@mohirlab/react 0.5.0 → 0.6.1

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 (163) hide show
  1. package/dist/components/accordion/accordion.d.ts +20 -0
  2. package/dist/components/accordion/accordion.d.ts.map +1 -0
  3. package/dist/components/accordion/accordion.js +45 -0
  4. package/dist/components/accordion/accordion.js.map +1 -0
  5. package/dist/components/accordion/accordion.styles.js +10 -0
  6. package/dist/components/accordion/accordion.styles.js.map +1 -0
  7. package/dist/components/accordion/index.d.ts +3 -0
  8. package/dist/components/avatar/avatar.css.d.ts +1 -0
  9. package/dist/components/avatar/avatar.css.d.ts.map +1 -1
  10. package/dist/components/avatar/avatar.d.ts +1 -0
  11. package/dist/components/avatar/avatar.d.ts.map +1 -1
  12. package/dist/components/avatar/avatar.js +1 -0
  13. package/dist/components/avatar/avatar.js.map +1 -1
  14. package/dist/components/avatar/avatar.styles.js +1 -0
  15. package/dist/components/avatar/index.d.ts +1 -0
  16. package/dist/components/badge/badge.css.d.ts +1 -0
  17. package/dist/components/badge/badge.css.d.ts.map +1 -1
  18. package/dist/components/badge/badge.d.ts +1 -0
  19. package/dist/components/badge/badge.d.ts.map +1 -1
  20. package/dist/components/badge/badge.js +1 -0
  21. package/dist/components/badge/badge.js.map +1 -1
  22. package/dist/components/badge/badge.styles.js +1 -0
  23. package/dist/components/badge/index.d.ts +1 -0
  24. package/dist/components/box/box.d.ts +1 -0
  25. package/dist/components/box/box.d.ts.map +1 -1
  26. package/dist/components/box/box.js +1 -0
  27. package/dist/components/box/box.js.map +1 -1
  28. package/dist/components/box/index.d.ts +1 -0
  29. package/dist/components/box/stack.d.ts +1 -0
  30. package/dist/components/box/stack.d.ts.map +1 -1
  31. package/dist/components/box/stack.js +1 -0
  32. package/dist/components/box/stack.js.map +1 -1
  33. package/dist/components/button/button.css.d.ts +1 -0
  34. package/dist/components/button/button.css.d.ts.map +1 -1
  35. package/dist/components/button/button.d.ts +1 -0
  36. package/dist/components/button/button.d.ts.map +1 -1
  37. package/dist/components/button/button.js +1 -0
  38. package/dist/components/button/button.js.map +1 -1
  39. package/dist/components/button/button.styles.js +1 -0
  40. package/dist/components/button/index.d.ts +1 -0
  41. package/dist/components/card/card-media.d.ts +1 -0
  42. package/dist/components/card/card-media.d.ts.map +1 -1
  43. package/dist/components/card/card-media.js +1 -0
  44. package/dist/components/card/card-media.js.map +1 -1
  45. package/dist/components/card/card.css.d.ts +1 -0
  46. package/dist/components/card/card.css.d.ts.map +1 -1
  47. package/dist/components/card/card.d.ts +1 -0
  48. package/dist/components/card/card.d.ts.map +1 -1
  49. package/dist/components/card/card.js +1 -0
  50. package/dist/components/card/card.js.map +1 -1
  51. package/dist/components/card/card.styles.js +1 -0
  52. package/dist/components/card/index.d.ts +1 -0
  53. package/dist/components/choice/choice.d.ts +1 -0
  54. package/dist/components/choice/choice.d.ts.map +1 -1
  55. package/dist/components/choice/choice.js +1 -0
  56. package/dist/components/choice/choice.js.map +1 -1
  57. package/dist/components/choice/choice.styles.js +1 -0
  58. package/dist/components/choice/index.d.ts +1 -0
  59. package/dist/components/dialog/dialog.css.d.ts +1 -0
  60. package/dist/components/dialog/dialog.css.d.ts.map +1 -1
  61. package/dist/components/dialog/dialog.d.ts +1 -0
  62. package/dist/components/dialog/dialog.d.ts.map +1 -1
  63. package/dist/components/dialog/dialog.js +1 -0
  64. package/dist/components/dialog/dialog.js.map +1 -1
  65. package/dist/components/dialog/dialog.styles.js +1 -0
  66. package/dist/components/dialog/index.d.ts +1 -0
  67. package/dist/components/field/field-context.d.ts +1 -0
  68. package/dist/components/field/field-context.d.ts.map +1 -1
  69. package/dist/components/field/field-context.js +1 -0
  70. package/dist/components/field/field-context.js.map +1 -1
  71. package/dist/components/field/field.d.ts +1 -0
  72. package/dist/components/field/field.d.ts.map +1 -1
  73. package/dist/components/field/field.js +1 -0
  74. package/dist/components/field/field.js.map +1 -1
  75. package/dist/components/field/field.styles.js +1 -0
  76. package/dist/components/field/index.d.ts +1 -0
  77. package/dist/components/field/use-field-control.js +1 -0
  78. package/dist/components/field/use-field-control.js.map +1 -1
  79. package/dist/components/icon/icon.d.ts +1 -0
  80. package/dist/components/icon/icon.d.ts.map +1 -1
  81. package/dist/components/icon/icon.js +1 -0
  82. package/dist/components/icon/icon.js.map +1 -1
  83. package/dist/components/icon/index.d.ts +1 -0
  84. package/dist/components/input/index.d.ts +1 -0
  85. package/dist/components/input/input.css.d.ts +1 -0
  86. package/dist/components/input/input.css.d.ts.map +1 -1
  87. package/dist/components/input/input.d.ts +1 -0
  88. package/dist/components/input/input.d.ts.map +1 -1
  89. package/dist/components/input/input.js +1 -0
  90. package/dist/components/input/input.js.map +1 -1
  91. package/dist/components/input/input.styles.js +1 -0
  92. package/dist/components/navigation/index.d.ts +1 -0
  93. package/dist/components/navigation/nav.d.ts +1 -0
  94. package/dist/components/navigation/nav.d.ts.map +1 -1
  95. package/dist/components/navigation/nav.js +1 -0
  96. package/dist/components/navigation/nav.js.map +1 -1
  97. package/dist/components/navigation/navigation.styles.js +1 -0
  98. package/dist/components/navigation/tabs.d.ts +1 -0
  99. package/dist/components/navigation/tabs.d.ts.map +1 -1
  100. package/dist/components/navigation/tabs.js +1 -0
  101. package/dist/components/navigation/tabs.js.map +1 -1
  102. package/dist/components/popover/index.d.ts +1 -0
  103. package/dist/components/popover/popover.css.d.ts +1 -0
  104. package/dist/components/popover/popover.css.d.ts.map +1 -1
  105. package/dist/components/popover/popover.d.ts +1 -0
  106. package/dist/components/popover/popover.d.ts.map +1 -1
  107. package/dist/components/popover/popover.js +1 -0
  108. package/dist/components/popover/popover.js.map +1 -1
  109. package/dist/components/popover/popover.styles.js +1 -0
  110. package/dist/components/select/index.d.ts +1 -0
  111. package/dist/components/select/select.d.ts +1 -0
  112. package/dist/components/select/select.d.ts.map +1 -1
  113. package/dist/components/select/select.js +1 -0
  114. package/dist/components/select/select.js.map +1 -1
  115. package/dist/components/select/select.styles.js +1 -0
  116. package/dist/components/slider/index.d.ts +1 -0
  117. package/dist/components/slider/slider.d.ts +1 -0
  118. package/dist/components/slider/slider.d.ts.map +1 -1
  119. package/dist/components/slider/slider.js +1 -0
  120. package/dist/components/slider/slider.js.map +1 -1
  121. package/dist/components/slider/slider.styles.js +1 -0
  122. package/dist/components/table/index.d.ts +3 -0
  123. package/dist/components/table/table.d.ts +26 -0
  124. package/dist/components/table/table.d.ts.map +1 -0
  125. package/dist/components/table/table.js +59 -0
  126. package/dist/components/table/table.js.map +1 -0
  127. package/dist/components/table/table.styles.js +9 -0
  128. package/dist/components/table/table.styles.js.map +1 -0
  129. package/dist/components/text/index.d.ts +1 -0
  130. package/dist/components/text/text.css.d.ts +1 -0
  131. package/dist/components/text/text.css.d.ts.map +1 -1
  132. package/dist/components/text/text.d.ts +1 -0
  133. package/dist/components/text/text.d.ts.map +1 -1
  134. package/dist/components/text/text.js +1 -0
  135. package/dist/components/text/text.js.map +1 -1
  136. package/dist/components/text/text.styles.js +1 -0
  137. package/dist/components/theme-scope/theme-scope.d.ts +1 -0
  138. package/dist/components/theme-scope/theme-scope.d.ts.map +1 -1
  139. package/dist/components/theme-scope/theme-scope.js +1 -0
  140. package/dist/components/theme-scope/theme-scope.js.map +1 -1
  141. package/dist/components/toast/index.d.ts +1 -0
  142. package/dist/components/toast/toast.d.ts +1 -0
  143. package/dist/components/toast/toast.d.ts.map +1 -1
  144. package/dist/components/toast/toast.js +1 -0
  145. package/dist/components/toast/toast.js.map +1 -1
  146. package/dist/components/toast/toast.styles.js +1 -0
  147. package/dist/hooks/index.d.ts +1 -0
  148. package/dist/hooks/use-disclosure.d.ts +1 -0
  149. package/dist/hooks/use-disclosure.d.ts.map +1 -1
  150. package/dist/hooks/use-disclosure.js +1 -0
  151. package/dist/hooks/use-disclosure.js.map +1 -1
  152. package/dist/hooks/use-presence.d.ts +1 -0
  153. package/dist/hooks/use-presence.d.ts.map +1 -1
  154. package/dist/hooks/use-presence.js +1 -0
  155. package/dist/hooks/use-presence.js.map +1 -1
  156. package/dist/index.d.ts +6 -1
  157. package/dist/index.js +5 -2
  158. package/dist/styles.css +157 -0
  159. package/dist/utils/cx.d.ts +1 -0
  160. package/dist/utils/cx.d.ts.map +1 -1
  161. package/dist/utils/cx.js +1 -0
  162. package/dist/utils/cx.js.map +1 -1
  163. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+
