@manakind/ui-core 0.18.0 → 0.20.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 (159) hide show
  1. package/README.md +30 -2
  2. package/dist/avatar/avatar.css +42 -0
  3. package/dist/avatar/avatar.css.d.ts +2 -0
  4. package/dist/avatar/avatar.d.ts +55 -0
  5. package/dist/avatar/avatar.d.ts.map +1 -0
  6. package/dist/avatar/avatar.js +41 -0
  7. package/dist/avatar/avatar.js.map +1 -0
  8. package/dist/avatar/index.d.ts +3 -0
  9. package/dist/avatar/index.d.ts.map +1 -0
  10. package/dist/avatar/index.js +2 -0
  11. package/dist/avatar/index.js.map +1 -0
  12. package/dist/centered-layout/centered-layout.css +36 -0
  13. package/dist/centered-layout/centered-layout.css.d.ts +2 -0
  14. package/dist/centered-layout/centered-layout.d.ts +18 -0
  15. package/dist/centered-layout/centered-layout.d.ts.map +1 -0
  16. package/dist/centered-layout/centered-layout.js +16 -0
  17. package/dist/centered-layout/centered-layout.js.map +1 -0
  18. package/dist/centered-layout/index.d.ts +3 -0
  19. package/dist/centered-layout/index.d.ts.map +1 -0
  20. package/dist/centered-layout/index.js +2 -0
  21. package/dist/centered-layout/index.js.map +1 -0
  22. package/dist/divider/divider.css +18 -0
  23. package/dist/divider/divider.css.d.ts +2 -0
  24. package/dist/divider/divider.d.ts +26 -0
  25. package/dist/divider/divider.d.ts.map +1 -0
  26. package/dist/divider/divider.js +15 -0
  27. package/dist/divider/divider.js.map +1 -0
  28. package/dist/divider/index.d.ts +3 -0
  29. package/dist/divider/index.d.ts.map +1 -0
  30. package/dist/divider/index.js +2 -0
  31. package/dist/divider/index.js.map +1 -0
  32. package/dist/empty-state/empty-state.css +37 -0
  33. package/dist/empty-state/empty-state.css.d.ts +2 -0
  34. package/dist/empty-state/empty-state.d.ts +26 -0
  35. package/dist/empty-state/empty-state.d.ts.map +1 -0
  36. package/dist/empty-state/empty-state.js +16 -0
  37. package/dist/empty-state/empty-state.js.map +1 -0
  38. package/dist/empty-state/index.d.ts +3 -0
  39. package/dist/empty-state/index.d.ts.map +1 -0
  40. package/dist/empty-state/index.js +2 -0
  41. package/dist/empty-state/index.js.map +1 -0
  42. package/dist/form-layout/form-layout.css +18 -0
  43. package/dist/form-layout/form-layout.css.d.ts +2 -0
  44. package/dist/form-layout/form-layout.d.ts +21 -0
  45. package/dist/form-layout/form-layout.d.ts.map +1 -0
  46. package/dist/form-layout/form-layout.js +24 -0
  47. package/dist/form-layout/form-layout.js.map +1 -0
  48. package/dist/form-layout/index.d.ts +3 -0
  49. package/dist/form-layout/index.d.ts.map +1 -0
  50. package/dist/form-layout/index.js +2 -0
  51. package/dist/form-layout/index.js.map +1 -0
  52. package/dist/index.d.ts +14 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +14 -0
  55. package/dist/index.js.map +1 -1
  56. package/dist/layout/index.d.ts +3 -0
  57. package/dist/layout/index.d.ts.map +1 -0
  58. package/dist/layout/index.js +2 -0
  59. package/dist/layout/index.js.map +1 -0
  60. package/dist/layout/layout.css +185 -0
  61. package/dist/layout/layout.css.d.ts +2 -0
  62. package/dist/layout/layout.d.ts +105 -0
  63. package/dist/layout/layout.d.ts.map +1 -0
  64. package/dist/layout/layout.js +77 -0
  65. package/dist/layout/layout.js.map +1 -0
  66. package/dist/menu/action-menu.d.ts +120 -0
  67. package/dist/menu/action-menu.d.ts.map +1 -0
  68. package/dist/menu/action-menu.js +80 -0
  69. package/dist/menu/action-menu.js.map +1 -0
  70. package/dist/menu/index.d.ts +2 -0
  71. package/dist/menu/index.d.ts.map +1 -1
  72. package/dist/menu/index.js +1 -0
  73. package/dist/menu/index.js.map +1 -1
  74. package/dist/menu/menu.css +62 -8
  75. package/dist/menu/menu.d.ts +1 -1
  76. package/dist/menu/menu.d.ts.map +1 -1
  77. package/dist/menu/menu.js +1 -1
  78. package/dist/menu/menu.js.map +1 -1
  79. package/dist/page-layout/index.d.ts +3 -0
  80. package/dist/page-layout/index.d.ts.map +1 -0
  81. package/dist/page-layout/index.js +2 -0
  82. package/dist/page-layout/index.js.map +1 -0
  83. package/dist/page-layout/page-layout.css +81 -0
  84. package/dist/page-layout/page-layout.css.d.ts +2 -0
  85. package/dist/page-layout/page-layout.d.ts +43 -0
  86. package/dist/page-layout/page-layout.d.ts.map +1 -0
  87. package/dist/page-layout/page-layout.js +42 -0
  88. package/dist/page-layout/page-layout.js.map +1 -0
  89. package/dist/section/index.d.ts +3 -0
  90. package/dist/section/index.d.ts.map +1 -0
  91. package/dist/section/index.js +2 -0
  92. package/dist/section/index.js.map +1 -0
  93. package/dist/section/section.css +31 -0
  94. package/dist/section/section.css.d.ts +2 -0
  95. package/dist/section/section.d.ts +31 -0
  96. package/dist/section/section.d.ts.map +1 -0
  97. package/dist/section/section.js +19 -0
  98. package/dist/section/section.js.map +1 -0
  99. package/dist/show/index.d.ts +3 -0
  100. package/dist/show/index.d.ts.map +1 -0
  101. package/dist/show/index.js +2 -0
  102. package/dist/show/index.js.map +1 -0
  103. package/dist/show/show.css +67 -0
  104. package/dist/show/show.css.d.ts +2 -0
  105. package/dist/show/show.d.ts +36 -0
  106. package/dist/show/show.d.ts.map +1 -0
  107. package/dist/show/show.js +23 -0
  108. package/dist/show/show.js.map +1 -0
  109. package/dist/skeleton/index.d.ts +3 -0
  110. package/dist/skeleton/index.d.ts.map +1 -0
  111. package/dist/skeleton/index.js +2 -0
  112. package/dist/skeleton/index.js.map +1 -0
  113. package/dist/skeleton/skeleton.css +36 -0
  114. package/dist/skeleton/skeleton.css.d.ts +2 -0
  115. package/dist/skeleton/skeleton.d.ts +26 -0
  116. package/dist/skeleton/skeleton.d.ts.map +1 -0
  117. package/dist/skeleton/skeleton.js +21 -0
  118. package/dist/skeleton/skeleton.js.map +1 -0
  119. package/dist/split-layout/index.d.ts +3 -0
  120. package/dist/split-layout/index.d.ts.map +1 -0
  121. package/dist/split-layout/index.js +2 -0
  122. package/dist/split-layout/index.js.map +1 -0
  123. package/dist/split-layout/split-layout.css +71 -0
  124. package/dist/split-layout/split-layout.css.d.ts +2 -0
  125. package/dist/split-layout/split-layout.d.ts +32 -0
  126. package/dist/split-layout/split-layout.d.ts.map +1 -0
  127. package/dist/split-layout/split-layout.js +25 -0
  128. package/dist/split-layout/split-layout.js.map +1 -0
  129. package/dist/text/index.d.ts +3 -0
  130. package/dist/text/index.d.ts.map +1 -0
  131. package/dist/text/index.js +2 -0
  132. package/dist/text/index.js.map +1 -0
  133. package/dist/text/text.css +128 -0
  134. package/dist/text/text.css.d.ts +2 -0
  135. package/dist/text/text.d.ts +78 -0
  136. package/dist/text/text.d.ts.map +1 -0
  137. package/dist/text/text.js +56 -0
  138. package/dist/text/text.js.map +1 -0
  139. package/dist/visually-hidden/index.d.ts +3 -0
  140. package/dist/visually-hidden/index.d.ts.map +1 -0
  141. package/dist/visually-hidden/index.js +2 -0
  142. package/dist/visually-hidden/index.js.map +1 -0
  143. package/dist/visually-hidden/visually-hidden.css +19 -0
  144. package/dist/visually-hidden/visually-hidden.css.d.ts +2 -0
  145. package/dist/visually-hidden/visually-hidden.d.ts +15 -0
  146. package/dist/visually-hidden/visually-hidden.d.ts.map +1 -0
  147. package/dist/visually-hidden/visually-hidden.js +17 -0
  148. package/dist/visually-hidden/visually-hidden.js.map +1 -0
  149. package/dist/wizard-layout/index.d.ts +3 -0
  150. package/dist/wizard-layout/index.d.ts.map +1 -0
  151. package/dist/wizard-layout/index.js +2 -0
  152. package/dist/wizard-layout/index.js.map +1 -0
  153. package/dist/wizard-layout/wizard-layout.css +52 -0
  154. package/dist/wizard-layout/wizard-layout.css.d.ts +2 -0
  155. package/dist/wizard-layout/wizard-layout.d.ts +50 -0
  156. package/dist/wizard-layout/wizard-layout.d.ts.map +1 -0
  157. package/dist/wizard-layout/wizard-layout.js +38 -0
  158. package/dist/wizard-layout/wizard-layout.js.map +1 -0
  159. package/package.json +114 -2
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Menu as ArkMenu } from '@ark-ui/react/menu';
3
+ import { Portal } from '@ark-ui/react/portal';
4
+ import { useContext, useRef } from 'react';
5
+ import { cx } from '../cx';
6
+ import { Check } from '../fallback-glyphs';
7
+ import { Icon } from '../icon/icon';
8
+ import { PortalContainerContext } from '../portal-container';
9
+ import './menu.css';
10
+ function ActionMenuRow({ item, linkComponent: LinkComponent, itemIndicator }) {
11
+ const body = (_jsxs(_Fragment, { children: [_jsxs("span", { className: "ds-menu__item-body", children: [item.icon && (_jsx(Icon, { source: item.icon, size: "sm", decorative: true, className: "ds-menu__item-icon" })), _jsx(ArkMenu.ItemText, { children: item.label })] }), item.current && (_jsx("span", { className: "ds-menu__item-indicator", children: _jsx(Icon, { source: itemIndicator, size: "sm", decorative: true }) }))] }));
12
+ const itemProps = {
13
+ value: item.value,
14
+ valueText: item.label,
15
+ disabled: item.disabled,
16
+ closeOnSelect: item.closeOnSelect,
17
+ className: 'ds-menu__item',
18
+ };
19
+ if (item.href === undefined) {
20
+ return _jsx(ArkMenu.Item, { ...itemProps, children: body });
21
+ }
22
+ return (_jsx(ArkMenu.Item, { ...itemProps, asChild: true, children: _jsx(LinkComponent, { href: item.href, "aria-current": item.current ? 'page' : undefined, children: body }) }));
23
+ }
24
+ /**
25
+ * A menu of actions and links, opened from a trigger, built on Ark UI's
26
+ * Menu. The counterpart of `Menu`, whose items are mutually exclusive
27
+ * choices: here every item does something or goes somewhere.
28
+ *
29
+ * Ark owns the hard parts: `menu` / `menuitem` semantics, roving highlight
30
+ * with the arrow keys, Home/End, typeahead, Escape and click outside to
31
+ * dismiss, following a link on Enter, and focus returning to the trigger on
32
+ * close. This wrapper contributes the `ds-menu` classes and `--ds-menu-*`
33
+ * bindings it shares with `Menu`, a flat `items` API, and the header and
34
+ * footer slots.
35
+ *
36
+ * ```tsx
37
+ * <ActionMenu
38
+ * trigger={<IconButton icon={MenuGlyph} variant="tertiary" aria-label="Main navigation" />}
39
+ * linkComponent={Link}
40
+ * items={[
41
+ * { value: 'dashboard', label: 'Dashboard', href: '/dashboard', current: true },
42
+ * { value: 'goals', label: 'Goals', href: '/goals' },
43
+ * ]}
44
+ * />
45
+ * ```
46
+ *
47
+ * Reach for this for an account menu, a row's overflow actions, or a
48
+ * navigation that folds into a button on a phone. A set of choices where
49
+ * exactly one is in effect is a `Menu`; a form field is a `Select`.
50
+ *
51
+ * The popup renders in a portal, at the same `z-index: 60` as Select's
52
+ * listbox, and is mounted only while open, as `Menu`'s is.
53
+ */
54
+ export function ActionMenu({ trigger, items, onSelect, header, footer, linkComponent = 'a', itemIndicator = Check, open, onOpenChange, className, }) {
55
+ const portalContainer = useContext(PortalContainerContext);
56
+ const handleSelect = (details) => onSelect?.(details.value);
57
+ const handleOpenChange = (details) => onOpenChange?.(details.open);
58
+ /*
59
+ * Enter on a link item. Zag's default dispatches a click that does not
60
+ * bubble, which the browser follows as a document load but React never
61
+ * sees, so a router's link component could not take it over. `click()`
62
+ * bubbles, and the link navigates the way a pointer click would.
63
+ */
64
+ const navigate = (details) => queueMicrotask(() => details.node.click());
65
+ /*
66
+ * The footer sits beside the `menu` element, not in it, because a menu may
67
+ * own only items. To Zag that makes it outside, so a press on the message
68
+ * would dismiss the menu; this keeps it open.
69
+ */
70
+ const footerRef = useRef(null);
71
+ const keepOpenForFooter = (event) => {
72
+ const target = event.detail.originalEvent.target;
73
+ if (target instanceof Node && footerRef.current?.contains(target))
74
+ event.preventDefault();
75
+ };
76
+ const rows = items.map((item) => (_jsx(ActionMenuRow, { item: item, linkComponent: linkComponent, itemIndicator: itemIndicator }, item.value)));
77
+ const list = header === undefined ? (rows) : (_jsxs(ArkMenu.ItemGroup, { children: [_jsx(ArkMenu.ItemGroupLabel, { className: "ds-menu__header", children: header }), rows] }));
78
+ return (_jsxs(ArkMenu.Root, { lazyMount: true, unmountOnExit: true, open: open, onOpenChange: handleOpenChange, onSelect: handleSelect, navigate: navigate, onInteractOutside: keepOpenForFooter, children: [_jsx(ArkMenu.Trigger, { asChild: true, children: trigger }), _jsx(Portal, { container: portalContainer, children: _jsx(ArkMenu.Positioner, { children: _jsxs("div", { className: cx('ds-menu__popup', className), children: [_jsx(ArkMenu.Content, { className: "ds-menu__content", children: list }), _jsx("div", { ref: footerRef, className: "ds-menu__footer", "aria-live": "polite", children: footer })] }) }) })] }));
79
+ }
80
+ //# sourceMappingURL=action-menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-menu.js","sourceRoot":"","sources":["../../src/menu/action-menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAuD,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChG,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,YAAY,CAAC;AAgGpB,SAAS,aAAa,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAsB;IAC9F,MAAM,IAAI,GAAG,CACX,8BACE,gBAAM,SAAS,EAAC,oBAAoB,aACjC,IAAI,CAAC,IAAI,IAAI,CACZ,KAAC,IAAI,IAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,QAAC,SAAS,EAAC,oBAAoB,GAAG,CAChF,EACD,KAAC,OAAO,CAAC,QAAQ,cAAE,IAAI,CAAC,KAAK,GAAoB,IAC5C,EACN,IAAI,CAAC,OAAO,IAAI,CACf,eAAM,SAAS,EAAC,yBAAyB,YACvC,KAAC,IAAI,IAAC,MAAM,EAAE,a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AE,SAAS,CAAC,aAC7C,KAAC,OAAO,CAAC,OAAO,IAAC,SAAS,EAAC,kBAAkB,YAAE,IAAI,GAAmB,EACtE,cAAK,GAAG,EAAE,SAAS,EAAE,SAAS,EAAC,iBAAiB,eAAW,QAAQ,YAChE,MAAM,GACH,IACF,GACa,GACd,IACI,CAChB,CAAC;AACJ,CAAC"}
@@ -1,3 +1,5 @@
1
+ export type { ActionMenuItem, ActionMenuLinkProps, ActionMenuProps } from './action-menu';
2
+ export { ActionMenu } from './action-menu';
1
3
  export type { MenuItem, MenuProps, MenuTriggerProps } from './menu';
