@jfrader/ui 0.6.0 → 0.7.1

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 (96) hide show
  1. package/README.md +11 -6
  2. package/dist/avatar-BuM1zB_f.js +164 -0
  3. package/dist/{avatar-group-DvP8mAE-.js → avatar-group-D1UEihvh.js} +1 -1
  4. package/dist/avatar-group.js +1 -1
  5. package/dist/avatar.js +1 -1
  6. package/dist/card-frame-CcLa6NQ4.js +13 -0
  7. package/dist/{chat-thread-DVa17BRC.js → chat-thread-CMhwxhoA.js} +1 -1
  8. package/dist/chat-thread.js +1 -1
  9. package/dist/{comment-thread-BnUHxviq.js → comment-thread-DbOzYr0q.js} +1 -1
  10. package/dist/comment-thread.js +1 -1
  11. package/dist/emblem-DnXmpZCh.js +166 -0
  12. package/dist/emblem.js +2 -0
  13. package/dist/flip-game-card-xmcR_QSq.js +100 -0
  14. package/dist/flip-game-card.js +2 -0
  15. package/dist/game-card-Bnhpz78f.js +187 -0
  16. package/dist/game-card.js +2 -0
  17. package/dist/{hover-card-DN1EAlQA.js → hover-card--ijYr1cd.js} +1 -1
  18. package/dist/hover-card.js +1 -1
  19. package/dist/in-view-title-BUZCMqge.js +225 -0
  20. package/dist/in-view-title.js +2 -0
  21. package/dist/index.js +70 -65
  22. package/dist/initials-DEdwNe9_.js +18 -0
  23. package/dist/locale-switcher-DTkySKsM.js +375 -0
  24. package/dist/locale-switcher.js +1 -1
  25. package/dist/{thread-parts-DfZNz70v.js → thread-parts-DbKhuwVU.js} +1 -1
  26. package/dist/{timeline-DaldDMX7.js → timeline-BPKY94mT.js} +1 -1
  27. package/dist/timeline.js +1 -1
  28. package/dist/types/components/activity-rings/activity-rings.d.ts +7 -9
  29. package/dist/types/components/avatar/avatar.d.ts +3 -1
  30. package/dist/types/components/avatar-group/avatar-group.d.ts +3 -3
  31. package/dist/types/components/button/button.d.ts +7 -7
  32. package/dist/types/components/card/card.d.ts +4 -1
  33. package/dist/types/components/chip-group/chip-group.d.ts +2 -2
  34. package/dist/types/components/combobox/combobox.d.ts +2 -2
  35. package/dist/types/components/command-palette/command-palette.d.ts +1 -1
  36. package/dist/types/components/comment-thread/comment-thread.d.ts +4 -4
  37. package/dist/types/components/copy-button/copy-button.d.ts +6 -6
  38. package/dist/types/components/countdown/countdown.d.ts +2 -2
  39. package/dist/types/components/dialog/dialog.d.ts +18 -20
  40. package/dist/types/components/drawer/drawer.d.ts +2 -2
  41. package/dist/types/components/emblem/emblem.d.ts +59 -0
  42. package/dist/types/components/emblem/index.d.ts +2 -0
  43. package/dist/types/components/empty-state/empty-state.d.ts +2 -2
  44. package/dist/types/components/file-dropzone/file-dropzone.d.ts +3 -4
  45. package/dist/types/components/filter-toolbar/filter-toolbar.d.ts +2 -2
  46. package/dist/types/components/flip-game-card/flip-game-card.d.ts +22 -0
  47. package/dist/types/components/flip-game-card/index.d.ts +2 -0
  48. package/dist/types/components/game-card/card-frame.d.ts +16 -0
  49. package/dist/types/components/game-card/decks.d.ts +27 -0
  50. package/dist/types/components/game-card/game-card.d.ts +37 -0
  51. package/dist/types/components/game-card/index.d.ts +4 -0
  52. package/dist/types/components/hold-to-confirm/hold-to-confirm.d.ts +1 -1
  53. package/dist/types/components/hover-card/hover-card.d.ts +5 -5
  54. package/dist/types/components/in-view-title/in-view-title.d.ts +23 -0
  55. package/dist/types/components/in-view-title/index.d.ts +1 -0
  56. package/dist/types/components/inline-edit/inline-edit.d.ts +6 -6
  57. package/dist/types/components/json-viewer/json-viewer.d.ts +7 -9
  58. package/dist/types/components/keycap-keyboard/keycap-keyboard.d.ts +1 -1
  59. package/dist/types/components/link-unfurl/link-unfurl.d.ts +17 -7
  60. package/dist/types/components/locale-switcher/locale-switcher.d.ts +17 -11
  61. package/dist/types/components/mention-input/mention-input.d.ts +7 -7
  62. package/dist/types/components/metric-card/metric-card.d.ts +2 -2
  63. package/dist/types/components/navigation/navigation.d.ts +1 -1
  64. package/dist/types/components/next/emotion-registry.d.ts +3 -5
  65. package/dist/types/components/now-playing/now-playing.d.ts +2 -2
  66. package/dist/types/components/password-field/password-field.d.ts +1 -1
  67. package/dist/types/components/progress/progress.d.ts +1 -1
  68. package/dist/types/components/select/select.d.ts +1 -1
  69. package/dist/types/components/sheet-stack/sheet-stack.d.ts +19 -16
  70. package/dist/types/components/signature-pad/signature-pad.d.ts +2 -2
  71. package/dist/types/components/split-button/split-button.d.ts +3 -4
  72. package/dist/types/components/swipe-actions/swipe-actions.d.ts +1 -2
  73. package/dist/types/components/tag-input/tag-input.d.ts +2 -3
  74. package/dist/types/components/theme-root/theme-root.d.ts +5 -6
  75. package/dist/types/components/theme-switch/theme-switch.d.ts +3 -3
  76. package/dist/types/components/time-picker/time-picker.d.ts +2 -2
  77. package/dist/types/components/timeline/timeline.d.ts +4 -4
  78. package/dist/types/components/toast/toast.d.ts +3 -3
  79. package/dist/types/components/tree-view/tree-view.d.ts +4 -3
  80. package/dist/types/components/typewriter-terminal/index.d.ts +2 -0
  81. package/dist/types/components/typewriter-terminal/typewriter-terminal.d.ts +87 -0
  82. package/dist/types/components/usage-meter/usage-meter.d.ts +4 -4
  83. package/dist/types/components/usage-meter/usage-model.d.ts +1 -1
  84. package/dist/types/components/user-menu/user-menu.d.ts +3 -4
  85. package/dist/types/index.d.ts +5 -0
  86. package/dist/types/styling/motion-timings.d.ts +5 -0
  87. package/dist/types/styling/sx.d.ts +1 -1
  88. package/dist/types/styling/theme.d.ts +13 -0
  89. package/dist/types/utils/initials.d.ts +2 -0
  90. package/dist/typewriter-terminal-BUEsMzo3.js +588 -0
  91. package/dist/typewriter-terminal.js +2 -0
  92. package/dist/{user-menu-DzELTg1x.js → user-menu-Czrrk93A.js} +1 -1
  93. package/dist/user-menu.js +1 -1
  94. package/package.json +22 -2
  95. package/dist/avatar-B6idYC59.js +0 -146
  96. package/dist/locale-switcher-CZF7XNYG.js +0 -295
