nitro_kit 0.9.0 → 2.0.0.alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.agents/plugins/marketplace.json +20 -0
- data/CHANGELOG.md +172 -0
- data/LICENSE +28 -0
- data/README.md +22 -15
- data/STYLE_GUIDE.md +425 -0
- data/app/assets/stylesheets/nitro_kit-tailwind-v4.css +38 -0
- data/app/assets/stylesheets/nitro_kit.css +7239 -0
- data/app/components/nitro_kit/accordion.rb +125 -65
- data/app/components/nitro_kit/alert.rb +80 -43
- data/app/components/nitro_kit/app_navigation.rb +307 -0
- data/app/components/nitro_kit/app_shell.rb +227 -0
- data/app/components/nitro_kit/appearance_bootstrap.rb +146 -0
- data/app/components/nitro_kit/appearance_picker.rb +156 -0
- data/app/components/nitro_kit/auth_shell.rb +34 -0
- data/app/components/nitro_kit/avatar.rb +85 -29
- data/app/components/nitro_kit/avatar_stack.rb +155 -9
- data/app/components/nitro_kit/badge.rb +43 -81
- data/app/components/nitro_kit/button.rb +180 -103
- data/app/components/nitro_kit/button_group.rb +63 -11
- data/app/components/nitro_kit/button_to.rb +69 -0
- data/app/components/nitro_kit/card.rb +42 -45
- data/app/components/nitro_kit/checkbox.rb +115 -62
- data/app/components/nitro_kit/checkbox_group.rb +131 -22
- data/app/components/nitro_kit/choice.rb +55 -0
- data/app/components/nitro_kit/combobox.rb +292 -105
- data/app/components/nitro_kit/command_palette.rb +412 -0
- data/app/components/nitro_kit/component.rb +322 -46
- data/app/components/nitro_kit/container.rb +32 -0
- data/app/components/nitro_kit/control_group.rb +45 -0
- data/app/components/nitro_kit/danger_zone.rb +78 -0
- data/app/components/nitro_kit/data_section.rb +106 -0
- data/app/components/nitro_kit/details_table.rb +229 -0
- data/app/components/nitro_kit/dialog.rb +257 -83
- data/app/components/nitro_kit/dropdown.rb +335 -122
- data/app/components/nitro_kit/dropzone.rb +326 -0
- data/app/components/nitro_kit/empty_state.rb +99 -0
- data/app/components/nitro_kit/field.rb +461 -236
- data/app/components/nitro_kit/field_group.rb +15 -8
- data/app/components/nitro_kit/fieldset.rb +37 -39
- data/app/components/nitro_kit/flex.rb +49 -0
- data/app/components/nitro_kit/form_builder.rb +313 -72
- data/app/components/nitro_kit/form_section.rb +79 -0
- data/app/components/nitro_kit/grid.rb +34 -0
- data/app/components/nitro_kit/icon.rb +54 -25
- data/app/components/nitro_kit/input.rb +97 -10
- data/app/components/nitro_kit/label.rb +22 -6
- data/app/components/nitro_kit/layout_options.rb +7 -0
- data/app/components/nitro_kit/page_header.rb +76 -0
- data/app/components/nitro_kit/pagination.rb +355 -69
- data/app/components/nitro_kit/pagination_bar.rb +90 -0
- data/app/components/nitro_kit/progressive_image.rb +181 -0
- data/app/components/nitro_kit/radio_button.rb +77 -55
- data/app/components/nitro_kit/radio_button_group.rb +107 -36
- data/app/components/nitro_kit/responsive_value.rb +94 -0
- data/app/components/nitro_kit/rich_text_area.rb +31 -0
- data/app/components/nitro_kit/select.rb +129 -64
- data/app/components/nitro_kit/settings_layout.rb +152 -0
- data/app/components/nitro_kit/sheet.rb +202 -0
- data/app/components/nitro_kit/stat_grid.rb +75 -0
- data/app/components/nitro_kit/switch.rb +108 -51
- data/app/components/nitro_kit/table.rb +237 -45
- data/app/components/nitro_kit/tabs.rb +168 -63
- data/app/components/nitro_kit/textarea.rb +81 -10
- data/app/components/nitro_kit/toast.rb +211 -80
- data/app/components/nitro_kit/toolbar.rb +75 -0
- data/app/components/nitro_kit/tooltip.rb +235 -34
- data/app/components/nitro_kit/typeset.rb +28 -0
- data/app/javascript/controllers/nk/app_shell_controller.js +224 -0
- data/app/javascript/controllers/nk/appearance_controller.js +73 -0
- data/app/javascript/controllers/nk/avatar_controller.js +15 -0
- data/app/javascript/controllers/nk/button_controller.js +56 -0
- data/app/javascript/controllers/nk/checkable_controller.js +41 -0
- data/app/javascript/controllers/nk/combobox_controller.js +314 -82
- data/app/javascript/controllers/nk/command_palette_controller.js +249 -0
- data/app/javascript/controllers/nk/dialog_controller.js +14 -10
- data/app/javascript/controllers/nk/dropdown_controller.js +106 -58
- data/app/javascript/controllers/nk/dropzone/direct_upload.js +61 -0
- data/app/javascript/controllers/nk/dropzone/file_rules.js +77 -0
- data/app/javascript/controllers/nk/dropzone/form_submit_lock.js +30 -0
- data/app/javascript/controllers/nk/dropzone_controller.js +482 -0
- data/app/javascript/controllers/nk/overlay_position.js +37 -0
- data/app/javascript/controllers/nk/progressive_image_controller.js +116 -0
- data/app/javascript/controllers/nk/tabs_controller.js +135 -23
- data/app/javascript/controllers/nk/toast_controller.js +112 -45
- data/app/javascript/controllers/nk/tooltip_controller.js +12 -47
- data/config/importmap.rb +2 -0
- data/config/locales/en.yml +98 -0
- data/docs/agent_guide.md +139 -0
- data/docs/agent_native_spec.md +422 -0
- data/docs/component_contracts.md +263 -0
- data/docs/customization.md +595 -0
- data/docs/hotwire.md +94 -0
- data/docs/initialization_prompt.md +36 -0
- data/docs/migration_1_to_2.md +318 -0
- data/docs/new_app_strategy.md +22 -0
- data/docs/patterns/application_foundation.md +136 -0
- data/docs/patterns/crud_resource.md +144 -0
- data/docs/patterns/destructive_action.md +105 -0
- data/docs/patterns/flash_and_toast.md +57 -0
- data/docs/patterns/inline_edit.md +59 -0
- data/docs/patterns/queryable_collection.md +187 -0
- data/docs/patterns/resource_form.md +126 -0
- data/docs/rails_conventions.md +95 -0
- data/docs/rails_integration.md +514 -0
- data/lib/generators/nitro_kit/install_generator.rb +48 -0
- data/lib/generators/nitro_kit/upgrade_smoke_tests_generator.rb +67 -0
- data/lib/nitro_kit/engine.rb +20 -0
- data/lib/nitro_kit/installation.rb +671 -0
- data/lib/nitro_kit/migration_inventory.rb +345 -0
- data/lib/nitro_kit/upgrade_smoke_test.rb +403 -0
- data/lib/nitro_kit/version.rb +1 -1
- data/lib/nitro_kit.rb +5 -42
- data/lib/rails/commands/nitro_kit/nitro_kit_command.rb +42 -0
- data/lib/tasks/nitro_kit_tasks.rake +79 -4
- data/plugins/nitro-kit/.codex-plugin/plugin.json +28 -0
- data/plugins/nitro-kit/skills/nitro-kit-hotwire/SKILL.md +67 -0
- data/plugins/nitro-kit/skills/nitro-kit-hotwire/agents/openai.yaml +4 -0
- data/plugins/nitro-kit/skills/nitro-kit-rails/SKILL.md +60 -0
- data/plugins/nitro-kit/skills/nitro-kit-rails/agents/openai.yaml +4 -0
- data/plugins/nitro-kit/skills/nitro-kit-ui/SKILL.md +62 -0
- data/plugins/nitro-kit/skills/nitro-kit-ui/agents/openai.yaml +4 -0
- data/src/stylesheets/nitro_kit/components/accordion.css +119 -0
- data/src/stylesheets/nitro_kit/components/alert.css +82 -0
- data/src/stylesheets/nitro_kit/components/app_navigation.css +156 -0
- data/src/stylesheets/nitro_kit/components/app_shell.css +605 -0
- data/src/stylesheets/nitro_kit/components/appearance_picker.css +117 -0
- data/src/stylesheets/nitro_kit/components/auth_shell.css +8 -0
- data/src/stylesheets/nitro_kit/components/avatar.css +81 -0
- data/src/stylesheets/nitro_kit/components/avatar_stack.css +80 -0
- data/src/stylesheets/nitro_kit/components/badge.css +76 -0
- data/src/stylesheets/nitro_kit/components/button.css +283 -0
- data/src/stylesheets/nitro_kit/components/button_group.css +53 -0
- data/src/stylesheets/nitro_kit/components/button_to.css +6 -0
- data/src/stylesheets/nitro_kit/components/card.css +70 -0
- data/src/stylesheets/nitro_kit/components/checkbox.css +160 -0
- data/src/stylesheets/nitro_kit/components/checkbox_group.css +61 -0
- data/src/stylesheets/nitro_kit/components/combobox.css +148 -0
- data/src/stylesheets/nitro_kit/components/command_palette.css +255 -0
- data/src/stylesheets/nitro_kit/components/container.css +25 -0
- data/src/stylesheets/nitro_kit/components/control_group.css +149 -0
- data/src/stylesheets/nitro_kit/components/danger_zone.css +54 -0
- data/src/stylesheets/nitro_kit/components/data_section.css +40 -0
- data/src/stylesheets/nitro_kit/components/details_table.css +53 -0
- data/src/stylesheets/nitro_kit/components/dialog.css +80 -0
- data/src/stylesheets/nitro_kit/components/dropdown.css +152 -0
- data/src/stylesheets/nitro_kit/components/dropzone.css +198 -0
- data/src/stylesheets/nitro_kit/components/empty_state.css +53 -0
- data/src/stylesheets/nitro_kit/components/field.css +79 -0
- data/src/stylesheets/nitro_kit/components/field_group.css +6 -0
- data/src/stylesheets/nitro_kit/components/fieldset.css +28 -0
- data/src/stylesheets/nitro_kit/components/flex.css +455 -0
- data/src/stylesheets/nitro_kit/components/form_section.css +71 -0
- data/src/stylesheets/nitro_kit/components/grid.css +308 -0
- data/src/stylesheets/nitro_kit/components/icon.css +26 -0
- data/src/stylesheets/nitro_kit/components/input.css +80 -0
- data/src/stylesheets/nitro_kit/components/label.css +9 -0
- data/src/stylesheets/nitro_kit/components/layout.css +440 -0
- data/src/stylesheets/nitro_kit/components/page_header.css +61 -0
- data/src/stylesheets/nitro_kit/components/pagination.css +119 -0
- data/src/stylesheets/nitro_kit/components/pagination_bar.css +41 -0
- data/src/stylesheets/nitro_kit/components/palette.css +113 -0
- data/src/stylesheets/nitro_kit/components/progressive_image.css +139 -0
- data/src/stylesheets/nitro_kit/components/radio_button.css +127 -0
- data/src/stylesheets/nitro_kit/components/radio_button_group.css +143 -0
- data/src/stylesheets/nitro_kit/components/rich_text_area.css +21 -0
- data/src/stylesheets/nitro_kit/components/select.css +70 -0
- data/src/stylesheets/nitro_kit/components/settings_layout.css +100 -0
- data/src/stylesheets/nitro_kit/components/sheet.css +100 -0
- data/src/stylesheets/nitro_kit/components/stat_grid.css +51 -0
- data/src/stylesheets/nitro_kit/components/switch.css +152 -0
- data/src/stylesheets/nitro_kit/components/table.css +116 -0
- data/src/stylesheets/nitro_kit/components/tabs.css +138 -0
- data/src/stylesheets/nitro_kit/components/textarea.css +39 -0
- data/src/stylesheets/nitro_kit/components/toast.css +131 -0
- data/src/stylesheets/nitro_kit/components/toolbar.css +78 -0
- data/src/stylesheets/nitro_kit/components/tooltip.css +124 -0
- data/src/stylesheets/nitro_kit/components/typeset.css +191 -0
- data/src/stylesheets/nitro_kit/layers.css +7 -0
- data/src/stylesheets/nitro_kit/reset.css +192 -0
- data/src/stylesheets/nitro_kit/tokens.css +198 -0
- metadata +182 -51
- data/Rakefile +0 -8
- data/app/assets/tailwind/application.css +0 -49
- data/app/components/nitro_kit/datepicker.rb +0 -9
- data/app/helpers/nitro_kit/accordion_helper.rb +0 -9
- data/app/helpers/nitro_kit/alert_helper.rb +0 -11
- data/app/helpers/nitro_kit/avatar_helper.rb +0 -13
- data/app/helpers/nitro_kit/badge_helper.rb +0 -13
- data/app/helpers/nitro_kit/button_group_helper.rb +0 -9
- data/app/helpers/nitro_kit/button_helper.rb +0 -49
- data/app/helpers/nitro_kit/card_helper.rb +0 -9
- data/app/helpers/nitro_kit/checkbox_helper.rb +0 -50
- data/app/helpers/nitro_kit/combobox_helper.rb +0 -9
- data/app/helpers/nitro_kit/datepicker_helper.rb +0 -9
- data/app/helpers/nitro_kit/dialog_helper.rb +0 -9
- data/app/helpers/nitro_kit/dropdown_helper.rb +0 -9
- data/app/helpers/nitro_kit/field_group_helper.rb +0 -9
- data/app/helpers/nitro_kit/field_helper.rb +0 -9
- data/app/helpers/nitro_kit/fieldset_helper.rb +0 -9
- data/app/helpers/nitro_kit/form_helper.rb +0 -13
- data/app/helpers/nitro_kit/icon_helper.rb +0 -9
- data/app/helpers/nitro_kit/input_helper.rb +0 -37
- data/app/helpers/nitro_kit/label_helper.rb +0 -19
- data/app/helpers/nitro_kit/pagination_helper.rb +0 -46
- data/app/helpers/nitro_kit/radio_button_helper.rb +0 -23
- data/app/helpers/nitro_kit/select_helper.rb +0 -24
- data/app/helpers/nitro_kit/switch_helper.rb +0 -9
- data/app/helpers/nitro_kit/table_helper.rb +0 -9
- data/app/helpers/nitro_kit/tabs_helper.rb +0 -9
- data/app/helpers/nitro_kit/textarea_helper.rb +0 -9
- data/app/helpers/nitro_kit/toast_helper.rb +0 -25
- data/app/helpers/nitro_kit/tooltip_helper.rb +0 -9
- data/app/javascript/controllers/nk/accordion_controller.js +0 -18
- data/app/javascript/controllers/nk/datepicker_controller.js +0 -5
- data/app/javascript/controllers/nk/switch_controller.js +0 -32
- data/lib/generators/nitro_kit/component_generator.rb +0 -84
- data/lib/nitro_kit/schema_builder.rb +0 -129
- data/lib/nitro_kit/variants.rb +0 -21
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nitro-kit-rails
|
|
3
|
+
description: "Build or refactor Nitro Kit 2 Rails application features on one conventional path: REST noun resources, tenant-scoped records, rich domain models, state records, standard forms and responses, Minitest fixtures, and server-rendered HTML. Use for CRUD, authentication-adjacent application structure, teams or accounts, publication and other lifecycle state, controllers, models, routes, authorization boundaries, and tests in an application that uses Nitro Kit."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Nitro Kit Rails
|
|
7
|
+
|
|
8
|
+
Use the Rails conventions shipped with the application's installed Nitro Kit
|
|
9
|
+
version. Treat them as the greenfield default, not a reason to rewrite an
|
|
10
|
+
established application outside the requested scope.
|
|
11
|
+
|
|
12
|
+
## Load the installed path
|
|
13
|
+
|
|
14
|
+
1. Work from the Rails application root.
|
|
15
|
+
2. Confirm `nitro_kit` appears in `Gemfile.lock` at version 2.x.
|
|
16
|
+
3. Run `bundle show nitro_kit` and treat its output as `NITRO_KIT_ROOT`.
|
|
17
|
+
4. Read `NITRO_KIT_ROOT/docs/agent_guide.md` completely.
|
|
18
|
+
5. Read `NITRO_KIT_ROOT/docs/rails_conventions.md` completely.
|
|
19
|
+
6. For a complete product resource, read
|
|
20
|
+
`NITRO_KIT_ROOT/docs/patterns/crud_resource.md` completely.
|
|
21
|
+
7. For authentication, teams, application navigation, or settings, read
|
|
22
|
+
`NITRO_KIT_ROOT/docs/patterns/application_foundation.md` completely.
|
|
23
|
+
8. Read the matching Hotwire recipe before implementing an interaction.
|
|
24
|
+
|
|
25
|
+
Never use a Nitro Kit 1.x helper, copied component, controller, or Tailwind
|
|
26
|
+
contract as a substitute for the installed API.
|
|
27
|
+
|
|
28
|
+
## Follow the application grammar
|
|
29
|
+
|
|
30
|
+
- Scope tenant data through `Current.team` or `Current.account`; record
|
|
31
|
+
`Current.user` as the actor.
|
|
32
|
+
- Put domain behavior on the model before introducing another abstraction.
|
|
33
|
+
- Model meaningful lifecycle state as a record and expose it through a noun
|
|
34
|
+
resource instead of a custom controller verb.
|
|
35
|
+
- Keep controllers focused on scoped loading, one domain operation, and one
|
|
36
|
+
conventional response.
|
|
37
|
+
- Use Rails `form_with` with `NitroKit::FormBuilder`.
|
|
38
|
+
- In an existing application, replace a form control only when Nitro Kit has a
|
|
39
|
+
genuine semantic and behavioral equivalent. Otherwise preserve it as
|
|
40
|
+
application-owned Rails and semantic HTML, including its names, values,
|
|
41
|
+
errors, accessibility, uploads, and browser behavior. Do not retain copied
|
|
42
|
+
Nitro Kit 1.x source as the fallback.
|
|
43
|
+
- Redirect successful mutations with `303`; render invalid models with `422`.
|
|
44
|
+
- Render HTML on the server and add Hotwire progressively.
|
|
45
|
+
- Test with Minitest and fixtures, including tenancy and unhappy paths.
|
|
46
|
+
- In authenticated admin areas, default to a hybrid `AppShell` with the route's
|
|
47
|
+
one `h1` and basic actions in its `Toolbar`. Keep one page gutter and avoid
|
|
48
|
+
repeated headings or automatic Card wrappers.
|
|
49
|
+
- In a new team-aware application, create the first user's `Team` and owner
|
|
50
|
+
`Membership` together. Put roles on memberships and scope product records
|
|
51
|
+
through `Current.team`.
|
|
52
|
+
|
|
53
|
+
Preserve a clear ownership boundary: Rails owns product policy and records;
|
|
54
|
+
Nitro Kit owns component contracts and focused progressive behavior.
|
|
55
|
+
|
|
56
|
+
## Verify
|
|
57
|
+
|
|
58
|
+
Run focused model and request tests first. Add a system test only where browser
|
|
59
|
+
behavior is part of the contract. Assert status, visibility, authorization,
|
|
60
|
+
and stable DOM boundaries rather than implementation trivia.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nitro-kit-ui
|
|
3
|
+
description: Build or refactor Rails interfaces with Nitro Kit 2's Phlex components, layouts, blocks, FormBuilder, and theme tokens. Use when an application has nitro_kit 2.x in its bundle, mentions Nitro Kit, or asks for a Rails interface that should follow the installed component contract instead of Nitro Kit 1.x helpers, custom markup, CSS overrides, or copied component code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Nitro Kit UI
|
|
7
|
+
|
|
8
|
+
Use the documentation shipped with the application's installed gem as the source of truth. Compose application-owned product UI from gem-owned components.
|
|
9
|
+
|
|
10
|
+
## Load the matching contract
|
|
11
|
+
|
|
12
|
+
1. Work from the Rails application root.
|
|
13
|
+
2. Confirm `nitro_kit` appears in `Gemfile.lock`.
|
|
14
|
+
3. Run `bundle show nitro_kit` and treat its output as `NITRO_KIT_ROOT`.
|
|
15
|
+
4. Read `NITRO_KIT_ROOT/docs/agent_guide.md` completely.
|
|
16
|
+
5. Read the relevant sections of `NITRO_KIT_ROOT/docs/component_contracts.md`. Read `customization.md` only for themes, tokens, or application composition.
|
|
17
|
+
6. Inspect the installed component source when constructor or compound-slot details remain unclear. Never guess a component API from memory.
|
|
18
|
+
|
|
19
|
+
For a Nitro Kit 1.x migration, read
|
|
20
|
+
`NITRO_KIT_ROOT/docs/migration_1_to_2.md` before editing. Inventory product
|
|
21
|
+
flows and behavior first. If the Nitro Kit MCP catalog is available, search it
|
|
22
|
+
by workflow rather than old component name, then select high-level
|
|
23
|
+
compositions before replacing atoms.
|
|
24
|
+
|
|
25
|
+
If the gem is not installed, say that the skill requires Nitro Kit and follow the application's requested installation scope. Do not substitute APIs from an older Nitro Kit release.
|
|
26
|
+
|
|
27
|
+
## Build the interface
|
|
28
|
+
|
|
29
|
+
1. Reuse the highest-level Nitro block that matches the page region, then compose components inside it.
|
|
30
|
+
2. Include `NitroKit` once in the application's base Phlex component and use capitalized Kit methods such as `Button(...)` and `Card(...)`. Use `.new` only when another API needs a component object. Keep product-specific components under the application's namespace, commonly `UI::*`.
|
|
31
|
+
3. Use `NitroKit::FormBuilder` explicitly with Rails `form_with` for model-backed forms.
|
|
32
|
+
4. Keep routes, authorization, records, query policy, DOM IDs, Turbo boundaries, and response semantics in the application.
|
|
33
|
+
5. Use documented `--nk-*` properties for theming and Nitro layout primitives for layout.
|
|
34
|
+
6. Verify closed options and required compound declarations before rendering.
|
|
35
|
+
7. For authenticated CRUD, prefer a hybrid `AppShell` with a `Toolbar` that
|
|
36
|
+
owns the route's single `h1` and basic actions. The shell main region owns
|
|
37
|
+
one content gutter. Do not repeat that heading in `PageHeader`, or wrap each
|
|
38
|
+
table, form, and detail region in another Card.
|
|
39
|
+
8. For team administration and account settings, read
|
|
40
|
+
`docs/patterns/application_foundation.md`. Put Settings after an
|
|
41
|
+
`AppNavigation` spacer and use `SettingsLayout` with plain `FormSection`
|
|
42
|
+
regions instead of a stack of Cards.
|
|
43
|
+
|
|
44
|
+
## Preserve the boundary
|
|
45
|
+
|
|
46
|
+
- Do not copy Nitro components into the application.
|
|
47
|
+
- During migration, replace an existing control only when the installed catalog
|
|
48
|
+
provides a genuine semantic and behavioral equivalent. Otherwise keep or
|
|
49
|
+
re-express it as application-owned Rails and semantic HTML, optionally inside
|
|
50
|
+
a custom `form.field` composition. Preserve names, IDs, values, errors,
|
|
51
|
+
accessibility, uploads, and browser behavior; report the missing equivalent
|
|
52
|
+
as a Nitro Kit coverage gap.
|
|
53
|
+
- Never downgrade a specialized control to a generic Nitro control for visual
|
|
54
|
+
consistency, and never retain copied Nitro Kit 1.x source as the fallback.
|
|
55
|
+
- Do not introduce `nk_*` helpers, a general ERB bridge, or generated variant helpers.
|
|
56
|
+
- Do not pass `class:` or `style:`. Prefer component options, composition, or theme tokens. Use `desperately_need_a_class:` only for a genuine external integration boundary.
|
|
57
|
+
- Do not add application-specific behavior to Nitro-owned Stimulus controllers.
|
|
58
|
+
- Do not recreate a Nitro component with raw HTML unless the installed catalog cannot express the semantics.
|
|
59
|
+
|
|
60
|
+
## Verify
|
|
61
|
+
|
|
62
|
+
Run the smallest relevant application tests. For component rendering, assert semantic elements and owned `data-nk` or slot attributes rather than private implementation helpers. Exercise invalid and empty states when the UI accepts user input or collections.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
@layer nitro-kit.base {
|
|
2
|
+
:where([data-nk="accordion"]) {
|
|
3
|
+
inline-size: 100%;
|
|
4
|
+
color: var(--nk-color-foreground);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:where([data-nk="accordion"] > [data-slot="accordion-item"]) {
|
|
8
|
+
border-block-end: var(--nk-border-width) solid var(--nk-color-border);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:where([data-nk="accordion"] > [data-slot="accordion-item"]:first-child) {
|
|
12
|
+
border-block-start: var(--nk-border-width) solid var(--nk-color-border);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:where(
|
|
16
|
+
[data-nk="accordion"]
|
|
17
|
+
> [data-slot="accordion-item"]
|
|
18
|
+
> [data-slot="accordion-trigger"]
|
|
19
|
+
) {
|
|
20
|
+
display: flex;
|
|
21
|
+
width: 100%;
|
|
22
|
+
min-height: 2.75rem;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
gap: calc(var(--nk-space) * 3);
|
|
26
|
+
padding: calc(var(--nk-space) * 3) 0;
|
|
27
|
+
font: inherit;
|
|
28
|
+
font-weight: var(--nk-font-weight-medium);
|
|
29
|
+
color: inherit;
|
|
30
|
+
text-align: start;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
background: transparent;
|
|
33
|
+
border: 0;
|
|
34
|
+
list-style: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:where(
|
|
38
|
+
[data-nk="accordion"]
|
|
39
|
+
> [data-slot="accordion-item"]
|
|
40
|
+
> [data-slot="accordion-trigger"]
|
|
41
|
+
)::-webkit-details-marker {
|
|
42
|
+
display: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:where(
|
|
46
|
+
[data-nk="accordion"]
|
|
47
|
+
> [data-slot="accordion-item"]
|
|
48
|
+
> [data-slot="accordion-trigger"]
|
|
49
|
+
> [data-slot="accordion-label"]
|
|
50
|
+
) {
|
|
51
|
+
flex: 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:where(
|
|
55
|
+
[data-nk="accordion"]
|
|
56
|
+
> [data-slot="accordion-item"]
|
|
57
|
+
> [data-slot="accordion-trigger"]
|
|
58
|
+
> [data-slot="accordion-icon"]
|
|
59
|
+
) {
|
|
60
|
+
flex: none;
|
|
61
|
+
width: 1rem;
|
|
62
|
+
height: 1rem;
|
|
63
|
+
color: var(--nk-color-muted-foreground);
|
|
64
|
+
transition:
|
|
65
|
+
color var(--nk-duration-fast) var(--nk-ease),
|
|
66
|
+
transform var(--nk-duration-fast) var(--nk-ease);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:where(
|
|
70
|
+
[data-nk="accordion"]
|
|
71
|
+
> [data-slot="accordion-item"][open]
|
|
72
|
+
> [data-slot="accordion-trigger"]
|
|
73
|
+
> [data-slot="accordion-icon"]
|
|
74
|
+
) {
|
|
75
|
+
transform: rotate(180deg);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:where(
|
|
79
|
+
[data-nk="accordion"]
|
|
80
|
+
> [data-slot="accordion-item"]
|
|
81
|
+
> [data-slot="accordion-content"]
|
|
82
|
+
) {
|
|
83
|
+
padding-block-end: calc(var(--nk-space) * 4);
|
|
84
|
+
line-height: var(--nk-leading-normal);
|
|
85
|
+
color: var(--nk-color-muted-foreground);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@layer nitro-kit.state {
|
|
90
|
+
@media (hover: hover) {
|
|
91
|
+
:where(
|
|
92
|
+
[data-nk="accordion"]
|
|
93
|
+
> [data-slot="accordion-item"]
|
|
94
|
+
> [data-slot="accordion-trigger"]:hover
|
|
95
|
+
) {
|
|
96
|
+
color: var(--nk-color-primary);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
:where(
|
|
101
|
+
[data-nk="accordion"]
|
|
102
|
+
> [data-slot="accordion-item"]
|
|
103
|
+
> [data-slot="accordion-trigger"]:focus-visible
|
|
104
|
+
) {
|
|
105
|
+
outline: var(--nk-focus-width) solid var(--nk-color-focus);
|
|
106
|
+
outline-offset: var(--nk-focus-offset);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@media (prefers-reduced-motion: reduce) {
|
|
110
|
+
:where(
|
|
111
|
+
[data-nk="accordion"]
|
|
112
|
+
> [data-slot="accordion-item"]
|
|
113
|
+
> [data-slot="accordion-trigger"]
|
|
114
|
+
> [data-slot="accordion-icon"]
|
|
115
|
+
) {
|
|
116
|
+
transition-duration: 0.01ms;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
@layer nitro-kit.base {
|
|
2
|
+
:where([data-nk="alert"]) {
|
|
3
|
+
--_nk-alert-background: var(--nk-color-surface);
|
|
4
|
+
--_nk-alert-border: var(--nk-color-border);
|
|
5
|
+
--_nk-alert-foreground: var(--nk-color-foreground);
|
|
6
|
+
--_nk-alert-tint-strength: 12%;
|
|
7
|
+
|
|
8
|
+
position: relative;
|
|
9
|
+
display: grid;
|
|
10
|
+
width: 100%;
|
|
11
|
+
gap: calc(var(--nk-space) * 2);
|
|
12
|
+
padding: calc(var(--nk-space) * 4);
|
|
13
|
+
font-size: var(--nk-text-sm);
|
|
14
|
+
line-height: var(--nk-leading-normal);
|
|
15
|
+
color: var(--_nk-alert-foreground);
|
|
16
|
+
background-color: var(--_nk-alert-background);
|
|
17
|
+
border-width: var(--nk-border-width);
|
|
18
|
+
border-color: var(--_nk-alert-border);
|
|
19
|
+
border-radius: var(--nk-radius-lg);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:where([data-nk="alert"] > [data-slot="alert-title"]) {
|
|
23
|
+
font-size: var(--nk-text-base);
|
|
24
|
+
font-weight: var(--nk-font-weight-semibold);
|
|
25
|
+
line-height: var(--nk-leading-tight);
|
|
26
|
+
text-wrap: balance;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:where([data-nk="alert"]:has(> [data-slot="alert-icon"])) {
|
|
30
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:where([data-nk="alert"] > [data-slot="alert-icon"]) {
|
|
34
|
+
grid-row: 1 / -1;
|
|
35
|
+
width: 1.25rem;
|
|
36
|
+
height: 1.25rem;
|
|
37
|
+
margin-block-start: 0.0625rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:where(
|
|
41
|
+
[data-nk="alert"]:has(> [data-slot="alert-icon"])
|
|
42
|
+
> [data-slot="alert-title"],
|
|
43
|
+
[data-nk="alert"]:has(> [data-slot="alert-icon"])
|
|
44
|
+
> [data-slot="alert-description"]
|
|
45
|
+
) {
|
|
46
|
+
grid-column: 2;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:where([data-nk="alert"] > [data-slot="alert-description"]) {
|
|
50
|
+
max-width: var(--nk-content-lg);
|
|
51
|
+
color: var(--_nk-alert-foreground);
|
|
52
|
+
text-wrap: pretty;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@layer nitro-kit.variant {
|
|
57
|
+
:where([data-nk="alert"][data-variant]) {
|
|
58
|
+
--_nk-alert-background: color-mix(
|
|
59
|
+
in oklab,
|
|
60
|
+
var(--_nk-palette-tint) var(--_nk-alert-tint-strength),
|
|
61
|
+
transparent
|
|
62
|
+
);
|
|
63
|
+
--_nk-alert-border: color-mix(
|
|
64
|
+
in oklab,
|
|
65
|
+
var(--_nk-palette-tint) 45%,
|
|
66
|
+
transparent
|
|
67
|
+
);
|
|
68
|
+
--_nk-alert-foreground: var(--_nk-palette-light);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:where([data-theme="dark"] [data-nk="alert"][data-variant]) {
|
|
72
|
+
--_nk-alert-foreground: var(--_nk-palette-dark);
|
|
73
|
+
--_nk-alert-tint-strength: 20%;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@media (prefers-color-scheme: dark) {
|
|
77
|
+
:where(:root:not([data-theme]) [data-nk="alert"][data-variant]) {
|
|
78
|
+
--_nk-alert-foreground: var(--_nk-palette-dark);
|
|
79
|
+
--_nk-alert-tint-strength: 20%;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
@layer nitro-kit.base {
|
|
2
|
+
:where([data-nk="app-navigation"]) {
|
|
3
|
+
--_nk-app-navigation-inset: calc(var(--nk-space) * 3);
|
|
4
|
+
|
|
5
|
+
display: flex;
|
|
6
|
+
flex: 1 1 auto;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
min-inline-size: 0;
|
|
9
|
+
min-block-size: 0;
|
|
10
|
+
color: var(--nk-app-shell-sidebar-foreground);
|
|
11
|
+
font-size: var(--nk-text-sm);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:where(
|
|
15
|
+
[data-nk="app-navigation"] > [data-slot="app-navigation-header"],
|
|
16
|
+
[data-nk="app-navigation"] > [data-slot="app-navigation-footer"]
|
|
17
|
+
) {
|
|
18
|
+
flex: 0 0 auto;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:where([data-nk="app-navigation"] > [data-slot="app-navigation-header"]) {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
min-block-size: var(--nk-app-shell-topbar-height);
|
|
25
|
+
padding-inline: calc(var(--nk-space) * 6);
|
|
26
|
+
border-block-end: var(--nk-border-width) solid var(--nk-app-shell-border);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:where([data-nk="app-navigation"] > [data-slot="app-navigation-footer"]) {
|
|
30
|
+
padding: calc(var(--nk-space) * 3);
|
|
31
|
+
border-block-start: var(--nk-border-width) solid var(--nk-app-shell-border);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:where([data-nk="app-navigation"] > [data-slot="app-navigation-body"]) {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex: 1 1 auto;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: var(--nk-space);
|
|
39
|
+
min-block-size: 0;
|
|
40
|
+
padding: var(--_nk-app-navigation-inset);
|
|
41
|
+
overflow: auto;
|
|
42
|
+
overscroll-behavior: contain;
|
|
43
|
+
scrollbar-gutter: stable;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:where(
|
|
47
|
+
[data-nk="app-navigation"] [data-slot="app-navigation-section"],
|
|
48
|
+
[data-nk="app-navigation"] [data-slot="app-navigation-section-list"]
|
|
49
|
+
) {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex: 0 0 auto;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
gap: var(--nk-space);
|
|
54
|
+
min-inline-size: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:where(
|
|
58
|
+
[data-nk="app-navigation"] [data-slot="app-navigation-section-label"]
|
|
59
|
+
) {
|
|
60
|
+
display: block;
|
|
61
|
+
margin: calc(var(--nk-space) * 4) calc(var(--nk-space) * 2) var(--nk-space);
|
|
62
|
+
color: var(--nk-color-muted-foreground);
|
|
63
|
+
font-size: var(--nk-text-xs);
|
|
64
|
+
font-weight: var(--nk-font-weight-semibold);
|
|
65
|
+
line-height: var(--nk-leading-tight);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:where([data-nk="app-navigation"] [data-slot="app-navigation-item"]) {
|
|
69
|
+
flex: 0 0 auto;
|
|
70
|
+
min-inline-size: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:where([data-nk="app-navigation"] [data-slot="app-navigation-item-link"]) {
|
|
74
|
+
display: flex;
|
|
75
|
+
gap: calc(var(--nk-space) * 2);
|
|
76
|
+
align-items: center;
|
|
77
|
+
min-block-size: var(--nk-control-height-md);
|
|
78
|
+
padding: calc(var(--nk-space) * 2) calc(var(--nk-space) * 3);
|
|
79
|
+
color: inherit;
|
|
80
|
+
font-weight: var(--nk-font-weight-medium);
|
|
81
|
+
line-height: var(--nk-leading-tight);
|
|
82
|
+
text-decoration: none;
|
|
83
|
+
border-radius: var(--nk-radius-md);
|
|
84
|
+
transition:
|
|
85
|
+
color var(--nk-duration-normal) var(--nk-ease),
|
|
86
|
+
background-color var(--nk-duration-normal) var(--nk-ease);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:where([data-nk="app-navigation"] [data-slot="app-navigation-item-label"]) {
|
|
90
|
+
flex: 1 1 auto;
|
|
91
|
+
min-inline-size: 0;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
text-overflow: ellipsis;
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:where(
|
|
98
|
+
[data-nk="app-navigation"] [data-slot="app-navigation-item-icon"],
|
|
99
|
+
[data-nk="app-navigation"] [data-slot="app-navigation-item-badge"]
|
|
100
|
+
) {
|
|
101
|
+
flex: 0 0 auto;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
:where([data-nk="app-navigation"] [data-slot="app-navigation-item-badge"]) {
|
|
105
|
+
margin-inline-start: auto;
|
|
106
|
+
font-variant-numeric: tabular-nums;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:where([data-nk="app-navigation"] [data-slot="app-navigation-divider"]) {
|
|
110
|
+
flex: 0 0 auto;
|
|
111
|
+
display: block;
|
|
112
|
+
block-size: var(--nk-border-width);
|
|
113
|
+
margin-block: calc(var(--nk-space) * 2);
|
|
114
|
+
margin-inline: calc(var(--_nk-app-navigation-inset) * -1);
|
|
115
|
+
background: var(--nk-app-shell-border);
|
|
116
|
+
border: 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
:where([data-nk="app-navigation"] [data-slot="app-navigation-spacer"]) {
|
|
120
|
+
flex: 1 1 calc(var(--nk-space) * 4);
|
|
121
|
+
min-block-size: calc(var(--nk-space) * 4);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@layer nitro-kit.state {
|
|
126
|
+
:where(
|
|
127
|
+
[data-nk="app-navigation"]
|
|
128
|
+
[data-slot="app-navigation-item-link"][data-state="current"]
|
|
129
|
+
) {
|
|
130
|
+
color: var(--nk-app-shell-sidebar-accent-foreground);
|
|
131
|
+
background: var(--nk-app-shell-sidebar-accent);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@media (hover: hover) {
|
|
135
|
+
:where(
|
|
136
|
+
[data-nk="app-navigation"] [data-slot="app-navigation-item-link"]:hover
|
|
137
|
+
) {
|
|
138
|
+
color: var(--nk-app-shell-sidebar-accent-foreground);
|
|
139
|
+
background: var(--nk-app-shell-sidebar-accent);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
:where(
|
|
144
|
+
[data-nk="app-navigation"]
|
|
145
|
+
[data-slot="app-navigation-item-link"]:focus-visible
|
|
146
|
+
) {
|
|
147
|
+
outline: var(--nk-focus-width) solid var(--nk-color-focus);
|
|
148
|
+
outline-offset: calc(var(--nk-focus-offset) * -1);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@media (prefers-reduced-motion: reduce) {
|
|
152
|
+
:where([data-nk="app-navigation"] [data-slot="app-navigation-item-link"]) {
|
|
153
|
+
transition-duration: 0.01ms;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|