@mohirlab/react 0.6.0 → 0.7.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 (197) hide show
  1. package/dist/components/accordion/accordion.d.ts +1 -0
  2. package/dist/components/accordion/accordion.d.ts.map +1 -1
  3. package/dist/components/accordion/accordion.js +1 -0
  4. package/dist/components/accordion/accordion.js.map +1 -1
  5. package/dist/components/accordion/accordion.styles.js +1 -0
  6. package/dist/components/accordion/index.d.ts +1 -0
  7. package/dist/components/avatar/avatar.css.d.ts +1 -0
  8. package/dist/components/avatar/avatar.css.d.ts.map +1 -1
  9. package/dist/components/avatar/avatar.d.ts +1 -0
  10. package/dist/components/avatar/avatar.d.ts.map +1 -1
  11. package/dist/components/avatar/avatar.js +1 -0
  12. package/dist/components/avatar/avatar.js.map +1 -1
  13. package/dist/components/avatar/avatar.styles.js +1 -0
  14. package/dist/components/avatar/index.d.ts +1 -0
  15. package/dist/components/badge/badge.css.d.ts +1 -0
  16. package/dist/components/badge/badge.css.d.ts.map +1 -1
  17. package/dist/components/badge/badge.d.ts +1 -0
  18. package/dist/components/badge/badge.d.ts.map +1 -1
  19. package/dist/components/badge/badge.js +1 -0
  20. package/dist/components/badge/badge.js.map +1 -1
  21. package/dist/components/badge/badge.styles.js +1 -0
  22. package/dist/components/badge/index.d.ts +1 -0
  23. package/dist/components/box/box.d.ts +1 -0
  24. package/dist/components/box/box.d.ts.map +1 -1
  25. package/dist/components/box/box.js +1 -0
  26. package/dist/components/box/box.js.map +1 -1
  27. package/dist/components/box/index.d.ts +1 -0
  28. package/dist/components/box/stack.d.ts +1 -0
  29. package/dist/components/box/stack.d.ts.map +1 -1
  30. package/dist/components/box/stack.js +1 -0
  31. package/dist/components/box/stack.js.map +1 -1
  32. package/dist/components/button/button.css.d.ts +1 -0
  33. package/dist/components/button/button.css.d.ts.map +1 -1
  34. package/dist/components/button/button.d.ts +1 -0
  35. package/dist/components/button/button.d.ts.map +1 -1
  36. package/dist/components/button/button.js +1 -0
  37. package/dist/components/button/button.js.map +1 -1
  38. package/dist/components/button/button.styles.js +1 -0
  39. package/dist/components/button/index.d.ts +1 -0
  40. package/dist/components/card/card-media.d.ts +1 -0
  41. package/dist/components/card/card-media.d.ts.map +1 -1
  42. package/dist/components/card/card-media.js +1 -0
  43. package/dist/components/card/card-media.js.map +1 -1
  44. package/dist/components/card/card.css.d.ts +1 -0
  45. package/dist/components/card/card.css.d.ts.map +1 -1
  46. package/dist/components/card/card.d.ts +1 -0
  47. package/dist/components/card/card.d.ts.map +1 -1
  48. package/dist/components/card/card.js +1 -0
  49. package/dist/components/card/card.js.map +1 -1
  50. package/dist/components/card/card.styles.js +1 -0
  51. package/dist/components/card/index.d.ts +1 -0
  52. package/dist/components/choice/choice.d.ts +1 -0
  53. package/dist/components/choice/choice.d.ts.map +1 -1
  54. package/dist/components/choice/choice.js +1 -0
  55. package/dist/components/choice/choice.js.map +1 -1
  56. package/dist/components/choice/choice.styles.js +1 -0
  57. package/dist/components/choice/index.d.ts +1 -0
  58. package/dist/components/combobox/combobox.d.ts +34 -0
  59. package/dist/components/combobox/combobox.d.ts.map +1 -0
  60. package/dist/components/combobox/combobox.js +265 -0
  61. package/dist/components/combobox/combobox.js.map +1 -0
  62. package/dist/components/combobox/combobox.styles.js +42 -0
  63. package/dist/components/combobox/combobox.styles.js.map +1 -0
  64. package/dist/components/combobox/index.d.ts +3 -0
  65. package/dist/components/dialog/dialog.css.d.ts +1 -0
  66. package/dist/components/dialog/dialog.css.d.ts.map +1 -1
  67. package/dist/components/dialog/dialog.d.ts +1 -0
  68. package/dist/components/dialog/dialog.d.ts.map +1 -1
  69. package/dist/components/dialog/dialog.js +1 -0
  70. package/dist/components/dialog/dialog.js.map +1 -1
  71. package/dist/components/dialog/dialog.styles.js +1 -0
  72. package/dist/components/dialog/index.d.ts +1 -0
  73. package/dist/components/feedback/feedback.css.d.ts +39 -0
  74. package/dist/components/feedback/feedback.css.d.ts.map +1 -0
  75. package/dist/components/feedback/feedback.d.ts +41 -0
  76. package/dist/components/feedback/feedback.d.ts.map +1 -0
  77. package/dist/components/feedback/feedback.js +70 -0
  78. package/dist/components/feedback/feedback.js.map +1 -0
  79. package/dist/components/feedback/feedback.styles.js +40 -0
  80. package/dist/components/feedback/feedback.styles.js.map +1 -0
  81. package/dist/components/feedback/index.d.ts +3 -0
  82. package/dist/components/field/field-context.d.ts +1 -0
  83. package/dist/components/field/field-context.d.ts.map +1 -1
  84. package/dist/components/field/field-context.js +1 -0
  85. package/dist/components/field/field-context.js.map +1 -1
  86. package/dist/components/field/field.d.ts +1 -0
  87. package/dist/components/field/field.d.ts.map +1 -1
  88. package/dist/components/field/field.js +1 -0
  89. package/dist/components/field/field.js.map +1 -1
  90. package/dist/components/field/field.styles.js +1 -0
  91. package/dist/components/field/index.d.ts +1 -0
  92. package/dist/components/field/use-field-control.js +1 -0
  93. package/dist/components/field/use-field-control.js.map +1 -1
  94. package/dist/components/icon/icon.d.ts +1 -0
  95. package/dist/components/icon/icon.d.ts.map +1 -1
  96. package/dist/components/icon/icon.js +1 -0
  97. package/dist/components/icon/icon.js.map +1 -1
  98. package/dist/components/icon/index.d.ts +1 -0
  99. package/dist/components/input/index.d.ts +1 -0
  100. package/dist/components/input/input.css.d.ts +1 -0
  101. package/dist/components/input/input.css.d.ts.map +1 -1
  102. package/dist/components/input/input.d.ts +1 -0
  103. package/dist/components/input/input.d.ts.map +1 -1
  104. package/dist/components/input/input.js +1 -0
  105. package/dist/components/input/input.js.map +1 -1
  106. package/dist/components/input/input.styles.js +1 -0
  107. package/dist/components/menu/index.d.ts +3 -0
  108. package/dist/components/menu/menu.d.ts +48 -0
  109. package/dist/components/menu/menu.d.ts.map +1 -0
  110. package/dist/components/menu/menu.js +188 -0
  111. package/dist/components/menu/menu.js.map +1 -0
  112. package/dist/components/menu/menu.styles.js +28 -0
  113. package/dist/components/menu/menu.styles.js.map +1 -0
  114. package/dist/components/navigation/index.d.ts +3 -1
  115. package/dist/components/navigation/nav.d.ts +1 -0
  116. package/dist/components/navigation/nav.d.ts.map +1 -1
  117. package/dist/components/navigation/nav.js +1 -0
  118. package/dist/components/navigation/nav.js.map +1 -1
  119. package/dist/components/navigation/navigation.styles.js +1 -0
  120. package/dist/components/navigation/pagination.d.ts +34 -0
  121. package/dist/components/navigation/pagination.d.ts.map +1 -0
  122. package/dist/components/navigation/pagination.js +109 -0
  123. package/dist/components/navigation/pagination.js.map +1 -0
  124. package/dist/components/navigation/pagination.styles.js +11 -0
  125. package/dist/components/navigation/pagination.styles.js.map +1 -0
  126. package/dist/components/navigation/tabs.d.ts +1 -0
  127. package/dist/components/navigation/tabs.d.ts.map +1 -1
  128. package/dist/components/navigation/tabs.js +1 -0
  129. package/dist/components/navigation/tabs.js.map +1 -1
  130. package/dist/components/popover/index.d.ts +1 -0
  131. package/dist/components/popover/popover.css.d.ts +1 -0
  132. package/dist/components/popover/popover.css.d.ts.map +1 -1
  133. package/dist/components/popover/popover.d.ts +1 -0
  134. package/dist/components/popover/popover.d.ts.map +1 -1
  135. package/dist/components/popover/popover.js +2 -1
  136. package/dist/components/popover/popover.js.map +1 -1
  137. package/dist/components/popover/popover.styles.js +1 -0
  138. package/dist/components/select/index.d.ts +1 -0
  139. package/dist/components/select/select.d.ts +1 -0
  140. package/dist/components/select/select.d.ts.map +1 -1
  141. package/dist/components/select/select.js +1 -0
  142. package/dist/components/select/select.js.map +1 -1
  143. package/dist/components/select/select.styles.js +1 -0
  144. package/dist/components/slider/index.d.ts +1 -0
  145. package/dist/components/slider/slider.d.ts +1 -0
  146. package/dist/components/slider/slider.d.ts.map +1 -1
  147. package/dist/components/slider/slider.js +1 -0
  148. package/dist/components/slider/slider.js.map +1 -1
  149. package/dist/components/slider/slider.styles.js +1 -0
  150. package/dist/components/table/index.d.ts +1 -0
  151. package/dist/components/table/table.d.ts +1 -0
  152. package/dist/components/table/table.d.ts.map +1 -1
  153. package/dist/components/table/table.js +1 -0
  154. package/dist/components/table/table.js.map +1 -1
  155. package/dist/components/table/table.styles.js +1 -0
  156. package/dist/components/text/index.d.ts +1 -0
  157. package/dist/components/text/text.css.d.ts +1 -0
  158. package/dist/components/text/text.css.d.ts.map +1 -1
  159. package/dist/components/text/text.d.ts +1 -0
  160. package/dist/components/text/text.d.ts.map +1 -1
  161. package/dist/components/text/text.js +1 -0
  162. package/dist/components/text/text.js.map +1 -1
  163. package/dist/components/text/text.styles.js +1 -0
  164. package/dist/components/theme-scope/theme-scope.d.ts +1 -0
  165. package/dist/components/theme-scope/theme-scope.d.ts.map +1 -1
  166. package/dist/components/theme-scope/theme-scope.js +1 -0
  167. package/dist/components/theme-scope/theme-scope.js.map +1 -1
  168. package/dist/components/toast/index.d.ts +1 -0
  169. package/dist/components/toast/toast.d.ts +1 -0
  170. package/dist/components/toast/toast.d.ts.map +1 -1
  171. package/dist/components/toast/toast.js +1 -0
  172. package/dist/components/toast/toast.js.map +1 -1
  173. package/dist/components/toast/toast.styles.js +1 -0
  174. package/dist/components/visually-hidden/index.d.ts +3 -0
  175. package/dist/components/visually-hidden/visually-hidden.d.ts +13 -0
  176. package/dist/components/visually-hidden/visually-hidden.d.ts.map +1 -0
  177. package/dist/components/visually-hidden/visually-hidden.js +19 -0
  178. package/dist/components/visually-hidden/visually-hidden.js.map +1 -0
  179. package/dist/components/visually-hidden/visually-hidden.styles.js +7 -0
  180. package/dist/components/visually-hidden/visually-hidden.styles.js.map +1 -0
  181. package/dist/hooks/index.d.ts +1 -0
  182. package/dist/hooks/use-disclosure.d.ts +1 -0
  183. package/dist/hooks/use-disclosure.d.ts.map +1 -1
  184. package/dist/hooks/use-disclosure.js +1 -0
  185. package/dist/hooks/use-disclosure.js.map +1 -1
  186. package/dist/hooks/use-presence.d.ts +1 -0
  187. package/dist/hooks/use-presence.d.ts.map +1 -1
  188. package/dist/hooks/use-presence.js +1 -0
  189. package/dist/hooks/use-presence.js.map +1 -1
  190. package/dist/index.d.ts +12 -2
  191. package/dist/index.js +9 -3
  192. package/dist/styles.css +640 -166
  193. package/dist/utils/cx.d.ts +1 -0
  194. package/dist/utils/cx.d.ts.map +1 -1
  195. package/dist/utils/cx.js +1 -0
  196. package/dist/utils/cx.js.map +1 -1
  197. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"nav.js","names":["styles.segmented","styles.segment","styles.segmentInput","styles.segmentLabel","styles.bottomNav","styles.bottomBadge","styles.bottomItem","styles.bottomNavSpacer","styles.crumbs","styles.crumb","styles.crumbCurrent","styles.crumbLink"],"sources":["../../../src/components/navigation/nav.tsx"],"sourcesContent":["import { useId, useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { iconArrowLeft, iconChevronRight, type IconData } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { Icon } from '../icon';\nimport * as styles from './navigation.css';\n\n/* ---------------------------------------------------- Segmented control */\n\nexport interface SegmentedOption {\n value: string;\n label: ReactNode;\n icon?: IconData;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps extends Omit<\n ComponentPropsWithRef<'div'>,\n 'defaultValue' | 'onChange' | 'children'\n> {\n /** Names the choice, e.g. \"View\". */\n 'aria-label': string;\n options: SegmentedOption[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n name?: string;\n /** Stretch to the container width, segments sharing it equally. */\n fullWidth?: boolean;\n}\n\n/**\n * One choice from two to five short options, such as a view or a time range. Native\n * radios underneath: arrow keys move the choice, and it submits with forms.\n */\nexport function SegmentedControl({\n options,\n value,\n defaultValue,\n onValueChange,\n name,\n fullWidth,\n className,\n ...rest\n}: SegmentedControlProps) {\n const generated = useId();\n const [internal, setInternal] = useState(defaultValue ?? options[0]?.value);\n const current = value ?? internal;\n return (\n <div\n {...rest}\n role=\"radiogroup\"\n data-full-width={fullWidth || undefined}\n className={cx(styles.segmented, className)}\n >\n {options.map((option) => (\n <label key={option.value} className={styles.segment}>\n <input\n type=\"radio\"\n className={styles.segmentInput}\n name={name ?? `ml-seg-${generated}`}\n value={option.value}\n checked={current === option.value}\n disabled={option.disabled}\n onChange={() => {\n if (value === undefined) setInternal(option.value);\n onValueChange?.(option.value);\n }}\n />\n <span className={styles.segmentLabel}>\n {option.icon && <Icon icon={option.icon} size={16} />}\n {option.label}\n </span>\n </label>\n ))}\n </div>\n );\n}\n\n/* ---------------------------------------------------------- Bottom nav */\n\nexport interface BottomNavProps extends ComponentPropsWithRef<'nav'> {\n /** Names the navigation, e.g. \"Main\". */\n 'aria-label': string;\n /** Hide from this breakpoint up, where a sidebar or top bar takes over. Default tablet. */\n hideFrom?: 'tablet' | 'desktop' | 'never';\n}\n\n/**\n * The phone tab bar: three to five top-level destinations, fixed to the bottom and\n * clear of the home indicator. Add a `BottomNavSpacer` at the end of the page so\n * content can scroll past it.\n */\nexport function BottomNav({ hideFrom = 'tablet', className, ...rest }: BottomNavProps) {\n return <nav {...rest} data-hide-from={hideFrom} className={cx(styles.bottomNav, className)} />;\n}\n\ntype BottomNavItemProps = {\n icon: IconData;\n label: string;\n /** Marks the current destination (`aria-current=\"page\"`). */\n current?: boolean;\n /** A count such as unread messages; announced with the label. */\n badge?: number;\n className?: string;\n} & (\n | ({ href: string } & Omit<ComponentPropsWithRef<'a'>, 'children'>)\n | ({ href?: undefined } & Omit<ComponentPropsWithRef<'button'>, 'children'>)\n);\n\nexport function BottomNavItem({ icon, label, current, badge, className, ...rest }: BottomNavItemProps) {\n const content = (\n <>\n <Icon icon={icon} size={22} />\n <span>{label}</span>\n {badge ? (\n <span className={styles.bottomBadge} aria-hidden=\"true\">\n {badge > 99 ? '99+' : badge}\n </span>\n ) : null}\n </>\n );\n const shared = {\n className: cx(styles.bottomItem, className),\n 'aria-current': current ? ('page' as const) : undefined,\n // The visual badge is hidden; the count is part of the accessible name instead.\n 'aria-label': badge ? `${label}, ${badge}` : undefined,\n };\n if (rest.href !== undefined) {\n return (\n <a {...(rest as ComponentPropsWithRef<'a'>)} {...shared}>\n {content}\n </a>\n );\n }\n return (\n <button type=\"button\" {...(rest as ComponentPropsWithRef<'button'>)} {...shared}>\n {content}\n </button>\n );\n}\n\n/** Reserves room under the page content for the bottom nav (on the same breakpoints). */\nexport function BottomNavSpacer({ hideFrom = 'tablet' }: Pick<BottomNavProps, 'hideFrom'>) {\n return <div aria-hidden=\"true\" data-hide-from={hideFrom} className={styles.bottomNavSpacer} />;\n}\n\n/* --------------------------------------------------------- Breadcrumbs */\n\nexport interface Crumb {\n label: ReactNode;\n href?: string;\n}\n\nexport interface BreadcrumbsProps extends Omit<ComponentPropsWithRef<'nav'>, 'children'> {\n /** From the top level down to the current page (last, not linked). */\n items: Crumb[];\n}\n\n/**\n * Where the current page sits in the hierarchy. On phones it collapses to a single\n * \"← Parent\" back link, the thing people actually use a trail for on a small screen.\n */\nexport function Breadcrumbs({\n items,\n className,\n 'aria-label': ariaLabel = 'Breadcrumb',\n ...rest\n}: BreadcrumbsProps) {\n const parent = items.length > 1 ? items[items.length - 2] : undefined;\n return (\n <nav {...rest} aria-label={ariaLabel} className={className}>\n <ol className={styles.crumbs}>\n {parent?.href && (\n <li className={styles.crumbBack}>\n <a className={styles.crumbLink} href={parent.href}>\n <Icon icon={iconArrowLeft} size={16} /> {parent.label}\n </a>\n </li>\n )}\n {items.map((item, index) => {\n const last = index === items.length - 1;\n return (\n <li key={index} className={styles.crumb}>\n {last || !item.href ? (\n <span className={styles.crumbCurrent} aria-current={last ? 'page' : undefined}>\n {item.label}\n </span>\n ) : (\n <a className={styles.crumbLink} href={item.href}>\n {item.label}\n </a>\n )}\n {!last && <Icon icon={iconChevronRight} size={14} className={styles.crumbSeparator} />}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n}\n"],"mappings":";;;;;;;;;;;AAkCA,SAAgB,iBAAiB,EAC/B,SACA,OACA,cACA,eACA,MACA,WACA,WACA,GAAG,QACqB;CACxB,MAAM,YAAY,MAAM;CACxB,MAAM,CAAC,UAAU,eAAe,SAAS,gBAAgB,QAAQ,EAAE,EAAE,KAAK;CAC1E,MAAM,UA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C;;CACD,CAAA;AAET"}
