@usefragments/ui 1.3.3 → 1.4.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 (137) hide show
  1. package/dist/assets/ui.css +1176 -766
  2. package/dist/chart.cjs +60 -24
  3. package/dist/chart.js +38 -24
  4. package/dist/colorpicker.cjs +56 -9
  5. package/dist/colorpicker.js +34 -9
  6. package/dist/components/Badge/Badge.module.scss.cjs +23 -16
  7. package/dist/components/Badge/Badge.module.scss.js +23 -16
  8. package/dist/components/Badge/index.cjs +8 -1
  9. package/dist/components/Badge/index.d.ts +3 -0
  10. package/dist/components/Badge/index.d.ts.map +1 -1
  11. package/dist/components/Badge/index.js +8 -1
  12. package/dist/components/Button/Button.module.scss.cjs +16 -13
  13. package/dist/components/Button/Button.module.scss.js +16 -13
  14. package/dist/components/Button/index.d.ts +2 -1
  15. package/dist/components/Button/index.d.ts.map +1 -1
  16. package/dist/components/Chart/index.d.ts +3 -0
  17. package/dist/components/Chart/index.d.ts.map +1 -1
  18. package/dist/components/CodeBlock/CodeBlock.module.scss.cjs +21 -21
  19. package/dist/components/CodeBlock/CodeBlock.module.scss.js +21 -21
  20. package/dist/components/ColorPicker/index.d.ts +4 -0
  21. package/dist/components/ColorPicker/index.d.ts.map +1 -1
  22. package/dist/components/Combobox/Combobox.module.scss.cjs +23 -23
  23. package/dist/components/Combobox/Combobox.module.scss.js +23 -23
  24. package/dist/components/Command/Command.module.scss.cjs +11 -11
  25. package/dist/components/Command/Command.module.scss.js +11 -11
  26. package/dist/components/ConversationList/ConversationList.module.scss.cjs +13 -10
  27. package/dist/components/ConversationList/ConversationList.module.scss.js +14 -11
  28. package/dist/components/ConversationList/index.cjs +26 -22
  29. package/dist/components/ConversationList/index.d.ts +5 -1
  30. package/dist/components/ConversationList/index.d.ts.map +1 -1
  31. package/dist/components/ConversationList/index.js +27 -23
  32. package/dist/components/DataTable/index.d.ts +4 -1
  33. package/dist/components/DataTable/index.d.ts.map +1 -1
  34. package/dist/components/DatePicker/index.d.ts +3 -0
  35. package/dist/components/DatePicker/index.d.ts.map +1 -1
  36. package/dist/components/Editor/index.d.ts +4 -1
  37. package/dist/components/Editor/index.d.ts.map +1 -1
  38. package/dist/components/Listbox/Listbox.module.scss.cjs +8 -8
  39. package/dist/components/Listbox/Listbox.module.scss.js +8 -8
  40. package/dist/components/Markdown/Markdown.module.scss.cjs +1 -1
  41. package/dist/components/Markdown/Markdown.module.scss.js +1 -1
  42. package/dist/components/Markdown/index.d.ts +16 -0
  43. package/dist/components/Markdown/index.d.ts.map +1 -1
  44. package/dist/components/Menu/Menu.module.scss.cjs +14 -14
  45. package/dist/components/Menu/Menu.module.scss.js +14 -14
  46. package/dist/components/Message/Message.module.scss.cjs +23 -20
  47. package/dist/components/Message/Message.module.scss.js +24 -21
  48. package/dist/components/Message/index.cjs +5 -1
  49. package/dist/components/Message/index.d.ts.map +1 -1
  50. package/dist/components/Message/index.js +5 -1
  51. package/dist/components/NavigationMenu/NavigationMenu.module.scss.cjs +28 -28
  52. package/dist/components/NavigationMenu/NavigationMenu.module.scss.js +28 -28
  53. package/dist/components/Pagination/Pagination.module.scss.cjs +7 -7
  54. package/dist/components/Pagination/Pagination.module.scss.js +7 -7
  55. package/dist/components/Prompt/Prompt.module.scss.cjs +52 -22
  56. package/dist/components/Prompt/Prompt.module.scss.js +52 -22
  57. package/dist/components/Prompt/index.cjs +197 -2
  58. package/dist/components/Prompt/index.d.ts +98 -3
  59. package/dist/components/Prompt/index.d.ts.map +1 -1
  60. package/dist/components/Prompt/index.js +198 -3
  61. package/dist/components/Select/Select.module.scss.cjs +29 -17
  62. package/dist/components/Select/Select.module.scss.js +30 -18
  63. package/dist/components/Select/index.cjs +45 -8
  64. package/dist/components/Select/index.d.ts +17 -2
  65. package/dist/components/Select/index.d.ts.map +1 -1
  66. package/dist/components/Select/index.js +45 -8
  67. package/dist/components/Sidebar/Sidebar.module.scss.cjs +45 -42
  68. package/dist/components/Sidebar/Sidebar.module.scss.js +45 -42
  69. package/dist/components/Sidebar/index.cjs +2 -0
  70. package/dist/components/Sidebar/index.d.ts +6 -1
  71. package/dist/components/Sidebar/index.d.ts.map +1 -1
  72. package/dist/components/Sidebar/index.js +2 -0
  73. package/dist/components/Text/Text.module.scss.cjs +63 -51
  74. package/dist/components/Text/Text.module.scss.js +63 -51
  75. package/dist/components/Text/index.d.ts +4 -2
  76. package/dist/components/Text/index.d.ts.map +1 -1
  77. package/dist/data-table.cjs +210 -28
  78. package/dist/data-table.js +189 -29
  79. package/dist/datepicker.cjs +63 -14
  80. package/dist/datepicker.js +41 -14
  81. package/dist/editor.cjs +67 -16
  82. package/dist/editor.js +45 -16
  83. package/dist/index.cjs +1 -0
  84. package/dist/index.d.ts +1 -1
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +2 -1
  87. package/dist/markdown.cjs +63 -19
  88. package/dist/markdown.js +41 -19
  89. package/fragments.json +1 -1
  90. package/package.json +2 -2
  91. package/src/components/Badge/Badge.contract.json +28 -5
  92. package/src/components/Badge/Badge.module.scss +21 -0
  93. package/src/components/Badge/index.tsx +10 -1
  94. package/src/components/Button/Button.contract.json +9 -3
  95. package/src/components/Button/Button.module.scss +34 -0
  96. package/src/components/Button/index.tsx +11 -1
  97. package/src/components/Chart/Chart.contract.json +7 -0
  98. package/src/components/Chart/index.tsx +44 -27
  99. package/src/components/CodeBlock/CodeBlock.contract.json +7 -0
  100. package/src/components/CodeBlock/CodeBlock.module.scss +7 -2
  101. package/src/components/ColorPicker/ColorPicker.contract.json +9 -1
  102. package/src/components/ColorPicker/index.tsx +42 -12
  103. package/src/components/Combobox/Combobox.module.scss +4 -13
  104. package/src/components/ConversationList/ConversationList.contract.json +16 -1
  105. package/src/components/ConversationList/ConversationList.module.scss +12 -0
  106. package/src/components/ConversationList/index.tsx +40 -26
  107. package/src/components/DataTable/DataTable.contract.json +8 -1
  108. package/src/components/DataTable/index.tsx +282 -51
  109. package/src/components/DatePicker/DatePicker.contract.json +8 -1
  110. package/src/components/DatePicker/index.tsx +51 -22
  111. package/src/components/Editor/Editor.contract.json +19 -1
  112. package/src/components/Editor/index.tsx +67 -23
  113. package/src/components/Listbox/Listbox.module.scss +3 -11
  114. package/src/components/Markdown/Markdown.contract.json +15 -1
  115. package/src/components/Markdown/Markdown.module.scss +18 -1
  116. package/src/components/Markdown/index.tsx +58 -24
  117. package/src/components/Menu/Menu.module.scss +12 -2
  118. package/src/components/Message/Message.contract.json +3 -0
  119. package/src/components/Message/Message.module.scss +33 -4
  120. package/src/components/Message/index.tsx +7 -1
  121. package/src/components/Pagination/Pagination.contract.json +1 -0
  122. package/src/components/Pagination/Pagination.module.scss +5 -4
  123. package/src/components/Prompt/Prompt.contract.json +40 -1
  124. package/src/components/Prompt/Prompt.module.scss +351 -4
  125. package/src/components/Prompt/index.tsx +324 -0
  126. package/src/components/Select/Select.contract.json +11 -1
  127. package/src/components/Select/Select.module.scss +80 -13
  128. package/src/components/Select/index.tsx +73 -7
  129. package/src/components/Sidebar/Sidebar.contract.json +1 -0
  130. package/src/components/Sidebar/Sidebar.module.scss +10 -0
  131. package/src/components/Sidebar/index.tsx +7 -0
  132. package/src/components/Text/Text.contract.json +7 -4
  133. package/src/components/Text/Text.module.scss +18 -0
  134. package/src/components/Text/index.tsx +4 -2
  135. package/src/index.ts +1 -0
  136. package/src/tokens/_mixins.scss +39 -4
  137. package/src/tokens/_variables.scss +30 -0
