@jfrader/ui 0.6.0 → 0.7.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 (90) hide show
  1. package/README.md +10 -6
  2. package/dist/{avatar-group-DvP8mAE-.js → avatar-group-BlMLNw4J.js} +1 -1
  3. package/dist/avatar-group.js +1 -1
  4. package/dist/avatar-sPxDqFiZ.js +133 -0
  5. package/dist/avatar.js +1 -1
  6. package/dist/{chat-thread-DVa17BRC.js → chat-thread-DkB-WMWJ.js} +1 -1
  7. package/dist/chat-thread.js +1 -1
  8. package/dist/{comment-thread-BnUHxviq.js → comment-thread-DXfqgRNI.js} +1 -1
  9. package/dist/comment-thread.js +1 -1
  10. package/dist/emblem-DnXmpZCh.js +166 -0
  11. package/dist/emblem.js +2 -0
  12. package/dist/game-card-Oeu74giK.js +194 -0
  13. package/dist/game-card.js +2 -0
  14. package/dist/{hover-card-DN1EAlQA.js → hover-card-Dgu2CwMD.js} +1 -1
  15. package/dist/hover-card.js +1 -1
  16. package/dist/in-view-title-BUZCMqge.js +225 -0
  17. package/dist/in-view-title.js +2 -0
  18. package/dist/index.js +69 -65
  19. package/dist/initials-DEdwNe9_.js +18 -0
  20. package/dist/locale-switcher-DTkySKsM.js +375 -0
  21. package/dist/locale-switcher.js +1 -1
  22. package/dist/{thread-parts-DfZNz70v.js → thread-parts-Cpktor6D.js} +1 -1
  23. package/dist/{timeline-DaldDMX7.js → timeline-BcF46lG9.js} +1 -1
  24. package/dist/timeline.js +1 -1
  25. package/dist/types/components/activity-rings/activity-rings.d.ts +7 -9
  26. package/dist/types/components/avatar-group/avatar-group.d.ts +3 -3
  27. package/dist/types/components/button/button.d.ts +7 -7
  28. package/dist/types/components/card/card.d.ts +4 -1
  29. package/dist/types/components/chip-group/chip-group.d.ts +2 -2
  30. package/dist/types/components/combobox/combobox.d.ts +2 -2
  31. package/dist/types/components/command-palette/command-palette.d.ts +1 -1
  32. package/dist/types/components/comment-thread/comment-thread.d.ts +4 -4
  33. package/dist/types/components/copy-button/copy-button.d.ts +6 -6
  34. package/dist/types/components/countdown/countdown.d.ts +2 -2
  35. package/dist/types/components/dialog/dialog.d.ts +18 -20
  36. package/dist/types/components/drawer/drawer.d.ts +2 -2
  37. package/dist/types/components/emblem/emblem.d.ts +59 -0
  38. package/dist/types/components/emblem/index.d.ts +2 -0
  39. package/dist/types/components/empty-state/empty-state.d.ts +2 -2
  40. package/dist/types/components/file-dropzone/file-dropzone.d.ts +3 -4
  41. package/dist/types/components/filter-toolbar/filter-toolbar.d.ts +2 -2
  42. package/dist/types/components/game-card/card-frame.d.ts +16 -0
  43. package/dist/types/components/game-card/decks.d.ts +27 -0
  44. package/dist/types/components/game-card/game-card.d.ts +37 -0
  45. package/dist/types/components/game-card/index.d.ts +4 -0
  46. package/dist/types/components/hold-to-confirm/hold-to-confirm.d.ts +1 -1
  47. package/dist/types/components/hover-card/hover-card.d.ts +5 -5
  48. package/dist/types/components/in-view-title/in-view-title.d.ts +23 -0
  49. package/dist/types/components/in-view-title/index.d.ts +1 -0
  50. package/dist/types/components/inline-edit/inline-edit.d.ts +6 -6
  51. package/dist/types/components/json-viewer/json-viewer.d.ts +7 -9
  52. package/dist/types/components/keycap-keyboard/keycap-keyboard.d.ts +1 -1
  53. package/dist/types/components/link-unfurl/link-unfurl.d.ts +17 -7
  54. package/dist/types/components/locale-switcher/locale-switcher.d.ts +17 -11
  55. package/dist/types/components/mention-input/mention-input.d.ts +7 -7
  56. package/dist/types/components/metric-card/metric-card.d.ts +2 -2
  57. package/dist/types/components/navigation/navigation.d.ts +1 -1
  58. package/dist/types/components/next/emotion-registry.d.ts +3 -5
  59. package/dist/types/components/now-playing/now-playing.d.ts +2 -2
  60. package/dist/types/components/password-field/password-field.d.ts +1 -1
  61. package/dist/types/components/progress/progress.d.ts +1 -1
  62. package/dist/types/components/select/select.d.ts +1 -1
  63. package/dist/types/components/sheet-stack/sheet-stack.d.ts +19 -16
  64. package/dist/types/components/signature-pad/signature-pad.d.ts +2 -2
  65. package/dist/types/components/split-button/split-button.d.ts +3 -4
  66. package/dist/types/components/swipe-actions/swipe-actions.d.ts +1 -2
  67. package/dist/types/components/tag-input/tag-input.d.ts +2 -3
  68. package/dist/types/components/theme-root/theme-root.d.ts +5 -6
  69. package/dist/types/components/theme-switch/theme-switch.d.ts +3 -3
  70. package/dist/types/components/time-picker/time-picker.d.ts +2 -2
  71. package/dist/types/components/timeline/timeline.d.ts +4 -4
  72. package/dist/types/components/toast/toast.d.ts +3 -3
  73. package/dist/types/components/tree-view/tree-view.d.ts +4 -3
  74. package/dist/types/components/typewriter-terminal/index.d.ts +2 -0
  75. package/dist/types/components/typewriter-terminal/typewriter-terminal.d.ts +87 -0
  76. package/dist/types/components/usage-meter/usage-meter.d.ts +4 -4
  77. package/dist/types/components/usage-meter/usage-model.d.ts +1 -1
  78. package/dist/types/components/user-menu/user-menu.d.ts +3 -4
  79. package/dist/types/index.d.ts +4 -0
  80. package/dist/types/styling/motion-timings.d.ts +5 -0
  81. package/dist/types/styling/sx.d.ts +1 -1
  82. package/dist/types/styling/theme.d.ts +10 -0
  83. package/dist/types/utils/initials.d.ts +2 -0
  84. package/dist/typewriter-terminal-BUEsMzo3.js +588 -0
  85. package/dist/typewriter-terminal.js +2 -0
  86. package/dist/{user-menu-DzELTg1x.js → user-menu-MctRu_Lh.js} +1 -1
  87. package/dist/user-menu.js +1 -1
  88. package/package.json +18 -2
  89. package/dist/avatar-B6idYC59.js +0 -146
  90. package/dist/locale-switcher-CZF7XNYG.js +0 -295