2
+ import { CellProps, Table, TableProps, Td, Th } from "./table.js";
3
+ export { type CellProps, Table, type TableProps, Td, Th };
@@ -0,0 +1,26 @@
1
+
2
+ import { ComponentPropsWithRef, ReactNode } from "react";
3
+ export interface TableProps extends ComponentPropsWithRef<'table'> {
4
+ /** Names the table (and its scroll region). Shown above it unless `hideCaption`. */
5
+ caption: ReactNode;
6
+ hideCaption?: boolean;
7
+ density?: 'compact' | 'standard' | 'comfortable';
8
+ /** Keep the header row visible while scrolling; give the table a max height via `maxHeight`. */
9
+ stickyHeader?: boolean;
10
+ maxHeight?: string;
11
+ /** Keep the first column visible while scrolling sideways, e.g. names. */
12
+ stickyFirstColumn?: boolean;
13
+ }
14
+ /**
15
+ * A semantic `<table>` in a scroll container. When it is wider (or taller) than its
16
+ * space, the container becomes a named, focusable region so keyboard users can scroll it.
17
+ * Write the rows with plain `<thead>`, `<tbody>`, `<tr>`, and `Th`/`Td` for numbers.
18
+ */
19
+ export declare function Table({ caption, hideCaption, density, stickyHeader, maxHeight, stickyFirstColumn, className, children, ...rest }: TableProps): import("react").JSX.Element;
20
+ export interface CellProps {
21
+ /** Right-align with tabular figures, for amounts and counts. */
22
+ numeric?: boolean;
23
+ }
24
+ export declare function Th({ numeric, className, scope, ...rest }: ComponentPropsWithRef<'th'> & CellProps): import("react").JSX.Element;
25
+ export declare function Td({ numeric, className, ...rest }: ComponentPropsWithRef<'td'> & CellProps): import("react").JSX.Element;
26
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { cx } from "../../utils/cx.js";
4
+ import { captionHidden, table, wrap } from "./table.styles.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ // src/components/table/table.tsx
7
+ /**
8
+ * A semantic `<table>` in a scroll container. When it is wider (or taller) than its
9
+ * space, the container becomes a named, focusable region so keyboard users can scroll it.
10
+ * Write the rows with plain `<thead>`, `<tbody>`, `<tr>`, and `Th`/`Td` for numbers.
11
+ */
12
+ function Table({ caption, hideCaption, density = "standard", stickyHeader, maxHeight, stickyFirstColumn, className, children, ...rest }) {
13
+ const wrap$1 = useRef(null);
14
+ const [scrollable, setScrollable] = useState(false);
15
+ useEffect(() => {
16
+ const el = wrap$1.current;
17
+ if (!el) return;
18
+ const check = () => setScrollable(el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight);
19
+ check();
20
+ const observer = new ResizeObserver(check);
21
+ observer.observe(el);
22
+ return () => observer.disconnect();
23
+ }, []);
24
+ return /* @__PURE__ */ jsx("div", {
25
+ ref: wrap$1,
26
+ className: wrap,
27
+ "data-sticky-header": stickyHeader || void 0,
28
+ "data-sticky-first": stickyFirstColumn || void 0,
29
+ style: maxHeight ? { maxHeight } : void 0,
30
+ role: scrollable ? "region" : void 0,
31
+ "aria-label": scrollable && typeof caption === "string" ? caption : void 0,
32
+ tabIndex: scrollable ? 0 : void 0,
33
+ children: /* @__PURE__ */ jsxs("table", {
34
+ ...rest,
35
+ "data-density": density,
36
+ className: cx(table, className),
37
+ children: [/* @__PURE__ */ jsx("caption", {
38
+ className: hideCaption ? captionHidden : void 0,
39
+ children: caption
40
+ }), children]
41
+ })
42
+ });
43
+ }
44
+ function Th({ numeric: numeric$2, className, scope = "col", ...rest }) {
45
+ return /* @__PURE__ */ jsx("th", {
46
+ ...rest,
47
+ scope,
48
+ className: cx(numeric$2 && "ml_1fd8r9h4", className)
49
+ });
50
+ }
51
+ function Td({ numeric: numeric$1, className, ...rest }) {
52
+ return /* @__PURE__ */ jsx("td", {
53
+ ...rest,
54
+ className: cx(numeric$1 && "ml_1fd8r9h4", className)
55
+ });
56
+ }
57
+ export { Table, Td, Th };
58
+
59
+ //# sourceMappingURL=table.js.map
@@ -0,0 +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"}
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ // src/components/table/table.css.ts
3
+ var captionHidden = "ml_1fd8r9h5";
4
+ var numeric = "ml_1fd8r9h4";
5
+ var table = "ml_1fd8r9h3";
6
+ var wrap = "ml_1fd8r9h2";
7
+ export { captionHidden, numeric, table, wrap };
8
+
9
+ //# sourceMappingURL=table.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.styles.js","names":[],"sources":[],"mappings":""}
@@ -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({
@@ -1,3 +1,4 @@
1
+
1
2
  import { ComponentPropsWithRef, ElementType } from "react";
2
3
  import { ThemeMode } from "@mohirlab/themes";
3
4
  export interface ThemeScopeProps extends ComponentPropsWithRef<'div'> {
@@ -1 +1 @@
1
- {"version":3,"file":"theme-scope.d.ts","names":[],"sources":["../../../src/components/theme-scope/theme-scope.tsx"],"mappings":";;iBAIiB,wBAAwB;;EAEvC,OAAO;;EAEP;EACA,KAAK;;;;;;wBAOS,aACd,MACA,OACA,IAAI,WACJ,cACG,QACF,kCAAe,IAAA"}
1
+ {"version":3,"file":"theme-scope.d.ts","names":[],"sources":["../../../src/components/theme-scope/theme-scope.tsx"],"mappings":";;;iBAIiB,wBAAwB;;EAEvC,OAAO;;EAEP;EACA,KAAK;;;;;;wBAOS,aACd,MACA,OACA,IAAI,WACJ,cACG,QACF,kCAAe,IAAA"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { themes } from "@mohirlab/themes";
2
3
  import { cx } from "../../utils/cx.js";
3
4
  import { jsx } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"theme-scope.js","names":[],"sources":["../../../src/components/theme-scope/theme-scope.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ElementType } from 'react';\nimport { themes, type ThemeMode } from '@mohirlab/themes';\nimport { cx } from '../../utils/cx';\n\nexport interface ThemeScopeProps extends ComponentPropsWithRef<'div'> {\n /** A built-in mode. Ignored when `theme` is given. */\n mode?: ThemeMode;\n /** Any theme class made with `createTheme(vars, ...)`, such as a brand theme. */\n theme?: string;\n as?: ElementType;\n}\n\n/**\n * Applies a theme to its subtree. Scopes nest: a dark panel inside a light\n * page, or a brand-themed widget inside someone else's app.\n */\nexport function ThemeScope({\n mode = 'light',\n theme,\n as: Component = 'div',\n className,\n ...rest\n}: ThemeScopeProps) {\n return (\n <Component\n {...rest}\n data-ml-mode={theme ? undefined : mode}\n className={cx(theme ?? themes[mode], className)}\n />\n );\n}\n"],"mappings":";;;;;;;;AAgBA,SAAgB,WAAW,EACzB,OAAO,SACP,OACA,IAAI,YAAY,OAChB,WACA,GAAG,QACe;CAClB,OACE,oBAAC,WAAD;EACE,GAAI;EACJ,gBAAc,QAAQ,KAAA,IAAY;EAClC,WAAW,GAAG,SAAS,OAAO,OAAO,SAAS;CAC/C,CAAA;AAEL"}
1
+ {"version":3,"file":"theme-scope.js","names":[],"sources":["../../../src/components/theme-scope/theme-scope.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ElementType } from 'react';\nimport { themes, type ThemeMode } from '@mohirlab/themes';\nimport { cx } from '../../utils/cx';\n\nexport interface ThemeScopeProps extends ComponentPropsWithRef<'div'> {\n /** A built-in mode. Ignored when `theme` is given. */\n mode?: ThemeMode;\n /** Any theme class made with `createTheme(vars, ...)`, such as a brand theme. */\n theme?: string;\n as?: ElementType;\n}\n\n/**\n * Applies a theme to its subtree. Scopes nest: a dark panel inside a light\n * page, or a brand-themed widget inside someone else's app.\n */\nexport function ThemeScope({\n mode = 'light',\n theme,\n as: Component = 'div',\n className,\n ...rest\n}: ThemeScopeProps) {\n return (\n <Component\n {...rest}\n data-ml-mode={theme ? undefined : mode}\n className={cx(theme ?? themes[mode], className)}\n />\n );\n}\n"],"mappings":";;;;;;;;;AAgBA,SAAgB,WAAW,EACzB,OAAO,SACP,OACA,IAAI,YAAY,OAChB,WACA,GAAG,QACe;CAClB,OACE,oBAAC,WAAD;EACE,GAAI;EACJ,gBAAc,QAAQ,KAAA,IAAY;EAClC,WAAW,GAAG,SAAS,OAAO,OAAO,SAAS;CAC/C,CAAA;AAEL"}
@@ -1,2 +1,3 @@
1
+
1
2
  import { ToastOptions, ToastProvider, ToastProviderProps, ToastTone, useToast } from "./toast.js";
2
3
  export { type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, useToast };
@@ -1,3 +1,4 @@
1
+
1
2
  import { ReactNode } from "react";
2
3
  export type ToastTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
3
4
  export interface ToastOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"toast.d.ts","names":[],"sources":["../../../src/components/toast/toast.tsx"],"mappings":";YAcY;iBAEK;EACf,OAAO;EACP,cAAc;EACd,OAAO;;EAEP;IAAW;IAAe;;;EAE1B;;EAEA;;UAQQ;EACR,QAAQ,SAAS;EACjB,UAAU;;;wBAMI,YAAY;iBAMX;EACf,UAAU;;EAEV;;EAEA;EACA;;;;;;wBAUc,gBACd,UACA,KACA,OACA,gBACC,qCAAkB,IAAA"}
1
+ {"version":3,"file":"toast.d.ts","names":[],"sources":["../../../src/components/toast/toast.tsx"],"mappings":";;YAcY;iBAEK;EACf,OAAO;EACP,cAAc;EACd,OAAO;;EAEP;IAAW;IAAe;;;EAE1B;;EAEA;;UAQQ;EACR,QAAQ,SAAS;EACjB,UAAU;;;wBAMI,YAAY;iBAMX;EACf,UAAU;;EAEV;;EAEA;EACA;;;;;;wBAUc,gBACd,UACA,KACA,OACA,gBACC,qCAAkB,IAAA"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
2
3
  import { iconClose } from "@mohirlab/icons";
3
4
  import { Icon } from "../icon/icon.js";
@@ -1 +1 @@
1
- {"version":3,"file":"toast.js","names":["styles.region","styles.toast","styles.sealMark","styles.content","styles.title","styles.dismiss"],"sources":["../../../src/components/toast/toast.tsx"],"sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport { iconClose } from '@mohirlab/icons';\nimport { Icon } from '../icon';\nimport * as styles from './toast.css';\n\nexport type ToastTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';\n\nexport interface ToastOptions {\n title: ReactNode;\n description?: ReactNode;\n tone?: ToastTone;\n /** One follow-up action, e.g. Undo. Toasts must never be the only way to do something. */\n action?: { label: string; onClick: () => void };\n /** Milliseconds before it dismisses itself. Default 5000 (8000 for danger). `Infinity` keeps it. */\n duration?: number;\n /** Reuse an id to replace a toast instead of stacking a new one. */\n id?: string;\n}\n\ninterface ToastItem extends ToastOptions {\n id: string;\n closing: boolean;\n}\n\ninterface ToastApi {\n toast: (options: ToastOptions) => string;\n dismiss: (id: string) => void;\n}\n\nconst ToastContext = createContext<ToastApi | null>(null);\n\n/** Show and dismiss toasts. Needs a `<ToastProvider>` above. */\nexport function useToast(): ToastApi {\n const api = useContext(ToastContext);\n if (!api) throw new Error('useToast() must be used inside <ToastProvider>.');\n return api;\n}\n\nexport interface ToastProviderProps {\n children: ReactNode;\n /** Most toasts on screen at once; older ones are dismissed. Default 3. */\n max?: number;\n /** Accessible name of the notifications region, for localisation. */\n label?: string;\n dismissLabel?: string;\n}\n\nlet counter = 0;\nconst EXIT_MS = 400;\n\n/**\n * Renders the notification region in place (so it inherits the surrounding theme) and\n * provides `useToast()`. Put it once near the root, inside your `ThemeScope`.\n */\nexport function ToastProvider({\n children,\n max = 3,\n label = 'Notifications',\n dismissLabel = 'Dismiss',\n}: ToastProviderProps) {\n const [items, setItems] = useState<ToastItem[]>([]);\n const [paused, setPaused] = useState(false);\n\n // Closing toasts stay for their exit animation, then this sweep removes them.\n const sweep = useCallback(() => {\n setTimeout(() => setItems((list) => list.filter((t) => !t.closing)), EXIT_MS);\n }, []);\n\n const dismiss = useCallback(\n (id: string) => {\n setItems((list) => list.map((t) => (t.id === id ? { ...t, closing: true } : t)));\n sweep();\n },\n [sweep],\n );\n\n const toast = useCallback(\n (options: ToastOptions) => {\n const id = options.id ?? `ml-toast-${++counter}`;\n setItems((list) => {\n const next = [...list.filter((t) => t.id !== id), { ...options, id, closing: false }];\n // Over the limit: the oldest open toasts start leaving.\n const overflow = new Set(\n next\n .filter((t) => !t.closing)\n .slice(0, -max)\n .map((t) => t.id),\n );\n return overflow.size ? next.map((t) => (overflow.has(t.id) ? { ...t, closing: true } : t)) : next;\n });\n sweep();\n return id;\n },\n [max, sweep],\n );\n\n const api = useMemo(() => ({ toast, dismiss }), [toast, dismiss]);\n\n return (\n <ToastContext.Provider value={api}>\n {children}\n <section aria-label={label}>\n {/* oxlint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- hover and focus only pause the timers; nothing is activated */}\n <ol\n className={styles.region}\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n onPointerEnter={() => setPaused(true)}\n onPointerLeave={() => setPaused(false)}\n onFocus={() => setPaused(true)}\n onBlur={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setPaused(false);\n }}\n >\n {items.map((item) => (\n <ToastSlip\n key={item.id}\n item={item}\n paused={paused}\n dismissLabel={dismissLabel}\n onDismiss={() => dismiss(item.id)}\n />\n ))}\n </ol>\n </section>\n </ToastContext.Provider>\n );\n}\n\nfunction ToastSlip({\n item,\n paused,\n dismissLabel,\n onDismiss,\n}: {\n item: ToastItem;\n paused: boolean;\n dismissLabel: string;\n onDismiss: () => void;\n}) {\n const tone = item.tone ?? 'neutral';\n const duration = item.duration ?? (tone === 'danger' ? 8000 : 5000);\n const remaining = useRef(duration);\n\n // Count down only while nothing is hovered or focused; resume where it stopped.\n useEffect(() => {\n if (item.closing || paused || !Number.isFinite(remaining.current)) return;\n const started = Date.now();\n const timer = setTimeout(onDismiss, remaining.current);\n return () => {\n clearTimeout(timer);\n remaining.current -= Date.now() - started;\n };\n }, [item.closing, paused, onDismiss]);\n\n return (\n <li\n className={styles.toast({ tone })}\n data-state={item.closing ? 'closed' : 'open'}\n // Danger interrupts; everything else waits its turn in the polite region.\n role={tone === 'danger' ? 'alert' : undefined}\n aria-atomic=\"true\"\n >\n <span className={styles.sealMark} aria-hidden=\"true\" />\n <div className={styles.content}>\n <span className={styles.title}>{item.title}</span>\n {item.description && <span className={styles.description}>{item.description}</span>}\n {item.action && (\n <button\n type=\"button\"\n className={styles.action}\n onClick={() => {\n item.action!.onClick();\n onDismiss();\n }}\n >\n {item.action.label}\n </button>\n )}\n </div>\n <button type=\"button\" className={styles.dismiss} aria-label={dismissLabel} onClick={onDismiss}>\n <Icon icon={iconClose} size={16} />\n </button>\n </li>\n );\n}\n"],"mappings":";;;;;;AAsCA,MAAM,eAAe,cAA+B,IAAI;;AAGxD,SAAgB,WAAqB;CACnC,MAAM,MAAM,WAAW,YAAY;CACnC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,iDAAiD;CAC3E,OAAO;AACT;AAWA,IAAI,UAAU;AACd,MAAM,UAAU;;;;;AAMhB,SAAgB,cAAc,EAC5B,UACA,MAAM,GACN,QA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KACP,CAAA;IAEP;;GACL,oBAAC,UAAD;IAAQ,MAAK;IAAS,WAAWC;IAAgB,cAAY;IAAc,SAAS;IAClF,UAAA,oBAAC,MAAD;KAAM,MAAM;KAAW,MAAM;IAAK,CAAA;GAC5B,CAAA;EACN;;AAER"}
1
+ {"version":3,"file":"toast.js","names":["styles.region","styles.toast","styles.sealMark","styles.content","styles.title","styles.dismiss"],"sources":["../../../src/components/toast/toast.tsx"],"sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport { iconClose } from '@mohirlab/icons';\nimport { Icon } from '../icon';\nimport * as styles from './toast.css';\n\nexport type ToastTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';\n\nexport interface ToastOptions {\n title: ReactNode;\n description?: ReactNode;\n tone?: ToastTone;\n /** One follow-up action, e.g. Undo. Toasts must never be the only way to do something. */\n action?: { label: string; onClick: () => void };\n /** Milliseconds before it dismisses itself. Default 5000 (8000 for danger). `Infinity` keeps it. */\n duration?: number;\n /** Reuse an id to replace a toast instead of stacking a new one. */\n id?: string;\n}\n\ninterface ToastItem extends ToastOptions {\n id: string;\n closing: boolean;\n}\n\ninterface ToastApi {\n toast: (options: ToastOptions) => string;\n dismiss: (id: string) => void;\n}\n\nconst ToastContext = createContext<ToastApi | null>(null);\n\n/** Show and dismiss toasts. Needs a `<ToastProvider>` above. */\nexport function useToast(): ToastApi {\n const api = useContext(ToastContext);\n if (!api) throw new Error('useToast() must be used inside <ToastProvider>.');\n return api;\n}\n\nexport interface ToastProviderProps {\n children: ReactNode;\n /** Most toasts on screen at once; older ones are dismissed. Default 3. */\n max?: number;\n /** Accessible name of the notifications region, for localisation. */\n label?: string;\n dismissLabel?: string;\n}\n\nlet counter = 0;\nconst EXIT_MS = 400;\n\n/**\n * Renders the notification region in place (so it inherits the surrounding theme) and\n * provides `useToast()`. Put it once near the root, inside your `ThemeScope`.\n */\nexport function ToastProvider({\n children,\n max = 3,\n label = 'Notifications',\n dismissLabel = 'Dismiss',\n}: ToastProviderProps) {\n const [items, setItems] = useState<ToastItem[]>([]);\n const [paused, setPaused] = useState(false);\n\n // Closing toasts stay for their exit animation, then this sweep removes them.\n const sweep = useCallback(() => {\n setTimeout(() => setItems((list) => list.filter((t) => !t.closing)), EXIT_MS);\n }, []);\n\n const dismiss = useCallback(\n (id: string) => {\n setItems((list) => list.map((t) => (t.id === id ? { ...t, closing: true } : t)));\n sweep();\n },\n [sweep],\n );\n\n const toast = useCallback(\n (options: ToastOptions) => {\n const id = options.id ?? `ml-toast-${++counter}`;\n setItems((list) => {\n const next = [...list.filter((t) => t.id !== id), { ...options, id, closing: false }];\n // Over the limit: the oldest open toasts start leaving.\n const overflow = new Set(\n next\n .filter((t) => !t.closing)\n .slice(0, -max)\n .map((t) => t.id),\n );\n return overflow.size ? next.map((t) => (overflow.has(t.id) ? { ...t, closing: true } : t)) : next;\n });\n sweep();\n return id;\n },\n [max, sweep],\n );\n\n const api = useMemo(() => ({ toast, dismiss }), [toast, dismiss]);\n\n return (\n <ToastContext.Provider value={api}>\n {children}\n <section aria-label={label}>\n {/* oxlint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- hover and focus only pause the timers; nothing is activated */}\n <ol\n className={styles.region}\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n onPointerEnter={() => setPaused(true)}\n onPointerLeave={() => setPaused(false)}\n onFocus={() => setPaused(true)}\n onBlur={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setPaused(false);\n }}\n >\n {items.map((item) => (\n <ToastSlip\n key={item.id}\n item={item}\n paused={paused}\n dismissLabel={dismissLabel}\n onDismiss={() => dismiss(item.id)}\n />\n ))}\n </ol>\n </section>\n </ToastContext.Provider>\n );\n}\n\nfunction ToastSlip({\n item,\n paused,\n dismissLabel,\n onDismiss,\n}: {\n item: ToastItem;\n paused: boolean;\n dismissLabel: string;\n onDismiss: () => void;\n}) {\n const tone = item.tone ?? 'neutral';\n const duration = item.duration ?? (tone === 'danger' ? 8000 : 5000);\n const remaining = useRef(duration);\n\n // Count down only while nothing is hovered or focused; resume where it stopped.\n useEffect(() => {\n if (item.closing || paused || !Number.isFinite(remaining.current)) return;\n const started = Date.now();\n const timer = setTimeout(onDismiss, remaining.current);\n return () => {\n clearTimeout(timer);\n remaining.current -= Date.now() - started;\n };\n }, [item.closing, paused, onDismiss]);\n\n return (\n <li\n className={styles.toast({ tone })}\n data-state={item.closing ? 'closed' : 'open'}\n // Danger interrupts; everything else waits its turn in the polite region.\n role={tone === 'danger' ? 'alert' : undefined}\n aria-atomic=\"true\"\n >\n <span className={styles.sealMark} aria-hidden=\"true\" />\n <div className={styles.content}>\n <span className={styles.title}>{item.title}</span>\n {item.description && <span className={styles.description}>{item.description}</span>}\n {item.action && (\n <button\n type=\"button\"\n className={styles.action}\n onClick={() => {\n item.action!.onClick();\n onDismiss();\n }}\n >\n {item.action.label}\n </button>\n )}\n </div>\n <button type=\"button\" className={styles.dismiss} aria-label={dismissLabel} onClick={onDismiss}>\n <Icon icon={iconClose} size={16} />\n </button>\n </li>\n );\n}\n"],"mappings":";;;;;;;AAsCA,MAAM,eAAe,cAA+B,IAAI;;AAGxD,SAAgB,WAAqB;CACnC,MAAM,MAAM,WAAW,YAAY;CACnC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,iDAAiD;CAC3E,OAAO;AACT;AAWA,IAAI,UAAU;AACd,MAAM,UAAU;;;;;AAMhB,SAAgB,cAAc,EAC5B,UACA,MAAM,GACN,QAAQ,iBACR,eAAe,aACM;CACrB,MAAM,CAAC,OAAO,YAAY,SAAsB,CAAC,CAAC;CAClD,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAG1C,MAAM,QAAQ,kBAAkB;EAC9B,iBAAiB,UAAU,SAAS,KAAK,QAAQ,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,OAAO;CAC9E,GAAG,CAAC,CAAC;CAEL,MAAM,UAAU,aACb,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css.ts
3
4
  var action = "ml_jxsxlqc";
@@ -1,3 +1,4 @@
1
+
1
2
  import { PresenceState, usePresence } from "./use-presence.js";
2
3
  import { useDisclosure } from "./use-disclosure.js";
3
4
  export { type PresenceState, useDisclosure, usePresence };
@@ -1,3 +1,4 @@
1
+
1
2
  /** Open/closed state for dialogs, sheets and other disclosures. */
2
3
  export declare function useDisclosure(initial?: boolean): {
3
4
  open: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"use-disclosure.d.ts","names":[],"sources":["../../src/hooks/use-disclosure.ts"],"mappings":";wBAGgB,cAAc"}
1
+ {"version":3,"file":"use-disclosure.d.ts","names":[],"sources":["../../src/hooks/use-disclosure.ts"],"mappings":";;wBAGgB,cAAc"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useCallback, useState } from "react";
2
3
  // src/hooks/use-disclosure.ts
3
4
  /** Open/closed state for dialogs, sheets and other disclosures. */
@@ -1 +1 @@
1
- {"version":3,"file":"use-disclosure.js","names":[],"sources":["../../src/hooks/use-disclosure.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\n/** Open/closed state for dialogs, sheets and other disclosures. */\nexport function useDisclosure(initial = false) {\n const [open, setOpen] = useState(initial);\n const onOpen = useCallback(() => setOpen(true), []);\n const onClose = useCallback(() => setOpen(false), []);\n const onToggle = useCallback(() => setOpen((v) => !v), []);\n return { open, setOpen, onOpen, onClose, onToggle };\n}\n"],"mappings":";;;AAGA,SAAgB,cAAc,UAAU,OAAO;CAC7C,MAAM,CAAC,MAAM,WAAW,SAAS,OAAO;CAIxC,OAAO;EAAE;EAAM;EAAS,QAHT,kBAAkB,QAAQ,IAAI,GAAG,CAAC,CAGpB;EAAG,SAFhB,kBAAkB,QAAQ,KAAK,GAAG,CAAC,CAEb;EAAG,UADxB,kBAAkB,SAAS,MAAM,CAAC,CAAC,GAAG,CAAC,CACR;CAAE;AACpD"}
1
+ {"version":3,"file":"use-disclosure.js","names":[],"sources":["../../src/hooks/use-disclosure.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\n/** Open/closed state for dialogs, sheets and other disclosures. */\nexport function useDisclosure(initial = false) {\n const [open, setOpen] = useState(initial);\n const onOpen = useCallback(() => setOpen(true), []);\n const onClose = useCallback(() => setOpen(false), []);\n const onToggle = useCallback(() => setOpen((v) => !v), []);\n return { open, setOpen, onOpen, onClose, onToggle };\n}\n"],"mappings":";;;;AAGA,SAAgB,cAAc,UAAU,OAAO;CAC7C,MAAM,CAAC,MAAM,WAAW,SAAS,OAAO;CAIxC,OAAO;EAAE;EAAM;EAAS,QAHT,kBAAkB,QAAQ,IAAI,GAAG,CAAC,CAGpB;EAAG,SAFhB,kBAAkB,QAAQ,KAAK,GAAG,CAAC,CAEb;EAAG,UADxB,kBAAkB,SAAS,MAAM,CAAC,CAAC,GAAG,CAAC,CACR;CAAE;AACpD"}
@@ -1,3 +1,4 @@
1
+
1
2
  import { RefObject } from "react";
2
3
  export type PresenceState = 'open' | 'closed';
3
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"use-presence.d.ts","names":[],"sources":["../../src/hooks/use-presence.ts"],"mappings":";YAEY;;;;;;;;;wBAUI,YACd,eACA,KAAK,UAAU,uBACb,gBAAgB;EAAqB;EAA6B"}
1
+ {"version":3,"file":"use-presence.d.ts","names":[],"sources":["../../src/hooks/use-presence.ts"],"mappings":";;YAEY;;;;;;;;;wBAUI,YACd,eACA,KAAK,UAAU,uBACb,gBAAgB;EAAqB;EAA6B"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useEffect, useLayoutEffect, useRef, useState } from "react";
2
3
  // src/hooks/use-presence.ts
3
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"use-presence.js","names":[],"sources":["../../src/hooks/use-presence.ts"],"sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState, type RefObject } from 'react';\n\nexport type PresenceState = 'open' | 'closed';\n\n/**\n * Keeps an element mounted until its exit animation has finished.\n *\n * Set `data-state={state}` on the element and give it a `motion()` style: when `open`\n * turns false, `state` becomes `closed`, the exit animation runs, and only then does\n * `mounted` turn false. If no animation runs (no CSS, reduced motion, tests), a timeout\n * finishes the exit anyway.\n */\nexport function usePresence(\n open: boolean,\n ref: RefObject<HTMLElement | null>,\n { onExitComplete, maxExitMs = 600 }: { onExitComplete?: () => void; maxExitMs?: number } = {},\n) {\n const [mounted, setMounted] = useState(open);\n // Mount during render when `open` turns on, so the element exists in the same commit.\n const [prevOpen, setPrevOpen] = useState(open);\n if (open !== prevOpen) {\n setPrevOpen(open);\n if (open) setMounted(true);\n }\n const state: PresenceState = open ? 'open' : 'closed';\n\n const exitRef = useRef(onExitComplete);\n useLayoutEffect(() => {\n exitRef.current = onExitComplete;\n });\n\n useEffect(() => {\n if (open || !mounted) return;\n const el = ref.current;\n let done = false;\n const finish = () => {\n if (done) return;\n done = true;\n exitRef.current?.();\n setMounted(false);\n };\n // Ignore animations of children and of pseudo-elements such as ::backdrop.\n const onEnd = (event: AnimationEvent) => {\n if (event.target === el && !event.pseudoElement) finish();\n };\n el?.addEventListener('animationend', onEnd);\n const timer = setTimeout(finish, maxExitMs);\n return () => {\n el?.removeEventListener('animationend', onEnd);\n clearTimeout(timer);\n };\n }, [open, mounted, ref, maxExitMs]);\n\n return { mounted, state };\n}\n"],"mappings":";;;;;;;;;;AAYA,SAAgB,YACd,MACA,KACA,EAAE,gBAAgB,YAAY,QAA6D,CAAC,GAC5F;CACA,MAAM,CAAC,SAAS,cAAc,SAAS,IAAI;CAE3C,MAAM,CAAC,UAAU,eAAe,SAAS,IAAI;CAC7C,IAAI,SAAS,UAAU;EACrB,YAAY,IAAI;EAChB,IAAI,MAAM,WAAW,IAAI;CAC3B;CACA,MAAM,QAAuB,OAAO,SAAS;CAE7C,MAAM,UAAU,OAAO,cAAc;CACrC,sBAAsB;EACpB,QAAQ,UAAU;CACpB,CAAC;CAED,gBAAgB;EACd,IAAI,QAAQ,CAAC,SAAS;EACtB,MAAM,KAAK,IAAI;EACf,IAAI,OAAO;EACX,MAAM,eAAe;GACnB,IAAI,MAAM;GACV,OAAO;GACP,QAAQ,UAAU;GAClB,WAAW,KAAK;EAClB;EAEA,MAAM,SAAS,UAA0B;GACvC,IAAI,MAAM,WAAW,MAAM,CAAC,MAAM,eAAe,OAAO;EAC1D;EACA,IAAI,iBAAiB,gBAAgB,KAAK;EAC1C,MAAM,QAAQ,WAAW,QAAQ,SAAS;EAC1C,aAAa;GACX,IAAI,oBAAoB,gBAAgB,KAAK;GAC7C,aAAa,KAAK;EACpB;CACF,GAAG;EAAC;EAAM;EAAS;EAAK;CAAS,CAAC;CAElC,OAAO;EAAE;EAAS;CAAM;AAC1B"}
1
+ {"version":3,"file":"use-presence.js","names":[],"sources":["../../src/hooks/use-presence.ts"],"sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState, type RefObject } from 'react';\n\nexport type PresenceState = 'open' | 'closed';\n\n/**\n * Keeps an element mounted until its exit animation has finished.\n *\n * Set `data-state={state}` on the element and give it a `motion()` style: when `open`\n * turns false, `state` becomes `closed`, the exit animation runs, and only then does\n * `mounted` turn false. If no animation runs (no CSS, reduced motion, tests), a timeout\n * finishes the exit anyway.\n */\nexport function usePresence(\n open: boolean,\n ref: RefObject<HTMLElement | null>,\n { onExitComplete, maxExitMs = 600 }: { onExitComplete?: () => void; maxExitMs?: number } = {},\n) {\n const [mounted, setMounted] = useState(open);\n // Mount during render when `open` turns on, so the element exists in the same commit.\n const [prevOpen, setPrevOpen] = useState(open);\n if (open !== prevOpen) {\n setPrevOpen(open);\n if (open) setMounted(true);\n }\n const state: PresenceState = open ? 'open' : 'closed';\n\n const exitRef = useRef(onExitComplete);\n useLayoutEffect(() => {\n exitRef.current = onExitComplete;\n });\n\n useEffect(() => {\n if (open || !mounted) return;\n const el = ref.current;\n let done = false;\n const finish = () => {\n if (done) return;\n done = true;\n exitRef.current?.();\n setMounted(false);\n };\n // Ignore animations of children and of pseudo-elements such as ::backdrop.\n const onEnd = (event: AnimationEvent) => {\n if (event.target === el && !event.pseudoElement) finish();\n };\n el?.addEventListener('animationend', onEnd);\n const timer = setTimeout(finish, maxExitMs);\n return () => {\n el?.removeEventListener('animationend', onEnd);\n clearTimeout(timer);\n };\n }, [open, mounted, ref, maxExitMs]);\n\n return { mounted, state };\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAgB,YACd,MACA,KACA,EAAE,gBAAgB,YAAY,QAA6D,CAAC,GAC5F;CACA,MAAM,CAAC,SAAS,cAAc,SAAS,IAAI;CAE3C,MAAM,CAAC,UAAU,eAAe,SAAS,IAAI;CAC7C,IAAI,SAAS,UAAU;EACrB,YAAY,IAAI;EAChB,IAAI,MAAM,WAAW,IAAI;CAC3B;CACA,MAAM,QAAuB,OAAO,SAAS;CAE7C,MAAM,UAAU,OAAO,cAAc;CACrC,sBAAsB;EACpB,QAAQ,UAAU;CACpB,CAAC;CAED,gBAAgB;EACd,IAAI,QAAQ,CAAC,SAAS;EACtB,MAAM,KAAK,IAAI;EACf,IAAI,OAAO;EACX,MAAM,eAAe;GACnB,IAAI,MAAM;GACV,OAAO;GACP,QAAQ,UAAU;GAClB,WAAW,KAAK;EAClB;EAEA,MAAM,SAAS,UAA0B;GACvC,IAAI,MAAM,WAAW,MAAM,CAAC,MAAM,eAAe,OAAO;EAC1D;EACA,IAAI,iBAAiB,gBAAgB,KAAK;EAC1C,MAAM,QAAQ,WAAW,QAAQ,SAAS;EAC1C,aAAa;GACX,IAAI,oBAAoB,gBAAgB,KAAK;GAC7C,aAAa,KAAK;EACpB;CACF,GAAG;EAAC;EAAM;EAAS;EAAK;CAAS,CAAC;CAElC,OAAO;EAAE;EAAS;CAAM;AAC1B"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+
2
+ import { Accordion, AccordionItem, AccordionItemProps, AccordionProps } from "./components/accordion/accordion.js";
3
+ import "./components/accordion/index.js";
1
4
  import { Avatar, AvatarGroup, AvatarGroupProps, AvatarProps } from "./components/avatar/avatar.js";
2
5
  import "./components/avatar/index.js";
3
6
  import { Badge, BadgeProps } from "./components/badge/badge.js";
@@ -31,6 +34,8 @@ import { Select, SelectProps } from "./components/select/select.js";
31
34
  import "./components/select/index.js";
32
35
  import { Slider, SliderProps, SliderValue } from "./components/slider/slider.js";
33
36
  import "./components/slider/index.js";
37
+ import { CellProps, Table, TableProps, Td, Th } from "./components/table/table.js";
38
+ import "./components/table/index.js";
34
39
  import { Heading, HeadingProps, MarginProps, Text, TextProps } from "./components/text/text.js";
35
40
  import "./components/text/index.js";
36
41
  import { ToastOptions, ToastProvider, ToastProviderProps, ToastTone, useToast } from "./components/toast/toast.js";
@@ -40,4 +45,4 @@ import { PresenceState, usePresence } from "./hooks/use-presence.js";
40
45
  import { useDisclosure } from "./hooks/use-disclosure.js";
41
46
  import "./hooks/index.js";
42
47
  import { cx } from "./utils/cx.js";
43
- export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Badge, type BadgeProps, BottomNav, BottomNavItem, type BottomNavProps, BottomNavSpacer, Box, type BoxProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, Card, CardHeader, CardMedia, type CardMediaProps, type CardProps, Checkbox, type CheckboxProps, type Crumb, Dialog, DialogActions, DialogBody, type DialogProps, Field, type FieldContextValue, type FieldProps, Heading, type HeadingProps, Icon, type IconProps, Input, type InputProps, type MarginProps, type Placement, Popover, type PopoverProps, type PresenceState, Radio, RadioGroup, type RadioGroupProps, type RadioProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Select, type SelectProps, Slider, type SliderProps, SliderValue, Stack, type StackProps, Switch, type SwitchProps, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Text, type TextProps, Textarea, type TextareaProps, ThemeScope, type ThemeScopeProps, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, Tooltip, type TooltipProps, cx, splitSprinkles, useDisclosure, useField, usePresence, useToast };
48
+ export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Badge, type BadgeProps, BottomNav, BottomNavItem, type BottomNavProps, BottomNavSpacer, Box, type BoxProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, Card, CardHeader, CardMedia, type CardMediaProps, type CardProps, type CellProps, Checkbox, type CheckboxProps, type Crumb, Dialog, DialogActions, DialogBody, type DialogProps, Field, type FieldContextValue, type FieldProps, Heading, type HeadingProps, Icon, type IconProps, Input, type InputProps, type MarginProps, type Placement, Popover, type PopoverProps, type PresenceState, Radio, RadioGroup, type RadioGroupProps, type RadioProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Select, type SelectProps, Slider, type SliderProps, SliderValue, Stack, type StackProps, Switch, type SwitchProps, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Table, type TableProps, Tabs, type TabsProps, Td, Text, type TextProps, Textarea, type TextareaProps, Th, ThemeScope, type ThemeScopeProps, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, Tooltip, type TooltipProps, cx, splitSprinkles, useDisclosure, useField, usePresence, useToast };
package/dist/index.js CHANGED
@@ -1,4 +1,7 @@
1
+ "use client";
1
2
  import { ThemeScope } from "./components/theme-scope/theme-scope.js";
