@povio/ui 5.0.0-rc.13 → 5.0.0-rc.15

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 (82) hide show
  1. package/README.md +8 -0
  2. package/dist/{AppCanvasPage-DtWEvs_Y.js → AppCanvasPage-BnyCHO3I.js} +152 -462
  3. package/dist/{AppCanvasPage-BZ2mrKY4.d.ts → AppCanvasPage-U9SxNwjS.d.ts} +1 -1
  4. package/dist/{BottomSheet-BXLE3161.js → BottomSheet-AqYVSMK9.js} +1 -75
  5. package/dist/BottomSheetHeader-Be6Elvs2.js +79 -0
  6. package/dist/{Calendar-DRHruqr_.js → Calendar-1p3VjSED.js} +3 -3
  7. package/dist/{CanvasComponentsFrame-CbgJJv-3.js → CanvasComponentsFrame-Dp0oDDoH.js} +6 -6
  8. package/dist/{UIConfigurator-DekPXjv9.js → CanvasInspector-DdP3mHUY.js} +1707 -522
  9. package/dist/{ComponentGallery-COqEqqN6.js → ComponentGallery-C_rXFvUY.js} +250 -1797
  10. package/dist/{DatePicker-xDEqzNJv.js → DatePicker-CAzuZRmd.js} +6 -6
  11. package/dist/{DatePickerInput-B0fEeCOf.js → DatePickerInput-BeQOVCk0.js} +4 -3
  12. package/dist/{DateRangePicker-DxuVhRaf.js → DateRangePicker-X3mBhfmL.js} +5 -5
  13. package/dist/{DateTimePicker-4N1Pka07.js → DateTimePicker-EtmGtoRe.js} +6 -6
  14. package/dist/{InputItem-Cv19Hwnx.js → InputItem-yC5oMyN-.js} +7 -7
  15. package/dist/{Inputs-D1aE_J9f.js → Inputs-Bd2nRNqk.js} +1 -1
  16. package/dist/{NumberRangeInput-Bzfe-RlV.js → NumberRangeInput-TkPXiWV3.js} +2 -2
  17. package/dist/{RichTextEditor-Bd7F5D8f.js → RichTextEditor-DiaPcBUM.js} +110 -32
  18. package/dist/{Select-CgIhoWgk.js → Select-tNlFSbAC.js} +5 -5
  19. package/dist/{Table-piX1SWvN.js → Table-CgG02oHQ.js} +1 -1
  20. package/dist/{TextArea-uPffb457.js → TextArea-DuvFUjts.js} +1 -1
  21. package/dist/{TimePicker-DN-i98z5.js → TimePicker-CBkiE-Yq.js} +5 -4
  22. package/dist/{TooltipWrapper-CDHFaUKZ.js → TooltipWrapper-CSXs5-E3.js} +2 -2
  23. package/dist/components/autocomplete.js +3 -3
  24. package/dist/components/bottom-sheet.js +1 -1
  25. package/dist/components/date-picker.js +1 -1
  26. package/dist/components/date-range-picker.js +1 -1
  27. package/dist/components/date-time-picker.js +1 -1
  28. package/dist/components/input.js +3 -3
  29. package/dist/components/number-field.js +3 -3
  30. package/dist/components/number-range-input.js +1 -1
  31. package/dist/components/query-autocomplete.js +1 -1
  32. package/dist/components/query-select.js +2 -2
  33. package/dist/components/select.js +1 -1
  34. package/dist/components/text-area.js +1 -1
  35. package/dist/components/time-picker.js +1 -1
  36. package/dist/config/app-canvas-tanstack.d.ts +1 -1
  37. package/dist/config/app-canvas-tanstack.js +1 -1
  38. package/dist/config/app-canvas.d.ts +1 -1
  39. package/dist/config/app-canvas.js +1 -1
  40. package/dist/config/ui-configurator-vite.d.ts +2 -0
  41. package/dist/config/ui-configurator-vite.js +234 -8
  42. package/dist/config/ui-configurator.d.ts +21 -2
  43. package/dist/config/ui-configurator.js +121 -3
  44. package/dist/{datePickerValue.utils-QWR2q5Vv.js → datePickerValue.utils-BDB6KM8q.js} +1 -1
  45. package/dist/demos-DIwj5vc0.js +2011 -0
  46. package/dist/index.js +7 -7
  47. package/dist/{logger-CqZjM-sn.js → logger-CW24po62.js} +10 -1
  48. package/dist/rhf/date-picker.js +1 -1
  49. package/dist/rhf/date-range-picker.js +1 -1
  50. package/dist/rhf/date-time-picker.js +1 -1
  51. package/dist/rhf/number-range-input.js +1 -1
  52. package/dist/rhf/rich-text-editor.js +1 -1
  53. package/dist/rhf/select.js +1 -1
  54. package/dist/rhf/text-area.js +1 -1
  55. package/dist/rhf/time-picker.js +1 -1
  56. package/dist/rhf.js +7 -7
  57. package/dist/rich-text-editor.js +1 -1
  58. package/dist/{staticDateTimeSegments-BWea3HAt.js → staticDateTimeSegments-Bs1_N5MR.js} +1 -1
  59. package/dist/{staticSelect.utils-BfTCi26B.js → staticSelect.utils-BgdYv2vP.js} +5 -4
  60. package/dist/styles/app-canvas.css +30 -24
  61. package/dist/styles/configurator.css +544 -34
  62. package/dist/tanstack/date-picker.js +1 -1
  63. package/dist/tanstack/date-range-picker.js +1 -1
  64. package/dist/tanstack/date-time-picker.js +1 -1
  65. package/dist/tanstack/form.js +1 -1
  66. package/dist/tanstack/inputs.js +1 -1
  67. package/dist/tanstack/number-range-input.js +1 -1
  68. package/dist/tanstack/rich-text-editor.js +1 -1
  69. package/dist/tanstack/select.js +1 -1
  70. package/dist/tanstack/table.js +2 -2
  71. package/dist/tanstack/text-area.js +1 -1
  72. package/dist/tanstack/time-picker.js +1 -1
  73. package/dist/tanstack.js +15 -15
  74. package/dist/token-classes-BqLWiy6O.js +245 -0
  75. package/dist/{useFieldAccessibility-B-bjtrNw.js → useFieldAccessibility-DnCdz938.js} +2 -1
  76. package/dist/{useFormAutosave-pmh35PXp.js → useFormAutosave-CxqZAJAB.js} +1 -1
  77. package/dist/{useStaticInputHandoff-B7DEm75m.js → useStaticInputHandoff-DKsxpVck.js} +2 -1
  78. package/dist/{useTableColumnConfig-CNJ_ZvIN.js → useTableColumnConfig-BnbKElno.js} +1 -1
  79. package/dist/utils/logger.js +1 -1
  80. package/package.json +1 -1
  81. package/dist/groups-oQmSeqXn.js +0 -18
  82. package/dist/underline-66hmELxa.js +0 -81
@@ -1,55 +1,29 @@
1
+ import { n as __exportAll } from "./logger-CW24po62.js";
1
2
  import { t as createLucideIcon } from "./createLucideIcon-LcezOE4z.js";
2
- import { o as inspectTokens } from "./UIConfigurator-DekPXjv9.js";
3
3
  import { n as ArrowLeft } from "./DropdownMenu-5jmtgLXd.js";
4
- import { i as ArrowRight } from "./DropdownMenuDesktop-Cl9gZVq0.js";
5
- import { n as Italic, r as Bold, t as Underline } from "./underline-66hmELxa.js";
6
- import { s as Calendar, t as UIConfig } from "./uiConfig.context-BS3r_kTS.js";
7
4
  import { t as Check } from "./check-DYMBkp_Z.js";
8
- import { t as ChevronDown } from "./chevron-down-B4Pr8bD3.js";
9
- import { t as ChevronUp } from "./chevron-up-D_Gqpb5M.js";
10
5
  import { t as FileUpload } from "./FileUpload-Cx98L1jz.js";
11
6
  import { t as PasswordInput } from "./PasswordInput-DYwUZ4-k.js";
12
- import { t as Table } from "./Table-piX1SWvN.js";
13
- import { t as Info } from "./info-iUmX3uDk.js";
7
+ import { t as Table } from "./Table-CgG02oHQ.js";
8
+ import { t as demos } from "./demos-DIwj5vc0.js";
14
9
  import { i as Search } from "./selectDesktop.cva-CHAMxhfO.js";
15
10
  import { t as UIOverrides } from "./uiOverrides.context-BTCH9y5a.js";
16
11
  import { t as Breadcrumbs } from "./Breadcrumbs-FF8hMfXd.js";
17
12
  import { t as Checkbox } from "./Checkbox-D3f2Plbc.js";
18
- import { t as Slider } from "./Slider-CMg0BXJO.js";
19
- import { t as Accordion } from "./Accordion-BzwO4_ml.js";
20
- import { t as RadioGroup } from "./RadioGroup-efBKgTYA.js";
21
13
  import { t as Switch } from "./Switch-CqnGEdeD.js";
22
- import { t as TextArea } from "./TextArea-uPffb457.js";
23
- import { i as menuPopoverWrapperDefinition, n as menuItemDefinition, r as menuPopoverDefinition, t as dropdownMenuDefinition } from "./dropdownMenu.cva-DvEmX0bs.js";
24
- import { i as tooltipTextDefinition, n as tooltipPointerHorizontalDefinition, t as tooltipDefinition } from "./tooltip.cva-BIzlOXHH.js";
25
- import { t as Typography } from "./Typography-LU4z2pR1.js";
26
- import { t as Spinner } from "./Spinner-BeVTUzzx.js";
14
+ import { t as TextArea } from "./TextArea-DuvFUjts.js";
15
+ import { n as menuItemDefinition, t as dropdownMenuDefinition } from "./dropdownMenu.cva-DvEmX0bs.js";
27
16
  import { t as Button } from "./Button-C5rv4Cr2.js";
28
17
  import { IconButton } from "./components/icon-button.js";
29
- import { BadgeButton } from "./components/badge-button.js";
30
- import { SplitButton } from "./components/split-button.js";
31
- import { TextButton } from "./components/text-button.js";
32
- import { ToggleButton } from "./components/toggle-button.js";
33
18
  import { t as Tag } from "./Tag-DPg5sL1Z.js";
34
- import { t as popoverDefinition } from "./popover.cva-Bhud1wnp.js";
35
19
  import { Input } from "./components/input.js";
36
- import { Autocomplete } from "./components/autocomplete.js";
37
- import { CheckboxGroup } from "./components/checkbox-group.js";
38
- import { t as TimePicker } from "./TimePicker-DN-i98z5.js";
39
- import { t as ToggleGroup } from "./ToggleGroup-DmVPNWok.js";
40
- import { t as DatePicker } from "./DatePicker-xDEqzNJv.js";
41
- import { t as Select } from "./Select-CgIhoWgk.js";
20
+ import { t as Select } from "./Select-tNlFSbAC.js";
42
21
  import { t as Progress } from "./Progress-B3mY9rIP.js";
