discourse/plugins/styleguide/config/locales
chapoi 2ca06ba236
DEV: form-kit
This PR introduces FormKit, a component-based form library designed to simplify form creation and management. This library provides a single `Form` component, various field components, controls, validation mechanisms, and customization options. Additionally, it includes helpers to facilitate testing and writing specifications for forms.

1. **Form Component**:
   - The main component that encapsulates form logic and structure.
   - Yields various utilities like `Field`, `Submit`, `Alert`, etc.

   **Example Usage**:
   ```gjs
   import Form from "discourse/form";

   <template>
     <Form as |form|>
       <form.Field
         @name="username"
         @title="Username"
         @validation="required"
         as |field|
       >
         <field.Input />
       </form.Field>

       <form.Field @name="age" @title="Age" as |field|>
         <field.Input @type="number" />
       </form.Field>

       <form.Submit />
     </Form>
   </template>
   ```

2. **Validation**:
   - Built-in validation rules such as `required`, `number`, `length`, and `url`.
   - Custom validation callbacks for more complex validation logic.

   **Example Usage**:
   ```javascript
   validateUsername(name, value, data, { addError }) {
     if (data.bar / 2 === value) {
       addError(name, "That's not how maths work.");
     }
   }
   ```

   ```hbs
   <form.Field @name="username" @validate={{this.validateUsername}} />
   ```

3. **Customization**:
   - Plugin outlets for extending form functionality.
   - Styling capabilities through propagated attributes.
   - Custom controls with properties provided by `form` and `field`.

   **Example Usage**:
   ```hbs
   <Form class="my-form" as |form|>
     <form.Field class="my-field" as |field|>
       <MyCustomControl id={{field.id}} @onChange={{field.set}} />
     </form.Field>
   </Form>
   ```

4. **Helpers for Testing**:
   - Test assertions for form and field validation.

   **Example usage**:
   ```javascript
   assert.form().hasErrors("the form shows errors");
   assert.form().field("foo").hasValue("bar", "user has set the value");
   ```

   - Helper for interacting with he form

   **Example usage**:
   ```javascript
   await formKit().field("foo").fillIn("bar");
   ```

5. **Page Object for System Specs**:
   - Page objects for interacting with forms in system specs.
   - Methods for submitting forms, checking alerts, and interacting with fields.

   **Example Usage**:
   ```ruby
   form = PageObjects::Components::FormKit.new(".my-form")
   form.submit
   expect(form).to have_an_alert("message")
   ```

   **Field Interactions**:
   ```ruby
   field = form.field("foo")
   expect(field).to have_value("bar")
   field.fill_in("bar")
   ```


6. **Collections handling**:
   - A specific component to handle array of objects

   **Example Usage**:
   ```gjs
    <Form @data={{hash foo=(array (hash bar=1) (hash bar=2))}} as |form|>
      <form.Collection @name="foo" as |collection|>
        <collection.Field @name="bar" @title="Bar" as |field|>
          <field.Input />
        </collection.Field>
      </form.Collection>
    </Form>
   ```