2
4
  export { Menu, MenuTrigger } from './menu';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
@@ -1,2 +1,3 @@
1
+ export { ActionMenu } from './action-menu';
1
2
  export { Menu, MenuTrigger } from './menu';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
@@ -54,9 +54,12 @@
54
54
 
55
55
  /*
56
56
  * The popup renders in a portal, so it is not a descendant of the trigger
57
- * in the DOM and is styled at the top level, as Select's listbox is.
57
+ * in the DOM and is styled at the top level, as Select's listbox is. It is
58
+ * the frame around the `menu` element (`.ds-menu__content`) and, for an
59
+ * ActionMenu, the footer beside it: a menu may own only items, so anything
60
+ * else in the frame is its sibling.
58
61
  */
59
- .ds-menu__content {
62
+ .ds-menu__popup {
60
63
  padding: var(--ds-menu-content-padding);
61
64
  border: 1px solid var(--ds-menu-content-border);
62
65
  border-radius: var(--ds-menu-content-radius);
@@ -72,22 +75,28 @@
72
75
  overflow-wrap: anywhere;
73
76
  /*
74
77
  * The `popup` stacking layer (ds-config/scripts/stacking.ts), as Select's
75
- * listbox: Zag copies this onto the positioner, a sibling of the page in
76
- * `<body>`, so the menu paints above the products' overlay layer and the
77
- * page content positioned under it.
78
+ * listbox: Zag copies the positioner's first child's value onto the
79
+ * positioner, a sibling of the page in `<body>`, so the menu paints above
80
+ * the products' overlay layer and the page content positioned under it.
78
81
  */
79
82
  z-index: 60;
80
83
 
81
84
  /*
82
- * Inset like Select's listbox ring: an outer ring on a portalled popup is
83
- * cropped by anything that sizes to it and can clip against the viewport.
85
+ * Keyboard focus sits on the `menu` element inside; the ring is drawn on
86
+ * the frame, inset like Select's listbox ring: an outer ring on a
87
+ * portalled popup is cropped by anything that sizes to it and can clip
88
+ * against the viewport.
84
89
  */
85
- &:focus-visible {
90
+ &:has(> .ds-menu__content:focus-visible) {
86
91
  outline: 2px solid var(--ds-menu-focus-ring);
87
92
  outline-offset: -2px;
88
93
  }
89
94
  }
90
95
 
96
+ .ds-menu__content {
97
+ outline: none;
98
+ }
99
+
91
100
  /*
92
101
  * Names the group of choices for assistive technology only. The trigger
93
102
  * already says what the menu chooses, so showing it again would repeat it.
@@ -124,6 +133,51 @@
124
133
  opacity: var(--ds-opacity-disabled);
125
134
  cursor: not-allowed;
126
135
  }
136
+
137
+ /* An ActionMenu link is an anchor with the item's role; it reads as a row, not a link. */
138
+ &:is(a) {
139
+ text-decoration: none;
140
+ }
141
+ }
142
+
143
+ /* The glyph and label of an ActionMenu item, kept together ahead of the indicator. */
144
+ .ds-menu__item-body {
145
+ display: inline-flex;
146
+ align-items: center;
147
+ gap: var(--ds-menu-item-gap);
148
+ min-width: 0;
149
+ max-width: 100%;
150
+ }
151
+
152
+ .ds-menu__item-icon {
153
+ flex-shrink: 0;
154
+ }
155
+
156
+ /*
157
+ * An ActionMenu's header names the group of items (Ark's group label), so
158
+ * it sits in the item's inset and is ruled off from the items under it.
159
+ */
160
+ .ds-menu__header {
161
+ padding: var(--ds-menu-item-padding-block) var(--ds-menu-item-padding-inline);
162
+ margin-block-end: var(--ds-menu-content-padding);
163
+ border-block-end: 1px solid var(--ds-menu-content-border);
164
+ color: var(--ds-menu-item-text);
165
+ }
166
+
167
+ /*
168
+ * A line under the items about the last action; not an item. Always in the
169
+ * DOM so that a message arriving later is announced (a live region created
170
+ * with its content is not), and taking no room while it is empty.
171
+ */
172
+ .ds-menu__footer {
173
+ margin-block-start: var(--ds-menu-content-padding);
174
+ padding: var(--ds-menu-item-padding-block) var(--ds-menu-item-padding-inline);
175
+ border-block-start: 1px solid var(--ds-menu-content-border);
176
+ color: var(--ds-menu-item-text);
177
+
178
+ &:empty {
179
+ display: none;
180
+ }
127
181
  }
128
182
 
129
183
  /*
@@ -53,7 +53,7 @@ export interface MenuProps<V extends string = string> {
53
53
  * they do Select's `itemIndicator`.
54
54
  */
55
55
  itemIndicator?: IconSource;
56
- /** Extra class names on the menu's popup. */
56
+ /** Extra class names on the menu's popup: the frame around the items. */
57
57
  className?: string;
58
58
  }
