@jfrader/ui 0.0.0-stage → 0.1.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 (194) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +123 -2
  3. package/dist/accordion-Dl-kvgPQ.js +168 -0
  4. package/dist/accordion.js +1 -0
  5. package/dist/alert-BzntPa_5.js +129 -0
  6. package/dist/alert.js +1 -0
  7. package/dist/avatar-Dk2ES3ru.js +124 -0
  8. package/dist/avatar.js +1 -0
  9. package/dist/badge-DZefC7rm.js +102 -0
  10. package/dist/badge.js +1 -0
  11. package/dist/breadcrumbs-5MCZ_Jr3.js +125 -0
  12. package/dist/breadcrumbs.js +1 -0
  13. package/dist/button-qy-50NPd.js +187 -0
  14. package/dist/button.js +1 -0
  15. package/dist/calendar-DcCAiN3b.js +372 -0
  16. package/dist/calendar.js +1 -0
  17. package/dist/card-L-Z_1vZN.js +120 -0
  18. package/dist/card.js +1 -0
  19. package/dist/checkbox-B7em7B-6.js +134 -0
  20. package/dist/checkbox.js +1 -0
  21. package/dist/choice-control-DCyQ_hVw.js +35 -0
  22. package/dist/collection-registry-C2jnQa7X.js +97 -0
  23. package/dist/combobox-DQcXR94r.js +301 -0
  24. package/dist/combobox.js +1 -0
  25. package/dist/command-palette-BRJ8A5De.js +328 -0
  26. package/dist/command-palette.js +1 -0
  27. package/dist/container-COHiEjI8.js +34 -0
  28. package/dist/container.js +1 -0
  29. package/dist/css-CW_HG55W.js +1 -0
  30. package/dist/date-picker-D1GwiRB9.js +239 -0
  31. package/dist/date-picker.js +1 -0
  32. package/dist/dialog-CYf9fCZO.js +175 -0
  33. package/dist/dialog.js +1 -0
  34. package/dist/disclosure-caret-BC6P8AsM.js +13 -0
  35. package/dist/divider-bi7OgCI5.js +76 -0
  36. package/dist/divider.js +1 -0
  37. package/dist/field-anatomy-DKkB268x.js +104 -0
  38. package/dist/flex-CDFDDaiu.js +21 -0
  39. package/dist/flex.js +1 -0
  40. package/dist/focus-ring-qOS3rPlM.js +11 -0
  41. package/dist/icon-wrapper-BKo4FI-O.js +12 -0
  42. package/dist/index.js +37 -0
  43. package/dist/kbd-DpiJgDJ2.js +55 -0
  44. package/dist/kbd.js +1 -0
  45. package/dist/layout-style-B_6YHQ6Q.js +56 -0
  46. package/dist/loading-ring-CTpT-IrT.js +18 -0
  47. package/dist/media-8K3xDAxM.js +4 -0
  48. package/dist/menu-A9fZUaAG.js +186 -0
  49. package/dist/menu.js +1 -0
  50. package/dist/navigation-Cemnmc_J.js +174 -0
  51. package/dist/navigation.js +1 -0
  52. package/dist/pagination-orCjUsn_.js +148 -0
  53. package/dist/pagination.js +1 -0
  54. package/dist/part-id-Bg1LSlk7.js +4 -0
  55. package/dist/pill-Dg2JJHHW.js +49 -0
  56. package/dist/pill.js +1 -0
  57. package/dist/popover-D_YU34WS.js +97 -0
  58. package/dist/popover.js +1 -0
  59. package/dist/progress-XdvBG0Vv.js +83 -0
  60. package/dist/progress.js +1 -0
  61. package/dist/radio-group-CxMJ2Vq7.js +130 -0
  62. package/dist/radio-group.js +1 -0
  63. package/dist/renderable-DwPvt1I8.js +6 -0
  64. package/dist/roving-focus-DeEZ55-T.js +35 -0
  65. package/dist/select-mwFbmzsn.js +256 -0
  66. package/dist/select.js +1 -0
  67. package/dist/skeleton-qas9ZKK9.js +47 -0
  68. package/dist/skeleton.js +1 -0
  69. package/dist/spinner-ros2CfIf.js +49 -0
  70. package/dist/spinner.js +1 -0
  71. package/dist/stack-Hs8THnIL.js +20 -0
  72. package/dist/stack.js +1 -0
  73. package/dist/surface-Bo_aSQOb.js +18 -0
  74. package/dist/switch-E375Bz4X.js +135 -0
  75. package/dist/switch.js +1 -0
  76. package/dist/tabs-CBwRiuul.js +173 -0
  77. package/dist/tabs.js +1 -0
  78. package/dist/text-field-BlP8qGn_.js +73 -0
  79. package/dist/text-field.js +1 -0
  80. package/dist/textarea-CUG26CH2.js +83 -0
  81. package/dist/textarea.js +1 -0
  82. package/dist/theme-root-CrdzwfSo.js +20 -0
  83. package/dist/theme-root.js +1 -0
  84. package/dist/toast-D_dnqnn-.js +270 -0
  85. package/dist/toast.js +1 -0
  86. package/dist/toggle-group-B7gXCea8.js +150 -0
  87. package/dist/toggle-group.js +1 -0
  88. package/dist/tooltip-BJ2hLV1b.js +92 -0
  89. package/dist/tooltip.js +1 -0
  90. package/dist/trigger-style-f54idgjT.js +35 -0
  91. package/dist/types/components/accordion/accordion.d.ts +33 -0
  92. package/dist/types/components/accordion/index.d.ts +2 -0
  93. package/dist/types/components/alert/alert.d.ts +23 -0
  94. package/dist/types/components/alert/index.d.ts +2 -0
  95. package/dist/types/components/avatar/avatar.d.ts +23 -0
  96. package/dist/types/components/avatar/index.d.ts +2 -0
  97. package/dist/types/components/badge/badge.d.ts +36 -0
  98. package/dist/types/components/badge/index.d.ts +2 -0
  99. package/dist/types/components/breadcrumbs/breadcrumbs.d.ts +15 -0
  100. package/dist/types/components/breadcrumbs/index.d.ts +2 -0
  101. package/dist/types/components/button/button.d.ts +34 -0
  102. package/dist/types/components/button/index.d.ts +2 -0
  103. package/dist/types/components/calendar/calendar.d.ts +28 -0
  104. package/dist/types/components/calendar/calendar.styles.d.ts +9 -0
  105. package/dist/types/components/calendar/calendar.utils.d.ts +37 -0
  106. package/dist/types/components/calendar/index.d.ts +2 -0
  107. package/dist/types/components/card/card.d.ts +34 -0
  108. package/dist/types/components/card/index.d.ts +2 -0
  109. package/dist/types/components/checkbox/checkbox.d.ts +21 -0
  110. package/dist/types/components/checkbox/index.d.ts +2 -0
  111. package/dist/types/components/combobox/combobox.d.ts +44 -0
  112. package/dist/types/components/combobox/index.d.ts +2 -0
  113. package/dist/types/components/command-palette/command-palette.d.ts +47 -0
  114. package/dist/types/components/command-palette/command-palette.styles.d.ts +8 -0
  115. package/dist/types/components/command-palette/index.d.ts +2 -0
  116. package/dist/types/components/container/container.d.ts +14 -0
  117. package/dist/types/components/container/index.d.ts +3 -0
  118. package/dist/types/components/date-picker/date-picker.d.ts +39 -0
  119. package/dist/types/components/date-picker/index.d.ts +2 -0
  120. package/dist/types/components/dialog/dialog.d.ts +61 -0
  121. package/dist/types/components/dialog/index.d.ts +2 -0
  122. package/dist/types/components/divider/divider.d.ts +14 -0
  123. package/dist/types/components/divider/index.d.ts +2 -0
  124. package/dist/types/components/field/field-anatomy.d.ts +49 -0
  125. package/dist/types/components/flex/flex.d.ts +4 -0
  126. package/dist/types/components/flex/index.d.ts +3 -0
  127. package/dist/types/components/kbd/index.d.ts +2 -0
  128. package/dist/types/components/kbd/kbd.d.ts +6 -0
  129. package/dist/types/components/menu/index.d.ts +2 -0
  130. package/dist/types/components/menu/menu.d.ts +29 -0
  131. package/dist/types/components/navigation/index.d.ts +2 -0
  132. package/dist/types/components/navigation/navigation.d.ts +24 -0
  133. package/dist/types/components/pagination/index.d.ts +2 -0
  134. package/dist/types/components/pagination/pagination.d.ts +14 -0
  135. package/dist/types/components/pill/index.d.ts +2 -0
  136. package/dist/types/components/pill/pill.d.ts +6 -0
  137. package/dist/types/components/popover/index.d.ts +2 -0
  138. package/dist/types/components/popover/popover.d.ts +19 -0
  139. package/dist/types/components/progress/index.d.ts +2 -0
  140. package/dist/types/components/progress/progress.d.ts +19 -0
  141. package/dist/types/components/radio-group/index.d.ts +2 -0
  142. package/dist/types/components/radio-group/radio-group.d.ts +29 -0
  143. package/dist/types/components/select/index.d.ts +2 -0
  144. package/dist/types/components/select/select.d.ts +38 -0
  145. package/dist/types/components/skeleton/index.d.ts +2 -0
  146. package/dist/types/components/skeleton/skeleton.d.ts +11 -0
  147. package/dist/types/components/spinner/index.d.ts +2 -0
  148. package/dist/types/components/spinner/spinner.d.ts +8 -0
  149. package/dist/types/components/stack/index.d.ts +3 -0
  150. package/dist/types/components/stack/stack.d.ts +7 -0
  151. package/dist/types/components/switch/index.d.ts +2 -0
  152. package/dist/types/components/switch/switch.d.ts +20 -0
  153. package/dist/types/components/tabs/index.d.ts +2 -0
  154. package/dist/types/components/tabs/tabs.d.ts +22 -0
  155. package/dist/types/components/text-field/index.d.ts +2 -0
  156. package/dist/types/components/text-field/text-field.d.ts +14 -0
  157. package/dist/types/components/textarea/index.d.ts +2 -0
  158. package/dist/types/components/textarea/textarea.d.ts +17 -0
  159. package/dist/types/components/theme-root/index.d.ts +2 -0
  160. package/dist/types/components/theme-root/theme-root.d.ts +7 -0
  161. package/dist/types/components/toast/index.d.ts +2 -0
  162. package/dist/types/components/toast/toast.d.ts +37 -0
  163. package/dist/types/components/toggle-group/index.d.ts +2 -0
  164. package/dist/types/components/toggle-group/toggle-group.d.ts +29 -0
  165. package/dist/types/components/tooltip/index.d.ts +2 -0
  166. package/dist/types/components/tooltip/tooltip.d.ts +23 -0
  167. package/dist/types/index.d.ts +36 -0
  168. package/dist/types/overlay/use-native-dialog.d.ts +39 -0
  169. package/dist/types/overlay/use-overlay-floating.d.ts +11 -0
  170. package/dist/types/overlay/use-scroll-lock.d.ts +5 -0
  171. package/dist/types/styling/choice-control.d.ts +8 -0
  172. package/dist/types/styling/css.d.ts +2 -0
  173. package/dist/types/styling/disclosure-caret.d.ts +9 -0
  174. package/dist/types/styling/focus-ring.d.ts +10 -0
  175. package/dist/types/styling/icon-wrapper.d.ts +1 -0
  176. package/dist/types/styling/input-control.d.ts +1 -0
  177. package/dist/types/styling/layout-style.d.ts +26 -0
  178. package/dist/types/styling/listbox-style.d.ts +12 -0
  179. package/dist/types/styling/loading-ring.d.ts +14 -0
  180. package/dist/types/styling/media.d.ts +2 -0
  181. package/dist/types/styling/surface.d.ts +19 -0
  182. package/dist/types/styling/trigger-style.d.ts +1 -0
  183. package/dist/types/styling/visually-hidden.d.ts +1 -0
  184. package/dist/types/utils/collection-registry.d.ts +41 -0
  185. package/dist/types/utils/part-id.d.ts +2 -0
  186. package/dist/types/utils/renderable.d.ts +3 -0
  187. package/dist/types/utils/roving-focus.d.ts +18 -0
  188. package/dist/types/utils/use-controlled-state.d.ts +7 -0
  189. package/dist/types/utils/use-latest-callback.d.ts +10 -0
  190. package/dist/use-controlled-state-DQXkiTQI.js +20 -0
  191. package/dist/use-native-dialog-BCp1chwO.js +83 -0
  192. package/dist/use-overlay-floating-CsZd3qxa.js +18 -0
  193. package/dist/visually-hidden-BXVyhj0y.js +16 -0
  194. package/package.json +198 -3