1
+ {"version":3,"file":"nav.js","names":["styles.segmented","styles.segment","styles.segmentInput","styles.segmentLabel","styles.bottomNav","styles.bottomBadge","styles.bottomItem","styles.bottomNavSpacer","styles.crumbs","styles.crumb","styles.crumbCurrent","styles.crumbLink"],"sources":["../../../src/components/navigation/nav.tsx"],"sourcesContent":["import { useId, useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { iconArrowLeft, iconChevronRight, type IconData } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { Icon } from '../icon';\nimport * as styles from './navigation.css';\n\n/* ---------------------------------------------------- Segmented control */\n\nexport interface SegmentedOption {\n value: string;\n label: ReactNode;\n icon?: IconData;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps extends Omit<\n ComponentPropsWithRef<'div'>,\n 'defaultValue' | 'onChange' | 'children'\n> {\n /** Names the choice, e.g. \"View\". */\n 'aria-label': string;\n options: SegmentedOption[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n name?: string;\n /** Stretch to the container width, segments sharing it equally. */\n fullWidth?: boolean;\n}\n\n/**\n * One choice from two to five short options, such as a view or a time range. Native\n * radios underneath: arrow keys move the choice, and it submits with forms.\n */\nexport function SegmentedControl({\n options,\n value,\n defaultValue,\n onValueChange,\n name,\n fullWidth,\n className,\n ...rest\n}: SegmentedControlProps) {\n const generated = useId();\n const [internal, setInternal] = useState(defaultValue ?? options[0]?.value);\n const current = value ?? internal;\n return (\n <div\n {...rest}\n role=\"radiogroup\"\n data-full-width={fullWidth || undefined}\n className={cx(styles.segmented, className)}\n >\n {options.map((option) => (\n <label key={option.value} className={styles.segment}>\n <input\n type=\"radio\"\n className={styles.segmentInput}\n name={name ?? `ml-seg-${generated}`}\n value={option.value}\n checked={current === option.value}\n disabled={option.disabled}\n onChange={() => {\n if (value === undefined) setInternal(option.value);\n onValueChange?.(option.value);\n }}\n />\n <span className={styles.segmentLabel}>\n {option.icon && <Icon icon={option.icon} size={16} />}\n {option.label}\n </span>\n </label>\n ))}\n </div>\n );\n}\n\n/* ---------------------------------------------------------- Bottom nav */\n\nexport interface BottomNavProps extends ComponentPropsWithRef<'nav'> {\n /** Names the navigation, e.g. \"Main\". */\n 'aria-label': string;\n /** Hide from this breakpoint up, where a sidebar or top bar takes over. Default tablet. */\n hideFrom?: 'tablet' | 'desktop' | 'never';\n}\n\n/**\n * The phone tab bar: three to five top-level destinations, fixed to the bottom and\n * clear of the home indicator. Add a `BottomNavSpacer` at the end of the page so\n * content can scroll past it.\n */\nexport function BottomNav({ hideFrom = 'tablet', className, ...rest }: BottomNavProps) {\n return <nav {...rest} data-hide-from={hideFrom} className={cx(styles.bottomNav, className)} />;\n}\n\ntype BottomNavItemProps = {\n icon: IconData;\n label: string;\n /** Marks the current destination (`aria-current=\"page\"`). */\n current?: boolean;\n /** A count such as unread messages; announced with the label. */\n badge?: number;\n className?: string;\n} & (\n | ({ href: string } & Omit<ComponentPropsWithRef<'a'>, 'children'>)\n | ({ href?: undefined } & Omit<ComponentPropsWithRef<'button'>, 'children'>)\n);\n\nexport function BottomNavItem({ icon, label, current, badge, className, ...rest }: BottomNavItemProps) {\n const content = (\n <>\n <Icon icon={icon} size={22} />\n <span>{label}</span>\n {badge ? (\n <span className={styles.bottomBadge} aria-hidden=\"true\">\n {badge > 99 ? '99+' : badge}\n </span>\n ) : null}\n </>\n );\n const shared = {\n className: cx(styles.bottomItem, className),\n 'aria-current': current ? ('page' as const) : undefined,\n // The visual badge is hidden; the count is part of the accessible name instead.\n 'aria-label': badge ? `${label}, ${badge}` : undefined,\n };\n if (rest.href !== undefined) {\n return (\n <a {...(rest as ComponentPropsWithRef<'a'>)} {...shared}>\n {content}\n </a>\n );\n }\n return (\n <button type=\"button\" {...(rest as ComponentPropsWithRef<'button'>)} {...shared}>\n {content}\n </button>\n );\n}\n\n/** Reserves room under the page content for the bottom nav (on the same breakpoints). */\nexport function BottomNavSpacer({ hideFrom = 'tablet' }: Pick<BottomNavProps, 'hideFrom'>) {\n return <div aria-hidden=\"true\" data-hide-from={hideFrom} className={styles.bottomNavSpacer} />;\n}\n\n/* --------------------------------------------------------- Breadcrumbs */\n\nexport interface Crumb {\n label: ReactNode;\n href?: string;\n}\n\nexport interface BreadcrumbsProps extends Omit<ComponentPropsWithRef<'nav'>, 'children'> {\n /** From the top level down to the current page (last, not linked). */\n items: Crumb[];\n}\n\n/**\n * Where the current page sits in the hierarchy. On phones it collapses to a single\n * \"← Parent\" back link, the thing people actually use a trail for on a small screen.\n */\nexport function Breadcrumbs({\n items,\n className,\n 'aria-label': ariaLabel = 'Breadcrumb',\n ...rest\n}: BreadcrumbsProps) {\n const parent = items.length > 1 ? items[items.length - 2] : undefined;\n return (\n <nav {...rest} aria-label={ariaLabel} className={className}>\n <ol className={styles.crumbs}>\n {parent?.href && (\n <li className={styles.crumbBack}>\n <a className={styles.crumbLink} href={parent.href}>\n <Icon icon={iconArrowLeft} size={16} /> {parent.label}\n </a>\n </li>\n )}\n {items.map((item, index) => {\n const last = index === items.length - 1;\n return (\n <li key={index} className={styles.crumb}>\n {last || !item.href ? (\n <span className={styles.crumbCurrent} aria-current={last ? 'page' : undefined}>\n {item.label}\n </span>\n ) : (\n <a className={styles.crumbLink} href={item.href}>\n {item.label}\n </a>\n )}\n {!last && <Icon icon={iconChevronRight} size={14} className={styles.crumbSeparator} />}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAkCA,SAAgB,iBAAiB,EAC/B,SACA,OACA,cACA,eACA,MACA,WACA,WACA,GAAG,QACqB;CACxB,MAAM,YAAY,MAAM;CACxB,MAAM,CAAC,UAAU,eAAe,SAAS,gBAAgB,QAAQ,EAAE,EAAE,KAAK;CAC1E,MAAM,UAAU,SAAS;CACzB,OACE,oBAAC,OAAD;EACE,GAAI;EACJ,MAAK;EACL,mBAAiB,aAAa,KAAA;EAC9B,WAAW,GAAGA,WAAkB,SAAS;EAExC,UAAA,QAAQ,KAAK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@ -0,0 +1,34 @@
1
+
2
+ import { ComponentPropsWithRef, ReactNode } from "react";
3
+ /**
4
+ * The pages to show, with `'gap'` for elided runs. The result always has the same
5
+ * length once there are enough pages, so the controls never shift under the pointer.
6
+ */
7
+ export declare function pageRange(page: number, pageCount: number, siblings?: number): (number | 'gap')[];
8
+ export interface PaginationLabels {
9
+ previous: string;
10
+ next: string;
11
+ /** Accessible name of a page number. */
12
+ page: (page: number) => string;
13
+ /** Shown on phones instead of the page numbers. */
14
+ status: (page: number, pageCount: number) => ReactNode;
15
+ }
16
+ export interface PaginationProps extends Omit<ComponentPropsWithRef<'nav'>, 'children' | 'onChange'> {
17
+ /** The current page, from 1. */
18
+ page: number;
19
+ pageCount: number;
20
+ /** Called with the chosen page. Not needed when `href` makes them links. */
21
+ onPageChange?: (page: number) => void;
22
+ /** Give each page a URL and the controls become links, so pages can be opened in tabs. */
23
+ href?: (page: number) => string;
24
+ /** Page numbers on each side of the current one. Default 1. */
25
+ siblings?: number;
26
+ /** Text for other languages. */
27
+ labels?: Partial<PaginationLabels>;
28
+ }
29
+ /**
30
+ * Moves between pages of a list or table. Below tablet width the numbers give way to
31
+ * "Page 3 of 12" between Previous and Next, which fits any phone.
32
+ */
33
+ export declare function Pagination({ page, pageCount, onPageChange, href, siblings, labels: labelsProp, className, 'aria-label': ariaLabel, ...rest }: PaginationProps): import("react").JSX.Element;
34
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","names":[],"sources":["../../../src/components/navigation/pagination.tsx"],"mappings":";;;;;;wBASgB,UAAU,cAAc,mBAAmB;iBAe1C;EACf;EACA;;EAEA,OAAO;;EAEP,SAAS,cAAc,sBAAsB;;iBAU9B,wBAAwB,KAAK;;EAE5C;EACA;;EAEA,gBAAgB;;EAEhB,QAAQ;;EAER;;EAEA,SAAS,QAAQ;;;;;;wBAOH,aACd,MACA,WACA,cACA,MACA,UACA,QAAQ,YACR,yBACc,cACX,QACF,kCAAe,IAAA"}
@@ -0,0 +1,109 @@
1
+ "use client";
2
+ import { iconChevronLeft, iconChevronRight } from "@mohirlab/icons";
3
+ import { Icon } from "../icon/icon.js";
4
+ import { gap, page, pageItem, pagination, status, step } from "./pagination.styles.js";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ // src/components/navigation/pagination.tsx
7
+ /**
8
+ * The pages to show, with `'gap'` for elided runs. The result always has the same
9
+ * length once there are enough pages, so the controls never shift under the pointer.
10
+ */
11
+ function pageRange(page, pageCount, siblings = 1) {
12
+ if (pageCount <= siblings * 2 + 5) return Array.from({ length: pageCount }, (_, i) => i + 1);
13
+ const current = Math.min(Math.max(page, 1), pageCount);
14
+ const span = siblings * 2 + 3;
15
+ if (current <= span - siblings) return [
16
+ ...Array.from({ length: span }, (_, i) => i + 1),
17
+ "gap",
18
+ pageCount
19
+ ];
20
+ if (current >= pageCount - span + siblings + 1) return [
21
+ 1,
22
+ "gap",
23
+ ...Array.from({ length: span }, (_, i) => pageCount - span + 1 + i)
24
+ ];
25
+ return [
26
+ 1,
27
+ "gap",
28
+ ...Array.from({ length: siblings * 2 + 1 }, (_, i) => current - siblings + i),
29
+ "gap",
30
+ pageCount
31
+ ];
32
+ }
33
+ const defaultLabels = {
34
+ previous: "Previous",
35
+ next: "Next",
36
+ page: (page) => `Page ${page}`,
37
+ status: (page, pageCount) => `Page ${page} of ${pageCount}`
38
+ };
39
+ /**
40
+ * Moves between pages of a list or table. Below tablet width the numbers give way to
41
+ * "Page 3 of 12" between Previous and Next, which fits any phone.
42
+ */
43
+ function Pagination({ page: page$1, pageCount, onPageChange, href, siblings = 1, labels: labelsProp, className, "aria-label": ariaLabel = "Pagination", ...rest }) {
44
+ const labels = {
45
+ ...defaultLabels,
46
+ ...labelsProp
47
+ };
48
+ const count = Math.max(1, pageCount);
49
+ const current = Math.min(Math.max(1, page$1), count);
50
+ const control = (target, kind, content, props = {}) => {
51
+ const disabled = target < 1 || target > count;
52
+ const isCurrent = target === current && kind === "ml_1365oi13";
53
+ if (href) return /* @__PURE__ */ jsx("a", {
54
+ ...props,
55
+ className: kind,
56
+ href: disabled || isCurrent ? void 0 : href(target),
57
+ "aria-disabled": disabled || void 0,
58
+ "aria-current": isCurrent ? "page" : void 0,
59
+ role: disabled ? "link" : void 0,
60
+ onClick: () => !disabled && !isCurrent && onPageChange?.(target),
61
+ children: content
62
+ });
63
+ return /* @__PURE__ */ jsx("button", {
64
+ ...props,
65
+ type: "button",
66
+ className: kind,
67
+ disabled,
68
+ "aria-current": isCurrent ? "page" : void 0,
69
+ onClick: () => !isCurrent && onPageChange?.(target),
70
+ children: content
71
+ });
72
+ };
73
+ return /* @__PURE__ */ jsx("nav", {
74
+ ...rest,
75
+ "aria-label": ariaLabel,
76
+ className,
77
+ children: /* @__PURE__ */ jsxs("ul", {
78
+ className: pagination,
79
+ children: [
80
+ /* @__PURE__ */ jsx("li", { children: control(current - 1, step, /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, {
81
+ icon: iconChevronLeft,
82
+ size: 16
83
+ }), labels.previous] })) }),
84
+ pageRange(current, count, siblings).map((item, index) => item === "gap" ? /* @__PURE__ */ jsx("li", {
85
+ className: pageItem,
86
+ "aria-hidden": "true",
87
+ children: /* @__PURE__ */ jsx("span", {
88
+ className: gap,
89
+ children: "…"
90
+ })
91
+ }, `gap-${index}`) : /* @__PURE__ */ jsx("li", {
92
+ className: pageItem,
93
+ children: control(item, page, item, { "aria-label": labels.page(item) })
94
+ }, item)),
95
+ /* @__PURE__ */ jsx("li", {
96
+ className: status,
97
+ children: labels.status(current, count)
98
+ }),
99
+ /* @__PURE__ */ jsx("li", { children: control(current + 1, step, /* @__PURE__ */ jsxs(Fragment, { children: [labels.next, /* @__PURE__ */ jsx(Icon, {
100
+ icon: iconChevronRight,
101
+ size: 16
102
+ })] })) })
103
+ ]
104
+ })
105
+ });
106
+ }
107
+ export { Pagination, pageRange };
108
+
109
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.js","names":["page","styles.pagination","styles.step","styles.pageItem","styles.gap","styles.page","styles.status"],"sources":["../../../src/components/navigation/pagination.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ReactNode } from 'react';\nimport { iconChevronLeft, iconChevronRight } from '@mohirlab/icons';\nimport { Icon } from '../icon';\nimport * as styles from './pagination.css';\n\n/**\n * The pages to show, with `'gap'` for elided runs. The result always has the same\n * length once there are enough pages, so the controls never shift under the pointer.\n */\nexport function pageRange(page: number, pageCount: number, siblings = 1): (number | 'gap')[] {\n const slots = siblings * 2 + 5; // first, last, current, siblings and two gaps\n if (pageCount <= slots) return Array.from({ length: pageCount }, (_, i) => i + 1);\n const current = Math.min(Math.max(page, 1), pageCount);\n const span = siblings * 2 + 3; // run of numbers next to one gap\n if (current <= span - siblings) {\n return [...Array.from({ length: span }, (_, i) => i + 1), 'gap', pageCount];\n }\n if (current >= pageCount - span + siblings + 1) {\n return [1, 'gap', ...Array.from({ length: span }, (_, i) => pageCount - span + 1 + i)];\n }\n const middle = Array.from({ length: siblings * 2 + 1 }, (_, i) => current - siblings + i);\n return [1, 'gap', ...middle, 'gap', pageCount];\n}\n\nexport interface PaginationLabels {\n previous: string;\n next: string;\n /** Accessible name of a page number. */\n page: (page: number) => string;\n /** Shown on phones instead of the page numbers. */\n status: (page: number, pageCount: number) => ReactNode;\n}\n\nconst defaultLabels: PaginationLabels = {\n previous: 'Previous',\n next: 'Next',\n page: (page) => `Page ${page}`,\n status: (page, pageCount) => `Page ${page} of ${pageCount}`,\n};\n\nexport interface PaginationProps extends Omit<ComponentPropsWithRef<'nav'>, 'children' | 'onChange'> {\n /** The current page, from 1. */\n page: number;\n pageCount: number;\n /** Called with the chosen page. Not needed when `href` makes them links. */\n onPageChange?: (page: number) => void;\n /** Give each page a URL and the controls become links, so pages can be opened in tabs. */\n href?: (page: number) => string;\n /** Page numbers on each side of the current one. Default 1. */\n siblings?: number;\n /** Text for other languages. */\n labels?: Partial<PaginationLabels>;\n}\n\n/**\n * Moves between pages of a list or table. Below tablet width the numbers give way to\n * \"Page 3 of 12\" between Previous and Next, which fits any phone.\n */\nexport function Pagination({\n page,\n pageCount,\n onPageChange,\n href,\n siblings = 1,\n labels: labelsProp,\n className,\n 'aria-label': ariaLabel = 'Pagination',\n ...rest\n}: PaginationProps) {\n const labels = { ...defaultLabels, ...labelsProp };\n const count = Math.max(1, pageCount);\n const current = Math.min(Math.max(1, page), count);\n\n const control = (target: number, kind: string, content: ReactNode, props: object = {}) => {\n const disabled = target < 1 || target > count;\n const isCurrent = target === current && kind === styles.page;\n if (href) {\n return (\n <a\n {...props}\n className={kind}\n href={disabled || isCurrent ? undefined : href(target)}\n aria-disabled={disabled || undefined}\n aria-current={isCurrent ? 'page' : undefined}\n role={disabled ? 'link' : undefined}\n onClick={() => !disabled && !isCurrent && onPageChange?.(target)}\n >\n {content}\n </a>\n );\n }\n return (\n <button\n {...props}\n type=\"button\"\n className={kind}\n disabled={disabled}\n aria-current={isCurrent ? 'page' : undefined}\n onClick={() => !isCurrent && onPageChange?.(target)}\n >\n {content}\n </button>\n );\n };\n\n return (\n <nav {...rest} aria-label={ariaLabel} className={className}>\n <ul className={styles.pagination}>\n <li>\n {control(\n current - 1,\n styles.step,\n <>\n <Icon icon={iconChevronLeft} size={16} />\n {labels.previous}\n </>,\n )}\n </li>\n {pageRange(current, count, siblings).map((item, index) =>\n item === 'gap' ? (\n <li key={`gap-${index}`} className={styles.pageItem} aria-hidden=\"true\">\n <span className={styles.gap}>…</span>\n </li>\n ) : (\n <li key={item} className={styles.pageItem}>\n {control(item, styles.page, item, { 'aria-label': labels.page(item) })}\n </li>\n ),\n )}\n <li className={styles.status}>{labels.status(current, count)}</li>\n <li>\n {control(\n current + 1,\n styles.step,\n <>\n {labels.next}\n <Icon icon={iconChevronRight} size={16} />\n </>,\n )}\n </li>\n </ul>\n </nav>\n );\n}\n"],"mappings":";;;;;;;;;;AASA,SAA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AA,CAAA,CACJ,EACE,CAAA;GACF;;CACD,CAAA;AAET"}
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ // src/components/navigation/pagination.css.ts
3
+ var gap = "ml_1365oi15";
4
+ var page = "ml_1365oi13";
5
+ var pageItem = "ml_1365oi11";
6
+ var pagination = "ml_1365oi10";
7
+ var status = "ml_1365oi12";
8
+ var step = "ml_1365oi14";
9
+ export { gap, page, pageItem, pagination, status, step };
10
+
11
+ //# sourceMappingURL=pagination.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.styles.js","names":[],"sources":[],"mappings":""}
@@ -1,3 +1,4 @@
1
+
1
2
  import { ComponentPropsWithRef, ReactNode } from "react";
2
3
  export interface TabsProps extends Omit<ComponentPropsWithRef<'div'>, 'defaultValue' | 'onChange'> {
3
4
  /** The selected tab (controlled). */
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.d.ts","names":[],"sources":["../../../src/components/navigation/tabs.tsx"],"mappings":";iBAyBiB,kBAAkB,KAAK;;EAEtC;;EAEA;EACA,iBAAiB;EACjB,UAAU;;;;;;wBAOI,OAAO,OAAO,cAAmB,eAAe,aAAa,QAAQ,4BAAS,IAAA;iBAmB7E,qBAAqB;;EAEpC;;;wBAIc,UAAU,WAAW,cAAc,QAAQ,+BAAY,IAAA;iBAyBtD,iBAAiB,KAAK;EACrC;;wBAGc,MAAM,OAAO,WAAW,YAAY,QAAQ,2BAAQ,IAAA;iBAsBnD,sBAAsB;EACrC;;;wBAIc,WAAW,OAAO,cAAc,QAAQ,gCAAa,IAAA"}
1
+ {"version":3,"file":"tabs.d.ts","names":[],"sources":["../../../src/components/navigation/tabs.tsx"],"mappings":";;iBAyBiB,kBAAkB,KAAK;;EAEtC;;EAEA;EACA,iBAAiB;EACjB,UAAU;;;;;;wBAOI,OAAO,OAAO,cAAmB,eAAe,aAAa,QAAQ,4BAAS,IAAA;iBAmB7E,qBAAqB;;EAEpC;;;wBAIc,UAAU,WAAW,cAAc,QAAQ,+BAAY,IAAA;iBAyBtD,iBAAiB,KAAK;EACrC;;wBAGc,MAAM,OAAO,WAAW,YAAY,QAAQ,2BAAQ,IAAA;iBAsBnD,sBAAsB;EACrC;;;wBAIc,WAAW,OAAO,cAAc,QAAQ,gCAAa,IAAA"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createContext, useContext, useId, useState } from "react";
2
3
  import { cx } from "../../utils/cx.js";
3
4
  import { tab, tabList, tabPanel } from "./navigation.styles.js";
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.js","names":["styles.tabList","styles.tab","styles.tabPanel"],"sources":["../../../src/components/navigation/tabs.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n useId,\n useState,\n type ComponentPropsWithRef,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './navigation.css';\n\ninterface TabsContextValue {\n value: string;\n select: (value: string) => void;\n idFor: (kind: 'tab' | 'panel', value: string) => string;\n}\n\nconst TabsContext = createContext<TabsContextValue | null>(null);\nconst useTabs = () => {\n const context = useContext(TabsContext);\n if (!context) throw new Error('Tab parts must be used inside <Tabs>.');\n return context;\n};\n\nexport interface TabsProps extends Omit<ComponentPropsWithRef<'div'>, 'defaultValue' | 'onChange'> {\n /** The selected tab (controlled). */\n value?: string;\n /** The tab selected first (uncontrolled). One of `value` or `defaultValue` is required. */\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n children: ReactNode;\n}\n\n/**\n * Tabs switch between panels of related content in place. For moving between pages,\n * use links instead. Follows the WAI-ARIA tabs pattern with automatic activation.\n */\nexport function Tabs({ value, defaultValue = '', onValueChange, children, ...rest }: TabsProps) {\n const base = useId();\n const [internal, setInternal] = useState(defaultValue);\n const current = value ?? internal;\n const context: TabsContextValue = {\n value: current,\n select: (next) => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n },\n idFor: (kind, v) => `${base}-${kind}-${v.replace(/[^\\w-]/g, '_')}`,\n };\n return (\n <TabsContext.Provider value={context}>\n <div {...rest}>{children}</div>\n </TabsContext.Provider>\n );\n}\n\nexport interface TabListProps extends ComponentPropsWithRef<'div'> {\n /** Names the set of tabs, e.g. \"Invoice views\". */\n 'aria-label': string;\n}\n\n/** The row of tabs. Arrow keys, Home and End move between tabs and select them. */\nexport function TabList({ className, onKeyDown, ...rest }: TabListProps) {\n const onKey = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n const tabs = [...event.currentTarget.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]:not(:disabled)')];\n const index = tabs.indexOf(document.activeElement as HTMLButtonElement);\n if (index === -1) return;\n const rtl = getComputedStyle(event.currentTarget).direction === 'rtl';\n const step = { ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1 }[event.key];\n let next: HTMLButtonElement | undefined;\n if (step) next = tabs[(index + step + tabs.length) % tabs.length];\n else if (event.key === 'Home') next = tabs[0];\n else if (event.key === 'End') next = tabs.at(-1);\n if (!next) return;\n event.preventDefault();\n next.focus();\n next.click();\n };\n return (\n // WAI-ARIA tabs pattern: focus lives on the tabs (roving tabindex), not on the list.\n // The list only handles keys that bubble up from the focused tab.\n // oxlint-disable-next-line jsx-a11y/interactive-supports-focus\n <div {...rest} role=\"tablist\" className={cx(styles.tabList, className)} onKeyDown={onKey} />\n );\n}\n\nexport interface TabProps extends Omit<ComponentPropsWithRef<'button'>, 'value'> {\n value: string;\n}\n\nexport function Tab({ value, className, onClick, ...rest }: TabProps) {\n const tabs = useTabs();\n const selected = tabs.value === value;\n return (\n <button\n {...rest}\n type=\"button\"\n role=\"tab\"\n id={tabs.idFor('tab', value)}\n aria-controls={tabs.idFor('panel', value)}\n aria-selected={selected}\n // Roving tabindex: Tab moves into the list once, arrows move within it.\n tabIndex={selected ? 0 : -1}\n className={cx(styles.tab, className)}\n onClick={(event) => {\n onClick?.(event);\n tabs.select(value);\n }}\n />\n );\n}\n\nexport interface TabPanelProps extends ComponentPropsWithRef<'div'> {\n value: string;\n}\n\n/** Content for one tab. Hidden panels stay in the DOM (state is kept) but are not shown. */\nexport function TabPanel({ value, className, ...rest }: TabPanelProps) {\n const tabs = useTabs();\n const selected = tabs.value === value;\n return (\n <div\n {...rest}\n role=\"tabpanel\"\n id={tabs.idFor('panel', value)}\n aria-labelledby={tabs.idFor('tab', value)}\n tabIndex={0}\n hidden={!selected}\n className={cx(styles.tabPanel, className)}\n />\n );\n}\n"],"mappings":";;;;;AAkBA,MAAM,cAAc,cAAuC,IAAI;AAC/D,MAAM,gBAAgB;CACpB,MAAM,UAAU,WAAW,WAAW;CACtC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,uCAAuC;CACrE,OAAO;AACT;;;;;AAeA,SAAgB,KAAK,EAAE,OAAO,eAAe,IAAI,eAAe,UAAU,GAAG,QAAmB;CAC9F,MAAM,OAAO,MAAM;CACnB,MAAM,CAAC,UAAU,eAAe,SAAS,YAAY;CAErD,MAAM,UAA4B;EAChC,OAFc,SAAS;EAGvB,SAAS,SAAS;GAChB,IAAI,UAAU,KAAA,GAAW,YAAY,IAAI;GACzC,gBAAgB,IAAI;EACtB;EACA,QAAQ,MAAM,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,EAAE,QAAQ,WAAW,GAAG;CACjE;CACA,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAO;EAC3B,UAAA,oBAAC,OAAD;GAAK,GAAI;GAAO;EAAc,CAAA;CACV,CAAA;AAE1B;;AAQA,SAAgB,QAAQ,EAAE,WAAW,WAAW,GAAG,QAAsB;CACvE,MAAM,SAAS,UAAyC;EACtD,YAAY,KAAK;EACjB,MAAM,OAAO,CAAC,GAAG,MAAM,cAAc,iBAAoC,+BAA6B,CAAC;EACvG,MAAM,QAAQ,KAAK,QAAQ,SAAS,aAAkC;EACtE,IAAI,UAAU,IAAI;EAClB,MAAM,MAAM,iBAAiB,MAAM,aAAa,CAAC,CAAC,cAAc;EAChE,MAAM,OAAO;GAAE,YAAY,MAAM,KAAK;GAAG,WAAW,MAAM,IAAI;EAAG,EAAE,MAAM;EACzE,IAAI;EACJ,IAAI,MAAM,OAAO,MAAM,QAAQ,OAAO,KAAK,UAAU,KAAK;OACrD,IAAI,MAAM,QAAQ,QAAQ,OAAO,KAAK;OACtC,IAAI,MAAM,QAAQ,OAAO,OAAO,KAAK,GAAG,EAAE;EAC/C,IAAI,CAAC,MAAM;EACX,MAAM,eAAe;EACrB,KAAK,MAAM;EACX,KAAK,MAAM;CACb;CACA,OAIE,oBAAC,OAAD;EAAK,GAAI;EAAM,MAAK;EAAU,WAAW,GAAGA,SAAgB,SAAS;EAAG,WAAW;CAAQ,CAAA;AAE/F;AAMA,SAAgB,IAAI,EAAE,OAAO,WAAW,SAAS,GAAG,QAAkB;CACpE,MAAM,OAAO,QAAQ;CACrB,MAAM,WAAW,KAAK,UAAU;CAChC,OACE,oBAAC,UAAD;EACE,GAAI;EACJ,MAAK;EACL,MAAK;EACL,IAAI,KAAK,MAAM,OAAO,KAAK;EAC3B,iBAAe,KAAK,MAAM,SAAS,KAAK;EACxC,iBAAe;EAEf,UAAU,WAAW,IAAI;EACzB,WAAW,GAAGC,KAAY,SAAS;EACnC,UAAU,UAAU;GAClB,UAAU,KAAK;GACf,KAAK,OAAO,KAAK;EACnB;CACD,CAAA;AAEL;;AAOA,SAAgB,SAAS,EAAE,OAAO,WAAW,GAAG,QAAuB;CACrE,MAAM,OAAO,QAAQ;CACrB,MAAM,WAAW,KAAK,UAAU;CAChC,OACE,oBAAC,OAAD;EACE,GAAI;EACJ,MAAK;EACL,IAAI,KAAK,MAAM,SAAS,KAAK;EAC7B,mBAAiB,KAAK,MAAM,OAAO,KAAK;EACxC,UAAU;EACV,QAAQ,CAAC;EACT,WAAW,GAAGC,UAAiB,SAAS;CACzC,CAAA;AAEL"}
1
+ {"version":3,"file":"tabs.js","names":["styles.tabList","styles.tab","styles.tabPanel"],"sources":["../../../src/components/navigation/tabs.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n useId,\n useState,\n type ComponentPropsWithRef,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './navigation.css';\n\ninterface TabsContextValue {\n value: string;\n select: (value: string) => void;\n idFor: (kind: 'tab' | 'panel', value: string) => string;\n}\n\nconst TabsContext = createContext<TabsContextValue | null>(null);\nconst useTabs = () => {\n const context = useContext(TabsContext);\n if (!context) throw new Error('Tab parts must be used inside <Tabs>.');\n return context;\n};\n\nexport interface TabsProps extends Omit<ComponentPropsWithRef<'div'>, 'defaultValue' | 'onChange'> {\n /** The selected tab (controlled). */\n value?: string;\n /** The tab selected first (uncontrolled). One of `value` or `defaultValue` is required. */\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n children: ReactNode;\n}\n\n/**\n * Tabs switch between panels of related content in place. For moving between pages,\n * use links instead. Follows the WAI-ARIA tabs pattern with automatic activation.\n */\nexport function Tabs({ value, defaultValue = '', onValueChange, children, ...rest }: TabsProps) {\n const base = useId();\n const [internal, setInternal] = useState(defaultValue);\n const current = value ?? internal;\n const context: TabsContextValue = {\n value: current,\n select: (next) => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n },\n idFor: (kind, v) => `${base}-${kind}-${v.replace(/[^\\w-]/g, '_')}`,\n };\n return (\n <TabsContext.Provider value={context}>\n <div {...rest}>{children}</div>\n </TabsContext.Provider>\n );\n}\n\nexport interface TabListProps extends ComponentPropsWithRef<'div'> {\n /** Names the set of tabs, e.g. \"Invoice views\". */\n 'aria-label': string;\n}\n\n/** The row of tabs. Arrow keys, Home and End move between tabs and select them. */\nexport function TabList({ className, onKeyDown, ...rest }: TabListProps) {\n const onKey = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n const tabs = [...event.currentTarget.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]:not(:disabled)')];\n const index = tabs.indexOf(document.activeElement as HTMLButtonElement);\n if (index === -1) return;\n const rtl = getComputedStyle(event.currentTarget).direction === 'rtl';\n const step = { ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1 }[event.key];\n let next: HTMLButtonElement | undefined;\n if (step) next = tabs[(index + step + tabs.length) % tabs.length];\n else if (event.key === 'Home') next = tabs[0];\n else if (event.key === 'End') next = tabs.at(-1);\n if (!next) return;\n event.preventDefault();\n next.focus();\n next.click();\n };\n return (\n // WAI-ARIA tabs pattern: focus lives on the tabs (roving tabindex), not on the list.\n // The list only handles keys that bubble up from the focused tab.\n // oxlint-disable-next-line jsx-a11y/interactive-supports-focus\n <div {...rest} role=\"tablist\" className={cx(styles.tabList, className)} onKeyDown={onKey} />\n );\n}\n\nexport interface TabProps extends Omit<ComponentPropsWithRef<'button'>, 'value'> {\n value: string;\n}\n\nexport function Tab({ value, className, onClick, ...rest }: TabProps) {\n const tabs = useTabs();\n const selected = tabs.value === value;\n return (\n <button\n {...rest}\n type=\"button\"\n role=\"tab\"\n id={tabs.idFor('tab', value)}\n aria-controls={tabs.idFor('panel', value)}\n aria-selected={selected}\n // Roving tabindex: Tab moves into the list once, arrows move within it.\n tabIndex={selected ? 0 : -1}\n className={cx(styles.tab, className)}\n onClick={(event) => {\n onClick?.(event);\n tabs.select(value);\n }}\n />\n );\n}\n\nexport interface TabPanelProps extends ComponentPropsWithRef<'div'> {\n value: string;\n}\n\n/** Content for one tab. Hidden panels stay in the DOM (state is kept) but are not shown. */\nexport function TabPanel({ value, className, ...rest }: TabPanelProps) {\n const tabs = useTabs();\n const selected = tabs.value === value;\n return (\n <div\n {...rest}\n role=\"tabpanel\"\n id={tabs.idFor('panel', value)}\n aria-labelledby={tabs.idFor('tab', value)}\n tabIndex={0}\n hidden={!selected}\n className={cx(styles.tabPanel, className)}\n />\n );\n}\n"],"mappings":";;;;;;AAkBA,MAAM,cAAc,cAAuC,IAAI;AAC/D,MAAM,gBAAgB;CACpB,MAAM,UAAU,WAAW,WAAW;CACtC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,uCAAuC;CACrE,OAAO;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EAAE,OAAO,WAAW,SAAS,GAAG,QAAkB;CACpE,MAAM,OAAO,QAAQ;CACrB,MAAM,WAAW,KAAK,UAAU;CAChC,OACE,oBAAC,UAAD;EACE,GAAI;EACJ,MAAK;EACL,MAAK;EACL,IAAI,KAAK,MAAM,OAAO,KAAK;EAC3B,iBAAe,KAAK,MAAM,SAAS,KAAK;EACxC,iBAAe;EAEf,UAAU,WAAW,IAAI;EACzB,WAAW,GAAGC,KAAY,SAAS;EACnC,UAAU,UAAU;GAClB,UAAU,KAAK;GACf,KAAK,OAAO,KAAK;EACnB;CACD,CAAA;AAEL;;AAOA,SAAgB,SAAS,EAAE,OAAO,WAAW,GAAG,QAAuB;CACrE,MAAM,OAAO,QAAQ;CACrB,MAAM,WAAW,KAAK,UAAU;CAChC,OACE,oBAAC,OAAD;EACE,GAAI;EACJ,MAAK;EACL,IAAI,KAAK,MAAM,SAAS,KAAK;EAC7B,mBAAiB,KAAK,MAAM,OAAO,KAAK;EACxC,UAAU;EACV,QAAQ,CAAC;EACT,WAAW,GAAGC,UAAiB,SAAS;CACzC,CAAA;AAEL"}
@@ -1,3 +1,4 @@
1
+
1
2
  import { Popover, PopoverProps, Tooltip, TooltipProps } from "./popover.js";
2
3
  import { Placement } from "./popover.css.js";
3
4
  export { type Placement, Popover, type PopoverProps, Tooltip, type TooltipProps };
@@ -1,3 +1,4 @@
1
+
1
2
  import "@vanilla-extract/recipes";
2
3
  /**
3
4
  * Where the panel sits relative to its trigger, as CSS `position-area` values.
@@ -1 +1 @@
1
- {"version":3,"file":"popover.css.d.ts","names":[],"sources":["../../../src/components/popover/popover.css.ts"],"mappings":";;;;;cAcM;WACJ;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;YAGU,yBAAyB"}
1
+ {"version":3,"file":"popover.css.d.ts","names":[],"sources":["../../../src/components/popover/popover.css.ts"],"mappings":";;;;;;cAcM;WACJ;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;YAGU,yBAAyB"}
@@ -1,3 +1,4 @@
1
+
1
2
  import { CSSProperties, ComponentPropsWithRef, ReactElement, ReactNode } from "react";
2
3
  import { Placement } from "./popover.css.js";
3
4
  type TriggerProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"popover.d.ts","names":["styles.Placement"],"sources":["../../../src/components/popover/popover.tsx"],"mappings":";;KAcK;EACH,QAAQ;EACR;EACA;EACA,kBAAkB;EAClB,kBAAkB;EAClB,WAAW;EACX,UAAU;EACV,aAAa;;iBAQE,qBAAqB,KAAK;;EAEzC,SAAS,aAAa;;EAEtB,QAAQ;EACR,YAAYA;;EAEZ,gBAAgB;EAChB,WAAW;;;;;;;wBAQG,UACd,SACA,OACA,WACA,cACA,WACA,OACA,aACG,QACF,+BAAY,IAAA;iBAoDE;;EAEf,SAAS;;EAET,UAAU,aAAa;EACvB,YAAYA;;EAEZ;;;;;;;wBAQc,UAAU,SAAS,UAAU,WAAW,SAAe,+BAAY,IAAA"}
1
+ {"version":3,"file":"popover.d.ts","names":["styles.Placement"],"sources":["../../../src/components/popover/popover.tsx"],"mappings":";;;KAcK;EACH,QAAQ;EACR;EACA;EACA,kBAAkB;EAClB,kBAAkB;EAClB,WAAW;EACX,UAAU;EACV,aAAa;;iBAQE,qBAAqB,KAAK;;EAEzC,SAAS,aAAa;;EAEtB,QAAQ;EACR,YAAYA;;EAEZ,gBAAgB;EAChB,WAAW;;;;;;;wBAQG,UACd,SACA,OACA,WACA,cACA,WACA,OACA,aACG,QACF,+BAAY,IAAA;iBAoDE;;EAEf,SAAS;;EAET,UAAU,aAAa;EACvB,YAAYA;;EAEZ;;;;;;;wBAQc,UAAU,SAAS,UAAU,WAAW,SAAe,+BAAY,IAAA"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cloneElement, isValidElement, useEffect, useId, useRef } from "react";
2
3
  import { cx } from "../../utils/cx.js";
3
4
  import { popover, tooltip } from "./popover.styles.js";
@@ -118,6 +119,6 @@ function Tooltip({ content, children, placement, delay = 400 }) {
118
119
  children: content
119
120
  })] });
120
121
  }
121
- export { Popover, Tooltip };
122
+ export { Popover, Tooltip, useAnchorName };
122
123
 
123
124
  //# sourceMappingURL=popover.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"popover.js","names":["styles.popover","styles.tooltip"],"sources":["../../../src/components/popover/popover.tsx"],"sourcesContent":["import {\n cloneElement,\n isValidElement,\n useEffect,\n useId,\n useRef,\n type ComponentPropsWithRef,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './popover.css';\n\ntype TriggerProps = {\n style?: CSSProperties;\n popoverTarget?: string;\n 'aria-describedby'?: string;\n onPointerEnter?: (event: never) => void;\n onPointerLeave?: (event: never) => void;\n onFocus?: (event: never) => void;\n onBlur?: (event: never) => void;\n onKeyDown?: (event: never) => void;\n};\n\n/** A unique, CSS-safe anchor name per instance. */\nfunction useAnchorName() {\n return `--ml-anchor-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`;\n}\n\nexport interface PopoverProps extends Omit<ComponentPropsWithRef<'div'>, 'title' | 'popover'> {\n /** The element that toggles it: usually a `Button`. It must be a `<button>`. */\n trigger: ReactElement<TriggerProps>;\n /** Optional heading; it also names the popover. */\n title?: ReactNode;\n placement?: styles.Placement;\n /** Called when it opens or closes, including light dismiss and Escape. */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n}\n\n/**\n * Non-modal content next to its trigger: filters, details, small forms.\n * Built on the Popover API: the browser handles light dismiss, Escape and top layer,\n * and `popovertarget` exposes the expanded state. CSS anchor positioning places it.\n */\nexport function Popover({\n trigger,\n title,\n placement,\n onOpenChange,\n className,\n style,\n children,\n ...rest\n}: PopoverProps) {\n const id = useId();\n const titleId = useId();\n const anchor = useAnchorName();\n const ref = useRef<HTMLDivElement>(null);\n const onOpenChangeRef = useRef(onOpenChange);\n useEffect(() => {\n onOpenChangeRef.current = onOpenChange;\n });\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n const onToggle = (event: Event) => onOpenChangeRef.current?.((event as ToggleEvent).newState === 'open');\n el.addEventListener('toggle', onToggle);\n return () => el.removeEventListener('toggle', onToggle);\n }, []);\n\n const wiredTrigger = isValidElement(trigger)\n ? cloneElement(trigger, {\n popoverTarget: id,\n style: { ...trigger.props.style, anchorName: anchor } as CSSProperties,\n })\n : trigger;\n\n return (\n <>\n {wiredTrigger}\n <div\n {...rest}\n ref={ref}\n id={id}\n popover=\"auto\"\n // A <dialog> shown through the Popover API is unreliable across browsers, so the\n // panel stays a <div> and the role names it.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"dialog\"\n aria-labelledby={title ? titleId : undefined}\n className={cx(styles.popover({ placement }), className)}\n style={{ ...style, positionAnchor: anchor } as CSSProperties}\n >\n {title && (\n <p id={titleId} className={styles.popoverTitle}>\n {title}\n </p>\n )}\n {children}\n </div>\n </>\n );\n}\n\nexport interface TooltipProps {\n /** Short, plain text. Tooltips must never hold links, buttons or other controls. */\n content: ReactNode;\n /** The described element. It must be focusable, so keyboard users get the tooltip too. */\n children: ReactElement<TriggerProps>;\n placement?: styles.Placement;\n /** Hover delay before showing, in ms. Focus shows it straight away. Default 400. */\n delay?: number;\n}\n\n/**\n * A short description of a control, shown on hover (after a delay) and on focus,\n * hidden on leave, blur and Escape. Linked with `aria-describedby`.\n * Touch screens have no hover, so never put essential information only in a tooltip.\n */\nexport function Tooltip({ content, children, placement, delay = 400 }: TooltipProps) {\n const id = useId();\n const anchor = useAnchorName();\n const ref = useRef<HTMLDivElement>(null);\n const timer = useRef<ReturnType<typeof setTimeout>>(undefined);\n\n const show = (after = 0) => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n const el = ref.current;\n if (el && !el.matches(':popover-open')) el.showPopover();\n }, after);\n };\n const hide = () => {\n clearTimeout(timer.current);\n const el = ref.current;\n if (el?.matches(':popover-open')) el.hidePopover();\n };\n useEffect(() => {\n const pending = timer;\n return () => clearTimeout(pending.current);\n }, [timer]);\n\n const props = children.props;\n // The handlers below read refs only when the events fire; the rule cannot see that\n // through cloneElement.\n // oxlint-disable-next-line react/refs\n const trigger = cloneElement(children, {\n 'aria-describedby': [props['aria-describedby'], id].filter(Boolean).join(' '),\n style: { ...props.style, anchorName: anchor } as CSSProperties,\n onPointerEnter: (event: never) => {\n props.onPointerEnter?.(event);\n show(delay);\n },\n onPointerLeave: (event: never) => {\n props.onPointerLeave?.(event);\n hide();\n },\n onFocus: (event: never) => {\n props.onFocus?.(event);\n show(0);\n },\n onBlur: (event: never) => {\n props.onBlur?.(event);\n hide();\n },\n onKeyDown: (event: never) => {\n props.onKeyDown?.(event);\n if ((event as KeyboardEvent).key === 'Escape') hide();\n },\n });\n\n return (\n <>\n {trigger}\n <div\n ref={ref}\n id={id}\n popover=\"manual\"\n role=\"tooltip\"\n className={styles.tooltip({ placement })}\n style={{ positionAnchor: anchor } as CSSProperties}\n >\n {content}\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;AA0BA,SAAS,gBAAgB;CACvB,OAAO,eAAe,MAAM,CAAC,CAAC,QAAQ,mBAAmB,EAAE;AAC7D;;;;;;AAkBA,SAAgB,QAAQ,EACtB,SACA,OACA,WACA,cACA,WACA,OACA,UACA,GAAG,QACY;CACf,MAAM,KAAK,MAAM;CACjB,MAAM,UAAU,MAAM;CACtB,MAAM,SAAS,cAAc;CAC7B,MAAM,MAAM,OAAuB,IAAI;CACvC,MAAM,kBAAkB,OAAO,YAAY;CAC3C,gBAAgB;EACd,gBAAgB,UAAU;CAC5B,CAAC;CAED,gBAAgB;EACd,MAAM,KAAK,IAAI;EACf,IAAI,CAAC,IAAI;EACT,MAAM,YAAY,UAAiB,gBAAgB,UAAW,MAAsB,aAAa,MAAM;EACvG,GAAG,iBAAiB,UAAU,QAAQ;EACtC,aAAa,GAAG,oBAAoB,UAAU,QAAQ;CACxD,GAAG,CAAC,CAAC;CAEL,MAAM,eAAe,eAAe,OAAO,IACvC,aAAa,SAAS;EACpB,eAAe;EACf,OAA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iB,UAAiB;GAChC,MAAM,iBAAiB,KAAK;GAC5B,KAAK,KAAK;EACZ;EACA,iBAAiB,UAAiB;GAChC,MAAM,iBAAiB,KAAK;GAC5B,KAAK;EACP;EACA,UAAU,UAAiB;GACzB,MAAM,UAAU,KAAK;GACrB,KAAK,CAAC;EACR;EACA,SAAS,UAAiB;GACxB,MAAM,SAAS,KAAK;GACpB,KAAK;EACP;EACA,YAAY,UAAiB;GAC3B,MAAM,YAAY,KAAK;GACvB,IAAK,MAAwB,QAAQ,UAAU,KAAK;EACtD;CACF,CAAC;CAED,OACE,qBAAA,UAAA,EAAA,UAAA,CACG,SACD,oBAAC,OAAD;EACO;EACD;EACJ,SAAQ;EACR,MAAK;EACL,WAAWC,QAAe,EAAE,UAAU,CAAC;EACvC,OAAO,EAAE,gBAAgB,OAAO;EAE/B,UAAA;CACE,CAAA,CACL,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"popover.js","names":["styles.popover","styles.tooltip"],"sources":["../../../src/components/popover/popover.tsx"],"sourcesContent":["import {\n cloneElement,\n isValidElement,\n useEffect,\n useId,\n useRef,\n type ComponentPropsWithRef,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './popover.css';\n\ntype TriggerProps = {\n style?: CSSProperties;\n popoverTarget?: string;\n 'aria-describedby'?: string;\n onPointerEnter?: (event: never) => void;\n onPointerLeave?: (event: never) => void;\n onFocus?: (event: never) => void;\n onBlur?: (event: never) => void;\n onKeyDown?: (event: never) => void;\n};\n\n/** A unique, CSS-safe anchor name per instance. */\nexport function useAnchorName() {\n return `--ml-anchor-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`;\n}\n\nexport interface PopoverProps extends Omit<ComponentPropsWithRef<'div'>, 'title' | 'popover'> {\n /** The element that toggles it: usually a `Button`. It must be a `<button>`. */\n trigger: ReactElement<TriggerProps>;\n /** Optional heading; it also names the popover. */\n title?: ReactNode;\n placement?: styles.Placement;\n /** Called when it opens or closes, including light dismiss and Escape. */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n}\n\n/**\n * Non-modal content next to its trigger: filters, details, small forms.\n * Built on the Popover API: the browser handles light dismiss, Escape and top layer,\n * and `popovertarget` exposes the expanded state. CSS anchor positioning places it.\n */\nexport function Popover({\n trigger,\n title,\n placement,\n onOpenChange,\n className,\n style,\n children,\n ...rest\n}: PopoverProps) {\n const id = useId();\n const titleId = useId();\n const anchor = useAnchorName();\n const ref = useRef<HTMLDivElement>(null);\n const onOpenChangeRef = useRef(onOpenChange);\n useEffect(() => {\n onOpenChangeRef.current = onOpenChange;\n });\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n const onToggle = (event: Event) => onOpenChangeRef.current?.((event as ToggleEvent).newState === 'open');\n el.addEventListener('toggle', onToggle);\n return () => el.removeEventListener('toggle', onToggle);\n }, []);\n\n const wiredTrigger = isValidElement(trigger)\n ? cloneElement(trigger, {\n popoverTarget: id,\n style: { ...trigger.props.style, anchorName: anchor } as CSSProperties,\n })\n : trigger;\n\n return (\n <>\n {wiredTrigger}\n <div\n {...rest}\n ref={ref}\n id={id}\n popover=\"auto\"\n // A <dialog> shown through the Popover API is unreliable across browsers, so the\n // panel stays a <div> and the role names it.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"dialog\"\n aria-labelledby={title ? titleId : undefined}\n className={cx(styles.popover({ placement }), className)}\n style={{ ...style, positionAnchor: anchor } as CSSProperties}\n >\n {title && (\n <p id={titleId} className={styles.popoverTitle}>\n {title}\n </p>\n )}\n {children}\n </div>\n </>\n );\n}\n\nexport interface TooltipProps {\n /** Short, plain text. Tooltips must never hold links, buttons or other controls. */\n content: ReactNode;\n /** The described element. It must be focusable, so keyboard users get the tooltip too. */\n children: ReactElement<TriggerProps>;\n placement?: styles.Placement;\n /** Hover delay before showing, in ms. Focus shows it straight away. Default 400. */\n delay?: number;\n}\n\n/**\n * A short description of a control, shown on hover (after a delay) and on focus,\n * hidden on leave, blur and Escape. Linked with `aria-describedby`.\n * Touch screens have no hover, so never put essential information only in a tooltip.\n */\nexport function Tooltip({ content, children, placement, delay = 400 }: TooltipProps) {\n const id = useId();\n const anchor = useAnchorName();\n const ref = useRef<HTMLDivElement>(null);\n const timer = useRef<ReturnType<typeof setTimeout>>(undefined);\n\n const show = (after = 0) => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n const el = ref.current;\n if (el && !el.matches(':popover-open')) el.showPopover();\n }, after);\n };\n const hide = () => {\n clearTimeout(timer.current);\n const el = ref.current;\n if (el?.matches(':popover-open')) el.hidePopover();\n };\n useEffect(() => {\n const pending = timer;\n return () => clearTimeout(pending.current);\n }, [timer]);\n\n const props = children.props;\n // The handlers below read refs only when the events fire; the rule cannot see that\n // through cloneElement.\n // oxlint-disable-next-line react/refs\n const trigger = cloneElement(children, {\n 'aria-describedby': [props['aria-describedby'], id].filter(Boolean).join(' '),\n style: { ...props.style, anchorName: anchor } as CSSProperties,\n onPointerEnter: (event: never) => {\n props.onPointerEnter?.(event);\n show(delay);\n },\n onPointerLeave: (event: never) => {\n props.onPointerLeave?.(event);\n hide();\n },\n onFocus: (event: never) => {\n props.onFocus?.(event);\n show(0);\n },\n onBlur: (event: never) => {\n props.onBlur?.(event);\n hide();\n },\n onKeyDown: (event: never) => {\n props.onKeyDown?.(event);\n if ((event as KeyboardEvent).key === 'Escape') hide();\n },\n });\n\n return (\n <>\n {trigger}\n <div\n ref={ref}\n id={id}\n popover=\"manual\"\n role=\"tooltip\"\n className={styles.tooltip({ placement })}\n style={{ positionAnchor: anchor } as CSSProperties}\n >\n {content}\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;AA0BA,SAAgB,gBAAgB;CAC9B,OAAO,eAAe,MAAM,CAAC,CAAC,QAAQ,mBAAmB,EAAE;AAC7D;;;;;;AAkBA,SAAgB,QAAQ,EACtB,SACA,OACA,WACA,cACA,WACA,OACA,UACA,GAAG,QACY;CACf,MAAM,KAAK,M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YAAY;EACzD,GAAG,KAAK;CACV;CACA,MAAM,aAAa;EACjB,aAAa,MAAM,OAAO;EAC1B,MAAM,KAAK,IAAI;EACf,IAAI,IAAI,QAAQ,eAAe,GAAG,GAAG,YAAY;CACnD;CACA,gBAAgB;EACd,MAAM,UAAU;EAChB,aAAa,aAAa,QAAQ,OAAO;CAC3C,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,QAAQ,SAAS;CAIvB,MAAM,UAAU,aAAa,UAAU;EACrC,oBAAoB,CAAC,MAAM,qBAAqB,EAAE,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAC5E,OAAO;GAAE,GAAG,MAAM;GAAO,YAAY;EAAO;EAC5C,iBAAiB,UAAiB;GAChC,MAAM,iBAAiB,KAAK;GAC5B,KAAK,KAAK;EACZ;EACA,iBAAiB,UAAiB;GAChC,MAAM,iBAAiB,KAAK;GAC5B,KAAK;EACP;EACA,UAAU,UAAiB;GACzB,MAAM,UAAU,KAAK;GACrB,KAAK,CAAC;EACR;EACA,SAAS,UAAiB;GACxB,MAAM,SAAS,KAAK;GACpB,KAAK;EACP;EACA,YAAY,UAAiB;GAC3B,MAAM,YAAY,KAAK;GACvB,IAAK,MAAwB,QAAQ,UAAU,KAAK;EACtD;CACF,CAAC;CAED,OACE,qBAAA,UAAA,EAAA,UAAA,CACG,SACD,oBAAC,OAAD;EACO;EACD;EACJ,SAAQ;EACR,MAAK;EACL,WAAWC,QAAe,EAAE,UAAU,CAAC;EACvC,OAAO,EAAE,gBAAgB,OAAO;EAE/B,UAAA;CACE,CAAA,CACL,EAAA,CAAA;AAEN"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createRuntimeFn } from "@vanilla-extract/recipes/createRuntimeFn";
2
3
  // src/components/popover/popover.css.ts
3
4
  var popover = createRuntimeFn({
@@ -1,2 +1,3 @@
1
+
1
2
  import { Select, SelectProps } from "./select.js";
2
3
  export { Select, type SelectProps };
@@ -1,3 +1,4 @@
1
+
1
2
  import { ComponentPropsWithRef } from "react";
2
3
  import { InputVariants } from "../input/input.css.js";
3
4
  export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'size'> {
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","names":[],"sources":["../../../src/components/select/select.tsx"],"mappings":";;iBAQiB,oBAAoB,KAAK;EACxC,OAAO;EACP;;EAEA;;;;;;wBAOc,SACd,MACA,SACA,aACA,WACA,IACA,UACA,UACA,UACA,cACA,UACG,QACF,8BAAW,IAAA"}
1
+ {"version":3,"file":"select.d.ts","names":[],"sources":["../../../src/components/select/select.tsx"],"mappings":";;;iBAQiB,oBAAoB,KAAK;EACxC,OAAO;EACP;;EAEA;;;;;;wBAOc,SACd,MACA,SACA,aACA,WACA,IACA,UACA,UACA,UACA,cACA,UACG,QACF,8BAAW,IAAA"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { iconChevronDown } from "@mohirlab/icons";
2
3
  import { cx } from "../../utils/cx.js";
3
4
  import { useFieldControl } from "../field/use-field-control.js";
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","names":["styles.wrap","styles.select","styles.chevron"],"sources":["../../../src/components/select/select.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react';\nimport { iconChevronDown } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport { Icon } from '../icon';\nimport { input, type InputVariants } from '../input/input.css';\nimport * as styles from './select.css';\n\nexport interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'size'> {\n size?: InputVariants['size'];\n invalid?: boolean;\n /** Shown first and not selectable again once a choice is made, e.g. \"Choose a country\". */\n placeholder?: string;\n}\n\n/**\n * The native `<select>`, styled like `Input`. Phones get the system picker, keyboards\n * and screen readers get native behaviour, and forms submit it as is.\n */\nexport function Select({\n size,\n invalid,\n placeholder,\n className,\n id,\n required,\n disabled,\n children,\n defaultValue,\n value,\n ...rest\n}: SelectProps) {\n const control = useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': rest['aria-describedby'],\n });\n // With a placeholder and no value given, start on the placeholder option.\n const initial = placeholder && value === undefined && defaultValue === undefined ? '' : defaultValue;\n return (\n <span className={styles.wrap}>\n <select\n {...rest}\n {...control}\n value={value}\n defaultValue={initial}\n className={cx(input({ size }), styles.select, className)}\n >\n {placeholder && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {children}\n </select>\n <Icon icon={iconChevronDown} className={styles.chevron} size={18} />\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,SAAgB,OAAO,EACrB,MACA,SACA,aACA,WACA,IACA,UACA,UACA,UACA,cACA,OACA,GAAG,QACW;CACd,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA;EACA;EACA,oBAAoB,KAAK;CAC3B,CAAC;CAED,MAAM,UAAU,eAAe,UAAU,KAAA,KAAa,iBAAiB,KAAA,IAAY,KAAK;CACxF,OACE,qBAAC,QAAD;EAAM,WAAWA;EAAjB,UAAA,CACE,qBAAC,UAAD;GACE,GAAI;GACJ,GAAI;GACG;GACP,cAAc;GACd,WAAW,GAAG,MAAM,EAAE,KAAK,CAAC,GAAGC,QAAe,SAAS;GALzD,UAAA,CAOG,eACC,oBAAC,UAAD;IAAQ,OAAM;IAAG,UAAA;IACd,UAAA;GACK,CAAA,GAET,QACK;EACR,CAAA,GAAA,oBAAC,MAAD;GAAM,MAAM;GAAiB,WAAWC;GAAgB,MAAM;EAAK,CAAA,CAC/D;;AAEV"}
1
+ {"version":3,"file":"select.js","names":["styles.wrap","styles.select","styles.chevron"],"sources":["../../../src/components/select/select.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react';\nimport { iconChevronDown } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport { Icon } from '../icon';\nimport { input, type InputVariants } from '../input/input.css';\nimport * as styles from './select.css';\n\nexport interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'size'> {\n size?: InputVariants['size'];\n invalid?: boolean;\n /** Shown first and not selectable again once a choice is made, e.g. \"Choose a country\". */\n placeholder?: string;\n}\n\n/**\n * The native `<select>`, styled like `Input`. Phones get the system picker, keyboards\n * and screen readers get native behaviour, and forms submit it as is.\n */\nexport function Select({\n size,\n invalid,\n placeholder,\n className,\n id,\n required,\n disabled,\n children,\n defaultValue,\n value,\n ...rest\n}: SelectProps) {\n const control = useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': rest['aria-describedby'],\n });\n // With a placeholder and no value given, start on the placeholder option.\n const initial = placeholder && value === undefined && defaultValue === undefined ? '' : defaultValue;\n return (\n <span className={styles.wrap}>\n <select\n {...rest}\n {...control}\n value={value}\n defaultValue={initial}\n className={cx(input({ size }), styles.select, className)}\n >\n {placeholder && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {children}\n </select>\n <Icon icon={iconChevronDown} className={styles.chevron} size={18} />\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,SAAgB,OAAO,EACrB,MACA,SACA,aACA,WACA,IACA,UACA,UACA,UACA,cACA,OACA,GAAG,QACW;CACd,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA;EACA;EACA,oBAAoB,KAAK;CAC3B,CAAC;CAED,MAAM,UAAU,eAAe,UAAU,KAAA,KAAa,iBAAiB,KAAA,IAAY,KAAK;CACxF,OACE,qBAAC,QAAD;EAAM,WAAWA;EAAjB,UAAA,CACE,qBAAC,UAAD;GACE,GAAI;GACJ,GAAI;GACG;GACP,cAAc;GACd,WAAW,GAAG,MAAM,EAAE,KAAK,CAAC,GAAGC,QAAe,SAAS;GALzD,UAAA,CAOG,eACC,oBAAC,UAAD;IAAQ,OAAM;IAAG,UAAA;IACd,UAAA;GACK,CAAA,GAET,QACK;EACR,CAAA,GAAA,oBAAC,MAAD;GAAM,MAAM;GAAiB,WAAWC;GAAgB,MAAM;EAAK,CAAA,CAC/D;;AAEV"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  // src/components/select/select.css.ts
2
3
  var chevron = "ml_1bax71n2";
3
4
  var select = "ml_1bax71n1";
@@ -1,2 +1,3 @@
1
+
1
2
  import { Slider, SliderProps, SliderValue } from "./slider.js";
2
3
  export { Slider, type SliderProps, SliderValue };
@@ -1,3 +1,4 @@
1
+
1
2
  import { ComponentPropsWithRef, ReactNode } from "react";
2
3
  export interface SliderProps extends Omit<ComponentPropsWithRef<'input'>, 'type' | 'value' | 'defaultValue' | 'size'> {
3
4
  value?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"slider.d.ts","names":[],"sources":["../../../src/components/slider/slider.tsx"],"mappings":";iBAMiB,oBAAoB,KACnC;EAGA;EACA;EACA,iBAAiB;EACjB;EACA;EACA;;EAEA,UAAU;;;wBAII,SACd,OACA,cACA,eACA,KACA,KACA,MACA,QACA,WACA,OACA,IACA,UACA,UACA,aACG,QACF,8BAAW,IAAA;;wBA4BE,cAAc;EAAc,UAAU;oBAAW,IAAA"}
1
+ {"version":3,"file":"slider.d.ts","names":[],"sources":["../../../src/components/slider/slider.tsx"],"mappings":";;iBAMiB,oBAAoB,KACnC;EAGA;EACA;EACA,iBAAiB;EACjB;EACA;EACA;;EAEA,UAAU;;;wBAII,SACd,OACA,cACA,eACA,KACA,KACA,MACA,QACA,WACA,OACA,IACA,UACA,UACA,aACG,QACF,8BAAW,IAAA;;wBA4BE,cAAc;EAAc,UAAU;oBAAW,IAAA"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useState } from "react";
2
3
  import { assignInlineVars } from "@vanilla-extract/dynamic";
3
4
  import { cx } from "../../utils/cx.js";
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","names":["styles.slider","styles.fill","styles.output"],"sources":["../../../src/components/slider/slider.tsx"],"sourcesContent":["import { useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport * as styles from './slider.css';\n\nexport interface SliderProps extends Omit<\n ComponentPropsWithRef<'input'>,\n 'type' | 'value' | 'defaultValue' | 'size'\n> {\n value?: number;\n defaultValue?: number;\n onValueChange?: (value: number) => void;\n min?: number;\n max?: number;\n step?: number;\n /** Format the value for `aria-valuetext` and for `SliderValue`, e.g. `(v) => \\`${v}%\\``. */\n format?: (value: number) => string;\n}\n\n/** A native range input with a filled track. Arrow keys, Page Up/Down, Home and End work natively. */\nexport function Slider({\n value,\n defaultValue,\n onValueChange,\n min = 0,\n max = 100,\n step = 1,\n format,\n className,\n style,\n id,\n required,\n disabled,\n onChange,\n ...rest\n}: SliderProps) {\n const control = useFieldControl({ id, required, disabled, 'aria-describedby': rest['aria-describedby'] });\n const [internal, setInternal] = useState(defaultValue ?? (min + max) / 2);\n const current = value ?? internal;\n const percent = max === min ? 0 : ((current - min) / (max - min)) * 100;\n return (\n <input\n {...rest}\n {...control}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={current}\n aria-valuetext={format?.(current)}\n onChange={(event) => {\n onChange?.(event);\n const next = Number(event.target.value);\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n }}\n className={cx(styles.slider, className)}\n style={{ ...style, ...assignInlineVars({ [styles.fill]: `${percent}%` }) }}\n />\n );\n}\n\n/** Label row for a slider inside a `Field`: puts the current value at the end. */\nexport function SliderValue({ children }: { children: ReactNode }) {\n return <output className={styles.output}>{children}</output>;\n}\n"],"mappings":";;;;;;;;AAqBA,SAAgB,OAAO,EACrB,OACA,cACA,eACA,MAAM,GACN,MAAM,KACN,OAAO,GACP,QACA,WACA,OACA,IACA,UACA,UACA,UACA,GAAG,QACW;CACd,MAAM,UAAU,gBAAgB;EAAE;EAAI;EAAU;EAAU,oBAAoB,KAAK;CAAoB,CAAC;CACxG,MAAM,CAAC,UAAU,eAAe,SAAS,iBAAiB,MAAM,OAAO,CAAC;CACxE,MAAM,UAAU,SAAS;CACzB,MAAM,UAAU,QAAQ,MAAM,KAAM,UAAU,QAAQ,MAAM,OAAQ;CACpE,OACE,oBAAC,SAAD;EACE,GAAI;EACJ,GAAI;EACJ,MAAK;EACA;EACA;EACC;EACN,OAAO;EACP,kBAAgB,SAAS,OAAO;EAChC,WAAW,UAAU;GACnB,WAAW,KAAK;GAChB,MAAM,OAAO,OAAO,MAAM,OAAO,KAAK;GACtC,IAAI,UAAU,KAAA,GAAW,YAAY,IAAI;GACzC,gBAAgB,IAAI;EACtB;EACA,WAAW,GAAGA,QAAe,SAAS;EACtC,OAAO;GAAE,GAAG;GAAO,GAAG,iBAAiB,GAAGC,OAAc,GAAG,QAAQ,GAAG,CAAC;EAAE;CAC1E,CAAA;AAEL;;AAGA,SAAgB,YAAY,EAAE,YAAqC;CACjE,OAAO,oBAAC,UAAD;EAAQ,WAAWC;EAAgB;CAAiB,CAAA;AAC7D"}
1
+ {"version":3,"file":"slider.js","names":["styles.slider","styles.fill","styles.output"],"sources":["../../../src/components/slider/slider.tsx"],"sourcesContent":["import { useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport * as styles from './slider.css';\n\nexport interface SliderProps extends Omit<\n ComponentPropsWithRef<'input'>,\n 'type' | 'value' | 'defaultValue' | 'size'\n> {\n value?: number;\n defaultValue?: number;\n onValueChange?: (value: number) => void;\n min?: number;\n max?: number;\n step?: number;\n /** Format the value for `aria-valuetext` and for `SliderValue`, e.g. `(v) => \\`${v}%\\``. */\n format?: (value: number) => string;\n}\n\n/** A native range input with a filled track. Arrow keys, Page Up/Down, Home and End work natively. */\nexport function Slider({\n value,\n defaultValue,\n onValueChange,\n min = 0,\n max = 100,\n step = 1,\n format,\n className,\n style,\n id,\n required,\n disabled,\n onChange,\n ...rest\n}: SliderProps) {\n const control = useFieldControl({ id, required, disabled, 'aria-describedby': rest['aria-describedby'] });\n const [internal, setInternal] = useState(defaultValue ?? (min + max) / 2);\n const current = value ?? internal;\n const percent = max === min ? 0 : ((current - min) / (max - min)) * 100;\n return (\n <input\n {...rest}\n {...control}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={current}\n aria-valuetext={format?.(current)}\n onChange={(event) => {\n onChange?.(event);\n const next = Number(event.target.value);\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n }}\n className={cx(styles.slider, className)}\n style={{ ...style, ...assignInlineVars({ [styles.fill]: `${percent}%` }) }}\n />\n );\n}\n\n/** Label row for a slider inside a `Field`: puts the current value at the end. */\nexport function SliderValue({ children }: { children: ReactNode }) {\n return <output className={styles.output}>{children}</output>;\n}\n"],"mappings":";;;;;;;;;AAqBA,SAAgB,OAAO,EACrB,OACA,cACA,eACA,MAAM,GACN,MAAM,KACN,OAAO,GACP,QACA,WACA,OACA,IACA,UACA,UACA,UACA,GAAG,QACW;CACd,MAAM,UAAU,gBAAgB;EAAE;EAAI;EAAU;EAAU,oBAAoB,KAAK;CAAoB,CAAC;CACxG,MAAM,CAAC,UAAU,eAAe,SAAS,iBAAiB,MAAM,OAAO,CAAC;CACxE,MAAM,UAAU,SAAS;CACzB,MAAM,UAAU,QAAQ,MAAM,KAAM,UAAU,QAAQ,MAAM,OAAQ;CACpE,OACE,oBAAC,SAAD;EACE,GAAI;EACJ,GAAI;EACJ,MAAK;EACA;EACA;EACC;EACN,OAAO;EACP,kBAAgB,SAAS,OAAO;EAChC,WAAW,UAAU;GACnB,WAAW,KAAK;GAChB,MAAM,OAAO,OAAO,MAAM,OAAO,KAAK;GACtC,IAAI,UAAU,KAAA,GAAW,YAAY,IAAI;GACzC,gBAAgB,IAAI;EACtB;EACA,WAAW,GAAGA,QAAe,SAAS;EACtC,OAAO;GAAE,GAAG;GAAO,GAAG,iBAAiB,GAAGC,OAAc,GAAG,QAAQ,GAAG,CAAC;EAAE;CAC1E,CAAA;AAEL;;AAGA,SAAgB,YAAY,EAAE,YAAqC;CACjE,OAAO,oBAAC,UAAD;EAAQ,WAAWC;EAAgB;CAAiB,CAAA;AAC7D"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  // src/components/slider/slider.css.ts
2
3
  var fill = "var(--ml_kzlle60)";
3
4
  var output = "ml_kzlle63";
@@ -1,2 +1,3 @@
1
+
1
2
  import { CellProps, Table, TableProps, Td, Th } from "./table.js";
2
3
  export { type CellProps, Table, type TableProps, Td, Th };
@@ -1,3 +1,4 @@
1
+
1
2
  import { ComponentPropsWithRef, ReactNode } from "react";
2
3
  export interface TableProps extends ComponentPropsWithRef<'table'> {
3
4
  /** Names the table (and its scroll region). Shown above it unless `hideCaption`. */
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","names":[],"sources":["../../../src/components/table/table.tsx"],"mappings":";iBAIiB,mBAAmB;;EAElC,SAAS;EACT;EACA;;EAEA;EACA;;EAEA;;;;;;;wBAQc,QACd,SACA,aACA,SACA,cACA,WACA,mBACA,WACA,aACG,QACF,6BAAU,IAAA;iBAgCI;;EAEf;;wBAGc,KAAK,SAAS,WAAW,UAAkB,QAAQ,8BAA8B,4BAAS,IAAA;wBAI1F,KAAK,SAAS,cAAc,QAAQ,8BAA8B,4BAAS,IAAA"}
1
+ {"version":3,"file":"table.d.ts","names":[],"sources":["../../../src/components/table/table.tsx"],"mappings":";;iBAIiB,mBAAmB;;EAElC,SAAS;EACT;EACA;;EAEA;EACA;;EAEA;;;;;;;wBAQc,QACd,SACA,aACA,SACA,cACA,WACA,mBACA,WACA,aACG,QACF,6BAAU,IAAA;iBAgCI;;EAEf;;wBAGc,KAAK,SAAS,WAAW,UAAkB,QAAQ,8BAA8B,4BAAS,IAAA;wBAI1F,KAAK,SAAS,cAAc,QAAQ,8BAA8B,4BAAS,IAAA"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useEffect, useRef, useState } from "react";
2
3
  import { cx } from "../../utils/cx.js";
3
4
  import { captionHidden, table, wrap } from "./table.styles.js";
@@ -1 +1 @@
1
- {"version":3,"file":"table.js","names":["wrap","styles.wrap","styles.table","styles.captionHidden","numeric"],"sources":["../../../src/components/table/table.tsx"],"sourcesContent":["import { useEffect, useRef, useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './table.css';\n\nexport interface TableProps extends ComponentPropsWithRef<'table'> {\n /** Names the table (and its scroll region). Shown above it unless `hideCaption`. */\n caption: ReactNode;\n hideCaption?: boolean;\n density?: 'compact' | 'standard' | 'comfortable';\n /** Keep the header row visible while scrolling; give the table a max height via `maxHeight`. */\n stickyHeader?: boolean;\n maxHeight?: string;\n /** Keep the first column visible while scrolling sideways, e.g. names. */\n stickyFirstColumn?: boolean;\n}\n\n/**\n * A semantic `<table>` in a scroll container. When it is wider (or taller) than its\n * space, the container becomes a named, focusable region so keyboard users can scroll it.\n * Write the rows with plain `<thead>`, `<tbody>`, `<tr>`, and `Th`/`Td` for numbers.\n */\nexport function Table({\n caption,\n hideCaption,\n density = 'standard',\n stickyHeader,\n maxHeight,\n stickyFirstColumn,\n className,\n children,\n ...rest\n}: TableProps) {\n const wrap = useRef<HTMLDivElement>(null);\n const [scrollable, setScrollable] = useState(false);\n useEffect(() => {\n const el = wrap.current;\n if (!el) return;\n const check = () => setScrollable(el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight);\n check();\n const observer = new ResizeObserver(check);\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n return (\n <div\n ref={wrap}\n className={styles.wrap}\n data-sticky-header={stickyHeader || undefined}\n data-sticky-first={stickyFirstColumn || undefined}\n style={maxHeight ? { maxHeight } : undefined}\n // Only a region (and a tab stop) when there is something to scroll.\n role={scrollable ? 'region' : undefined}\n aria-label={scrollable && typeof caption === 'string' ? caption : undefined}\n tabIndex={scrollable ? 0 : undefined}\n >\n <table {...rest} data-density={density} className={cx(styles.table, className)}>\n <caption className={hideCaption ? styles.captionHidden : undefined}>{caption}</caption>\n {children}\n </table>\n </div>\n );\n}\n\nexport interface CellProps {\n /** Right-align with tabular figures, for amounts and counts. */\n numeric?: boolean;\n}\n\nexport function Th({ numeric, className, scope = 'col', ...rest }: ComponentPropsWithRef<'th'> & CellProps) {\n return <th {...rest} scope={scope} className={cx(numeric && styles.numeric, className)} />;\n}\n\nexport function Td({ numeric, className, ...rest }: ComponentPropsWithRef<'td'> & CellProps) {\n return <td {...rest} className={cx(numeric && styles.numeric, className)} />;\n}\n"],"mappings":";;;;;;;;;;AAqBA,SAAgB,MAAM,EACpB,SACA,aACA,UAAU,YACV,cACA,WACA,mBACA,WACA,UACA,GAAG,QACU;CACb,MAAMA,SAAO,OAAuB,IAAI;CACxC,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,gBAAgB;EACd,MAAM,KAAKA,OAAK;EAChB,IAAI,CAAC,IAAI;EACT,MAAM,cAAc,cAAc,GAAG,cAAc,GAAG,eAAe,GAAG,eAAe,GAAG,YAAY;EACtG,MAAM;EACN,MAAM,WAAW,IAAI,eAAe,KAAK;EACzC,SAAS,QAAQ,EAAE;EACnB,aAAa,SAAS,WAAW;CACnC,GAAG,CAAC,CAAC;CACL,OACE,oBAAC,OAAD;EACE,KAAKA;EACL,WAAWC;EACX,sBAAoB,gBAAgB,KAAA;EACpC,qBAAmB,qBAAqB,KAAA;EACxC,OAAO,YAAY,EAAE,UAAU,IAAI,KAAA;EAEnC,MAAM,aAAa,WAAW,KAAA;EAC9B,cAAY,cAAc,OAAO,YAAY,WAAW,UAAU,KAAA;EAClE,UAAU,aAAa,IAAI,KAAA;EAE3B,UAAA,qBAAC,SAAD;GAAO,GAAI;GAAM,gBAAc;GAAS,WAAW,GAAGC,OAAc,SAAS;GAA7E,UAAA,CACE,oBAAC,WAAD;IAAS,WAAW,cAAcC,gBAAuB,KAAA;IAAY,UAAA;GAAiB,CAAA,GACrF,QACI;;CACJ,CAAA;AAET;AAOA,SAAgB,GAAG,EAAEC,SAAAA,WAAS,WAAW,QAAQ,OAAO,GAAG,QAAiD;CAC1G,OAAO,oBAAC,MAAD;EAAI,GAAI;EAAa;EAAO,WAAW,GAAGA,aAAW,eAAgB,SAAS;CAAI,CAAA;AAC3F;AAEA,SAAgB,GAAG,EAAEA,SAAAA,WAAS,WAAW,GAAG,QAAiD;CAC3F,OAAO,oBAAC,MAAD;EAAI,GAAI;EAAM,WAAW,GAAGA,aAAW,eAAgB,SAAS;CAAI,CAAA;AAC7E"}
1
+ {"version":3,"file":"table.js","names":["wrap","styles.wrap","styles.table","styles.captionHidden","numeric"],"sources":["../../../src/components/table/table.tsx"],"sourcesContent":["import { useEffect, useRef, useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './table.css';\n\nexport interface TableProps extends ComponentPropsWithRef<'table'> {\n /** Names the table (and its scroll region). Shown above it unless `hideCaption`. */\n caption: ReactNode;\n hideCaption?: boolean;\n density?: 'compact' | 'standard' | 'comfortable';\n /** Keep the header row visible while scrolling; give the table a max height via `maxHeight`. */\n stickyHeader?: boolean;\n maxHeight?: string;\n /** Keep the first column visible while scrolling sideways, e.g. names. */\n stickyFirstColumn?: boolean;\n}\n\n/**\n * A semantic `<table>` in a scroll container. When it is wider (or taller) than its\n * space, the container becomes a named, focusable region so keyboard users can scroll it.\n * Write the rows with plain `<thead>`, `<tbody>`, `<tr>`, and `Th`/`Td` for numbers.\n */\nexport function Table({\n caption,\n hideCaption,\n density = 'standard',\n stickyHeader,\n maxHeight,\n stickyFirstColumn,\n className,\n children,\n ...rest\n}: TableProps) {\n const wrap = useRef<HTMLDivElement>(null);\n const [scrollable, setScrollable] = useState(false);\n useEffect(() => {\n const el = wrap.current;\n if (!el) return;\n const check = () => setScrollable(el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight);\n check();\n const observer = new ResizeObserver(check);\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n return (\n <div\n ref={wrap}\n className={styles.wrap}\n data-sticky-header={stickyHeader || undefined}\n data-sticky-first={stickyFirstColumn || undefined}\n style={maxHeight ? { maxHeight } : undefined}\n // Only a region (and a tab stop) when there is something to scroll.\n role={scrollable ? 'region' : undefined}\n aria-label={scrollable && typeof caption === 'string' ? caption : undefined}\n tabIndex={scrollable ? 0 : undefined}\n >\n <table {...rest} data-density={density} className={cx(styles.table, className)}>\n <caption className={hideCaption ? styles.captionHidden : undefined}>{caption}</caption>\n {children}\n </table>\n </div>\n );\n}\n\nexport interface CellProps {\n /** Right-align with tabular figures, for amounts and counts. */\n numeric?: boolean;\n}\n\nexport function Th({ numeric, className, scope = 'col', ...rest }: ComponentPropsWithRef<'th'> & CellProps) {\n return <th {...rest} scope={scope} className={cx(numeric && styles.numeric, className)} />;\n}\n\nexport function Td({ numeric, className, ...rest }: ComponentPropsWithRef<'td'> & CellProps) {\n return <td {...rest} className={cx(numeric && styles.numeric, className)} />;\n}\n"],"mappings":";;;;;;;;;;;AAqBA,SAAgB,MAAM,EACpB,SACA,aACA,UAAU,YACV,cACA,WACA,mBACA,WACA,UACA,GAAG,QACU;CACb,MAAMA,SAAO,OAAuB,IAAI;CACxC,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,gBAAgB;EACd,MAAM,KAAKA,OAAK;EAChB,IAAI,CAAC,IAAI;EACT,MAAM,cAAc,cAAc,GAAG,cAAc,GAAG,eAAe,GAAG,eAAe,GAAG,YAAY;EACtG,MAAM;EACN,MAAM,WAAW,IAAI,eAAe,KAAK;EACzC,SAAS,QAAQ,EAAE;EACnB,aAAa,SAAS,WAAW;CACnC,GAAG,CAAC,CAAC;CACL,OACE,oBAAC,OAAD;EACE,KAAKA;EACL,WAAWC;EACX,sBAAoB,gBAAgB,KAAA;EACpC,qBAAmB,qBAAqB,KAAA;EACxC,OAAO,YAAY,EAAE,UAAU,IAAI,KAAA;EAEnC,MAAM,aAAa,WAAW,KAAA;EAC9B,cAAY,cAAc,OAAO,YAAY,WAAW,UAAU,KAAA;EAClE,UAAU,aAAa,IAAI,KAAA;EAE3B,UAAA,qBAAC,SAAD;GAAO,GAAI;GAAM,gBAAc;GAAS,WAAW,GAAGC,OAAc,SAAS;GAA7E,UAAA,CACE,oBAAC,WAAD;IAAS,WAAW,cAAcC,gBAAuB,KAAA;IAAY,UAAA;GAAiB,CAAA,GACrF,QACI;;CACJ,CAAA;AAET;AAOA,SAAgB,GAAG,EAAEC,SAAAA,WAAS,WAAW,QAAQ,OAAO,GAAG,QAAiD;CAC1G,OAAO,oBAAC,MAAD;EAAI,GAAI;EAAa;EAAO,WAAW,GAAGA,aAAW,eAAgB,SAAS;CAAI,CAAA;AAC3F;AAEA,SAAgB,GAAG,EAAEA,SAAAA,WAAS,WAAW,GAAG,QAAiD;CAC3F,OAAO,oBAAC,MAAD;EAAI,GAAI;EAAM,WAAW,GAAGA,aAAW,eAAgB,SAAS;CAAI,CAAA;AAC7E"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  // src/components/table/table.css.ts
2
3
  var captionHidden = "ml_1fd8r9h5";
3
4
  var numeric = "ml_1fd8r9h4";
@@ -1,2 +1,3 @@
1
+
1
2
  import { Heading, HeadingProps, MarginProps, Text, TextProps } from "./text.js";
2
3
  export { Heading, type HeadingProps, type MarginProps, Text, type TextProps };
@@ -1,3 +1,4 @@
1
+
1
2
  import { RecipeVariants } from "@vanilla-extract/recipes";
2
3
  export declare const text: import("@vanilla-extract/recipes").RuntimeFn<{
3
4
  variant: {
@@ -1 +1 @@
1
- {"version":3,"file":"text.css.d.ts","names":[],"sources":["../../../src/components/text/text.css.ts"],"mappings":";qBAQa,yCAAI;;;;;;;;;;;;;;;;;MAmBT;MACA;MACA;MACA;;;MAGA;MACA;MACA;;;;;;;;MAGO;MAAwB;;;;;;;;;;;;;;;;;MAYtB;;;MACF;;;MACC;;;MACA;;;MACA;;;MACC;;;;;;;;;;;;;YAWL,eAAe,YAAY,sBAAsB"}
1
+ {"version":3,"file":"text.css.d.ts","names":[],"sources":["../../../src/components/text/text.css.ts"],"mappings":";;qBAQa,yCAAI;;;;;;;;;;;;;;;;;MAmBT;MACA;MACA;MACA;;;MAGA;MACA;MACA;;;;;;;;MAGO;MAAwB;;;;;;;;;;;;;;;;;MAYtB;;;MACF;;;MACC;;;MACA;;;MACA;;;MACC;;;;;;;;;;;;;YAWL,eAAe,YAAY,sBAAsB"}
@@ -1,3 +1,4 @@
1
+
1
2
  import { ComponentPropsWithRef, ElementType } from "react";
2
3
  import { Sprinkles } from "@mohirlab/sprinkles";
3
4
  import { TextVariants } from "./text.css.js";
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","names":[],"sources":["../../../src/components/text/text.tsx"],"mappings":";;;;YAMY,cAAc,KACxB;iBAae,kBAAkB,KAAK,sCAAsC;EAC5E,UAAU;EACV,OAAO;;EAEP;EACA,KAAK;;wBAQS,OAAO,SAAkB,MAAM,SAAS,IAAI,cAAc,SAAS,4BAAS,IAAA;iBAsB3E,qBAAqB,KAAK;;EAEzC;EACA,UAAU,QAAQ;;;wBAMJ,UAAU,OAAW,SAAS,SAAqB,QAAQ,+BAAY,IAAA"}
1
+ {"version":3,"file":"text.d.ts","names":[],"sources":["../../../src/components/text/text.tsx"],"mappings":";;;;;YAMY,cAAc,KACxB;iBAae,kBAAkB,KAAK,sCAAsC;EAC5E,UAAU;EACV,OAAO;;EAEP;EACA,KAAK;;wBAQS,OAAO,SAAkB,MAAM,SAAS,IAAI,cAAc,SAAS,4BAAS,IAAA;iBAsB3E,qBAAqB,KAAK;;EAEzC;EACA,UAAU,QAAQ;;;wBAMJ,UAAU,OAAW,SAAS,SAAqB,QAAQ,+BAAY,IAAA"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { sprinkles } from "@mohirlab/sprinkles";
2
3
  import { cx } from "../../utils/cx.js";
3
4
  import { text } from "./text.styles.js";
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","names":[],"sources":["../../../src/components/text/text.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ElementType } from 'react';\nimport { sprinkles, type Sprinkles } from '@mohirlab/sprinkles';\nimport { cx } from '../../utils/cx';\nimport { text, type TextVariants } from './text.css';\n\n/** Token-bound outer spacing, so text can sit in a layout without custom CSS. */\nexport type MarginProps = Pick<\n Sprinkles,\n 'margin' | 'marginX' | 'marginY' | 'marginTop' | 'marginBottom' | 'marginLeft' | 'marginRight'\n>;\nconst marginKeys = [\n 'margin',\n 'marginX',\n 'marginY',\n 'marginTop',\n 'marginBottom',\n 'marginLeft',\n 'marginRight',\n] as const;\n\nexport interface TextProps extends Omit<ComponentPropsWithRef<'p'>, 'color'>, MarginProps {\n variant?: TextVariants['variant'];\n tone?: TextVariants['tone'];\n /** Tabular figures, for numbers that should line up. */\n numeric?: boolean;\n as?: ElementType;\n}\n\nconst defaultElement: Partial<Record<NonNullable<TextVariants['variant']>, ElementType>> = {\n label: 'span',\n code: 'code',\n};\n\nexport function Text({ variant = 'body', tone, numeric, as, className, ...props }: TextProps) {\n const Component = as ?? defaultElement[variant] ?? 'p';\n const margins: MarginProps = {};\n const rest: Record<string, unknown> = { ...props };\n for (const key of marginKeys) {\n if (key in rest) {\n (margins as Record<string, unknown>)[key] = rest[key];\n delete rest[key];\n }\n }\n return (\n <Component\n {...rest}\n className={cx(\n text({ variant, tone, numeric }),\n Object.keys(margins).length > 0 && sprinkles(margins),\n className,\n )}\n />\n );\n}\n\nexport interface HeadingProps extends Omit<TextProps, 'as' | 'variant'> {\n /** Document outline level. Visual size follows it unless `variant` is set. */\n level?: 1 | 2 | 3 | 4;\n variant?: Extract<TextVariants['variant'], 'display' | 'title' | 'heading' | 'subheading'>;\n}\n\nconst variantForLevel = { 1: 'title', 2: 'heading', 3: 'subheading', 4: 'subheading' } as const;\n\n/** Heading level (semantics) and size (visuals) are separate on purpose. */\nexport function Heading({ level = 2, variant, tone = 'default', ...rest }: HeadingProps) {\n return <Text {...rest} as={`h${level}`} variant={variant ?? variantForLevel[level]} tone={tone} />;\n}\n"],"mappings":";;;;;AAUA,MAAM,aAAa;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAUA,MAAM,iBAAqF;CACzF,OAAO;CACP,MAAM;AACR;AAEA,SAAgB,KAAK,EAAE,UAAU,QAAQ,MAAM,SAAS,IAAI,WAAW,GAAG,SAAoB;CAC5F,MAAM,YAAY,MAAM,eAAe,YAAY;CACnD,MAAM,UAAuB,CAAC;CAC9B,MAAM,OAAgC,EAAE,GAAG,MAAM;CACjD,KAAK,MAAM,OAAO,YAChB,IAAI,OAAO,MAAM;EACd,QAAoC,OAAO,KAAK;EACjD,OAAO,KAAK;CACd;CAEF,OACE,oBAAC,WAAD;EACE,GAAI;EACJ,WAAW,GACT,KAAK;GAAE;GAAS;GAAM;EAAQ,CAAC,GAC/B,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,KAAK,UAAU,OAAO,GACpD,SACF;CACD,CAAA;AAEL;AAQA,MAAM,kBAAkB;CAAE,GAAG;CAAS,GAAG;CAAW,GAAG;CAAc,GAAG;AAAa;;AAGrF,SAAgB,QAAQ,EAAE,QAAQ,GAAG,SAAS,OAAO,WAAW,GAAG,QAAsB;CACvF,OAAO,oBAAC,MAAD;EAAM,GAAI;EAAM,IAAI,IAAI;EAAS,SAAS,WAAW,gBAAgB;EAAc;CAAO,CAAA;AACnG"}
1
+ {"version":3,"file":"text.js","names":[],"sources":["../../../src/components/text/text.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ElementType } from 'react';\nimport { sprinkles, type Sprinkles } from '@mohirlab/sprinkles';\nimport { cx } from '../../utils/cx';\nimport { text, type TextVariants } from './text.css';\n\n/** Token-bound outer spacing, so text can sit in a layout without custom CSS. */\nexport type MarginProps = Pick<\n Sprinkles,\n 'margin' | 'marginX' | 'marginY' | 'marginTop' | 'marginBottom' | 'marginLeft' | 'marginRight'\n>;\nconst marginKeys = [\n 'margin',\n 'marginX',\n 'marginY',\n 'marginTop',\n 'marginBottom',\n 'marginLeft',\n 'marginRight',\n] as const;\n\nexport interface TextProps extends Omit<ComponentPropsWithRef<'p'>, 'color'>, MarginProps {\n variant?: TextVariants['variant'];\n tone?: TextVariants['tone'];\n /** Tabular figures, for numbers that should line up. */\n numeric?: boolean;\n as?: ElementType;\n}\n\nconst defaultElement: Partial<Record<NonNullable<TextVariants['variant']>, ElementType>> = {\n label: 'span',\n code: 'code',\n};\n\nexport function Text({ variant = 'body', tone, numeric, as, className, ...props }: TextProps) {\n const Component = as ?? defaultElement[variant] ?? 'p';\n const margins: MarginProps = {};\n const rest: Record<string, unknown> = { ...props };\n for (const key of marginKeys) {\n if (key in rest) {\n (margins as Record<string, unknown>)[key] = rest[key];\n delete rest[key];\n }\n }\n return (\n <Component\n {...rest}\n className={cx(\n text({ variant, tone, numeric }),\n Object.keys(margins).length > 0 && sprinkles(margins),\n className,\n )}\n />\n );\n}\n\nexport interface HeadingProps extends Omit<TextProps, 'as' | 'variant'> {\n /** Document outline level. Visual size follows it unless `variant` is set. */\n level?: 1 | 2 | 3 | 4;\n variant?: Extract<TextVariants['variant'], 'display' | 'title' | 'heading' | 'subheading'>;\n}\n\nconst variantForLevel = { 1: 'title', 2: 'heading', 3: 'subheading', 4: 'subheading' } as const;\n\n/** Heading level (semantics) and size (visuals) are separate on purpose. */\nexport function Heading({ level = 2, variant, tone = 'default', ...rest }: HeadingProps) {\n return <Text {...rest} as={`h${level}`} variant={variant ?? variantForLevel[level]} tone={tone} />;\n}\n"],"mappings":";;;;;;AAUA,MAAM,aAAa;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAUA,MAAM,iBAAqF;CACzF,OAAO;CACP,MAAM;AACR;AAEA,SAAgB,KAAK,EAAE,UAAU,QAAQ,MAAM,SAAS,IAAI,WAAW,GAAG,SAAoB;CAC5F,MAAM,YAAY,MAAM,eAAe,YAAY;CACnD,MAAM,UAAuB,CAAC;CAC9B,MAAM,OAAgC,EAAE,GAAG,MAAM;CACjD,KAAK,MAAM,OAAO,YAChB,IAAI,OAAO,MAAM;EACd,QAAoC,OAAO,KAAK;EACjD,OAAO,KAAK;CACd;CAEF,OACE,oBAAC,WAAD;EACE,GAAI;EACJ,WAAW,GACT,KAAK;GAAE;GAAS;GAAM;EAAQ,CAAC,GAC/B,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,KAAK,UAAU,OAAO,GACpD,SACF;CACD,CAAA;AAEL;AAQA,MAAM,kBAAkB;CAAE,GAAG;CAAS,GAAG;CAAW,GAAG;CAAc,GAAG;AAAa;;AAGrF,SAAgB,QAAQ,EAAE,QAAQ,GAAG,SAAS,OAAO,WAAW,GAAG,QAAsB;CACvF,OAAO,oBAAC,MAAD;EAAM,GAAI;EAAM,IAAI,IAAI;EAAS,SAAS,WAAW,gBAAgB;EAAc;CAAO,CAAA;AACnG"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createRuntimeFn } from "@vanilla-extract/recipes/createRuntimeFn";
2
3
  // src/components/text/text.css.ts
3
4
  var text = createRuntimeFn({