@traefik-labs/faency 13.4.0 → 13.6.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 (229) hide show
  1. package/dist/components/AriaTable/AriaTable.cjs +13 -5
  2. package/dist/components/AriaTable/AriaTable.cjs.map +1 -1
  3. package/dist/components/AriaTable/AriaTable.constants.cjs +5 -0
  4. package/dist/components/AriaTable/AriaTable.constants.cjs.map +1 -0
  5. package/dist/components/AriaTable/AriaTable.constants.js +5 -0
  6. package/dist/components/AriaTable/AriaTable.constants.js.map +1 -0
  7. package/dist/components/AriaTable/AriaTable.js +13 -5
  8. package/dist/components/AriaTable/AriaTable.js.map +1 -1
  9. package/dist/components/AriaTable/AriaTable.vanilla.cjs +194 -0
  10. package/dist/components/AriaTable/AriaTable.vanilla.cjs.map +1 -0
  11. package/dist/components/AriaTable/AriaTable.vanilla.css.cjs +28 -0
  12. package/dist/components/AriaTable/AriaTable.vanilla.css.cjs.map +1 -0
  13. package/dist/components/AriaTable/AriaTable.vanilla.css.js +17 -0
  14. package/dist/components/AriaTable/AriaTable.vanilla.css.js.map +1 -0
  15. package/dist/components/AriaTable/AriaTable.vanilla.js +185 -0
  16. package/dist/components/AriaTable/AriaTable.vanilla.js.map +1 -0
  17. package/dist/components/Badge/Badge.vanilla.cjs +2 -1
  18. package/dist/components/Badge/Badge.vanilla.cjs.map +1 -1
  19. package/dist/components/Badge/Badge.vanilla.js +2 -1
  20. package/dist/components/Badge/Badge.vanilla.js.map +1 -1
  21. package/dist/components/Blockquote/Blockquote.vanilla.cjs +2 -1
  22. package/dist/components/Blockquote/Blockquote.vanilla.cjs.map +1 -1
  23. package/dist/components/Blockquote/Blockquote.vanilla.js +2 -1
  24. package/dist/components/Blockquote/Blockquote.vanilla.js.map +1 -1
  25. package/dist/components/Box/Box.vanilla.cjs +2 -1
  26. package/dist/components/Box/Box.vanilla.cjs.map +1 -1
  27. package/dist/components/Box/Box.vanilla.js +2 -1
  28. package/dist/components/Box/Box.vanilla.js.map +1 -1
  29. package/dist/components/Bubble/Bubble.vanilla.cjs +2 -1
  30. package/dist/components/Bubble/Bubble.vanilla.cjs.map +1 -1
  31. package/dist/components/Bubble/Bubble.vanilla.js +2 -1
  32. package/dist/components/Bubble/Bubble.vanilla.js.map +1 -1
  33. package/dist/components/Button/Button.vanilla.cjs +2 -1
  34. package/dist/components/Button/Button.vanilla.cjs.map +1 -1
  35. package/dist/components/Button/Button.vanilla.js +2 -1
  36. package/dist/components/Button/Button.vanilla.js.map +1 -1
  37. package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.cjs +5 -4
  38. package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.cjs.map +1 -1
  39. package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.js +5 -4
  40. package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.js.map +1 -1
  41. package/dist/components/Card/Card.vanilla.cjs +2 -1
  42. package/dist/components/Card/Card.vanilla.cjs.map +1 -1
  43. package/dist/components/Card/Card.vanilla.js +2 -1
  44. package/dist/components/Card/Card.vanilla.js.map +1 -1
  45. package/dist/components/CodeBlock/CodeBlock.cjs +2 -2
  46. package/dist/components/CodeBlock/CodeBlock.js +2 -2
  47. package/dist/components/CodeBlock/CodeBlock.vanilla.cjs +6 -14
  48. package/dist/components/CodeBlock/CodeBlock.vanilla.cjs.map +1 -1
  49. package/dist/components/CodeBlock/CodeBlock.vanilla.js +6 -14
  50. package/dist/components/CodeBlock/CodeBlock.vanilla.js.map +1 -1
  51. package/dist/components/Combobox/Combobox.vanilla.cjs +2 -2
  52. package/dist/components/Combobox/Combobox.vanilla.cjs.map +1 -1
  53. package/dist/components/Combobox/Combobox.vanilla.js +2 -2
  54. package/dist/components/Combobox/Combobox.vanilla.js.map +1 -1
  55. package/dist/components/Container/Container.vanilla.cjs +2 -1
  56. package/dist/components/Container/Container.vanilla.cjs.map +1 -1
  57. package/dist/components/Container/Container.vanilla.js +2 -1
  58. package/dist/components/Container/Container.vanilla.js.map +1 -1
  59. package/dist/components/DateTimePicker/DateTimePicker.cjs +1 -1
  60. package/dist/components/DateTimePicker/DateTimePicker.js +1 -1
  61. package/dist/components/Dialog/Dialog.cjs +1 -1
  62. package/dist/components/Dialog/Dialog.js +1 -1
  63. package/dist/components/Elevation/Elevation.vanilla.cjs +2 -1
  64. package/dist/components/Elevation/Elevation.vanilla.cjs.map +1 -1
  65. package/dist/components/Elevation/Elevation.vanilla.css.cjs.map +1 -1
  66. package/dist/components/Elevation/Elevation.vanilla.css.js.map +1 -1
  67. package/dist/components/Elevation/Elevation.vanilla.js +2 -1
  68. package/dist/components/Elevation/Elevation.vanilla.js.map +1 -1
  69. package/dist/components/Field/Field.cjs +80 -33
  70. package/dist/components/Field/Field.cjs.map +1 -1
  71. package/dist/components/Field/Field.js +80 -33
  72. package/dist/components/Field/Field.js.map +1 -1
  73. package/dist/components/Field/Field.vanilla.cjs +62 -32
  74. package/dist/components/Field/Field.vanilla.cjs.map +1 -1
  75. package/dist/components/Field/Field.vanilla.css.cjs +6 -0
  76. package/dist/components/Field/Field.vanilla.css.cjs.map +1 -1
  77. package/dist/components/Field/Field.vanilla.css.js +4 -1
  78. package/dist/components/Field/Field.vanilla.css.js.map +1 -1
  79. package/dist/components/Field/Field.vanilla.js +63 -33
  80. package/dist/components/Field/Field.vanilla.js.map +1 -1
  81. package/dist/components/Field/FieldContext.cjs +48 -10
  82. package/dist/components/Field/FieldContext.cjs.map +1 -1
  83. package/dist/components/Field/FieldContext.js +48 -10
  84. package/dist/components/Field/FieldContext.js.map +1 -1
  85. package/dist/components/Flex/Flex.vanilla.cjs +2 -1
  86. package/dist/components/Flex/Flex.vanilla.cjs.map +1 -1
  87. package/dist/components/Flex/Flex.vanilla.js +2 -1
  88. package/dist/components/Flex/Flex.vanilla.js.map +1 -1
  89. package/dist/components/Grid/Grid.vanilla.cjs +2 -1
  90. package/dist/components/Grid/Grid.vanilla.cjs.map +1 -1
  91. package/dist/components/Grid/Grid.vanilla.js +2 -1
  92. package/dist/components/Grid/Grid.vanilla.js.map +1 -1
  93. package/dist/components/IconButton/IconButton.vanilla.cjs +2 -1
  94. package/dist/components/IconButton/IconButton.vanilla.cjs.map +1 -1
  95. package/dist/components/IconButton/IconButton.vanilla.js +2 -1
  96. package/dist/components/IconButton/IconButton.vanilla.js.map +1 -1
  97. package/dist/components/Image/Image.vanilla.cjs +2 -1
  98. package/dist/components/Image/Image.vanilla.cjs.map +1 -1
  99. package/dist/components/Image/Image.vanilla.js +2 -1
  100. package/dist/components/Image/Image.vanilla.js.map +1 -1
  101. package/dist/components/Input/Input.vanilla.cjs +2 -1
  102. package/dist/components/Input/Input.vanilla.cjs.map +1 -1
  103. package/dist/components/Input/Input.vanilla.js +2 -1
  104. package/dist/components/Input/Input.vanilla.js.map +1 -1
  105. package/dist/components/Label/Label.vanilla.cjs +2 -1
  106. package/dist/components/Label/Label.vanilla.cjs.map +1 -1
  107. package/dist/components/Label/Label.vanilla.js +2 -1
  108. package/dist/components/Label/Label.vanilla.js.map +1 -1
  109. package/dist/components/List/List.cjs +1 -1
  110. package/dist/components/List/List.js +1 -1
  111. package/dist/components/Meter/Meter.vanilla.cjs +3 -2
  112. package/dist/components/Meter/Meter.vanilla.cjs.map +1 -1
  113. package/dist/components/Meter/Meter.vanilla.js +3 -2
  114. package/dist/components/Meter/Meter.vanilla.js.map +1 -1
  115. package/dist/components/NavigationTree/NavigationTreeItem.cjs +2 -2
  116. package/dist/components/NavigationTree/NavigationTreeItem.js +2 -2
  117. package/dist/components/Panel/Panel.vanilla.cjs +2 -1
  118. package/dist/components/Panel/Panel.vanilla.cjs.map +1 -1
  119. package/dist/components/Panel/Panel.vanilla.js +2 -1
  120. package/dist/components/Panel/Panel.vanilla.js.map +1 -1
  121. package/dist/components/Paragraph/Paragraph.vanilla.cjs +2 -1
  122. package/dist/components/Paragraph/Paragraph.vanilla.cjs.map +1 -1
  123. package/dist/components/Paragraph/Paragraph.vanilla.js +2 -1
  124. package/dist/components/Paragraph/Paragraph.vanilla.js.map +1 -1
  125. package/dist/components/RowLink/RowLink.cjs +18 -46
  126. package/dist/components/RowLink/RowLink.cjs.map +1 -1
  127. package/dist/components/RowLink/RowLink.constants.cjs +7 -0
  128. package/dist/components/RowLink/RowLink.constants.cjs.map +1 -0
  129. package/dist/components/RowLink/RowLink.constants.js +6 -0
  130. package/dist/components/RowLink/RowLink.constants.js.map +1 -0
  131. package/dist/components/RowLink/RowLink.js +15 -45
  132. package/dist/components/RowLink/RowLink.js.map +1 -1
  133. package/dist/components/RowLink/RowLink.utils.cjs +87 -0
  134. package/dist/components/RowLink/RowLink.utils.cjs.map +1 -0
  135. package/dist/components/RowLink/RowLink.utils.js +83 -0
  136. package/dist/components/RowLink/RowLink.utils.js.map +1 -0
  137. package/dist/components/RowLink/RowLink.vanilla.cjs +21 -0
  138. package/dist/components/RowLink/RowLink.vanilla.cjs.map +1 -0
  139. package/dist/components/RowLink/RowLink.vanilla.css.cjs +10 -0
  140. package/dist/components/RowLink/RowLink.vanilla.css.cjs.map +1 -0
  141. package/dist/components/RowLink/RowLink.vanilla.css.js +8 -0
  142. package/dist/components/RowLink/RowLink.vanilla.css.js.map +1 -0
  143. package/dist/components/RowLink/RowLink.vanilla.js +19 -0
  144. package/dist/components/RowLink/RowLink.vanilla.js.map +1 -0
  145. package/dist/components/SegmentedControl/SegmentedControl.vanilla.cjs +3 -3
  146. package/dist/components/SegmentedControl/SegmentedControl.vanilla.cjs.map +1 -1
  147. package/dist/components/SegmentedControl/SegmentedControl.vanilla.js +3 -3
  148. package/dist/components/SegmentedControl/SegmentedControl.vanilla.js.map +1 -1
  149. package/dist/components/Select/Select.cjs +1 -1
  150. package/dist/components/Select/Select.js +1 -1
  151. package/dist/components/Skeleton/Skeleton.vanilla.cjs +2 -1
  152. package/dist/components/Skeleton/Skeleton.vanilla.cjs.map +1 -1
  153. package/dist/components/Skeleton/Skeleton.vanilla.js +2 -1
  154. package/dist/components/Skeleton/Skeleton.vanilla.js.map +1 -1
  155. package/dist/components/Spinner/Spinner.vanilla.cjs +3 -2
  156. package/dist/components/Spinner/Spinner.vanilla.cjs.map +1 -1
  157. package/dist/components/Spinner/Spinner.vanilla.js +3 -2
  158. package/dist/components/Spinner/Spinner.vanilla.js.map +1 -1
  159. package/dist/components/SplitLayout/SplitLayout.vanilla.cjs +4 -3
  160. package/dist/components/SplitLayout/SplitLayout.vanilla.cjs.map +1 -1
  161. package/dist/components/SplitLayout/SplitLayout.vanilla.js +4 -3
  162. package/dist/components/SplitLayout/SplitLayout.vanilla.js.map +1 -1
  163. package/dist/components/Table/ExpandToggle.vanilla.cjs +30 -0
  164. package/dist/components/Table/ExpandToggle.vanilla.cjs.map +1 -0
  165. package/dist/components/Table/ExpandToggle.vanilla.js +27 -0
  166. package/dist/components/Table/ExpandToggle.vanilla.js.map +1 -0
  167. package/dist/components/Table/SortButton.vanilla.cjs +38 -0
  168. package/dist/components/Table/SortButton.vanilla.cjs.map +1 -0
  169. package/dist/components/Table/SortButton.vanilla.js +35 -0
  170. package/dist/components/Table/SortButton.vanilla.js.map +1 -0
  171. package/dist/components/Table/Table.cjs +11 -4
  172. package/dist/components/Table/Table.cjs.map +1 -1
  173. package/dist/components/Table/Table.js +11 -4
  174. package/dist/components/Table/Table.js.map +1 -1
  175. package/dist/components/Table/Table.vanilla.cjs +142 -0
  176. package/dist/components/Table/Table.vanilla.cjs.map +1 -0
  177. package/dist/components/Table/Table.vanilla.css.cjs +178 -0
  178. package/dist/components/Table/Table.vanilla.css.cjs.map +1 -0
  179. package/dist/components/Table/Table.vanilla.css.js +161 -0
  180. package/dist/components/Table/Table.vanilla.css.js.map +1 -0
  181. package/dist/components/Table/Table.vanilla.js +133 -0
  182. package/dist/components/Table/Table.vanilla.js.map +1 -0
  183. package/dist/components/Table/useTableSort.cjs +60 -0
  184. package/dist/components/Table/useTableSort.cjs.map +1 -0
  185. package/dist/components/Table/useTableSort.js +59 -0
  186. package/dist/components/Table/useTableSort.js.map +1 -0
  187. package/dist/components/Text/Text.vanilla.cjs +2 -1
  188. package/dist/components/Text/Text.vanilla.cjs.map +1 -1
  189. package/dist/components/Text/Text.vanilla.js +2 -1
  190. package/dist/components/Text/Text.vanilla.js.map +1 -1
  191. package/dist/components/TextField/TextField.cjs +1 -1
  192. package/dist/components/TextField/TextField.js +1 -1
  193. package/dist/components/TextField/TextField.vanilla.cjs +1 -1
  194. package/dist/components/TextField/TextField.vanilla.js +1 -1
  195. package/dist/components/Textarea/Textarea.cjs +2 -2
  196. package/dist/components/Textarea/Textarea.js +2 -2
  197. package/dist/components/Textarea/Textarea.vanilla.cjs +4 -3
  198. package/dist/components/Textarea/Textarea.vanilla.cjs.map +1 -1
  199. package/dist/components/Textarea/Textarea.vanilla.js +4 -3
  200. package/dist/components/Textarea/Textarea.vanilla.js.map +1 -1
  201. package/dist/components/Toast/Toast.vanilla.cjs +5 -5
  202. package/dist/components/Toast/Toast.vanilla.cjs.map +1 -1
  203. package/dist/components/Toast/Toast.vanilla.js +5 -5
  204. package/dist/components/Toast/Toast.vanilla.js.map +1 -1
  205. package/dist/components/Toast/ToastProvider.vanilla.cjs +1 -1
  206. package/dist/components/Toast/ToastProvider.vanilla.js +1 -1
  207. package/dist/faency.css +3001 -2303
  208. package/dist/index.cjs +50 -29
  209. package/dist/index.d.ts +570 -24
  210. package/dist/index.js +33 -30
  211. package/dist/styles/cx.cjs +5 -0
  212. package/dist/styles/cx.cjs.map +1 -0
  213. package/dist/styles/cx.js +5 -0
  214. package/dist/styles/cx.js.map +1 -0
  215. package/dist/styles/themes.css.cjs.map +1 -1
  216. package/dist/styles/themes.css.js.map +1 -1
  217. package/dist/styles/tokens.css.cjs +55 -44
  218. package/dist/styles/tokens.css.cjs.map +1 -1
  219. package/dist/styles/tokens.css.js +55 -44
  220. package/dist/styles/tokens.css.js.map +1 -1
  221. package/dist/styles/useInlineStyle.cjs +16 -0
  222. package/dist/styles/useInlineStyle.cjs.map +1 -0
  223. package/dist/styles/useInlineStyle.js +16 -0
  224. package/dist/styles/useInlineStyle.js.map +1 -0
  225. package/dist/utils/warnOnce.cjs +13 -0
  226. package/dist/utils/warnOnce.cjs.map +1 -0
  227. package/dist/utils/warnOnce.js +13 -0
  228. package/dist/utils/warnOnce.js.map +1 -0
  229. package/package.json +10 -17