@@ -0,0 +1,83 @@
1
+ import { n as e, t } from "./css-CW_HG55W.js";
2
+ import { n, t as r } from "./media-8K3xDAxM.js";
3
+ import { t as i } from "./visually-hidden-BXVyhj0y.js";
4
+ import { t as a } from "./renderable-DwPvt1I8.js";
5
+ import { forwardRef as o, useId as s } from "react";
6
+ import { vars as c } from "@jfrader/tokens/vars";
7
+ import { jsx as l, jsxs as u } from "@emotion/react/jsx-runtime";
8
+ //#region src/components/progress/progress.tsx
9
+ var d = "40%", f = "1.4s ease-in-out infinite", p = 100, m = e({
10
+ from: { transform: "translateX(-100%)" },
11
+ to: { transform: "translateX(250%)" }
12
+ }), h = e({
13
+ from: { transform: "translateX(100%)" },
14
+ to: { transform: "translateX(-250%)" }
15
+ }), g = t({
16
+ position: "relative",
17
+ display: "block",
18
+ boxSizing: "border-box",
19
+ blockSize: "4px",
20
+ overflow: "hidden",
21
+ backgroundColor: c.color.surfaceHover,
22
+ border: `1px solid ${c.color.borderSubtle}`,
23
+ borderRadius: c.radius.full
24
+ }), _ = t({
25
+ blockSize: "100%",
26
+ backgroundColor: c.color.accent,
27
+ borderRadius: c.radius.full,
28
+ transitionProperty: "width",
29
+ transitionDuration: c.motion.duration.base,
30
+ transitionTimingFunction: c.motion.easeStandard,
31
+ [n]: { transitionDuration: "0s" },
32
+ [r]: {
33
+ forcedColorAdjust: "none",
34
+ backgroundColor: "Highlight"
35
+ }
36
+ }), v = t({
37
+ inlineSize: d,
38
+ animation: `${m} ${f}`,
39
+ "&:dir(rtl)": { animation: `${h} ${f}` },
40
+ [n]: {
41
+ "&, &:dir(rtl)": { animation: "none" },
42
+ opacity: .7
43
+ }
44
+ });
45
+ function y(e, t) {
46
+ let n = Number.isFinite(t) && t > 0 ? t : p;
47
+ return {
48
+ value: e === void 0 ? void 0 : Math.min(Math.max(Number.isFinite(e) ? e : 0, 0), n),
49
+ max: n
50
+ };
51
+ }
52
+ var b = o(function({ value: e, max: t = p, label: n, getValueLabel: r, slotProps: o, "aria-labelledby": c, ...d }, f) {
53
+ let m = `${s()}-label`, h = a(n), b = [c, h && m].filter(Boolean).join(" ") || void 0, { value: x, max: S } = y(e, t), C = x === void 0, w = x === void 0 ? 0 : x / S * 100;
54
+ return /* @__PURE__ */ u("div", {
55
+ ...d,
56
+ ref: f,
57
+ role: "progressbar",
58
+ "data-ui": "progress",
59
+ "data-state": C ? "indeterminate" : "determinate",
60
+ "aria-labelledby": b,
61
+ "aria-valuemin": 0,
62
+ "aria-valuemax": S,
63
+ "aria-valuenow": x,
64
+ "aria-valuetext": x === void 0 ? void 0 : r?.(x, S),
65
+ css: g,
66
+ children: [h && /* @__PURE__ */ l("span", {
67
+ id: m,
68
+ css: i,
69
+ children: n
70
+ }), /* @__PURE__ */ l("div", {
71
+ "data-ui": "progress-indicator",
72
+ className: o?.indicator?.className,
73
+ style: C ? void 0 : { width: `${w}%` },
74
+ css: [
75
+ _,
76
+ C && v,
77
+ o?.indicator?.css
78
+ ]
79
+ })]
80
+ });
81
+ });
82
+ //#endregion
83
+ export { b as t };
@@ -0,0 +1 @@
1
+ export { t as Progress } from "./progress-XdvBG0Vv.js";
@@ -0,0 +1,130 @@
1
+ import { t as e } from "./css-CW_HG55W.js";
2
+ import { n as t, t as n } from "./media-8K3xDAxM.js";
3
+ import { t as r } from "./use-controlled-state-DQXkiTQI.js";
4
+ import { t as i } from "./renderable-DwPvt1I8.js";
5
+ import { i as a, n as o, r as s, t as c } from "./choice-control-DCyQ_hVw.js";
6
+ import { createContext as l, forwardRef as u, useContext as d, useId as f, useMemo as p } from "react";
7
+ import { vars as m } from "@jfrader/tokens/vars";
8
+ import { jsx as h, jsxs as g } from "@emotion/react/jsx-runtime";
9
+ //#region src/components/radio-group/radio-group.tsx
10
+ var _ = l(null);
11
+ function v(e) {
12
+ let t = d(_);
13
+ if (!t) throw Error(`RadioGroup.${e} must be rendered inside <RadioGroup>.`);
14
+ return t;
15
+ }
16
+ var y = "16px", b = {
17
+ vertical: e({
18
+ display: "grid",
19
+ justifyItems: "start",
20
+ gap: m.space[3]
21
+ }),
22
+ horizontal: e({
23
+ display: "flex",
24
+ flexWrap: "wrap",
25
+ alignItems: "flex-start",
26
+ gap: m.space[4]
27
+ })
28
+ }, x = e({ "input:checked + span::after": { opacity: 1 } }), S = e({ minBlockSize: "32px" }), C = e({
29
+ display: "inline-flex",
30
+ alignItems: "center",
31
+ justifyContent: "center",
32
+ flexShrink: 0,
33
+ boxSizing: "border-box",
34
+ inlineSize: y,
35
+ blockSize: y,
36
+ border: `1px solid ${m.color.borderControl}`,
37
+ borderRadius: m.radius.full,
38
+ backgroundColor: m.color.surfaceRaised,
39
+ transitionProperty: "background-color, border-color",
40
+ transitionDuration: m.motion.duration.fast,
41
+ transitionTimingFunction: m.motion.easeStandard,
42
+ "&::after": {
43
+ content: "\"\"",
44
+ inlineSize: "40%",
45
+ blockSize: "40%",
46
+ borderRadius: m.radius.full,
47
+ backgroundColor: m.color.accentContrast,
48
+ opacity: 0
49
+ },
50
+ [t]: { transitionDuration: "0s" },
51
+ [n]: { "&::after": { backgroundColor: "CanvasText" } }
52
+ }), w = e({ fontSize: m.textSize.sm }), T = e({
53
+ marginInlineStart: `calc(${y} + ${m.space[2]})`,
54
+ fontSize: m.textSize.sm,
55
+ color: m.color.textMuted
56
+ }), E = u(function({ value: e, defaultValue: t, onValueChange: n, name: i, disabled: a = !1, orientation: o = "vertical", ...s }, c) {
57
+ let l = f(), u = i ?? l, [d, m] = r(e, t, n), g = p(() => ({
58
+ value: d,
59
+ setValue: m,
60
+ name: u,
61
+ disabled: a
62
+ }), [
63
+ d,
64
+ m,
65
+ u,
66
+ a
67
+ ]);
68
+ return /* @__PURE__ */ h(_.Provider, {
69
+ value: g,
70
+ children: /* @__PURE__ */ h("div", {
71
+ ...s,
72
+ ref: c,
73
+ role: "radiogroup",
74
+ "aria-orientation": o,
75
+ "data-ui": "radio-group-root",
76
+ "data-orientation": o,
77
+ css: b[o]
78
+ })
79
+ });
80
+ }), D = u(function({ value: e, label: t, description: n, disabled: r, onChange: l, slotProps: u, className: d, "aria-labelledby": p, "aria-describedby": m, ..._ }, y) {
81
+ let { value: b, setValue: E, name: D, disabled: O } = v("Radio"), k = O || r, A = f(), j = `${A}-label`, M = `${A}-description`, N = i(t), P = i(n), F = [p, N && j].filter(Boolean).join(" ") || void 0, I = [m, P && M].filter(Boolean).join(" ") || void 0, L = [d, u?.root?.className].filter(Boolean).join(" ") || void 0, R = (t) => {
82
+ l?.(t), t.currentTarget.checked && E(e);
83
+ };
84
+ return /* @__PURE__ */ g("label", {
85
+ "data-ui": "radio-group-radio",
86
+ className: L,
87
+ css: [
88
+ s,
89
+ x,
90
+ o,
91
+ u?.root?.css
92
+ ],
93
+ children: [/* @__PURE__ */ g("span", {
94
+ css: [a, S],
95
+ children: [
96
+ /* @__PURE__ */ h("input", {
97
+ ..._,
98
+ ref: y,
99
+ type: "radio",
100
+ name: D,
101
+ value: e,
102
+ checked: b === e,
103
+ disabled: k,
104
+ "aria-labelledby": F,
105
+ "aria-describedby": I,
106
+ onChange: R,
107
+ css: c
108
+ }),
109
+ /* @__PURE__ */ h("span", {
110
+ "aria-hidden": "true",
111
+ className: u?.control?.className,
112
+ css: [C, u?.control?.css]
113
+ }),
114
+ N && /* @__PURE__ */ h("span", {
115
+ id: j,
116
+ className: u?.label?.className,
117
+ css: [w, u?.label?.css],
118
+ children: t
119
+ })
120
+ ]
121
+ }), P && /* @__PURE__ */ h("span", {
122
+ id: M,
123
+ className: u?.description?.className,
124
+ css: [T, u?.description?.css],
125
+ children: n
126
+ })]
127
+ });
128
+ }), O = Object.assign(E, { Radio: D });
129
+ //#endregion
130
+ export { O as t };
@@ -0,0 +1 @@
1
+ export { t as RadioGroup } from "./radio-group-CxMJ2Vq7.js";
@@ -0,0 +1,6 @@
1
+ //#region src/utils/renderable.ts
2
+ function e(e) {
3
+ return e != null && typeof e != "boolean";
4
+ }
5
+ //#endregion
6
+ export { e as t };
@@ -0,0 +1,35 @@
1
+ //#region src/utils/roving-focus.ts
2
+ var e = (e, t) => (e + 1) % t, t = (e, t) => (e - 1 + t) % t, n = () => 0, r = (e, t) => t - 1, i = {
3
+ horizontal: {
4
+ ArrowRight: e,
5
+ ArrowLeft: t,
6
+ Home: n,
7
+ End: r
8
+ },
9
+ horizontalRtl: {
10
+ ArrowRight: t,
11
+ ArrowLeft: e,
12
+ Home: n,
13
+ End: r
14
+ },
15
+ vertical: {
16
+ ArrowDown: e,
17
+ ArrowUp: t,
18
+ Home: n,
19
+ End: r
20
+ }
21
+ };
22
+ function a(e, { itemSelector: t, ownerSelector: n }) {
23
+ return Array.from(e.querySelectorAll(t)).filter((t) => t.closest(n) === e);
24
+ }
25
+ function o(e, t) {
26
+ if (t != null) return e.find((e) => e.dataset.value === t);
27
+ }
28
+ function s(e, t, n, r) {
29
+ let o = i[n === "horizontal" && getComputedStyle(t).direction === "rtl" ? "horizontalRtl" : n][e.key];
30
+ if (!o) return;
31
+ let s = a(t, r), c = s.indexOf(e.target);
32
+ c !== -1 && (e.preventDefault(), s[o(c, s.length)]?.focus());
33
+ }
34
+ //#endregion
35
+ export { s as n, a as r, o as t };
@@ -0,0 +1,256 @@
1
+ import { t as e } from "./css-CW_HG55W.js";
2
+ import { t } from "./use-controlled-state-DQXkiTQI.js";
3
+ import { a as n, c as r, d as i, f as a, l as o, o as s, r as c, s as l, t as u, u as d } from "./collection-registry-C2jnQa7X.js";
4
+ import { t as f } from "./trigger-style-f54idgjT.js";
5
+ import { t as p } from "./use-overlay-floating-CsZd3qxa.js";
6
+ import { createContext as m, forwardRef as h, useContext as g, useId as _, useLayoutEffect as v, useMemo as y, useRef as b, useState as x } from "react";
7
+ import { vars as S } from "@jfrader/tokens/vars";
8
+ import { jsx as C, jsxs as w } from "@emotion/react/jsx-runtime";
9
+ import { FloatingList as T, FloatingPortal as E, useClick as D, useDismiss as O, useInteractions as k, useListNavigation as A, useMergeRefs as j, useRole as M } from "@floating-ui/react";
10
+ //#region src/components/select/select.tsx
11
+ var N = 500, P = new Intl.Collator(void 0, {
12
+ usage: "search",
13
+ sensitivity: "base"
14
+ }), F = "✓", I = m(null), L = m(!1);
15
+ function R(e) {
16
+ let t = g(I);
17
+ if (!t) throw Error(`Select.${e} must be rendered inside <Select>.`);
18
+ return t;
19
+ }
20
+ function z() {
21
+ let e = R("Item");
22
+ if (!g(L)) throw Error("Select.Item must be rendered inside <Select.Content>.");
23
+ return e;
24
+ }
25
+ var B = e({
26
+ justifyContent: "flex-start",
27
+ minInlineSize: "180px",
28
+ "&[aria-expanded=\"true\"]": { backgroundColor: S.color.surfaceHover }
29
+ }), V = e({
30
+ overflow: "hidden",
31
+ textOverflow: "ellipsis",
32
+ whiteSpace: "nowrap",
33
+ "&[data-placeholder]": { color: S.color.textMuted }
34
+ });
35
+ function H({ value: e, defaultValue: r, onValueChange: i, open: a, defaultOpen: o = !1, onOpenChange: s, placement: c = "bottom-start", disabled: l = !1, name: u, children: d }) {
36
+ let f = _(), [m, h] = t(e, r, i), [g = !1, v] = t(a, o, s), [S, T] = x(null), [E, j] = x(!1), [N, F] = n(), [L, R] = x(null), z = b([]), B = b([]), V = b(null);
37
+ !g && E && (j(!1), T(null));
38
+ let { valuesByIndex: H, disabledIndices: U } = y(() => {
39
+ let e = [], t = /* @__PURE__ */ new Set();
40
+ return N.forEach((n, r) => {
41
+ n.index !== -1 && (e[n.index] = r, n.disabled && t.add(n.index));
42
+ }), {
43
+ valuesByIndex: e,
44
+ disabledIndices: t
45
+ };
46
+ }, [N]), W = m === void 0 ? void 0 : N.get(m), G = W && W.index !== -1 ? W.index : null, { refs: K, floatingStyles: q, context: J } = p({
47
+ open: g,
48
+ placement: c,
49
+ onOpenChange: (e) => v(e)
50
+ }), Y = D(J), X = M(J, { role: "listbox" }), ee = O(J, {
51
+ escapeKey: !0,
52
+ outsidePress: !0
53
+ }), te = A(J, {
54
+ listRef: z,
55
+ activeIndex: S,
56
+ onNavigate: T,
57
+ virtual: !0,
58
+ virtualItemRef: V,
59
+ loop: !0,
60
+ focusItemOnOpen: !0,
61
+ selectedIndex: E ? null : G,
62
+ disabledIndices: (e) => U.has(e)
63
+ }), { getReferenceProps: Z, getFloatingProps: Q, getItemProps: $ } = k([
64
+ Y,
65
+ X,
66
+ ee,
67
+ te
68
+ ]), ne = y(() => {
69
+ let e = (e) => {
70
+ h(e), v(!1);
71
+ };
72
+ return {
73
+ baseId: f,
74
+ open: g,
75
+ disabled: l,
76
+ selectedValue: m,
77
+ activeIndex: S,
78
+ options: N,
79
+ triggerLabelling: L,
80
+ refs: K,
81
+ floatingStyles: q,
82
+ elementsRef: z,
83
+ labelsRef: B,
84
+ getReferenceProps: Z,
85
+ getFloatingProps: Q,
86
+ getItemProps: $,
87
+ selectValue: e,
88
+ matchTypeahead: (e) => {
89
+ let t = B.current, n = S ?? -1;
90
+ for (let r = 1; r <= t.length; r += 1) {
91
+ let i = (n + r) % t.length, a = t[i];
92
+ if (!(a == null || U.has(i)) && P.compare(a.slice(0, e.length), e) === 0) {
93
+ T(i), g || (j(!0), v(!0));
94
+ return;
95
+ }
96
+ }
97
+ },
98
+ selectIndex: (t) => {
99
+ let n = H[t];
100
+ n === void 0 || U.has(t) || e(n);
101
+ },
102
+ requestOpenChange: v,
103
+ registration: F,
104
+ setTriggerLabelling: R
105
+ };
106
+ }, [
107
+ f,
108
+ g,
109
+ l,
110
+ m,
111
+ S,
112
+ N,
113
+ L,
114
+ K,
115
+ q,
116
+ Z,
117
+ Q,
118
+ $,
119
+ H,
120
+ U,
121
+ h,
122
+ v,
123
+ F
124
+ ]);
125
+ return /* @__PURE__ */ w(I.Provider, {
126
+ value: ne,
127
+ children: [d, u !== void 0 && /* @__PURE__ */ C("input", {
128
+ type: "hidden",
129
+ name: u,
130
+ value: m ?? "",
131
+ disabled: l
132
+ })]
133
+ });
134
+ }
135
+ var U = h(function({ id: e, disabled: t, onKeyDown: n, ...r }, i) {
136
+ let { baseId: a, open: o, disabled: s, activeIndex: c, refs: l, getReferenceProps: u, selectIndex: d, matchTypeahead: p, requestOpenChange: m, setTriggerLabelling: h } = R("Trigger"), g = j([l.setReference, i]), _ = b({
137
+ search: "",
138
+ lastKeyAt: 0
139
+ }), y = e ?? `${a}-trigger`, x = r["aria-labelledby"], S = r["aria-label"];
140
+ v(() => (h({
141
+ id: y,
142
+ labelledBy: x,
143
+ label: S
144
+ }), () => h(null)), [
145
+ y,
146
+ x,
147
+ S,
148
+ h
149
+ ]);
150
+ let w = (e) => {
151
+ if (n?.(e), !(e.defaultPrevented || s || t)) {
152
+ if (e.key.length === 1 && e.key !== " " && !e.ctrlKey && !e.altKey && !e.metaKey) {
153
+ let t = performance.now(), n = _.current, r = (t - n.lastKeyAt > N ? "" : n.search) + e.key;
154
+ _.current = {
155
+ search: r,
156
+ lastKeyAt: t
157
+ }, p(r);
158
+ } else o && (e.key === "Tab" ? m(!1) : (e.key === "Enter" || e.key === " ") && c !== null && (e.preventDefault(), d(c)));
159
+ }
160
+ };
161
+ return /* @__PURE__ */ C("button", {
162
+ type: "button",
163
+ ...u({
164
+ ...r,
165
+ id: y,
166
+ disabled: s || t,
167
+ onKeyDown: w
168
+ }),
169
+ ref: g,
170
+ "data-state": o ? "open" : "closed",
171
+ "data-ui": "select-trigger",
172
+ css: [f, B]
173
+ });
174
+ }), W = h(function({ placeholder: e, ...t }, n) {
175
+ let { selectedValue: r, options: i } = R("Value"), a = r === void 0 ? void 0 : i.get(r)?.label, o = a === void 0;
176
+ return /* @__PURE__ */ C("span", {
177
+ ...t,
178
+ ref: n,
179
+ "data-placeholder": o || void 0,
180
+ "data-ui": "select-value",
181
+ css: V,
182
+ children: o ? e : a
183
+ });
184
+ }), G = h(function({ style: e, onMouseDown: t, children: n, ...r }, o) {
185
+ let { open: s, triggerLabelling: c, refs: l, floatingStyles: u, elementsRef: d, getFloatingProps: f } = R("Content"), p = j([s ? l.setFloating : null, o]), m = r["aria-labelledby"] !== void 0 || r["aria-label"] !== void 0 ? {} : c?.labelledBy === void 0 ? c?.label === void 0 ? { "aria-labelledby": c?.id } : { "aria-label": c.label } : { "aria-labelledby": c.labelledBy }, h = (e) => {
186
+ t?.(e), e.preventDefault();
187
+ };
188
+ return /* @__PURE__ */ C(E, { children: /* @__PURE__ */ C("div", {
189
+ ...f({
190
+ ...m,
191
+ ...r,
192
+ onMouseDown: h
193
+ }),
194
+ ref: p,
195
+ hidden: !s,
196
+ "data-state": s ? "open" : "closed",
197
+ "data-ui": "select-listbox",
198
+ style: {
199
+ ...e,
200
+ ...u
201
+ },
202
+ css: [a, i],
203
+ children: /* @__PURE__ */ C(T, {
204
+ elementsRef: d,
205
+ children: /* @__PURE__ */ C(L.Provider, {
206
+ value: !0,
207
+ children: n
208
+ })
209
+ })
210
+ }) });
211
+ }), K = h(function({ value: e, disabled: t = !1, onClick: n, children: i, ...a }, f) {
212
+ let { baseId: p, selectedValue: m, activeIndex: h, labelsRef: g, getItemProps: _, selectValue: v, registration: y } = z(), x = b(null), { ref: S, index: T } = c(e, y, x, (e, n) => ({
213
+ index: e,
214
+ label: n,
215
+ disabled: t
216
+ }), {
217
+ labelsRef: g,
218
+ include: !t
219
+ }), E = j([S, f]), D = T !== -1 && h === T, O = m === e, k = (r) => {
220
+ n?.(r), !(t || r.defaultPrevented) && v(e);
221
+ };
222
+ return /* @__PURE__ */ w("div", {
223
+ ..._({
224
+ id: u(p, e),
225
+ ...a,
226
+ onClick: k
227
+ }),
228
+ ref: E,
229
+ role: "option",
230
+ "aria-selected": O,
231
+ "aria-disabled": t || void 0,
232
+ "data-active": D || void 0,
233
+ "data-ui": "select-item",
234
+ css: [
235
+ l,
236
+ s,
237
+ o
238
+ ],
239
+ children: [/* @__PURE__ */ C("span", {
240
+ ref: x,
241
+ css: d,
242
+ children: i
243
+ }), O && /* @__PURE__ */ C("span", {
244
+ "aria-hidden": "true",
245
+ css: r,
246
+ children: F
247
+ })]
248
+ });
249
+ }), q = Object.assign(H, {
250
+ Trigger: U,
251
+ Value: W,
252
+ Content: G,
253
+ Item: K
254
+ });
255
+ //#endregion
256
+ export { q as t };
package/dist/select.js ADDED
@@ -0,0 +1 @@
1
+ export { t as Select } from "./select-mwFbmzsn.js";
@@ -0,0 +1,47 @@
1
+ import { n as e, t } from "./css-CW_HG55W.js";
2
+ import { n } from "./media-8K3xDAxM.js";
3
+ import { forwardRef as r } from "react";
4
+ import { vars as i } from "@jfrader/tokens/vars";
5
+ import { jsx as a } from "@emotion/react/jsx-runtime";
6
+ //#region src/components/skeleton/skeleton.tsx
7
+ var o = e({
8
+ from: { backgroundPosition: "200% 0" },
9
+ to: { backgroundPosition: "-100% 0" }
10
+ }), s = t({
11
+ display: "block",
12
+ inlineSize: "100%",
13
+ blockSize: "1em",
14
+ flexShrink: 0,
15
+ borderRadius: i.radius.sm,
16
+ backgroundColor: i.color.surfaceHover,
17
+ backgroundImage: `linear-gradient(90deg, transparent, ${i.color.border}, transparent)`,
18
+ backgroundSize: "200% 100%",
19
+ backgroundRepeat: "no-repeat",
20
+ animation: `${o} 1.6s ease-in-out infinite`,
21
+ "&:dir(rtl)": { animationDirection: "reverse" },
22
+ [n]: {
23
+ animation: "none",
24
+ backgroundImage: "none"
25
+ }
26
+ }), c = t({
27
+ inlineSize: i.space[10],
28
+ blockSize: "auto",
29
+ aspectRatio: "1",
30
+ borderRadius: i.radius.full
31
+ }), l = r(function({ width: e, height: t, circle: n = !1, radius: r, style: i, ...o }, l) {
32
+ return /* @__PURE__ */ a("div", {
33
+ ...o,
34
+ ref: l,
35
+ "aria-hidden": "true",
36
+ "data-ui": "skeleton",
37
+ style: {
38
+ inlineSize: e,
39
+ blockSize: t,
40
+ borderRadius: n ? void 0 : r,
41
+ ...i
42
+ },
43
+ css: [s, n && c]
44
+ });
45
+ });
46
+ //#endregion
47
+ export { l as t };
@@ -0,0 +1 @@
1
+ export { t as Skeleton } from "./skeleton-qas9ZKK9.js";
@@ -0,0 +1,49 @@
1
+ import { t as e } from "./css-CW_HG55W.js";
2
+ import { n as t } from "./media-8K3xDAxM.js";
3
+ import { t as n } from "./visually-hidden-BXVyhj0y.js";
4
+ import { n as r, t as i } from "./loading-ring-CTpT-IrT.js";
5
+ import { forwardRef as a } from "react";
6
+ import { vars as o } from "@jfrader/tokens/vars";
7
+ import { jsx as s, jsxs as c } from "@emotion/react/jsx-runtime";
8
+ //#region src/components/spinner/spinner.tsx
9
+ var l = e({
10
+ position: "relative",
11
+ display: "inline-flex",
12
+ verticalAlign: "middle"
13
+ }), u = e({
14
+ ...i,
15
+ flexShrink: 0,
16
+ boxSizing: "border-box",
17
+ [t]: { animation: `${r} 1.6s ease-in-out infinite alternate` }
18
+ }), d = {
19
+ sm: e({
20
+ inlineSize: o.space[4],
21
+ blockSize: o.space[4]
22
+ }),
23
+ md: e({
24
+ inlineSize: o.space[5],
25
+ blockSize: o.space[5]
26
+ }),
27
+ lg: e({
28
+ inlineSize: o.space[6],
29
+ blockSize: o.space[6]
30
+ })
31
+ }, f = a(function({ size: e = "md", label: t = "Loading", ...r }, i) {
32
+ return /* @__PURE__ */ c("span", {
33
+ ...r,
34
+ ref: i,
35
+ role: "status",
36
+ "data-ui": "spinner",
37
+ css: l,
38
+ children: [/* @__PURE__ */ s("span", {
39
+ "aria-hidden": "true",
40
+ "data-ui": "spinner-indicator",
41
+ css: [u, d[e]]
42
+ }), /* @__PURE__ */ s("span", {
43
+ css: n,
44
+ children: t
45
+ })]
46
+ });
47
+ });
48
+ //#endregion
49
+ export { f as t };
@@ -0,0 +1 @@
1
+ export { t as Spinner } from "./spinner-ros2CfIf.js";
@@ -0,0 +1,20 @@
1
+ import { t as e } from "./layout-style-B_6YHQ6Q.js";
2
+ import { forwardRef as t } from "react";
3
+ import { jsx as n } from "@emotion/react/jsx-runtime";
4
+ //#region src/components/stack/stack.tsx
5
+ var r = t(function({ gap: t = "md", align: r, justify: i, wrap: a, ...o }, s) {
6
+ return /* @__PURE__ */ n("div", {
7
+ ...o,
8
+ ref: s,
9
+ "data-ui": "stack",
10
+ css: e({
11
+ direction: "column",
12
+ gap: t,
13
+ align: r,
14
+ justify: i,
15
+ wrap: a
16
+ })
17
+ });
18
+ });
19
+ //#endregion
20
+ export { r as t };
package/dist/stack.js ADDED
@@ -0,0 +1 @@
1
+ export { t as Stack } from "./stack-Hs8THnIL.js";
@@ -0,0 +1,18 @@
1
+ import { vars as e } from "@jfrader/tokens/vars";
2
+ //#region src/styling/surface.ts
3
+ var t = {
4
+ boxSizing: "border-box",
5
+ backgroundColor: e.color.surfaceRaised,
6
+ border: `1px solid ${e.color.border}`,
7
+ color: e.color.text,
8
+ fontFamily: e.font.sans,
9
+ lineHeight: e.lineHeight.base
10
+ }, n = {
11
+ border: 0,
12
+ padding: 0,
13
+ background: "transparent",
14
+ color: "inherit",
15
+ "&::backdrop": { backgroundColor: e.color.scrim }
16
+ };
17
+ //#endregion
18
+ export { t as n, n as t };