3
+ import { Icon } from "./components/icon/icon.js";
4
+ import { Accordion, AccordionItem } from "./components/accordion/accordion.js";
2
5
  import { Avatar, AvatarGroup } from "./components/avatar/avatar.js";
3
6
  import { Badge } from "./components/badge/badge.js";
4
7
  import { Box, splitSprinkles } from "./components/box/box.js";
@@ -6,7 +9,6 @@ import { Stack } from "./components/box/stack.js";
6
9
  import { Button } from "./components/button/button.js";
7
10
  import { Card, CardHeader } from "./components/card/card.js";
8
11
  import { CardMedia } from "./components/card/card-media.js";
9
- import { Icon } from "./components/icon/icon.js";
10
12
  import { Checkbox, Radio, RadioGroup, Switch } from "./components/choice/choice.js";
11
13
  import { usePresence } from "./hooks/use-presence.js";
12
14
  import { Dialog, DialogActions, DialogBody } from "./components/dialog/dialog.js";
@@ -18,8 +20,9 @@ import { BottomNav, BottomNavItem, BottomNavSpacer, Breadcrumbs, SegmentedContro
18
20
  import { Popover, Tooltip } from "./components/popover/popover.js";
19
21
  import { Select } from "./components/select/select.js";
20
22
  import { Slider, SliderValue } from "./components/slider/slider.js";
23
+ import { Table, Td, Th } from "./components/table/table.js";
21
24
  import { Heading, Text } from "./components/text/text.js";
22
25
  import { ToastProvider, useToast } from "./components/toast/toast.js";
23
26
  import { cx } from "./utils/cx.js";
24
27
  import { useDisclosure } from "./hooks/use-disclosure.js";
25
- export { Avatar, AvatarGroup, Badge, BottomNav, BottomNavItem, BottomNavSpacer, Box, Breadcrumbs, Button, Card, CardHeader, CardMedia, Checkbox, Dialog, DialogActions, DialogBody, Field, Heading, Icon, Input, Popover, Radio, RadioGroup, SegmentedControl, Select, Slider, SliderValue, Stack, Switch, Tab, TabList, TabPanel, Tabs, Text, Textarea, ThemeScope, ToastProvider, Tooltip, cx, splitSprinkles, useDisclosure, useField, usePresence, useToast };
28
+ export { Accordion, AccordionItem, Avatar, AvatarGroup, Badge, BottomNav, BottomNavItem, BottomNavSpacer, Box, Breadcrumbs, Button, Card, CardHeader, CardMedia, Checkbox, Dialog, DialogActions, DialogBody, Field, Heading, Icon, Input, Popover, Radio, RadioGroup, SegmentedControl, Select, Slider, SliderValue, Stack, Switch, Tab, TabList, TabPanel, Table, Tabs, Td, Text, Textarea, Th, ThemeScope, ToastProvider, Tooltip, cx, splitSprinkles, useDisclosure, useField, usePresence, useToast };
package/dist/styles.css CHANGED
@@ -2,6 +2,67 @@
2
2
  @layer ml-theme;
3
3
  @layer ml-components;
4
4
  @layer ml-utilities;
5
+ @layer ml-components {
6
+ .ml_1mhi8cy0 {
7
+ display: flex;
8
+ flex-direction: column;
9
+ border-top: 1px solid var(--ml_color-hairline_uyc1fj8);
10
+ }
11
+ .ml_1mhi8cy1 {
12
+ border-bottom: 1px solid var(--ml_color-hairline_uyc1fj8);
13
+ }
14
+ .ml_1mhi8cy2 {
15
+ outline: none;
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: space-between;
19
+ gap: var(--ml_space-4_uyc1fj13);
20
+ min-height: 3rem;
21
+ padding-block: var(--ml_space-3_uyc1fj12);
22
+ list-style: none;
23
+ cursor: pointer;
24
+ font-size: var(--ml_font-size-md_uyc1fj1p);
25
+ font-weight: var(--ml_font-weight-strong_uyc1fj1x);
26
+ color: var(--ml_color-text_uyc1fj4);
27
+ border-radius: var(--ml_radius-sm_uyc1fj1g);
28
+ }
29
+ .ml_1mhi8cy2:focus-visible {
30
+ box-shadow: 0 0 0 2px var(--ml_color-canvas_uyc1fj0), 0 0 0 4px var(--ml_color-focus_uyc1fjs);
31
+ }
32
+ .ml_1mhi8cy2::-webkit-details-marker {
33
+ display: none;
34
+ }
35
+ .ml_1mhi8cy2::marker {
36
+ content: "";
37
+ }
38
+ .ml_1mhi8cy2:hover {
39
+ color: var(--ml_color-accentText_uyc1fjf);
40
+ }
41
+ .ml_1mhi8cy3 {
42
+ flex-shrink: 0;
43
+ color: var(--ml_color-textSubtle_uyc1fj6);
44
+ transition: transform var(--ml_motion-duration-settle_uyc1fj27) var(--ml_motion-easing-standard_uyc1fj29);
45
+ }
46
+ .ml_1mhi8cy1[open] .ml_1mhi8cy3 {
47
+ transform: rotate(180deg);
48
+ }
49
+ .ml_1mhi8cy4 {
50
+ padding-bottom: var(--ml_space-4_uyc1fj13);
51
+ padding-right: var(--ml_space-8_uyc1fj16);
52
+ font-size: var(--ml_font-size-md_uyc1fj1p);
53
+ line-height: var(--ml_font-leading-normal_uyc1fj21);
54
+ color: var(--ml_color-textMuted_uyc1fj5);
55
+ }
56
+ @media (prefers-reduced-motion: reduce) {
57
+ .ml_1mhi8cy3 {
58
+ transition: none;
59
+ }
60
+ }
61
+ }
62
+ @layer ml-reset;
63
+ @layer ml-theme;
64
+ @layer ml-components;
65
+ @layer ml-utilities;
5
66
  @layer ml-components {
6
67
  .ml_7aeaaw1 {
7
68
  position: relative;
@@ -1528,6 +1589,102 @@
1528
1589
  @layer ml-theme;
1529
1590
  @layer ml-components;
1530
1591
  @layer ml-utilities;
1592
+ @layer ml-components {
1593
+ .ml_1fd8r9h2 {
1594
+ outline: none;
1595
+ position: relative;
1596
+ overflow-x: auto;
1597
+ max-width: 100%;
1598
+ border-radius: var(--ml_radius-lg_uyc1fj1i);
1599
+ background-color: var(--ml_color-surface_uyc1fj1);
1600
+ box-shadow: var(--ml_shadow-hairline_uyc1fjv);
1601
+ }
1602
+ .ml_1fd8r9h2:focus-visible {
1603
+ box-shadow: 0 0 0 2px var(--ml_color-canvas_uyc1fj0), 0 0 0 4px var(--ml_color-focus_uyc1fjs);
1604
+ }
1605
+ .ml_1fd8r9h2[data-sticky-header] {
1606
+ overflow-y: auto;
1607
+ }
1608
+ .ml_1fd8r9h3 {
1609
+ --ml_1fd8r9h0: var(--ml_space-3_uyc1fj12);
1610
+ --ml_1fd8r9h1: var(--ml_space-4_uyc1fj13);
1611
+ width: 100%;
1612
+ border-collapse: separate;
1613
+ border-spacing: 0;
1614
+ font-size: var(--ml_font-size-sm_uyc1fj1o);
1615
+ color: var(--ml_color-text_uyc1fj4);
1616
+ }
1617
+ .ml_1fd8r9h3[data-density="compact"] {
1618
+ --ml_1fd8r9h0: var(--ml_space-2_uyc1fj11);
1619
+ --ml_1fd8r9h1: var(--ml_space-3_uyc1fj12);
1620
+ }
1621
+ .ml_1fd8r9h3[data-density="comfortable"] {
1622
+ --ml_1fd8r9h0: var(--ml_space-4_uyc1fj13);
1623
+ --ml_1fd8r9h1: var(--ml_space-5_uyc1fj14);
1624
+ }
1625
+ .ml_1fd8r9h3 caption {
1626
+ caption-side: top;
1627
+ text-align: start;
1628
+ padding: var(--ml_space-4_uyc1fj13) var(--ml_space-4_uyc1fj13) var(--ml_space-2_uyc1fj11);
1629
+ font-weight: var(--ml_font-weight-strong_uyc1fj1x);
1630
+ font-size: var(--ml_font-size-md_uyc1fj1p);
1631
+ }
1632
+ .ml_1fd8r9h3 th, .ml_1fd8r9h3 td {
1633
+ padding: var(--ml_1fd8r9h0) var(--ml_1fd8r9h1);
1634
+ text-align: start;
1635
+ vertical-align: middle;
1636
+ border-bottom: 1px solid var(--ml_color-hairline_uyc1fj8);
1637
+ white-space: nowrap;
1638
+ }
1639
+ .ml_1fd8r9h3 thead th {
1640
+ font-size: var(--ml_font-size-xs_uyc1fj1n);
1641
+ font-weight: var(--ml_font-weight-strong_uyc1fj1x);
1642
+ letter-spacing: var(--ml_font-tracking-label_uyc1fj24);
1643
+ text-transform: uppercase;
1644
+ color: var(--ml_color-textSubtle_uyc1fj6);
1645
+ background-color: var(--ml_color-surface_uyc1fj1);
1646
+ }
1647
+ .ml_1fd8r9h3 tbody tr:last-child > * {
1648
+ border-bottom: 0;
1649
+ }
1650
+ .ml_1fd8r9h3 tbody tr:hover > * {
1651
+ background-color: color-mix(in oklch, var(--ml_color-surface_uyc1fj1), var(--ml_color-text_uyc1fj4) 3%);
1652
+ }
1653
+ .ml_1fd8r9h2[data-sticky-header] thead th {
1654
+ position: sticky;
1655
+ top: 0;
1656
+ z-index: 1;
1657
+ }
1658
+ .ml_1fd8r9h2[data-sticky-first] tr > :first-child {
1659
+ position: sticky;
1660
+ inset-inline-start: 0;
1661
+ z-index: 1;
1662
+ background-color: var(--ml_color-surface_uyc1fj1);
1663
+ box-shadow: 1px 0 0 var(--ml_color-hairline_uyc1fj8);
1664
+ }
1665
+ .ml_1fd8r9h4 {
1666
+ text-align: end;
1667
+ font-variant-numeric: tabular-nums;
1668
+ }
1669
+ .ml_1fd8r9h3 th.ml_1fd8r9h4, .ml_1fd8r9h3 td.ml_1fd8r9h4 {
1670
+ text-align: end;
1671
+ }
1672
+ .ml_1fd8r9h5 {
1673
+ position: absolute;
1674
+ width: 1px;
1675
+ height: 1px;
1676
+ padding: 0;
1677
+ margin: -1px;
1678
+ overflow: hidden;
1679
+ clip: rect(0, 0, 0, 0);
1680
+ white-space: nowrap;
1681
+ border: 0;
1682
+ }
1683
+ }
1684
+ @layer ml-reset;
1685
+ @layer ml-theme;
1686
+ @layer ml-components;
1687
+ @layer ml-utilities;
1531
1688
  @layer ml-components {
1532
1689
  .ml_1pplbdu0 {
1533
1690
  margin: 0;
@@ -1,3 +1,4 @@
1
+
1
2
  /** Join class names, skipping falsy values. */
2
3
  export declare function cx(...classes: Array<string | false | null | undefined>): string;
3
4
  //# sourceMappingURL=cx.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cx.d.ts","names":[],"sources":["../../src/utils/cx.ts"],"mappings":";wBACgB,MAAM,SAAS"}
1
+ {"version":3,"file":"cx.d.ts","names":[],"sources":["../../src/utils/cx.ts"],"mappings":";;wBACgB,MAAM,SAAS"}
package/dist/utils/cx.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  // src/utils/cx.ts
2
3
  /** Join class names, skipping falsy values. */
3
4
  function cx(...classes) {
@@ -1 +1 @@
1
- {"version":3,"file":"cx.js","names":[],"sources":["../../src/utils/cx.ts"],"sourcesContent":["/** Join class names, skipping falsy values. */\nexport function cx(...classes: Array<string | false | null | undefined>): string {\n return classes.filter(Boolean).join(' ');\n}\n"],"mappings":";;AACA,SAAgB,GAAG,GAAG,SAA2D;CAC/E,OAAO,QAAQ,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACzC"}
1
+ {"version":3,"file":"cx.js","names":[],"sources":["../../src/utils/cx.ts"],"sourcesContent":["/** Join class names, skipping falsy values. */\nexport function cx(...classes: Array<string | false | null | undefined>): string {\n return classes.filter(Boolean).join(' ');\n}\n"],"mappings":";;;AACA,SAAgB,GAAG,GAAG,SAA2D;CAC/E,OAAO,QAAQ,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACzC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohirlab/react",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Mohirlab React components.",
5
5
  "keywords": [
6
6
  "design-system",