@@ -0,0 +1,133 @@
1
+ import { cx } from "../../styles/cx.js";
2
+ import { useInlineStyle } from "../../styles/useInlineStyle.js";
3
+ import { handleRowClick, mapRowLink, openRowLink } from "../RowLink/RowLink.utils.js";
4
+ import { RowLinkVanilla } from "../RowLink/RowLink.vanilla.js";
5
+ import { rowLinkRow, rowLinkTable } from "../RowLink/RowLink.vanilla.css.js";
6
+ import { ExpandToggleVanilla, stopEvent } from "./ExpandToggle.vanilla.js";
7
+ import { ARIA_SORT, SortButtonVanilla } from "./SortButton.vanilla.js";
8
+ import { captionRecipe, tableRecipe, tbody, tdRecipe, tfoot, thRecipe, thead, trRecipe } from "./Table.vanilla.css.js";
9
+ import { forwardRef, useId, useState } from "react";
10
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ // components/Table/Table.vanilla.tsx
12
+ var TableVanilla = forwardRef(({ elevation, className, css, style, ...props }, ref) => /* @__PURE__ */ jsx("table", {
13
+ ref,
14
+ className: cx(tableRecipe({ elevation }), rowLinkTable, className),
15
+ style: useInlineStyle(css, style),
16
+ ...props
17
+ }));
18
+ TableVanilla.displayName = "TableVanilla";
19
+ var CaptionVanilla = forwardRef(({ size, weight, variant, gradient, transform, noWrap, className, css, style, ...props }, ref) => /* @__PURE__ */ jsx("caption", {
20
+ ref,
21
+ className: cx(captionRecipe({
22
+ size,
23
+ weight,
24
+ variant,
25
+ gradient,
26
+ transform,
27
+ noWrap
28
+ }), className),
29
+ style: useInlineStyle(css, style),
30
+ ...props
31
+ }));
32
+ CaptionVanilla.displayName = "CaptionVanilla";
33
+ var section = (Tag, sectionClass, displayName) => {
34
+ const Section = forwardRef(({ className, css, style, ...props }, ref) => /* @__PURE__ */ jsx(Tag, {
35
+ ref,
36
+ className: cx(sectionClass, className),
37
+ style: useInlineStyle(css, style),
38
+ ...props
39
+ }));
40
+ Section.displayName = displayName;
41
+ return Section;
42
+ };
43
+ var TheadVanilla = section("thead", thead, "TheadVanilla");
44
+ var TbodyVanilla = section("tbody", tbody, "TbodyVanilla");
45
+ var TfootVanilla = section("tfoot", tfoot, "TfootVanilla");
46
+ var ThVanilla = forwardRef(({ size, weight, variant, gradient, transform, noWrap, align, sort, onSort, className, css, style, children, ...props }, ref) => /* @__PURE__ */ jsx("th", {
47
+ ref,
48
+ "aria-sort": sort && ARIA_SORT[sort],
49
+ className: cx(thRecipe({
50
+ size,
51
+ weight,
52
+ variant,
53
+ gradient,
54
+ transform,
55
+ noWrap,
56
+ align
57
+ }), className),
58
+ style: useInlineStyle(css, style),
59
+ ...props,
60
+ children: onSort ? /* @__PURE__ */ jsx(SortButtonVanilla, {
61
+ sort,
62
+ onSort,
63
+ children
64
+ }) : children
65
+ }));
66
+ ThVanilla.displayName = "ThVanilla";
67
+ var TdVanilla = forwardRef(({ subtle, align, className, css, style, ...props }, ref) => /* @__PURE__ */ jsx("td", {
68
+ ref,
69
+ className: cx(tdRecipe({
70
+ subtle,
71
+ align
72
+ }), className),
73
+ style: useInlineStyle(css, style),
74
+ ...props
75
+ }));
76
+ TdVanilla.displayName = "TdVanilla";
77
+ var TrVanilla = forwardRef(({ collapsedContent: collapsedContent$1, collapsedContentColSpan = 1, expandLabel = "Expand row", emptyFirstColumn = false, tableHead = false, href, linkAs, linkCell, linkProps, linkOverlay, interactive, active, className, css, style, children, onClick, onAuxClick, ...props }, ref) => {
78
+ const [isOpen, setIsOpen] = useState(false);
79
+ const contentId = useId();
80
+ const inlineStyle = useInlineStyle(css, style);
81
+ const collapsible = !!collapsedContent$1;
82
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("tr", {
83
+ ref,
84
+ className: cx(trRecipe({
85
+ interactive: interactive ?? (href !== void 0 || void 0),
86
+ active
87
+ }), rowLinkRow, className),
88
+ "data-collapsed": collapsible && !isOpen ? "" : void 0,
89
+ style: inlineStyle,
90
+ onClick: (event) => handleRowClick(event, onClick),
91
+ onAuxClick: (event) => {
92
+ onAuxClick?.(event);
93
+ openRowLink(event);
94
+ },
95
+ ...props,
96
+ children: [
97
+ emptyFirstColumn && (tableHead ? /* @__PURE__ */ jsx("td", { className: cx(thRecipe(), "_1aa2xbm2e") }) : /* @__PURE__ */ jsx(TdVanilla, {})),
98
+ collapsible && /* @__PURE__ */ jsx(TdVanilla, {
99
+ className: "_1aa2xbm2l",
100
+ onClick: stopEvent,
101
+ children: /* @__PURE__ */ jsx(ExpandToggleVanilla, {
102
+ label: expandLabel,
103
+ isOpen,
104
+ controls: contentId,
105
+ onToggle: () => setIsOpen((open) => !open)
106
+ })
107
+ }),
108
+ mapRowLink(children, {
109
+ href,
110
+ linkAs,
111
+ linkCell,
112
+ linkProps,
113
+ linkOverlay
114
+ }, TdVanilla, RowLinkVanilla, {
115
+ row: "TrVanilla",
116
+ cell: "TdVanilla"
117
+ })
118
+ ]
119
+ }), collapsible && /* @__PURE__ */ jsx(TrVanilla, { children: /* @__PURE__ */ jsx(TdVanilla, {
120
+ id: contentId,
121
+ colSpan: collapsedContentColSpan,
122
+ className: "_1aa2xbm2p",
123
+ "data-closed": isOpen ? void 0 : "",
124
+ children: /* @__PURE__ */ jsx("div", {
125
+ className: "_1aa2xbm2q",
126
+ children: collapsedContent$1
127
+ })
128
+ }) })] });
129
+ });
130
+ TrVanilla.displayName = "TrVanilla";
131
+ export { CaptionVanilla, TableVanilla, TbodyVanilla, TdVanilla, TfootVanilla, ThVanilla, TheadVanilla, TrVanilla };
132
+
133
+ //# sourceMappingURL=Table.vanilla.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Table.vanilla.js","names":["collapsedContent","_Fragment"],"sources":["../../../components/Table/Table.vanilla.tsx"],"sourcesContent":["import { RecipeVariants } from '@vanilla-extract/recipes';\nimport React, { forwardRef, ReactNode, useId, useState } from 'react';\n\nimport { CSSProps } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useInlineStyle } from '../../styles/useInlineStyle';\nimport {\n handleRowClick,\n mapRowLink,\n openRowLink,\n RowLinkShortcutProps,\n} from '../RowLink/RowLink.utils';\nimport { RowLinkVanilla } from '../RowLink/RowLink.vanilla';\nimport { rowLinkRow, rowLinkTable } from '../RowLink/RowLink.vanilla.css';\nimport { ExpandToggleVanilla, stopEvent } from './ExpandToggle.vanilla';\nimport { ARIA_SORT, SortButtonVanilla } from './SortButton.vanilla';\nimport {\n captionRecipe,\n collapsedCell,\n collapsedContent as collapsedContentClass,\n emptyHeaderCell,\n tableRecipe,\n tbody,\n tdRecipe,\n tfoot,\n thead,\n thRecipe,\n toggleCell,\n trRecipe,\n} from './Table.vanilla.css';\nimport { TableSortProps } from './useTableSort';\n\ntype TableRecipeVariants = NonNullable<RecipeVariants<typeof tableRecipe>>;\ntype CaptionRecipeVariants = NonNullable<RecipeVariants<typeof captionRecipe>>;\ntype TrRecipeVariants = NonNullable<RecipeVariants<typeof trRecipe>>;\ntype ThRecipeVariants = NonNullable<RecipeVariants<typeof thRecipe>>;\ntype TdRecipeVariants = NonNullable<RecipeVariants<typeof tdRecipe>>;\n\nexport type TableVanillaProps = React.TableHTMLAttributes<HTMLTableElement> &\n CSSProps &\n TableRecipeVariants;\n\nexport const TableVanilla = forwardRef<HTMLTableElement, TableVanillaProps>(\n ({ elevation, className, css, style, ...props }, ref) => (\n <table\n ref={ref}\n className={cx(tableRecipe({ elevation }), rowLinkTable, className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nTableVanilla.displayName = 'TableVanilla';\n\nexport type CaptionVanillaProps = React.HTMLAttributes<HTMLTableCaptionElement> &\n CSSProps &\n CaptionRecipeVariants;\n\nexport const CaptionVanilla = forwardRef<HTMLTableCaptionElement, CaptionVanillaProps>(\n (\n { size, weight, variant, gradient, transform, noWrap, className, css, style, ...props },\n ref,\n ) => (\n <caption\n ref={ref}\n className={cx(\n captionRecipe({ size, weight, variant, gradient, transform, noWrap }),\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nCaptionVanilla.displayName = 'CaptionVanilla';\n\nexport type TableSectionVanillaProps = React.HTMLAttributes<HTMLTableSectionElement> & CSSProps;\n\nconst section = (Tag: 'thead' | 'tbody' | 'tfoot', sectionClass: string, displayName: string) => {\n const Section = forwardRef<HTMLTableSectionElement, TableSectionVanillaProps>(\n ({ className, css, style, ...props }, ref) => (\n <Tag\n ref={ref}\n className={cx(sectionClass, className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n );\n Section.displayName = displayName;\n return Section;\n};\n\nexport const TheadVanilla = section('thead', thead, 'TheadVanilla');\nexport const TbodyVanilla = section('tbody', tbody, 'TbodyVanilla');\nexport const TfootVanilla = section('tfoot', tfoot, 'TfootVanilla');\n\nexport type ThVanillaProps = Omit<React.ThHTMLAttributes<HTMLTableCellElement>, 'align'> &\n CSSProps &\n ThRecipeVariants &\n TableSortProps;\n\nexport const ThVanilla = forwardRef<HTMLTableCellElement, ThVanillaProps>(\n (\n {\n size,\n weight,\n variant,\n gradient,\n transform,\n noWrap,\n align,\n sort,\n onSort,\n className,\n css,\n style,\n children,\n ...props\n },\n ref,\n ) => (\n <th\n ref={ref}\n aria-sort={sort && ARIA_SORT[sort]}\n className={cx(\n thRecipe({ size, weight, variant, gradient, transform, noWrap, align }),\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n >\n {onSort ? (\n <SortButtonVanilla sort={sort} onSort={onSort}>\n {children}\n </SortButtonVanilla>\n ) : (\n children\n )}\n </th>\n ),\n);\n\nThVanilla.displayName = 'ThVanilla';\n\nexport type TdVanillaProps = Omit<React.TdHTMLAttributes<HTMLTableCellElement>, 'align'> &\n CSSProps &\n TdRecipeVariants;\n\nexport const TdVanilla = forwardRef<HTMLTableCellElement, TdVanillaProps>(\n ({ subtle, align, className, css, style, ...props }, ref) => (\n <td\n ref={ref}\n className={cx(tdRecipe({ subtle, align }), className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nTdVanilla.displayName = 'TdVanilla';\n\nexport type TrVanillaProps = React.HTMLAttributes<HTMLTableRowElement> &\n CSSProps &\n TrRecipeVariants &\n RowLinkShortcutProps & {\n /** Content shown in a full-width row below, toggled by a button in a new first cell. */\n collapsedContent?: ReactNode;\n /** Column span of the collapsed content row; set it to the number of columns. */\n collapsedContentColSpan?: number;\n /** Accessible name of the expand button. */\n expandLabel?: string;\n /** Adds an empty first cell, to line up with rows that have an expand button. */\n emptyFirstColumn?: boolean;\n /** Styles the empty first cell as a header, for a row in `TheadVanilla`. */\n tableHead?: boolean;\n };\n\nexport const TrVanilla = forwardRef<HTMLTableRowElement, TrVanillaProps>(\n (\n {\n collapsedContent,\n collapsedContentColSpan = 1,\n expandLabel = 'Expand row',\n emptyFirstColumn = false,\n tableHead = false,\n href,\n linkAs,\n linkCell,\n linkProps,\n linkOverlay,\n interactive,\n active,\n className,\n css,\n style,\n children,\n onClick,\n onAuxClick,\n ...props\n },\n ref,\n ) => {\n const [isOpen, setIsOpen] = useState(false);\n const contentId = useId();\n const inlineStyle = useInlineStyle(css, style);\n const collapsible = !!collapsedContent;\n\n return (\n <>\n <tr\n ref={ref}\n className={cx(\n trRecipe({ interactive: interactive ?? (href !== undefined || undefined), active }),\n rowLinkRow,\n className,\n )}\n data-collapsed={collapsible && !isOpen ? '' : undefined}\n style={inlineStyle}\n onClick={(event) => handleRowClick(event, onClick)}\n onAuxClick={(event) => {\n onAuxClick?.(event);\n openRowLink(event);\n }}\n {...props}\n >\n {emptyFirstColumn &&\n (tableHead ? <td className={cx(thRecipe(), emptyHeaderCell)} /> : <TdVanilla />)}\n {collapsible && (\n <TdVanilla className={toggleCell} onClick={stopEvent}>\n <ExpandToggleVanilla\n label={expandLabel}\n isOpen={isOpen}\n controls={contentId}\n onToggle={() => setIsOpen((open) => !open)}\n />\n </TdVanilla>\n )}\n {mapRowLink(\n children,\n { href, linkAs, linkCell, linkProps, linkOverlay },\n TdVanilla,\n RowLinkVanilla,\n { row: 'TrVanilla', cell: 'TdVanilla' },\n )}\n </tr>\n {collapsible && (\n <TrVanilla>\n <TdVanilla\n id={contentId}\n colSpan={collapsedContentColSpan}\n className={collapsedCell}\n data-closed={isOpen ? undefined : ''}\n >\n <div className={collapsedContentClass}>{collapsedContent}</div>\n </TdVanilla>\n </TrVanilla>\n )}\n </>\n );\n },\n);\n\nTrVanilla.displayName = 'TrVanilla';\n"],"mappings":";;;;;;;;;;;AA0CA,IAAa,eAAe,YACzB,EAAE,WAAW,WAAW,KAAK,OAAO,GAAG,SAAS,QAC/C,oBAAC,SAAD;CACO;CACL,WAAW,GAAG,YAAY,EAAE,UAAU,CAAC,GAAG,cAAc,SAAS;CACjE,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;AACL,CAAA,CAEL;AAEA,aAAa,cAAc;AAM3B,IAAa,iBAAiB,YAE1B,EAAE,MAAM,QAAQ,SAAS,UAAU,WAAW,QAAQ,WAAW,KAAK,OAAO,GAAG,SAChF,QAEA,oBAAC,WAAD;CACO;CACL,WAAW,GACT,cAAc;EAAE;EAAM;EAAQ;EAAS;EAAU;EAAW;CAAO,CAAC,GACpE,SACF;CACA,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;AACL,CAAA,CAEL;AAEA,eAAe,cAAc;AAI7B,IAAM,WAAW,KAAkC,cAAsB,gBAAwB;CAC/F,MAAM,UAAU,YACb,EAAE,WAAW,KAAK,OAAO,GAAG,SAAS,QACpC,oBAAC,KAAD;EACO;EACL,WAAW,GAAG,cAAc,SAAS;EACrC,OAAO,eAAe,KAAK,KAAK;EAChC,GAAI;CACL,CAAA,CAEL;CACA,QAAQ,cAAc;CACtB,OAAO;AACT;AAEA,IAAa,eAAe,QAAQ,SAAS,OAAO,cAAc;AAClE,IAAa,eAAe,QAAQ,SAAS,OAAO,cAAc;AAClE,IAAa,eAAe,QAAQ,SAAS,OAAO,cAAc;AAOlE,IAAa,YAAY,YAErB,EACE,MACA,QACA,SACA,UACA,WACA,QACA,OACA,MACA,QACA,WACA,KACA,OACA,UACA,GAAG,SAEL,QAEA,oBAAC,MAAD;CACO;CACL,aAAW,QAAQ,UAAU;CAC7B,WAAW,GACT,SAAS;EAAE;EAAM;EAAQ;EAAS;EAAU;EAAW;EAAQ;CAAM,CAAC,GACtE,SACF;CACA,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;CAEH,UAAA,SACC,oBAAC,mBAAD;EAAyB;EAAc;EACpC;CACgB,CAAA,IAEnB;AAEA,CAAA,CAER;AAEA,UAAU,cAAc;AAMxB,IAAa,YAAY,YACtB,EAAE,QAAQ,OAAO,WAAW,KAAK,OAAO,GAAG,SAAS,QACnD,oBAAC,MAAD;CACO;CACL,WAAW,GAAG,SAAS;EAAE;EAAQ;CAAM,CAAC,GAAG,SAAS;CACpD,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;AACL,CAAA,CAEL;AAEA,UAAU,cAAc;AAkBxB,IAAa,YAAY,YAErB,EACE,kBAAA,oBACA,0BAA0B,GAC1B,cAAc,cACd,mBAAmB,OACnB,YAAY,OACZ,MACA,QACA,UACA,WACA,aACA,aACA,QACA,WACA,KACA,OACA,UACA,SACA,YACA,GAAG,SAEL,QACG;CACH,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAC1C,MAAM,YAAY,MAAM;CACxB,MAAM,cAAc,eAAe,KAAK,KAAK;CAC7C,MAAM,cAAc,CAAC,CAACA;CAEtB,OACE,qBAAAC,UAAA,EAAA,UAAA,CACE,qBAAC,MAAD;EACO;EACL,WAAW,GACT,SAAS;GAAE,aAAa,gBAAgB,SAAS,KAAA,KAAa,KAAA;GAAY;EAAO,CAAC,GAClF,YACA,SACF;EACA,kBAAgB,eAAe,CAAC,SAAS,KAAK,KAAA;EAC9C,OAAO;EACP,UAAU,UAAU,eAAe,OAAO,OAAO;EACjD,aAAa,UAAU;GACrB,aAAa,KAAK;GAClB,YAAY,KAAK;EACnB;EACA,GAAI;EAdN,UAAA;GAgBG,qBACE,YAAY,oBAAC,MAAD,EAAI,WAAW,GAAG,SAAS,GAAA,YAAkB,EAAI,CAAA,IAAI,oBAAC,WAAD,CAAY,CAAA;GAC/E,eACC,oBAAC,WAAD;IAAW,WAAA;IAAuB,SAAS;IACzC,UAAA,oBAAC,qBAAD;KACE,OAAO;KACC;KACR,UAAU;KACV,gBAAgB,WAAW,SAAS,CAAC,IAAI;IAC1C,CAAA;GACQ,CAAA;GAEZ,WACC,UACA;IAAE;IAAM;IAAQ;IAAU;IAAW;GAAY,GACjD,WACA,gBACA;IAAE,KAAK;IAAa,MAAM;GAAY,CACxC;EACE;CACH,CAAA,GAAA,eACC,oBAAC,WAAD,EAAA,UACE,oBAAC,WAAD;EACE,IAAI;EACJ,SAAS;EACT,WAAA;EACA,eAAa,SAAS,KAAA,IAAY;EAElC,UAAA,oBAAC,OAAD;GAAK,WAAA;GAAmC,UAAAD;EAAsB,CAAA;CACrD,CAAA,EACF,CAAA,CAEb,EAAA,CAAA;AAEN,CACF;AAEA,UAAU,cAAc"}
@@ -0,0 +1,60 @@
1
+ let react = require("react");
2
+ // components/Table/useTableSort.ts
3
+ /**
4
+ * Keeps the sorted column and direction, and gives each header its `sort` and `onSort`.
5
+ * It does not sort: pass `key` and `direction` to `sortRows`, or to the API.
6
+ */
7
+ var useTableSort = ({ initialKey, initialDirection, newColumnDirection = "asc" }) => {
8
+ const [state, setState] = (0, react.useState)({
9
+ key: initialKey,
10
+ direction: initialDirection ?? newColumnDirection
11
+ });
12
+ const { key, direction } = state;
13
+ const toggle = (column) => setState((state) => state.key === column ? {
14
+ key: column,
15
+ direction: state.direction === "asc" ? "desc" : "asc"
16
+ } : {
17
+ key: column,
18
+ direction: newColumnDirection
19
+ });
20
+ const sortProps = (column) => ({
21
+ sort: column === key ? direction : void 0,
22
+ onSort: () => toggle(column)
23
+ });
24
+ return {
25
+ key,
26
+ direction,
27
+ sortProps
28
+ };
29
+ };
30
+ var isEmpty = (value) => value === null || value === void 0 || value === "" || Number.isNaN(value);
31
+ var collator = new Intl.Collator(void 0, {
32
+ numeric: true,
33
+ sensitivity: "base"
34
+ });
35
+ var compareValues = (a, b) => {
36
+ if (typeof a === "number" && typeof b === "number") return a - b;
37
+ if (typeof a === "number") return -1;
38
+ if (typeof b === "number") return 1;
39
+ return collator.compare(String(a), String(b));
40
+ };
41
+ /**
42
+ * Returns a sorted copy of `rows`: numbers by value, then strings in locale order,
43
+ * ignoring case and comparing digit runs as numbers ("item2" before "item10").
44
+ * Empty values (`null`, `undefined`, `''`, `NaN`) go last in both directions. Ties keep their order.
45
+ */
46
+ var sortRows = (rows, getValue, key, direction) => {
47
+ const factor = direction === "asc" ? 1 : -1;
48
+ return [...rows].sort((rowA, rowB) => {
49
+ const a = getValue(rowA, key);
50
+ const b = getValue(rowB, key);
51
+ const emptyA = isEmpty(a);
52
+ const emptyB = isEmpty(b);
53
+ if (emptyA || emptyB) return Number(emptyA) - Number(emptyB);
54
+ return factor * compareValues(a, b);
55
+ });
56
+ };
57
+ exports.sortRows = sortRows;
58
+ exports.useTableSort = useTableSort;
59
+
60
+ //# sourceMappingURL=useTableSort.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableSort.cjs","names":["useState"],"sources":["../../../components/Table/useTableSort.ts"],"sourcesContent":["import { useState } from 'react';\n\nexport type TableSortDirection = 'asc' | 'desc';\n\nexport type TableSortProps = {\n /** The direction the column is sorted in, or `undefined` when it is not sorted. */\n sort?: TableSortDirection;\n /** Makes the column sortable: called when its header is clicked. */\n onSort?: () => void;\n};\n\nexport type UseTableSortOptions<K extends string> = {\n /** The column sorted on the first render. Later changes are ignored. */\n initialKey: K;\n /** The direction on the first render, `newColumnDirection` by default. Later changes are ignored. */\n initialDirection?: TableSortDirection;\n /** The direction a column is sorted in when it is clicked while another one is sorted. */\n newColumnDirection?: TableSortDirection;\n};\n\n/**\n * Keeps the sorted column and direction, and gives each header its `sort` and `onSort`.\n * It does not sort: pass `key` and `direction` to `sortRows`, or to the API.\n */\nexport const useTableSort = <K extends string>({\n initialKey,\n initialDirection,\n newColumnDirection = 'asc',\n}: UseTableSortOptions<K>) => {\n const [state, setState] = useState({\n key: initialKey,\n direction: initialDirection ?? newColumnDirection,\n });\n const { key, direction } = state;\n\n const toggle = (column: K) =>\n setState((state) =>\n state.key === column\n ? { key: column, direction: state.direction === 'asc' ? 'desc' : 'asc' }\n : { key: column, direction: newColumnDirection },\n );\n\n const sortProps = (column: K): TableSortProps => ({\n sort: column === key ? direction : undefined,\n onSort: () => toggle(column),\n });\n\n return { key, direction, sortProps };\n};\n\nexport type TableSortValue = string | number | null | undefined;\n\nconst isEmpty = (value: TableSortValue) =>\n value === null || value === undefined || value === '' || Number.isNaN(value);\n\nconst collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });\n\nconst compareValues = (a: TableSortValue, b: TableSortValue) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a - b;\n }\n if (typeof a === 'number') {\n return -1;\n }\n if (typeof b === 'number') {\n return 1;\n }\n return collator.compare(String(a), String(b));\n};\n\n/**\n * Returns a sorted copy of `rows`: numbers by value, then strings in locale order,\n * ignoring case and comparing digit runs as numbers (\"item2\" before \"item10\").\n * Empty values (`null`, `undefined`, `''`, `NaN`) go last in both directions. Ties keep their order.\n */\nexport const sortRows = <T, K extends string>(\n rows: readonly T[],\n getValue: (row: T, key: K) => TableSortValue,\n key: K,\n direction: TableSortDirection,\n): T[] => {\n const factor = direction === 'asc' ? 1 : -1;\n return [...rows].sort((rowA, rowB) => {\n const a = getValue(rowA, key);\n const b = getValue(rowB, key);\n const emptyA = isEmpty(a);\n const emptyB = isEmpty(b);\n if (emptyA || emptyB) {\n return Number(emptyA) - Number(emptyB);\n }\n return factor * compareValues(a, b);\n });\n};\n"],"mappings":";;;;;;AAwBA,IAAa,gBAAkC,EAC7C,YACA,kBACA,qBAAqB,YACO;CAC5B,MAAM,CAAC,OAAO,aAAA,GAAYA,MAAAA,SAAAA,CAAS;EACjC,KAAK;EACL,WAAW,oBAAoB;CACjC,CAAC;CACD,MAAM,EAAE,KAAK,cAAc;CAE3B,MAAM,UAAU,WACd,UAAU,UACR,MAAM,QAAQ,SACV;EAAE,KAAK;EAAQ,WAAW,MAAM,cAAc,QAAQ,SAAS;CAAM,IACrE;EAAE,KAAK;EAAQ,WAAW;CAAmB,CACnD;CAEF,MAAM,aAAa,YAA+B;EAChD,MAAM,WAAW,MAAM,YAAY,KAAA;EACnC,cAAc,OAAO,MAAM;CAC7B;CAEA,OAAO;EAAE;EAAK;EAAW;CAAU;AACrC;AAIA,IAAM,WAAW,UACf,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU,MAAM,OAAO,MAAM,KAAK;AAE7E,IAAM,WAAW,IAAI,KAAK,SAAS,KAAA,GAAW;CAAE,SAAS;CAAM,aAAa;AAAO,CAAC;AAEpF,IAAM,iBAAiB,GAAmB,MAAsB;CAC9D,IAAI,OAAO,MAAM,YAAY,OAAO,MAAM,UACxC,OAAO,IAAI;CAEb,IAAI,OAAO,MAAM,UACf,OAAO;CAET,IAAI,OAAO,MAAM,UACf,OAAO;CAET,OAAO,SAAS,QAAQ,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AAC9C;;;;;;AAOA,IAAa,YACX,MACA,UACA,KACA,cACQ;CACR,MAAM,SAAS,cAAc,QAAQ,IAAI;CACzC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,MAAM,MAAM,SAAS;EACpC,MAAM,IAAI,SAAS,MAAM,GAAG;EAC5B,MAAM,IAAI,SAAS,MAAM,GAAG;EAC5B,MAAM,SAAS,QAAQ,CAAC;EACxB,MAAM,SAAS,QAAQ,CAAC;EACxB,IAAI,UAAU,QACZ,OAAO,OAAO,MAAM,IAAI,OAAO,MAAM;EAEvC,OAAO,SAAS,cAAc,GAAG,CAAC;CACpC,CAAC;AACH"}
@@ -0,0 +1,59 @@
1
+ import { useState } from "react";
2
+ // components/Table/useTableSort.ts
3
+ /**
4
+ * Keeps the sorted column and direction, and gives each header its `sort` and `onSort`.
5
+ * It does not sort: pass `key` and `direction` to `sortRows`, or to the API.
6
+ */
7
+ var useTableSort = ({ initialKey, initialDirection, newColumnDirection = "asc" }) => {
8
+ const [state, setState] = useState({
9
+ key: initialKey,
10
+ direction: initialDirection ?? newColumnDirection
11
+ });
12
+ const { key, direction } = state;
13
+ const toggle = (column) => setState((state) => state.key === column ? {
14
+ key: column,
15
+ direction: state.direction === "asc" ? "desc" : "asc"
16
+ } : {
17
+ key: column,
18
+ direction: newColumnDirection
19
+ });
20
+ const sortProps = (column) => ({
21
+ sort: column === key ? direction : void 0,
22
+ onSort: () => toggle(column)
23
+ });
24
+ return {
25
+ key,
26
+ direction,
27
+ sortProps
28
+ };
29
+ };
30
+ var isEmpty = (value) => value === null || value === void 0 || value === "" || Number.isNaN(value);
31
+ var collator = new Intl.Collator(void 0, {
32
+ numeric: true,
33
+ sensitivity: "base"
34
+ });
35
+ var compareValues = (a, b) => {
36
+ if (typeof a === "number" && typeof b === "number") return a - b;
37
+ if (typeof a === "number") return -1;
38
+ if (typeof b === "number") return 1;
39
+ return collator.compare(String(a), String(b));
40
+ };
41
+ /**
42
+ * Returns a sorted copy of `rows`: numbers by value, then strings in locale order,
43
+ * ignoring case and comparing digit runs as numbers ("item2" before "item10").
44
+ * Empty values (`null`, `undefined`, `''`, `NaN`) go last in both directions. Ties keep their order.
45
+ */
46
+ var sortRows = (rows, getValue, key, direction) => {
47
+ const factor = direction === "asc" ? 1 : -1;
48
+ return [...rows].sort((rowA, rowB) => {
49
+ const a = getValue(rowA, key);
50
+ const b = getValue(rowB, key);
51
+ const emptyA = isEmpty(a);
52
+ const emptyB = isEmpty(b);
53
+ if (emptyA || emptyB) return Number(emptyA) - Number(emptyB);
54
+ return factor * compareValues(a, b);
55
+ });
56
+ };
57
+ export { sortRows, useTableSort };
58
+
59
+ //# sourceMappingURL=useTableSort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableSort.js","names":[],"sources":["../../../components/Table/useTableSort.ts"],"sourcesContent":["import { useState } from 'react';\n\nexport type TableSortDirection = 'asc' | 'desc';\n\nexport type TableSortProps = {\n /** The direction the column is sorted in, or `undefined` when it is not sorted. */\n sort?: TableSortDirection;\n /** Makes the column sortable: called when its header is clicked. */\n onSort?: () => void;\n};\n\nexport type UseTableSortOptions<K extends string> = {\n /** The column sorted on the first render. Later changes are ignored. */\n initialKey: K;\n /** The direction on the first render, `newColumnDirection` by default. Later changes are ignored. */\n initialDirection?: TableSortDirection;\n /** The direction a column is sorted in when it is clicked while another one is sorted. */\n newColumnDirection?: TableSortDirection;\n};\n\n/**\n * Keeps the sorted column and direction, and gives each header its `sort` and `onSort`.\n * It does not sort: pass `key` and `direction` to `sortRows`, or to the API.\n */\nexport const useTableSort = <K extends string>({\n initialKey,\n initialDirection,\n newColumnDirection = 'asc',\n}: UseTableSortOptions<K>) => {\n const [state, setState] = useState({\n key: initialKey,\n direction: initialDirection ?? newColumnDirection,\n });\n const { key, direction } = state;\n\n const toggle = (column: K) =>\n setState((state) =>\n state.key === column\n ? { key: column, direction: state.direction === 'asc' ? 'desc' : 'asc' }\n : { key: column, direction: newColumnDirection },\n );\n\n const sortProps = (column: K): TableSortProps => ({\n sort: column === key ? direction : undefined,\n onSort: () => toggle(column),\n });\n\n return { key, direction, sortProps };\n};\n\nexport type TableSortValue = string | number | null | undefined;\n\nconst isEmpty = (value: TableSortValue) =>\n value === null || value === undefined || value === '' || Number.isNaN(value);\n\nconst collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });\n\nconst compareValues = (a: TableSortValue, b: TableSortValue) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a - b;\n }\n if (typeof a === 'number') {\n return -1;\n }\n if (typeof b === 'number') {\n return 1;\n }\n return collator.compare(String(a), String(b));\n};\n\n/**\n * Returns a sorted copy of `rows`: numbers by value, then strings in locale order,\n * ignoring case and comparing digit runs as numbers (\"item2\" before \"item10\").\n * Empty values (`null`, `undefined`, `''`, `NaN`) go last in both directions. Ties keep their order.\n */\nexport const sortRows = <T, K extends string>(\n rows: readonly T[],\n getValue: (row: T, key: K) => TableSortValue,\n key: K,\n direction: TableSortDirection,\n): T[] => {\n const factor = direction === 'asc' ? 1 : -1;\n return [...rows].sort((rowA, rowB) => {\n const a = getValue(rowA, key);\n const b = getValue(rowB, key);\n const emptyA = isEmpty(a);\n const emptyB = isEmpty(b);\n if (emptyA || emptyB) {\n return Number(emptyA) - Number(emptyB);\n }\n return factor * compareValues(a, b);\n });\n};\n"],"mappings":";;;;;;AAwBA,IAAa,gBAAkC,EAC7C,YACA,kBACA,qBAAqB,YACO;CAC5B,MAAM,CAAC,OAAO,YAAY,SAAS;EACjC,KAAK;EACL,WAAW,oBAAoB;CACjC,CAAC;CACD,MAAM,EAAE,KAAK,cAAc;CAE3B,MAAM,UAAU,WACd,UAAU,UACR,MAAM,QAAQ,SACV;EAAE,KAAK;EAAQ,WAAW,MAAM,cAAc,QAAQ,SAAS;CAAM,IACrE;EAAE,KAAK;EAAQ,WAAW;CAAmB,CACnD;CAEF,MAAM,aAAa,YAA+B;EAChD,MAAM,WAAW,MAAM,YAAY,KAAA;EACnC,cAAc,OAAO,MAAM;CAC7B;CAEA,OAAO;EAAE;EAAK;EAAW;CAAU;AACrC;AAIA,IAAM,WAAW,UACf,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU,MAAM,OAAO,MAAM,KAAK;AAE7E,IAAM,WAAW,IAAI,KAAK,SAAS,KAAA,GAAW;CAAE,SAAS;CAAM,aAAa;AAAO,CAAC;AAEpF,IAAM,iBAAiB,GAAmB,MAAsB;CAC9D,IAAI,OAAO,MAAM,YAAY,OAAO,MAAM,UACxC,OAAO,IAAI;CAEb,IAAI,OAAO,MAAM,UACf,OAAO;CAET,IAAI,OAAO,MAAM,UACf,OAAO;CAET,OAAO,SAAS,QAAQ,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AAC9C;;;;;;AAOA,IAAa,YACX,MACA,UACA,KACA,cACQ;CACR,MAAM,SAAS,cAAc,QAAQ,IAAI;CACzC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,MAAM,MAAM,SAAS;EACpC,MAAM,IAAI,SAAS,MAAM,GAAG;EAC5B,MAAM,IAAI,SAAS,MAAM,GAAG;EAC5B,MAAM,SAAS,QAAQ,CAAC;EACxB,MAAM,SAAS,QAAQ,CAAC;EACxB,IAAI,UAAU,QACZ,OAAO,OAAO,MAAM,IAAI,OAAO,MAAM;EAEvC,OAAO,SAAS,cAAc,GAAG,CAAC;CACpC,CAAC;AACH"}
@@ -1,4 +1,5 @@
1
1
  const require_cssProps = require("../../styles/cssProps.cjs");