59
59
  export interface MenuTriggerProps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;IAC9E;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,SAAwB,EACxB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,gBAAgB,2CAOlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAC9C,OAAO,EACP,KAAK,EACL,KAAK,EACL,KAAK,EACL,aAAa,EACb,aAAqB,EACrB,SAAS,GACV,EAAE,SAAS,CAAC,CAAC,CAAC,2CA+Cd"}
package/dist/menu/menu.js CHANGED
@@ -74,6 +74,6 @@ export function Menu({ trigger, label, items, value, onValueChange, itemIndicato
74
74
  onValueChange(chosen.value);
75
75
  }, [items, value, onValueChange]);
76
76
  const portalContainer = useContext(PortalContainerContext);
77
- return (_jsxs(ArkMenu.Root, { lazyMount: true, unmountOnExit: true, children: [_jsx(ArkMenu.Trigger, { asChild: true, children: trigger }), _jsx(Portal, { container: portalContainer, children: _jsx(ArkMenu.Positioner, { children: _jsx(ArkMenu.Content, { className: cx('ds-menu__content', className), children: _jsxs(ArkMenu.RadioItemGroup, { value: value, onValueChange: handleValueChange, children: [_jsx(ArkMenu.ItemGroupLabel, { className: "ds-menu__label", children: label }), items.map((item) => (_jsxs(ArkMenu.RadioItem, { value: item.value, valueText: item.label, disabled: item.disabled, className: "ds-menu__item", children: [_jsx(ArkMenu.ItemText, { children: item.label }), _jsx(ArkMenu.ItemIndicator, { className: "ds-menu__item-indicator", children: _jsx(Icon, { source: itemIndicator, size: "sm", decorative: true }) })] }, item.value)))] }) }) }) })] }));
77
+ return (_jsxs(ArkMenu.Root, { lazyMount: true, unmountOnExit: true, children: [_jsx(ArkMenu.Trigger, { asChild: true, children: trigger }), _jsx(Portal, { container: portalContainer, children: _jsx(ArkMenu.Positioner, { children: _jsx("div", { className: cx('ds-menu__popup', className), children: _jsx(ArkMenu.Content, { className: "ds-menu__content", children: _jsxs(ArkMenu.RadioItemGroup, { value: value, onValueChange: handleValueChange, children: [_jsx(ArkMenu.ItemGroupLabel, { className: "ds-menu__label", children: label }), items.map((item) => (_jsxs(ArkMenu.RadioItem, { value: item.value, valueText: item.label, disabled: item.disabled, className: "ds-menu__item", children: [_jsx(ArkMenu.ItemText, { children: item.label }), _jsx(ArkMenu.ItemIndicator, { className: "ds-menu__item-indicator", children: _jsx(Icon, { source: itemIndicator, size: "sm", decorative: true }) })] }, item.value)))] }) }) }) }) })] }));
78
78
  }