package/README.md CHANGED
@@ -22,7 +22,9 @@ React components styled with Emotion and themed through the CSS custom propertie
22
22
  | `@jfrader/ui/date-picker` | `DatePicker` |
23
23
  | `@jfrader/ui/dialog` | `Dialog` |
24
24
  | `@jfrader/ui/divider` | `Divider` |
25
+ | `@jfrader/ui/emblem` | `Emblem` |
25
26
  | `@jfrader/ui/flex` | `Flex` |
27
+ | `@jfrader/ui/game-card` | `GameCard` |
26
28
  | `@jfrader/ui/kbd` | `Kbd` |
27
29
  | `@jfrader/ui/menu` | `Menu` |
28
30
  | `@jfrader/ui/pagination` | `Pagination` |
@@ -52,7 +54,7 @@ Each subpath also exports its prop types. The package root re-exports everything
52
54
  import { Button, Dialog, ThemeRoot } from '@jfrader/ui';
53
55
  ```
54
56
 
55
- Or import per path:
57
+ Or import each component by subpath:
56
58
 
57
59
  ```tsx
58
60
  import { Button } from '@jfrader/ui/button';
@@ -100,7 +102,7 @@ Token names and values live in `packages/tokens/src/tokens.ts`.
100
102
  pnpm --filter @jfrader/tokens build && pnpm --filter @jfrader/ui build