43
- import { NumberField } from "./components/number-field.js";
44
- import { t as Stepper } from "./Stepper-Cp5vbL5g.js";
45
- import { n as dialogMainDefinition, t as dialogContentDefinition } from "./dialog.cva-COhDZaVl.js";
46
22
  import { t as Dialog } from "./Dialog-9manOgMA.js";
47
23
  import { Pagination } from "./components/pagination.js";
48
- import { t as Alert } from "./Alert-CnvEb1D_.js";
49
- import { t as Toast } from "./Toast-DtG3pA61.js";
50
24
  import { Link } from "./components/link.js";
51
25
  import { Badge } from "./components/badge.js";
52
- import { n as galleryGroups } from "./groups-oQmSeqXn.js";
26
+ import { t as inspectTokens } from "./token-classes-BqLWiy6O.js";
53
27
  import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
54
28
  import { c } from "react/compiler-runtime";
55
29
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -61,7 +35,7 @@ import { UNSAFE_PortalProvider } from "react-aria";
61
35
  * This source code is licensed under the ISC license.
62
36
  * See the LICENSE file in the root directory of this source tree.
63
37
  */
64
- const __iconData$9 = {
38
+ const __iconData$6 = {
65
39
  name: "bell",
66
40
  size: 24,
67
41
  node: [["path", {
@@ -72,8 +46,8 @@ const __iconData$9 = {
72
46
  key: "11g9vi"
73
47
  }]]
74
48
  };
75
- __iconData$9.node;
76
- const Bell = createLucideIcon(__iconData$9);
49
+ __iconData$6.node;
50
+ const Bell = createLucideIcon(__iconData$6);
77
51
  //#endregion
78
52
  //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/credit-card.mjs
79
53
  /**
@@ -82,7 +56,7 @@ const Bell = createLucideIcon(__iconData$9);
82
56
  * This source code is licensed under the ISC license.
83
57
  * See the LICENSE file in the root directory of this source tree.
84
58
  */
85
- const __iconData$8 = {
59
+ const __iconData$5 = {
86
60
  name: "credit-card",
87
61
  size: 24,
88
62
  node: [["rect", {
@@ -100,30 +74,8 @@ const __iconData$8 = {
100
74
  key: "1b3vmo"
101
75
  }]]
102
76
  };
103
- __iconData$8.node;
104
- const CreditCard = createLucideIcon(__iconData$8);
105
- //#endregion
106
- //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/house.mjs
107
- /**
108
- * @license lucide-react v1.43.0 - ISC
109
- *
110
- * This source code is licensed under the ISC license.
111
- * See the LICENSE file in the root directory of this source tree.
112
- */
113
- const __iconData$7 = {
114
- name: "house",
115
- size: 24,
116
- node: [["path", {
117
- d: "M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",
118
- key: "5wwlr5"
119
- }], ["path", {
120
- d: "M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
121
- key: "r6nss1"
122
- }]],
123
- aliases: ["home"]
124
- };
125
- __iconData$7.node;
126
- const House = createLucideIcon(__iconData$7);
77
+ __iconData$5.node;
78
+ const CreditCard = createLucideIcon(__iconData$5);
127
79
  //#endregion
128
80
  //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/maximize-2.mjs
129
81
  /**
@@ -132,7 +84,7 @@ const House = createLucideIcon(__iconData$7);
132
84
  * This source code is licensed under the ISC license.
133
85
  * See the LICENSE file in the root directory of this source tree.
134
86
  */
135
- const __iconData$6 = {
87
+ const __iconData$4 = {
136
88
  name: "maximize-2",
137
89
  size: 24,
138
90
  node: [
@@ -154,8 +106,8 @@ const __iconData$6 = {
154
106
  }]
155
107
  ]
156
108
  };
157
- __iconData$6.node;
158
- const Maximize2 = createLucideIcon(__iconData$6);
109
+ __iconData$4.node;
110
+ const Maximize2 = createLucideIcon(__iconData$4);
159
111
  //#endregion
160
112
  //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/minimize-2.mjs
161
113
  /**
@@ -164,7 +116,7 @@ const Maximize2 = createLucideIcon(__iconData$6);
164
116
  * This source code is licensed under the ISC license.
165
117
  * See the LICENSE file in the root directory of this source tree.
166
118
  */
167
- const __iconData$5 = {
119
+ const __iconData$3 = {
168
120
  name: "minimize-2",
169
121
  size: 24,
170
122
  node: [
@@ -186,52 +138,8 @@ const __iconData$5 = {
186
138
  }]
187
139
  ]
188
140
  };
189
- __iconData$5.node;
190
- const Minimize2 = createLucideIcon(__iconData$5);
191
- //#endregion
192
- //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/send.mjs
193
- /**
194
- * @license lucide-react v1.43.0 - ISC
195
- *
196
- * This source code is licensed under the ISC license.
197
- * See the LICENSE file in the root directory of this source tree.
198
- */
199
- const __iconData$4 = {
200
- name: "send",
201
- size: 24,
202
- node: [["path", {
203
- d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",
204
- key: "1ffxy3"
205
- }], ["path", {
206
- d: "m21.854 2.147-10.94 10.939",
207
- key: "12cjpa"
208
- }]]
209
- };
210
- __iconData$4.node;
211
- const Send = createLucideIcon(__iconData$4);
212
- //#endregion
213
- //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/settings.mjs
214
- /**
215
- * @license lucide-react v1.43.0 - ISC
216
- *
217
- * This source code is licensed under the ISC license.
218
- * See the LICENSE file in the root directory of this source tree.
219
- */
220
- const __iconData$3 = {
221
- name: "settings",
222
- size: 24,
223
- node: [["path", {
224
- d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
225
- key: "1i5ecw"
226
- }], ["circle", {
227
- cx: "12",
228
- cy: "12",
229
- r: "3",
230
- key: "1v7zrd"
231
- }]]
232
- };
233
141
  __iconData$3.node;
234
- const Settings = createLucideIcon(__iconData$3);
142
+ const Minimize2 = createLucideIcon(__iconData$3);
235
143
  //#endregion
236
144
  //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/shield-check.mjs
237
145
  /**
@@ -341,1626 +249,203 @@ function Inspector({ isKnown, describe, onSelect, revision, children }) {
341
249
  top: px(style.borderTopWidth) * scale,
342
250
  right: px(style.borderRightWidth) * scale,
343
251
  bottom: px(style.borderBottomWidth) * scale,
344
- left: px(style.borderLeftWidth) * scale
345
- };
346
- const pad = {
347
- top: px(style.paddingTop) * scale,
348
- right: px(style.paddingRight) * scale,
349
- bottom: px(style.paddingBottom) * scale,
350
- left: px(style.paddingLeft) * scale
351
- };
352
- const inner = {
353
- x: left + border.left,
354
- y: top + border.top,
355
- width: box.width - border.left - border.right,
356
- height: box.height - border.top - border.bottom
357
- };
358
- const next = [];
359
- const add = (kind, token, key, x, y, width, height) => {
360
- if (token && width > .5 && height > .5) next.push({
361
- key,
362
- kind,
363
- token,
364
- label: describe(token),
365
- x,
366
- y,
367
- width,
368
- height
369
- });
370
- };
371
- add("padding", tokens.padding.top, "pt", inner.x, inner.y, inner.width, pad.top);
372
- add("padding", tokens.padding.bottom, "pb", inner.x, inner.y + inner.height - pad.bottom, inner.width, pad.bottom);
373
- add("padding", tokens.padding.left, "pl", inner.x, inner.y + pad.top, pad.left, inner.height - pad.top - pad.bottom);
374
- add("padding", tokens.padding.right, "pr", inner.x + inner.width - pad.right, inner.y + pad.top, pad.right, inner.height - pad.top - pad.bottom);
375
- if (tokens.gap.row || tokens.gap.column) {
376
- const children_0 = [...target.children].map((child) => child.getBoundingClientRect()).filter((rect) => rect.width > 0 && rect.height > 0);
377
- const contentTop = inner.y + pad.top;
378
- const contentHeight = inner.height - pad.top - pad.bottom;
379
- const contentLeft = inner.x + pad.left;
380
- const contentWidth = inner.width - pad.left - pad.right;
381
- children_0.slice(1).forEach((rect_0, index) => {
382
- const previous = children_0[index];
383
- if (rect_0.left >= previous.right - .5) add("gap", tokens.gap.column, `gx${index}`, previous.right - origin.left, contentTop, rect_0.left - previous.right, contentHeight);
384
- else if (rect_0.top >= previous.bottom - .5) add("gap", tokens.gap.row, `gy${index}`, contentLeft, previous.bottom - origin.top, contentWidth, rect_0.top - previous.bottom);
385
- });
386
- }
387
- if (tokens.radius && px(style.borderTopLeftRadius) > 0) {
388
- const size = Math.min(12, box.width / 3, box.height / 3);
389
- add("radius", tokens.radius, "r-tl", left, top, size, size);
390
- add("radius", tokens.radius, "r-tr", left + box.width - size, top, size, size);
391
- add("radius", tokens.radius, "r-bl", left, top + box.height - size, size, size);
392
- add("radius", tokens.radius, "r-br", left + box.width - size, top + box.height - size, size, size);
393
- }
394
- setRegions(next);
395
- setOutline({
396
- x: left,
397
- y: top,
398
- width: box.width,
399
- height: box.height
400
- });
401
- }, [
402
- target,
403
- tokensOf,
404
- describe
405
- ]);
406
- useLayoutEffect(measure, [measure, revision]);
407
- useEffect(() => {
408
- const stage_0 = stageRef.current;
409
- const ownerWindow = stage_0?.ownerDocument.defaultView;
410
- if (!stage_0 || !ownerWindow) return;
411
- let frame = 0;
412
- const schedule = () => {
413
- ownerWindow.cancelAnimationFrame(frame);
414
- frame = ownerWindow.requestAnimationFrame(measure);
415
- };
416
- const observer = new ResizeObserver(schedule);
417
- observer.observe(stage_0);
418
- if (target) observer.observe(target);
419
- ownerWindow.addEventListener("scroll", schedule, true);
420
- return () => {
421
- ownerWindow.cancelAnimationFrame(frame);
422
- observer.disconnect();
423
- ownerWindow.removeEventListener("scroll", schedule, true);
424
- };
425
- }, [measure, target]);
426
- const onPointerMove = (event) => {
427
- if (event.target.closest(".studio-inspect-region")) return;
428
- const content = contentRef.current;
429
- if (!content) return;
430
- const hit = content.ownerDocument.elementsFromPoint(event.clientX, event.clientY).find((element_0) => content.contains(element_0) && hasTokens(tokensOf(element_0)));
431
- if (hit && hit !== target) setTarget(hit);
432
- };
433
- return /* @__PURE__ */ jsxs("div", {
434
- ref: stageRef,
435
- className: "studio-inspect-stage",
436
- onPointerMove,
437
- children: [
438
- /* @__PURE__ */ jsx("div", {
439
- ref: contentRef,
440
- className: "studio-inspect-content",
441
- children
442
- }),
443
- /* @__PURE__ */ jsxs("div", {
444
- className: "studio-inspect-layer",
445
- "aria-label": "Token inspector",
446
- children: [
447
- outline && /* @__PURE__ */ jsx("div", {
448
- className: "studio-inspect-outline",
449
- style: {
450
- left: outline.x,
451
- top: outline.y,
452
- width: outline.width,
453
- height: outline.height
454
- }
455
- }),
456
- regions.map((region) => /* @__PURE__ */ jsx("button", {
457
- type: "button",
458
- className: `studio-inspect-region is-${region.kind} ${active === region.token ? "is-active" : ""}`,
459
- style: {
460
- left: region.x,
461
- top: region.y,
462
- width: region.width,
463
- height: region.height
464
- },
465
- "aria-label": `Edit ${region.kind} ${region.label}`,
466
- title: region.label,
467
- onPointerEnter: () => setActive(region.token),
468
- onPointerLeave: () => setActive(null),
469
- onClick: (event_0) => {
470
- event_0.stopPropagation();
471
- onSelect(region.token);
472
- }
473
- }, region.key)),
474
- active && regions.some((region_1) => region_1.token === active) && /* @__PURE__ */ jsx(InspectLabel, {
475
- region: regions.find((region_0) => region_0.token === active),
476
- stageWidth: stageRef.current?.clientWidth ?? 0
477
- })
478
- ]
479
- }),
480
- !target && /* @__PURE__ */ jsx("p", {
481
- className: "studio-inspect-hint",
482
- children: "Hover the component to see its paddings, gaps and radius."
483
- })
484
- ]
485
- });
486
- }
487
- function InspectLabel(t0) {
488
- const $ = c(10);
489
- const { region, stageWidth } = t0;
490
- const left = Math.max(4, Math.min(region.x, stageWidth - 220));
491
- const t1 = `studio-inspect-label is-${region.kind}`;
492
- const t2 = Math.max(0, region.y - 24);
493
- let t3;
494
- if ($[0] !== left || $[1] !== t2) {
495
- t3 = {
496
- left,
497
- top: t2
498
- };
499
- $[0] = left;
500
- $[1] = t2;
501
- $[2] = t3;
502
- } else t3 = $[2];
503
- let t4;
504
- if ($[3] !== region.kind) {
505
- t4 = /* @__PURE__ */ jsx("strong", { children: region.kind });
506
- $[3] = region.kind;
507
- $[4] = t4;
508
- } else t4 = $[4];
509
- let t5;
510
- if ($[5] !== region.label || $[6] !== t1 || $[7] !== t3 || $[8] !== t4) {
511
- t5 = /* @__PURE__ */ jsxs("div", {
512
- className: t1,
513
- style: t3,
514
- children: [
515
- t4,
516
- " ",
517
- region.label
518
- ]
519
- });
520
- $[5] = region.label;
521
- $[6] = t1;
522
- $[7] = t3;
523
- $[8] = t4;
524
- $[9] = t5;
525
- } else t5 = $[9];
526
- return t5;
527
- }
528
- //#endregion
529
- //#region src/configurator/gallery/demos.tsx
530
- const noop = () => {};
531
- const menuItems = [
532
- {
533
- label: "Edit",
534
- onAction: noop
535
- },
536
- {
537
- label: "Duplicate",
538
- onAction: noop
539
- },
540
- {
541
- label: "Archive",
542
- isDisabled: true,
543
- onAction: noop
544
- }
545
- ];
546
- const eventItems = [
547
- {
548
- id: "1",
549
- label: "Roundtable"
550
- },
551
- {
552
- id: "2",
553
- label: "Conference"
554
- },
555
- {
556
- id: "3",
557
- label: "Meeting"
558
- },
559
- {
560
- id: "4",
561
- label: "Party"
562
- },
563
- {
564
- id: "5",
565
- label: "Disabled item",
566
- isDisabled: true
567
- }
568
- ];
569
- const airportItems = Array.from({ length: 12 }, (_, index) => ({
570
- id: `airport-${index + 1}`,
571
- label: `Airport ${String(index + 1).padStart(3, "0")}`
572
- }));
573
- const groupOptions = [
574
- {
575
- label: "Option 1",
576
- value: "option-1"
577
- },
578
- {
579
- label: "Option 2",
580
- value: "option-2"
581
- },
582
- {
583
- label: "Option 3",
584
- value: "option-3"
585
- }
586
- ];
587
- const accordionContent = /* @__PURE__ */ jsx("p", {
588
- className: "text-text-default-2",
589
- children: "This is the content of the accordion item. It can contain any React elements."
590
- });
591
- const accordionItems = [
592
- {
593
- id: "item1",
594
- heading: "What is your refund policy?",
595
- subheading: "Returns & exchanges",
596
- icon: Info,
597
- children: accordionContent
598
- },
599
- {
600
- id: "item2",
601
- heading: "How do I track my order?",
602
- subheading: "Shipping info",
603
- icon: Info,
604
- children: accordionContent
605
- },
606
- {
607
- id: "item3",
608
- heading: "Do you offer international shipping?",
609
- subheading: "Global delivery",
610
- icon: Info,
611
- children: accordionContent
612
- }
613
- ];
614
- const steps = [
615
- {
616
- id: "1",
617
- title: "Account",
618
- subtext: "Create your account"
619
- },
620
- {
621
- id: "2",
622
- title: "Profile",
623
- subtext: "Tell us about yourself"
624
- },
625
- {
626
- id: "3",
627
- title: "Review",
628
- subtext: "Review your details"
629
- }
630
- ];
631
- const tableRows = [
632
- {
633
- name: "Ada Lovelace",
634
- email: "ada@example.com",
635
- role: "Admin"
636
- },
637
- {
638
- name: "Alan Turing",
639
- email: "alan@example.com",
640
- role: "Editor"
641
- },
642
- {
643
- name: "Grace Hopper",
644
- email: "grace@example.com",
645
- role: "Viewer"
646
- },
647
- {
648
- name: "Linus Torvalds",
649
- email: "linus@example.com",
650
- role: "Editor"
651
- }
652
- ];
653
- const tableColumns = [
654
- {
655
- accessorKey: "name",
656
- header: "Name",
657
- enableSorting: false
658
- },
659
- {
660
- accessorKey: "email",
661
- header: "Email",
662
- enableSorting: false
663
- },
664
- {
665
- accessorKey: "role",
666
- header: "Role",
667
- enableSorting: false
668
- }
669
- ];
670
- function ToggleGroupDemo() {
671
- const $ = c(11);
672
- const [value, setValue] = useState("option1");
673
- let t0;
674
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
675
- t0 = ["bold"];
676
- $[0] = t0;
677
- } else t0 = $[0];
678
- const [format, setFormat] = useState(t0);
679
- let t1;
680
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
681
- t1 = [
682
- {
683
- id: "option1",
684
- label: "Option 1"
685
- },
686
- {
687
- id: "option2",
688
- label: "Option 2"
689
- },
690
- {
691
- id: "option3",
692
- label: "Option 3"
693
- }
694
- ];
695
- $[1] = t1;
696
- } else t1 = $[1];
697
- let t2;
698
- if ($[2] !== value) {
699
- t2 = /* @__PURE__ */ jsx(ToggleGroup, {
700
- "aria-label": "View",
701
- items: t1,
702
- value,
703
- onChange: setValue
704
- });
705
- $[2] = value;
706
- $[3] = t2;
707
- } else t2 = $[3];
708
- let t3;
709
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
710
- t3 = /* @__PURE__ */ jsx(ToggleGroup, {
711
- "aria-label": "Send options",
712
- items: [{
713
- id: "calendar",
714
- label: "Calendar",
715
- icon: Calendar
716
- }, {
717
- id: "send",
718
- label: "Send",
719
- icon: Send
720
- }],
721
- defaultValue: "calendar"
722
- });
723
- $[4] = t3;
724
- } else t3 = $[4];
725
- let t4;
726
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
727
- t4 = [
728
- {
729
- id: "bold",
730
- label: "Bold",
731
- icon: Bold,
732
- iconOnly: true
733
- },
734
- {
735
- id: "italic",
736
- label: "Italic",
737
- icon: Italic,
738
- iconOnly: true
739
- },
740
- {
741
- id: "underline",
742
- label: "Underline",
743
- icon: Underline,
744
- iconOnly: true
745
- }
746
- ];
747
- $[5] = t4;
748
- } else t4 = $[5];
749
- let t5;
750
- if ($[6] !== format) {
751
- t5 = /* @__PURE__ */ jsx(ToggleGroup, {
752
- "aria-label": "Formatting",
753
- selectionMode: "multiple",
754
- items: t4,
755
- value: format,
756
- onChange: setFormat
757
- });
758
- $[6] = format;
759
- $[7] = t5;
760
- } else t5 = $[7];
761
- let t6;
762
- if ($[8] !== t2 || $[9] !== t5) {
763
- t6 = /* @__PURE__ */ jsxs("div", {
764
- className: "flex flex-col items-start gap-3",
765
- children: [
766
- t2,
767
- t3,
768
- t5
769
- ]
770
- });
771
- $[8] = t2;
772
- $[9] = t5;
773
- $[10] = t6;
774
- } else t6 = $[10];
775
- return t6;
776
- }
777
- function CheckboxGroupDemo() {
778
- const $ = c(3);
779
- let t0;
780
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
781
- t0 = ["option-2"];
782
- $[0] = t0;
783
- } else t0 = $[0];
784
- const [value, setValue] = useState(t0);
785
- let t1;
786
- if ($[1] !== value) {
787
- t1 = /* @__PURE__ */ jsx(CheckboxGroup, {
788
- label: "Checkbox group",
789
- options: groupOptions,
790
- value,
791
- onChange: setValue
792
- });
793
- $[1] = value;
794
- $[2] = t1;
795
- } else t1 = $[2];
796
- return t1;
797
- }
798
- function RadioGroupDemo() {
799
- const $ = c(2);
800
- const [value, setValue] = useState("option-1");
801
- let t0;
802
- if ($[0] !== value) {
803
- t0 = /* @__PURE__ */ jsx(RadioGroup, {
804
- label: "Radio group",
805
- options: groupOptions,
806
- value,
807
- onChange: setValue
808
- });
809
- $[0] = value;
810
- $[1] = t0;
811
- } else t0 = $[1];
812
- return t0;
813
- }
814
- function SelectDemo() {
815
- const $ = c(8);
816
- const [value, setValue] = useState("2");
817
- let t0;
818
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
819
- t0 = ["1", "3"];
820
- $[0] = t0;
821
- } else t0 = $[0];
822
- const [multi, setMulti] = useState(t0);
823
- let t1;
824
- if ($[1] !== value) {
825
- t1 = /* @__PURE__ */ jsx(Select, {
826
- label: "Event type",
827
- placeholder: "Ex.: Roundtable",
828
- items: eventItems,
829
- value,
830
- onChange: setValue
831
- });
832
- $[1] = value;
833
- $[2] = t1;
834
- } else t1 = $[2];
835
- let t2;
836
- if ($[3] !== multi) {
837
- t2 = /* @__PURE__ */ jsx(Select, {
838
- label: "Event types",
839
- placeholder: "Select several",
840
- selectionMode: "multiple",
841
- items: eventItems,
842
- value: multi,
843
- onChange: setMulti
844
- });
845
- $[3] = multi;
846
- $[4] = t2;
847
- } else t2 = $[4];
848
- let t3;
849
- if ($[5] !== t1 || $[6] !== t2) {
850
- t3 = /* @__PURE__ */ jsxs("div", {
851
- className: "flex flex-col gap-4",
852
- children: [t1, t2]
853
- });
854
- $[5] = t1;
855
- $[6] = t2;
856
- $[7] = t3;
857
- } else t3 = $[7];
858
- return t3;
859
- }
860
- function AutocompleteDemo() {
861
- const $ = c(2);
862
- const [value, setValue] = useState(null);
863
- let t0;
864
- if ($[0] !== value) {
865
- t0 = /* @__PURE__ */ jsx(Autocomplete, {
866
- label: "Airport",
867
- placeholder: "Choose an airport",
868
- items: airportItems,
869
- value,
870
- onChange: setValue
871
- });
872
- $[0] = value;
873
- $[1] = t0;
874
- } else t0 = $[1];
875
- return t0;
876
- }
877
- function DatePickerDemo() {
878
- const $ = c(2);
879
- const [value, setValue] = useState(null);
880
- let t0;
881
- if ($[0] !== value) {
882
- t0 = /* @__PURE__ */ jsx(DatePicker, {
883
- label: "Date",
884
- value,
885
- onChange: setValue
886
- });
887
- $[0] = value;
888
- $[1] = t0;
889
- } else t0 = $[1];
890
- return t0;
891
- }
892
- function TimePickerDemo() {
893
- const $ = c(2);
894
- const [value, setValue] = useState(null);
895
- let t0;
896
- if ($[0] !== value) {
897
- t0 = /* @__PURE__ */ jsx(TimePicker, {
898
- label: "Time",
899
- value,
900
- onChange: setValue
901
- });
902
- $[0] = value;
903
- $[1] = t0;
904
- } else t0 = $[1];
905
- return t0;
906
- }
907
- function PaginationDemo() {
908
- const $ = c(4);
909
- const [page, setPage] = useState(1);
910
- const [pageSize, setPageSize] = useState(10);
911
- let t0;
912
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
913
- t0 = (size) => {
914
- setPageSize(size);
915
- setPage(1);
916
- };
917
- $[0] = t0;
918
- } else t0 = $[0];
919
- let t1;
920
- if ($[1] !== page || $[2] !== pageSize) {
921
- t1 = /* @__PURE__ */ jsx(Pagination, {
922
- page,
923
- pageSize,
924
- totalItems: 100,
925
- hideFirstLast: true,
926
- onPageChange: setPage,
927
- onPageSizeChange: t0
928
- });
929
- $[1] = page;
930
- $[2] = pageSize;
931
- $[3] = t1;
932
- } else t1 = $[3];
933
- return t1;
934
- }
935
- function DialogDemo() {
936
- const $ = c(19);
937
- const ui = UIConfig.useConfig();
938
- const dialogMainCva = UIOverrides.useCva("dialog.mainCva", dialogMainDefinition);
939
- const dialogContentCva = UIOverrides.useCva("dialog.contentCva", dialogContentDefinition);
940
- let t0;
941
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
942
- t0 = /* @__PURE__ */ jsx(Button, { children: "Open dialog" });
943
- $[0] = t0;
944
- } else t0 = $[0];
945
- let t1;
946
- if ($[1] !== dialogMainCva) {
947
- t1 = dialogMainCva({});
948
- $[1] = dialogMainCva;
949
- $[2] = t1;
950
- } else t1 = $[2];
951
- let t2;
952
- if ($[3] !== dialogContentCva) {
953
- t2 = dialogContentCva({});
954
- $[3] = dialogContentCva;
955
- $[4] = t2;
956
- } else t2 = $[4];
957
- let t3;
958
- if ($[5] !== ui.alertDialog.titleTypography) {
959
- t3 = /* @__PURE__ */ jsx(Typography, {
960
- ...ui.alertDialog.titleTypography,
961
- as: "h2",
962
- className: "text-surface-default-card-foreground",
963
- children: "Delete project?"
964
- });
965
- $[5] = ui.alertDialog.titleTypography;
966
- $[6] = t3;
967
- } else t3 = $[6];
968
- let t4;
969
- if ($[7] !== ui.alertDialog.descriptionTypography) {
970
- t4 = /* @__PURE__ */ jsx(Typography, {
971
- ...ui.alertDialog.descriptionTypography,
972
- className: "text-surface-default-card-foreground",
973
- children: "This will permanently remove the project and all of its files. This action cannot be undone."
974
- });
975
- $[7] = ui.alertDialog.descriptionTypography;
976
- $[8] = t4;
977
- } else t4 = $[8];
978
- let t5;
979
- if ($[9] !== t3 || $[10] !== t4) {
980
- t5 = /* @__PURE__ */ jsxs("div", {
981
- className: "flex flex-col gap-modal-gap-text",
982
- children: [t3, t4]
983
- });
984
- $[9] = t3;
985
- $[10] = t4;
986
- $[11] = t5;
987
- } else t5 = $[11];
988
- let t6;
989
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
990
- t6 = /* @__PURE__ */ jsxs("div", {
991
- className: "flex w-full flex-wrap gap-modal-gap-buttons pt-1",
992
- children: [/* @__PURE__ */ jsx(Button, {
993
- color: "secondary",
994
- width: "fill",
995
- className: "min-w-40 flex-1 shrink-0",
996
- children: "Cancel"
997
- }), /* @__PURE__ */ jsx(Button, {
998
- width: "fill",
999
- className: "min-w-40 flex-1 shrink-0",
1000
- children: "Delete"
1001
- })]
1002
- });
1003
- $[12] = t6;
1004
- } else t6 = $[12];
1005
- let t7;
1006
- if ($[13] !== t2 || $[14] !== t5) {
1007
- t7 = /* @__PURE__ */ jsxs("div", {
1008
- "aria-label": "Delete project",
1009
- className: t2,
1010
- children: [t5, t6]
1011
- });
1012
- $[13] = t2;
1013
- $[14] = t5;
1014
- $[15] = t7;
1015
- } else t7 = $[15];
1016
- let t8;
1017
- if ($[16] !== t1 || $[17] !== t7) {
1018
- t8 = /* @__PURE__ */ jsxs("div", {
1019
- className: "flex flex-col items-start gap-3",
1020
- children: [t0, /* @__PURE__ */ jsx("div", {
1021
- className: t1,
1022
- children: t7
1023
- })]
1024
- });
1025
- $[16] = t1;
1026
- $[17] = t7;
1027
- $[18] = t8;
1028
- } else t8 = $[18];
1029
- return t8;
1030
- }
1031
- function PopoverDemo() {
1032
- const $ = c(6);
1033
- const popoverCva = UIOverrides.useCva("popover.cva", popoverDefinition);
1034
- let t0;
1035
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1036
- t0 = /* @__PURE__ */ jsx(Button, {
1037
- endIcon: ChevronDown,
1038
- children: "Open popover"
1039
- });
1040
- $[0] = t0;
1041
- } else t0 = $[0];
1042
- let t1;
1043
- if ($[1] !== popoverCva) {
1044
- t1 = popoverCva({});
1045
- $[1] = popoverCva;
1046
- $[2] = t1;
1047
- } else t1 = $[2];
1048
- const t2 = `${t1} overflow-hidden p-2`;
1049
- let t3;
1050
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
1051
- t3 = /* @__PURE__ */ jsxs("div", {
1052
- className: "flex flex-col gap-2",
1053
- children: [
1054
- /* @__PURE__ */ jsx(Typography, {
1055
- size: "body",
1056
- className: "font-bold",
1057
- children: "Popover title"
1058
- }),
1059
- /* @__PURE__ */ jsx(Typography, {
1060
- size: "small",
1061
- children: "Popovers show rich content anchored to a trigger element."
1062
- }),
1063
- /* @__PURE__ */ jsx(TextButton, {
1064
- size: "sm",
1065
- children: "Learn more"
1066
- })
1067
- ]
1068
- });
1069
- $[3] = t3;
1070
- } else t3 = $[3];
1071
- let t4;
1072
- if ($[4] !== t2) {
1073
- t4 = /* @__PURE__ */ jsxs("div", {
1074
- className: "flex flex-col items-start",
1075
- children: [t0, /* @__PURE__ */ jsx("div", {
1076
- className: "my-4 w-72 outline-none",
1077
- children: /* @__PURE__ */ jsx("div", {
1078
- "aria-label": "Popover",
1079
- className: "outline-none",
1080
- children: /* @__PURE__ */ jsx("div", {
1081
- className: t2,
1082
- children: t3
1083
- })
1084
- })
1085
- })]
1086
- });
1087
- $[4] = t2;
1088
- $[5] = t4;
1089
- } else t4 = $[5];
1090
- return t4;
1091
- }
1092
- function DropdownMenuDemo() {
1093
- const $ = c(19);
1094
- const menuPopoverCva = UIOverrides.useCva("dropdownMenu.popoverCva", menuPopoverDefinition);
1095
- const menuPopoverWrapperCva = UIOverrides.useCva("dropdownMenu.popoverWrapperCva", menuPopoverWrapperDefinition);
1096
- const menuCva = UIOverrides.useCva("dropdownMenu.cva", dropdownMenuDefinition);
1097
- const menuItemCva = UIOverrides.useCva("dropdownMenu.itemCva", menuItemDefinition);
1098
- let t0;
1099
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1100
- t0 = [
1101
- { label: "Profile" },
1102
- { label: "Settings" },
1103
- {
1104
- label: "More options",
1105
- submenu: true
1106
- },
1107
- {
1108
- label: "Disabled item",
1109
- disabled: true
1110
- }
1111
- ];
1112
- $[0] = t0;
1113
- } else t0 = $[0];
1114
- const items = t0;
1115
- let t1;
1116
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1117
- t1 = /* @__PURE__ */ jsx(BadgeButton, {
1118
- icon: Settings,
1119
- children: "Open menu"
1120
- });
1121
- $[1] = t1;
1122
- } else t1 = $[1];
1123
- let t2;
1124
- if ($[2] !== menuPopoverCva) {
1125
- t2 = menuPopoverCva({});
1126
- $[2] = menuPopoverCva;
1127
- $[3] = t2;
1128
- } else t2 = $[3];
1129
- const t3 = `${t2} w-56`;
1130
- let t4;
1131
- if ($[4] !== menuPopoverWrapperCva) {
1132
- t4 = menuPopoverWrapperCva({});
1133
- $[4] = menuPopoverWrapperCva;
1134
- $[5] = t4;
1135
- } else t4 = $[5];
1136
- let t5;
1137
- if ($[6] !== menuCva) {
1138
- t5 = menuCva({ isMobile: false });
1139
- $[6] = menuCva;
1140
- $[7] = t5;
1141
- } else t5 = $[7];
1142
- let t6;
1143
- if ($[8] !== menuItemCva) {
1144
- t6 = items.map((item) => /* @__PURE__ */ jsxs("div", {
1145
- "aria-disabled": item.disabled || void 0,
1146
- "data-disabled": item.disabled || void 0,
1147
- "data-has-submenu": item.submenu || void 0,
1148
- className: menuItemCva({ isMobile: false }),
1149
- children: [item.label, item.submenu && /* @__PURE__ */ jsx(ArrowRight, { className: "size-6" })]
1150
- }, item.label));
1151
- $[8] = menuItemCva;
1152
- $[9] = t6;
1153
- } else t6 = $[9];
1154
- let t7;
1155
- if ($[10] !== t5 || $[11] !== t6) {
1156
- t7 = /* @__PURE__ */ jsx("div", {
1157
- className: t5,
1158
- children: t6
1159
- });
1160
- $[10] = t5;
1161
- $[11] = t6;
1162
- $[12] = t7;
1163
- } else t7 = $[12];
1164
- let t8;
1165
- if ($[13] !== t4 || $[14] !== t7) {
1166
- t8 = /* @__PURE__ */ jsx("div", {
1167
- className: t4,
1168
- children: t7
1169
- });
1170
- $[13] = t4;
1171
- $[14] = t7;
1172
- $[15] = t8;
1173
- } else t8 = $[15];
1174
- let t9;
1175
- if ($[16] !== t3 || $[17] !== t8) {
1176
- t9 = /* @__PURE__ */ jsxs("div", {
1177
- className: "flex flex-col items-start",
1178
- children: [t1, /* @__PURE__ */ jsx("div", {
1179
- className: t3,
1180
- children: t8
1181
- })]
1182
- });
1183
- $[16] = t3;
1184
- $[17] = t8;
1185
- $[18] = t9;
1186
- } else t9 = $[18];
1187
- return t9;
1188
- }
1189
- function TooltipDemo() {
1190
- const $ = c(19);
1191
- const tooltipCva = UIOverrides.useCva("tooltip.cva", tooltipDefinition);
1192
- const tooltipPointerCva = UIOverrides.useCva("tooltip.pointerHorizontalCva", tooltipPointerHorizontalDefinition);
1193
- const tooltipTextCva = UIOverrides.useCva("tooltip.textCva", tooltipTextDefinition);
1194
- let t0;
1195
- if ($[0] !== tooltipCva) {
1196
- t0 = tooltipCva({});
1197
- $[0] = tooltipCva;
1198
- $[1] = t0;
1199
- } else t0 = $[1];
1200
- let t1;
1201
- if ($[2] !== tooltipTextCva) {
1202
- t1 = tooltipTextCva({});
1203
- $[2] = tooltipTextCva;
1204
- $[3] = t1;
1205
- } else t1 = $[3];
1206
- const t2 = `${t1} font-bold`;
1207
- let t3;
1208
- if ($[4] !== t2) {
1209
- t3 = /* @__PURE__ */ jsx(Typography, {
1210
- size: "small",
1211
- className: t2,
1212
- children: "Tooltip text"
1213
- });
1214
- $[4] = t2;
1215
- $[5] = t3;
1216
- } else t3 = $[5];
1217
- let t4;
1218
- if ($[6] !== t0 || $[7] !== t3) {
1219
- t4 = /* @__PURE__ */ jsx("div", {
1220
- className: t0,
1221
- children: t3
1222
- });
1223
- $[6] = t0;
1224
- $[7] = t3;
1225
- $[8] = t4;
1226
- } else t4 = $[8];
1227
- let t5;
1228
- if ($[9] !== tooltipPointerCva) {
1229
- t5 = tooltipPointerCva({});
1230
- $[9] = tooltipPointerCva;
1231
- $[10] = t5;
1232
- } else t5 = $[10];
1233
- let t6;
1234
- if ($[11] !== t5) {
1235
- t6 = /* @__PURE__ */ jsx(ChevronUp, {
1236
- className: t5,
1237
- fill: "currentColor",
1238
- strokeWidth: 0,
1239
- "aria-hidden": "true"
1240
- });
1241
- $[11] = t5;
1242
- $[12] = t6;
1243
- } else t6 = $[12];
1244
- let t7;
1245
- if ($[13] !== t4 || $[14] !== t6) {
1246
- t7 = /* @__PURE__ */ jsxs("div", {
1247
- className: "group flex flex-col items-center",
1248
- "data-placement": "top",
1249
- children: [t4, t6]
1250
- });
1251
- $[13] = t4;
1252
- $[14] = t6;
1253
- $[15] = t7;
1254
- } else t7 = $[15];
1255
- let t8;
1256
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
1257
- t8 = /* @__PURE__ */ jsx(Button, {
1258
- variant: "outlined",
1259
- children: "Hover me"
1260
- });
1261
- $[16] = t8;
1262
- } else t8 = $[16];
1263
- let t9;
1264
- if ($[17] !== t7) {
1265
- t9 = /* @__PURE__ */ jsxs("div", {
1266
- className: "flex flex-col items-center",
1267
- children: [t7, t8]
1268
- });
1269
- $[17] = t7;
1270
- $[18] = t9;
1271
- } else t9 = $[18];
1272
- return t9;
1273
- }
1274
- const demos = [
1275
- {
1276
- id: "button",
1277
- title: "Button",
1278
- group: "Buttons",
1279
- render: () => /* @__PURE__ */ jsxs("div", {
1280
- className: "flex flex-col gap-3",
1281
- children: [
1282
- /* @__PURE__ */ jsxs("div", {
1283
- className: "flex flex-wrap items-center gap-2",
1284
- children: [
1285
- /* @__PURE__ */ jsx(Button, { children: "Contained" }),
1286
- /* @__PURE__ */ jsx(Button, {
1287
- variant: "outlined",
1288
- children: "Outlined"
1289
- }),
1290
- /* @__PURE__ */ jsx(Button, {
1291
- variant: "subtle",
1292
- children: "Subtle"
1293
- }),
1294
- /* @__PURE__ */ jsx(Button, {
1295
- variant: "ghost",
1296
- children: "Ghost"
1297
- }),
1298
- /* @__PURE__ */ jsx(Button, {
1299
- variant: "text",
1300
- children: "Text"
1301
- })
1302
- ]
1303
- }),
1304
- /* @__PURE__ */ jsxs("div", {
1305
- className: "flex flex-wrap items-center gap-2",
1306
- children: [
1307
- /* @__PURE__ */ jsx(Button, {
1308
- color: "secondary",
1309
- children: "Secondary"
1310
- }),
1311
- /* @__PURE__ */ jsx(Button, {
1312
- color: "error",
1313
- children: "Error"
1314
- }),
1315
- /* @__PURE__ */ jsx(Button, {
1316
- startIcon: Calendar,
1317
- children: "With icon"
1318
- }),
1319
- /* @__PURE__ */ jsx(Button, {
1320
- isLoading: true,
1321
- children: "Loading"
1322
- })
1323
- ]
1324
- }),
1325
- /* @__PURE__ */ jsxs("div", {
1326
- className: "flex flex-wrap items-center gap-2",
1327
- children: [
1328
- /* @__PURE__ */ jsx(Button, {
1329
- size: "sm",
1330
- children: "Small"
1331
- }),
1332
- /* @__PURE__ */ jsx(Button, {
1333
- size: "default",
1334
- children: "Default"
1335
- }),
1336
- /* @__PURE__ */ jsx(Button, {
1337
- isDisabled: true,
1338
- children: "Disabled"
1339
- }),
1340
- /* @__PURE__ */ jsx(Button, {
1341
- variant: "outlined",
1342
- isDisabled: true,
1343
- children: "Disabled"
1344
- })
1345
- ]
1346
- })
1347
- ]
1348
- })
1349
- },
1350
- {
1351
- id: "icon-button",
1352
- title: "IconButton",
1353
- group: "Buttons",
1354
- render: () => /* @__PURE__ */ jsxs("div", {
1355
- className: "flex flex-wrap items-center gap-2",
1356
- children: [
1357
- /* @__PURE__ */ jsx(IconButton, {
1358
- icon: Calendar,
1359
- label: "Calendar"
1360
- }),
1361
- /* @__PURE__ */ jsx(IconButton, {
1362
- icon: Calendar,
1363
- label: "Calendar",
1364
- variant: "outlined"
1365
- }),
1366
- /* @__PURE__ */ jsx(IconButton, {
1367
- icon: Calendar,
1368
- label: "Calendar",
1369
- variant: "subtle"
1370
- }),
1371
- /* @__PURE__ */ jsx(IconButton, {
1372
- icon: Calendar,
1373
- label: "Calendar",
1374
- color: "secondary"
1375
- }),
1376
- /* @__PURE__ */ jsx(IconButton, {
1377
- icon: Calendar,
1378
- label: "Calendar",
1379
- size: "sm"
1380
- }),
1381
- /* @__PURE__ */ jsx(IconButton, {
1382
- icon: Calendar,
1383
- label: "Calendar",
1384
- isDisabled: true
1385
- })
1386
- ]
1387
- })
1388
- },
1389
- {
1390
- id: "text-button",
1391
- title: "TextButton",
1392
- group: "Buttons",
1393
- render: () => /* @__PURE__ */ jsxs("div", {
1394
- className: "flex flex-wrap items-center gap-4",
1395
- children: [
1396
- /* @__PURE__ */ jsx(TextButton, { children: "Log in" }),
1397
- /* @__PURE__ */ jsx(TextButton, {
1398
- icon: Calendar,
1399
- children: "With icon"
1400
- }),
1401
- /* @__PURE__ */ jsx(TextButton, {
1402
- color: "secondary",
1403
- children: "Secondary"
1404
- }),
1405
- /* @__PURE__ */ jsx(TextButton, {
1406
- color: "error",
1407
- children: "Error"
1408
- }),
1409
- /* @__PURE__ */ jsx(TextButton, {
1410
- isDisabled: true,
1411
- children: "Disabled"
1412
- })
1413
- ]
1414
- })
1415
- },
1416
- {
1417
- id: "toggle-button",
1418
- title: "ToggleButton",
1419
- group: "Buttons",
1420
- render: () => /* @__PURE__ */ jsxs("div", {
1421
- className: "flex flex-wrap items-center gap-2",
1422
- children: [
1423
- /* @__PURE__ */ jsx(ToggleButton, { children: "Toggle me" }),
1424
- /* @__PURE__ */ jsx(ToggleButton, {
1425
- defaultSelected: true,
1426
- children: "Selected"
1427
- }),
1428
- /* @__PURE__ */ jsx(ToggleButton, {
1429
- isDisabled: true,
1430
- children: "Disabled"
1431
- })
1432
- ]
1433
- })
1434
- },
1435
- {
1436
- id: "split-button",
1437
- title: "SplitButton",
1438
- group: "Buttons",
1439
- render: () => /* @__PURE__ */ jsxs("div", {
1440
- className: "flex flex-wrap items-center gap-3",
1441
- children: [/* @__PURE__ */ jsx(SplitButton, {
1442
- label: "Save",
1443
- labelRight: "More",
1444
- items: menuItems
1445
- }), /* @__PURE__ */ jsx(SplitButton, {
1446
- label: "Save",
1447
- labelRight: "More",
1448
- variant: "outlined",
1449
- items: menuItems
1450
- })]
1451
- })
1452
- },
1453
- {
1454
- id: "badge-button",
1455
- title: "BadgeButton",
1456
- group: "Buttons",
1457
- render: () => /* @__PURE__ */ jsxs("div", {
1458
- className: "flex flex-wrap items-center gap-2",
1459
- children: [
1460
- /* @__PURE__ */ jsx(BadgeButton, { children: "Badge" }),
1461
- /* @__PURE__ */ jsx(BadgeButton, {
1462
- icon: Calendar,
1463
- children: "With icon"
1464
- }),
1465
- /* @__PURE__ */ jsx(BadgeButton, {
1466
- dismissable: true,
1467
- children: "Dismissable"
1468
- }),
1469
- /* @__PURE__ */ jsx(BadgeButton, {
1470
- toggle: true,
1471
- defaultSelected: true,
1472
- children: "Selected"
1473
- }),
1474
- /* @__PURE__ */ jsx(BadgeButton, {
1475
- isDisabled: true,
1476
- children: "Disabled"
1477
- })
1478
- ]
1479
- })
1480
- },
1481
- {
1482
- id: "toggle-group",
1483
- title: "ToggleGroup",
1484
- group: "Buttons",
1485
- render: () => /* @__PURE__ */ jsx(ToggleGroupDemo, {})
1486
- },
1487
- {
1488
- id: "input",
1489
- title: "Input",
1490
- group: "Inputs",
1491
- render: () => /* @__PURE__ */ jsxs("div", {
1492
- className: "flex flex-col gap-4",
1493
- children: [
1494
- /* @__PURE__ */ jsx(Input, {
1495
- label: "First name",
1496
- placeholder: "Enter your name"
1497
- }),
1498
- /* @__PURE__ */ jsx(Input, {
1499
- label: "Email",
1500
- placeholder: "name@example.com",
1501
- helperText: "We will never share your email.",
1502
- isRequired: true
1503
- }),
1504
- /* @__PURE__ */ jsx(Input, {
1505
- label: "Username",
1506
- defaultValue: "admin",
1507
- error: "This username is already taken."
1508
- }),
1509
- /* @__PURE__ */ jsx(Input, {
1510
- label: "Disabled",
1511
- defaultValue: "Read only value",
1512
- isDisabled: true
1513
- })
1514
- ]
1515
- })
1516
- },
1517
- {
1518
- id: "text-area",
1519
- title: "TextArea",
1520
- group: "Inputs",
1521
- render: () => /* @__PURE__ */ jsx(TextArea, {
1522
- label: "Description",
1523
- placeholder: "Tell us more",
1524
- helperText: "Maximum 500 characters"
1525
- })
1526
- },
1527
- {
1528
- id: "password-input",
1529
- title: "PasswordInput",
1530
- group: "Inputs",
1531
- render: () => /* @__PURE__ */ jsx(PasswordInput, {
1532
- label: "Password",
1533
- defaultValue: "supersecret",
1534
- isRequired: true
1535
- })
1536
- },
1537
- {
1538
- id: "number-field",
1539
- title: "NumberField",
1540
- group: "Inputs",
1541
- render: () => /* @__PURE__ */ jsx(NumberField, {
1542
- label: "Quantity",
1543
- defaultValue: 3
1544
- })
1545
- },
1546
- {
1547
- id: "checkbox",
1548
- title: "Checkbox",
1549
- group: "Inputs",
1550
- render: () => /* @__PURE__ */ jsxs("div", {
1551
- className: "flex flex-col gap-2",
1552
- children: [
1553
- /* @__PURE__ */ jsx(Checkbox, { children: "Unchecked" }),
1554
- /* @__PURE__ */ jsx(Checkbox, {
1555
- defaultSelected: true,
1556
- children: "Checked"
1557
- }),
1558
- /* @__PURE__ */ jsx(Checkbox, {
1559
- isIndeterminate: true,
1560
- children: "Indeterminate"
1561
- }),
1562
- /* @__PURE__ */ jsx(Checkbox, {
1563
- isDisabled: true,
1564
- children: "Disabled"
1565
- }),
1566
- /* @__PURE__ */ jsx(Checkbox, {
1567
- error: "This is an error message",
1568
- children: "With error"
1569
- })
1570
- ]
1571
- })
1572
- },
1573
- {
1574
- id: "checkbox-group",
1575
- title: "CheckboxGroup",
1576
- group: "Inputs",
1577
- render: () => /* @__PURE__ */ jsx(CheckboxGroupDemo, {})
1578
- },
1579
- {
1580
- id: "radio-group",
1581
- title: "RadioGroup",
1582
- group: "Inputs",
1583
- render: () => /* @__PURE__ */ jsx(RadioGroupDemo, {})
1584
- },
1585
- {
1586
- id: "switch",
1587
- title: "Switch",
1588
- group: "Inputs",
1589
- render: () => /* @__PURE__ */ jsxs("div", {
1590
- className: "flex flex-col gap-2",
1591
- children: [
1592
- /* @__PURE__ */ jsx(Switch, { children: "Off" }),
1593
- /* @__PURE__ */ jsx(Switch, {
1594
- defaultSelected: true,
1595
- children: "On"
1596
- }),
1597
- /* @__PURE__ */ jsx(Switch, {
1598
- isDisabled: true,
1599
- children: "Disabled"
1600
- }),
1601
- /* @__PURE__ */ jsx(Switch, {
1602
- defaultSelected: true,
1603
- isDisabled: true,
1604
- children: "Selected disabled"
1605
- })
1606
- ]
1607
- })
1608
- },
1609
- {
1610
- id: "slider",
1611
- title: "Slider",
1612
- group: "Inputs",
1613
- render: () => /* @__PURE__ */ jsxs("div", {
1614
- className: "flex flex-col gap-4",
1615
- children: [/* @__PURE__ */ jsx(Slider, {
1616
- label: "Percentage",
1617
- defaultValue: 40,
1618
- unit: "%"
1619
- }), /* @__PURE__ */ jsx(Slider, {
1620
- label: "Range",
1621
- isRange: true,
1622
- defaultValue: [25, 75]
1623
- })]
1624
- })
1625
- },
1626
- {
1627
- id: "select",
1628
- title: "Select",
1629
- group: "Selection",
1630
- render: () => /* @__PURE__ */ jsx(SelectDemo, {})
1631
- },
1632
- {
1633
- id: "autocomplete",
1634
- title: "Autocomplete",
1635
- group: "Selection",
1636
- render: () => /* @__PURE__ */ jsx(AutocompleteDemo, {})
1637
- },
1638
- {
1639
- id: "date-picker",
1640
- title: "DatePicker",
1641
- group: "Selection",
1642
- render: () => /* @__PURE__ */ jsx(DatePickerDemo, {})
1643
- },
1644
- {
1645
- id: "time-picker",
1646
- title: "TimePicker",
1647
- group: "Selection",
1648
- render: () => /* @__PURE__ */ jsx(TimePickerDemo, {})
1649
- },
1650
- {
1651
- id: "file-upload",
1652
- title: "FileUpload",
1653
- group: "Files",
1654
- render: () => /* @__PURE__ */ jsx(FileUpload, {
1655
- label: "Upload file",
1656
- helperText: "Upload images (JPEG, PNG, WEBP)",
1657
- acceptedFileTypes: [
1658
- "image/jpeg",
1659
- "image/png",
1660
- "image/webp"
1661
- ]
1662
- })
1663
- },
1664
- {
1665
- id: "alert",
1666
- title: "Alert",
1667
- group: "Feedback",
1668
- render: () => /* @__PURE__ */ jsxs("div", {
1669
- className: "flex flex-col gap-3",
1670
- children: [
1671
- /* @__PURE__ */ jsx(Alert, {
1672
- text: "This is a neutral alert with some helpful information.",
1673
- icon: Info
1674
- }),
1675
- /* @__PURE__ */ jsx(Alert, {
1676
- color: "success",
1677
- text: "Your changes have been saved.",
1678
- icon: Check
1679
- }),
1680
- /* @__PURE__ */ jsx(Alert, {
1681
- color: "warning",
1682
- text: "Your trial ends in 3 days.",
1683
- icon: Info
1684
- }),
1685
- /* @__PURE__ */ jsx(Alert, {
1686
- variant: "contained",
1687
- color: "error",
1688
- text: "Something went wrong. Please try again.",
1689
- icon: Info
1690
- })
1691
- ]
1692
- })
1693
- },
1694
- {
1695
- id: "toast",
1696
- title: "Toast",
1697
- group: "Feedback",
1698
- render: () => /* @__PURE__ */ jsxs("div", {
1699
- className: "flex flex-col gap-3",
1700
- children: [/* @__PURE__ */ jsx(Toast, {
1701
- variant: "outlined",
1702
- color: "neutral",
1703
- text: "This is a toast notification.",
1704
- icon: Check,
1705
- actions: [{
1706
- text: "Undo",
1707
- onPress: noop
1708
- }, {
1709
- text: "Dismiss",
1710
- onPress: noop
1711
- }]
1712
- }), /* @__PURE__ */ jsx(Toast, {
1713
- variant: "contained",
1714
- color: "success",
1715
- text: "File uploaded successfully.",
1716
- icon: Check
1717
- })]
1718
- })
1719
- },
1720
- {
1721
- id: "progress",
1722
- title: "Progress",
1723
- group: "Feedback",
1724
- render: () => /* @__PURE__ */ jsxs("div", {
1725
- className: "flex flex-col gap-4",
1726
- children: [
1727
- /* @__PURE__ */ jsx(Progress, {
1728
- progress: 50,
1729
- valueLabel: "trailing"
1730
- }),
1731
- /* @__PURE__ */ jsx(Progress, {
1732
- progress: 30,
1733
- valueLabel: "leading"
1734
- }),
1735
- /* @__PURE__ */ jsx(Progress, {
1736
- progress: 75,
1737
- valueLabel: "none"
1738
- })
1739
- ]
1740
- })
1741
- },
1742
- {
1743
- id: "spinner",
1744
- title: "Spinner",
1745
- group: "Feedback",
1746
- render: () => /* @__PURE__ */ jsxs("div", {
1747
- className: "flex items-center gap-6",
1748
- children: [/* @__PURE__ */ jsx(Spinner, { size: "default" }), /* @__PURE__ */ jsx(Spinner, { size: "l" })]
1749
- })
1750
- },
1751
- {
1752
- id: "badge",
1753
- title: "Badge",
1754
- group: "Text",
1755
- render: () => /* @__PURE__ */ jsxs("div", {
1756
- className: "flex flex-wrap items-center gap-2",
1757
- children: [
1758
- /* @__PURE__ */ jsx(Badge, {
1759
- color: "primary",
1760
- children: "Primary"
1761
- }),
1762
- /* @__PURE__ */ jsx(Badge, {
1763
- color: "secondary",
1764
- children: "Secondary"
1765
- }),
1766
- /* @__PURE__ */ jsx(Badge, {
1767
- color: "error",
1768
- children: "Error"
1769
- }),
1770
- /* @__PURE__ */ jsx(Badge, {
1771
- variant: "outlined",
1772
- color: "primary",
1773
- children: "Outlined"
1774
- }),
1775
- /* @__PURE__ */ jsx(Badge, {
1776
- color: "primary",
1777
- dismissable: true,
1778
- onDismiss: noop,
1779
- children: "Dismissable"
1780
- })
1781
- ]
1782
- })
1783
- },
1784
- {
1785
- id: "tag",
1786
- title: "Tag",
1787
- group: "Text",
1788
- render: () => /* @__PURE__ */ jsxs("div", {
1789
- className: "flex flex-wrap items-center gap-2",
1790
- children: [
1791
- /* @__PURE__ */ jsx(Tag, {
1792
- color: "primary",
1793
- children: "Primary"
1794
- }),
1795
- /* @__PURE__ */ jsx(Tag, {
1796
- color: "secondary",
1797
- children: "Secondary"
1798
- }),
1799
- /* @__PURE__ */ jsx(Tag, {
1800
- color: "success",
1801
- children: "Success"
1802
- }),
1803
- /* @__PURE__ */ jsx(Tag, {
1804
- color: "warning",
1805
- children: "Warning"
1806
- }),
1807
- /* @__PURE__ */ jsx(Tag, {
1808
- color: "error",
1809
- children: "Error"
1810
- }),
1811
- /* @__PURE__ */ jsx(Tag, {
1812
- color: "primary",
1813
- dismissable: true,
1814
- onDismiss: noop,
1815
- children: "Dismissable"
1816
- })
1817
- ]
1818
- })
1819
- },
1820
- {
1821
- id: "link",
1822
- title: "Link",
1823
- group: "Text",
1824
- render: () => /* @__PURE__ */ jsxs(Typography, {
1825
- size: "body",
1826
- children: [
1827
- "Read the ",
1828
- /* @__PURE__ */ jsx(Link, {
1829
- href: "#",
1830
- children: "documentation"
1831
- }),
1832
- " or visit the ",
1833
- /* @__PURE__ */ jsx(Link, {
1834
- href: "#",
1835
- children: "help center"
1836
- }),
1837
- "."
1838
- ]
1839
- })
1840
- },
1841
- {
1842
- id: "typography",
1843
- title: "Typography",
1844
- group: "Text",
1845
- render: () => /* @__PURE__ */ jsxs("div", {
1846
- className: "flex flex-col gap-2",
252
+ left: px(style.borderLeftWidth) * scale
253
+ };
254
+ const pad = {
255
+ top: px(style.paddingTop) * scale,
256
+ right: px(style.paddingRight) * scale,
257
+ bottom: px(style.paddingBottom) * scale,
258
+ left: px(style.paddingLeft) * scale
259
+ };
260
+ const inner = {
261
+ x: left + border.left,
262
+ y: top + border.top,
263
+ width: box.width - border.left - border.right,
264
+ height: box.height - border.top - border.bottom
265
+ };
266
+ const next = [];
267
+ const add = (kind, token, key, x, y, width, height) => {
268
+ if (token && width > .5 && height > .5) next.push({
269
+ key,
270
+ kind,
271
+ token,
272
+ label: describe(token),
273
+ x,
274
+ y,
275
+ width,
276
+ height
277
+ });
278
+ };
279
+ add("padding", tokens.padding.top, "pt", inner.x, inner.y, inner.width, pad.top);
280
+ add("padding", tokens.padding.bottom, "pb", inner.x, inner.y + inner.height - pad.bottom, inner.width, pad.bottom);
281
+ add("padding", tokens.padding.left, "pl", inner.x, inner.y + pad.top, pad.left, inner.height - pad.top - pad.bottom);
282
+ add("padding", tokens.padding.right, "pr", inner.x + inner.width - pad.right, inner.y + pad.top, pad.right, inner.height - pad.top - pad.bottom);
283
+ if (tokens.gap.row || tokens.gap.column) {
284
+ const children_0 = [...target.children].map((child) => child.getBoundingClientRect()).filter((rect) => rect.width > 0 && rect.height > 0);
285
+ const contentTop = inner.y + pad.top;
286
+ const contentHeight = inner.height - pad.top - pad.bottom;
287
+ const contentLeft = inner.x + pad.left;
288
+ const contentWidth = inner.width - pad.left - pad.right;
289
+ children_0.slice(1).forEach((rect_0, index) => {
290
+ const previous = children_0[index];
291
+ if (rect_0.left >= previous.right - .5) add("gap", tokens.gap.column, `gx${index}`, previous.right - origin.left, contentTop, rect_0.left - previous.right, contentHeight);
292
+ else if (rect_0.top >= previous.bottom - .5) add("gap", tokens.gap.row, `gy${index}`, contentLeft, previous.bottom - origin.top, contentWidth, rect_0.top - previous.bottom);
293
+ });
294
+ }
295
+ if (tokens.radius && px(style.borderTopLeftRadius) > 0) {
296
+ const size = Math.min(12, box.width / 3, box.height / 3);
297
+ add("radius", tokens.radius, "r-tl", left, top, size, size);
298
+ add("radius", tokens.radius, "r-tr", left + box.width - size, top, size, size);
299
+ add("radius", tokens.radius, "r-bl", left, top + box.height - size, size, size);
300
+ add("radius", tokens.radius, "r-br", left + box.width - size, top + box.height - size, size, size);
301
+ }
302
+ setRegions(next);
303
+ setOutline({
304
+ x: left,
305
+ y: top,
306
+ width: box.width,
307
+ height: box.height
308
+ });
309
+ }, [
310
+ target,
311
+ tokensOf,
312
+ describe
313
+ ]);
314
+ useLayoutEffect(measure, [measure, revision]);
315
+ useEffect(() => {
316
+ const stage_0 = stageRef.current;
317
+ const ownerWindow = stage_0?.ownerDocument.defaultView;
318
+ if (!stage_0 || !ownerWindow) return;
319
+ let frame = 0;
320
+ const schedule = () => {
321
+ ownerWindow.cancelAnimationFrame(frame);
322
+ frame = ownerWindow.requestAnimationFrame(measure);
323
+ };
324
+ const observer = new ResizeObserver(schedule);
325
+ observer.observe(stage_0);
326
+ if (target) observer.observe(target);
327
+ ownerWindow.addEventListener("scroll", schedule, true);
328
+ return () => {
329
+ ownerWindow.cancelAnimationFrame(frame);
330
+ observer.disconnect();
331
+ ownerWindow.removeEventListener("scroll", schedule, true);
332
+ };
333
+ }, [measure, target]);
334
+ const onPointerMove = (event) => {
335
+ if (event.target.closest(".studio-inspect-region")) return;
336
+ const content = contentRef.current;
337
+ if (!content) return;
338
+ const hit = content.ownerDocument.elementsFromPoint(event.clientX, event.clientY).find((element_0) => content.contains(element_0) && hasTokens(tokensOf(element_0)));
339
+ if (hit && hit !== target) setTarget(hit);
340
+ };
341
+ return /* @__PURE__ */ jsxs("div", {
342
+ ref: stageRef,
343
+ className: "studio-inspect-stage",
344
+ onPointerMove,
345
+ children: [
346
+ /* @__PURE__ */ jsx("div", {
347
+ ref: contentRef,
348
+ className: "studio-inspect-content",
349
+ children
350
+ }),
351
+ /* @__PURE__ */ jsxs("div", {
352
+ className: "studio-inspect-layer",
353
+ "aria-label": "Token inspector",
354
+ children: [
355
+ outline && /* @__PURE__ */ jsx("div", {
356
+ className: "studio-inspect-outline",
357
+ style: {
358
+ left: outline.x,
359
+ top: outline.y,
360
+ width: outline.width,
361
+ height: outline.height
362
+ }
363
+ }),
364
+ regions.map((region) => /* @__PURE__ */ jsx("button", {
365
+ type: "button",
366
+ className: `studio-inspect-region is-${region.kind} ${active === region.token ? "is-active" : ""}`,
367
+ style: {
368
+ left: region.x,
369
+ top: region.y,
370
+ width: region.width,
371
+ height: region.height
372
+ },
373
+ "aria-label": `Edit ${region.kind} ${region.label}`,
374
+ title: region.label,
375
+ onPointerEnter: () => setActive(region.token),
376
+ onPointerLeave: () => setActive(null),
377
+ onClick: (event_0) => {
378
+ event_0.stopPropagation();
379
+ onSelect(region.token);
380
+ }
381
+ }, region.key)),
382
+ active && regions.some((region_1) => region_1.token === active) && /* @__PURE__ */ jsx(InspectLabel, {
383
+ region: regions.find((region_0) => region_0.token === active),
384
+ stageWidth: stageRef.current?.clientWidth ?? 0
385
+ })
386
+ ]
387
+ }),
388
+ !target && /* @__PURE__ */ jsx("p", {
389
+ className: "studio-inspect-hint",
390
+ children: "Hover the component to see its paddings, gaps and radius."
391
+ })
392
+ ]
393
+ });
394
+ }
395
+ function InspectLabel(t0) {
396
+ const $ = c(10);
397
+ const { region, stageWidth } = t0;
398
+ const left = Math.max(4, Math.min(region.x, stageWidth - 220));
399
+ const t1 = `studio-inspect-label is-${region.kind}`;
400
+ const t2 = Math.max(0, region.y - 24);
401
+ let t3;
402
+ if ($[0] !== left || $[1] !== t2) {
403
+ t3 = {
404
+ left,
405
+ top: t2
406
+ };
407
+ $[0] = left;
408
+ $[1] = t2;
409
+ $[2] = t3;
410
+ } else t3 = $[2];
411
+ let t4;
412
+ if ($[3] !== region.kind) {
413
+ t4 = /* @__PURE__ */ jsx("strong", { children: region.kind });
414
+ $[3] = region.kind;
415
+ $[4] = t4;
416
+ } else t4 = $[4];
417
+ let t5;
418
+ if ($[5] !== region.label || $[6] !== t1 || $[7] !== t3 || $[8] !== t4) {
419
+ t5 = /* @__PURE__ */ jsxs("div", {
420
+ className: t1,
421
+ style: t3,
1847
422
  children: [
1848
- /* @__PURE__ */ jsx(Typography, {
1849
- size: "h1",
1850
- as: "h1",
1851
- children: "Heading 1"
1852
- }),
1853
- /* @__PURE__ */ jsx(Typography, {
1854
- size: "h2",
1855
- as: "h2",
1856
- children: "Heading 2"
1857
- }),
1858
- /* @__PURE__ */ jsx(Typography, {
1859
- size: "h3",
1860
- as: "h3",
1861
- children: "Heading 3"
1862
- }),
1863
- /* @__PURE__ */ jsx(Typography, {
1864
- size: "lead",
1865
- children: "Lead paragraph text."
1866
- }),
1867
- /* @__PURE__ */ jsx(Typography, {
1868
- size: "body",
1869
- children: "Body text for general content and descriptions."
1870
- }),
1871
- /* @__PURE__ */ jsx(Typography, {
1872
- size: "small",
1873
- children: "Small text for captions and metadata."
1874
- })
423
+ t4,
424
+ " ",
425
+ region.label
1875
426
  ]
1876
- })
1877
- },
1878
- {
1879
- id: "accordion",
1880
- title: "Accordion",
1881
- group: "Navigation",
1882
- render: () => /* @__PURE__ */ jsx(Accordion, {
1883
- items: accordionItems,
1884
- defaultExpandedKeys: ["item1"]
1885
- })
1886
- },
1887
- {
1888
- id: "stepper",
1889
- wide: true,
1890
- title: "Stepper",
1891
- group: "Navigation",
1892
- render: () => /* @__PURE__ */ jsx(Stepper, {
1893
- steps,
1894
- currentStep: 1
1895
- })
1896
- },
1897
- {
1898
- id: "breadcrumbs",
1899
- title: "Breadcrumbs",
1900
- group: "Navigation",
1901
- render: () => /* @__PURE__ */ jsx(Breadcrumbs, { items: [
1902
- {
1903
- id: "home",
1904
- label: "Home",
1905
- link: { href: "#" },
1906
- icon: House
1907
- },
1908
- {
1909
- id: "products",
1910
- label: "Products",
1911
- link: { href: "#" }
1912
- },
1913
- {
1914
- id: "current",
1915
- label: "Product details"
1916
- }
1917
- ] })
1918
- },
1919
- {
1920
- id: "pagination",
1921
- wide: true,
1922
- title: "Pagination",
1923
- group: "Navigation",
1924
- render: () => /* @__PURE__ */ jsx(PaginationDemo, {})
1925
- },
1926
- {
1927
- id: "dialog",
1928
- title: "Dialog",
1929
- group: "Overlays",
1930
- overlay: true,
1931
- render: () => /* @__PURE__ */ jsx(DialogDemo, {})
1932
- },
1933
- {
1934
- id: "popover",
1935
- title: "Popover",
1936
- group: "Overlays",
1937
- overlay: true,
1938
- render: () => /* @__PURE__ */ jsx(PopoverDemo, {})
1939
- },
1940
- {
1941
- id: "tooltip",
1942
- title: "Tooltip",
1943
- group: "Overlays",
1944
- overlay: true,
1945
- render: () => /* @__PURE__ */ jsx(TooltipDemo, {})
1946
- },
1947
- {
1948
- id: "dropdown-menu",
1949
- title: "DropdownMenu",
1950
- group: "Overlays",
1951
- overlay: true,
1952
- render: () => /* @__PURE__ */ jsx(DropdownMenuDemo, {})
1953
- },
1954
- {
1955
- id: "table",
1956
- wide: true,
1957
- title: "Table",
1958
- group: "Data",
1959
- render: () => /* @__PURE__ */ jsx(Table, {
1960
- items: tableRows,
1961
- columns: tableColumns
1962
- })
1963
- }
427
+ });
428
+ $[5] = region.label;
429
+ $[6] = t1;
430
+ $[7] = t3;
431
+ $[8] = t4;
432
+ $[9] = t5;
433
+ } else t5 = $[9];
434
+ return t5;
435
+ }
436
+ //#endregion
437
+ //#region src/configurator/gallery/groups.ts
438
+ /** Gallery sections, kept apart from the demos so a host can list them without loading every component. */
439
+ const galleryGroups = [
440
+ "Buttons",
441
+ "Inputs",
442
+ "Selection",
443
+ "Files",
444
+ "Feedback",
445
+ "Text",
446
+ "Navigation",
447
+ "Overlays",
448
+ "Data"
1964
449
  ];
