@tangible/ui 0.2.19 → 0.2.20

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.
@@ -14,6 +14,7 @@
14
14
  --tui-modal-radius
15
15
  --tui-modal-padding
16
16
  --tui-modal-shadow
17
+ --tui-modal-foot-gap
17
18
  */
18
19
 
19
20
  @mixin styles() {
@@ -35,6 +36,7 @@
35
36
  // --tui-modal-radius Dialog border radius
36
37
  // --tui-modal-padding Dialog padding (slots)
37
38
  // --tui-modal-shadow Dialog box shadow
39
+ // --tui-modal-foot-gap Gap between actions in Modal.Foot
38
40
  //
39
41
  // To override from consuming code:
40
42
  // .my-context .tui-modal { --tui-modal-max: 600px; }
@@ -233,11 +235,39 @@
233
235
  padding-inline-end: calc(var(--_padding) + var(--#{sys.$prefix}spacing-xl));
234
236
  }
235
237
 
236
- // Foot slot
238
+ // Foot slot — the actions row. Flex so Buttons share one line, gathered at
239
+ // the inline end by default (reading order = visual order, primary last);
240
+ // Modal.Foot's `justify` re-points the distribution via data-justify. Wraps
241
+ // rather than overflows when a narrow dialog can't fit every action.
242
+ //
243
+ // Deliberately a data attribute, not an `is-align-*` class: the bare
244
+ // `.is-align-*` / `.is-justify-*` utilities are unscoped and sit in the
245
+ // utilities layer, so a modifier class of that name would have its
246
+ // `align-items` hijacked by the utility and win over anything set here.
237
247
  .#{sys.$prefix}modal__foot {
248
+ --_foot-gap: var(--#{sys.$prefix}modal-foot-gap, var(--#{sys.$prefix}spacing-sm));
249
+ --_foot-justify: flex-end;
250
+
238
251
  padding-block: var(--_padding);
239
252
  padding-inline: var(--_padding);
240
253
  width: 100%;
254
+ display: flex;
255
+ flex-wrap: wrap;
256
+ align-items: center;
257
+ justify-content: var(--_foot-justify);
258
+ gap: var(--_foot-gap);
259
+
260
+ // `end` is the base rule above — deliberately no attribute selector for it.
261
+ &[data-justify="start"] {
262
+ --_foot-justify: flex-start;
263
+ }
264
+
265
+ // Not `space-between`: with three actions that floats the middle one
266
+ // into no-man's-land. The intent is "first action apart, the rest
267
+ // grouped at the end", which is an auto margin after the first item.
268
+ &[data-justify="between"] > :first-child {
269
+ margin-inline-end: auto;
270
+ }
241
271
  }
242
272
 
243
273
  // Size presets — scale min-body proportionally to width so short-content
@@ -16,7 +16,8 @@
16
16
  //
17
17
  // Compact reorder control for sortable lists. Vertical stack of chevron-up,
18
18
  // center (drag handle / index / lock), and chevron-down. The 'arrows' mode
19
- // drops the center for explicit-move-only items (top-level containers).
19
+ // drops the drag handle for explicit-move-only items; its center is the
20
+ // index badge when one is given, otherwise there is no center at all.
20
21
  //
21
22
  // Component API tokens (never defined here, only read via fallback):
22
23
  // --tui-move-handle-size Override container size
@@ -221,16 +222,19 @@
221
222
  }
222
223
 
223
224
  // -------------------------------------------------------------------------
224
- // Index ↔ handle hover swap
225
+ // Index ↔ handle hover swap (full mode only)
225
226
  // -------------------------------------------------------------------------
226
227
  // Uses opacity + position instead of display:none so the handle button
227
228
  // remains focusable. Tab triggers :focus-within reliably because the
228
229
  // button is always in the layout flow (just visually hidden).
230
+ //
231
+ // Scoped away from arrows mode: it has no handle to swap to, so the hover
232
+ // rule would just blank the index.
229
233
  &__center {
230
234
  position: relative;
231
235
  }
232
236
 
233
- &.has-index {
237
+ &.has-index:not(.is-arrows) {
234
238
  .#{sys.$prefix}move-handle__index {
235
239
  opacity: 1;
236
240
  }
@@ -257,7 +261,7 @@
257
261
 
258
262
  // Touch devices: always show handle, hide index
259
263
  @media (hover: none) {
260
- &.has-index {
264
+ &.has-index:not(.is-arrows) {
261
265
  .#{sys.$prefix}move-handle__index {
262
266
  display: none;
263
267
  }
@@ -291,6 +295,18 @@
291
295
  // Arrows variant — panel with chevrons only, no center (unless locked)
292
296
  // -------------------------------------------------------------------------
293
297
  &.is-arrows {
298
+ // The group is the focus-recovery target when both chevrons disable
299
+ // (tabIndex -1, reached programmatically only) — keep that visible.
300
+ &:focus-visible {
301
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
302
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
303
+ }
304
+ }
305
+
306
+ // With an index the stack is chevron | badge | chevron at full mode's
307
+ // exact heights (16 + center + 16 = 56px at md), so the two modes line up
308
+ // in one list. Without one, the chevrons take the whole panel.
309
+ &.is-arrows:not(.has-index) {
294
310
  // No center to reserve space for — the stack is just the two chevrons.
295
311
  min-height: calc(2 * #{$_chevron-size});
296
312
 
package/tui-manifest.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.2.19",
3
- "generated": "2026-09-01T18:02:16.418Z",
2
+ "version": "0.2.20",
3
+ "generated": "2026-09-03T19:23:49.505Z",
4
4
  "components": {
5
5
  "Accordion": {
6
6
  "props": {
@@ -16,12 +16,12 @@
16
16
  "value": {
17
17
  "type": "string | string[]",
18
18
  "required": false,
19
- "description": "Controlled: currently open item value\nControlled: currently open item values"
19
+ "description": "Controlled: currently open item value. `null` means \"controlled, nothing\nopen\". Controlled vs uncontrolled is decided once, at mount, from whether\n`value` is `undefined` — so pass `null` (not `undefined`) for \"all closed\",\nand if `undefined` does leak back in later (`onValueChange` reports it on\ncollapse), it reads as \"nothing open\" rather than switching modes.\nControlled: currently open item values"
20
20
  },
21
21
  "onValueChange": {
22
22
  "type": "((value: string) => void) | ((value: string[]) => void)",
23
23
  "required": false,
24
- "description": "Callback when open item changes (undefined when all closed in collapsible mode)\nCallback when open items change"
24
+ "description": "Callback when open item changes. Receives `undefined` when all items are\nclosed (collapsible mode) — store it as `value ?? null` if your state is\n`string | null`.\nCallback when open items change"
25
25
  },
26
26
  "collapsible": {
27
27
  "type": "boolean",
@@ -73,6 +73,18 @@
73
73
  },
74
74
  {
75
75
  "note": "Keyboard: Arrow keys navigate triggers, Enter/Space toggle"
76
+ },
77
+ {
78
+ "note": "Controlled single: value accepts string | null — null is 'nothing open'; undefined would flip to uncontrolled. onValueChange still reports undefined when all closed (store as v ?? null)"
79
+ },
80
+ {
81
+ "note": "Trigger asChild stamps the full-width row paint (tui-accordion__trigger) by default; add `unstyled` when the child is already a styled control (IconButton). data-tui-accordion-trigger + data-state always land"
82
+ },
83
+ {
84
+ "note": "asChild with a native <button> child: Enter/Space activation is left to the browser (no synthetic toggle), so it fires once"
85
+ },
86
+ {
87
+ "note": "useAccordionItem() (exported) gives a secondary control inside Accordion.Item the panelId/isOpen/toggle for its own aria-expanded/aria-controls"
76
88
  }
77
89
  ],
78
90
  "examples": [
@@ -87,6 +99,10 @@
87
99
  {
88
100
  "name": "With heading",
89
101
  "code": "<Accordion.Item value=\"faq\" headingLevel={3}>\n <Accordion.Trigger>Frequently Asked</Accordion.Trigger>\n <Accordion.Panel>Answer here</Accordion.Panel>\n</Accordion.Item>"
102
+ },
103
+ {
104
+ "name": "Icon-button trigger + secondary control",
105
+ "code": "function EditLink() {\n const { isOpen, panelId, toggle } = useAccordionItem();\n return <button type=\"button\" aria-expanded={isOpen} aria-controls={panelId} onClick={toggle}>{isOpen ? 'Close' : 'Edit'}</button>;\n}\n\n<Accordion type=\"single\" collapsible value={open} onValueChange={(v) => setOpen(v ?? null)}>\n <Accordion.Item value=\"row-1\">\n <div className=\"row\">\n <span>Hero banner</span>\n <EditLink />\n <Accordion.Trigger asChild unstyled>\n <IconButton icon=\"system/chevron-down\" label=\"Toggle Hero banner\" variant=\"ghost\" size=\"sm\" />\n </Accordion.Trigger>\n </div>\n <Accordion.Panel>…</Accordion.Panel>\n </Accordion.Item>\n</Accordion>"
90
106
  }
91
107
  ],
92
108
  "related": [
@@ -1633,6 +1649,16 @@
1633
1649
  "type": "\"sm\" | \"md\" | \"lg\" | \"xl\"",
1634
1650
  "required": false
1635
1651
  },
1652
+ "role": {
1653
+ "type": "\"dialog\" | \"alertdialog\"",
1654
+ "required": false,
1655
+ "description": "ARIA role of the dialog element. Default `'dialog'`.\n\n`'alertdialog'` is for a dialog that interrupts the user's workflow to demand a response —\na destructive-action confirm is the textbook case. Focus trap, `aria-modal`, Escape and\nfocus restore behave identically for both roles; what changes is the contract around them:\nthe APG alert dialog pattern expects BOTH `aria-labelledby` (the heading) and\n`aria-describedby` (the message) — a dev warning fires if either is missing — and the\nbackdrop stops dismissing on click unless `closeOnBackdropClick` says otherwise, since a\nstray click outside is not a response. Escape still closes: it is the keyboard \"cancel\".\n\nInitial focus lands on the first focusable element in DOM order (unless\n`initialFocusSelector` says otherwise), and the APG wants that to be the safest action —\nso put Cancel before the destructive action in `Modal.Foot`. If the visual order must\ndiffer (`Modal.Foot justify=\"between\"` with a destructive action first), point\n`initialFocusSelector` at the safe one.\nhttps://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/"
1656
+ },
1657
+ "closeOnBackdropClick": {
1658
+ "type": "boolean",
1659
+ "required": false,
1660
+ "description": "Close when clicking the backdrop. Default `true` for `role=\"dialog\"`, `false` for\n`role=\"alertdialog\"` (see `role`). Passing it explicitly always wins."
1661
+ },
1636
1662
  "preventScrollOnRestore": {
1637
1663
  "type": "boolean",
1638
1664
  "required": false,
@@ -1652,7 +1678,8 @@
1652
1678
  "--tui-modal-border",
1653
1679
  "--tui-modal-radius",
1654
1680
  "--tui-modal-padding",
1655
- "--tui-modal-shadow"
1681
+ "--tui-modal-shadow",
1682
+ "--tui-modal-foot-gap"
1656
1683
  ],
1657
1684
  "story": {
1658
1685
  "title": "Overlays/Modal",
@@ -1672,6 +1699,12 @@
1672
1699
  {
1673
1700
  "note": "Always provide aria-labelledby pointing to a heading id for accessibility"
1674
1701
  },
1702
+ {
1703
+ "note": "role=\"alertdialog\" for confirms that interrupt to demand a response (destructive actions): needs BOTH aria-labelledby and aria-describedby (dev warning otherwise), and the backdrop stops dismissing on click by default — Escape still cancels"
1704
+ },
1705
+ {
1706
+ "note": "Modal.Foot is a flex actions row, end-aligned by default; justify=\"start\" | \"end\" | \"between\" re-points it (between = first action apart, rest grouped at the end). No need for tui-flex / justify utilities on it"
1707
+ },
1675
1708
  {
1676
1709
  "note": "Body uses two-layer wrapper for scroll + :has() composition"
1677
1710
  },
@@ -1693,6 +1726,10 @@
1693
1726
  {
1694
1727
  "name": "With close button",
1695
1728
  "code": "<Modal open={open} onClose={close} showCloseButton aria-labelledby=\"title\">\n <Modal.Head><h2 id=\"title\">Confirm</h2></Modal.Head>\n <Modal.Body>Are you sure?</Modal.Body>\n</Modal>"
1729
+ },
1730
+ {
1731
+ "name": "Alert dialog (destructive confirm)",
1732
+ "code": "<Modal open={open} onClose={close} role=\"alertdialog\" size=\"sm\" aria-labelledby=\"confirm-title\" aria-describedby=\"confirm-desc\">\n <Modal.Head><h2 id=\"confirm-title\">Delete course?</h2></Modal.Head>\n <Modal.Body><p id=\"confirm-desc\">This removes the course and its lessons. It cannot be undone.</p></Modal.Body>\n <Modal.Foot>\n <Button variant=\"outline\" label=\"Cancel\" onClick={close} />\n <Button theme=\"danger\" label=\"Delete\" onClick={confirm} />\n </Modal.Foot>\n</Modal>"
1696
1733
  }
1697
1734
  ],
1698
1735
  "related": [
@@ -1706,7 +1743,7 @@
1706
1743
  "mode": {
1707
1744
  "type": "\"full\" | \"handle\" | \"arrows\"",
1708
1745
  "required": false,
1709
- "description": "Structural mode. 'full' (default) shows background panel with arrows/index.\n'handle' shows only the bare drag icon button. 'arrows' shows the panel\nwith only the up/down chevron buttons — no drag handle or index — for\nitems reordered exclusively by explicit moves (e.g. top-level containers)."
1746
+ "description": "Structural mode. 'full' (default) shows background panel with arrows/index.\n'handle' shows only the bare drag icon button. 'arrows' shows the panel\nwith the up/down chevron buttons and no drag handle — for items reordered\nexclusively by explicit moves (top-level containers, lists without a drag\nlibrary). Pass `index` to show the position between the chevrons."
1710
1747
  },
1711
1748
  "size": {
1712
1749
  "type": "\"sm\" | \"md\"",
@@ -1716,7 +1753,7 @@
1716
1753
  "index": {
1717
1754
  "type": "number",
1718
1755
  "required": false,
1719
- "description": "Position index. When provided, shows number at rest, drag handle on hover. Ignored in 'arrows' mode."
1756
+ "description": "Position index. In 'full' mode, shows the number at rest and swaps to the\ndrag handle on hover/focus-within. In 'arrows' mode, shows the number\nbetween the chevrons with no swap — there is no handle to swap to.\nIgnored in 'handle' mode."
1720
1757
  },
1721
1758
  "locked": {
1722
1759
  "type": "boolean",