101
103
  ```
102
104
 
103
- Writes ES modules to `dist/` (`dist/index.js` plus one `dist/<name>.js` per component) and declarations to `dist/types/`. `react`, `react-dom` and every package in `dependencies` stay external.
105
+ The build writes ES modules to `dist/` (`dist/index.js` plus one `dist/<name>.js` per component) and declarations to `dist/types/`. It does not bundle `react`, `react-dom` or any package in `dependencies`.
104
106
 
105
107
  ## Publishing
106
108
 
@@ -119,9 +121,9 @@ gh workflow run publish.yml --repo jfrader/jfrader-ui --ref v0.1.1
119
121
 
120
122
  npmjs authenticates through the package's trusted publisher for `jfrader/jfrader-ui` → `.github/workflows/publish.yml`, configured on npmjs after the first version is published by hand. GitHub Packages uses the workflow's `GITHUB_TOKEN`. See the [root README](https://github.com/jfrader/jfrader-ui#publishing) for the full release setup.
121
123
 
122
- In the repo, `exports` point at `src/` so the workspace consumes source. `node scripts/flip-exports.mjs dist` validates and switches both packages to the publish layout; `node scripts/flip-exports.mjs src` switches both back. The UI `prepack` builds UI and flips only its manifest with `--package ui`; `postpack` restores only UI. Each flip validates only the selected package's export targets.
124
+ In the repo, `exports` point at `src/` so workspace apps use the source. `node scripts/flip-exports.mjs dist` validates and switches both packages to the publish layout. `node scripts/flip-exports.mjs src` switches both back. The UI `prepack` builds UI and switches only its manifest with `--package ui`; `postpack` restores only UI. Each switch validates only the selected package's export targets.
123
125
 
124
- Build tokens before packing UI: the published UI package depends on `@jfrader/tokens`, which stays external rather than being bundled. The UI hook does not build or validate tokens; prepare its published artifacts separately. Run from the repo root:
126
+ Build tokens before packing UI. UI depends on the published `@jfrader/tokens` package and does not bundle it. The UI hook does not build or validate tokens. Run from the repo root:
125
127
 
126
128
  ```sh
127
129
  pnpm --filter @jfrader/tokens build && pnpm --filter @jfrader/ui build
@@ -131,9 +133,11 @@ pnpm --filter @jfrader/ui pack --pack-destination /tmp/opencode
131
133
 
132
134
  Root `pnpm build` builds Storybook, not the published packages. If packing fails after `prepack`, run `node scripts/flip-exports.mjs src` from the repo root to restore workspace exports.
133
135
 
134
- It must contain only `dist/**`, `package.json`, `README.md` and `LICENSE`.
136
+ The tarball must contain only `dist/**`, `package.json`, `README.md` and `LICENSE`.
135
137
 
136
- ### Registry choice / installing
138
+ <a id="registry-choice--installing"></a>
139
+
140
+ ### Registry choice
137
141
 
138
142
  npmjs needs no authentication; GitHub Packages requires authentication even for public packages. To install from GitHub Packages, add this to `.npmrc`:
139
143
 
@@ -3,7 +3,7 @@ import { i as e } from "./css-BYJhdGh-.js";
3
3
  import { n as t } from "./media-8yrN85VT.js";
4
4
  import { t as n } from "./sx-BJXJ2xJK.js";
5
5
  import { t as r } from "./visually-hidden-DgVO3NaB.js";
6
- import { t as i } from "./avatar-B6idYC59.js";
6
+ import { t as i } from "./avatar-sPxDqFiZ.js";
7
7
  import { useId as a } from "react";
8
8
  import { vars as o } from "@jfrader/tokens/vars";