@@ -1,146 +0,0 @@
1
- 'use client';
2
- import { i as e } from "./css-BYJhdGh-.js";
3
- import { n as t } from "./media-8yrN85VT.js";
4
- import { t as n } from "./sx-BJXJ2xJK.js";
5
- import { useState as r } from "react";
6
- import { vars as i } from "@jfrader/tokens/vars";
7
- import { jsx as a, jsxs as o } from "@emotion/react/jsx-runtime";
8
- //#region src/components/avatar/avatar.tsx
9
- var s = 2, c = new Intl.Segmenter(void 0, { granularity: "grapheme" });
10
- function l(e) {
11
- let t = Array.from(c.segment(e), ({ segment: e }) => e), n = t[0] ?? "";
12
- if (!/\p{Extended_Pictographic}/u.test(n)) return n;
13
- let r = "";
14
- for (let e of t) {
15
- if (!/\p{Extended_Pictographic}/u.test(e)) break;
16
- r += e;
17
- }
18
- return r;
19
- }
20
- function u(e) {
21
- return e.trim().split(/\s+/).filter(Boolean).slice(0, s).map(l).join("").toLocaleUpperCase();
22
- }
23
- var d = e({
24
- position: "relative",
25
- display: "inline-flex",
26
- alignItems: "center",
27
- justifyContent: "center",
28
- flexShrink: 0,
29
- boxSizing: "border-box",
30
- borderRadius: i.radius.full,
31
- backgroundColor: i.color.surfaceHover,
32
- color: i.color.text,
33
- fontWeight: i.fontWeight.medium,
34
- lineHeight: 1,
35
- userSelect: "none",
36
- verticalAlign: "middle",
37
- [t]: { outline: "1px solid CanvasText" }
38
- }), f = {
39
- sm: e({
40
- inlineSize: i.space[6],
41
- blockSize: i.space[6],
42
- fontSize: i.textSize.xs
43
- }),
44
- md: e({
45
- inlineSize: i.space[8],
46
- blockSize: i.space[8],
47
- fontSize: i.textSize.sm
48
- }),
49
- lg: e({
50
- inlineSize: i.space[10],
51
- blockSize: i.space[10],
52
- fontSize: i.textSize.md
53
- })
54
- }, p = e({
55
- display: "block",
56
- inlineSize: "100%",
57
- blockSize: "100%",
58
- borderRadius: i.radius.full,
59
- objectFit: "cover"
60
- }), m = e({
61
- position: "absolute",
62
- insetBlockEnd: 0,
63
- insetInlineEnd: 0,
64
- inlineSize: "25%",
65
- blockSize: "25%",
66
- "&::before": {
67
- content: "\"\"",
68
- position: "absolute",
69
- insetBlockStart: 0,
70
- insetInlineStart: 0,
71
- inlineSize: "100%",
72
- blockSize: "100%",
73
- boxSizing: "border-box",
74
- borderRadius: i.radius.full,
75
- boxShadow: `0 0 0 2px ${i.color.bg}`
76
- }
77
- }), h = {
78
- online: e({ "&::before": { backgroundColor: i.color.success } }),
79
- away: e({ "&::before": {
80
- border: `2px solid ${i.color.warning}`,
81
- backgroundColor: "transparent"
82
- } }),
83
- busy: e({ "&::before": {
84
- backgroundColor: i.color.danger,
85
- blockSize: "30%",
86
- insetBlockStart: "35%"
87
- } }),
88
- offline: e({ "&::before": {
89
- backgroundColor: i.color.textSubtle,
90
- inlineSize: "60%",
91
- blockSize: "60%",
92
- insetBlockStart: "20%",
93
- insetInlineStart: "20%"
94
- } })
95
- }, g = e({ [t]: {
96
- "&::before": {
97
- forcedColorAdjust: "none",
98
- backgroundColor: "CanvasText",
99
- outline: "2px solid Canvas"
100
- },
101
- "&[data-status=\"away\"]::before": {
102
- borderColor: "CanvasText",
103
- backgroundColor: "Canvas"
104
- }
105
- } });
106
- function _({ ref: e, name: t, src: i, size: s = "md", status: c, statusLabel: l, slotProps: _, className: v, sx: y, ...b }) {
107
- let [x, S] = r(), C = i !== void 0 && i !== "" && i !== x, w = c === void 0 ? t : `${t}, ${l ?? c}`;
108
- return /* @__PURE__ */ a(n, {
109
- className: v,
110
- styles: [d, f[s]],
111
- sx: y,
112
- children: (n) => /* @__PURE__ */ o("span", {
113
- ...b,
114
- ref: e,
115
- "data-ui": "avatar",
116
- role: "img",
117
- "aria-label": w,
118
- className: n,
119
- children: [C ? /* @__PURE__ */ a("img", {
120
- src: i,
121
- alt: "",
122
- onError: () => S(i),
123
- className: _?.image?.className,
124
- css: [p, _?.image?.css]
125
- }) : /* @__PURE__ */ a("span", {
126
- "aria-hidden": "true",
127
- className: _?.fallback?.className,
128
- css: _?.fallback?.css,
129
- children: u(t)
130
- }), c !== void 0 && /* @__PURE__ */ a("span", {
131
- "aria-hidden": "true",
132
- "data-status": c,
133
- className: _?.status?.className,
134
- css: [
135
- m,
136
- h[c],
137
- g,
138
- _?.status?.css
139
- ]
140
- })]
141
- })
142
- });
143
- }
144
- _.displayName = "Avatar";
145
- //#endregion
146
- export { _ as t };
@@ -1,295 +0,0 @@
1
- 'use client';
2
- import { i as e } from "./css-BYJhdGh-.js";
3
- import { n as t } from "./focus-ring-BK5W5_NY.js";
4
- import { r as n } from "./media-8yrN85VT.js";
5
- import { t as r } from "./sx-BJXJ2xJK.js";
6
- import { t as i } from "./visually-hidden-DgVO3NaB.js";
7
- import { t as a } from "./renderable-DzcIj1Lo.js";
8
- import { t as o } from "./icon-wrapper-C-zMD0uL.js";
9
- import { t as s } from "./trigger-style-CtOrdPk4.js";
10
- import { o as c, r as l, s as u } from "./listbox-style-DNOxAulu.js";
11
- import { a as d, i as f, l as p, r as m, s as h, u as g } from "./menu-CVzpsyXn.js";
12
- import { useEffect as _, useId as v } from "react";
13
- import { vars as y } from "@jfrader/tokens/vars";
14
- import { Fragment as b, jsx as x, jsxs as S } from "@emotion/react/jsx-runtime";
15
- import { useMergeRefs as C } from "@floating-ui/react";
16
- //#region src/components/locale-switcher/locale-switcher.tsx
17
- var w = "LocaleSwitcher", T = "✓", E = e({
18
- display: "inline-flex",
19
- alignItems: "center",
20
- minInlineSize: 0,
21
- maxInlineSize: "100%",
22
- fontFamily: y.font.sans,
23
- lineHeight: y.lineHeight.tight,
24
- color: y.color.text
25
- }), D = {
26
- sm: e({ fontSize: y.textSize.sm }),
27
- md: e({ fontSize: y.textSize.sm }),
28
- lg: e({ fontSize: y.textSize.md })
29
- }, O = e({
30
- gap: y.space[2],
31
- maxInlineSize: "100%",
32
- fontSize: "inherit",
33
- whiteSpace: "nowrap"
34
- }), k = {
35
- sm: e({
36
- minBlockSize: y.space[8],
37
- paddingInline: y.space[3]
38
- }),
39
- md: e({
40
- minBlockSize: y.space[10],
41
- paddingInline: y.space[4]
42
- }),
43
- lg: e({
44
- minBlockSize: y.space[12],
45
- paddingInline: y.space[5]
46
- })
47
- }, A = e({
48
- display: "inline-flex",
49
- transitionProperty: "transform",
50
- transitionDuration: y.motion.duration.fast,
51
- transitionTimingFunction: y.motion.easeStandard,
52
- "& svg": {
53
- inlineSize: "1em",
54
- blockSize: "1em"
55
- },
56
- "[aria-expanded=\"true\"] > &": { transform: "rotate(180deg)" },
57
- [n]: { transitionDuration: "0s" }
58
- }), j = e({
59
- gap: y.space[2],
60
- textDecoration: "none",
61
- "&[aria-current=\"true\"]": { fontWeight: y.fontWeight.medium }
62
- }), M = e({ marginInlineStart: "auto" }), N = e({
63
- display: "flex",
64
- flexWrap: "wrap",
65
- alignItems: "center",
66
- gap: y.space[3],
67
- margin: 0,
68
- padding: 0,
69
- listStyle: "none"
70
- }), P = e({
71
- display: "inline-flex",
72
- alignItems: "center",
73
- minBlockSize: y.space[8],
74
- borderRadius: y.radius.sm
75
- }), F = e({
76
- color: y.color.accentText,
77
- textDecoration: "underline",
78
- textUnderlineOffset: "0.2em",
79
- transitionProperty: "color",
80
- transitionDuration: y.motion.duration.fast,
81
- transitionTimingFunction: y.motion.easeStandard,
82
- "&:hover": { color: y.color.text },
83
- "&:focus-visible": { ...t },
84
- [n]: { transitionDuration: "0s" }
85
- }), I = e({
86
- color: y.color.text,
87
- fontWeight: y.fontWeight.medium
88
- }), L = /* @__PURE__ */ S("svg", {
89
- viewBox: "0 0 24 24",
90
- fill: "none",
91
- stroke: "currentColor",
92
- strokeWidth: "2",
93
- strokeLinecap: "round",
94
- focusable: "false",
95
- children: [/* @__PURE__ */ x("circle", {
96
- cx: "12",
97
- cy: "12",
98
- r: "9"
99
- }), /* @__PURE__ */ x("path", { d: "M3 12h18M12 3c2.5 2.5 3.75 5.5 3.75 9S14.5 18.5 12 21c-2.5-2.5-3.75-5.5-3.75-9S9.5 5.5 12 3Z" })]
100
- }), R = /* @__PURE__ */ x("svg", {
101
- viewBox: "0 0 16 16",
102
- fill: "none",
103
- stroke: "currentColor",
104
- strokeWidth: "1.5",
105
- strokeLinecap: "round",
106
- strokeLinejoin: "round",
107
- children: /* @__PURE__ */ x("path", { d: "M4 6l4 4 4-4" })
108
- });
109
- function z({ option: e, current: t, link: n, adornment: r, ...i }) {
110
- let a = {
111
- ...i,
112
- lang: e.lang,
113
- dir: "auto",
114
- "aria-current": t ? "true" : void 0,
115
- children: /* @__PURE__ */ S(b, { children: [e.label, r] })
116
- };
117
- if (!n) return /* @__PURE__ */ x("span", { ...a });
118
- let o = {
119
- ...a,
120
- href: e.href,
121
- hrefLang: e.lang
122
- };
123
- return e.render ? e.render(o) : /* @__PURE__ */ x("a", { ...o });
124
- }
125
- function B({ styles: e, slot: t, ...n }) {
126
- return /* @__PURE__ */ x(r, {
127
- className: t?.className,
128
- styles: [
129
- P,
130
- e,
131
- t?.css
132
- ],
133
- children: (e) => /* @__PURE__ */ x(z, {
134
- ...n,
135
- "data-ui": "locale-switcher-option",
136
- className: e
137
- })
138
- });
139
- }
140
- function V({ options: e, value: t, current: n, size: r, triggerLabel: _, icon: y, open: b, defaultOpen: C, onOpenChange: E, placement: D, slotProps: N }) {
141
- let P = v(), F = `${P}-action`, I = `${P}-current`, { className: L, css: B, ...V } = N?.trigger ?? {}, { className: H, css: U, ...W } = N?.content ?? {}, G = N?.option;
142
- return /* @__PURE__ */ S(f, {
143
- open: b,
144
- defaultOpen: C,
145
- onOpenChange: E,
146
- placement: D,
147
- children: [/* @__PURE__ */ S(h, {
148
- ...V,
149
- "aria-labelledby": p(_ ? F : void 0, n ? I : void 0),
150
- family: w,
151
- marker: "locale-switcher-trigger",
152
- styles: [
153
- s,
154
- O,
155
- k[r],
156
- B
157
- ],
158
- className: L,
159
- children: [
160
- _ && /* @__PURE__ */ x("span", {
161
- id: F,
162
- css: i,
163
- children: _
164
- }),
165
- a(y) && /* @__PURE__ */ x("span", {
166
- "aria-hidden": "true",
167
- css: o,
168
- children: y
169
- }),
170
- n && /* @__PURE__ */ x("span", {
171
- id: I,
172
- lang: n.lang,
173
- dir: "auto",
174
- children: n.label
175
- }),
176
- /* @__PURE__ */ x("span", {
177
- "aria-hidden": "true",
178
- css: A,
179
- children: R
180
- })
181
- ]
182
- }), /* @__PURE__ */ x(m, {
183
- ...W,
184
- family: w,
185
- marker: "locale-switcher-menu",
186
- styles: [
187
- u,
188
- c,
189
- U
190
- ],
191
- className: H,
192
- defaultLabelledBy: _ ? F : void 0,
193
- children: e.map((e) => {
194
- let n = e.value === t;
195
- return /* @__PURE__ */ x(d, {
196
- family: w,
197
- marker: "locale-switcher-option",
198
- styles: [
199
- g,
200
- j,
201
- G?.css
202
- ],
203
- className: G?.className,
204
- render: (t) => /* @__PURE__ */ x(z, {
205
- ...t,
206
- option: e,
207
- current: n,
208
- link: !0,
209
- adornment: n && /* @__PURE__ */ x("span", {
210
- "aria-hidden": "true",
211
- css: [l, M],
212
- children: T
213
- })
214
- })
215
- }, e.value);
216
- })
217
- })]
218
- });
219
- }
220
- function H({ options: e, value: t, slotProps: n }) {
221
- let r = e.find((e) => e.value !== t);
222
- return r ? /* @__PURE__ */ x(B, {
223
- option: r,
224
- current: !1,
225
- link: !0,
226
- styles: F,
227
- slot: n?.option
228
- }) : null;
229
- }
230
- function U({ options: e, value: t, slotProps: n }) {
231
- return /* @__PURE__ */ x("ul", {
232
- css: N,
233
- children: e.map((e) => {
234
- let r = e.value === t;
235
- return /* @__PURE__ */ x("li", { children: /* @__PURE__ */ x(B, {
236
- option: e,
237
- current: r,
238
- link: !r,
239
- styles: r ? I : F,
240
- slot: n?.option
241
- }) }, e.value);
242
- })
243
- });
244
- }
245
- var W = {
246
- menu: V,
247
- swap: H,
248
- inline: U
249
- }, G = {
250
- menu: "div",
251
- swap: "div",
252
- inline: "nav"
253
- };
254
- function K({ ref: e, options: t, value: n, variant: i = "menu", size: a = "md", triggerLabel: o, label: s, icon: c = L, open: l, defaultOpen: u, onOpenChange: d, placement: f, slotProps: p, className: m, sx: h, ...g }) {
255
- let v = C([e]), y = t.find((e) => e.value === n), b = t.length, S = y !== void 0, w = !!o;
256
- _(() => {
257
- process.env.NODE_ENV !== "production" && (S || console.warn(`LocaleSwitcher: value "${n}" matches no option.`), i === "swap" && b !== 2 && console.warn(`LocaleSwitcher: the swap variant expects exactly two options and got ${b}; it links to the first option that is not current.`), i === "menu" && !w && console.warn("LocaleSwitcher: the menu variant needs a triggerLabel that names its action."));
258
- }, [
259
- i,
260
- n,
261
- S,
262
- b,
263
- w
264
- ]);
265
- let T = G[i], O = W[i];
266
- return /* @__PURE__ */ x(r, {
267
- className: m,
268
- styles: [E, D[a]],
269
- sx: h,
270
- children: (e) => /* @__PURE__ */ x(T, {
271
- ...g,
272
- ref: v,
273
- "aria-label": g["aria-label"] ?? (i === "inline" ? s : void 0),
274
- "data-ui": "locale-switcher",
275
- "data-variant": i,
276
- className: e,
277
- children: /* @__PURE__ */ x(O, {
278
- options: t,
279
- value: n,
280
- current: y,
281
- size: a,
282
- triggerLabel: o,
283
- icon: c,
284
- open: l,
285
- defaultOpen: u,
286
- onOpenChange: d,
287
- placement: f,
288
- slotProps: p
289
- })
290
- })
291
- });
292
- }
293
- K.displayName = "LocaleSwitcher";
294
- //#endregion
295
- export { K as t };