1965
450
  //#endregion
1966
451
  //#region src/configurator/gallery/LayoutPreview.tsx
@@ -2239,7 +724,7 @@ function DashboardScreen() {
2239
724
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
2240
725
  t3 = /* @__PURE__ */ jsx("div", {
2241
726
  className: "studio-layout-stats",
2242
- children: stats.map(_temp$1)
727
+ children: stats.map(_temp)
2243
728
  });
2244
729
  t4 = /* @__PURE__ */ jsx(Table, {
2245
730
  items: projects,
@@ -2285,7 +770,7 @@ function DashboardScreen() {
2285
770
  return t6;
2286
771
  }
2287
772
  /** A sign-in screen: centered form with email, password, remember me, a primary and a secondary action. */
2288
- function _temp$1(t0) {
773
+ function _temp(t0) {
2289
774
  const { label, value, trend } = t0;
2290
775
  return /* @__PURE__ */ jsxs("div", {
2291
776
  className: "studio-layout-stat",
@@ -3256,6 +1741,10 @@ function LayoutPreview() {
3256
1741
  }
3257
1742
  //#endregion
3258
1743
  //#region src/configurator/gallery/ComponentGallery.tsx
1744
+ var ComponentGallery_exports = /* @__PURE__ */ __exportAll({
1745
+ ComponentDemoArtboard: () => ComponentDemoArtboard,
1746
+ default: () => ComponentGallery
1747
+ });
3259
1748
  /** Keeps portaled overlays (tooltips, popovers) inside the card so they inherit preview tokens and stay in place. */
3260
1749
  function PortalHere(t0) {
3261
1750
  const $ = c(7);
@@ -3390,76 +1879,40 @@ function ZoomedDemo(t0) {
3390
1879
  } else t10 = $[21];
3391
1880
  return t10;
3392
1881
  }
3393
- /** One gallery section on its own, live and uninspected, for an App Canvas artboard. */
3394
- function ComponentArtboard(t0) {
3395
- const $ = c(13);
3396
- const { group } = t0;
3397
- if (group === "Layouts") {
3398
- let t1;
3399
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
3400
- t1 = /* @__PURE__ */ jsx(LayoutPreview, {});
3401
- $[0] = t1;
3402
- } else t1 = $[0];
3403
- return t1;
3404
- }
1882
+ /** One component on its own, live and uninspected, for an App Canvas artboard. */
1883
+ function ComponentDemoArtboard(t0) {
1884
+ const $ = c(5);
1885
+ const { id } = t0;
3405
1886
  let t1;
3406
- let t2;
3407
- let t3;
3408
- let t4;
3409
- if ($[1] !== group) {
3410
- const items = demos.filter((demo) => demo.group === group);
3411
- t3 = "studio-gallery-group";
3412
- t4 = group;
3413
- t1 = "studio-gallery-grid";
3414
- t2 = items.map(_temp);
3415
- $[1] = group;
3416
- $[2] = t1;
3417
- $[3] = t2;
3418
- $[4] = t3;
3419
- $[5] = t4;
3420
- } else {
3421
- t1 = $[2];
3422
- t2 = $[3];
3423
- t3 = $[4];
3424
- t4 = $[5];
1887
+ if ($[0] !== id) {
1888
+ t1 = demos.find((item) => item.id === id);
1889
+ $[0] = id;
1890
+ $[1] = t1;
1891
+ } else t1 = $[1];
1892
+ const demo = t1;
1893
+ if (!demo) {
1894
+ let t2;
1895
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1896
+ t2 = /* @__PURE__ */ jsx("p", {
1897
+ className: "studio-gallery-loading",
1898
+ children: "This component is no longer in the gallery."
1899
+ });
1900
+ $[2] = t2;
1901
+ } else t2 = $[2];
1902
+ return t2;
3425
1903
  }
3426
- let t5;
3427
- if ($[6] !== t1 || $[7] !== t2) {
3428
- t5 = /* @__PURE__ */ jsx("div", {
3429
- className: t1,
3430
- children: t2
3431
- });
3432
- $[6] = t1;
3433
- $[7] = t2;
3434
- $[8] = t5;
3435
- } else t5 = $[8];
3436
- let t6;
3437
- if ($[9] !== t3 || $[10] !== t4 || $[11] !== t5) {
3438
- t6 = /* @__PURE__ */ jsx("section", {
3439
- className: t3,
3440
- "aria-label": t4,
3441
- children: t5
3442
- });
3443
- $[9] = t3;
3444
- $[10] = t4;
3445
- $[11] = t5;
3446
- $[12] = t6;
3447
- } else t6 = $[12];
3448
- return t6;
3449
- }
3450
- function _temp(demo_0) {
3451
- return /* @__PURE__ */ jsxs("div", {
3452
- className: `studio-gallery-card ${demo_0.wide ? "is-wide" : ""}`,
3453
- children: [/* @__PURE__ */ jsx("span", {
3454
- className: "studio-gallery-card-title",
3455
- children: demo_0.title
3456
- }), /* @__PURE__ */ jsx(PortalHere, { children: (portalRef) => /* @__PURE__ */ jsx("div", {
1904
+ let t2;
1905
+ if ($[3] !== demo) {
1906
+ t2 = /* @__PURE__ */ jsx(PortalHere, { children: (portalRef) => /* @__PURE__ */ jsx("div", {
3457
1907
  ref: portalRef,
3458
1908
  className: "studio-gallery-demo",
3459
- "data-inspector-name": demo_0.title,
3460
- children: demo_0.render()
3461
- }) })]
3462
- }, demo_0.id);
1909
+ "data-inspector-name": demo.title,
1910
+ children: demo.render()
1911
+ }) });
1912
+ $[3] = demo;
1913
+ $[4] = t2;
1914
+ } else t2 = $[4];
1915
+ return t2;
3463
1916
  }
3464
1917
  /** Every Povio UI component in one scrollable list; clicking a card zooms it into the token inspector. */
3465
1918
  function ComponentGallery(t0) {
@@ -3571,4 +2024,4 @@ function ComponentGallery(t0) {
3571
2024
  return t7;
3572
2025
  }
3573
2026
  //#endregion
3574
- export { ComponentArtboard, ComponentGallery as default };
2027
+ export { ComponentGallery_exports as n, ComponentDemoArtboard as t };