79
79
  //# sourceMappingURL=menu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","sourceRoot":"","sources":["../../src/menu/menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAA0C,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxF,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,YAAY,CAAC;AAuEpB;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,SAAS,GAAG,YAAY,EACxB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACS;IACjB,OAAO,CACL,kBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC,KAAM,KAAK,aAC1E,QAAQ,EACT,KAAC,IAAI,IAAC,MAAM,EAAE,SAAS,EAAE,IAAI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C,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,MAAC,OAAO,CAAC,SAAS,IAEhB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,SAAS,EAAE,IAAI,CAAC,KAAK,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAC,eAAe,aAEzB,KAAC,OAAO,CAAC,QAAQ,cAAE,IAAI,CAAC,KAAK,GAAoB,EACjD,KAAC,OAAO,CAAC,aAAa,IAAC,SAAS,EAAC,yBAAyB,YACxD,KAAC,IAAI,IAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,SAAG,GAC9B,KATnB,IAAI,CAAC,KAAK,CAUG,CACrB,CAAC,IACqB,GACT,GACd,GACa,GACd,IACI,CAChB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type { PageActionsProps, PageDescriptionProps, PageHeaderProps, PageLayoutProps, PageTitleProps, } from './page-layout';
2
+ export { PageActions, PageDescription, PageHeader, PageLayout, PageTitle } from './page-layout';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/page-layout/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { PageActions, PageDescription, PageHeader, PageLayout, PageTitle } from './page-layout';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/page-layout/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,81 @@
1
+ @layer components {
2
+ .ds-page {
3
+ box-sizing: border-box;
4
+ display: flex;
5
+ flex-direction: column;
6
+ gap: var(--ds-page-gap);
7
+ width: 100%;
8
+ margin-inline: auto;
9
+ padding-block: var(--ds-page-padding-block);
10
+ padding-inline: var(--ds-page-padding-inline);
11
+ min-width: 0;
12
+ overflow-wrap: anywhere;
13
+
14
+ &.ds-page--sm {
15
+ max-width: var(--ds-layout-content-sm);
16
+ }
17
+
18
+ &.ds-page--md {
19
+ max-width: var(--ds-layout-content-md);
20
+ }
21
+
22
+ &.ds-page--lg {
23
+ max-width: var(--ds-layout-content-lg);
24
+ }
25
+
26
+ &.ds-page--xl {
27
+ max-width: var(--ds-layout-content-xl);
28
+ }
29
+ }
30
+
31
+ /*
32
+ * Title over description, actions beneath both on a narrow viewport: a
33
+ * plain column, so a part left out leaves no row and no gap behind. From
34
+ * `md` the header is a grid whose rows are only the parts present: the
35
+ * title in row one, the description in the row after it, the actions in
36
+ * the second column of row one. No template areas, because an explicit
37
+ * empty row keeps its gutter.
38
+ */
39
+ .ds-page__header {
40
+ display: flex;
41
+ flex-direction: column;
42
+ gap: var(--ds-page-header-gap);
43
+ min-width: 0;
44
+
45
+ & .ds-page__actions {
46
+ display: flex;
47
+ flex-wrap: wrap;
48
+ align-items: center;
49
+ gap: var(--ds-layout-gap);
50
+ }
51
+ }
52
+
53
+ /*
54
+ * `fit-content(50%)`, not `auto`: an auto track grows to its max-content, so
55
+ * one long unbroken label in the actions would take the whole header and
56
+ * squeeze the title to nothing. Capped at half, the label breaks instead.
57
+ */
58
+ @media (width >= 48rem) {
59
+ .ds-page__header {
60
+ display: grid;
61
+ grid-template-columns: minmax(0, 1fr) fit-content(50%);
62
+ column-gap: var(--ds-layout-gap-relaxed);
63
+
64
+ & .ds-page__title {
65
+ grid-column: 1;
66
+ grid-row: 1;
67
+ }
68
+
69
+ & .ds-page__description {
70
+ grid-column: 1;
71
+ }
72
+
73
+ & .ds-page__actions {
74
+ grid-column: 2;
75
+ grid-row: 1;
76
+ align-self: start;
77
+ justify-content: flex-end;
78
+ }
79
+ }
80
+ }
81
+ }
@@ -0,0 +1,2 @@
1
+ /* AUTOGENERATED: types for the stylesheet beside it. */
2
+ export {};
@@ -0,0 +1,43 @@
1
+ import { ark } from '@ark-ui/react/factory';
2
+ import type { ComponentProps } from 'react';
3
+ import './page-layout.css';
4
+ import type { ContentWidth } from '../layout/layout';
5
+ import { type HeadingProps, type TextProps } from '../text/text';
6
+ export interface PageLayoutProps extends ComponentProps<typeof ark.div> {
7
+ /**
8
+ * Where the page's content stops growing. Defaults to `xl`, a full page; a
9
+ * settings page or a reading page is `lg`.
10
+ */
11
+ size?: ContentWidth;
12
+ }
13
+ /**
14
+ * The template every page composes: a centred column with the page's inset
15
+ * and the rhythm between its regions.
16
+ *
17
+ * Children are the page's regions, usually a {@link PageHeader} and then
18
+ * {@link Section}s, separated by `--ds-page-gap`. The inset from the viewport
19
+ * is `--ds-page-padding-inline` and `--ds-page-padding-block`. Renders a
20
+ * `div`; pass `asChild` to make the page a landmark
21
+ * (`<PageLayout asChild><main>…</main></PageLayout>`).
22
+ */
23
+ export declare function PageLayout({ size, className, children, ...props }: PageLayoutProps): import("react/jsx-runtime").JSX.Element;
24
+ export type PageHeaderProps = ComponentProps<typeof ark.header>;
25
+ /**
26
+ * The top of a page: its {@link PageTitle}, an optional {@link PageDescription}
27
+ * and optional {@link PageActions}. The title and description stack; the
28
+ * actions sit beside them from `md` up and under them on a narrower viewport.
29
+ */
30
+ export declare function PageHeader({ className, children, ...props }: PageHeaderProps): import("react/jsx-runtime").JSX.Element;
31
+ export type PageTitleProps = Omit<HeadingProps, 'level'>;
32
+ /**
33
+ * The page's one `h1`. Takes a `ref` for focus management after a route
34
+ * change or a removal, like any heading.
35
+ */
36
+ export declare function PageTitle({ className, children, ...props }: PageTitleProps): import("react/jsx-runtime").JSX.Element;
37
+ export type PageDescriptionProps = TextProps;
38
+ /** Muted supporting copy under the title. */
39
+ export declare function PageDescription({ className, children, ...props }: PageDescriptionProps): import("react/jsx-runtime").JSX.Element;
40
+ export type PageActionsProps = ComponentProps<typeof ark.div>;
41
+ /** The page's primary controls, a wrapping row aligned to the end. */
42
+ export declare function PageActions({ className, children, ...props }: PageActionsProps): import("react/jsx-runtime").JSX.Element;
43
+ //# sourceMappingURL=page-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-layout.d.ts","sourceRoot":"","sources":["../../src/page-layout/page-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAW,KAAK,YAAY,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhF,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC;IACrE;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,EAAE,IAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAMzF;AAED,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;AAEhE;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAM5E;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAM1E;AAED,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAE7C,6CAA6C;AAC7C,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,2CAMtF;AAED,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;AAE9D,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAM9E"}
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ark } from '@ark-ui/react/factory';
3
+ import './page-layout.css';
4
+ import { cx } from '../cx';
5
+ import { Heading, Text } from '../text/text';
6
+ /**
7
+ * The template every page composes: a centred column with the page's inset
8
+ * and the rhythm between its regions.
9
+ *
10
+ * Children are the page's regions, usually a {@link PageHeader} and then
11
+ * {@link Section}s, separated by `--ds-page-gap`. The inset from the viewport
12
+ * is `--ds-page-padding-inline` and `--ds-page-padding-block`. Renders a
13
+ * `div`; pass `asChild` to make the page a landmark
14
+ * (`<PageLayout asChild><main>…</main></PageLayout>`).
15
+ */
16
+ export function PageLayout({ size = 'xl', className, children, ...props }) {
17
+ return (_jsx(ark.div, { className: cx('ds-page', `ds-page--${size}`, className), ...props, children: children }));
18
+ }
19
+ /**
20
+ * The top of a page: its {@link PageTitle}, an optional {@link PageDescription}
21
+ * and optional {@link PageActions}. The title and description stack; the
22
+ * actions sit beside them from `md` up and under them on a narrower viewport.
23
+ */
24
+ export function PageHeader({ className, children, ...props }) {
25
+ return (_jsx(ark.header, { className: cx('ds-page__header', className), ...props, children: children }));
26
+ }
27
+ /**
28
+ * The page's one `h1`. Takes a `ref` for focus management after a route
29
+ * change or a removal, like any heading.
30
+ */
31
+ export function PageTitle({ className, children, ...props }) {
32
+ return (_jsx(Heading, { level: 1, className: cx('ds-page__title', className), ...props, children: children }));
33
+ }
34
+ /** Muted supporting copy under the title. */
35
+ export function PageDescription({ className, children, ...props }) {
36
+ return (_jsx(Text, { tone: "muted", className: cx('ds-page__description', className), ...props, children: children }));
37
+ }
38
+ /** The page's primary controls, a wrapping row aligned to the end. */
39
+ export function PageActions({ className, children, ...props }) {
40
+ return (_jsx(ark.div, { className: cx('ds-page__actions', className), ...props, children: children }));
41
+ }
42
+ //# sourceMappingURL=page-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-layout.js","sourceRoot":"","sources":["../../src/page-layout/page-layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAqB,IAAI,EAAkB,MAAM,cAAc,CAAC;AAUhF;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAmB;IACxF,OAAO,CACL,KAAC,GAAG,CAAC,GAAG,IAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,YAAY,IAAI,EAAE,EAAE,SAAS,CAAC,KAAM,KAAK,YACxE,QAAQ,GACD,CACX,CAAC;AACJ,CAAC;AAID;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAmB;IAC3E,OAAO,CACL,KAAC,GAAG,CAAC,MAAM,IAAC,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,KAAM,KAAK,YAC/D,QAAQ,GACE,CACd,CAAC;AACJ,CAAC;AAID;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAkB;IACzE,OAAO,CACL,KAAC,OAAO,IAAC,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,KAAM,KAAK,YACrE,QAAQ,GACD,CACX,CAAC;AACJ,CAAC;AAID,6CAA6C;AAC7C,MAAM,UAAU,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAwB;IACrF,OAAO,CACL,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,KAAM,KAAK,YAC3E,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC;AAID,sEAAsE;AACtE,MAAM,UAAU,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAoB;IAC7E,OAAO,CACL,KAAC,GAAG,CAAC,GAAG,IAAC,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC,KAAM,KAAK,YAC7D,QAAQ,GACD,CACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type { SectionProps } from './section';
2
+ export { Section } from './section';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/section/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Section } from './section';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/section/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,31 @@
1
+ @layer components {
2
+ .ds-section {
3
+ display: flex;
4
+ flex-direction: column;
5
+ gap: var(--ds-section-gap);
6
+ min-width: 0;
7
+ overflow-wrap: anywhere;
8
+
9
+ & .ds-section__header {
10
+ display: flex;
11
+ flex-wrap: wrap;
12
+ align-items: flex-start;
13
+ justify-content: space-between;
14
+ gap: var(--ds-layout-gap);
15
+ }
16
+
17
+ & .ds-section__heading {
18
+ display: flex;
19
+ flex-direction: column;
20
+ gap: var(--ds-section-header-gap);
21
+ min-width: 0;
22
+ }
23
+
24
+ & .ds-section__actions {
25
+ display: flex;
26
+ flex-wrap: wrap;
27
+ align-items: center;
28
+ gap: var(--ds-layout-gap);
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,2 @@
1
+ /* AUTOGENERATED: types for the stylesheet beside it. */
2
+ export {};
@@ -0,0 +1,31 @@
1
+ import { ark } from '@ark-ui/react/factory';
2
+ import { type ComponentProps, type ReactNode } from 'react';
3
+ import './section.css';
4
+ import { type HeadingLevel } from '../text/text';
5
+ /**
6
+ * No `asChild`: the region renders its own header beside `children`, and Ark's
7
+ * `asChild` clones exactly one element, so it would render nothing.
8
+ */
9
+ export interface SectionProps extends Omit<ComponentProps<typeof ark.section>, 'title' | 'asChild'> {
10
+ /** The section's heading, which also names the region for assistive technology. */
11
+ title: ReactNode;
12
+ /**
13
+ * The heading level of `title`. Defaults to `2`, a section of a page; a
14
+ * section inside another section is `3`.
15
+ */
16
+ titleLevel?: HeadingLevel;
17
+ /** Muted copy under the title. */
18
+ description?: ReactNode;
19
+ /** Controls beside the title: a "See all" link, a filter. */
20
+ actions?: ReactNode;
21
+ }
22
+ /**
23
+ * A titled region of a page.
24
+ *
25
+ * Renders a `section` named by its own heading (`aria-labelledby`), so a
26
+ * screen reader can jump between the page's regions by name. The header is
27
+ * title and description with the actions beside them; the children follow
28
+ * at the section's own gap, tighter than the page's.
29
+ */
30
+ export declare function Section({ title, titleLevel, description, actions, className, children, ...props }: SectionProps): import("react/jsx-runtime").JSX.Element;
31
+ //# sourceMappingURL=section.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../../src/section/section.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AACnE,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAW,KAAK,YAAY,EAAQ,MAAM,cAAc,CAAC;AAEhE;;;GAGG;AACH,MAAM,WAAW,YACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACrE,mFAAmF;IACnF,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,kCAAkC;IAClC,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,UAAc,EACd,WAAW,EACX,OAAO,EACP,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,YAAY,2CAoBd"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ark } from '@ark-ui/react/factory';
3
+ import { useId } from 'react';
4
+ import './section.css';
5
+ import { cx } from '../cx';
6
+ import { Heading, Text } from '../text/text';
7
+ /**
8
+ * A titled region of a page.
9
+ *
10
+ * Renders a `section` named by its own heading (`aria-labelledby`), so a
11
+ * screen reader can jump between the page's regions by name. The header is
12
+ * title and description with the actions beside them; the children follow
13
+ * at the section's own gap, tighter than the page's.
14
+ */
15
+ export function Section({ title, titleLevel = 2, description, actions, className, children, ...props }) {
16
+ const titleId = useId();
17
+ return (_jsxs(ark.section, { "aria-labelledby": titleId, className: cx('ds-section', className), ...props, children: [_jsxs("div", { className: "ds-section__header", children: [_jsxs("div", { className: "ds-section__heading", children: [_jsx(Heading, { level: titleLevel, size: "xl", id: titleId, className: "ds-section__title", children: title }), description ? (_jsx(Text, { tone: "muted", className: "ds-section__description", children: description })) : null] }), actions ? _jsx("div", { className: "ds-section__actions", children: actions }) : null] }), children] }));
18
+ }
19
+ //# sourceMappingURL=section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"section.js","sourceRoot":"","sources":["../../src/section/section.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAuC,KAAK,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAqB,IAAI,EAAE,MAAM,cAAc,CAAC;AAqBhE;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,EACtB,KAAK,EACL,UAAU,GAAG,CAAC,EACd,WAAW,EACX,OAAO,EACP,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACK;IACb,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IACxB,OAAO,CACL,MAAC,GAAG,CAAC,OAAO,uBAAkB,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,KAAM,KAAK,aACtF,eAAK,SAAS,EAAC,oBAAoB,aACjC,eAAK,SAAS,EAAC,qBAAqB,aAClC,KAAC,OAAO,IAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAC,IAAI,EAAC,EAAE,EAAE,OAAO,EAAE,SAAS,EAAC,mBAAmB,YAC7E,KAAK,GACE,EACT,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,yBAAyB,YACnD,WAAW,GACP,CACR,CAAC,CAAC,CAAC,IAAI,IACJ,EACL,OAAO,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,qBAAqB,YAAE,OAAO,GAAO,CAAC,CAAC,CAAC,IAAI,IAClE,EACL,QAAQ,IACG,CACf,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type { ShowProps } from './show';
2
+ export { Show } from './show';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/show/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Show } from './show';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/show/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}