9
9
  import { jsx as s, jsxs as c } from "@emotion/react/jsx-runtime";
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as AvatarGroup } from "./avatar-group-DvP8mAE-.js";
2
+ export { t as AvatarGroup } from "./avatar-group-BlMLNw4J.js";
@@ -0,0 +1,133 @@
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 { t as r } from "./initials-DEdwNe9_.js";
6
+ import { useState as i } from "react";
7
+ import { vars as a } from "@jfrader/tokens/vars";
8
+ import { jsx as o, jsxs as s } from "@emotion/react/jsx-runtime";
9
+ //#region src/components/avatar/avatar.tsx
10
+ var c = 2, l = e({
11
+ position: "relative",
12
+ display: "inline-flex",
13
+ alignItems: "center",
14
+ justifyContent: "center",
15
+ flexShrink: 0,
16
+ boxSizing: "border-box",
17
+ borderRadius: a.radius.full,
18
+ backgroundColor: a.color.surfaceHover,
19
+ color: a.color.text,
20
+ fontWeight: a.fontWeight.medium,
21
+ lineHeight: 1,
22
+ userSelect: "none",
23
+ verticalAlign: "middle",
24
+ [t]: { outline: "1px solid CanvasText" }
25
+ }), u = {
26
+ sm: e({
27
+ inlineSize: a.space[6],
28
+ blockSize: a.space[6],
29
+ fontSize: a.textSize.xs
30
+ }),
31
+ md: e({
32
+ inlineSize: a.space[8],
33
+ blockSize: a.space[8],
34
+ fontSize: a.textSize.sm
35
+ }),
36
+ lg: e({
37
+ inlineSize: a.space[10],
38
+ blockSize: a.space[10],
39
+ fontSize: a.textSize.md
40
+ })
41
+ }, d = e({
42
+ display: "block",
43
+ inlineSize: "100%",
44
+ blockSize: "100%",
45
+ borderRadius: a.radius.full,
46
+ objectFit: "cover"
47
+ }), f = e({
48
+ position: "absolute",
49
+ insetBlockEnd: 0,
50
+ insetInlineEnd: 0,
51
+ inlineSize: "25%",
52
+ blockSize: "25%",
53
+ "&::before": {
54
+ content: "\"\"",
55
+ position: "absolute",
56
+ insetBlockStart: 0,
57
+ insetInlineStart: 0,
58
+ inlineSize: "100%",
59
+ blockSize: "100%",
60
+ boxSizing: "border-box",
61
+ borderRadius: a.radius.full,
62
+ boxShadow: `0 0 0 2px ${a.color.bg}`
63
+ }
64
+ }), p = {
65
+ online: e({ "&::before": { backgroundColor: a.color.success } }),
66
+ away: e({ "&::before": {
67
+ border: `2px solid ${a.color.warning}`,
68
+ backgroundColor: "transparent"
69
+ } }),
70
+ busy: e({ "&::before": {
71
+ backgroundColor: a.color.danger,
72
+ blockSize: "30%",
73
+ insetBlockStart: "35%"
74
+ } }),
75
+ offline: e({ "&::before": {
76
+ backgroundColor: a.color.textSubtle,
77
+ inlineSize: "60%",
78
+ blockSize: "60%",
79
+ insetBlockStart: "20%",
80
+ insetInlineStart: "20%"
81
+ } })
82
+ }, m = e({ [t]: {
83
+ "&::before": {
84
+ forcedColorAdjust: "none",
85
+ backgroundColor: "CanvasText",
86
+ outline: "2px solid Canvas"
87
+ },
88
+ "&[data-status=\"away\"]::before": {
89
+ borderColor: "CanvasText",
90
+ backgroundColor: "Canvas"
91
+ }
92
+ } });
93
+ function h({ ref: e, name: t, src: a, size: h = "md", status: g, statusLabel: _, slotProps: v, className: y, sx: b, ...x }) {
94
+ let [S, C] = i(), w = a !== void 0 && a !== "" && a !== S, T = g === void 0 ? t : `${t}, ${_ ?? g}`;
95
+ return /* @__PURE__ */ o(n, {
96
+ className: y,
97
+ styles: [l, u[h]],
98
+ sx: b,
99
+ children: (n) => /* @__PURE__ */ s("span", {
100
+ ...x,
101
+ ref: e,
102
+ "data-ui": "avatar",
103
+ role: "img",
104
+ "aria-label": T,
105
+ className: n,
106
+ children: [w ? /* @__PURE__ */ o("img", {
107
+ src: a,
108
+ alt: "",
109
+ onError: () => C(a),
110
+ className: v?.image?.className,
111
+ css: [d, v?.image?.css]
112
+ }) : /* @__PURE__ */ o("span", {
113
+ "aria-hidden": "true",
114
+ className: v?.fallback?.className,
115
+ css: v?.fallback?.css,
116
+ children: r(t, c)
117
+ }), g !== void 0 && /* @__PURE__ */ o("span", {
118
+ "aria-hidden": "true",
119
+ "data-status": g,
120
+ className: v?.status?.className,
121
+ css: [
122
+ f,
123
+ p[g],
124
+ m,
125
+ v?.status?.css
126
+ ]
127
+ })]
128
+ })
129
+ });
130
+ }
131
+ h.displayName = "Avatar";
132
+ //#endregion
133
+ export { h as t };
package/dist/avatar.js CHANGED
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as Avatar } from "./avatar-B6idYC59.js";
2
+ export { t as Avatar } from "./avatar-sPxDqFiZ.js";
@@ -8,7 +8,7 @@ import { t as s } from "./visually-hidden-DgVO3NaB.js";
8
8
  import { t as c } from "./button-C6OV0C7J.js";
9
9
  import { t as ee } from "./part-id-D0zksy32.js";
10
10
  import { t as te } from "./card-C008OQCp.js";
11
- import { c as l, d as ne, g as re, h as u, i as ie, m as ae, n as d, p as oe, r as se, t as f } from "./thread-parts-DfZNz70v.js";
11
+ import { c as l, d as ne, g as re, h as u, i as ie, m as ae, n as d, p as oe, r as se, t as f } from "./thread-parts-Cpktor6D.js";
12
12
  import { useEffect as ce, useId as le, useLayoutEffect as p, useMemo as m, useRef as h, useState as g } from "react";
13
13
  import { vars as _ } from "@jfrader/tokens/vars";
