@nearform/quantum 1.7.3 → 1.9.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 (260) hide show
  1. package/README.md +19 -1
  2. package/dist/animations/index.d.ts +25 -0
  3. package/dist/animations/index.js +14 -37
  4. package/dist/animations/index.js.map +1 -1
  5. package/dist/assets/build/open-source.icon.d.ts +2 -0
  6. package/dist/assets/build/open-source.icon.js +7 -0
  7. package/dist/assets/build/open-source.icon.js.map +1 -0
  8. package/dist/assets/index.d.ts +13 -0
  9. package/dist/assets/index.js +29 -0
  10. package/dist/assets/index.js.map +1 -0
  11. package/dist/colors/accent.d.ts +16 -0
  12. package/dist/colors/accent.js +21 -0
  13. package/dist/colors/accent.js.map +1 -0
  14. package/dist/colors/background.d.ts +36 -0
  15. package/dist/colors/background.js +41 -0
  16. package/dist/colors/background.js.map +1 -0
  17. package/dist/colors/base.d.ts +136 -0
  18. package/dist/colors/base.js +140 -0
  19. package/dist/colors/base.js.map +1 -0
  20. package/dist/colors/border.d.ts +16 -0
  21. package/dist/colors/border.js +21 -0
  22. package/dist/colors/border.js.map +1 -0
  23. package/dist/colors/button.d.ts +106 -0
  24. package/dist/colors/button.js +115 -0
  25. package/dist/colors/button.js.map +1 -0
  26. package/dist/colors/feedback.d.ts +27 -0
  27. package/dist/colors/feedback.js +32 -0
  28. package/dist/colors/feedback.js.map +1 -0
  29. package/dist/colors/foreground.d.ts +35 -0
  30. package/dist/colors/foreground.js +40 -0
  31. package/dist/colors/foreground.js.map +1 -0
  32. package/dist/colors/index.d.ts +351 -0
  33. package/dist/colors/index.js +13 -416
  34. package/dist/colors/index.js.map +1 -1
  35. package/dist/components/Accordion/index.d.ts +13 -0
  36. package/dist/components/Accordion/index.js +97 -0
  37. package/dist/components/Accordion/index.js.map +1 -0
  38. package/dist/components/AppHeader/index.d.ts +21 -0
  39. package/dist/components/AppHeader/index.js +98 -0
  40. package/dist/components/AppHeader/index.js.map +1 -0
  41. package/dist/components/Avatar/index.d.ts +30 -0
  42. package/dist/components/Avatar/index.js +116 -0
  43. package/dist/components/Avatar/index.js.map +1 -0
  44. package/dist/components/BackLink/index.d.ts +9 -0
  45. package/dist/components/BackLink/index.js +80 -0
  46. package/dist/components/BackLink/index.js.map +1 -0
  47. package/dist/components/Badge/index.d.ts +48 -0
  48. package/dist/components/Badge/index.js +160 -0
  49. package/dist/components/Badge/index.js.map +1 -0
  50. package/dist/components/Breadcrumb/index.d.ts +13 -0
  51. package/dist/components/Breadcrumb/index.js +90 -0
  52. package/dist/components/Breadcrumb/index.js.map +1 -0
  53. package/dist/components/Button/index.d.ts +17 -0
  54. package/dist/components/Button/index.js +204 -0
  55. package/dist/components/Button/index.js.map +1 -0
  56. package/dist/components/ButtonGroup/index.d.ts +11 -0
  57. package/dist/components/ButtonGroup/index.js +102 -0
  58. package/dist/components/ButtonGroup/index.js.map +1 -0
  59. package/dist/components/Calendar/index.d.ts +8 -0
  60. package/dist/components/Calendar/index.js +146 -0
  61. package/dist/components/Calendar/index.js.map +1 -0
  62. package/dist/components/Card/index.d.ts +28 -0
  63. package/dist/components/Card/index.js +155 -0
  64. package/dist/components/Card/index.js.map +1 -0
  65. package/dist/components/Chat/index.d.ts +39 -0
  66. package/dist/components/Chat/index.js +100 -0
  67. package/dist/components/Chat/index.js.map +1 -0
  68. package/dist/components/Checkbox/index.d.ts +5 -0
  69. package/dist/components/Checkbox/index.js +128 -0
  70. package/dist/components/Checkbox/index.js.map +1 -0
  71. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +61 -0
  72. package/dist/components/CheckboxGroup/CheckboxGroup.js +107 -0
  73. package/dist/components/CheckboxGroup/CheckboxGroup.js.map +1 -0
  74. package/dist/components/CheckboxGroup/CheckboxGroupItem.d.ts +19 -0
  75. package/dist/components/CheckboxGroup/CheckboxGroupItem.js +83 -0
  76. package/dist/components/CheckboxGroup/CheckboxGroupItem.js.map +1 -0
  77. package/dist/components/CheckboxGroup/index.d.ts +2 -0
  78. package/dist/components/CheckboxGroup/index.js +9 -0
  79. package/dist/components/CheckboxGroup/index.js.map +1 -0
  80. package/dist/components/Chip/index.d.ts +11 -0
  81. package/dist/components/Chip/index.js +105 -0
  82. package/dist/components/Chip/index.js.map +1 -0
  83. package/dist/components/CodeBlock/index.d.ts +7 -0
  84. package/dist/components/CodeBlock/index.js +57 -0
  85. package/dist/components/CodeBlock/index.js.map +1 -0
  86. package/dist/components/ControlLabel/index.d.ts +13 -0
  87. package/dist/components/ControlLabel/index.js +83 -0
  88. package/dist/components/ControlLabel/index.js.map +1 -0
  89. package/dist/components/DateInput/index.d.ts +26 -0
  90. package/dist/components/DateInput/index.js +261 -0
  91. package/dist/components/DateInput/index.js.map +1 -0
  92. package/dist/components/DocsList/index.d.ts +18 -0
  93. package/dist/components/DocsList/index.js +125 -0
  94. package/dist/components/DocsList/index.js.map +1 -0
  95. package/dist/components/FormGroup/index.d.ts +121 -0
  96. package/dist/components/FormGroup/index.js +359 -0
  97. package/dist/components/FormGroup/index.js.map +1 -0
  98. package/dist/components/HeroButton/index.d.ts +17 -0
  99. package/dist/components/HeroButton/index.js +139 -0
  100. package/dist/components/HeroButton/index.js.map +1 -0
  101. package/dist/components/IconButton/index.d.ts +77 -0
  102. package/dist/components/IconButton/index.js +235 -0
  103. package/dist/components/IconButton/index.js.map +1 -0
  104. package/dist/components/Input/index.d.ts +27 -0
  105. package/dist/components/Input/index.js +179 -0
  106. package/dist/components/Input/index.js.map +1 -0
  107. package/dist/components/Label/index.d.ts +12 -0
  108. package/dist/components/Label/index.js +89 -0
  109. package/dist/components/Label/index.js.map +1 -0
  110. package/dist/components/Link/index.d.ts +8 -0
  111. package/dist/components/Link/index.js +40 -0
  112. package/dist/components/Link/index.js.map +1 -0
  113. package/dist/components/Modal/index.d.ts +26 -0
  114. package/dist/components/Modal/index.js +143 -0
  115. package/dist/components/Modal/index.js.map +1 -0
  116. package/dist/components/Navigation/index.d.ts +8 -0
  117. package/dist/components/Navigation/index.js +65 -0
  118. package/dist/components/Navigation/index.js.map +1 -0
  119. package/dist/components/Notice/index.d.ts +17 -0
  120. package/dist/components/Notice/index.js +134 -0
  121. package/dist/components/Notice/index.js.map +1 -0
  122. package/dist/components/PageHeader/index.d.ts +15 -0
  123. package/dist/components/PageHeader/index.js +90 -0
  124. package/dist/components/PageHeader/index.js.map +1 -0
  125. package/dist/components/Pagination/index.d.ts +17 -0
  126. package/dist/components/Pagination/index.js +118 -0
  127. package/dist/components/Pagination/index.js.map +1 -0
  128. package/dist/components/Password/index.d.ts +18 -0
  129. package/dist/components/Password/index.js +106 -0
  130. package/dist/components/Password/index.js.map +1 -0
  131. package/dist/components/Popover/index.d.ts +28 -0
  132. package/dist/components/Popover/index.js +97 -0
  133. package/dist/components/Popover/index.js.map +1 -0
  134. package/dist/components/Radio/RadioGroup.d.ts +42 -0
  135. package/dist/components/Radio/RadioGroup.js +82 -0
  136. package/dist/components/Radio/RadioGroup.js.map +1 -0
  137. package/dist/components/Radio/RadioGroupItem.d.ts +17 -0
  138. package/dist/components/Radio/RadioGroupItem.js +117 -0
  139. package/dist/components/Radio/RadioGroupItem.js.map +1 -0
  140. package/dist/components/Radio/index.d.ts +2 -0
  141. package/dist/components/Radio/index.js +8 -0
  142. package/dist/components/Radio/index.js.map +1 -0
  143. package/dist/components/Select/index.d.ts +19 -0
  144. package/dist/components/Select/index.js +206 -0
  145. package/dist/components/Select/index.js.map +1 -0
  146. package/dist/components/Slider/index.d.ts +18 -0
  147. package/dist/components/Slider/index.js +122 -0
  148. package/dist/components/Slider/index.js.map +1 -0
  149. package/dist/components/SortAndShow/index.d.ts +15 -0
  150. package/dist/components/SortAndShow/index.js +68 -0
  151. package/dist/components/SortAndShow/index.js.map +1 -0
  152. package/dist/components/SplitButton/index.d.ts +25 -0
  153. package/dist/components/SplitButton/index.js +224 -0
  154. package/dist/components/SplitButton/index.js.map +1 -0
  155. package/dist/components/Stats/index.d.ts +10 -0
  156. package/dist/components/Stats/index.js +63 -0
  157. package/dist/components/Stats/index.js.map +1 -0
  158. package/dist/components/Stepper/index.d.ts +23 -0
  159. package/dist/components/Stepper/index.js +142 -0
  160. package/dist/components/Stepper/index.js.map +1 -0
  161. package/dist/components/StepsIndicator/Step.d.ts +6 -0
  162. package/dist/components/StepsIndicator/Step.js +24 -0
  163. package/dist/components/StepsIndicator/Step.js.map +1 -0
  164. package/dist/components/StepsIndicator/StepsIndicator.d.ts +12 -0
  165. package/dist/components/StepsIndicator/StepsIndicator.js +67 -0
  166. package/dist/components/StepsIndicator/StepsIndicator.js.map +1 -0
  167. package/dist/components/StepsIndicator/index.d.ts +2 -0
  168. package/dist/components/StepsIndicator/index.js +19 -0
  169. package/dist/components/StepsIndicator/index.js.map +1 -0
  170. package/dist/components/Subnav/index.d.ts +14 -0
  171. package/dist/components/Subnav/index.js +94 -0
  172. package/dist/components/Subnav/index.js.map +1 -0
  173. package/dist/components/Switch/index.d.ts +4 -0
  174. package/dist/components/Switch/index.js +103 -0
  175. package/dist/components/Switch/index.js.map +1 -0
  176. package/dist/components/Table/index.d.ts +48 -0
  177. package/dist/components/Table/index.js +147 -0
  178. package/dist/components/Table/index.js.map +1 -0
  179. package/dist/components/Tabs/index.d.ts +16 -0
  180. package/dist/components/Tabs/index.js +168 -0
  181. package/dist/components/Tabs/index.js.map +1 -0
  182. package/dist/components/Textarea/index.d.ts +13 -0
  183. package/dist/components/Textarea/index.js +96 -0
  184. package/dist/components/Textarea/index.js.map +1 -0
  185. package/dist/components/Toast/index.d.ts +24 -0
  186. package/dist/components/Toast/index.js +171 -0
  187. package/dist/components/Toast/index.js.map +1 -0
  188. package/dist/components/ToggleList/index.d.ts +20 -0
  189. package/dist/components/ToggleList/index.js +68 -0
  190. package/dist/components/ToggleList/index.js.map +1 -0
  191. package/dist/components/Tooltip/index.d.ts +11 -0
  192. package/dist/components/Tooltip/index.js +66 -0
  193. package/dist/components/Tooltip/index.js.map +1 -0
  194. package/dist/components/WebsiteFooter/index.d.ts +23 -0
  195. package/dist/components/WebsiteFooter/index.js +113 -0
  196. package/dist/components/WebsiteFooter/index.js.map +1 -0
  197. package/dist/components/WebsiteHeader/index.d.ts +21 -0
  198. package/dist/components/WebsiteHeader/index.js +98 -0
  199. package/dist/components/WebsiteHeader/index.js.map +1 -0
  200. package/dist/components/choice-group.d.ts +109 -0
  201. package/dist/components/choice-group.js +200 -0
  202. package/dist/components/choice-group.js.map +1 -0
  203. package/dist/components/index.d.ts +49 -0
  204. package/dist/components/index.js +66 -0
  205. package/dist/components/index.js.map +1 -0
  206. package/dist/esm/animations/index.js +17 -0
  207. package/dist/esm/animations/index.js.map +1 -0
  208. package/dist/esm/colors/accent.js +18 -0
  209. package/dist/esm/colors/accent.js.map +1 -0
  210. package/dist/esm/colors/background.js +38 -0
  211. package/dist/esm/colors/background.js.map +1 -0
  212. package/dist/esm/colors/base.js +137 -0
  213. package/dist/esm/colors/base.js.map +1 -0
  214. package/dist/esm/colors/border.js +18 -0
  215. package/dist/esm/colors/border.js.map +1 -0
  216. package/dist/esm/colors/button.js +112 -0
  217. package/dist/esm/colors/button.js.map +1 -0
  218. package/dist/esm/colors/feedback.js +29 -0
  219. package/dist/esm/colors/feedback.js.map +1 -0
  220. package/dist/esm/colors/foreground.js +37 -0
  221. package/dist/esm/colors/foreground.js.map +1 -0
  222. package/dist/esm/colors/index.js +13 -0
  223. package/dist/esm/colors/index.js.map +1 -0
  224. package/dist/esm/package.json +1 -0
  225. package/dist/esm/tailwind-base.js +31 -0
  226. package/dist/esm/tailwind-base.js.map +1 -0
  227. package/dist/esm/tailwind-plugin.js +29 -0
  228. package/dist/esm/tailwind-plugin.js.map +1 -0
  229. package/dist/esm/theme.js +55 -0
  230. package/dist/esm/theme.js.map +1 -0
  231. package/dist/global.css +574 -482
  232. package/dist/index.d.ts +3 -1299
  233. package/dist/index.js +23 -6335
  234. package/dist/index.js.map +1 -1
  235. package/dist/lib/utils.d.ts +16 -0
  236. package/dist/lib/utils.js +23 -0
  237. package/dist/lib/utils.js.map +1 -0
  238. package/dist/tailwind-base.js +33 -0
  239. package/dist/tailwind-base.js.map +1 -0
  240. package/dist/tailwind-plugin.js +31 -497
  241. package/dist/tailwind-plugin.js.map +1 -1
  242. package/dist/theme.js +60 -0
  243. package/dist/theme.js.map +1 -0
  244. package/package.json +9 -11
  245. package/dist/animations/index.mjs +0 -8
  246. package/dist/animations/index.mjs.map +0 -1
  247. package/dist/chunk-36NLQKQR.mjs +0 -22
  248. package/dist/chunk-36NLQKQR.mjs.map +0 -1
  249. package/dist/chunk-3FFF7Q7C.mjs +0 -55
  250. package/dist/chunk-3FFF7Q7C.mjs.map +0 -1
  251. package/dist/chunk-GTI4HTES.mjs +0 -386
  252. package/dist/chunk-GTI4HTES.mjs.map +0 -1
  253. package/dist/colors/index.mjs +0 -8
  254. package/dist/colors/index.mjs.map +0 -1
  255. package/dist/global.css.map +0 -1
  256. package/dist/index.d.mts +0 -1299
  257. package/dist/index.mjs +0 -5910
  258. package/dist/index.mjs.map +0 -1
  259. package/dist/tailwind-plugin.mjs +0 -67
  260. package/dist/tailwind-plugin.mjs.map +0 -1
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __rest = (this && this.__rest) || function (s, e) {
36
+ var t = {};
37
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38
+ t[p] = s[p];
39
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
40
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
41
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
42
+ t[p[i]] = s[p[i]];
43
+ }
44
+ return t;
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.iconButtonVariants = exports.IconButton = void 0;
48
+ const jsx_runtime_1 = require("react/jsx-runtime");
49
+ const React = __importStar(require("react"));
50
+ const class_variance_authority_1 = require("class-variance-authority");
51
+ const Button_1 = require("../Button");
52
+ const utils_1 = require("../../lib/utils");
53
+ /**
54
+ * An icon button is a `Button` with the label taken out, so it takes its
55
+ * colours from `buttonVariants` rather than restating them. That import is
56
+ * the point rather than an economy: the two sit beside each other in a
57
+ * toolbar, so a variant that gained a hover state or a focus ring in one and
58
+ * not the other would be visible in the gap between them.
59
+ *
60
+ * `size: null` is how cva is told to skip a variant *and* its default, so
61
+ * `Button`'s padding and text sizes are left off entirely and the square
62
+ * below is the only thing setting the box.
63
+ *
64
+ * Which is the other half of the borrowing: a `Button`'s height is arithmetic
65
+ * -- padding plus line box plus border, with compound variants putting
66
+ * `secondary`'s 2px back -- and there is no line box here to add up, because
67
+ * there is no text. So the height is set outright, as `Input` sets its own,
68
+ * and `border-box` absorbs `secondary`'s border rather than a compound
69
+ * variant having to. The numbers are `Button`'s, measured: an icon button
70
+ * belongs in a row with one.
71
+ */
72
+ const iconButtonVariants = (0, class_variance_authority_1.cva)(['shrink-0', '[&>svg]:shrink-0'], {
73
+ variants: {
74
+ /**
75
+ * The box is square and matches the `Button` of the same name, so the two
76
+ * line up in a row. `xs` and `sm` are the same 36px box there as well --
77
+ * what separates them is the size of what is inside, `text-xs` against
78
+ * `text-sm` in `Button` and a 14px icon against a 16px one here.
79
+ *
80
+ * The icon is sized from here rather than left to the caller, so a row of
81
+ * them agrees without each one repeating an `h-4 w-4` and an icon drawn
82
+ * at some other size cannot set the row's height. `[&>svg]` is the same
83
+ * selector `Input` and `Password` size their own icons with. Being a
84
+ * selector it also outranks a class on the icon itself, so the override
85
+ * is `[&>svg]:h-6 [&>svg]:w-6` in the button's `className`, which
86
+ * `tailwind-merge` takes as replacing this rather than joining it.
87
+ */
88
+ size: {
89
+ lg: ['h-12', 'w-12', '[&>svg]:h-5', '[&>svg]:w-5'],
90
+ md: ['h-10', 'w-10', '[&>svg]:h-4', '[&>svg]:w-4'],
91
+ sm: ['h-9', 'w-9', '[&>svg]:h-4', '[&>svg]:w-4'],
92
+ xs: ['h-9', 'w-9', '[&>svg]:h-3.5', '[&>svg]:w-3.5']
93
+ },
94
+ shape: {
95
+ // `Button`'s own corner, so a square icon button beside a text one is
96
+ // the same shape.
97
+ rounded: 'rounded-lg',
98
+ circle: 'rounded-full'
99
+ }
100
+ },
101
+ defaultVariants: {
102
+ size: 'md',
103
+ shape: 'rounded'
104
+ }
105
+ });
106
+ exports.iconButtonVariants = iconButtonVariants;
107
+ /**
108
+ * Whether the unnamed-button warning has already gone out in this pass.
109
+ *
110
+ * `StrictMode` invokes a component body twice in development to surface impure
111
+ * renders, and both invocations reach the `console.error` below, so one button
112
+ * prints the message twice.
113
+ *
114
+ * `useRef` is the obvious guard and does not work: React rebuilds the hook
115
+ * state for the second invocation, so the ref arrives fresh with `current`
116
+ * false and both passes warn. Measured rather than assumed --
117
+ * `__tests__/icon-button-strict-mode.test.tsx` mounts one under `StrictMode`
118
+ * and counts, and it counts two without this. `useEffect` would dedupe and is
119
+ * worse: effects do not run on the server, so the warning would vanish from
120
+ * every server render and from the rest of this suite, which is where it is
121
+ * most likely to be seen.
122
+ *
123
+ * So a module-level flag, cleared on a microtask rather than never. Both of
124
+ * `StrictMode`'s invocations are synchronous and land in the same pass, so
125
+ * they collapse into one message, while a re-render in some later task warns
126
+ * again. That last part is the reason for the microtask: a warning that fires
127
+ * once per session and then goes quiet cannot be told apart from a warning you
128
+ * have fixed.
129
+ */
130
+ let warnedThisPass = false;
131
+ const warnUnnamed = () => {
132
+ if (warnedThisPass)
133
+ return;
134
+ warnedThisPass = true;
135
+ queueMicrotask(() => {
136
+ warnedThisPass = false;
137
+ });
138
+ console.error('IconButton: `label` is required and cannot be empty. This button has ' +
139
+ 'rendered with no accessible name, and a screen reader will announce ' +
140
+ 'it as "button" and nothing more. Pass a label saying what the button ' +
141
+ 'does -- "Delete article", not "bin".');
142
+ };
143
+ /**
144
+ * A button whose content is an icon and nothing else: the close on a dialog,
145
+ * the actions at the end of a table row, a toolbar.
146
+ *
147
+ * `label` is required and has no default, which is the one way this differs
148
+ * from every other prop here. An icon button with no accessible name is a
149
+ * control a screen reader announces as "button" and nothing more, and unlike
150
+ * a missing colour it is invisible to everyone who is not affected by it.
151
+ * There is no name that could be guessed from an icon, so the type asks for
152
+ * one rather than inventing it (WCAG 4.1.2).
153
+ *
154
+ * The icon is left out of the accessibility tree by `aria-label` itself,
155
+ * which replaces an element's contents when the name is computed, so the icon
156
+ * needs no `aria-hidden` of its own. What the icon must not carry is a
157
+ * `title`, which would put a browser tooltip on it that the button's own
158
+ * `Tooltip` did not put there. That one is unreachable from here: `icon` is a
159
+ * `ReactNode`, so there is nothing to type-check.
160
+ *
161
+ * `title` is off the button as well, which is the one prop of a `<button>`
162
+ * this component takes away. It is not that it competes for the name --
163
+ * `title` is the last resort in the naming order, behind both `aria-label`
164
+ * and the contents, so while there is a label it never wins. It is that every
165
+ * reason to reach for it here is already served by something better, and
166
+ * served properly: a tooltip is `Tooltip`, which is reachable by keyboard and
167
+ * by touch as a native one is not, and a name is `label`. What is left is a
168
+ * second tooltip doubling up with the first, and a name that appears out of
169
+ * nowhere in the one case where `label` resolved empty. Neither is worth a
170
+ * prop, so the type stops it at the point where it can still be changed
171
+ * cheaply.
172
+ *
173
+ * Only the type stops it. A `title` arriving through an untyped spread is
174
+ * passed to the element like any other attribute, because deleting an
175
+ * attribute a caller explicitly set is a worse surprise than rendering it.
176
+ *
177
+ * `type` defaults to `"button"`. A bare `<button>` inside a form is a submit
178
+ * button, and an icon button is most often a close or a remove -- the one
179
+ * place that default does the most damage.
180
+ */
181
+ const IconButton = React.forwardRef((_a, ref) => {
182
+ var { className, variant, size, shape, icon, label, type = 'button', 'aria-label': ariaLabel } = _a, props = __rest(_a, ["className", "variant", "size", "shape", "icon", "label", "type", 'aria-label']);
183
+ // An `aria-label` of the caller's own wins, and an empty one falls back
184
+ // rather than being spread over the top of `label` -- a button holding a
185
+ // required name and then blanking it has only one reading, and it is not
186
+ // the one where the name goes away silently. `aria-labelledby` is not
187
+ // weighed against either: it beats them both wherever it is passed, which
188
+ // is the naming order in the specification rather than anything decided
189
+ // here.
190
+ //
191
+ // Trimmed, because the name-computation algorithm trims before it decides
192
+ // whether a label is empty, so a `label` of `" "` is exactly as unnamed as
193
+ // one of `""` -- and `label` is typed `string`, which stops neither. The
194
+ // type is the guard against a name being forgotten; this is the guard
195
+ // against one being supplied and empty, which the type cannot express.
196
+ //
197
+ // Nothing is invented when both are empty. There is no name that could be
198
+ // guessed from an icon, and a placeholder would be worse than none: it
199
+ // would silence the failure with something untrue. So the attribute comes
200
+ // off entirely instead of going on empty. The computed name is the same
201
+ // either way -- an empty `aria-label` is skipped and the algorithm falls
202
+ // through to the contents, which are an icon and say nothing -- but the
203
+ // markup is not. `aria-label=""` reads as a deliberate suppression, and
204
+ // linters and reviewers take it for one. A button with no `aria-label` at
205
+ // all is plainly unnamed, and axe's `button-name` rule says so in the
206
+ // consumer's own CI rather than the component quietly asserting a name it
207
+ // does not have.
208
+ const name = (ariaLabel === null || ariaLabel === void 0 ? void 0 : ariaLabel.trim()) || (label === null || label === void 0 ? void 0 : label.trim()) || undefined;
209
+ // ...and says so in development, where the person who can fix it is
210
+ // looking, rather than leaving it for a consumer's axe run to find.
211
+ //
212
+ // No other component here warns, and the line between them is worth
213
+ // stating rather than assuming. What the others cannot express is
214
+ // contextual -- whether the page holds a second `ButtonGroup`, whether a
215
+ // heading above a `RadioGroup` already carries its name -- so they cannot
216
+ // know they are wrong and would have to guess. This one knows. An icon
217
+ // button with no accessible name has no valid reading at all, whatever
218
+ // surrounds it, so the certainty is what earns the warning and it does not
219
+ // generalise to a convention for the rest of the library.
220
+ //
221
+ // `aria-labelledby` is exempt: it names the button from text already on
222
+ // the page and beats `aria-label` wherever both appear, so a caller using
223
+ // it has named the button and only fallen foul of the type. It is read
224
+ // from `props` rather than destructured so that it still reaches the
225
+ // element through the spread.
226
+ if (process.env.NODE_ENV !== 'production' &&
227
+ !name &&
228
+ !props['aria-labelledby']) {
229
+ warnUnnamed();
230
+ }
231
+ return ((0, jsx_runtime_1.jsx)("button", Object.assign({ ref: ref, type: type, "aria-label": name, className: (0, utils_1.cn)((0, Button_1.buttonVariants)({ variant, size: null }), iconButtonVariants({ size, shape }), className) }, props, { children: icon })));
232
+ });
233
+ exports.IconButton = IconButton;
234
+ IconButton.displayName = 'IconButton';
235
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/IconButton/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA8B;AAC9B,uEAAiE;AAEjE,sCAA0C;AAC1C,2CAAoC;AAEp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AAE,KAAK,EAAE,CAAC,EACnC,SAAS,CACV,IACG,KAAK,cAER,IAAI,IACE,CACV,CAAA;AACH,CAAC,CACF,CAAA;AAIQ,gCAAU;AAFnB,UAAU,CAAC,WAAW,GAAG,YAAY,CAAA"}
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ declare const formVariants: (props?: ({
3
+ variant?: "success" | "error" | "primary" | null | undefined;
4
+ size?: "default" | "sm" | "lg" | null | undefined;
5
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
6
+ type InputType = 'color' | 'date' | 'datetime-local' | 'email' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week' | (string & {});
7
+ /**
8
+ * `size` is the field's height rather than the HTML attribute of that name,
9
+ * which is omitted. The attribute asks for a width in characters, and the
10
+ * `<input>` here is `flex-grow` inside the field, so it was already being
11
+ * overruled by the layout before it could mean anything.
12
+ */
13
+ interface InputProps extends Omit<React.HTMLProps<HTMLInputElement>, 'size'> {
14
+ variant: 'primary' | 'error' | 'success';
15
+ size?: 'sm' | 'default' | 'lg';
16
+ type: InputType;
17
+ formClassName?: string;
18
+ leftSideClassName?: string;
19
+ leftSideChild?: React.ReactNode;
20
+ rightSideChild?: React.ReactNode;
21
+ labelText?: string;
22
+ helpText?: string;
23
+ clearLabel?: string;
24
+ onClear: () => void;
25
+ }
26
+ declare const Input: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
27
+ export { Input, InputProps, formVariants };
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.formVariants = exports.Input = void 0;
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
19
+ const react_1 = __importDefault(require("react"));
20
+ const utils_1 = require("../../lib/utils");
21
+ const class_variance_authority_1 = require("class-variance-authority");
22
+ const assets_1 = require("../../assets");
23
+ /**
24
+ * The design draws the leading icon at 16x16, so the size is set here rather
25
+ * than left to the icon that is passed in. `react-icons` renders at `1em`,
26
+ * which ties every glyph to whatever font size the field inherits -- a search
27
+ * icon and a caller's own icon then come out at different sizes in the same
28
+ * form, and both move when the surrounding text does.
29
+ */
30
+ const leftSideVariants = (0, class_variance_authority_1.cva)([
31
+ 'flex',
32
+ 'shrink-0',
33
+ 'items-center',
34
+ 'text-inherit',
35
+ '[&>svg]:h-4',
36
+ '[&>svg]:w-4'
37
+ ]);
38
+ /**
39
+ * The clear control is a 24x24 target around a 12x12 glyph: the cross is drawn
40
+ * at 12, and 24 is the smallest target WCAG 2.5.8 accepts. The negative margin
41
+ * is half the difference between the two -- the padding the target gains on
42
+ * the right is taken back out of the field's own padding, so the target grows
43
+ * around the cross rather than pushing it inwards, and the cross stays exactly
44
+ * where the design puts it.
45
+ */
46
+ const rightSideVariants = (0, class_variance_authority_1.cva)([
47
+ 'flex',
48
+ 'h-6',
49
+ 'w-6',
50
+ 'shrink-0',
51
+ '-mr-1.5',
52
+ 'items-center',
53
+ 'justify-center',
54
+ 'self-center text-inherit',
55
+ 'rounded-xs',
56
+ 'focus-visible:outline-2',
57
+ 'focus-visible:outline-offset-2',
58
+ 'focus-visible:outline-current',
59
+ '[&>svg]:h-3',
60
+ '[&>svg]:w-3'
61
+ ]);
62
+ const formVariants = (0, class_variance_authority_1.cva)([
63
+ 'flex',
64
+ 'border',
65
+ 'border-2',
66
+ 'rounded-lg',
67
+ 'overflow-hidden',
68
+ 'px-3',
69
+ 'items-center',
70
+ 'gap-1.5',
71
+ '[&:has(:disabled)]:border-none'
72
+ ], {
73
+ variants: {
74
+ variant: {
75
+ primary: [
76
+ 'border-border-subtle',
77
+ 'dark:border-border-subtle-dark',
78
+ 'bg-background-alt',
79
+ 'dark:bg-background-alt-dark',
80
+ 'hover:border-border-hover',
81
+ 'hover:focus-within:border-border-focus',
82
+ 'dark:hover:focus-within:border-border-focus-dark',
83
+ 'focus-within:shadow-brandGreen',
84
+ 'text-foreground-muted',
85
+ 'dark:text-foreground-muted-dark',
86
+ 'dark:focus-within:shadow-brandGreen10'
87
+ ],
88
+ error: [
89
+ 'border-feedback-error',
90
+ 'text-feedback-error',
91
+ 'bg-red-50',
92
+ 'hover:border-red-700',
93
+ 'focus-within:shadow-red',
94
+ 'dark:border-feedback-error-dark',
95
+ 'dark:text-feedback-error-dark',
96
+ 'dark:bg-background-alt-dark'
97
+ ],
98
+ success: [
99
+ 'border-feedback-success',
100
+ 'text-feedback-success',
101
+ 'bg-green-50',
102
+ 'hover:border-green-700',
103
+ 'focus-within:shadow-green',
104
+ 'dark:border-feedback-success-dark',
105
+ 'dark:text-feedback-success-dark',
106
+ 'dark:bg-background-alt-dark'
107
+ ]
108
+ },
109
+ /**
110
+ * `sm` and `default` are the two heights the design file specifies, and
111
+ * the field had neither: its height was a 12px padding plus whatever
112
+ * line box the inherited font produced, which was 40px when #264 was
113
+ * filed and is 52px today. The design has no size that follows the text
114
+ * like that.
115
+ *
116
+ * So they are heights rather than a padding that adds up to one. That
117
+ * also fixes the disabled field, which drops its 2px border and was 4px
118
+ * shorter than every other field because of it.
119
+ *
120
+ * The two of them match `Select`'s `sm` and `lg` to the pixel, which is
121
+ * what lets a select and an input sit next to each other in a row. The
122
+ * names do not match, and cannot: 42px is the size the design calls
123
+ * regular, so it is the default here, and `Select` had already spent
124
+ * `lg` on it.
125
+ *
126
+ * `lg` is not in the design file. It is 48px because that is the height
127
+ * of a large `Button` -- both of its variants, which is what the
128
+ * compound variants in `Button` are there to line up -- so a large field
129
+ * and the button that submits it are the same height.
130
+ */
131
+ size: {
132
+ sm: ['h-[37px]'],
133
+ default: ['h-[42px]'],
134
+ lg: ['h-[48px]']
135
+ }
136
+ },
137
+ defaultVariants: {
138
+ size: 'default'
139
+ }
140
+ });
141
+ exports.formVariants = formVariants;
142
+ const inputVariants = (0, class_variance_authority_1.cva)(['flex', 'flex-grow', 'items-center', 'outline-hidden', 'bg-transparent'], {
143
+ variants: {
144
+ variant: {
145
+ primary: ['text-foreground', 'dark:text-foreground-dark'],
146
+ error: ['text-feedback-error', 'dark:text-feedback-error-dark'],
147
+ success: ['text-green-700', 'dark:text-feedback-success-dark']
148
+ }
149
+ },
150
+ defaultVariants: {
151
+ variant: 'primary'
152
+ }
153
+ });
154
+ const convertTypeToLeftComponent = (type) => {
155
+ var _a;
156
+ const mapping = {
157
+ search: (0, jsx_runtime_1.jsx)(assets_1.BsSearch, { "aria-hidden": "true" })
158
+ };
159
+ return (_a = mapping[type]) !== null && _a !== void 0 ? _a : null;
160
+ };
161
+ const Input = react_1.default.forwardRef((_a, ref) => {
162
+ var { type, id, className, formClassName, leftSideClassName, variant, size, leftSideChild, rightSideChild, labelText, helpText, clearLabel = 'Clear input', onClear, 'aria-describedby': ariaDescribedby } = _a, props = __rest(_a, ["type", "id", "className", "formClassName", "leftSideClassName", "variant", "size", "leftSideChild", "rightSideChild", "labelText", "helpText", "clearLabel", "onClear", 'aria-describedby']);
163
+ const generatedId = react_1.default.useId();
164
+ const inputId = id !== null && id !== void 0 ? id : generatedId;
165
+ const helpTextId = `${inputId}-helptext`;
166
+ const describedBy = [ariaDescribedby, helpText ? helpTextId : undefined]
167
+ .filter(Boolean)
168
+ .join(' ') || undefined;
169
+ const leftSideComponent = leftSideChild !== null && leftSideChild !== void 0 ? leftSideChild : convertTypeToLeftComponent(type);
170
+ const rightSideComponent = rightSideChild !== null && rightSideChild !== void 0 ? rightSideChild : ((0, jsx_runtime_1.jsx)(assets_1.BsX, { strokeWidth: 0.6, "aria-hidden": "true" }));
171
+ const field = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)(formVariants({ variant, size }), formClassName), children: [leftSideComponent && ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)(leftSideVariants(), leftSideClassName), children: leftSideComponent })), (0, jsx_runtime_1.jsx)("input", Object.assign({ id: inputId, type: type, className: (0, utils_1.cn)(inputVariants({ variant }), className), ref: ref, "aria-describedby": describedBy }, props)), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClear, "aria-label": clearLabel, className: rightSideVariants(), children: rightSideComponent })] }));
172
+ if (!labelText && !helpText) {
173
+ return field;
174
+ }
175
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-3", children: [labelText && ((0, jsx_runtime_1.jsx)("label", { htmlFor: inputId, className: "text-m text-foreground dark:text-foreground-dark", children: labelText })), field, helpText && ((0, jsx_runtime_1.jsx)("span", { id: helpTextId, className: "text-sm text-foreground-muted dark:text-foreground-muted-dark", children: helpText }))] }));
176
+ });
177
+ exports.Input = Input;
178
+ Input.displayName = 'Input';
179
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Input/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,2CAAoC;AACpC,uEAA8C;AAC9C,yCAA4C;AAE5C;;;;;;GAMG;AACH,MAAM,gBAAgB,GAAG,IAAA,8BAAG,EAAC;IAC3B,MAAM;IACN,UAAU;IACV,cAAc;IACd,cAAc;IACd,aAAa;IACb,aAAa;CACd,CAAC,CAAA;AAEF;;;;;;;GAOG;AACH,MAAM,iBAAiB,GAAG,IAAA,8BAAG,EAAC;IAC5B,MAAM;IACN,KAAK;IACL,KAAK;IACL,UAAU;IACV,SAAS;IACT,cAAc;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G,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,CAC3C,uBAAC,YAAG,IAAC,WAAW,EAAE,GAAG,iBAAc,MAAM,GAAG,CAC7C,CAAA;IAED,MAAM,KAAK,GAAG,CACZ,iCAAK,SAAS,EAAE,IAAA,UAAE,EAAC,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,aAAa,CAAC,aAC/D,iBAAiB,IAAI,CACpB,gCAAK,SAAS,EAAE,IAAA,UAAE,EAAC,gBAAgB,EAAE,EAAE,iBAAiB,CAAC,YACtD,iBAAiB,GACd,CACP,EACD,gDACE,EAAE,EAAE,OAAO,EACX,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,IAAA,UAAE,EAAC,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,EACpD,GAAG,EAAE,GAAG,sBACU,WAAW,IACzB,KAAK,EACT,EACF,mCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,gBACJ,UAAU,EACtB,SAAS,EAAE,iBAAiB,EAAE,YAE7B,kBAAkB,GACZ,IACL,CACP,CAAA;IAED,IAAI,CAAC,SAAS,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,CACL,iCAAK,SAAS,EAAC,qBAAqB,aACjC,SAAS,IAAI,CACZ,kCACE,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,kDAAkD,YAE3D,SAAS,GACJ,CACT,EACA,KAAK,EACL,QAAQ,IAAI,CACX,iCACE,EAAE,EAAE,UAAU,EACd,SAAS,EAAC,+DAA+D,YAExE,QAAQ,GACJ,CACR,IACG,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAIQ,sBAAK;AAFd,KAAK,CAAC,WAAW,GAAG,OAAO,CAAA"}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import * as LabelPrimitive from '@radix-ui/react-label';
3
+ import { type VariantProps } from 'class-variance-authority';
4
+ declare const labelVariants: (props?: ({
5
+ size?: "sm" | "md" | "lg" | "xs" | "xl" | null | undefined;
6
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
7
+ interface LabelProps extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>, VariantProps<typeof labelVariants> {
8
+ hintText?: string;
9
+ align?: 'left' | 'right';
10
+ }
11
+ declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
12
+ export { Label, LabelProps };
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ 'use client';
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __rest = (this && this.__rest) || function (s, e) {
37
+ var t = {};
38
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
+ t[p] = s[p];
40
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
41
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
42
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
43
+ t[p[i]] = s[p[i]];
44
+ }
45
+ return t;
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.Label = void 0;
49
+ const jsx_runtime_1 = require("react/jsx-runtime");
50
+ const React = __importStar(require("react"));
51
+ const LabelPrimitive = __importStar(require("@radix-ui/react-label"));
52
+ const class_variance_authority_1 = require("class-variance-authority");
53
+ const utils_1 = require("../../lib/utils");
54
+ const labelVariants = (0, class_variance_authority_1.cva)('font-medium leading-normal peer-disabled:cursor-not-allowed peer-disabled:opacity-70 dark:text-foreground-inverse', {
55
+ variants: {
56
+ size: {
57
+ lg: 'text-lg',
58
+ md: 'text-md',
59
+ sm: 'text-sm',
60
+ xs: 'text-xs',
61
+ xl: 'text-xl'
62
+ }
63
+ },
64
+ defaultVariants: {
65
+ size: 'sm'
66
+ }
67
+ });
68
+ const alignVariants = (0, class_variance_authority_1.cva)('', {
69
+ variants: {
70
+ align: {
71
+ left: 'text-left',
72
+ right: 'text-right'
73
+ }
74
+ },
75
+ defaultVariants: {
76
+ align: 'left'
77
+ }
78
+ });
79
+ const Label = React.forwardRef((_a, ref) => {
80
+ var { className, size, hintText, align } = _a, props = __rest(_a, ["className", "size", "hintText", "align"]);
81
+ const label = ((0, jsx_runtime_1.jsx)(LabelPrimitive.Root, Object.assign({ ref: ref, className: (0, utils_1.cn)(labelVariants({ size }), alignVariants({ align }), className) }, props)));
82
+ if (hintText) {
83
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [label, (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)(alignVariants({ align }), 'font-semibold text-xs text-foreground-muted dark:text-foreground-muted-dark'), children: hintText })] }));
84
+ }
85
+ return label;
86
+ });
87
+ exports.Label = Label;
88
+ Label.displayName = LabelPrimitive.Root.displayName;
89
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Label/index.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEZ,6CAA8B;AAC9B,sEAAuD;AACvD,uEAAiE;AAEjE,2CAAoC;AAEpC,MAAM,aAAa,GAAG,IAAA,8BAAG,EACvB,mHAAmH,EACnH;IACE,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,EAAE,EAAE,SAAS;YACb,EAAE,EAAE,SAAS;YACb,EAAE,EAAE,SAAS;YACb,EAAE,EAAE,SAAS;YACb,EAAE,EAAE,SAAS;SACd;KACF;IACD,eAAe,EAAE;QACf,IAAI,EAAE,IAAI;KACX;CACF,CACF,CAAA;AAED,MAAM,aAAa,GAAG,IAAA,8BAAG,EAAC,EAAE,EAAE;IAC5B,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,YAAY;SACpB;KACF;IACD,eAAe,EAAE;QACf,KAAK,EAAE,MAAM;KACd;CACF,CAAC,CAAA;AAUF,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAG5B,CAAC,EAA8C,EAAE,GAAG,EAAE,EAAE;QAAvD,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,OAAY,EAAP,KAAK,cAA5C,0CAA8C,CAAF;IAC7C,MAAM,KAAK,GAAG,CACZ,uBAAC,cAAc,CAAC,IAAI,kBAClB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,UAAE,EACX,aAAa,CAAC,EAAE,IAAI,EAAE,CAAC,EACvB,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC,EACxB,SAAS,CACV,IACG,KAAK,EACT,CACH,CAAA;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CACL,iCAAK,SAAS,EAAC,eAAe,aAC3B,KAAK,EACN,gCACE,SAAS,EAAE,IAAA,UAAE,EACX,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC,EACxB,6EAA6E,CAC9E,YAEA,QAAQ,GACL,IACF,CACP,CAAA;IACH,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAC,CAAA;AAGO,sBAAK;AAFd,KAAK,CAAC,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,WAAW,CAAA"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { IconType } from '../../assets';
3
+ interface Props extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
4
+ selected?: boolean;
5
+ icon?: IconType;
6
+ }
7
+ declare const Link: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLAnchorElement>>;
8
+ export { Link };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Link = void 0;
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
19
+ const react_1 = __importDefault(require("react"));
20
+ const utils_1 = require("../../lib/utils");
21
+ const Link = react_1.default.forwardRef((_a, ref) => {
22
+ var { className, onClick, selected = false, children, icon: Icon, 'aria-current': ariaCurrent } = _a, props = __rest(_a, ["className", "onClick", "selected", "children", "icon", 'aria-current']);
23
+ const selectedClasses = 'cursor-default text-white dark:text-foreground-inverse-dark bg-background-inverse dark:bg-background-inverse-dark';
24
+ const hoverClasses = 'hover:bg-grey-100 hover:underline dark:hover:bg-grey-700';
25
+ const focusClasses = 'focus:shadow-brandGreen focus:underline dark:focus:shadow-brandGreen10';
26
+ const unselectedFocusClasses = 'focus:bg-grey-100 dark:focus:bg-grey-700';
27
+ return ((0, jsx_runtime_1.jsxs)("a", Object.assign({ className: (0, utils_1.cn)('flex items-center space-x-3', 'py-1 px-1.5', 'rounded', 'cursor-pointer', 'outline-hidden', 'dark:text-white', focusClasses, selected
28
+ ? selectedClasses
29
+ : `${hoverClasses} ${unselectedFocusClasses}`, className), ref: ref, "aria-current": ariaCurrent !== null && ariaCurrent !== void 0 ? ariaCurrent : (selected ? 'page' : undefined), onClick: e => {
30
+ if (selected) {
31
+ e.preventDefault();
32
+ }
33
+ else {
34
+ onClick === null || onClick === void 0 ? void 0 : onClick(e);
35
+ }
36
+ } }, props, { children: [Icon ? (0, jsx_runtime_1.jsx)(Icon, { className: "mr-1", "aria-hidden": "true" }) : null, children] })));
37
+ });
38
+ exports.Link = Link;
39
+ Link.displayName = 'Link';
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Link/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,2CAAoC;AAQpC,MAAM,IAAI,GAAG,eAAK,CAAC,UAAU,CAC3B,CACE,EAQC,EACD,GAAG,EACH,EAAE;QAVF,EACE,SAAS,EACT,OAAO,EACP,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,WAAW,OAE5B,EADI,KAAK,cAPV,wEAQC,CADS;IAIV,MAAM,eAAe,GACnB,mHAAmH,CAAA;IACrH,MAAM,YAAY,GAChB,0DAA0D,CAAA;IAC5D,MAAM,YAAY,GAChB,wEAAwE,CAAA;IAC1E,MAAM,sBAAsB,GAAG,0CAA0C,CAAA;IAEzE,OAAO,CACL,6CACE,SAAS,EAAE,IAAA,UAAE,EACX,6BAA6B,EAC7B,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,QAAQ;YACN,CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,GAAG,YAAY,IAAI,sBAAsB,EAAE,EAC/C,SAAS,CACV,EACD,GAAG,EAAE,GAAG,kBACM,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,EAC5D,OAAO,EAAE,CAAC,CAAC,EAAE;YACX,IAAI,QAAQ,EAAE,CAAC;gBACb,CAAC,CAAC,cAAc,EAAE,CAAA;YACpB,CAAC;iBAAM,CAAC;gBACN,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,CAAA;YACd,CAAC;QACH,CAAC,IACG,KAAK,eAER,IAAI,CAAC,CAAC,CAAC,uBAAC,IAAI,IAAC,SAAS,EAAC,MAAM,iBAAa,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,EAC1D,QAAQ,KACP,CACL,CAAA;AACH,CAAC,CACF,CAAA;AAIQ,oBAAI;AAFb,IAAI,CAAC,WAAW,GAAG,MAAM,CAAA"}
@@ -0,0 +1,26 @@
1
+ import * as React from 'react';
2
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
3
+ import { type VariantProps } from 'class-variance-authority';
4
+ declare const Modal: React.FC<DialogPrimitive.DialogProps>;
5
+ declare const ModalTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
+ declare const ModalPortal: React.FC<DialogPrimitive.DialogPortalProps>;
7
+ declare const ModalCloseFooter: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
8
+ declare const ModalOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
+ declare const ModalContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
+ declare const headerVariants: (props?: ({
11
+ variant?: "form" | "default" | null | undefined;
12
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
13
+ declare const ModalHeader: {
14
+ ({ className, variant, ...props }: React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof headerVariants>): React.JSX.Element;
15
+ displayName: string;
16
+ };
17
+ declare const ModalFooter: {
18
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
19
+ displayName: string;
20
+ };
21
+ declare const ModalTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
22
+ declare const ModalClose: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
23
+ declare const ModalDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & VariantProps<(props?: ({
24
+ variant?: "form" | "default" | null | undefined;
25
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLParagraphElement>>;
26
+ export { Modal, ModalPortal, ModalOverlay, ModalClose, ModalCloseFooter, ModalTrigger, ModalContent, ModalHeader, ModalFooter, ModalTitle, ModalDescription };