@toyu-ui/elements 0.1.0

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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +79 -0
  3. package/button/tyui-button.d.ts +27 -0
  4. package/button.d.ts +1 -0
  5. package/button.js +339 -0
  6. package/center/tyui-center.d.ts +13 -0
  7. package/center.d.ts +1 -0
  8. package/center.js +39 -0
  9. package/checkbox/tyui-checkbox.d.ts +25 -0
  10. package/checkbox.d.ts +1 -0
  11. package/checkbox.js +288 -0
  12. package/cluster/tyui-cluster.d.ts +16 -0
  13. package/cluster.d.ts +1 -0
  14. package/cluster.js +53 -0
  15. package/container/tyui-container.d.ts +14 -0
  16. package/container.d.ts +1 -0
  17. package/container.js +44 -0
  18. package/custom-elements.json +1651 -0
  19. package/flex/tyui-flex.d.ts +22 -0
  20. package/flex.d.ts +1 -0
  21. package/flex.js +66 -0
  22. package/frame/tyui-frame.d.ts +13 -0
  23. package/frame.d.ts +1 -0
  24. package/frame.js +35 -0
  25. package/grid/tyui-grid.d.ts +20 -0
  26. package/grid.d.ts +1 -0
  27. package/grid.js +59 -0
  28. package/index.d.ts +12 -0
  29. package/index.js +26 -0
  30. package/input/tyui-input.d.ts +40 -0
  31. package/input.d.ts +1 -0
  32. package/input.js +345 -0
  33. package/layout/layout-helpers.d.ts +9 -0
  34. package/layout-helpers-C2WgKm6F.js +171 -0
  35. package/package.json +91 -0
  36. package/radio/tyui-radio.d.ts +21 -0
  37. package/radio-group/tyui-radio-group.d.ts +28 -0
  38. package/radio-group.d.ts +1 -0
  39. package/radio-group.js +234 -0
  40. package/radio.d.ts +1 -0
  41. package/radio.js +239 -0
  42. package/sidebar/tyui-sidebar.d.ts +17 -0
  43. package/sidebar.d.ts +1 -0
  44. package/sidebar.js +53 -0
  45. package/skills/button/SKILL.md +49 -0
  46. package/skills/center/SKILL.md +45 -0
  47. package/skills/checkbox/SKILL.md +39 -0
  48. package/skills/cluster/SKILL.md +44 -0
  49. package/skills/components/SKILL.md +53 -0
  50. package/skills/container/SKILL.md +42 -0
  51. package/skills/flex/SKILL.md +45 -0
  52. package/skills/frame/SKILL.md +42 -0
  53. package/skills/grid/SKILL.md +44 -0
  54. package/skills/input/SKILL.md +59 -0
  55. package/skills/radio/SKILL.md +49 -0
  56. package/skills/radio-group/SKILL.md +51 -0
  57. package/skills/sidebar/SKILL.md +43 -0
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: grid
3
+ description: Use tyui-grid for responsive peer-card and panel collections that auto-fit columns from container width.
4
+ license: Apache-2.0
5
+ metadata:
6
+ type: library
7
+ library: '@toyu-ui/elements'
8
+ library_version: '0.1.0'
9
+ source: src/grid/tyui-grid.ts
10
+ manifest: ../../custom-elements.json
11
+ ---
12
+
13
+ # tyui-grid
14
+
15
+ ## Intent
16
+
17
+ Use `tyui-grid` for repeated peer items that should form responsive columns from the container width and a minimum item size.
18
+
19
+ ## API Source
20
+
21
+ Authoritative API facts live in `@toyu-ui/elements/custom-elements.json`.
22
+
23
+ ## Correct Usage
24
+
25
+ ```html
26
+ <tyui-grid min-item-size="14rem" gap="4">
27
+ <section>Alpha</section>
28
+ <section>Beta</section>
29
+ <section>Gamma</section>
30
+ </tyui-grid>
31
+ ```
32
+
33
+ ## Selection Guidance
34
+
35
+ - Use Grid for cards, tiles, metric panels, image groups, and settings panels.
36
+ - Use Cluster for compact wrapping action rows and tags.
37
+ - Use Flex for one-axis composition.
38
+ - Use table or data-grid components for tabular data with row and column relationships.
39
+
40
+ ## Anti-Patterns
41
+
42
+ - Do not use Grid for data tables or keyboard-navigable ARIA grids.
43
+ - Do not use dense visual reordering when DOM order must match reading order.
44
+ - Do not calculate columns in JavaScript.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: input
3
+ description: Use and integrate the tyui-input custom element for accessible single-line text entry without confusing base component features with design-system variants.
4
+ license: Apache-2.0
5
+ metadata:
6
+ type: library
7
+ library: '@toyu-ui/elements'
8
+ library_version: '0.1.0'
9
+ source: src/input/tyui-input.ts
10
+ manifest: ../../custom-elements.json
11
+ ---
12
+
13
+ # tyui-input
14
+
15
+ ## Intent
16
+
17
+ Use `tyui-input` for short single-line text entry such as names, email addresses,
18
+ search terms, telephone numbers, URLs, passwords, and numeric text.
19
+
20
+ ## API Source
21
+
22
+ Authoritative API facts live in `@toyu-ui/elements/custom-elements.json`.
23
+
24
+ ## Registration
25
+
26
+ ```ts
27
+ import { defineTyuiInput } from '@toyu-ui/define/input';
28
+
29
+ defineTyuiInput();
30
+ ```
31
+
32
+ ## Correct Usage
33
+
34
+ ```html
35
+ <label for="email">Email</label>
36
+ <tyui-input id="email" name="email" type="email" required></tyui-input>
37
+ ```
38
+
39
+ ## Design-System Variants
40
+
41
+ The base component owns neutral appearances only. Product or design-system
42
+ layers may add visual variants through public tokens, host classes, and
43
+ documented parts. For example, Fluent's focused underline is a Fluent design
44
+ layer feature, not a base `appearance` value.
45
+
46
+ ## Selection Guidance
47
+
48
+ - Use Input for short single-line text entry.
49
+ - Use a textarea component, when available, for multiline text.
50
+ - Use Select, Combobox, RadioGroup, or Checkbox when the user chooses from known options.
51
+ - Use Field or a visible native label to provide the accessible label.
52
+ - Keep design-system-specific visuals in the design layer rather than adding base appearances.
53
+
54
+ ## Anti-Patterns
55
+
56
+ - Do not rely on placeholder as the only label.
57
+ - Do not put buttons, links, or other focusable controls in content slots.
58
+ - Do not invent unsupported input appearances; use design-layer classes for
59
+ product-specific visuals.
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: radio
3
+ description: Use tyui-radio only as a radio option coordinated by tyui-radio-group, with native input focus and group-owned selection.
4
+ license: Apache-2.0
5
+ metadata:
6
+ type: library
7
+ library: '@toyu-ui/elements'
8
+ library_version: '0.1.0'
9
+ source: src/radio/tyui-radio.ts
10
+ manifest: ../../custom-elements.json
11
+ ---
12
+
13
+ # tyui-radio
14
+
15
+ ## Intent
16
+
17
+ Use `tyui-radio` to represent one option inside `tyui-radio-group`.
18
+
19
+ ## API Source
20
+
21
+ Authoritative API facts live in `@toyu-ui/elements/custom-elements.json`.
22
+
23
+ ## Correct Usage
24
+
25
+ ```html
26
+ <tyui-radio-group label="Plan" name="plan" value="team">
27
+ <tyui-radio value="personal">Personal</tyui-radio>
28
+ <tyui-radio value="team">Team</tyui-radio>
29
+ </tyui-radio-group>
30
+ ```
31
+
32
+ ## Focus And Keyboard
33
+
34
+ `tyui-radio-group` owns value and roving tabindex. The active radio mirrors its
35
+ tab stop to the native shadow input so real browser `Tab` enters the group and
36
+ arrow keys move focus and selection.
37
+
38
+ ## Selection Guidance
39
+
40
+ - Use Radio only as an option inside RadioGroup.
41
+ - Use RadioGroup for the field label, name, value ownership, and keyboard coordination.
42
+ - Use Checkbox for unrelated independent boolean choices.
43
+ - Use Select or Combobox for larger option sets.
44
+
45
+ ## Anti-Patterns
46
+
47
+ - Do not use standalone radio buttons for unrelated boolean choices.
48
+ - Do not manage checked state independently when inside a group.
49
+ - Do not replace native radio keyboard behavior with app-level key handlers.
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: radio-group
3
+ description: Use and integrate tyui-radio-group for mutually exclusive choices, including value ownership, keyboard behavior, and form participation.
4
+ license: Apache-2.0
5
+ metadata:
6
+ type: library
7
+ library: '@toyu-ui/elements'
8
+ library_version: '0.1.0'
9
+ source: src/radio-group/tyui-radio-group.ts
10
+ manifest: ../../custom-elements.json
11
+ ---
12
+
13
+ # tyui-radio-group
14
+
15
+ ## Intent
16
+
17
+ Use `tyui-radio-group` when the user must choose exactly one option from a small
18
+ set.
19
+
20
+ ## API Source
21
+
22
+ Authoritative API facts live in `@toyu-ui/elements/custom-elements.json`.
23
+
24
+ ## Correct Usage
25
+
26
+ ```html
27
+ <tyui-radio-group label="Notification frequency" name="frequency" required>
28
+ <tyui-radio value="daily">Daily</tyui-radio>
29
+ <tyui-radio value="weekly">Weekly</tyui-radio>
30
+ <tyui-radio value="never">Never</tyui-radio>
31
+ </tyui-radio-group>
32
+ ```
33
+
34
+ ## Keyboard Contract
35
+
36
+ - `Tab` enters the checked enabled radio, or the first enabled radio.
37
+ - Arrow keys move focus and selection, wrapping and skipping disabled radios.
38
+ - `Space` selects the focused radio.
39
+
40
+ ## Selection Guidance
41
+
42
+ - Use RadioGroup when the user chooses exactly one option from a small set.
43
+ - Use Checkbox for independent boolean choices or multi-select checklists.
44
+ - Use Select or Combobox for long option lists, async options, or compact forms.
45
+ - Keep only `tyui-radio` choices in the default slot.
46
+
47
+ ## Anti-Patterns
48
+
49
+ - Do not place non-radio interactive elements in the default slot.
50
+ - Do not use radio group for multi-select choices.
51
+ - Do not create custom roving tabindex outside the group.
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: sidebar
3
+ description: Use tyui-sidebar for two-region fixed-plus-fluid layouts such as filters beside results or navigation beside content.
4
+ license: Apache-2.0
5
+ metadata:
6
+ type: library
7
+ library: '@toyu-ui/elements'
8
+ library_version: '0.1.0'
9
+ source: src/sidebar/tyui-sidebar.ts
10
+ manifest: ../../custom-elements.json
11
+ ---
12
+
13
+ # tyui-sidebar
14
+
15
+ ## Intent
16
+
17
+ Use `tyui-sidebar` for a two-region layout where one child has a preferred fixed size and the other child takes remaining space.
18
+
19
+ ## API Source
20
+
21
+ Authoritative API facts live in `@toyu-ui/elements/custom-elements.json`.
22
+
23
+ ## Correct Usage
24
+
25
+ ```html
26
+ <tyui-sidebar side-size="16rem" content-min="55%" gap="4">
27
+ <aside>Filters</aside>
28
+ <main>Results</main>
29
+ </tyui-sidebar>
30
+ ```
31
+
32
+ ## Selection Guidance
33
+
34
+ - Use Sidebar for filters beside results, navigation beside content, metadata beside detail, or media beside body.
35
+ - Use Grid when regions are peer cards or equal columns.
36
+ - Use Container for page rails.
37
+ - Use dialog or drawer components for overlay side panels.
38
+
39
+ ## Anti-Patterns
40
+
41
+ - Do not add more than two direct children.
42
+ - Do not use Sidebar for overlay drawer behavior.
43
+ - Do not use `side="end"` to fix an incorrect DOM reading order.