14
14
  import { Fragment as v, jsx as y, jsxs as b } from "@emotion/react/jsx-runtime";
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as ChatThread } from "./chat-thread-DVa17BRC.js";
2
+ export { t as ChatThread } from "./chat-thread-DkB-WMWJ.js";
@@ -8,7 +8,7 @@ import { t as ee } from "./renderable-DzcIj1Lo.js";
8
8
  import { t as s } from "./button-C6OV0C7J.js";
9
9
  import { t as c } from "./part-id-D0zksy32.js";
10
10
  import { t as l } from "./card-C008OQCp.js";
11
- import { a as u, c as d, d as f, f as te, g as p, h as m, i as ne, l as re, n as ie, o as ae, p as oe, r as se, s as ce, t as le, u as ue } from "./thread-parts-DfZNz70v.js";
11
+ import { a as u, c as d, d as f, f as te, g as p, h as m, i as ne, l as re, n as ie, o as ae, p as oe, r as se, s as ce, t as le, u as ue } from "./thread-parts-Cpktor6D.js";
12
12
  import { useEffect as de, useId as fe, useLayoutEffect as h, useMemo as g, useRef as _, useState as v } from "react";
13
13
  import { vars as y } from "@jfrader/tokens/vars";
14
14
  import { Fragment as pe, jsx as b, jsxs as x } from "@emotion/react/jsx-runtime";
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as CommentThread } from "./comment-thread-BnUHxviq.js";
2
+ export { t as CommentThread } from "./comment-thread-DXfqgRNI.js";
@@ -0,0 +1,166 @@
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 "./initials-DEdwNe9_.js";
7
+ import { useState as a } from "react";
8
+ import { vars as o } from "@jfrader/tokens/vars";
9
+ import { jsx as s } from "@emotion/react/jsx-runtime";
10
+ import { useMergeRefs as c } from "@floating-ui/react";
11
+ //#region src/components/emblem/emblem.tsx
12
+ var l = 3, u = "[data-ui=\"emblem-plate\"]", d = "polygon(50% 0, 91% 16%, 84% 73%, 50% 100%, 16% 73%, 9% 16%)", f = "polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%)", p = "0.12", m = "0.85", h = "@supports (color: oklch(from red l c h))", g = "@supports (color: contrast-color(red))", _ = e({
13
+ "--emblem-fill": o.color.accent,
14
+ "--emblem-highlight": "var(--emblem-fill)",
15
+ "--emblem-secondary": "var(--emblem-highlight)",
16
+ "--emblem-pattern": "none",
17
+ "--emblem-shadow": `drop-shadow(${o.shadow.raised})`,
18
+ "--emblem-brightness": "1",
19
+ position: "relative",
20
+ display: "inline-block",
21
+ inlineSize: "var(--emblem-size)",
22
+ blockSize: "var(--emblem-size)",
23
+ fontSize: "var(--emblem-size)",
24
+ verticalAlign: "middle",
25
+ userSelect: "none",
26
+ filter: "var(--emblem-shadow) brightness(var(--emblem-brightness))",
27
+ [h]: { "--emblem-highlight": `oklch(from var(--emblem-fill) calc(l + ${p}) calc(c * ${m}) h)` }
28
+ }), v = e({
29
+ position: "absolute",
30
+ inset: 0,
31
+ display: "grid",
32
+ placeItems: "center",
33
+ overflow: "hidden",
34
+ backgroundImage: "var(--emblem-pattern), linear-gradient(135deg, var(--emblem-highlight), var(--emblem-fill))",
35
+ "&::after": {
36
+ content: "\"\"",
37
+ position: "absolute",
38
+ inset: "10% 12% 14%",
39
+ border: "1px solid color-mix(in srgb, var(--emblem-secondary) 42%, transparent)",
40
+ borderRadius: "inherit",
41
+ clipPath: "inherit"
42
+ }
43
+ }), y = e({
44
+ position: "relative",
45
+ maxInlineSize: "100%",
46
+ overflow: "hidden",
47
+ fontFamily: o.font.sans,
48
+ fontSize: "0.5em",
49
+ fontWeight: o.fontWeight.semibold,
50
+ letterSpacing: "-0.03em",
51
+ lineHeight: 1,
52
+ whiteSpace: "nowrap"
53
+ }), b = e({
54
+ color: `var(--emblem-ink, ${o.color.accentContrast})`,
55
+ [g]: { color: "var(--emblem-ink, contrast-color(var(--emblem-highlight)))" }
56
+ }), x = e({
57
+ display: "block",
58
+ inlineSize: "100%",
59
+ blockSize: "100%",
60
+ objectFit: "cover"
61
+ }), S = {
62
+ sm: e({ "--emblem-size": o.size.emblemSm }),
63
+ md: e({ "--emblem-size": o.size.emblemMd }),
64
+ lg: e({ "--emblem-size": o.size.emblemLg }),
65
+ xl: e({ "--emblem-size": o.size.emblemXl })
66
+ }, C = {
67
+ shield: e({
68
+ blockSize: "calc(var(--emblem-size) * 8 / 7)",
69
+ [`& > ${u}`]: { clipPath: d }
70
+ }),
71
+ circle: e({ [`& > ${u}`]: { borderRadius: o.radius.full } }),
72
+ squircle: e({ [`& > ${u}`]: { borderRadius: "30%" } }),
73
+ hexagon: e({ [`& > ${u}`]: { clipPath: f } })
74
+ }, w = {
75
+ none: e({ "--emblem-pattern": "none" }),
76
+ stripes: e({ "--emblem-pattern": "repeating-linear-gradient(to right, var(--emblem-secondary) 0 10%, transparent 10% 20%)" }),
77
+ hoops: e({ "--emblem-pattern": "repeating-linear-gradient(to bottom, var(--emblem-secondary) 0 12%, transparent 12% 24%)" }),
78
+ sash: e({
79
+ "--emblem-pattern": "linear-gradient(135deg, transparent 34%, var(--emblem-secondary) 34% 62%, transparent 62%)",
80
+ "&:dir(rtl)": { "--emblem-pattern": "linear-gradient(225deg, transparent 34%, var(--emblem-secondary) 34% 62%, transparent 62%)" }
81
+ })
82
+ }, T = e({
83
+ cursor: "pointer",
84
+ textDecoration: "none",
85
+ transitionProperty: "filter, transform",
86
+ transitionDuration: o.motion.duration.fast,
87
+ transitionTimingFunction: o.motion.easeStandard,
88
+ "&:hover": {
89
+ "--emblem-brightness": "1.08",
90
+ transform: "translateY(-1px)"
91
+ },
92
+ "&:focus-visible": { ...t },
93
+ [n]: { transitionDuration: "0s" }
94
+ });
95
+ function E({ ref: e, name: t, initials: n, src: o, color: u, secondaryColor: d, inkColor: f, shape: p = "shield", size: m = "md", pattern: h = "none", slotProps: g, className: E, style: D, sx: O, render: k, ...A }) {
96
+ let [j, M] = a(), N = c([e]), P = o !== void 0 && o !== "" && o !== j, F = [
97
+ _,
98
+ S[m],
99
+ C[p],
100
+ w[h]
101
+ ];
102
+ k !== void 0 && F.push(T);
103
+ let I = n ?? i(t, l), L = P ? t : `${t} — ${I}`, R = {};
104
+ u !== void 0 && (R["--emblem-fill"] = u), d !== void 0 && (R["--emblem-secondary"] = d), f !== void 0 && (R["--emblem-ink"] = f);
105
+ let z = {
106
+ ...R,
107
+ ...D
108
+ }, B = /* @__PURE__ */ s("span", {
109
+ "data-ui": "emblem-plate",
110
+ "aria-hidden": "true",
111
+ css: v,
112
+ children: P ? /* @__PURE__ */ s("img", {
113
+ src: o,
114
+ alt: "",
115
+ onError: () => M(o),
116
+ className: g?.image?.className,
117
+ css: [x, g?.image?.css]
118
+ }) : /* @__PURE__ */ s("span", {
119
+ "data-ui": "emblem-ink",
120
+ "aria-hidden": "true",
121
+ className: g?.monogram?.className,
122
+ css: [
123
+ y,
124
+ b,
125
+ g?.monogram?.css
126
+ ],
127
+ children: I
128
+ })
129
+ });
130
+ return k ? /* @__PURE__ */ s(r, {
131
+ className: E,
132
+ styles: F,
133
+ sx: O,
134
+ children: (e) => k({
135
+ ...A,
136
+ className: e,
137
+ ref: N,
138
+ style: z,
139
+ "data-ui": "emblem",
140
+ "data-shape": p,
141
+ "data-pattern": h,
142
+ "aria-label": L,
143
+ css: F,
144
+ children: B
145
+ })
146
+ }) : /* @__PURE__ */ s(r, {
147
+ className: E,
148
+ styles: F,
149
+ sx: O,
150
+ children: (n) => /* @__PURE__ */ s("span", {
151
+ ...A,
152
+ ref: e,
153
+ role: "img",
154
+ "aria-label": t,
155
+ "data-ui": "emblem",
156
+ "data-shape": p,
157
+ "data-pattern": h,
158
+ className: n,
159
+ style: z,
160
+ children: B
161
+ })
162
+ });
163
+ }
164
+ E.displayName = "Emblem";
165
+ //#endregion
166
+ export { E as t };
package/dist/emblem.js ADDED
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ export { t as Emblem } from "./emblem-DnXmpZCh.js";
@@ -0,0 +1,194 @@
1
+ 'use client';
2
+ import { i as e } from "./css-BYJhdGh-.js";
3
+ import { t } from "./sx-BJXJ2xJK.js";
4
+ import { t as n } from "./renderable-DzcIj1Lo.js";
5
+ import { vars as r } from "@jfrader/tokens/vars";
6
+ import { jsx as i, jsxs as a } from "@emotion/react/jsx-runtime";
7
+ //#region src/components/game-card/card-frame.ts
8
+ var o = {
9
+ ratio: 1.48,
10
+ cornerDivisor: 13
11
+ }, s = {
12
+ markWidthRatio: .35,
13
+ watermarkInsetPercent: 3,
14
+ watermarkOpacity: .15,
15
+ contentPaddingPercent: 4
16
+ }, c = {
17
+ oros: "💰",
18
+ copas: "🍷",
19
+ espadas: "🗡️",
20
+ bastos: "🌵",
21
+ hearts: "♥︎",
22
+ diamonds: "♦︎",
23
+ clubs: "♣︎",
24
+ spades: "♠︎"
25
+ }, l = {
26
+ hearts: "red",
27
+ diamonds: "red",
28
+ clubs: "ink",
29
+ spades: "ink"
30
+ }, u = {
31
+ 1: "1",
32
+ 2: "2",
33
+ 3: "3",
34
+ 4: "4",
35
+ 5: "5",
36
+ 6: "6",
37
+ 7: "7",
38
+ 8: "8",
39
+ 9: "9",
40
+ 10: "10",
41
+ 11: "11",
42
+ 12: "12",
43
+ A: "A",
44
+ J: "J",
45
+ Q: "Q",
46
+ K: "K"
47
+ }, d = e({
48
+ "--game-card-width": r.size.gameCardMd,
49
+ position: "relative",
50
+ display: "block",
51
+ flexShrink: 0,
52
+ boxSizing: "border-box",
53
+ inlineSize: "var(--game-card-width)",
54
+ blockSize: `calc(var(--game-card-width) * ${o.ratio})`,
55
+ borderRadius: `calc(var(--game-card-width) / ${o.cornerDivisor})`,
56
+ overflow: "hidden",
57
+ containerType: "inline-size",
58
+ userSelect: "none",
59
+ verticalAlign: "middle"
60
+ }), f = e({
61
+ backgroundColor: r.color.cardFace,
62
+ color: r.color.cardInk,
63
+ border: `1px solid ${r.color.cardInk}`
64
+ }), p = e({ opacity: .55 }), m = e({
65
+ position: "absolute",
66
+ inset: 0
67
+ }), h = e({
68
+ display: "grid",
69
+ placeItems: "center",
70
+ paddingInline: `${s.contentPaddingPercent}%`,
71
+ fontSize: `${s.markWidthRatio * 100}cqw`,
72
+ fontWeight: r.fontWeight.semibold,
73
+ lineHeight: 1,
74
+ whiteSpace: "nowrap"
75
+ }), g = e({
76
+ display: "grid",
77
+ placeItems: "center",
78
+ "& > img, & > svg": {
79
+ inlineSize: "100%",
80
+ blockSize: "100%",
81
+ objectFit: "cover"
82
+ }
83
+ }), _ = e({
84
+ display: "grid",
85
+ gridAutoFlow: "column",
86
+ alignItems: "center",
87
+ gap: "0.1em"
88
+ }), v = e({
89
+ position: "absolute",
90
+ fontSize: `${s.markWidthRatio * 100}cqw`,
91
+ lineHeight: 1,
92
+ opacity: s.watermarkOpacity
93
+ }), y = e({
94
+ insetBlockStart: `${s.watermarkInsetPercent}%`,
95
+ insetInlineEnd: 0
96
+ }), b = e({
97
+ insetBlockEnd: `${s.watermarkInsetPercent}%`,
98
+ insetInlineStart: 0
99
+ }), x = {
100
+ red: e({ color: r.color.cardRed }),
101
+ ink: e({ color: r.color.cardInk })
102
+ }, S = e({
103
+ backgroundColor: r.color.surfaceRaised,
104
+ backgroundImage: `repeating-linear-gradient(45deg, ${r.color.surfaceHover} 0 2px, transparent 2px 6px), repeating-linear-gradient(-45deg, ${r.color.surfaceHover} 0 2px, transparent 2px 6px)`,
105
+ "&::after": {
106
+ content: "\"\"",
107
+ position: "absolute",
108
+ inset: "8%",
109
+ border: `1px solid ${r.color.borderControl}`,
110
+ borderRadius: "inherit"
111
+ }
112
+ }), C = {
113
+ sm: e({ "--game-card-width": r.size.gameCardSm }),
114
+ md: e({ "--game-card-width": r.size.gameCardMd }),
115
+ lg: e({ "--game-card-width": r.size.gameCardLg })
116
+ };
117
+ function w({ ref: e, label: r, value: a, face: o, size: s = "md", rankLabel: c, dimmed: l = !1, children: u, slotProps: h, className: _, sx: v, ...y }) {
118
+ let b = o ?? (a === void 0 ? "back" : "emoji"), x = b === "back" || a === void 0;
119
+ return /* @__PURE__ */ i(t, {
120
+ className: _,
121
+ styles: [
122
+ d,
123
+ f,
124
+ C[s],
125
+ l && p
126
+ ],
127
+ sx: v,
128
+ children: (t) => /* @__PURE__ */ i("div", {
129
+ ...y,
130
+ ref: e,
131
+ role: "img",
132
+ "aria-label": r,
133
+ "data-ui": "game-card",
134
+ "data-face": b,
135
+ "data-deck": x ? void 0 : a.deck,
136
+ className: t,
137
+ children: x ? /* @__PURE__ */ i("span", {
138
+ "data-ui": "game-card-back",
139
+ "aria-hidden": "true",
140
+ className: h?.back?.className,
141
+ css: [
142
+ m,
143
+ S,
144
+ h?.back?.css
145
+ ]
146
+ }) : n(u) ? /* @__PURE__ */ i("span", {
147
+ "data-ui": "game-card-art",
148
+ "aria-hidden": "true",
149
+ className: h?.face?.className,
150
+ css: [
151
+ m,
152
+ g,
153
+ h?.face?.css
154
+ ],
155
+ children: u
156
+ }) : /* @__PURE__ */ i(T, {
157
+ value: a,
158
+ rankLabel: c,
159
+ slotProps: h
160
+ })
161
+ })
162
+ });
163
+ }
164
+ w.displayName = "GameCard";
165
+ function T({ value: e, rankLabel: t, slotProps: n }) {
166
+ let r = c[e.suit], o = t ?? u[e.rank], s = l[e.suit];
167
+ return /* @__PURE__ */ a("span", {
168
+ "data-ui": "game-card-print",
169
+ "aria-hidden": "true",
170
+ className: n?.face?.className,
171
+ css: [
172
+ m,
173
+ h,
174
+ s !== void 0 && x[s],
175
+ n?.face?.css
176
+ ],
177
+ children: [
178
+ /* @__PURE__ */ i("span", {
179
+ css: [v, y],
180
+ children: r
181
+ }),
182
+ /* @__PURE__ */ a("span", {
183
+ css: _,
184
+ children: [/* @__PURE__ */ i("span", { children: o }), /* @__PURE__ */ i("span", { children: r })]
185
+ }),
186
+ /* @__PURE__ */ i("span", {
187
+ css: [v, b],
188
+ children: r
189
+ })
190
+ ]
191
+ });
192
+ }
193
+ //#endregion
194
+ export { l as i, u as n, c as r, w as t };
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ export { t as GameCard, n as RANK_MARKS, r as SUIT_GLYPHS, i as SUIT_INK } from "./game-card-Oeu74giK.js";
@@ -4,7 +4,7 @@ import { r as n } from "./media-8yrN85VT.js";
4
4
  import { t as r } from "./sx-BJXJ2xJK.js";
5
5
  import { t as i } from "./use-controlled-state-DpeVQZNR.js";
6
6
  import { t as a } from "./renderable-DzcIj1Lo.js";
7
- import { t as o } from "./avatar-B6idYC59.js";
7
+ import { t as o } from "./avatar-sPxDqFiZ.js";
8
8
  import { n as s } from "./surface-C69kwSuk.js";
9
9
  import { t as c } from "./trigger-style-CtOrdPk4.js";
10
10
  import { a as l, i as u } from "./overlay-layer-qEbpEtb8.js";
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as HoverCard } from "./hover-card-DN1EAlQA.js";
2
+ export { t as HoverCard } from "./hover-card-Dgu2CwMD.js";