2
+ const require_cx = require("../../styles/cx.cjs");
2
3
  const require_themeContext = require("../../styles/themeContext.cjs");
3
4
  const require_Text_vanilla_css = require("./Text.vanilla.css.cjs");
4
5
  let react = require("react");
@@ -24,7 +25,7 @@ var TextVanillaComponentImpl = (0, react.forwardRef)(({ as, className, css, styl
24
25
  });
25
26
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
26
27
  ref,
27
- className: `${recipeClass} ${className || ""}`.trim(),
28
+ className: require_cx.cx(recipeClass, className),
28
29
  style: mergedStyles,
29
30
  ...props
30
31
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Text.vanilla.cjs","names":["forwardRef","useVanillaExtractTheme","processCSSProp","assignInlineVars","textRecipe"],"sources":["../../../components/Text/Text.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport { ElementType, forwardRef } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport {\n PolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n} from '../../styles/polymorphic';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { textRecipe } from './Text.vanilla.css';\n\ntype TextRecipeVariants = RecipeVariants<typeof textRecipe>;\n\ninterface TextOwnProps extends Omit<TextRecipeVariants, never>, CSSProps {}\n\nexport type TextVanillaProps<C extends ElementType = 'span'> = PolymorphicComponentProps<\n C,\n TextOwnProps\n>;\n\ntype TextComponent = PolymorphicComponent<'span', TextVanillaProps<ElementType>>;\n\nconst TextVanillaComponentImpl = forwardRef(\n <C extends ElementType = 'span'>(\n {\n as,\n className,\n css,\n style,\n size,\n weight,\n variant,\n gradient,\n transform,\n noWrap,\n ...props\n }: TextVanillaProps<C>,\n ref?: PolymorphicRef<C>,\n ) => {\n const Component = as || 'span';\n\n const { colors } = useVanillaExtractTheme();\n\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const mergedStyles = {\n ...cssStyles,\n ...style,\n ...assignInlineVars(vars),\n };\n\n const recipeClass = textRecipe({ size, weight, variant, gradient, transform, noWrap });\n\n return (\n <Component\n ref={ref}\n className={`${recipeClass} ${className || ''}`.trim()}\n style={mergedStyles}\n {...props}\n />\n );\n },\n);\n\nTextVanillaComponentImpl.displayName = 'TextVanilla';\n\nexport const TextVanilla = TextVanillaComponentImpl as TextComponent;\n"],"mappings":";;;;;;;AAwBA,IAAM,4BAAA,GAA2BA,MAAAA,WAAAA,EAE7B,EACE,IACA,WACA,KACA,OACA,MACA,QACA,SACA,UACA,WACA,QACA,GAAG,SAEL,QACG;CACH,MAAM,YAAY,MAAM;CAExB,MAAM,EAAE,WAAWC,qBAAAA,uBAAuB;CAE1C,MAAM,EAAE,OAAO,WAAW,SAASC,iBAAAA,eAAe,KAAK,MAAM;CAE7D,MAAM,eAAe;EACnB,GAAG;EACH,GAAG;EACH,IAAA,GAAGC,yBAAAA,iBAAAA,CAAiB,IAAI;CAC1B;CAEA,MAAM,cAAcC,yBAAAA,WAAW;EAAE;EAAM;EAAQ;EAAS;EAAU;EAAW;CAAO,CAAC;CAErF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EACO;EACL,WAAW,GAAG,YAAY,GAAG,aAAa,KAAK,KAAK;EACpD,OAAO;EACP,GAAI;CACL,CAAA;AAEL,CACF;AAEA,yBAAyB,cAAc;AAEvC,IAAa,cAAc"}
1
+ {"version":3,"file":"Text.vanilla.cjs","names":["forwardRef","useVanillaExtractTheme","processCSSProp","assignInlineVars","textRecipe","cx"],"sources":["../../../components/Text/Text.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport { ElementType, forwardRef } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport {\n PolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n} from '../../styles/polymorphic';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { textRecipe } from './Text.vanilla.css';\n\ntype TextRecipeVariants = RecipeVariants<typeof textRecipe>;\n\ninterface TextOwnProps extends Omit<TextRecipeVariants, never>, CSSProps {}\n\nexport type TextVanillaProps<C extends ElementType = 'span'> = PolymorphicComponentProps<\n C,\n TextOwnProps\n>;\n\ntype TextComponent = PolymorphicComponent<'span', TextVanillaProps<ElementType>>;\n\nconst TextVanillaComponentImpl = forwardRef(\n <C extends ElementType = 'span'>(\n {\n as,\n className,\n css,\n style,\n size,\n weight,\n variant,\n gradient,\n transform,\n noWrap,\n ...props\n }: TextVanillaProps<C>,\n ref?: PolymorphicRef<C>,\n ) => {\n const Component = as || 'span';\n\n const { colors } = useVanillaExtractTheme();\n\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const mergedStyles = {\n ...cssStyles,\n ...style,\n ...assignInlineVars(vars),\n };\n\n const recipeClass = textRecipe({ size, weight, variant, gradient, transform, noWrap });\n\n return (\n <Component ref={ref} className={cx(recipeClass, className)} style={mergedStyles} {...props} />\n );\n },\n);\n\nTextVanillaComponentImpl.displayName = 'TextVanilla';\n\nexport const TextVanilla = TextVanillaComponentImpl as TextComponent;\n"],"mappings":";;;;;;;;AAyBA,IAAM,4BAAA,GAA2BA,MAAAA,WAAAA,EAE7B,EACE,IACA,WACA,KACA,OACA,MACA,QACA,SACA,UACA,WACA,QACA,GAAG,SAEL,QACG;CACH,MAAM,YAAY,MAAM;CAExB,MAAM,EAAE,WAAWC,qBAAAA,uBAAuB;CAE1C,MAAM,EAAE,OAAO,WAAW,SAASC,iBAAAA,eAAe,KAAK,MAAM;CAE7D,MAAM,eAAe;EACnB,GAAG;EACH,GAAG;EACH,IAAA,GAAGC,yBAAAA,iBAAAA,CAAiB,IAAI;CAC1B;CAEA,MAAM,cAAcC,yBAAAA,WAAW;EAAE;EAAM;EAAQ;EAAS;EAAU;EAAW;CAAO,CAAC;CAErF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EAAgB;EAAK,WAAWC,WAAAA,GAAG,aAAa,SAAS;EAAG,OAAO;EAAc,GAAI;CAAQ,CAAA;AAEjG,CACF;AAEA,yBAAyB,cAAc;AAEvC,IAAa,cAAc"}
@@ -1,4 +1,5 @@
1
1
  import { processCSSProp } from "../../styles/cssProps.js";
2
+ import { cx } from "../../styles/cx.js";
2
3
  import { useVanillaExtractTheme } from "../../styles/themeContext.js";
3
4
  import { textRecipe } from "./Text.vanilla.css.js";
4
5
  import { forwardRef } from "react";
@@ -24,7 +25,7 @@ var TextVanillaComponentImpl = forwardRef(({ as, className, css, style, size, we
24
25
  });
25
26
  return /* @__PURE__ */ jsx(Component, {
26
27
  ref,
27
- className: `${recipeClass} ${className || ""}`.trim(),
28
+ className: cx(recipeClass, className),
28
29
  style: mergedStyles,
29
30
  ...props
30
31
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Text.vanilla.js","names":[],"sources":["../../../components/Text/Text.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport { ElementType, forwardRef } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport {\n PolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n} from '../../styles/polymorphic';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { textRecipe } from './Text.vanilla.css';\n\ntype TextRecipeVariants = RecipeVariants<typeof textRecipe>;\n\ninterface TextOwnProps extends Omit<TextRecipeVariants, never>, CSSProps {}\n\nexport type TextVanillaProps<C extends ElementType = 'span'> = PolymorphicComponentProps<\n C,\n TextOwnProps\n>;\n\ntype TextComponent = PolymorphicComponent<'span', TextVanillaProps<ElementType>>;\n\nconst TextVanillaComponentImpl = forwardRef(\n <C extends ElementType = 'span'>(\n {\n as,\n className,\n css,\n style,\n size,\n weight,\n variant,\n gradient,\n transform,\n noWrap,\n ...props\n }: TextVanillaProps<C>,\n ref?: PolymorphicRef<C>,\n ) => {\n const Component = as || 'span';\n\n const { colors } = useVanillaExtractTheme();\n\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const mergedStyles = {\n ...cssStyles,\n ...style,\n ...assignInlineVars(vars),\n };\n\n const recipeClass = textRecipe({ size, weight, variant, gradient, transform, noWrap });\n\n return (\n <Component\n ref={ref}\n className={`${recipeClass} ${className || ''}`.trim()}\n style={mergedStyles}\n {...props}\n />\n );\n },\n);\n\nTextVanillaComponentImpl.displayName = 'TextVanilla';\n\nexport const TextVanilla = TextVanillaComponentImpl as TextComponent;\n"],"mappings":";;;;;;;AAwBA,IAAM,2BAA2B,YAE7B,EACE,IACA,WACA,KACA,OACA,MACA,QACA,SACA,UACA,WACA,QACA,GAAG,SAEL,QACG;CACH,MAAM,YAAY,MAAM;CAExB,MAAM,EAAE,WAAW,uBAAuB;CAE1C,MAAM,EAAE,OAAO,WAAW,SAAS,eAAe,KAAK,MAAM;CAE7D,MAAM,eAAe;EACnB,GAAG;EACH,GAAG;EACH,GAAG,iBAAiB,IAAI;CAC1B;CAEA,MAAM,cAAc,WAAW;EAAE;EAAM;EAAQ;EAAS;EAAU;EAAW;CAAO,CAAC;CAErF,OACE,oBAAC,WAAD;EACO;EACL,WAAW,GAAG,YAAY,GAAG,aAAa,KAAK,KAAK;EACpD,OAAO;EACP,GAAI;CACL,CAAA;AAEL,CACF;AAEA,yBAAyB,cAAc;AAEvC,IAAa,cAAc"}
1
+ {"version":3,"file":"Text.vanilla.js","names":[],"sources":["../../../components/Text/Text.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport { ElementType, forwardRef } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport {\n PolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n} from '../../styles/polymorphic';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { textRecipe } from './Text.vanilla.css';\n\ntype TextRecipeVariants = RecipeVariants<typeof textRecipe>;\n\ninterface TextOwnProps extends Omit<TextRecipeVariants, never>, CSSProps {}\n\nexport type TextVanillaProps<C extends ElementType = 'span'> = PolymorphicComponentProps<\n C,\n TextOwnProps\n>;\n\ntype TextComponent = PolymorphicComponent<'span', TextVanillaProps<ElementType>>;\n\nconst TextVanillaComponentImpl = forwardRef(\n <C extends ElementType = 'span'>(\n {\n as,\n className,\n css,\n style,\n size,\n weight,\n variant,\n gradient,\n transform,\n noWrap,\n ...props\n }: TextVanillaProps<C>,\n ref?: PolymorphicRef<C>,\n ) => {\n const Component = as || 'span';\n\n const { colors } = useVanillaExtractTheme();\n\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const mergedStyles = {\n ...cssStyles,\n ...style,\n ...assignInlineVars(vars),\n };\n\n const recipeClass = textRecipe({ size, weight, variant, gradient, transform, noWrap });\n\n return (\n <Component ref={ref} className={cx(recipeClass, className)} style={mergedStyles} {...props} />\n );\n },\n);\n\nTextVanillaComponentImpl.displayName = 'TextVanilla';\n\nexport const TextVanilla = TextVanillaComponentImpl as TextComponent;\n"],"mappings":";;;;;;;;AAyBA,IAAM,2BAA2B,YAE7B,EACE,IACA,WACA,KACA,OACA,MACA,QACA,SACA,UACA,WACA,QACA,GAAG,SAEL,QACG;CACH,MAAM,YAAY,MAAM;CAExB,MAAM,EAAE,WAAW,uBAAuB;CAE1C,MAAM,EAAE,OAAO,WAAW,SAAS,eAAe,KAAK,MAAM;CAE7D,MAAM,eAAe;EACnB,GAAG;EACH,GAAG;EACH,GAAG,iBAAiB,IAAI;CAC1B;CAEA,MAAM,cAAc,WAAW;EAAE;EAAM;EAAQ;EAAS;EAAU;EAAW;CAAO,CAAC;CAErF,OACE,oBAAC,WAAD;EAAgB;EAAK,WAAW,GAAG,aAAa,SAAS;EAAG,OAAO;EAAc,GAAI;CAAQ,CAAA;AAEjG,CACF;AAEA,yBAAyB,cAAc;AAEvC,IAAa,cAAc"}
@@ -1,8 +1,8 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_stitches_config = require("../../stitches.config.cjs");
3
+ const require_Field = require("../Field/Field.cjs");
3
4
  const require_FieldContext = require("../Field/FieldContext.cjs");
4
5
  const require_Input = require("../Input/Input.cjs");
5
- const require_Field = require("../Field/Field.cjs");
6
6
  const require_Tooltip = require("../Tooltip/Tooltip.cjs");
7
7
  let _radix_ui_react_icons = require("@radix-ui/react-icons");
8
8
  let react = require("react");
@@ -1,7 +1,7 @@
1
1
  import { styled } from "../../stitches.config.js";
2
+ import { Field } from "../Field/Field.js";
2
3
  import { useFieldContext } from "../Field/FieldContext.js";
3
4
  import { Input } from "../Input/Input.js";
4
- import { Field } from "../Field/Field.js";
5
5
  import { Tooltip } from "../Tooltip/Tooltip.js";
6
6
  import { CrossCircledIcon, ExclamationTriangleIcon, EyeClosedIcon, EyeOpenIcon } from "@radix-ui/react-icons";
7
7
  import React from "react";
@@ -1,7 +1,7 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
+ const require_Field_vanilla = require("../Field/Field.vanilla.cjs");
2
3
  const require_FieldContext = require("../Field/FieldContext.cjs");
3
4
  const require_Input_vanilla = require("../Input/Input.vanilla.cjs");
4
- const require_Field_vanilla = require("../Field/Field.vanilla.cjs");
5
5
  const require_Tooltip = require("../Tooltip/Tooltip.cjs");
6
6
  require("./TextField.vanilla.css.cjs");
7
7
  let _radix_ui_react_icons = require("@radix-ui/react-icons");
@@ -1,6 +1,6 @@
1
+ import { FieldVanilla } from "../Field/Field.vanilla.js";
1
2
  import { useFieldContext } from "../Field/FieldContext.js";
2
3
  import { InputVanilla } from "../Input/Input.vanilla.js";
3
- import { FieldVanilla } from "../Field/Field.vanilla.js";
4
4
  import { Tooltip } from "../Tooltip/Tooltip.js";
5
5
  import "./TextField.vanilla.css.js";
6
6
  import { CrossCircledIcon, ExclamationTriangleIcon, EyeClosedIcon, EyeOpenIcon } from "@radix-ui/react-icons";
@@ -1,9 +1,9 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_stitches_config = require("../../stitches.config.cjs");
3
3
  const require_Elevation = require("../Elevation/Elevation.cjs");
4
- const require_Label = require("../Label/Label.cjs");
5
- const require_FieldContext = require("../Field/FieldContext.cjs");
6
4
  const require_Field = require("../Field/Field.cjs");
5
+ const require_FieldContext = require("../Field/FieldContext.cjs");
6
+ const require_Label = require("../Label/Label.cjs");
7
7
  let react = require("react");
8
8
  react = require_runtime.__toESM(react, 1);
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -1,8 +1,8 @@
1
1
  import { styled } from "../../stitches.config.js";
2
2
  import { elevationVariants } from "../Elevation/Elevation.js";
3
- import { Label } from "../Label/Label.js";
4
- import { useFieldControl } from "../Field/FieldContext.js";
5
3
  import { Field } from "../Field/Field.js";
4
+ import { useFieldControl } from "../Field/FieldContext.js";
5
+ import { Label } from "../Label/Label.js";
6
6
  import React from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  // components/Textarea/Textarea.tsx
@@ -1,9 +1,10 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_cssProps = require("../../styles/cssProps.cjs");
3
+ const require_cx = require("../../styles/cx.cjs");
3
4
  const require_themeContext = require("../../styles/themeContext.cjs");
4
- const require_Label_vanilla = require("../Label/Label.vanilla.cjs");
5
- const require_FieldContext = require("../Field/FieldContext.cjs");
6
5
  const require_Field_vanilla = require("../Field/Field.vanilla.cjs");
6
+ const require_FieldContext = require("../Field/FieldContext.cjs");
7
+ const require_Label_vanilla = require("../Label/Label.vanilla.cjs");
7
8
  const require_Textarea_vanilla_css = require("./Textarea.vanilla.css.cjs");
8
9
  let react = require("react");
9
10
  react = require_runtime.__toESM(react, 1);
@@ -44,7 +45,7 @@ var TextareaVanillaControl = react.default.forwardRef(({ state, disabled, id, cs
44
45
  id: control.id,
45
46
  disabled: control.disabled,
46
47
  ref: forwardedRef,
47
- className: `${styledTextareaClass} ${className || ""}`.trim(),
48
+ className: require_cx.cx(styledTextareaClass, className),
48
49
  style: mergedStyles,
49
50
  "aria-describedby": control["aria-describedby"],
50
51
  "aria-invalid": control["aria-invalid"],
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.vanilla.cjs","names":["React","useVanillaExtractTheme","useFieldControl","processCSSProp","assignInlineVars","textareaWrapperRecipe","styledTextareaRecipe","FieldVanilla","LabelVanilla"],"sources":["../../../components/Textarea/Textarea.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport React from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { FieldVanilla } from '../Field/Field.vanilla';\nimport { FieldLabelProps, useFieldControl } from '../Field/FieldContext';\nimport { LabelVanilla } from '../Label';\nimport {\n adornmentWrapperEnd,\n styledTextareaRecipe,\n textareaWrapperRecipe,\n} from './Textarea.vanilla.css';\n\ntype StyledTextareaRecipeVariants = NonNullable<RecipeVariants<typeof styledTextareaRecipe>>;\n\nexport interface TextareaVanillaOwnProps extends CSSProps {\n variant?: StyledTextareaRecipeVariants['variant'];\n state?: StyledTextareaRecipeVariants['state'];\n cursor?: StyledTextareaRecipeVariants['cursor'];\n resize?: StyledTextareaRecipeVariants['resize'];\n label?: string;\n description?: React.ReactNode;\n error?: React.ReactNode;\n announceError?: boolean;\n endAdornment?: React.ReactNode;\n rootCss?: CSSProps['css'];\n}\n\nexport type TextareaVanillaProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> &\n TextareaVanillaOwnProps;\n\ntype TextareaVanillaControlProps = Omit<\n TextareaVanillaProps,\n 'label' | 'description' | 'error' | 'announceError' | 'rootCss'\n>;\n\nconst TextareaVanillaControl = React.forwardRef<HTMLTextAreaElement, TextareaVanillaControlProps>(\n (\n {\n state,\n disabled,\n id,\n css,\n endAdornment,\n variant,\n cursor,\n resize,\n className,\n style,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n ...props\n },\n forwardedRef,\n ) => {\n const { colors } = useVanillaExtractTheme();\n const control = useFieldControl({\n id,\n disabled,\n invalid: state === 'invalid',\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n });\n const resolvedState = control.invalid ? 'invalid' : state;\n const hasEndAdornment = Boolean(endAdornment);\n\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n const mergedStyles = { ...cssStyles, ...style, ...assignInlineVars(vars) };\n\n const textareaWrapperClass = textareaWrapperRecipe({\n state: resolvedState,\n disabled: control.disabled,\n });\n const styledTextareaClass = styledTextareaRecipe({\n variant,\n state: resolvedState,\n cursor,\n resize,\n endAdornment: hasEndAdornment,\n });\n\n return (\n <div className={textareaWrapperClass}>\n <textarea\n id={control.id}\n disabled={control.disabled}\n ref={forwardedRef}\n className={`${styledTextareaClass} ${className || ''}`.trim()}\n style={mergedStyles}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n {...props}\n />\n {hasEndAdornment && <div className={adornmentWrapperEnd}>{endAdornment}</div>}\n </div>\n );\n },\n);\n\nTextareaVanillaControl.displayName = 'TextareaVanillaControl';\n\nexport const TextareaVanilla = React.forwardRef<HTMLTextAreaElement, TextareaVanillaProps>(\n ({ label, description, error, announceError, id, rootCss, state, ...props }, forwardedRef) => {\n return (\n <FieldVanilla\n id={id}\n label={\n label &&\n ((labelProps: FieldLabelProps) => (\n <LabelVanilla {...labelProps} css={{ display: 'block' }}>\n {label}\n </LabelVanilla>\n ))\n }\n description={description}\n error={error}\n announceError={announceError}\n invalid={state === 'invalid'}\n disabled={props.disabled}\n css={rootCss}\n >\n <TextareaVanillaControl ref={forwardedRef} id={id} state={state} {...props} />\n </FieldVanilla>\n );\n },\n);\n\nTextareaVanilla.displayName = 'TextareaVanilla';\n"],"mappings":";;;;;;;;;;;;AAsCA,IAAM,yBAAyBA,MAAAA,QAAM,YAEjC,EACE,OACA,UACA,IACA,KACA,cACA,SACA,QACA,QACA,WACA,OACA,oBAAoB,iBACpB,gBAAgB,aAChB,GAAG,SAEL,iBACG;CACH,MAAM,EAAE,WAAWC,qBAAAA,uBAAuB;CAC1C,MAAM,UAAUC,qBAAAA,gBAAgB;EAC9B;EACA;EACA,SAAS,UAAU;EACnB,oBAAoB;EACpB,gBAAgB;CAClB,CAAC;CACD,MAAM,gBAAgB,QAAQ,UAAU,YAAY;CACpD,MAAM,kBAAkB,QAAQ,YAAY;CAE5C,MAAM,EAAE,OAAO,WAAW,SAASC,iBAAAA,eAAe,KAAK,MAAM;CAC7D,MAAM,eAAe;EAAE,GAAG;EAAW,GAAG;EAAO,IAAA,GAAGC,yBAAAA,iBAAAA,CAAiB,IAAI;CAAE;CAEzE,MAAM,uBAAuBC,6BAAAA,sBAAsB;EACjD,OAAO;EACP,UAAU,QAAQ;CACpB,CAAC;CACD,MAAM,sBAAsBC,6BAAAA,qBAAqB;EAC/C;EACA,OAAO;EACP;EACA;EACA,cAAc;CAChB,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAW;EAAhB,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,YAAD;GACE,IAAI,QAAQ;GACZ,UAAU,QAAQ;GAClB,KAAK;GACL,WAAW,GAAG,oBAAoB,GAAG,aAAa,KAAK,KAAK;GAC5D,OAAO;GACP,oBAAkB,QAAQ;GAC1B,gBAAc,QAAQ;GACtB,GAAI;EACL,CAAA,GACA,mBAAmB,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAA;GAAiC,UAAA;EAAkB,CAAA,CACzE;;AAET,CACF;AAEA,uBAAuB,cAAc;AAErC,IAAa,kBAAkBN,MAAAA,QAAM,YAClC,EAAE,OAAO,aAAa,OAAO,eAAe,IAAI,SAAS,OAAO,GAAG,SAAS,iBAAiB;CAC5F,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACO,sBAAAA,cAAD;EACM;EACJ,OACE,WACE,eACA,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,cAAD;GAAc,GAAI;GAAY,KAAK,EAAE,SAAS,QAAQ;GACnD,UAAA;EACW,CAAA;EAGL;EACN;EACQ;EACf,SAAS,UAAU;EACnB,UAAU,MAAM;EAChB,KAAK;EAEL,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,wBAAD;GAAwB,KAAK;GAAkB;GAAW;GAAO,GAAI;EAAQ,CAAA;CACjE,CAAA;AAElB,CACF;AAEA,gBAAgB,cAAc"}
1
+ {"version":3,"file":"Textarea.vanilla.cjs","names":["React","useVanillaExtractTheme","useFieldControl","processCSSProp","assignInlineVars","textareaWrapperRecipe","styledTextareaRecipe","cx","FieldVanilla","LabelVanilla"],"sources":["../../../components/Textarea/Textarea.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport React from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { FieldVanilla } from '../Field/Field.vanilla';\nimport { FieldLabelProps, useFieldControl } from '../Field/FieldContext';\nimport { LabelVanilla } from '../Label';\nimport {\n adornmentWrapperEnd,\n styledTextareaRecipe,\n textareaWrapperRecipe,\n} from './Textarea.vanilla.css';\n\ntype StyledTextareaRecipeVariants = NonNullable<RecipeVariants<typeof styledTextareaRecipe>>;\n\nexport interface TextareaVanillaOwnProps extends CSSProps {\n variant?: StyledTextareaRecipeVariants['variant'];\n state?: StyledTextareaRecipeVariants['state'];\n cursor?: StyledTextareaRecipeVariants['cursor'];\n resize?: StyledTextareaRecipeVariants['resize'];\n label?: string;\n description?: React.ReactNode;\n error?: React.ReactNode;\n announceError?: boolean;\n endAdornment?: React.ReactNode;\n rootCss?: CSSProps['css'];\n}\n\nexport type TextareaVanillaProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> &\n TextareaVanillaOwnProps;\n\ntype TextareaVanillaControlProps = Omit<\n TextareaVanillaProps,\n 'label' | 'description' | 'error' | 'announceError' | 'rootCss'\n>;\n\nconst TextareaVanillaControl = React.forwardRef<HTMLTextAreaElement, TextareaVanillaControlProps>(\n (\n {\n state,\n disabled,\n id,\n css,\n endAdornment,\n variant,\n cursor,\n resize,\n className,\n style,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n ...props\n },\n forwardedRef,\n ) => {\n const { colors } = useVanillaExtractTheme();\n const control = useFieldControl({\n id,\n disabled,\n invalid: state === 'invalid',\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n });\n const resolvedState = control.invalid ? 'invalid' : state;\n const hasEndAdornment = Boolean(endAdornment);\n\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n const mergedStyles = { ...cssStyles, ...style, ...assignInlineVars(vars) };\n\n const textareaWrapperClass = textareaWrapperRecipe({\n state: resolvedState,\n disabled: control.disabled,\n });\n const styledTextareaClass = styledTextareaRecipe({\n variant,\n state: resolvedState,\n cursor,\n resize,\n endAdornment: hasEndAdornment,\n });\n\n return (\n <div className={textareaWrapperClass}>\n <textarea\n id={control.id}\n disabled={control.disabled}\n ref={forwardedRef}\n className={cx(styledTextareaClass, className)}\n style={mergedStyles}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n {...props}\n />\n {hasEndAdornment && <div className={adornmentWrapperEnd}>{endAdornment}</div>}\n </div>\n );\n },\n);\n\nTextareaVanillaControl.displayName = 'TextareaVanillaControl';\n\nexport const TextareaVanilla = React.forwardRef<HTMLTextAreaElement, TextareaVanillaProps>(\n ({ label, description, error, announceError, id, rootCss, state, ...props }, forwardedRef) => {\n return (\n <FieldVanilla\n id={id}\n label={\n label &&\n ((labelProps: FieldLabelProps) => (\n <LabelVanilla {...labelProps} css={{ display: 'block' }}>\n {label}\n </LabelVanilla>\n ))\n }\n description={description}\n error={error}\n announceError={announceError}\n invalid={state === 'invalid'}\n disabled={props.disabled}\n css={rootCss}\n >\n <TextareaVanillaControl ref={forwardedRef} id={id} state={state} {...props} />\n </FieldVanilla>\n );\n },\n);\n\nTextareaVanilla.displayName = 'TextareaVanilla';\n"],"mappings":";;;;;;;;;;;;;AAuCA,IAAM,yBAAyBA,MAAAA,QAAM,YAEjC,EACE,OACA,UACA,IACA,KACA,cACA,SACA,QACA,QACA,WACA,OACA,oBAAoB,iBACpB,gBAAgB,aAChB,GAAG,SAEL,iBACG;CACH,MAAM,EAAE,WAAWC,qBAAAA,uBAAuB;CAC1C,MAAM,UAAUC,qBAAAA,gBAAgB;EAC9B;EACA;EACA,SAAS,UAAU;EACnB,oBAAoB;EACpB,gBAAgB;CAClB,CAAC;CACD,MAAM,gBAAgB,QAAQ,UAAU,YAAY;CACpD,MAAM,kBAAkB,QAAQ,YAAY;CAE5C,MAAM,EAAE,OAAO,WAAW,SAASC,iBAAAA,eAAe,KAAK,MAAM;CAC7D,MAAM,eAAe;EAAE,GAAG;EAAW,GAAG;EAAO,IAAA,GAAGC,yBAAAA,iBAAAA,CAAiB,IAAI;CAAE;CAEzE,MAAM,uBAAuBC,6BAAAA,sBAAsB;EACjD,OAAO;EACP,UAAU,QAAQ;CACpB,CAAC;CACD,MAAM,sBAAsBC,6BAAAA,qBAAqB;EAC/C;EACA,OAAO;EACP;EACA;EACA,cAAc;CAChB,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAW;EAAhB,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,YAAD;GACE,IAAI,QAAQ;GACZ,UAAU,QAAQ;GAClB,KAAK;GACL,WAAWC,WAAAA,GAAG,qBAAqB,SAAS;GAC5C,OAAO;GACP,oBAAkB,QAAQ;GAC1B,gBAAc,QAAQ;GACtB,GAAI;EACL,CAAA,GACA,mBAAmB,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAA;GAAiC,UAAA;EAAkB,CAAA,CACzE;;AAET,CACF;AAEA,uBAAuB,cAAc;AAErC,IAAa,kBAAkBP,MAAAA,QAAM,YAClC,EAAE,OAAO,aAAa,OAAO,eAAe,IAAI,SAAS,OAAO,GAAG,SAAS,iBAAiB;CAC5F,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACQ,sBAAAA,cAAD;EACM;EACJ,OACE,WACE,eACA,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,cAAD;GAAc,GAAI;GAAY,KAAK,EAAE,SAAS,QAAQ;GACnD,UAAA;EACW,CAAA;EAGL;EACN;EACQ;EACf,SAAS,UAAU;EACnB,UAAU,MAAM;EAChB,KAAK;EAEL,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,wBAAD;GAAwB,KAAK;GAAkB;GAAW;GAAO,GAAI;EAAQ,CAAA;CACjE,CAAA;AAElB,CACF;AAEA,gBAAgB,cAAc"}
@@ -1,8 +1,9 @@
1
1
  import { processCSSProp } from "../../styles/cssProps.js";
2
+ import { cx } from "../../styles/cx.js";
2
3
  import { useVanillaExtractTheme } from "../../styles/themeContext.js";
3
- import { LabelVanilla } from "../Label/Label.vanilla.js";
4
- import { useFieldControl } from "../Field/FieldContext.js";
5
4
  import { FieldVanilla } from "../Field/Field.vanilla.js";
5
+ import { useFieldControl } from "../Field/FieldContext.js";
6
+ import { LabelVanilla } from "../Label/Label.vanilla.js";
6
7
  import { styledTextareaRecipe, textareaWrapperRecipe } from "./Textarea.vanilla.css.js";
7
8
  import React from "react";
8
9
  import { assignInlineVars } from "@vanilla-extract/dynamic";
@@ -42,7 +43,7 @@ var TextareaVanillaControl = React.forwardRef(({ state, disabled, id, css, endAd
42
43
  id: control.id,
43
44
  disabled: control.disabled,
44
45
  ref: forwardedRef,
45
- className: `${styledTextareaClass} ${className || ""}`.trim(),
46
+ className: cx(styledTextareaClass, className),
46
47
  style: mergedStyles,
47
48
  "aria-describedby": control["aria-describedby"],
48
49
  "aria-invalid": control["aria-invalid"],
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.vanilla.js","names":[],"sources":["../../../components/Textarea/Textarea.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport React from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { FieldVanilla } from '../Field/Field.vanilla';\nimport { FieldLabelProps, useFieldControl } from '../Field/FieldContext';\nimport { LabelVanilla } from '../Label';\nimport {\n adornmentWrapperEnd,\n styledTextareaRecipe,\n textareaWrapperRecipe,\n} from './Textarea.vanilla.css';\n\ntype StyledTextareaRecipeVariants = NonNullable<RecipeVariants<typeof styledTextareaRecipe>>;\n\nexport interface TextareaVanillaOwnProps extends CSSProps {\n variant?: StyledTextareaRecipeVariants['variant'];\n state?: StyledTextareaRecipeVariants['state'];\n cursor?: StyledTextareaRecipeVariants['cursor'];\n resize?: StyledTextareaRecipeVariants['resize'];\n label?: string;\n description?: React.ReactNode;\n error?: React.ReactNode;\n announceError?: boolean;\n endAdornment?: React.ReactNode;\n rootCss?: CSSProps['css'];\n}\n\nexport type TextareaVanillaProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> &\n TextareaVanillaOwnProps;\n\ntype TextareaVanillaControlProps = Omit<\n TextareaVanillaProps,\n 'label' | 'description' | 'error' | 'announceError' | 'rootCss'\n>;\n\nconst TextareaVanillaControl = React.forwardRef<HTMLTextAreaElement, TextareaVanillaControlProps>(\n (\n {\n state,\n disabled,\n id,\n css,\n endAdornment,\n variant,\n cursor,\n resize,\n className,\n style,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n ...props\n },\n forwardedRef,\n ) => {\n const { colors } = useVanillaExtractTheme();\n const control = useFieldControl({\n id,\n disabled,\n invalid: state === 'invalid',\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n });\n const resolvedState = control.invalid ? 'invalid' : state;\n const hasEndAdornment = Boolean(endAdornment);\n\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n const mergedStyles = { ...cssStyles, ...style, ...assignInlineVars(vars) };\n\n const textareaWrapperClass = textareaWrapperRecipe({\n state: resolvedState,\n disabled: control.disabled,\n });\n const styledTextareaClass = styledTextareaRecipe({\n variant,\n state: resolvedState,\n cursor,\n resize,\n endAdornment: hasEndAdornment,\n });\n\n return (\n <div className={textareaWrapperClass}>\n <textarea\n id={control.id}\n disabled={control.disabled}\n ref={forwardedRef}\n className={`${styledTextareaClass} ${className || ''}`.trim()}\n style={mergedStyles}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n {...props}\n />\n {hasEndAdornment && <div className={adornmentWrapperEnd}>{endAdornment}</div>}\n </div>\n );\n },\n);\n\nTextareaVanillaControl.displayName = 'TextareaVanillaControl';\n\nexport const TextareaVanilla = React.forwardRef<HTMLTextAreaElement, TextareaVanillaProps>(\n ({ label, description, error, announceError, id, rootCss, state, ...props }, forwardedRef) => {\n return (\n <FieldVanilla\n id={id}\n label={\n label &&\n ((labelProps: FieldLabelProps) => (\n <LabelVanilla {...labelProps} css={{ display: 'block' }}>\n {label}\n </LabelVanilla>\n ))\n }\n description={description}\n error={error}\n announceError={announceError}\n invalid={state === 'invalid'}\n disabled={props.disabled}\n css={rootCss}\n >\n <TextareaVanillaControl ref={forwardedRef} id={id} state={state} {...props} />\n </FieldVanilla>\n );\n },\n);\n\nTextareaVanilla.displayName = 'TextareaVanilla';\n"],"mappings":";;;;;;;;;;AAsCA,IAAM,yBAAyB,MAAM,YAEjC,EACE,OACA,UACA,IACA,KACA,cACA,SACA,QACA,QACA,WACA,OACA,oBAAoB,iBACpB,gBAAgB,aAChB,GAAG,SAEL,iBACG;CACH,MAAM,EAAE,WAAW,uBAAuB;CAC1C,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA,SAAS,UAAU;EACnB,oBAAoB;EACpB,gBAAgB;CAClB,CAAC;CACD,MAAM,gBAAgB,QAAQ,UAAU,YAAY;CACpD,MAAM,kBAAkB,QAAQ,YAAY;CAE5C,MAAM,EAAE,OAAO,WAAW,SAAS,eAAe,KAAK,MAAM;CAC7D,MAAM,eAAe;EAAE,GAAG;EAAW,GAAG;EAAO,GAAG,iBAAiB,IAAI;CAAE;CAEzE,MAAM,uBAAuB,sBAAsB;EACjD,OAAO;EACP,UAAU,QAAQ;CACpB,CAAC;CACD,MAAM,sBAAsB,qBAAqB;EAC/C;EACA,OAAO;EACP;EACA;EACA,cAAc;CAChB,CAAC;CAED,OACE,qBAAC,OAAD;EAAK,WAAW;EAAhB,UAAA,CACE,oBAAC,YAAD;GACE,IAAI,QAAQ;GACZ,UAAU,QAAQ;GAClB,KAAK;GACL,WAAW,GAAG,oBAAoB,GAAG,aAAa,KAAK,KAAK;GAC5D,OAAO;GACP,oBAAkB,QAAQ;GAC1B,gBAAc,QAAQ;GACtB,GAAI;EACL,CAAA,GACA,mBAAmB,oBAAC,OAAD;GAAK,WAAA;GAAiC,UAAA;EAAkB,CAAA,CACzE;;AAET,CACF;AAEA,uBAAuB,cAAc;AAErC,IAAa,kBAAkB,MAAM,YAClC,EAAE,OAAO,aAAa,OAAO,eAAe,IAAI,SAAS,OAAO,GAAG,SAAS,iBAAiB;CAC5F,OACE,oBAAC,cAAD;EACM;EACJ,OACE,WACE,eACA,oBAAC,cAAD;GAAc,GAAI;GAAY,KAAK,EAAE,SAAS,QAAQ;GACnD,UAAA;EACW,CAAA;EAGL;EACN;EACQ;EACf,SAAS,UAAU;EACnB,UAAU,MAAM;EAChB,KAAK;EAEL,UAAA,oBAAC,wBAAD;GAAwB,KAAK;GAAkB;GAAW;GAAO,GAAI;EAAQ,CAAA;CACjE,CAAA;AAElB,CACF;AAEA,gBAAgB,cAAc"}
1
+ {"version":3,"file":"Textarea.vanilla.js","names":[],"sources":["../../../components/Textarea/Textarea.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport React from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { FieldVanilla } from '../Field/Field.vanilla';\nimport { FieldLabelProps, useFieldControl } from '../Field/FieldContext';\nimport { LabelVanilla } from '../Label';\nimport {\n adornmentWrapperEnd,\n styledTextareaRecipe,\n textareaWrapperRecipe,\n} from './Textarea.vanilla.css';\n\ntype StyledTextareaRecipeVariants = NonNullable<RecipeVariants<typeof styledTextareaRecipe>>;\n\nexport interface TextareaVanillaOwnProps extends CSSProps {\n variant?: StyledTextareaRecipeVariants['variant'];\n state?: StyledTextareaRecipeVariants['state'];\n cursor?: StyledTextareaRecipeVariants['cursor'];\n resize?: StyledTextareaRecipeVariants['resize'];\n label?: string;\n description?: React.ReactNode;\n error?: React.ReactNode;\n announceError?: boolean;\n endAdornment?: React.ReactNode;\n rootCss?: CSSProps['css'];\n}\n\nexport type TextareaVanillaProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> &\n TextareaVanillaOwnProps;\n\ntype TextareaVanillaControlProps = Omit<\n TextareaVanillaProps,\n 'label' | 'description' | 'error' | 'announceError' | 'rootCss'\n>;\n\nconst TextareaVanillaControl = React.forwardRef<HTMLTextAreaElement, TextareaVanillaControlProps>(\n (\n {\n state,\n disabled,\n id,\n css,\n endAdornment,\n variant,\n cursor,\n resize,\n className,\n style,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n ...props\n },\n forwardedRef,\n ) => {\n const { colors } = useVanillaExtractTheme();\n const control = useFieldControl({\n id,\n disabled,\n invalid: state === 'invalid',\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n });\n const resolvedState = control.invalid ? 'invalid' : state;\n const hasEndAdornment = Boolean(endAdornment);\n\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n const mergedStyles = { ...cssStyles, ...style, ...assignInlineVars(vars) };\n\n const textareaWrapperClass = textareaWrapperRecipe({\n state: resolvedState,\n disabled: control.disabled,\n });\n const styledTextareaClass = styledTextareaRecipe({\n variant,\n state: resolvedState,\n cursor,\n resize,\n endAdornment: hasEndAdornment,\n });\n\n return (\n <div className={textareaWrapperClass}>\n <textarea\n id={control.id}\n disabled={control.disabled}\n ref={forwardedRef}\n className={cx(styledTextareaClass, className)}\n style={mergedStyles}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n {...props}\n />\n {hasEndAdornment && <div className={adornmentWrapperEnd}>{endAdornment}</div>}\n </div>\n );\n },\n);\n\nTextareaVanillaControl.displayName = 'TextareaVanillaControl';\n\nexport const TextareaVanilla = React.forwardRef<HTMLTextAreaElement, TextareaVanillaProps>(\n ({ label, description, error, announceError, id, rootCss, state, ...props }, forwardedRef) => {\n return (\n <FieldVanilla\n id={id}\n label={\n label &&\n ((labelProps: FieldLabelProps) => (\n <LabelVanilla {...labelProps} css={{ display: 'block' }}>\n {label}\n </LabelVanilla>\n ))\n }\n description={description}\n error={error}\n announceError={announceError}\n invalid={state === 'invalid'}\n disabled={props.disabled}\n css={rootCss}\n >\n <TextareaVanillaControl ref={forwardedRef} id={id} state={state} {...props} />\n </FieldVanilla>\n );\n },\n);\n\nTextareaVanilla.displayName = 'TextareaVanilla';\n"],"mappings":";;;;;;;;;;;AAuCA,IAAM,yBAAyB,MAAM,YAEjC,EACE,OACA,UACA,IACA,KACA,cACA,SACA,QACA,QACA,WACA,OACA,oBAAoB,iBACpB,gBAAgB,aAChB,GAAG,SAEL,iBACG;CACH,MAAM,EAAE,WAAW,uBAAuB;CAC1C,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA,SAAS,UAAU;EACnB,oBAAoB;EACpB,gBAAgB;CAClB,CAAC;CACD,MAAM,gBAAgB,QAAQ,UAAU,YAAY;CACpD,MAAM,kBAAkB,QAAQ,YAAY;CAE5C,MAAM,EAAE,OAAO,WAAW,SAAS,eAAe,KAAK,MAAM;CAC7D,MAAM,eAAe;EAAE,GAAG;EAAW,GAAG;EAAO,GAAG,iBAAiB,IAAI;CAAE;CAEzE,MAAM,uBAAuB,sBAAsB;EACjD,OAAO;EACP,UAAU,QAAQ;CACpB,CAAC;CACD,MAAM,sBAAsB,qBAAqB;EAC/C;EACA,OAAO;EACP;EACA;EACA,cAAc;CAChB,CAAC;CAED,OACE,qBAAC,OAAD;EAAK,WAAW;EAAhB,UAAA,CACE,oBAAC,YAAD;GACE,IAAI,QAAQ;GACZ,UAAU,QAAQ;GAClB,KAAK;GACL,WAAW,GAAG,qBAAqB,SAAS;GAC5C,OAAO;GACP,oBAAkB,QAAQ;GAC1B,gBAAc,QAAQ;GACtB,GAAI;EACL,CAAA,GACA,mBAAmB,oBAAC,OAAD;GAAK,WAAA;GAAiC,UAAA;EAAkB,CAAA,CACzE;;AAET,CACF;AAEA,uBAAuB,cAAc;AAErC,IAAa,kBAAkB,MAAM,YAClC,EAAE,OAAO,aAAa,OAAO,eAAe,IAAI,SAAS,OAAO,GAAG,SAAS,iBAAiB;CAC5F,OACE,oBAAC,cAAD;EACM;EACJ,OACE,WACE,eACA,oBAAC,cAAD;GAAc,GAAI;GAAY,KAAK,EAAE,SAAS,QAAQ;GACnD,UAAA;EACW,CAAA;EAGL;EACN;EACQ;EACf,SAAS,UAAU;EACnB,UAAU,MAAM;EAChB,KAAK;EAEL,UAAA,oBAAC,wBAAD;GAAwB,KAAK;GAAkB;GAAW;GAAO,GAAI;EAAQ,CAAA;CACjE,CAAA;AAElB,CACF;AAEA,gBAAgB,cAAc"}
@@ -1,5 +1,6 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_cssProps = require("../../styles/cssProps.cjs");
3
+ const require_cx = require("../../styles/cx.cjs");
3
4
  const require_themeContext = require("../../styles/themeContext.cjs");
4
5
  const require_Button_vanilla = require("../Button/Button.vanilla.cjs");
5
6
  const require_IconButton_vanilla = require("../IconButton/IconButton.vanilla.cjs");
@@ -19,7 +20,6 @@ var DEFAULT_ICONS = {
19
20
  warning: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.ExclamationTriangleIcon, {}),
20
21
  error: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.CrossCircledIcon, {})
21
22
  };
22
- var joinClassNames = (...classNames) => classNames.filter(Boolean).join(" ");
23
23
  var useCssProp = (css, style) => {
24
24
  const { colors } = require_themeContext.useVanillaExtractTheme();
25
25
  const { style: cssStyles, vars } = require_cssProps.processCSSProp(css, colors);
@@ -35,7 +35,7 @@ var ToastVanilla = (0, react.forwardRef)(({ variant = "gray", icon, closeLabel =
35
35
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_toast.Root, {
36
36
  ref,
37
37
  type: type ?? (variant === "error" ? "foreground" : "background"),
38
- className: joinClassNames(require_Toast_vanilla_css.toastRoot, className),
38
+ className: require_cx.cx(require_Toast_vanilla_css.toastRoot, className),
39
39
  style: mergedStyles,
40
40
  ...props,
41
41
  children: [
@@ -63,14 +63,14 @@ var ToastVanilla = (0, react.forwardRef)(({ variant = "gray", icon, closeLabel =
63
63
  ToastVanilla.displayName = "ToastVanilla";
64
64
  var ToastTitleVanilla = (0, react.forwardRef)(({ className, css, style, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_toast.Title, {
65
65
  ref,
66
- className: joinClassNames(require_Toast_vanilla_css.toastTitle, className),
66
+ className: require_cx.cx(require_Toast_vanilla_css.toastTitle, className),
67
67
  style: useCssProp(css, style),
68
68
  ...props
69
69
  }));
70
70
  ToastTitleVanilla.displayName = "ToastTitleVanilla";
71
71
  var ToastDescriptionVanilla = (0, react.forwardRef)(({ className, css, style, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_toast.Description, {
72
72
  ref,
73
- className: joinClassNames(require_Toast_vanilla_css.toastDescription, className),
73
+ className: require_cx.cx(require_Toast_vanilla_css.toastDescription, className),
74
74
  style: useCssProp(css, style),
75
75
  ...props
76
76
  }));
@@ -83,7 +83,7 @@ var ToastActionVanilla = (0, react.forwardRef)(({ altText, className, css, ...pr
83
83
  variant: "secondary",
84
84
  size: "small",
85
85
  css,
86
- className: joinClassNames(require_Toast_vanilla_css.toastAction, className),
86
+ className: require_cx.cx(require_Toast_vanilla_css.toastAction, className),
87
87
  ...props
88
88
  })
89
89
  }));