discourse/app/assets/stylesheets/mobile
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
..
components A11Y: remove heading tags from usercards (#27926) 2024-07-16 12:32:53 -04:00
float-kit UX: Chat mobile menu styling update (#27598) 2024-07-04 18:02:30 +02:00
form-kit DEV: form-kit 2024-07-17 11:59:35 +02:00
select-kit DEV: Use css var font sizes (#18518) 2022-10-12 15:31:59 +02:00
_index.scss FEATURE: the ability to change the order of flags (#27269) 2024-06-05 13:27:06 +10:00
admin_badges.scss DEV: form-kit 2024-07-17 11:59:35 +02:00
admin_customize.scss DEV: Clean up some styles (#14374) 2021-09-20 09:52:03 -04:00
admin_flags.scss FEATURE: created edit and delete flags (#27484) 2024-07-03 08:45:37 +10:00
admin_report_counters.scss
admin_report_table.scss DEV: Use css var font sizes (#18518) 2022-10-12 15:31:59 +02:00
admin_report.scss
admin_reports.scss
alert.scss DEV: remove old bootstrap alert CSS (#25991) 2024-03-01 16:03:34 -05:00
compose.scss UX: Hide the error tooltip when focusing the topic title (#27531) 2024-06-19 11:55:29 -03:00
dashboard.scss DEV: remove various unused CSS (#25994) 2024-03-01 16:51:26 -05:00
dialog.scss FIX: Modals on Android when keyboard is visible (#24442) 2023-11-20 11:56:06 -05:00
directory.scss DEV: remove various unused CSS (#25994) 2024-03-01 16:51:26 -05:00
discourse.scss Revert "UX: Make input sizing consistent across all browsers (#26159)" (#26295) 2024-03-21 17:54:11 +00:00
edit-category.scss DEV: Use css var font sizes (#18518) 2022-10-12 15:31:59 +02:00
emoji.scss UX: Larger images in mobile emoji picker (#17013) 2022-06-07 12:00:09 -04:00
header.scss DEV: Convert header to glimmer (#25214) 2024-02-23 11:08:15 -07:00
invite-signup.scss DEV: update classes, remove unused CSS (#25825) 2024-02-23 09:14:37 -05:00
lightbox.scss FEATURE: automatic dark mode (#10341) 2020-08-03 22:57:10 -04:00
login-modal.scss UX: Modal mobile fixes (#25788) 2024-02-21 13:49:42 +01:00
menu-panel.scss UX: Increase spacing mobile menus (#27554) 2024-06-21 17:05:19 +02:00
modal-overrides.scss UX: improves modal on mobile (#26055) 2024-03-22 16:29:32 +01:00
modal.scss DEV: remove bootbox dependency (#27443) 2024-06-12 15:56:17 +08:00
new-user.scss DEV: remove old and experimental user menu styles (#21326) 2023-05-02 15:07:42 -04:00
personal-message.scss UX: adjust pm styles to enbubble controls (#24996) 2023-12-22 14:28:02 -05:00
post-action-feedback.scss FIX: allow styling of feedback on mobile (#25072) 2023-12-30 08:57:16 +11:00
push-notifications-mobile.scss
reviewables.scss UX/DEV: Review queue redesign fixes (#20239) 2023-03-02 16:40:53 +01:00
sidebar.scss UX: Increase spacing mobile menus (#27554) 2024-06-21 17:05:19 +02:00
topic-list.scss UX: remove default use of quaternary color, update nav pill styles (#27502) 2024-06-24 09:54:34 -04:00
topic-post.scss UX: fix mobile read state alignment (#27323) 2024-06-04 09:40:41 -04:00
topic.scss DEV: Refactor topic admin menu to use <DMenu> (#26678) 2024-04-29 12:44:38 -03:00
user.scss FEATURE: add chat direct message button to user profile (#26135) 2024-03-18 11:17:37 +08:00