@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.
- package/README.md +11 -6
- package/dist/avatar-BuM1zB_f.js +164 -0
- package/dist/{avatar-group-DvP8mAE-.js → avatar-group-D1UEihvh.js} +1 -1
- package/dist/avatar-group.js +1 -1
- package/dist/avatar.js +1 -1
- package/dist/card-frame-CcLa6NQ4.js +13 -0
- package/dist/{chat-thread-DVa17BRC.js → chat-thread-CMhwxhoA.js} +1 -1
- package/dist/chat-thread.js +1 -1
- package/dist/{comment-thread-BnUHxviq.js → comment-thread-DbOzYr0q.js} +1 -1
- package/dist/comment-thread.js +1 -1
- package/dist/emblem-DnXmpZCh.js +166 -0
- package/dist/emblem.js +2 -0
- package/dist/flip-game-card-xmcR_QSq.js +100 -0
- package/dist/flip-game-card.js +2 -0
- package/dist/game-card-Bnhpz78f.js +187 -0
- package/dist/game-card.js +2 -0
- package/dist/{hover-card-DN1EAlQA.js → hover-card--ijYr1cd.js} +1 -1
- package/dist/hover-card.js +1 -1
- package/dist/in-view-title-BUZCMqge.js +225 -0
- package/dist/in-view-title.js +2 -0
- package/dist/index.js +70 -65
- package/dist/initials-DEdwNe9_.js +18 -0
- package/dist/locale-switcher-DTkySKsM.js +375 -0
- package/dist/locale-switcher.js +1 -1
- package/dist/{thread-parts-DfZNz70v.js → thread-parts-DbKhuwVU.js} +1 -1
- package/dist/{timeline-DaldDMX7.js → timeline-BPKY94mT.js} +1 -1
- package/dist/timeline.js +1 -1
- package/dist/types/components/activity-rings/activity-rings.d.ts +7 -9
- package/dist/types/components/avatar/avatar.d.ts +3 -1
- package/dist/types/components/avatar-group/avatar-group.d.ts +3 -3
- package/dist/types/components/button/button.d.ts +7 -7
- package/dist/types/components/card/card.d.ts +4 -1
- package/dist/types/components/chip-group/chip-group.d.ts +2 -2
- package/dist/types/components/combobox/combobox.d.ts +2 -2
- package/dist/types/components/command-palette/command-palette.d.ts +1 -1
- package/dist/types/components/comment-thread/comment-thread.d.ts +4 -4
- package/dist/types/components/copy-button/copy-button.d.ts +6 -6
- package/dist/types/components/countdown/countdown.d.ts +2 -2
- package/dist/types/components/dialog/dialog.d.ts +18 -20
- package/dist/types/components/drawer/drawer.d.ts +2 -2
- package/dist/types/components/emblem/emblem.d.ts +59 -0
- package/dist/types/components/emblem/index.d.ts +2 -0
- package/dist/types/components/empty-state/empty-state.d.ts +2 -2
- package/dist/types/components/file-dropzone/file-dropzone.d.ts +3 -4
- package/dist/types/components/filter-toolbar/filter-toolbar.d.ts +2 -2
- package/dist/types/components/flip-game-card/flip-game-card.d.ts +22 -0
- package/dist/types/components/flip-game-card/index.d.ts +2 -0
- package/dist/types/components/game-card/card-frame.d.ts +16 -0
- package/dist/types/components/game-card/decks.d.ts +27 -0
- package/dist/types/components/game-card/game-card.d.ts +37 -0
- package/dist/types/components/game-card/index.d.ts +4 -0
- package/dist/types/components/hold-to-confirm/hold-to-confirm.d.ts +1 -1
- package/dist/types/components/hover-card/hover-card.d.ts +5 -5
- package/dist/types/components/in-view-title/in-view-title.d.ts +23 -0
- package/dist/types/components/in-view-title/index.d.ts +1 -0
- package/dist/types/components/inline-edit/inline-edit.d.ts +6 -6
- package/dist/types/components/json-viewer/json-viewer.d.ts +7 -9
- package/dist/types/components/keycap-keyboard/keycap-keyboard.d.ts +1 -1
- package/dist/types/components/link-unfurl/link-unfurl.d.ts +17 -7
- package/dist/types/components/locale-switcher/locale-switcher.d.ts +17 -11
- package/dist/types/components/mention-input/mention-input.d.ts +7 -7
- package/dist/types/components/metric-card/metric-card.d.ts +2 -2
- package/dist/types/components/navigation/navigation.d.ts +1 -1
- package/dist/types/components/next/emotion-registry.d.ts +3 -5
- package/dist/types/components/now-playing/now-playing.d.ts +2 -2
- package/dist/types/components/password-field/password-field.d.ts +1 -1
- package/dist/types/components/progress/progress.d.ts +1 -1
- package/dist/types/components/select/select.d.ts +1 -1
- package/dist/types/components/sheet-stack/sheet-stack.d.ts +19 -16
- package/dist/types/components/signature-pad/signature-pad.d.ts +2 -2
- package/dist/types/components/split-button/split-button.d.ts +3 -4
- package/dist/types/components/swipe-actions/swipe-actions.d.ts +1 -2
- package/dist/types/components/tag-input/tag-input.d.ts +2 -3
- package/dist/types/components/theme-root/theme-root.d.ts +5 -6
- package/dist/types/components/theme-switch/theme-switch.d.ts +3 -3
- package/dist/types/components/time-picker/time-picker.d.ts +2 -2
- package/dist/types/components/timeline/timeline.d.ts +4 -4
- package/dist/types/components/toast/toast.d.ts +3 -3
- package/dist/types/components/tree-view/tree-view.d.ts +4 -3
- package/dist/types/components/typewriter-terminal/index.d.ts +2 -0
- package/dist/types/components/typewriter-terminal/typewriter-terminal.d.ts +87 -0
- package/dist/types/components/usage-meter/usage-meter.d.ts +4 -4
- package/dist/types/components/usage-meter/usage-model.d.ts +1 -1
- package/dist/types/components/user-menu/user-menu.d.ts +3 -4
- package/dist/types/index.d.ts +5 -0
- package/dist/types/styling/motion-timings.d.ts +5 -0
- package/dist/types/styling/sx.d.ts +1 -1
- package/dist/types/styling/theme.d.ts +13 -0
- package/dist/types/utils/initials.d.ts +2 -0
- package/dist/typewriter-terminal-BUEsMzo3.js +588 -0
- package/dist/typewriter-terminal.js +2 -0
- package/dist/{user-menu-DzELTg1x.js → user-menu-Czrrk93A.js} +1 -1
- package/dist/user-menu.js +1 -1
- package/package.json +22 -2
- package/dist/avatar-B6idYC59.js +0 -146
- package/dist/locale-switcher-CZF7XNYG.js +0 -295
package/README.md
CHANGED
|
@@ -22,7 +22,10 @@ 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/flip-game-card` | `FlipGameCard` |
|
|
28
|
+
| `@jfrader/ui/game-card` | `GameCard` |
|
|
26
29
|
| `@jfrader/ui/kbd` | `Kbd` |
|
|
27
30
|
| `@jfrader/ui/menu` | `Menu` |
|
|
28
31
|
| `@jfrader/ui/pagination` | `Pagination` |
|
|
@@ -52,7 +55,7 @@ Each subpath also exports its prop types. The package root re-exports everything
|
|
|
52
55
|
import { Button, Dialog, ThemeRoot } from '@jfrader/ui';
|
|
53
56
|
```
|
|
54
57
|
|
|
55
|
-
Or import
|
|
58
|
+
Or import each component by subpath:
|
|
56
59
|
|
|
57
60
|
```tsx
|
|
58
61
|
import { Button } from '@jfrader/ui/button';
|
|
@@ -100,7 +103,7 @@ Token names and values live in `packages/tokens/src/tokens.ts`.
|
|
|
100
103
|
pnpm --filter @jfrader/tokens build && pnpm --filter @jfrader/ui build
|
|
101
104
|
```
|
|
102
105
|
|
|
103
|
-
|
|
106
|
+
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
107
|
|
|
105
108
|
## Publishing
|
|
106
109
|
|
|
@@ -119,9 +122,9 @@ gh workflow run publish.yml --repo jfrader/jfrader-ui --ref v0.1.1
|
|
|
119
122
|
|
|
120
123
|
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
124
|
|
|
122
|
-
In the repo, `exports` point at `src/` so
|
|
125
|
+
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
126
|
|
|
124
|
-
Build tokens before packing UI
|
|
127
|
+
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
128
|
|
|
126
129
|
```sh
|
|
127
130
|
pnpm --filter @jfrader/tokens build && pnpm --filter @jfrader/ui build
|
|
@@ -131,9 +134,11 @@ pnpm --filter @jfrader/ui pack --pack-destination /tmp/opencode
|
|
|
131
134
|
|
|
132
135
|
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
136
|
|
|
134
|
-
|
|
137
|
+
The tarball must contain only `dist/**`, `package.json`, `README.md` and `LICENSE`.
|
|
135
138
|
|
|
136
|
-
|
|
139
|
+
<a id="registry-choice--installing"></a>
|
|
140
|
+
|
|
141
|
+
### Registry choice
|
|
137
142
|
|
|
138
143
|
npmjs needs no authentication; GitHub Packages requires authentication even for public packages. To install from GitHub Packages, add this to `.npmrc`:
|
|
139
144
|
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { a as e, i as t } from "./css-BYJhdGh-.js";
|
|
3
|
+
import { n, r } from "./media-8yrN85VT.js";
|
|
4
|
+
import { t as i } from "./sx-BJXJ2xJK.js";
|
|
5
|
+
import { t as a } from "./initials-DEdwNe9_.js";
|
|
6
|
+
import { useState as o } from "react";
|
|
7
|
+
import { vars as s } from "@jfrader/tokens/vars";
|
|
8
|
+
import { jsx as c, jsxs as l } from "@emotion/react/jsx-runtime";
|
|
9
|
+
//#region src/components/avatar/avatar.tsx
|
|
10
|
+
var u = 2, d = t({
|
|
11
|
+
position: "relative",
|
|
12
|
+
display: "inline-flex",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
flexShrink: 0,
|
|
16
|
+
boxSizing: "border-box",
|
|
17
|
+
borderRadius: s.radius.full,
|
|
18
|
+
backgroundColor: s.color.surfaceHover,
|
|
19
|
+
color: s.color.text,
|
|
20
|
+
fontWeight: s.fontWeight.medium,
|
|
21
|
+
lineHeight: 1,
|
|
22
|
+
userSelect: "none",
|
|
23
|
+
verticalAlign: "middle",
|
|
24
|
+
[n]: { outline: "1px solid CanvasText" }
|
|
25
|
+
}), f = {
|
|
26
|
+
sm: t({
|
|
27
|
+
inlineSize: s.space[6],
|
|
28
|
+
blockSize: s.space[6],
|
|
29
|
+
fontSize: s.textSize.xs
|
|
30
|
+
}),
|
|
31
|
+
md: t({
|
|
32
|
+
inlineSize: s.space[8],
|
|
33
|
+
blockSize: s.space[8],
|
|
34
|
+
fontSize: s.textSize.sm
|
|
35
|
+
}),
|
|
36
|
+
lg: t({
|
|
37
|
+
inlineSize: s.space[10],
|
|
38
|
+
blockSize: s.space[10],
|
|
39
|
+
fontSize: s.textSize.md
|
|
40
|
+
})
|
|
41
|
+
}, p = t({
|
|
42
|
+
display: "block",
|
|
43
|
+
inlineSize: "100%",
|
|
44
|
+
blockSize: "100%",
|
|
45
|
+
borderRadius: s.radius.full,
|
|
46
|
+
objectFit: "cover"
|
|
47
|
+
}), m = t({
|
|
48
|
+
position: "absolute",
|
|
49
|
+
insetBlockEnd: 0,
|
|
50
|
+
insetInlineEnd: 0,
|
|
51
|
+
inlineSize: "25%",
|
|
52
|
+
blockSize: "25%",
|
|
53
|
+
pointerEvents: "none",
|
|
54
|
+
"&::before": {
|
|
55
|
+
content: "\"\"",
|
|
56
|
+
position: "absolute",
|
|
57
|
+
insetBlockStart: 0,
|
|
58
|
+
insetInlineStart: 0,
|
|
59
|
+
inlineSize: "100%",
|
|
60
|
+
blockSize: "100%",
|
|
61
|
+
boxSizing: "border-box",
|
|
62
|
+
borderRadius: s.radius.full,
|
|
63
|
+
boxShadow: `0 0 0 2px ${s.color.bg}`
|
|
64
|
+
}
|
|
65
|
+
}), h = {
|
|
66
|
+
online: t({ "&::before": { backgroundColor: s.color.success } }),
|
|
67
|
+
away: t({ "&::before": {
|
|
68
|
+
border: `2px solid ${s.color.warning}`,
|
|
69
|
+
backgroundColor: "transparent"
|
|
70
|
+
} }),
|
|
71
|
+
busy: t({ "&::before": {
|
|
72
|
+
backgroundColor: s.color.danger,
|
|
73
|
+
blockSize: "30%",
|
|
74
|
+
insetBlockStart: "35%"
|
|
75
|
+
} }),
|
|
76
|
+
offline: t({ "&::before": {
|
|
77
|
+
backgroundColor: s.color.textSubtle,
|
|
78
|
+
inlineSize: "60%",
|
|
79
|
+
blockSize: "60%",
|
|
80
|
+
insetBlockStart: "20%",
|
|
81
|
+
insetInlineStart: "20%"
|
|
82
|
+
} })
|
|
83
|
+
}, g = t({ [n]: {
|
|
84
|
+
"&::before": {
|
|
85
|
+
forcedColorAdjust: "none",
|
|
86
|
+
backgroundColor: "CanvasText",
|
|
87
|
+
outline: "2px solid Canvas"
|
|
88
|
+
},
|
|
89
|
+
"&[data-status=\"away\"]::before": {
|
|
90
|
+
borderColor: "CanvasText",
|
|
91
|
+
backgroundColor: "Canvas"
|
|
92
|
+
}
|
|
93
|
+
} }), _ = e({
|
|
94
|
+
from: {
|
|
95
|
+
transform: "scale(.8)",
|
|
96
|
+
opacity: 1
|
|
97
|
+
},
|
|
98
|
+
to: {
|
|
99
|
+
transform: "scale(2.4)",
|
|
100
|
+
opacity: 0
|
|
101
|
+
}
|
|
102
|
+
}), v = { "&[data-status=\"online\"][data-pulse]::after": {
|
|
103
|
+
content: "none",
|
|
104
|
+
display: "none",
|
|
105
|
+
animation: "none"
|
|
106
|
+
} }, y = t({
|
|
107
|
+
"&[data-status=\"online\"][data-pulse]::after": {
|
|
108
|
+
content: "\"\"",
|
|
109
|
+
position: "absolute",
|
|
110
|
+
insetBlockStart: 0,
|
|
111
|
+
insetInlineStart: 0,
|
|
112
|
+
inlineSize: "100%",
|
|
113
|
+
blockSize: "100%",
|
|
114
|
+
borderRadius: s.radius.full,
|
|
115
|
+
color: s.color.success,
|
|
116
|
+
border: "1px solid currentColor",
|
|
117
|
+
animation: `${_} ${s.motion.duration.presence} infinite ${s.motion.easePresence}`
|
|
118
|
+
},
|
|
119
|
+
[r]: v,
|
|
120
|
+
[n]: v
|
|
121
|
+
});
|
|
122
|
+
function b({ ref: e, name: t, src: n, size: r = "md", status: s, pulse: _ = !1, statusLabel: v, slotProps: b, className: x, sx: S, ...C }) {
|
|
123
|
+
let [w, T] = o(), E = n !== void 0 && n !== "" && n !== w, D = s === void 0 ? t : `${t}, ${v ?? s}`;
|
|
124
|
+
return /* @__PURE__ */ c(i, {
|
|
125
|
+
className: x,
|
|
126
|
+
styles: [d, f[r]],
|
|
127
|
+
sx: S,
|
|
128
|
+
children: (r) => /* @__PURE__ */ l("span", {
|
|
129
|
+
...C,
|
|
130
|
+
ref: e,
|
|
131
|
+
"data-ui": "avatar",
|
|
132
|
+
role: "img",
|
|
133
|
+
"aria-label": D,
|
|
134
|
+
className: r,
|
|
135
|
+
children: [E ? /* @__PURE__ */ c("img", {
|
|
136
|
+
src: n,
|
|
137
|
+
alt: "",
|
|
138
|
+
onError: () => T(n),
|
|
139
|
+
className: b?.image?.className,
|
|
140
|
+
css: [p, b?.image?.css]
|
|
141
|
+
}) : /* @__PURE__ */ c("span", {
|
|
142
|
+
"aria-hidden": "true",
|
|
143
|
+
className: b?.fallback?.className,
|
|
144
|
+
css: b?.fallback?.css,
|
|
145
|
+
children: a(t, u)
|
|
146
|
+
}), s !== void 0 && /* @__PURE__ */ c("span", {
|
|
147
|
+
"aria-hidden": "true",
|
|
148
|
+
"data-status": s,
|
|
149
|
+
"data-pulse": _ && s === "online" ? "" : void 0,
|
|
150
|
+
className: b?.status?.className,
|
|
151
|
+
css: [
|
|
152
|
+
m,
|
|
153
|
+
h[s],
|
|
154
|
+
g,
|
|
155
|
+
y,
|
|
156
|
+
b?.status?.css
|
|
157
|
+
]
|
|
158
|
+
})]
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
b.displayName = "Avatar";
|
|
163
|
+
//#endregion
|
|
164
|
+
export { b as t };
|
|
@@ -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-
|
|
6
|
+
import { t as i } from "./avatar-BuM1zB_f.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";
|
package/dist/avatar-group.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as AvatarGroup } from "./avatar-group-
|
|
2
|
+
export { t as AvatarGroup } from "./avatar-group-D1UEihvh.js";
|
package/dist/avatar.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Avatar } from "./avatar-
|
|
2
|
+
export { t as Avatar } from "./avatar-BuM1zB_f.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
//#region src/components/game-card/card-frame.ts
|
|
3
|
+
var e = {
|
|
4
|
+
ratio: 1.48,
|
|
5
|
+
cornerDivisor: 13
|
|
6
|
+
}, t = {
|
|
7
|
+
markWidthRatio: .35,
|
|
8
|
+
watermarkInsetPercent: 3,
|
|
9
|
+
watermarkOpacity: .15,
|
|
10
|
+
contentPaddingPercent: 4
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as n, t };
|
|
@@ -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-
|
|
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-DbKhuwVU.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";
|
package/dist/chat-thread.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as ChatThread } from "./chat-thread-
|
|
2
|
+
export { t as ChatThread } from "./chat-thread-CMhwxhoA.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-
|
|
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-DbKhuwVU.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";
|
package/dist/comment-thread.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as CommentThread } from "./comment-thread-
|
|
2
|
+
export { t as CommentThread } from "./comment-thread-DbOzYr0q.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,100 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { i as e } from "./css-BYJhdGh-.js";
|
|
3
|
+
import { r as t } from "./media-8yrN85VT.js";
|
|
4
|
+
import { t as n } from "./sx-BJXJ2xJK.js";
|
|
5
|
+
import { n as r } from "./card-frame-CcLa6NQ4.js";
|
|
6
|
+
import { useEffect as i, useState as a } from "react";
|
|
7
|
+
import { vars as o } from "@jfrader/tokens/vars";
|
|
8
|
+
import { jsx as s, jsxs as c } from "@emotion/react/jsx-runtime";
|
|
9
|
+
import { MotionConfig as l, useReducedMotion as u } from "motion/react";
|
|
10
|
+
//#region src/components/flip-game-card/flip-game-card.tsx
|
|
11
|
+
var d = e({
|
|
12
|
+
label: "flip-game-card",
|
|
13
|
+
position: "relative",
|
|
14
|
+
flexShrink: 0,
|
|
15
|
+
inlineSize: "var(--flip-game-card-width)",
|
|
16
|
+
blockSize: `calc(var(--flip-game-card-width) * ${r.ratio})`,
|
|
17
|
+
perspective: o.size.gameCardPerspective
|
|
18
|
+
}), f = {
|
|
19
|
+
sm: e({ "--flip-game-card-width": o.size.gameCardSm }),
|
|
20
|
+
md: e({ "--flip-game-card-width": o.size.gameCardMd }),
|
|
21
|
+
lg: e({ "--flip-game-card-width": o.size.gameCardLg })
|
|
22
|
+
}, p = e({ "& > [data-ui=\"flip-game-card-rotator\"]": {
|
|
23
|
+
transform: "none",
|
|
24
|
+
transition: "none",
|
|
25
|
+
"& > [data-ui=\"flip-game-card-back\"]": { transform: "none" }
|
|
26
|
+
} }), m = e({
|
|
27
|
+
"&[data-reduced-motion=\"true\"]": p,
|
|
28
|
+
[t]: p
|
|
29
|
+
}), h = e({
|
|
30
|
+
position: "relative",
|
|
31
|
+
inlineSize: "100%",
|
|
32
|
+
blockSize: "100%",
|
|
33
|
+
transformStyle: "preserve-3d",
|
|
34
|
+
transform: "rotateY(0deg)",
|
|
35
|
+
transition: `transform ${o.motion.duration.slow} ${o.motion.easeStandard}`,
|
|
36
|
+
"&[data-state=\"back\"]": { transform: "rotateY(180deg)" }
|
|
37
|
+
}), g = e({
|
|
38
|
+
position: "absolute",
|
|
39
|
+
inset: 0,
|
|
40
|
+
backfaceVisibility: "hidden",
|
|
41
|
+
"&[aria-hidden=\"true\"]": { visibility: "hidden" },
|
|
42
|
+
"& > [data-ui=\"game-card\"]": {
|
|
43
|
+
inlineSize: "100%",
|
|
44
|
+
blockSize: "100%"
|
|
45
|
+
}
|
|
46
|
+
}), _ = e({ transform: "rotateY(180deg)" });
|
|
47
|
+
function v({ ref: e, flipped: t, front: r, back: o, size: p = "md", slotProps: v, className: y, sx: b, ...x }) {
|
|
48
|
+
let S = u(), [C, w] = a(!1);
|
|
49
|
+
i(() => w(!0), []);
|
|
50
|
+
let T = t ? "back" : "front";
|
|
51
|
+
return /* @__PURE__ */ s(l, {
|
|
52
|
+
reducedMotion: "user",
|
|
53
|
+
children: /* @__PURE__ */ s(n, {
|
|
54
|
+
className: y,
|
|
55
|
+
styles: [
|
|
56
|
+
d,
|
|
57
|
+
f[p],
|
|
58
|
+
m
|
|
59
|
+
],
|
|
60
|
+
sx: b,
|
|
61
|
+
children: (n) => /* @__PURE__ */ s("div", {
|
|
62
|
+
...x,
|
|
63
|
+
ref: e,
|
|
64
|
+
className: n,
|
|
65
|
+
"data-ui": "flip-game-card",
|
|
66
|
+
"data-state": T,
|
|
67
|
+
"data-size": p,
|
|
68
|
+
"data-reduced-motion": C && S || void 0,
|
|
69
|
+
children: /* @__PURE__ */ c("div", {
|
|
70
|
+
"data-ui": "flip-game-card-rotator",
|
|
71
|
+
"data-state": T,
|
|
72
|
+
className: v?.rotator?.className,
|
|
73
|
+
css: [h, v?.rotator?.css],
|
|
74
|
+
children: [/* @__PURE__ */ s("div", {
|
|
75
|
+
"data-ui": "flip-game-card-front",
|
|
76
|
+
inert: t,
|
|
77
|
+
"aria-hidden": t || void 0,
|
|
78
|
+
className: v?.front?.className,
|
|
79
|
+
css: [g, v?.front?.css],
|
|
80
|
+
children: r
|
|
81
|
+
}), /* @__PURE__ */ s("div", {
|
|
82
|
+
"data-ui": "flip-game-card-back",
|
|
83
|
+
inert: !t,
|
|
84
|
+
"aria-hidden": !t || void 0,
|
|
85
|
+
className: v?.back?.className,
|
|
86
|
+
css: [
|
|
87
|
+
g,
|
|
88
|
+
_,
|
|
89
|
+
v?.back?.css
|
|
90
|
+
],
|
|
91
|
+
children: o
|
|
92
|
+
})]
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
v.displayName = "FlipGameCard";
|
|
99
|
+
//#endregion
|
|
100
|
+
export { v as t };
|