package/dist/chart.cjs CHANGED
@@ -1,5 +1,27 @@
1
1
  "use client";
2
2
  "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
3
25
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
26
  const jsxRuntime = require("react/jsx-runtime");
5
27
  const React = require("react");
@@ -24,18 +46,40 @@ function _interopNamespaceDefault(e) {
24
46
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
25
47
  let _RechartsTooltip = null;
26
48
  let _RechartsLegend = null;
27
- let _chartLoaded = false;
49
+ let _chartLoadPromise = null;
28
50
  let _chartFailed = false;
29
51
  function loadChartDeps() {
30
- if (_chartLoaded) return;
31
- _chartLoaded = true;
32
- try {
33
- const rc = require("recharts");
34
- _RechartsTooltip = rc.Tooltip;
35
- _RechartsLegend = rc.Legend;
36
- } catch {
37
- _chartFailed = true;
52
+ if (!_chartLoadPromise) {
53
+ _chartLoadPromise = (async () => {
54
+ try {
55
+ const rc = await import("recharts");
56
+ _RechartsTooltip = rc.Tooltip;
57
+ _RechartsLegend = rc.Legend;
58
+ } catch {
59
+ _chartFailed = true;
60
+ if (process.env.NODE_ENV === "development") {
61
+ console.warn(
62
+ "[@usefragments/ui] Chart: recharts is not installed. Install it with: npm install recharts"
63
+ );
64
+ }
65
+ }
66
+ })();
38
67
  }
68
+ return _chartLoadPromise;
69
+ }
70
+ function useChartDeps() {
71
+ const [, rerender] = React__namespace.useReducer((n) => n + 1, 0);
72
+ React__namespace.useEffect(() => {
73
+ if (_RechartsTooltip || _chartFailed) return;
74
+ let active = true;
75
+ void loadChartDeps().then(() => {
76
+ if (active) rerender();
77
+ });
78
+ return () => {
79
+ active = false;
80
+ };
81
+ }, []);
82
+ return _RechartsTooltip !== null;
39
83
  }
40
84
  const ChartConfigContext = React__namespace.createContext(null);
41
85
  function useChartConfig() {
@@ -148,7 +192,7 @@ function ChartTooltip({
148
192
  content,
149
193
  ...props
150
194
  }) {
151
- loadChartDeps();
195
+ const chartReady = useChartDeps();
152
196
  const defaultContent = React__namespace.useCallback(
153
197
  (tooltipProps) => /* @__PURE__ */ jsxRuntime.jsx(
154
198
  ChartTooltipContent,
@@ -163,12 +207,7 @@ function ChartTooltip({
163
207
  ),
164
208
  [indicator, hideLabel, hideIndicator, labelFormatter, valueFormatter]
165
209
  );
166
- if (_chartFailed || !_RechartsTooltip) {
167
- if (_chartFailed && process.env.NODE_ENV === "development") {
168
- console.warn(
169
- "[@usefragments/ui] Chart: recharts is not installed. Install it with: npm install recharts"
170
- );
171
- }
210
+ if (!chartReady || !_RechartsTooltip) {
172
211
  return null;
173
212
  }
174
213
  const RechartsTooltipComponent = _RechartsTooltip;
@@ -202,14 +241,9 @@ function ChartLegendContent({ payload }) {
202
241
  }) });
203
242
  }
204
243
  function ChartLegend({ content, ...props }) {
205
- loadChartDeps();
244
+ const chartReady = useChartDeps();
206
245
  const defaultContent = (legendProps) => /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, { ...legendProps });
207
- if (_chartFailed || !_RechartsLegend) {
208
- if (_chartFailed && process.env.NODE_ENV === "development") {
209
- console.warn(
210
- "[@usefragments/ui] Chart: recharts is not installed. Install it with: npm install recharts"
211
- );
212
- }
246
+ if (!chartReady || !_RechartsLegend) {
213
247
  return null;
214
248
  }
215
249
  const RechartsLegendComponent = _RechartsLegend;
@@ -226,7 +260,9 @@ const Chart = Object.assign(ChartContainer, {
226
260
  Tooltip: ChartTooltip,
227
261
  TooltipContent: ChartTooltipContent,
228
262
  Legend: ChartLegend,
229
- LegendContent: ChartLegendContent
263
+ LegendContent: ChartLegendContent,
264
+ /** Start resolving recharts before first render (optional). */
265
+ preload: loadChartDeps
230
266
  });
231
267
  exports.Chart = Chart;
232
268
  exports.ChartContainer = ChartContainer;
package/dist/chart.js CHANGED
@@ -5,18 +5,40 @@ import { mergeAriaIds } from "./utils/aria.js";
5
5
  import styles from "./components/Chart/Chart.module.scss.js";
6
6
  let _RechartsTooltip = null;
7
7
  let _RechartsLegend = null;
8
- let _chartLoaded = false;
8
+ let _chartLoadPromise = null;
9
9
  let _chartFailed = false;
10
10
  function loadChartDeps() {
11
- if (_chartLoaded) return;
12
- _chartLoaded = true;
13
- try {
14
- const rc = require("recharts");
15
- _RechartsTooltip = rc.Tooltip;
16
- _RechartsLegend = rc.Legend;
17
- } catch {
18
- _chartFailed = true;
11
+ if (!_chartLoadPromise) {
12
+ _chartLoadPromise = (async () => {
13
+ try {
14
+ const rc = await import("recharts");
15
+ _RechartsTooltip = rc.Tooltip;
16
+ _RechartsLegend = rc.Legend;
17
+ } catch {
18
+ _chartFailed = true;
19
+ if (process.env.NODE_ENV === "development") {
20
+ console.warn(
21
+ "[@usefragments/ui] Chart: recharts is not installed. Install it with: npm install recharts"
22
+ );
23
+ }
24
+ }
25
+ })();
19
26
  }
27
+ return _chartLoadPromise;
28
+ }
29
+ function useChartDeps() {
30
+ const [, rerender] = React.useReducer((n) => n + 1, 0);
31
+ React.useEffect(() => {
32
+ if (_RechartsTooltip || _chartFailed) return;
33
+ let active = true;
34
+ void loadChartDeps().then(() => {
35
+ if (active) rerender();
36
+ });
37
+ return () => {
38
+ active = false;
39
+ };
40
+ }, []);
41
+ return _RechartsTooltip !== null;
20
42
  }
21
43
  const ChartConfigContext = React.createContext(null);
22
44
  function useChartConfig() {
@@ -129,7 +151,7 @@ function ChartTooltip({
129
151
  content,
130
152
  ...props
131
153
  }) {
132
- loadChartDeps();
154
+ const chartReady = useChartDeps();
133
155
  const defaultContent = React.useCallback(
134
156
  (tooltipProps) => /* @__PURE__ */ jsx(
135
157
  ChartTooltipContent,
@@ -144,12 +166,7 @@ function ChartTooltip({
144
166
  ),
145
167
  [indicator, hideLabel, hideIndicator, labelFormatter, valueFormatter]
146
168
  );
147
- if (_chartFailed || !_RechartsTooltip) {
148
- if (_chartFailed && process.env.NODE_ENV === "development") {
149
- console.warn(
150
- "[@usefragments/ui] Chart: recharts is not installed. Install it with: npm install recharts"
151
- );
152
- }
169
+ if (!chartReady || !_RechartsTooltip) {
153
170
  return null;
154
171
  }
155
172
  const RechartsTooltipComponent = _RechartsTooltip;
@@ -183,14 +200,9 @@ function ChartLegendContent({ payload }) {
183
200
  }) });
184
201
  }
185
202
  function ChartLegend({ content, ...props }) {
186
- loadChartDeps();
203
+ const chartReady = useChartDeps();
187
204
  const defaultContent = (legendProps) => /* @__PURE__ */ jsx(ChartLegendContent, { ...legendProps });
188
- if (_chartFailed || !_RechartsLegend) {
189
- if (_chartFailed && process.env.NODE_ENV === "development") {
190
- console.warn(
191
- "[@usefragments/ui] Chart: recharts is not installed. Install it with: npm install recharts"
192
- );
193
- }
205
+ if (!chartReady || !_RechartsLegend) {
194
206
  return null;
195
207
  }
196
208
  const RechartsLegendComponent = _RechartsLegend;
@@ -207,7 +219,9 @@ const Chart = Object.assign(ChartContainer, {
207
219
  Tooltip: ChartTooltip,
208
220
  TooltipContent: ChartTooltipContent,
209
221
  Legend: ChartLegend,
210
- LegendContent: ChartLegendContent
222
+ LegendContent: ChartLegendContent,
223
+ /** Start resolving recharts before first render (optional). */
224
+ preload: loadChartDeps
211
225
  });
212
226
  export {
213
227
  Chart,
@@ -1,5 +1,27 @@
1
1
  "use client";
2
2
  "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
3
25
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
26
  const jsxRuntime = require("react/jsx-runtime");
5
27
  const React = require("react");
@@ -26,15 +48,38 @@ function _interopNamespaceDefault(e) {
26
48
  }
27
49
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
28
50
  let _HexColorPicker = null;
29
- let _colorfulLoaded = false;
51
+ let _colorfulLoadPromise = null;
52
+ let _colorfulFailed = false;
30
53
  function loadColorfulDeps() {
31
- if (_colorfulLoaded) return;
32
- _colorfulLoaded = true;
33
- try {
34
- const rc = require("react-colorful");
35
- _HexColorPicker = rc.HexColorPicker;
36
- } catch {
54
+ if (!_colorfulLoadPromise) {
55
+ _colorfulLoadPromise = (async () => {
56
+ try {
57
+ const rc = await import("react-colorful");
58
+ _HexColorPicker = rc.HexColorPicker;
59
+ } catch {
60
+ _colorfulFailed = true;
61
+ if (process.env.NODE_ENV === "development") {
62
+ console.warn(
63
+ "[@usefragments/ui] ColorPicker: react-colorful is not installed. Install it with: npm install react-colorful"
64
+ );
65
+ }
66
+ }
67
+ })();
37
68
  }
69
+ return _colorfulLoadPromise;
70
+ }
71
+ function useColorfulDeps() {
72
+ const [, rerender] = React__namespace.useReducer((n) => n + 1, 0);
73
+ React__namespace.useEffect(() => {
74
+ if (_HexColorPicker || _colorfulFailed) return;
75
+ let active = true;
76
+ void loadColorfulDeps().then(() => {
77
+ if (active) rerender();
78
+ });
79
+ return () => {
80
+ active = false;
81
+ };
82
+ }, []);
38
83
  }
39
84
  const ColorPickerRoot = React__namespace.forwardRef(function ColorPicker2({
40
85
  label,
@@ -53,7 +98,7 @@ const ColorPickerRoot = React__namespace.forwardRef(function ColorPicker2({
53
98
  }, ref) {
54
99
  const size = index.useResolvedControlSize(sizeProp);
55
100
  const resolvedHelperText = helperText ?? description;
56
- loadColorfulDeps();
101
+ useColorfulDeps();
57
102
  const [internalValue, setInternalValue] = React__namespace.useState(defaultValue);
58
103
  const [inputValue, setInputValue] = React__namespace.useState(value ?? defaultValue);
59
104
  const displayValue = value !== void 0 ? value : internalValue;
@@ -145,6 +190,8 @@ const ColorPickerRoot = React__namespace.forwardRef(function ColorPicker2({
145
190
  );
146
191
  });
147
192
  const ColorPicker = Object.assign(ColorPickerRoot, {
148
- Root: ColorPickerRoot
193
+ Root: ColorPickerRoot,
194
+ /** Start resolving react-colorful before first render (optional). */
195
+ preload: loadColorfulDeps
149
196
  });
150
197
  exports.ColorPicker = ColorPicker;
@@ -7,15 +7,38 @@ import { useResolvedControlSize } from "./components/ComponentDefaults/index.js"
7
7
  import { Input } from "./components/Input/index.js";
8
8
  import styles from "./components/ColorPicker/ColorPicker.module.scss.js";
9
9
  let _HexColorPicker = null;
10
- let _colorfulLoaded = false;
10
+ let _colorfulLoadPromise = null;
11
+ let _colorfulFailed = false;
11
12
  function loadColorfulDeps() {
12
- if (_colorfulLoaded) return;
13
- _colorfulLoaded = true;
14
- try {
15
- const rc = require("react-colorful");
16
- _HexColorPicker = rc.HexColorPicker;
17
- } catch {
13
+ if (!_colorfulLoadPromise) {
14
+ _colorfulLoadPromise = (async () => {
15
+ try {
16
+ const rc = await import("react-colorful");
17
+ _HexColorPicker = rc.HexColorPicker;
18
+ } catch {
19
+ _colorfulFailed = true;
20
+ if (process.env.NODE_ENV === "development") {
21
+ console.warn(
22
+ "[@usefragments/ui] ColorPicker: react-colorful is not installed. Install it with: npm install react-colorful"
23
+ );
24
+ }
25
+ }
26
+ })();
18
27
  }
28
+ return _colorfulLoadPromise;
29
+ }
30
+ function useColorfulDeps() {
31
+ const [, rerender] = React.useReducer((n) => n + 1, 0);
32
+ React.useEffect(() => {
33
+ if (_HexColorPicker || _colorfulFailed) return;
34
+ let active = true;
35
+ void loadColorfulDeps().then(() => {
36
+ if (active) rerender();
37
+ });
38
+ return () => {
39
+ active = false;
40
+ };
41
+ }, []);
19
42
  }
20
43
  const ColorPickerRoot = React.forwardRef(function ColorPicker2({
21
44
  label,
@@ -34,7 +57,7 @@ const ColorPickerRoot = React.forwardRef(function ColorPicker2({
34
57
  }, ref) {
35
58
  const size = useResolvedControlSize(sizeProp);
36
59
  const resolvedHelperText = helperText ?? description;
37
- loadColorfulDeps();
60
+ useColorfulDeps();
38
61
  const [internalValue, setInternalValue] = React.useState(defaultValue);
39
62
  const [inputValue, setInputValue] = React.useState(value ?? defaultValue);
40
63
  const displayValue = value !== void 0 ? value : internalValue;
@@ -126,7 +149,9 @@ const ColorPickerRoot = React.forwardRef(function ColorPicker2({
126
149
  );
127
150
  });
128
151
  const ColorPicker = Object.assign(ColorPickerRoot, {
129
- Root: ColorPickerRoot
152
+ Root: ColorPickerRoot,
153
+ /** Start resolving react-colorful before first render (optional). */
154
+ preload: loadColorfulDeps
130
155
  });
131
156
  export {
132
157
  ColorPicker
@@ -1,26 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const badge = "_badge_pckit_1";
4
- const sm = "_sm_pckit_14";
5
- const md = "_md_pckit_19";
6
- const lg = "_lg_pckit_24";
7
- const success = "_success_pckit_34";
8
- const warning = "_warning_pckit_39";
9
- const error = "_error_pckit_44";
10
- const info = "_info_pckit_49";
11
- const outline = "_outline_pckit_54";
12
- const label = "_label_pckit_60";
13
- const dim = "_dim_pckit_71";
14
- const active = "_active_pckit_82";
15
- const dot = "_dot_pckit_88";
16
- const icon = "_icon_pckit_100";
17
- const remove = "_remove_pckit_105";
3
+ const badge = "_badge_1luxf_1";
4
+ const sm = "_sm_1luxf_14";
5
+ const md = "_md_1luxf_19";
6
+ const lg = "_lg_1luxf_24";
7
+ const success = "_success_1luxf_34";
8
+ const warning = "_warning_1luxf_39";
9
+ const error = "_error_1luxf_44";
10
+ const info = "_info_1luxf_49";
11
+ const outline = "_outline_1luxf_54";
12
+ const label = "_label_1luxf_60";
13
+ const dim = "_dim_1luxf_71";
14
+ const active = "_active_1luxf_82";
15
+ const dot = "_dot_1luxf_88";
16
+ const dotPulse = "_dotPulse_1luxf_100";
17
+ const fuiBadgeDotPulse = "_fui-badge-dot-pulse_1luxf_1";
18
+ const icon = "_icon_1luxf_114";
19
+ const remove = "_remove_1luxf_119";
18
20
  const styles = {
19
21
  badge,
20
22
  sm,
21
23
  md,
22
24
  lg,
23
- "default": "_default_pckit_29",
25
+ "default": "_default_1luxf_29",
24
26
  success,
25
27
  warning,
26
28
  error,
@@ -30,6 +32,9 @@ const styles = {
30
32
  dim,
31
33
  active,
32
34
  dot,
35
+ dotPulse,
36
+ "fui-badge-dot-pulse": "_fui-badge-dot-pulse_1luxf_1",
37
+ fuiBadgeDotPulse,
33
38
  icon,
34
39
  remove
35
40
  };
@@ -38,7 +43,9 @@ exports.badge = badge;
38
43
  exports.default = styles;
39
44
  exports.dim = dim;
40
45
  exports.dot = dot;
46
+ exports.dotPulse = dotPulse;
41
47
  exports.error = error;
48
+ exports.fuiBadgeDotPulse = fuiBadgeDotPulse;
42
49
  exports.icon = icon;
43
50
  exports.info = info;
44
51
  exports.label = label;
@@ -1,24 +1,26 @@
1
- const badge = "_badge_pckit_1";
2
- const sm = "_sm_pckit_14";
3
- const md = "_md_pckit_19";
4
- const lg = "_lg_pckit_24";
5
- const success = "_success_pckit_34";
6
- const warning = "_warning_pckit_39";
7
- const error = "_error_pckit_44";
8
- const info = "_info_pckit_49";
9
- const outline = "_outline_pckit_54";
10
- const label = "_label_pckit_60";
11
- const dim = "_dim_pckit_71";
12
- const active = "_active_pckit_82";
13
- const dot = "_dot_pckit_88";
14
- const icon = "_icon_pckit_100";
15
- const remove = "_remove_pckit_105";
1
+ const badge = "_badge_1luxf_1";
2
+ const sm = "_sm_1luxf_14";
3
+ const md = "_md_1luxf_19";
4
+ const lg = "_lg_1luxf_24";
5
+ const success = "_success_1luxf_34";
6
+ const warning = "_warning_1luxf_39";
7
+ const error = "_error_1luxf_44";
8
+ const info = "_info_1luxf_49";
9
+ const outline = "_outline_1luxf_54";
10
+ const label = "_label_1luxf_60";
11
+ const dim = "_dim_1luxf_71";
12
+ const active = "_active_1luxf_82";
13
+ const dot = "_dot_1luxf_88";
14
+ const dotPulse = "_dotPulse_1luxf_100";
15
+ const fuiBadgeDotPulse = "_fui-badge-dot-pulse_1luxf_1";
16
+ const icon = "_icon_1luxf_114";
17
+ const remove = "_remove_1luxf_119";
16
18
  const styles = {
17
19
  badge,
18
20
  sm,
19
21
  md,
20
22
  lg,
21
- "default": "_default_pckit_29",
23
+ "default": "_default_1luxf_29",
22
24
  success,
23
25
  warning,
24
26
  error,
@@ -28,6 +30,9 @@ const styles = {
28
30
  dim,
29
31
  active,
30
32
  dot,
33
+ dotPulse,
34
+ "fui-badge-dot-pulse": "_fui-badge-dot-pulse_1luxf_1",
35
+ fuiBadgeDotPulse,
31
36
  icon,
32
37
  remove
33
38
  };
@@ -37,7 +42,9 @@ export {
37
42
  styles as default,
38
43
  dim,
39
44
  dot,
45
+ dotPulse,
40
46
  error,
47
+ fuiBadgeDotPulse,
41
48
  icon,
42
49
  info,
43
50
  label,
@@ -27,6 +27,7 @@ const BadgeRoot = React__namespace.forwardRef(function Badge2({
27
27
  variant = "default",
28
28
  size = "md",
29
29
  dot = false,
30
+ dotPulse = false,
30
31
  dotColor,
31
32
  icon,
32
33
  active = false,
@@ -57,7 +58,13 @@ const BadgeRoot = React__namespace.forwardRef(function Badge2({
57
58
  role: role ?? (announce ? "status" : void 0),
58
59
  "aria-label": effectiveAriaLabel,
59
60
  children: [
60
- dot && /* @__PURE__ */ jsxRuntime.jsx("span", { className: Badge_module.default.dot, "aria-hidden": "true" }),
61
+ dot && /* @__PURE__ */ jsxRuntime.jsx(
62
+ "span",
63
+ {
64
+ className: [Badge_module.default.dot, dotPulse && Badge_module.default.dotPulse].filter(Boolean).join(" "),
65
+ "aria-hidden": "true"
66
+ }
67
+ ),
61
68
  icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: Badge_module.default.icon, "aria-hidden": "true", children: icon }),
62
69
  /* @__PURE__ */ jsxRuntime.jsx("span", { children }),
63
70
  onRemove && /* @__PURE__ */ jsxRuntime.jsx(
@@ -21,6 +21,9 @@ export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
21
21
  size?: "sm" | "md" | "lg";
22
22
  /** Show a status dot before the label */
23
23
  dot?: boolean;
24
+ /** Breathe the status dot, for a state that is still happening rather than
25
+ * one that has settled. Respects `prefers-reduced-motion`. */
26
+ dotPulse?: boolean;
24
27
  /** Color for the leading status dot. Applies to `variant="label"` (and the
25
28
  * generic `dot` prop). Accepts any CSS color including CSS custom properties. */
26
29
  dotColor?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;GAGG;AACH,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;IACvE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;;;;;;iEAS6D;IAC7D,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;IAC7F;uBACmB;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,yCAAyC;IACzC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd;qFACiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;yBACqB;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;wBACoB;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAuED,eAAO,MAAM,KAAK;;CAEhB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;GAGG;AACH,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;IACvE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;;;;;;iEAS6D;IAC7D,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;IAC7F;uBACmB;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,yCAAyC;IACzC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd;kEAC8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;qFACiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;yBACqB;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;wBACoB;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA6ED,eAAO,MAAM,KAAK;;CAEhB,CAAC"}
@@ -8,6 +8,7 @@ const BadgeRoot = React.forwardRef(function Badge2({
8
8
  variant = "default",
9
9
  size = "md",
10
10
  dot = false,
11
+ dotPulse = false,
11
12
  dotColor,
12
13
  icon,
13
14
  active = false,
@@ -38,7 +39,13 @@ const BadgeRoot = React.forwardRef(function Badge2({
38
39
  role: role ?? (announce ? "status" : void 0),
39
40
  "aria-label": effectiveAriaLabel,
40
41
  children: [
41
- dot && /* @__PURE__ */ jsx("span", { className: styles.dot, "aria-hidden": "true" }),
42
+ dot && /* @__PURE__ */ jsx(
43
+ "span",
44
+ {
45
+ className: [styles.dot, dotPulse && styles.dotPulse].filter(Boolean).join(" "),
46
+ "aria-hidden": "true"
47
+ }
48
+ ),
42
49
  icon && /* @__PURE__ */ jsx("span", { className: styles.icon, "aria-hidden": "true", children: icon }),
43
50
  /* @__PURE__ */ jsx("span", { children }),
44
51
  onRemove && /* @__PURE__ */ jsx(
@@ -1,18 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const button = "_button_1xsqy_1";
4
- const xs = "_xs_1xsqy_75";
5
- const sm = "_sm_1xsqy_81";
6
- const md = "_md_1xsqy_87";
7
- const lg = "_lg_1xsqy_93";
8
- const icon = "_icon_1xsqy_99";
9
- const primary = "_primary_1xsqy_106";
10
- const secondary = "_secondary_1xsqy_121";
11
- const ghost = "_ghost_1xsqy_133";
12
- const link = "_link_1xsqy_145";
13
- const danger = "_danger_1xsqy_165";
14
- const outlined = "_outlined_1xsqy_193";
15
- const fullWidth = "_fullWidth_1xsqy_222";
3
+ const button = "_button_1bc7y_1";
4
+ const xs = "_xs_1bc7y_75";
5
+ const sm = "_sm_1bc7y_81";
6
+ const md = "_md_1bc7y_87";
7
+ const lg = "_lg_1bc7y_93";
8
+ const icon = "_icon_1bc7y_99";
9
+ const primary = "_primary_1bc7y_106";
10
+ const secondary = "_secondary_1bc7y_121";
11
+ const ghost = "_ghost_1bc7y_133";
12
+ const link = "_link_1bc7y_145";
13
+ const quiet = "_quiet_1bc7y_165";
14
+ const danger = "_danger_1bc7y_186";
15
+ const outlined = "_outlined_1bc7y_214";
16
+ const fullWidth = "_fullWidth_1bc7y_243";
16
17
  const styles = {
17
18
  button,
18
19
  xs,
@@ -24,6 +25,7 @@ const styles = {
24
25
  secondary,
25
26
  ghost,
26
27
  link,
28
+ quiet,
27
29
  danger,
28
30
  outlined,
29
31
  fullWidth
@@ -39,6 +41,7 @@ exports.link = link;
39
41
  exports.md = md;
40
42
  exports.outlined = outlined;
41
43
  exports.primary = primary;
44
+ exports.quiet = quiet;
42
45
  exports.secondary = secondary;
43
46
  exports.sm = sm;
44
47
  exports.xs = xs;
@@ -1,16 +1,17 @@
1
- const button = "_button_1xsqy_1";
2
- const xs = "_xs_1xsqy_75";
3
- const sm = "_sm_1xsqy_81";
4
- const md = "_md_1xsqy_87";
5
- const lg = "_lg_1xsqy_93";
6
- const icon = "_icon_1xsqy_99";
7
- const primary = "_primary_1xsqy_106";
8
- const secondary = "_secondary_1xsqy_121";
9
- const ghost = "_ghost_1xsqy_133";
10
- const link = "_link_1xsqy_145";
11
- const danger = "_danger_1xsqy_165";
12
- const outlined = "_outlined_1xsqy_193";
13
- const fullWidth = "_fullWidth_1xsqy_222";
1
+ const button = "_button_1bc7y_1";
2
+ const xs = "_xs_1bc7y_75";
3
+ const sm = "_sm_1bc7y_81";
4
+ const md = "_md_1bc7y_87";
5
+ const lg = "_lg_1bc7y_93";
6
+ const icon = "_icon_1bc7y_99";
7
+ const primary = "_primary_1bc7y_106";
8
+ const secondary = "_secondary_1bc7y_121";
9
+ const ghost = "_ghost_1bc7y_133";
10
+ const link = "_link_1bc7y_145";
11
+ const quiet = "_quiet_1bc7y_165";
12
+ const danger = "_danger_1bc7y_186";
13
+ const outlined = "_outlined_1bc7y_214";
14
+ const fullWidth = "_fullWidth_1bc7y_243";
14
15
  const styles = {
15
16
  button,
16
17
  xs,
@@ -22,6 +23,7 @@ const styles = {
22
23
  secondary,
23
24
  ghost,
24
25
  link,
26
+ quiet,
25
27
  danger,
26
28
  outlined,
27
29
  fullWidth
@@ -38,6 +40,7 @@ export {
38
40
  md,
39
41
  outlined,
40
42
  primary,
43
+ quiet,
41
44
  secondary,
42
45
  sm,
43
46
  xs