2024-07-17 11:59:35 +02:00
..
client.ar.yml Update translations (#25185) 2024-01-09 15:09:36 +01:00
client.be.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.bg.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.bs_BA.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.ca.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.cs.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.da.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.de.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
client.el.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.en_GB.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
client.en.yml DEV: form-kit 2024-07-17 11:59:35 +02:00
client.es.yml Update translations (#25185) 2024-01-09 15:09:36 +01:00
client.et.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.fa_IR.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.fi.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
client.fr.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
client.gl.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.he.yml Update translations (#24599) 2023-11-29 10:41:27 +01:00
client.hr.yml Update translations (#25185) 2024-01-09 15:09:36 +01:00
client.hu.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.hy.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.id.yml Update translations (#23873) 2023-10-11 11:18:02 +02:00
client.it.yml Update translations (#25185) 2024-01-09 15:09:36 +01:00
client.ja.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
client.ko.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.lt.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.lv.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.nb_NO.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.nl.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
client.pl_PL.yml Update translations (#25386) 2024-01-23 18:29:34 +01:00
client.pt_BR.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
client.pt.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.ro.yml Update translations (#24599) 2023-11-29 10:41:27 +01:00
client.ru.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
client.sk.yml Update translations (#25185) 2024-01-09 15:09:36 +01:00
client.sl.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.sq.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.sr.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.sv.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
client.sw.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.te.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.th.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.tr_TR.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
client.ug.yml FEATURE: Add Uyghur language (#27183) 2024-05-27 09:58:18 +02:00
client.uk.yml Update translations (#24716) 2023-12-05 14:39:08 +01:00
client.ur.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.vi.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
client.zh_CN.yml Update translations (#25185) 2024-01-09 15:09:36 +01:00
client.zh_TW.yml Update translations (#23627) 2023-09-27 11:03:00 +02:00
server.ar.yml Update translations (#25579) 2024-02-06 22:35:44 +01:00
server.be.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00
server.bg.yml Update translations (#13796) 2021-07-21 10:30:34 +02:00
server.bs_BA.yml Update translations (#18183) 2022-09-13 16:04:18 +02:00
server.ca.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00
server.cs.yml Update translations (#23538) 2023-09-12 15:27:48 +02:00
server.da.yml Update translations (#13796) 2021-07-21 10:30:34 +02:00
server.de.yml Update translations (#25386) 2024-01-23 18:29:34 +01:00
server.el.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00
server.en_GB.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00
server.en.yml DEV: Move core plugin TL -> group settings (#25355) 2024-01-23 11:35:14 +10:00
server.es.yml Update translations (#13796) 2021-07-21 10:30:34 +02:00
server.et.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00
server.fa_IR.yml Update translations (#14970) 2021-11-16 16:17:10 +01:00
server.fi.yml Update translations (#13796) 2021-07-21 10:30:34 +02:00
server.fr.yml Update translations (#13796) 2021-07-21 10:30:34 +02:00
server.gl.yml Update translations (#13796) 2021-07-21 10:30:34 +02:00
server.he.yml Update translations (#25476) 2024-01-30 17:05:37 +01:00
server.hr.yml FEATURE: Add Croatian language (#17130) 2022-06-18 00:18:22 +02:00
server.hu.yml Update translations (#13796) 2021-07-21 10:30:34 +02:00
server.hy.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00
server.id.yml Update translations (#16456) 2022-04-12 21:04:30 +02:00
server.it.yml Update translations (#13796) 2021-07-21 10:30:34 +02:00
server.ja.yml Update translations (#13796) 2021-07-21 10:30:34 +02:00
server.ko.yml Update translations (#13796) 2021-07-21 10:30:34 +02:00
server.lt.yml Update translations (#14579) 2021-10-12 16:00:22 +02:00
server.lv.yml Update translations (#14063) 2021-08-24 15:25:44 +02:00
server.nb_NO.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00
server.nl.yml Update translations (#25579) 2024-02-06 22:35:44 +01:00
server.pl_PL.yml Update translations (#26030) 2024-03-05 16:47:46 +01:00
server.pt_BR.yml Update translations (#25579) 2024-02-06 22:35:44 +01:00
server.pt.yml Update translations (#13796) 2021-07-21 10:30:34 +02:00
server.ro.yml Update translations (#13796) 2021-07-21 10:30:34 +02:00
server.ru.yml Update translations (#20671) 2023-03-14 15:04:54 +01:00
server.sk.yml Update translations (#26136) 2024-03-12 15:40:11 +01:00
server.sl.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00
server.sq.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00
server.sr.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00
server.sv.yml Update translations (#25476) 2024-01-30 17:05:37 +01:00
server.sw.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00
server.te.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00
server.th.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00
server.tr_TR.yml Update translations (#25659) 2024-02-13 16:11:30 +01:00
server.ug.yml FEATURE: Add Uyghur language (#27183) 2024-05-27 09:58:18 +02:00
server.uk.yml Update translations (#25476) 2024-01-30 17:05:37 +01:00
server.ur.yml Update translations (#13796) 2021-07-21 10:30:34 +02:00
server.vi.yml Update translations (#16505) 2022-04-19 15:45:09 +02:00
server.zh_CN.yml Update translations (#25579) 2024-02-06 22:35:44 +01:00
server.zh_TW.yml Update translations (#12019) 2021-02-09 14:56:15 +01:00