@gears-frontx/ui-kit 0.4.0-alpha.0 → 0.4.0-alpha.2
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/dist/attachment.js +36 -28
- package/dist/attachment.js.map +1 -1
- package/dist/bubble.js +34 -33
- package/dist/bubble.js.map +1 -1
- package/dist/chart.js +15 -15
- package/dist/chart.js.map +1 -1
- package/dist/chunks/native-select.DF1QrNz4.css +1 -0
- package/dist/components/attachment/attachment.d.ts.map +1 -1
- package/dist/components/bubble/bubble.d.ts.map +1 -1
- package/dist/components/chart/chart.d.ts.map +1 -1
- package/dist/components/marker/marker.d.ts.map +1 -1
- package/dist/docs/chart.md +8 -0
- package/dist/marker.js +26 -25
- package/dist/marker.js.map +1 -1
- package/dist/native-select.js +21 -20
- package/dist/native-select.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/native-select.BdYLTCZv.css +0 -1
package/dist/attachment.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
3
|
import { mergeProps as h } from "@base-ui/react/merge-props";
|
|
4
4
|
import { useRender as _ } from "@base-ui/react/use-render";
|
|
5
|
-
import { cx as
|
|
5
|
+
import { cx as c, cva as r } from "class-variance-authority";
|
|
6
6
|
import { useContext as l, createContext as u } from "react";
|
|
7
7
|
import { Button as d } from "./button.js";
|
|
8
|
-
import './chunks/attachment.rknKEWlr.css';const f = "_attachment_1njaq_20",
|
|
8
|
+
import './chunks/attachment.rknKEWlr.css';const f = "_attachment_1njaq_20", v = "_sizeDefault_1njaq_61", p = "_attachmentContent_1njaq_67", z = "_sizeSm_1njaq_75", g = "_sizeXs_1njaq_89", A = "_orientationHorizontal_1njaq_107", j = "_orientationVertical_1njaq_114", q = "_attachmentMedia_1njaq_124", T = "_variantIcon_1njaq_185", N = "_variantImage_1njaq_188", D = "_attachmentTitle_1njaq_209", V = "_attachmentDescription_1njaq_220", x = "_attachmentActions_1njaq_236", C = "_attachmentAction_1njaq_236", I = "_attachmentTrigger_1njaq_258", M = "_attachmentGroup_1njaq_265", n = {
|
|
9
9
|
attachment: f,
|
|
10
|
-
sizeDefault:
|
|
11
|
-
attachmentContent:
|
|
10
|
+
sizeDefault: v,
|
|
11
|
+
attachmentContent: p,
|
|
12
12
|
sizeSm: z,
|
|
13
13
|
sizeXs: g,
|
|
14
14
|
orientationHorizontal: A,
|
|
@@ -17,10 +17,10 @@ import './chunks/attachment.rknKEWlr.css';const f = "_attachment_1njaq_20", p =
|
|
|
17
17
|
variantIcon: T,
|
|
18
18
|
variantImage: N,
|
|
19
19
|
attachmentTitle: D,
|
|
20
|
-
attachmentDescription:
|
|
21
|
-
attachmentActions:
|
|
22
|
-
attachmentAction:
|
|
23
|
-
attachmentTrigger:
|
|
20
|
+
attachmentDescription: V,
|
|
21
|
+
attachmentActions: x,
|
|
22
|
+
attachmentAction: C,
|
|
23
|
+
attachmentTrigger: I,
|
|
24
24
|
attachmentGroup: M
|
|
25
25
|
}, s = u("done"), G = r(n.attachment, {
|
|
26
26
|
variants: {
|
|
@@ -43,16 +43,16 @@ function R({
|
|
|
43
43
|
className: a,
|
|
44
44
|
state: t = "done",
|
|
45
45
|
size: e = "default",
|
|
46
|
-
orientation:
|
|
46
|
+
orientation: i = "horizontal",
|
|
47
47
|
...m
|
|
48
48
|
}) {
|
|
49
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ o(s.Provider, { value: t, children: /* @__PURE__ */ o(
|
|
50
50
|
"div",
|
|
51
51
|
{
|
|
52
52
|
"data-state": t,
|
|
53
53
|
"data-size": e,
|
|
54
|
-
"data-orientation":
|
|
55
|
-
className: G({ size: e, orientation:
|
|
54
|
+
"data-orientation": i,
|
|
55
|
+
className: G({ size: e, orientation: i, className: a }),
|
|
56
56
|
...m
|
|
57
57
|
}
|
|
58
58
|
) });
|
|
@@ -68,54 +68,62 @@ const S = r(n.attachmentMedia, {
|
|
|
68
68
|
variant: "icon"
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
|
-
function k({ className: a, variant: t
|
|
72
|
-
|
|
71
|
+
function k({ className: a, variant: t, ...e }) {
|
|
72
|
+
const i = t ?? "icon";
|
|
73
|
+
return /* @__PURE__ */ o(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
"data-variant": i,
|
|
77
|
+
className: S({ variant: i, className: a }),
|
|
78
|
+
...e
|
|
79
|
+
}
|
|
80
|
+
);
|
|
73
81
|
}
|
|
74
82
|
function w({ className: a, ...t }) {
|
|
75
|
-
return /* @__PURE__ */
|
|
83
|
+
return /* @__PURE__ */ o("div", { className: c(n.attachmentContent, a), ...t });
|
|
76
84
|
}
|
|
77
85
|
function E({ className: a, ...t }) {
|
|
78
86
|
const e = l(s);
|
|
79
|
-
return /* @__PURE__ */
|
|
87
|
+
return /* @__PURE__ */ o(
|
|
80
88
|
"span",
|
|
81
89
|
{
|
|
82
|
-
className:
|
|
90
|
+
className: c(n.attachmentTitle, (e === "uploading" || e === "processing") && "shimmer", a),
|
|
83
91
|
...t
|
|
84
92
|
}
|
|
85
93
|
);
|
|
86
94
|
}
|
|
87
95
|
function F({ className: a, ...t }) {
|
|
88
|
-
return /* @__PURE__ */
|
|
96
|
+
return /* @__PURE__ */ o("span", { className: c(n.attachmentDescription, a), ...t });
|
|
89
97
|
}
|
|
90
98
|
function J({ className: a, ...t }) {
|
|
91
|
-
return /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */ o("div", { className: c(n.attachmentActions, a), ...t });
|
|
92
100
|
}
|
|
93
|
-
function K({ className: a, variant: t, size: e = "sm", ...
|
|
94
|
-
return /* @__PURE__ */
|
|
101
|
+
function K({ className: a, variant: t, size: e = "sm", ...i }) {
|
|
102
|
+
return /* @__PURE__ */ o(
|
|
95
103
|
d,
|
|
96
104
|
{
|
|
97
105
|
variant: t ?? "ghost",
|
|
98
106
|
size: e,
|
|
99
|
-
className:
|
|
100
|
-
...
|
|
107
|
+
className: c(n.attachmentAction, a),
|
|
108
|
+
...i
|
|
101
109
|
}
|
|
102
110
|
);
|
|
103
111
|
}
|
|
104
|
-
function L({ className: a, render: t, type: e, ...
|
|
112
|
+
function L({ className: a, render: t, type: e, ...i }) {
|
|
105
113
|
return _({
|
|
106
114
|
defaultTagName: "button",
|
|
107
115
|
render: t,
|
|
108
116
|
props: h(
|
|
109
117
|
{
|
|
110
118
|
type: t ? e : e ?? "button",
|
|
111
|
-
className:
|
|
119
|
+
className: c(n.attachmentTrigger, a)
|
|
112
120
|
},
|
|
113
|
-
|
|
121
|
+
i
|
|
114
122
|
)
|
|
115
123
|
});
|
|
116
124
|
}
|
|
117
125
|
function O({ className: a, ...t }) {
|
|
118
|
-
return /* @__PURE__ */
|
|
126
|
+
return /* @__PURE__ */ o("div", { className: c(n.attachmentGroup, "scroll-fade-x", "no-scrollbar", a), ...t });
|
|
119
127
|
}
|
|
120
128
|
export {
|
|
121
129
|
R as Attachment,
|
package/dist/attachment.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.js","sources":["../src/components/attachment/attachment.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { useRender } from '@base-ui/react/use-render';\nimport { cva, cx, type VariantProps } from 'class-variance-authority';\nimport { createContext, useContext, type ComponentProps } from 'react';\n\nimport { Button, type ButtonProps } from '../button/button.js';\nimport styles from './attachment.module.css';\n\n/*\n * A faithful port of shadcn/ui's base Attachment\n * (registry/bases/base/ui/attachment.tsx): a file/image attachment card\n * with media, metadata, upload state, and actions. No primitive to lean\n * on — the upload state machine (`state`) is plain data-attribute-driven\n * CSS, same shape as Message/Bubble, for every part EXCEPT the shimmer\n * below.\n *\n * Uses two utilities from this package's global stylesheet\n * (src/styles/utilities.css, imported alongside theme.css — see that\n * file's own header): `shimmer` on `AttachmentTitle` while uploading or\n * processing, and `scroll-fade-x` + `no-scrollbar` on `AttachmentGroup`'s\n * scroll track.\n *\n * Upstream drives the shimmer purely through a CSS ancestor selector\n * (`group-data-[state=processing]/attachment:shimmer`) with no extra prop\n * on `AttachmentTitle` at all. `shimmer` is a GLOBAL utility class, not a\n * CSS Modules class — there is no CSS-only way to conditionally attach an\n * unrelated global class name to a descendant based on an ancestor's data\n * attribute (a plain descendant selector can style `.attachmentTitle`\n * directly, but it cannot make that element also match every rule the\n * literal `.shimmer` class carries). Every other ancestor-state read\n * below (`AttachmentMedia`'s size/orientation/error styling,\n * `AttachmentDescription`'s error tint) stays pure CSS for exactly this\n * reason — only the shimmer needs it. React context carries the state\n * down to `AttachmentTitle` instead, so the API stays prop-free like\n * upstream — the consumer never re-passes `state` to a child part.\n */\nconst AttachmentStateContext = createContext<AttachmentProps['state']>('done');\n\nconst attachmentVariants = cva(styles.attachment, {\n variants: {\n size: {\n default: styles.sizeDefault,\n sm: styles.sizeSm,\n xs: styles.sizeXs,\n },\n orientation: {\n horizontal: styles.orientationHorizontal,\n vertical: styles.orientationVertical,\n },\n },\n defaultVariants: {\n size: 'default',\n orientation: 'horizontal',\n },\n});\n\nexport interface AttachmentProps extends ComponentProps<'div'>, VariantProps<typeof attachmentVariants> {\n /**\n * The upload state. Drives styling (idle's dashed border, error's\n * destructive tint on the media/description) and `AttachmentTitle`'s\n * shimmer.\n * @default 'done'\n */\n state?: 'idle' | 'uploading' | 'processing' | 'error' | 'done';\n}\n\n/** The root attachment container. */\nexport function Attachment({\n className,\n state = 'done',\n size = 'default',\n orientation = 'horizontal',\n ...props\n}: AttachmentProps) {\n return (\n <AttachmentStateContext.Provider value={state}>\n <div\n data-state={state}\n data-size={size}\n data-orientation={orientation}\n className={attachmentVariants({ size, orientation, className })}\n {...props}\n />\n </AttachmentStateContext.Provider>\n );\n}\n\nconst attachmentMediaVariants = cva(styles.attachmentMedia, {\n variants: {\n variant: {\n icon: styles.variantIcon,\n image: styles.variantImage,\n },\n },\n defaultVariants: {\n variant: 'icon',\n },\n});\n\nexport interface AttachmentMediaProps\n extends ComponentProps<'div'>, VariantProps<typeof attachmentMediaVariants> {}\n\n/** The media slot for an icon or image preview. Sizes and tints itself off\n * the ancestor `Attachment`'s `size`/`orientation`/`state` via CSS — no\n * extra props needed. */\nexport function AttachmentMedia({ className, variant = 'icon', ...props }: AttachmentMediaProps) {\n return <div data-variant={variant} className={attachmentMediaVariants({ variant, className })} {...props} />;\n}\n\nexport type AttachmentContentProps = ComponentProps<'div'>;\n\n/** Wraps the title and description. */\nexport function AttachmentContent({ className, ...props }: AttachmentContentProps) {\n return <div className={cx(styles.attachmentContent, className)} {...props} />;\n}\n\nexport type AttachmentTitleProps = ComponentProps<'span'>;\n\n/** The attachment name. Shimmers (via the global `shimmer` utility class —\n * see this file's own header) while the ancestor `Attachment`'s `state` is\n * `'uploading'` or `'processing'` — read from context, not a prop. */\nexport function AttachmentTitle({ className, ...props }: AttachmentTitleProps) {\n const state = useContext(AttachmentStateContext);\n return (\n <span\n className={cx(styles.attachmentTitle, (state === 'uploading' || state === 'processing') && 'shimmer', className)}\n {...props}\n />\n );\n}\n\nexport type AttachmentDescriptionProps = ComponentProps<'span'>;\n\n/** Secondary metadata such as the file type, size, or upload status. Picks\n * up the ancestor `Attachment`'s `error` tint via a CSS descendant\n * selector — no extra prop needed. */\nexport function AttachmentDescription({ className, ...props }: AttachmentDescriptionProps) {\n return <span className={cx(styles.attachmentDescription, className)} {...props} />;\n}\n\nexport type AttachmentActionsProps = ComponentProps<'div'>;\n\n/** A container for one or more actions, aligned to the end of the\n * attachment. */\nexport function AttachmentActions({ className, ...props }: AttachmentActionsProps) {\n return <div className={cx(styles.attachmentActions, className)} {...props} />;\n}\n\nexport type AttachmentActionProps = ButtonProps;\n\n/**\n * An action button. Renders the kit `Button` and accepts all of its props.\n *\n * DRIFT from upstream: shadcn's `AttachmentAction` defaults to\n * `size=\"icon-xs\"` — a dedicated micro icon-only step this kit's `Button`\n * does not have.\n * `size=\"sm\"` is the smallest step available; icon-only squaring already\n * works at any size via Button's own `[data-icon-only]` rule\n * (button.module.css), so the visual result is a slightly larger action\n * button (32px) than upstream's (24px), not a broken one.\n */\nexport function AttachmentAction({ className, variant, size = 'sm', ...props }: AttachmentActionProps) {\n return (\n <Button\n variant={variant ?? 'ghost'}\n size={size}\n className={cx(styles.attachmentAction, className)}\n {...props}\n />\n );\n}\n\nexport type AttachmentTriggerProps = useRender.ComponentProps<'button'>;\n\n/** A full-card overlay that activates the attachment — opens a link or\n * dialog while `AttachmentActions` stay independently clickable (it sits\n * behind them in the stacking order). Renders a `<button>` by default. */\nexport function AttachmentTrigger({ className, render, type, ...props }: AttachmentTriggerProps) {\n return useRender({\n defaultTagName: 'button',\n render,\n props: mergeProps<'button'>(\n {\n type: render ? type : (type ?? 'button'),\n className: cx(styles.attachmentTrigger, className),\n },\n props,\n ),\n });\n}\n\nexport type AttachmentGroupProps = ComponentProps<'div'>;\n\n/** Lays out attachments in a horizontally scrollable, snapping row with an\n * edge fade. Applies `scroll-fade-x` and `no-scrollbar` (this package's\n * global utilities — see this file's own header) directly, by class name,\n * alongside the module's own layout class. */\nexport function AttachmentGroup({ className, ...props }: AttachmentGroupProps) {\n return <div className={cx(styles.attachmentGroup, 'scroll-fade-x', 'no-scrollbar', className)} {...props} />;\n}\n\nexport { attachmentMediaVariants, attachmentVariants };\n"],"names":["AttachmentStateContext","createContext","attachmentVariants","cva","styles","Attachment","className","state","size","orientation","props","jsx","attachmentMediaVariants","AttachmentMedia","variant","AttachmentContent","cx","AttachmentTitle","useContext","AttachmentDescription","AttachmentActions","AttachmentAction","Button","AttachmentTrigger","render","type","useRender","mergeProps","AttachmentGroup"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;GAsCMA,IAAyBC,EAAwC,MAAM,GAEvEC,IAAqBC,EAAIC,EAAO,YAAY;AAAA,EAChD,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,SAASA,EAAO;AAAA,MAChB,IAAIA,EAAO;AAAA,MACX,IAA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EAAO,iBAAiB,iBAAiB,gBAAgBE,CAAS,GAAI,GAAGI,EAAA,CAAO;AAC5G;"}
|
|
1
|
+
{"version":3,"file":"attachment.js","sources":["../src/components/attachment/attachment.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { useRender } from '@base-ui/react/use-render';\nimport { cva, cx, type VariantProps } from 'class-variance-authority';\nimport { createContext, useContext, type ComponentProps } from 'react';\n\nimport { Button, type ButtonProps } from '../button/button.js';\nimport styles from './attachment.module.css';\n\n/*\n * A faithful port of shadcn/ui's base Attachment\n * (registry/bases/base/ui/attachment.tsx): a file/image attachment card\n * with media, metadata, upload state, and actions. No primitive to lean\n * on — the upload state machine (`state`) is plain data-attribute-driven\n * CSS, same shape as Message/Bubble, for every part EXCEPT the shimmer\n * below.\n *\n * Uses two utilities from this package's global stylesheet\n * (src/styles/utilities.css, imported alongside theme.css — see that\n * file's own header): `shimmer` on `AttachmentTitle` while uploading or\n * processing, and `scroll-fade-x` + `no-scrollbar` on `AttachmentGroup`'s\n * scroll track.\n *\n * Upstream drives the shimmer purely through a CSS ancestor selector\n * (`group-data-[state=processing]/attachment:shimmer`) with no extra prop\n * on `AttachmentTitle` at all. `shimmer` is a GLOBAL utility class, not a\n * CSS Modules class — there is no CSS-only way to conditionally attach an\n * unrelated global class name to a descendant based on an ancestor's data\n * attribute (a plain descendant selector can style `.attachmentTitle`\n * directly, but it cannot make that element also match every rule the\n * literal `.shimmer` class carries). Every other ancestor-state read\n * below (`AttachmentMedia`'s size/orientation/error styling,\n * `AttachmentDescription`'s error tint) stays pure CSS for exactly this\n * reason — only the shimmer needs it. React context carries the state\n * down to `AttachmentTitle` instead, so the API stays prop-free like\n * upstream — the consumer never re-passes `state` to a child part.\n */\nconst AttachmentStateContext = createContext<AttachmentProps['state']>('done');\n\nconst attachmentVariants = cva(styles.attachment, {\n variants: {\n size: {\n default: styles.sizeDefault,\n sm: styles.sizeSm,\n xs: styles.sizeXs,\n },\n orientation: {\n horizontal: styles.orientationHorizontal,\n vertical: styles.orientationVertical,\n },\n },\n defaultVariants: {\n size: 'default',\n orientation: 'horizontal',\n },\n});\n\nexport interface AttachmentProps extends ComponentProps<'div'>, VariantProps<typeof attachmentVariants> {\n /**\n * The upload state. Drives styling (idle's dashed border, error's\n * destructive tint on the media/description) and `AttachmentTitle`'s\n * shimmer.\n * @default 'done'\n */\n state?: 'idle' | 'uploading' | 'processing' | 'error' | 'done';\n}\n\n/** The root attachment container. */\nexport function Attachment({\n className,\n state = 'done',\n size = 'default',\n orientation = 'horizontal',\n ...props\n}: AttachmentProps) {\n return (\n <AttachmentStateContext.Provider value={state}>\n <div\n data-state={state}\n data-size={size}\n data-orientation={orientation}\n className={attachmentVariants({ size, orientation, className })}\n {...props}\n />\n </AttachmentStateContext.Provider>\n );\n}\n\nconst attachmentMediaVariants = cva(styles.attachmentMedia, {\n variants: {\n variant: {\n icon: styles.variantIcon,\n image: styles.variantImage,\n },\n },\n defaultVariants: {\n variant: 'icon',\n },\n});\n\nexport interface AttachmentMediaProps\n extends ComponentProps<'div'>, VariantProps<typeof attachmentMediaVariants> {}\n\n/** The media slot for an icon or image preview. Sizes and tints itself off\n * the ancestor `Attachment`'s `size`/`orientation`/`state` via CSS — no\n * extra props needed. */\nexport function AttachmentMedia({ className, variant, ...props }: AttachmentMediaProps) {\n // cva's own VariantProps types this `| null` (a consumer can pass\n // `variant={null}` to explicitly reset to the default), which a default\n // parameter value alone doesn't absorb — only `undefined` does. cva reads\n // that null as \"emit no variant class at all\" while `data-variant` would\n // still be dropped by React, so the media slot would come out with neither\n // the default class nor the attribute. Resolved once here, same as\n // marker.tsx, so class and attribute always agree.\n const resolvedVariant = variant ?? 'icon';\n return (\n <div\n data-variant={resolvedVariant}\n className={attachmentMediaVariants({ variant: resolvedVariant, className })}\n {...props}\n />\n );\n}\n\nexport type AttachmentContentProps = ComponentProps<'div'>;\n\n/** Wraps the title and description. */\nexport function AttachmentContent({ className, ...props }: AttachmentContentProps) {\n return <div className={cx(styles.attachmentContent, className)} {...props} />;\n}\n\nexport type AttachmentTitleProps = ComponentProps<'span'>;\n\n/** The attachment name. Shimmers (via the global `shimmer` utility class —\n * see this file's own header) while the ancestor `Attachment`'s `state` is\n * `'uploading'` or `'processing'` — read from context, not a prop. */\nexport function AttachmentTitle({ className, ...props }: AttachmentTitleProps) {\n const state = useContext(AttachmentStateContext);\n return (\n <span\n className={cx(styles.attachmentTitle, (state === 'uploading' || state === 'processing') && 'shimmer', className)}\n {...props}\n />\n );\n}\n\nexport type AttachmentDescriptionProps = ComponentProps<'span'>;\n\n/** Secondary metadata such as the file type, size, or upload status. Picks\n * up the ancestor `Attachment`'s `error` tint via a CSS descendant\n * selector — no extra prop needed. */\nexport function AttachmentDescription({ className, ...props }: AttachmentDescriptionProps) {\n return <span className={cx(styles.attachmentDescription, className)} {...props} />;\n}\n\nexport type AttachmentActionsProps = ComponentProps<'div'>;\n\n/** A container for one or more actions, aligned to the end of the\n * attachment. */\nexport function AttachmentActions({ className, ...props }: AttachmentActionsProps) {\n return <div className={cx(styles.attachmentActions, className)} {...props} />;\n}\n\nexport type AttachmentActionProps = ButtonProps;\n\n/**\n * An action button. Renders the kit `Button` and accepts all of its props.\n *\n * DRIFT from upstream: shadcn's `AttachmentAction` defaults to\n * `size=\"icon-xs\"` — a dedicated micro icon-only step this kit's `Button`\n * does not have.\n * `size=\"sm\"` is the smallest step available; icon-only squaring already\n * works at any size via Button's own `[data-icon-only]` rule\n * (button.module.css), so the visual result is a slightly larger action\n * button (32px) than upstream's (24px), not a broken one.\n */\nexport function AttachmentAction({ className, variant, size = 'sm', ...props }: AttachmentActionProps) {\n return (\n <Button\n variant={variant ?? 'ghost'}\n size={size}\n className={cx(styles.attachmentAction, className)}\n {...props}\n />\n );\n}\n\nexport type AttachmentTriggerProps = useRender.ComponentProps<'button'>;\n\n/** A full-card overlay that activates the attachment — opens a link or\n * dialog while `AttachmentActions` stay independently clickable (it sits\n * behind them in the stacking order). Renders a `<button>` by default. */\nexport function AttachmentTrigger({ className, render, type, ...props }: AttachmentTriggerProps) {\n return useRender({\n defaultTagName: 'button',\n render,\n props: mergeProps<'button'>(\n {\n type: render ? type : (type ?? 'button'),\n className: cx(styles.attachmentTrigger, className),\n },\n props,\n ),\n });\n}\n\nexport type AttachmentGroupProps = ComponentProps<'div'>;\n\n/** Lays out attachments in a horizontally scrollable, snapping row with an\n * edge fade. Applies `scroll-fade-x` and `no-scrollbar` (this package's\n * global utilities — see this file's own header) directly, by class name,\n * alongside the module's own layout class. */\nexport function AttachmentGroup({ className, ...props }: AttachmentGroupProps) {\n return <div className={cx(styles.attachmentGroup, 'scroll-fade-x', 'no-scrollbar', className)} {...props} />;\n}\n\nexport { attachmentMediaVariants, attachmentVariants };\n"],"names":["AttachmentStateContext","createContext","attachmentVariants","cva","styles","Attachment","className","state","size","orientation","props","jsx","attachmentMediaVariants","AttachmentMedia","variant","resolvedVariant","AttachmentContent","cx","AttachmentTitle","useContext","AttachmentDescription","AttachmentActions","AttachmentAction","Button","AttachmentTrigger","render","type","useRender","mergeProps","AttachmentGroup"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;GAsCMA,IAAyBC,EAAwC,MAAM,GAEvEC,IAAqBC,EAAIC,EAAO,YAAY;AAAA,EAChD,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,SAASA,EAAO;AAAA,MAChB,IAAIA,EAAO;AAAA,MACX,IAAIA,EAAO;AAAA,IAAA;AAAA,IAEb,aAAa;AAAA,MACX,YAAYA,EAAO;AAAA,MACnB,UAAUA,EAAO;AAAA,IAAA;AAAA,EACnB;AAAA,EAEF,iBAAiB;AAAA,IACf,MAAM;AAAA,IACN,aAAa;AAAA,EAAA;AAEjB,CAAC;AAaM,SAASC,EAAW;AAAA,EACzB,WAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC,IAAO;AAAA,EACP,aAAAC,IAAc;AAAA,EACd,GAAGC;AACL,GAAoB;AAClB,SACE,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AAO,gBAAAC,EAAC,UAAK,WAAWM,EAAGb,EAAO,uBAAuBE,CAAS,GAAI,GAAGI,GAAO;AAClF;AAMO,SAASW,EAAkB,EAAE,WAAAf,GAAW,GAAGI,KAAiC;AACjF,SAAO,gBAAAC,EAAC,SAAI,WAAWM,EAAGb,EAAO,mBAAmBE,CAAS,GAAI,GAAGI,GAAO;AAC7E;AAeO,SAASY,EAAiB,EAAE,WAAAhB,GAAW,SAAAQ,GAAS,MAAAN,IAAO,MAAM,GAAGE,KAAgC;AACrG,SACE,gBAAAC;AAAA,IAACY;AAAA,IAAA;AAAA,MACC,SAAST,KAAW;AAAA,MACpB,MAAAN;AAAA,MACA,WAAWS,EAAGb,EAAO,kBAAkBE,CAAS;AAAA,MAC/C,GAAGI;AAAA,IAAA;AAAA,EAAA;AAGV;AAOO,SAASc,EAAkB,EAAE,WAAAlB,GAAW,QAAAmB,GAAQ,MAAAC,GAAM,GAAGhB,KAAiC;AAC/F,SAAOiB,EAAU;AAAA,IACf,gBAAgB;AAAA,IAChB,QAAAF;AAAA,IACA,OAAOG;AAAA,MACL;AAAA,QACE,MAAMH,IAASC,IAAQA,KAAQ;AAAA,QAC/B,WAAWT,EAAGb,EAAO,mBAAmBE,CAAS;AAAA,MAAA;AAAA,MAEnDI;AAAA,IAAA;AAAA,EACF,CACD;AACH;AAQO,SAASmB,EAAgB,EAAE,WAAAvB,GAAW,GAAGI,KAA+B;AAC7E,SAAO,gBAAAC,EAAC,OAAA,EAAI,WAAWM,EAAGb,EAAO,iBAAiB,iBAAiB,gBAAgBE,CAAS,GAAI,GAAGI,EAAA,CAAO;AAC5G;"}
|
package/dist/bubble.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
-
import { mergeProps as
|
|
4
|
-
import { useRender as
|
|
5
|
-
import { cx as o, cva as
|
|
6
|
-
import './chunks/bubble.BKcAopT7.css';const
|
|
7
|
-
bubbleGroup:
|
|
8
|
-
bubble:
|
|
9
|
-
bubbleContent:
|
|
3
|
+
import { mergeProps as u } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender as l } from "@base-ui/react/use-render";
|
|
5
|
+
import { cx as o, cva as b } from "class-variance-authority";
|
|
6
|
+
import './chunks/bubble.BKcAopT7.css';const d = "_bubbleGroup_ma2s7_13", c = "_bubble_ma2s7_13", v = "_bubbleContent_ma2s7_38", _ = "_variantDefault_ma2s7_120", m = "_variantSecondary_ma2s7_132", f = "_variantMuted_ma2s7_145", p = "_variantTinted_ma2s7_164", g = "_variantOutline_ma2s7_176", G = "_variantGhost_ma2s7_202", T = "_variantDestructive_ma2s7_235", B = "_bubbleReactions_ma2s7_262", D = "_sideTop_ma2s7_289", S = "_sideBottom_ma2s7_294", R = "_alignStart_ma2s7_299", y = "_alignEnd_ma2s7_303", t = {
|
|
7
|
+
bubbleGroup: d,
|
|
8
|
+
bubble: c,
|
|
9
|
+
bubbleContent: v,
|
|
10
10
|
variantDefault: _,
|
|
11
|
-
variantSecondary:
|
|
12
|
-
variantMuted:
|
|
13
|
-
variantTinted:
|
|
14
|
-
variantOutline:
|
|
15
|
-
variantGhost:
|
|
16
|
-
variantDestructive:
|
|
17
|
-
bubbleReactions:
|
|
18
|
-
sideTop:
|
|
19
|
-
sideBottom:
|
|
20
|
-
alignStart:
|
|
21
|
-
alignEnd:
|
|
22
|
-
},
|
|
11
|
+
variantSecondary: m,
|
|
12
|
+
variantMuted: f,
|
|
13
|
+
variantTinted: p,
|
|
14
|
+
variantOutline: g,
|
|
15
|
+
variantGhost: G,
|
|
16
|
+
variantDestructive: T,
|
|
17
|
+
bubbleReactions: B,
|
|
18
|
+
sideTop: D,
|
|
19
|
+
sideBottom: S,
|
|
20
|
+
alignStart: R,
|
|
21
|
+
alignEnd: y
|
|
22
|
+
}, h = b(t.bubble, {
|
|
23
23
|
variants: {
|
|
24
24
|
variant: {
|
|
25
25
|
default: t.variantDefault,
|
|
@@ -38,25 +38,26 @@ import './chunks/bubble.BKcAopT7.css';const l = "_bubbleGroup_ma2s7_13", d = "_b
|
|
|
38
38
|
function O({ className: n, ...a }) {
|
|
39
39
|
return /* @__PURE__ */ s("div", { className: o(t.bubbleGroup, n), ...a });
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function x({ className: n, variant: a, align: e = "start", ...i }) {
|
|
42
|
+
const r = a ?? "default";
|
|
42
43
|
return /* @__PURE__ */ s(
|
|
43
44
|
"div",
|
|
44
45
|
{
|
|
45
|
-
"data-variant":
|
|
46
|
+
"data-variant": r,
|
|
46
47
|
"data-align": e,
|
|
47
|
-
className:
|
|
48
|
+
className: h({ variant: r, className: n }),
|
|
48
49
|
...i
|
|
49
50
|
}
|
|
50
51
|
);
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
-
return
|
|
53
|
+
function j({ className: n, render: a, ...e }) {
|
|
54
|
+
return l({
|
|
54
55
|
defaultTagName: "div",
|
|
55
56
|
render: a,
|
|
56
|
-
props:
|
|
57
|
+
props: u({ className: o(t.bubbleContent, n) }, e)
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
|
-
const
|
|
60
|
+
const C = b(t.bubbleReactions, {
|
|
60
61
|
variants: {
|
|
61
62
|
side: {
|
|
62
63
|
top: t.sideTop,
|
|
@@ -72,23 +73,23 @@ const h = r(t.bubbleReactions, {
|
|
|
72
73
|
align: "end"
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
|
-
function
|
|
76
|
+
function P({ className: n, side: a = "bottom", align: e = "end", ...i }) {
|
|
76
77
|
return /* @__PURE__ */ s(
|
|
77
78
|
"div",
|
|
78
79
|
{
|
|
79
80
|
"data-side": a,
|
|
80
81
|
"data-align": e,
|
|
81
|
-
className:
|
|
82
|
+
className: C({ side: a, align: e, className: n }),
|
|
82
83
|
...i
|
|
83
84
|
}
|
|
84
85
|
);
|
|
85
86
|
}
|
|
86
87
|
export {
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
x as Bubble,
|
|
89
|
+
j as BubbleContent,
|
|
89
90
|
O as BubbleGroup,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
P as BubbleReactions,
|
|
92
|
+
C as bubbleReactionsVariants,
|
|
93
|
+
h as bubbleVariants
|
|
93
94
|
};
|
|
94
95
|
//# sourceMappingURL=bubble.js.map
|
package/dist/bubble.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bubble.js","sources":["../src/components/bubble/bubble.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { useRender } from '@base-ui/react/use-render';\nimport { cva, cx, type VariantProps } from 'class-variance-authority';\nimport type { ComponentProps } from 'react';\n\nimport styles from './bubble.module.css';\n\n/*\n * A faithful port of shadcn/ui's base Bubble\n * (registry/bases/base/ui/bubble.tsx): framed conversational content —\n * chat text, short structured output, quoted replies, suggestions, and\n * reactions. Bubble is intentionally scoped to the bubble surface; avatars,\n * names, timestamps, and message-level actions belong on\n * [`Message`](message.tsx), not here. Bubble has no Base UI primitive, but\n * `BubbleContent` gets `render`-prop polymorphism from\n * `useRender`/`mergeProps` — the same utilities Base UI's own primitives\n * are built on, and the same pattern Badge uses — for a bubble that is\n * actually a link or button.\n *\n * `align` (like Message's own) is layout-only — a plain `data-align`\n * attribute, not a `cva` variant — since it only ever repositions the\n * bubble, with no color/geometry of its own per value. `variant` IS the\n * paint axis and drives real `cva` classes. BubbleReactions' `side`/`align`\n * are genuinely visual (they pick which edge/corner the pill anchors to),\n * so both are `cva` axes of their own, named after the prop the same way\n * `variant`/`size` are elsewhere in the kit.\n */\nconst bubbleVariants = cva(styles.bubble, {\n variants: {\n variant: {\n default: styles.variantDefault,\n secondary: styles.variantSecondary,\n muted: styles.variantMuted,\n tinted: styles.variantTinted,\n outline: styles.variantOutline,\n ghost: styles.variantGhost,\n destructive: styles.variantDestructive,\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\nexport type BubbleGroupProps = ComponentProps<'div'>;\n\n/** Stacks consecutive `Bubble`s from the same sender. Set `align` on each\n * `Bubble` itself — it does not belong on the group. */\nexport function BubbleGroup({ className, ...props }: BubbleGroupProps) {\n return <div className={cx(styles.bubbleGroup, className)} {...props} />;\n}\n\nexport interface BubbleProps extends ComponentProps<'div'>, VariantProps<typeof bubbleVariants> {\n /**\n * The inline alignment of the bubble within its row.\n * @default 'start'\n */\n align?: 'start' | 'end';\n}\n\n/** The root bubble wrapper. */\nexport function Bubble({ className, variant
|
|
1
|
+
{"version":3,"file":"bubble.js","sources":["../src/components/bubble/bubble.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { useRender } from '@base-ui/react/use-render';\nimport { cva, cx, type VariantProps } from 'class-variance-authority';\nimport type { ComponentProps } from 'react';\n\nimport styles from './bubble.module.css';\n\n/*\n * A faithful port of shadcn/ui's base Bubble\n * (registry/bases/base/ui/bubble.tsx): framed conversational content —\n * chat text, short structured output, quoted replies, suggestions, and\n * reactions. Bubble is intentionally scoped to the bubble surface; avatars,\n * names, timestamps, and message-level actions belong on\n * [`Message`](message.tsx), not here. Bubble has no Base UI primitive, but\n * `BubbleContent` gets `render`-prop polymorphism from\n * `useRender`/`mergeProps` — the same utilities Base UI's own primitives\n * are built on, and the same pattern Badge uses — for a bubble that is\n * actually a link or button.\n *\n * `align` (like Message's own) is layout-only — a plain `data-align`\n * attribute, not a `cva` variant — since it only ever repositions the\n * bubble, with no color/geometry of its own per value. `variant` IS the\n * paint axis and drives real `cva` classes. BubbleReactions' `side`/`align`\n * are genuinely visual (they pick which edge/corner the pill anchors to),\n * so both are `cva` axes of their own, named after the prop the same way\n * `variant`/`size` are elsewhere in the kit.\n */\nconst bubbleVariants = cva(styles.bubble, {\n variants: {\n variant: {\n default: styles.variantDefault,\n secondary: styles.variantSecondary,\n muted: styles.variantMuted,\n tinted: styles.variantTinted,\n outline: styles.variantOutline,\n ghost: styles.variantGhost,\n destructive: styles.variantDestructive,\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\nexport type BubbleGroupProps = ComponentProps<'div'>;\n\n/** Stacks consecutive `Bubble`s from the same sender. Set `align` on each\n * `Bubble` itself — it does not belong on the group. */\nexport function BubbleGroup({ className, ...props }: BubbleGroupProps) {\n return <div className={cx(styles.bubbleGroup, className)} {...props} />;\n}\n\nexport interface BubbleProps extends ComponentProps<'div'>, VariantProps<typeof bubbleVariants> {\n /**\n * The inline alignment of the bubble within its row.\n * @default 'start'\n */\n align?: 'start' | 'end';\n}\n\n/** The root bubble wrapper. */\nexport function Bubble({ className, variant, align = 'start', ...props }: BubbleProps) {\n // cva's own VariantProps types this `| null` (a consumer can pass\n // `variant={null}` to explicitly reset to the default), which a default\n // parameter value alone doesn't absorb — only `undefined` does. cva reads\n // that null as \"emit no variant class at all\" while `data-variant` would\n // still be dropped by React, so the bubble would come out with neither the\n // default class nor the attribute. Resolved once here, same as marker.tsx,\n // so class and attribute always agree.\n const resolvedVariant = variant ?? 'default';\n return (\n <div\n data-variant={resolvedVariant}\n data-align={align}\n className={bubbleVariants({ variant: resolvedVariant, className })}\n {...props}\n />\n );\n}\n\nexport type BubbleContentProps = useRender.ComponentProps<'div'>;\n\n/** The bubble content wrapper — the visible framed surface. Render as a\n * link or button via `render` for a clickable bubble; the visible focus\n * ring and hover feedback only apply once actually rendered that way. */\nexport function BubbleContent({ className, render, ...props }: BubbleContentProps) {\n return useRender({\n defaultTagName: 'div',\n render,\n props: mergeProps<'div'>({ className: cx(styles.bubbleContent, className) }, props),\n });\n}\n\nconst bubbleReactionsVariants = cva(styles.bubbleReactions, {\n variants: {\n side: {\n top: styles.sideTop,\n bottom: styles.sideBottom,\n },\n align: {\n start: styles.alignStart,\n end: styles.alignEnd,\n },\n },\n defaultVariants: {\n side: 'bottom',\n align: 'end',\n },\n});\n\nexport interface BubbleReactionsProps\n extends ComponentProps<'div'>, VariantProps<typeof bubbleReactionsVariants> {}\n\n/** Displays overlapped reactions anchored to a bubble edge. Reactions\n * overlap the bubble edge, so leave vertical space between bubble rows. */\nexport function BubbleReactions({ className, side = 'bottom', align = 'end', ...props }: BubbleReactionsProps) {\n return (\n <div\n data-side={side}\n data-align={align}\n className={bubbleReactionsVariants({ side, align, className })}\n {...props}\n />\n );\n}\n\nexport { bubbleReactionsVariants, bubbleVariants };\n"],"names":["bubbleVariants","cva","styles","BubbleGroup","className","props","jsx","cx","Bubble","variant","align","resolvedVariant","BubbleContent","render","useRender","mergeProps","bubbleReactionsVariants","BubbleReactions","side"],"mappings":";;;;;;;;;;;;;;;;;;;;;GA6BMA,IAAiBC,EAAIC,EAAO,QAAQ;AAAA,EACxC,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAASA,EAAO;AAAA,MAChB,WAAWA,EAAO;AAAA,MAClB,OAAOA,EAAO;AAAA,MACd,QAAQA,EAAO;AAAA,MACf,SAASA,EAAO;AAAA,MAChB,OAAOA,EAAO;AAAA,MACd,aAAaA,EAAO;AAAA,IAAA;AAAA,EACtB;AAAA,EAEF,iBAAiB;AAAA,IACf,SAAS;AAAA,EAAA;AAEb,CAAC;AAMM,SAASC,EAAY,EAAE,WAAAC,GAAW,GAAGC,KAA2B;AACrE,SAAO,gBAAAC,EAAC,SAAI,WAAWC,EAAGL,EAAO,aAAaE,CAAS,GAAI,GAAGC,GAAO;AACvE;AAWO,SAASG,EAAO,EAAE,WAAAJ,GAAW,SAAAK,GAAS,OAAAC,IAAQ,SAAS,GAAGL,KAAsB;AAQrF,QAAMM,IAAkBF,KAAW;AACnC,SACE,gBAAAH;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,gBAAcK;AAAA,MACd,cAAYD;AAAA,MACZ,WAAWV,EAAe,EAAE,SAASW,GAAiB,WAAAP,GAAW;AAAA,MAChE,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AAOO,SAASO,EAAc,EAAE,WAAAR,GAAW,QAAAS,GAAQ,GAAGR,KAA6B;AACjF,SAAOS,EAAU;AAAA,IACf,gBAAgB;AAAA,IAChB,QAAAD;AAAA,IACA,OAAOE,EAAkB,EAAE,WAAWR,EAAGL,EAAO,eAAeE,CAAS,EAAA,GAAKC,CAAK;AAAA,EAAA,CACnF;AACH;AAEA,MAAMW,IAA0Bf,EAAIC,EAAO,iBAAiB;AAAA,EAC1D,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,KAAKA,EAAO;AAAA,MACZ,QAAQA,EAAO;AAAA,IAAA;AAAA,IAEjB,OAAO;AAAA,MACL,OAAOA,EAAO;AAAA,MACd,KAAKA,EAAO;AAAA,IAAA;AAAA,EACd;AAAA,EAEF,iBAAiB;AAAA,IACf,MAAM;AAAA,IACN,OAAO;AAAA,EAAA;AAEX,CAAC;AAOM,SAASe,EAAgB,EAAE,WAAAb,GAAW,MAAAc,IAAO,UAAU,OAAAR,IAAQ,OAAO,GAAGL,KAA+B;AAC7G,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAWY;AAAA,MACX,cAAYR;AAAA,MACZ,WAAWM,EAAwB,EAAE,MAAAE,GAAM,OAAAR,GAAO,WAAAN,GAAW;AAAA,MAC5D,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
package/dist/chart.js
CHANGED
|
@@ -3,19 +3,19 @@ import { jsx as i, jsxs as m, Fragment as j } from "react/jsx-runtime";
|
|
|
3
3
|
import { useId as E, useMemo as V, createContext as k, useContext as A } from "react";
|
|
4
4
|
import { cx as h } from "class-variance-authority";
|
|
5
5
|
import * as b from "recharts";
|
|
6
|
-
import './chunks/chart.CeyctrXQ.css';const P = "_container_2ox8r_24", F = "_tooltipContent_2ox8r_92", G = "_tooltipLabel_2ox8r_104",
|
|
6
|
+
import './chunks/chart.CeyctrXQ.css';const P = "_container_2ox8r_24", F = "_tooltipContent_2ox8r_92", G = "_tooltipLabel_2ox8r_104", U = "_tooltipItems_2ox8r_108", K = "_tooltipItem_2ox8r_108", M = "_tooltipItemCentered_2ox8r_124", O = "_indicator_2ox8r_134", R = "_indicatorDot_2ox8r_139", q = "_indicatorLine_2ox8r_147", z = "_indicatorDashed_2ox8r_151", Z = "_indicatorNested_2ox8r_158", H = "_tooltipItemBody_2ox8r_163", J = "_tooltipItemBodyNested_2ox8r_169", Q = "_tooltipItemBodyInline_2ox8r_173", W = "_tooltipItemLabelGroup_2ox8r_177", X = "_tooltipItemName_2ox8r_182", Y = "_tooltipItemValue_2ox8r_186", tt = "_legendContent_2ox8r_195", ot = "_legendTop_2ox8r_202", et = "_legendBottom_2ox8r_206", nt = "_legendItem_2ox8r_210", rt = "_legendSwatch_2ox8r_224", e = {
|
|
7
7
|
container: P,
|
|
8
8
|
tooltipContent: F,
|
|
9
9
|
tooltipLabel: G,
|
|
10
|
-
tooltipItems:
|
|
11
|
-
tooltipItem:
|
|
12
|
-
tooltipItemCentered:
|
|
10
|
+
tooltipItems: U,
|
|
11
|
+
tooltipItem: K,
|
|
12
|
+
tooltipItemCentered: M,
|
|
13
13
|
indicator: O,
|
|
14
14
|
indicatorDot: R,
|
|
15
15
|
indicatorLine: q,
|
|
16
16
|
indicatorDashed: z,
|
|
17
|
-
indicatorNested:
|
|
18
|
-
tooltipItemBody:
|
|
17
|
+
indicatorNested: Z,
|
|
18
|
+
tooltipItemBody: H,
|
|
19
19
|
tooltipItemBodyNested: J,
|
|
20
20
|
tooltipItemBodyInline: Q,
|
|
21
21
|
tooltipItemLabelGroup: W,
|
|
@@ -34,7 +34,7 @@ function w() {
|
|
|
34
34
|
return n;
|
|
35
35
|
}
|
|
36
36
|
const ct = /[^a-zA-Z0-9_-]/g, it = /[;{}<>\\]|\/\*|\*\//;
|
|
37
|
-
function
|
|
37
|
+
function B(n) {
|
|
38
38
|
return n.replace(ct, "_");
|
|
39
39
|
}
|
|
40
40
|
function st(n) {
|
|
@@ -48,7 +48,7 @@ function ht({
|
|
|
48
48
|
initialDimension: a = lt,
|
|
49
49
|
...p
|
|
50
50
|
}) {
|
|
51
|
-
const c = E(), u =
|
|
51
|
+
const c = E(), u = B(`chart-${n ?? c}`);
|
|
52
52
|
return /* @__PURE__ */ i(T.Provider, { value: { config: l }, children: /* @__PURE__ */ m("div", { "data-chart": u, className: h(e.container, t), ...p, children: [
|
|
53
53
|
/* @__PURE__ */ i(at, { id: u, config: l }),
|
|
54
54
|
/* @__PURE__ */ i(b.ResponsiveContainer, { initialDimension: a, children: r })
|
|
@@ -58,10 +58,10 @@ function at({ id: n, config: t }) {
|
|
|
58
58
|
const r = Object.entries(t).filter(([, _]) => _.theme ?? _.color);
|
|
59
59
|
if (!r.length)
|
|
60
60
|
return null;
|
|
61
|
-
const l =
|
|
61
|
+
const l = B(n), a = (_) => r.map(([s, N]) => {
|
|
62
62
|
var I;
|
|
63
63
|
const g = ((I = N.theme) == null ? void 0 : I[_]) ?? N.color;
|
|
64
|
-
return !g || !st(g) ? null : ` --color-${
|
|
64
|
+
return !g || !st(g) ? null : ` --color-${B(s)}: ${g};`;
|
|
65
65
|
}).filter((s) => s !== null).join(`
|
|
66
66
|
`), p = a("light"), c = a("dark"), u = `
|
|
67
67
|
[data-chart='${l}'] {
|
|
@@ -78,7 +78,7 @@ ${c}
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
`;
|
|
81
|
-
return /* @__PURE__ */ i("style", {
|
|
81
|
+
return /* @__PURE__ */ i("style", { children: u });
|
|
82
82
|
}
|
|
83
83
|
const pt = b.Tooltip;
|
|
84
84
|
function It({
|
|
@@ -100,7 +100,7 @@ function It({
|
|
|
100
100
|
var v;
|
|
101
101
|
if (a || !(t != null && t.length))
|
|
102
102
|
return null;
|
|
103
|
-
const [o] = t, L = `${I ?? (o == null ? void 0 : o.dataKey) ?? (o == null ? void 0 : o.name) ?? "value"}`, f =
|
|
103
|
+
const [o] = t, L = `${I ?? (o == null ? void 0 : o.dataKey) ?? (o == null ? void 0 : o.name) ?? "value"}`, f = S(x, o, L), d = !I && typeof c == "string" ? ((v = x[c]) == null ? void 0 : v.label) ?? c : f == null ? void 0 : f.label;
|
|
104
104
|
return u ? /* @__PURE__ */ i("div", { className: h(e.tooltipLabel, _), children: u(d, t) }) : d ? /* @__PURE__ */ i("div", { className: h(e.tooltipLabel, _), children: d }) : null;
|
|
105
105
|
}, [c, u, t, a, _, x, I]);
|
|
106
106
|
if (!n || !(t != null && t.length))
|
|
@@ -110,7 +110,7 @@ function It({
|
|
|
110
110
|
C ? null : D,
|
|
111
111
|
/* @__PURE__ */ i("div", { className: e.tooltipItems, children: t.filter((o) => o.type !== "none").map((o, L) => {
|
|
112
112
|
var $;
|
|
113
|
-
const f = `${g ?? o.name ?? o.dataKey ?? "value"}`, d =
|
|
113
|
+
const f = `${g ?? o.name ?? o.dataKey ?? "value"}`, d = S(x, o, f), v = N ?? (($ = o.payload) == null ? void 0 : $.fill) ?? o.color;
|
|
114
114
|
return /* @__PURE__ */ i(
|
|
115
115
|
"div",
|
|
116
116
|
{
|
|
@@ -170,7 +170,7 @@ function gt({
|
|
|
170
170
|
n
|
|
171
171
|
),
|
|
172
172
|
children: r.filter((c) => c.type !== "none").map((c, u) => {
|
|
173
|
-
const _ = `${a ?? c.dataKey ?? "value"}`, s =
|
|
173
|
+
const _ = `${a ?? c.dataKey ?? "value"}`, s = S(p, c, _);
|
|
174
174
|
return /* @__PURE__ */ m("div", { className: e.legendItem, children: [
|
|
175
175
|
s != null && s.icon && !t ? /* @__PURE__ */ i(s.icon, {}) : /* @__PURE__ */ i("div", { className: e.legendSwatch, style: { backgroundColor: c.color } }),
|
|
176
176
|
s == null ? void 0 : s.label
|
|
@@ -185,7 +185,7 @@ function y(n, t) {
|
|
|
185
185
|
const r = n[t];
|
|
186
186
|
return typeof r == "string" ? r : void 0;
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function S(n, t, r) {
|
|
189
189
|
if (typeof t != "object" || t === null)
|
|
190
190
|
return;
|
|
191
191
|
const l = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, a = y(t, r) ?? (l && y(l, r)) ?? r;
|
package/dist/chart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.js","sources":["../src/components/chart/chart.tsx"],"sourcesContent":["'use client';\n\n/*\n * Upstream (apps/v4/registry/bases/base/ui/chart.tsx) wraps Recharts:\n * ChartContainer supplies the ResponsiveContainer plus a per-instance\n * runtime `<style>` tag (ChartStyle) that turns each `ChartConfig` entry\n * into a `--color-<key>` custom property scoped to that one chart instance\n * via a `data-chart` id — the hook a consumer's own Bar/Line/Area elements\n * read from (`fill=\"var(--color-desktop)\"`) to pick up branded series\n * colors without prop-drilling them through Recharts' own API. `data-chart`\n * is that scoping id, not this kit's usual `data-slot` marker — there is no\n * `data-slot` here by design, same as every other ported part.\n *\n * Two deliberate deviations from upstream, both forced by this kit's own\n * constraints rather than a style preference — see chart.md's \"Porting\n * notes\" for the consumer-facing summary:\n *\n * 1. THEMES / dark selector — upstream keys the per-theme color map by\n * `{ light: \"\", dark: \".dark\" }`, a literal Tailwind dark-mode class\n * selector. This kit has no such class (see theme.css's header): dark\n * mode is `[data-theme='dark']` plus a `prefers-color-scheme` fallback\n * guarded by `:not([data-theme='light'])`. ChartStyle below emits BOTH\n * selectors for the dark entry instead of one, mirroring theme.css's own\n * dual mechanism. The public `ChartConfig['theme']` keys stay exactly\n * `light`/`dark` regardless — that part is upstream's real API, not the\n * selector text it happens to compile to.\n * 2. No `--chart-1`..`--chart-5` palette — those tokens don't exist in\n * theme.css (frozen for this port) and were deliberately not added.\n * A consumer supplies every series color through `ChartConfig` itself\n * (`color` or `theme`) — upstream's real, load-bearing API regardless;\n * shadcn's own docs setting `--chart-1` etc. is just ONE value for that\n * same `color` field, not a requirement of the mechanism.\n */\n\nimport {\n type ComponentProps,\n type ComponentType,\n type ReactNode,\n createContext,\n useContext,\n useId,\n useMemo,\n} from 'react';\nimport { cx } from 'class-variance-authority';\nimport * as RechartsPrimitive from 'recharts';\nimport type { DefaultLegendContentProps, DefaultTooltipContentProps, TooltipValueType } from 'recharts';\n\nimport styles from './chart.module.css';\n\n// Matches Recharts' own default (used when a chart mounts with no measured\n// size yet) being {-1,-1} — upstream overrides it to a real, positive size\n// so ChartContainer's children render immediately instead of waiting for a\n// ResizeObserver entry that jsdom (and a slow first paint) may delay.\nconst INITIAL_DIMENSION = { width: 320, height: 200 } as const;\n\ntype TooltipNameType = number | string;\n\nexport type ChartConfig = Record<\n string,\n {\n label?: ReactNode;\n icon?: ComponentType;\n } & (\n | { color?: string; theme?: never }\n | { color?: never; theme: Record<'light' | 'dark', string> }\n )\n>;\n\ninterface ChartContextValue {\n config: ChartConfig;\n}\n\nconst ChartContext = createContext<ChartContextValue | null>(null);\n\nfunction useChart() {\n const context = useContext(ChartContext);\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />');\n }\n\n return context;\n}\n\nexport type ChartContainerProps = Omit<ComponentProps<'div'>, 'className' | 'children'> & {\n className?: string;\n config: ChartConfig;\n children: ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];\n initialDimension?: { width: number; height: number };\n};\n\n/*\n * Everything ChartStyle interpolates into its <style> tag is\n * consumer-supplied — the chart's `id`, every `ChartConfig` key, every\n * colour string — and none of it is escaped by React, which treats\n * `dangerouslySetInnerHTML` as opaque text. An id of `x] { } body {\n * display: none` would end the selector and start a rule of its own; a\n * colour of `red; } body { … }` does the same one line down; either could\n * carry a literal `</style>` and leave CSS altogether. So the two shapes\n * that reach the stylesheet are constrained rather than trusted:\n * identifiers are reduced to a character set that cannot express any of\n * those, and colour VALUES (which have no such small alphabet — they run\n * from `red` to `color-mix(in oklab, …)`) are checked for the characters\n * that would let one escape its own declaration, and dropped whole if\n * they carry any.\n */\nconst CSS_IDENT_UNSAFE = /[^a-zA-Z0-9_-]/g;\n\n// Anything that could close a declaration, a rule, a comment, or the\n// <style> element itself. Backslash is in the list because a CSS escape\n// sequence is another way to spell any of them.\nconst CSS_VALUE_UNSAFE = /[;{}<>\\\\]|\\/\\*|\\*\\//;\n\nfunction cssIdentifier(value: string): string {\n return value.replace(CSS_IDENT_UNSAFE, '_');\n}\n\nfunction isSafeCssValue(value: string): boolean {\n return !CSS_VALUE_UNSAFE.test(value);\n}\n\nexport function ChartContainer({\n id,\n className,\n children,\n config,\n initialDimension = INITIAL_DIMENSION,\n ...props\n}: ChartContainerProps) {\n const uniqueId = useId();\n // Normalized here, not just inside ChartStyle: the same string has to\n // land in the `data-chart` attribute and in the selector that targets\n // it, so they must be normalized by the same rule or they stop matching.\n const chartId = cssIdentifier(`chart-${id ?? uniqueId}`);\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div data-chart={chartId} className={cx(styles.container, className)} {...props}>\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer initialDimension={initialDimension}>\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n}\n\nexport interface ChartStyleProps {\n id: string;\n config: ChartConfig;\n}\n\n// Exported standalone (matching upstream) for a consumer building their own\n// chart shell without ChartContainer's div/ResponsiveContainer wrapper, who\n// still wants the same per-instance `--color-*` custom-property injection.\nexport function ChartStyle({ id, config }: ChartStyleProps) {\n const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme ?? itemConfig.color);\n\n if (!colorConfig.length) {\n return null;\n }\n\n const safeId = cssIdentifier(id);\n\n const declarationsFor = (theme: 'light' | 'dark') =>\n colorConfig\n .map(([key, itemConfig]) => {\n const color = itemConfig.theme?.[theme] ?? itemConfig.color;\n // A rejected colour drops its whole declaration rather than\n // emitting a broken one: the series then paints in Recharts' own\n // default instead of taking the rest of the stylesheet with it.\n if (!color || !isSafeCssValue(color)) {\n return null;\n }\n return ` --color-${cssIdentifier(key)}: ${color};`;\n })\n .filter((declaration): declaration is string => declaration !== null)\n .join('\\n');\n\n const lightDeclarations = declarationsFor('light');\n const darkDeclarations = declarationsFor('dark');\n\n // See the file header's point 1: two dark blocks (an explicit attribute\n // selector plus a prefers-color-scheme fallback) instead of upstream's\n // single `.dark` class, mirroring theme.css's own dual mechanism. The\n // light block carries no selector prefix, same as upstream's `THEMES.light\n // === \"\"` — it is the unconditional default every chart instance starts\n // from, which the dark blocks below layer on top of.\n const css = `\n[data-chart='${safeId}'] {\n${lightDeclarations}\n}\n\n[data-theme='dark'] [data-chart='${safeId}'] {\n${darkDeclarations}\n}\n\n@media (prefers-color-scheme: dark) {\n :root:not([data-theme='light']) [data-chart='${safeId}'] {\n${darkDeclarations}\n }\n}\n`;\n\n // Per-instance, consumer-supplied colors have no other way to reach a\n // scoped CSS custom property — there is no static class this kit's build\n // could hash for an arbitrary runtime string. Same trade-off upstream\n // makes with its own dangerouslySetInnerHTML.\n return <style dangerouslySetInnerHTML={{ __html: css }} />;\n}\n\nexport const ChartTooltip = RechartsPrimitive.Tooltip;\n\nexport type ChartTooltipContentProps = ComponentProps<typeof RechartsPrimitive.Tooltip> &\n Omit<ComponentProps<'div'>, 'className'> & {\n className?: string;\n hideLabel?: boolean;\n hideIndicator?: boolean;\n indicator?: 'line' | 'dot' | 'dashed';\n nameKey?: string;\n labelKey?: string;\n } & Omit<DefaultTooltipContentProps<TooltipValueType, TooltipNameType>, 'accessibilityLayer'>;\n\nexport function ChartTooltipContent({\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n}: ChartTooltipContentProps) {\n const { config } = useChart();\n\n const tooltipLabel = useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null;\n }\n\n const [item] = payload;\n const key = `${labelKey ?? item?.dataKey ?? item?.name ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const value =\n !labelKey && typeof label === 'string' ? (config[label]?.label ?? label) : itemConfig?.label;\n\n if (labelFormatter) {\n return <div className={cx(styles.tooltipLabel, labelClassName)}>{labelFormatter(value, payload)}</div>;\n }\n\n if (!value) {\n return null;\n }\n\n return <div className={cx(styles.tooltipLabel, labelClassName)}>{value}</div>;\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot';\n\n return (\n <div className={cx(styles.tooltipContent, className)}>\n {!nestLabel ? tooltipLabel : null}\n <div className={styles.tooltipItems}>\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey ?? item.name ?? item.dataKey ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const indicatorColor = color ?? item.payload?.fill ?? item.color;\n\n return (\n <div\n key={index}\n className={cx(styles.tooltipItem, indicator === 'dot' && styles.tooltipItemCentered)}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cx(\n styles.indicator,\n indicator === 'dot' && styles.indicatorDot,\n indicator === 'line' && styles.indicatorLine,\n indicator === 'dashed' && styles.indicatorDashed,\n indicator === 'dashed' && nestLabel && styles.indicatorNested,\n )}\n // Two paint targets, not one custom-property pair like\n // upstream's Tailwind `bg-(--color-bg)`/`border-(--color-border)`\n // arbitrary-value classes: dot/line indicators are filled\n // swatches (background only — chart.module.css's `.indicator`\n // sets no border), the dashed indicator is a hollow\n // dashed-border swatch (border only — `.indicatorDashed`\n // keeps its own background transparent). Setting both\n // properties unconditionally, like upstream does via two\n // always-present custom properties, would depend on which\n // Tailwind utility wins the cascade for the dashed case;\n // branching here is unambiguous.\n style={\n indicator === 'dashed'\n ? { borderColor: indicatorColor }\n : { backgroundColor: indicatorColor }\n }\n />\n )\n )}\n <div\n className={cx(\n styles.tooltipItemBody,\n nestLabel ? styles.tooltipItemBodyNested : styles.tooltipItemBodyInline,\n )}\n >\n <div className={styles.tooltipItemLabelGroup}>\n {nestLabel ? tooltipLabel : null}\n <span className={styles.tooltipItemName}>{itemConfig?.label ?? item.name}</span>\n </div>\n {item.value != null && (\n <span className={styles.tooltipItemValue}>\n {typeof item.value === 'number' ? item.value.toLocaleString() : String(item.value)}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n\nexport const ChartLegend = RechartsPrimitive.Legend;\n\nexport type ChartLegendContentProps = Omit<ComponentProps<'div'>, 'className'> & {\n className?: string;\n hideIcon?: boolean;\n nameKey?: string;\n} & DefaultLegendContentProps;\n\nexport function ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = 'bottom',\n nameKey,\n}: ChartLegendContentProps) {\n const { config } = useChart();\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div\n className={cx(\n styles.legendContent,\n verticalAlign === 'top' ? styles.legendTop : styles.legendBottom,\n className,\n )}\n >\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey ?? item.dataKey ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n return (\n <div key={index} className={styles.legendItem}>\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div className={styles.legendSwatch} style={{ backgroundColor: item.color }} />\n )}\n {itemConfig?.label}\n </div>\n );\n })}\n </div>\n );\n}\n\n// Guarded, single-purpose replacement for upstream's two inline\n// `payload[key as keyof typeof payload] as string` assertions: `in` proves\n// the property exists at runtime, this narrows the read value itself\n// instead of asserting the container's shape.\nfunction getStringField(source: object, key: string): string | undefined {\n if (!(key in source)) {\n return undefined;\n }\n const value = (source as Record<string, unknown>)[key];\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction getPayloadConfigFromPayload(\n config: ChartConfig,\n payload: unknown,\n key: string,\n): ChartConfig[string] | undefined {\n if (typeof payload !== 'object' || payload === null) {\n return undefined;\n }\n\n const payloadPayload =\n 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null\n ? payload.payload\n : undefined;\n\n const configLabelKey =\n getStringField(payload, key) ?? (payloadPayload && getStringField(payloadPayload, key)) ?? key;\n\n return configLabelKey in config ? config[configLabelKey] : config[key];\n}\n"],"names":["INITIAL_DIMENSION","ChartContext","createContext","useChart","context","useContext","CSS_IDENT_UNSAFE","CSS_VALUE_UNSAFE","cssIdentifier","value","isSafeCssValue","ChartContainer","id","className","children","config","initialDimension","props","uniqueId","useId","chartId","jsxs","cx","styles","jsx","ChartStyle","RechartsPrimitive","colorConfig","itemConfig","safeId","declarationsFor","theme","key","color","_a","declaration","lightDeclarations","darkDeclarations","css","ChartTooltip","ChartTooltipContent","active","payload","indicator","hideLabel","hideIndicator","label","labelFormatter","labelClassName","formatter","nameKey","labelKey","tooltipLabel","useMemo","item","getPayloadConfigFromPayload","nestLabel","index","indicatorColor","Fragment","ChartLegend","ChartLegendContent","hideIcon","verticalAlign","getStringField","source","payloadPayload","configLabelKey"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDMA,KAAoB,EAAE,OAAO,KAAK,QAAQ,IAAA,GAmB1CC,IAAeC,EAAwC,IAAI;AAEjE,SAASC,IAAW;AAClB,QAAMC,IAAUC,EAAWJ,CAAY;AAEvC,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,mDAAmD;AAGrE,SAAOA;AACT;AAwBA,MAAME,KAAmB,mBAKnBC,KAAmB;AAEzB,SAASC,EAAcC,GAAuB;AAC5C,SAAOA,EAAM,QAAQH,IAAkB,GAAG;AAC5C;AAEA,SAASI,GAAeD,GAAwB;AAC9C,SAAO,CAACF,GAAiB,KAAKE,CAAK;AACrC;AAEO,SAASE,GAAe;AAAA,EAC7B,IAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,kBAAAC,IAAmBhB;AAAA,EACnB,GAAGiB;AACL,GAAwB;AACtB,QAAMC,IAAWC,EAAA,GAIXC,IAAUZ,EAAc,SAASI,KAAMM,CAAQ,EAAE;AAEvD,2BACGjB,EAAa,UAAb,EAAsB,OAAO,EAAE,QAA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AA,CAAgB,IAEjB,gBAAAJ,EAAC,OAAA,EAAI,WAAWD,EAAO,cAAc,OAAO,EAAE,iBAAiB+B,EAAK,SAAS;AAAA,UAE9E1B,KAAA,gBAAAA,EAAY;AAAA,QAAA,EAAA,GANL6B,CAOV;AAAA,MAEJ,CAAC;AAAA,IAAA;AAAA,EAAA,IA3BE;AA8BX;AAMA,SAASO,EAAeC,GAAgBjC,GAAiC;AACvE,MAAI,EAAEA,KAAOiC;AACX;AAEF,QAAMxD,IAASwD,EAAmCjC,CAAG;AACrD,SAAO,OAAOvB,KAAU,WAAWA,IAAQ;AAC7C;AAEA,SAAS8C,EACPxC,GACA2B,GACAV,GACiC;AACjC,MAAI,OAAOU,KAAY,YAAYA,MAAY;AAC7C;AAGF,QAAMwB,IACJ,aAAaxB,KAAW,OAAOA,EAAQ,WAAY,YAAYA,EAAQ,YAAY,OAC/EA,EAAQ,UACR,QAEAyB,IACJH,EAAetB,GAASV,CAAG,MAAMkC,KAAkBF,EAAeE,GAAgBlC,CAAG,MAAMA;AAE7F,SAAOmC,KAAkBpD,IAASA,EAAOoD,CAAc,IAAIpD,EAAOiB,CAAG;AACvE;"}
|
|
1
|
+
{"version":3,"file":"chart.js","sources":["../src/components/chart/chart.tsx"],"sourcesContent":["'use client';\n\n/*\n * Upstream (apps/v4/registry/bases/base/ui/chart.tsx) wraps Recharts:\n * ChartContainer supplies the ResponsiveContainer plus a per-instance\n * runtime `<style>` tag (ChartStyle) that turns each `ChartConfig` entry\n * into a `--color-<key>` custom property scoped to that one chart instance\n * via a `data-chart` id — the hook a consumer's own Bar/Line/Area elements\n * read from (`fill=\"var(--color-desktop)\"`) to pick up branded series\n * colors without prop-drilling them through Recharts' own API. `data-chart`\n * is that scoping id, not this kit's usual `data-slot` marker — there is no\n * `data-slot` here by design, same as every other ported part.\n *\n * Two deliberate deviations from upstream, both forced by this kit's own\n * constraints rather than a style preference — see chart.md's \"Porting\n * notes\" for the consumer-facing summary:\n *\n * 1. THEMES / dark selector — upstream keys the per-theme color map by\n * `{ light: \"\", dark: \".dark\" }`, a literal Tailwind dark-mode class\n * selector. This kit has no such class (see theme.css's header): dark\n * mode is `[data-theme='dark']` plus a `prefers-color-scheme` fallback\n * guarded by `:not([data-theme='light'])`. ChartStyle below emits BOTH\n * selectors for the dark entry instead of one, mirroring theme.css's own\n * dual mechanism. The public `ChartConfig['theme']` keys stay exactly\n * `light`/`dark` regardless — that part is upstream's real API, not the\n * selector text it happens to compile to.\n * 2. No `--chart-1`..`--chart-5` palette — those tokens don't exist in\n * theme.css (frozen for this port) and were deliberately not added.\n * A consumer supplies every series color through `ChartConfig` itself\n * (`color` or `theme`) — upstream's real, load-bearing API regardless;\n * shadcn's own docs setting `--chart-1` etc. is just ONE value for that\n * same `color` field, not a requirement of the mechanism.\n */\n\nimport {\n type ComponentProps,\n type ComponentType,\n type ReactNode,\n createContext,\n useContext,\n useId,\n useMemo,\n} from 'react';\nimport { cx } from 'class-variance-authority';\nimport * as RechartsPrimitive from 'recharts';\nimport type { DefaultLegendContentProps, DefaultTooltipContentProps, TooltipValueType } from 'recharts';\n\nimport styles from './chart.module.css';\n\n// Matches Recharts' own default (used when a chart mounts with no measured\n// size yet) being {-1,-1} — upstream overrides it to a real, positive size\n// so ChartContainer's children render immediately instead of waiting for a\n// ResizeObserver entry that jsdom (and a slow first paint) may delay.\nconst INITIAL_DIMENSION = { width: 320, height: 200 } as const;\n\ntype TooltipNameType = number | string;\n\nexport type ChartConfig = Record<\n string,\n {\n label?: ReactNode;\n icon?: ComponentType;\n } & (\n | { color?: string; theme?: never }\n | { color?: never; theme: Record<'light' | 'dark', string> }\n )\n>;\n\ninterface ChartContextValue {\n config: ChartConfig;\n}\n\nconst ChartContext = createContext<ChartContextValue | null>(null);\n\nfunction useChart() {\n const context = useContext(ChartContext);\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />');\n }\n\n return context;\n}\n\nexport type ChartContainerProps = Omit<ComponentProps<'div'>, 'className' | 'children'> & {\n className?: string;\n config: ChartConfig;\n children: ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];\n initialDimension?: { width: number; height: number };\n};\n\n/*\n * Everything ChartStyle interpolates into its <style> tag is\n * consumer-supplied — the chart's `id`, every `ChartConfig` key, every\n * colour string — and React does not parse or validate CSS syntax within\n * it, whether the string reaches the tag as JSX children or via\n * `dangerouslySetInnerHTML`. An id of `x] { } body { display: none` would\n * end the selector and start a rule of its own; a colour of `red; } body {\n * … }` does the same one line down; either could carry a literal\n * `</style>` and try to leave CSS altogether. So the two shapes that reach\n * the stylesheet are constrained rather than trusted: identifiers are\n * reduced to a character set that cannot express any of those, and colour\n * VALUES (which have no such small alphabet — they run from `red` to\n * `color-mix(in oklab, …)`) are checked for the characters that would let\n * one escape its own declaration, and dropped whole if they carry any.\n */\nconst CSS_IDENT_UNSAFE = /[^a-zA-Z0-9_-]/g;\n\n// Anything that could close a declaration, a rule, a comment, or the\n// <style> element itself. Backslash is in the list because a CSS escape\n// sequence is another way to spell any of them.\nconst CSS_VALUE_UNSAFE = /[;{}<>\\\\]|\\/\\*|\\*\\//;\n\nfunction cssIdentifier(value: string): string {\n return value.replace(CSS_IDENT_UNSAFE, '_');\n}\n\nfunction isSafeCssValue(value: string): boolean {\n return !CSS_VALUE_UNSAFE.test(value);\n}\n\nexport function ChartContainer({\n id,\n className,\n children,\n config,\n initialDimension = INITIAL_DIMENSION,\n ...props\n}: ChartContainerProps) {\n const uniqueId = useId();\n // Normalized here, not just inside ChartStyle: the same string has to\n // land in the `data-chart` attribute and in the selector that targets\n // it, so they must be normalized by the same rule or they stop matching.\n const chartId = cssIdentifier(`chart-${id ?? uniqueId}`);\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div data-chart={chartId} className={cx(styles.container, className)} {...props}>\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer initialDimension={initialDimension}>\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n}\n\nexport interface ChartStyleProps {\n id: string;\n config: ChartConfig;\n}\n\n// Exported standalone (matching upstream) for a consumer building their own\n// chart shell without ChartContainer's div/ResponsiveContainer wrapper, who\n// still wants the same per-instance `--color-*` custom-property injection.\nexport function ChartStyle({ id, config }: ChartStyleProps) {\n const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme ?? itemConfig.color);\n\n if (!colorConfig.length) {\n return null;\n }\n\n const safeId = cssIdentifier(id);\n\n const declarationsFor = (theme: 'light' | 'dark') =>\n colorConfig\n .map(([key, itemConfig]) => {\n const color = itemConfig.theme?.[theme] ?? itemConfig.color;\n // A rejected colour drops its whole declaration rather than\n // emitting a broken one: the series then paints in Recharts' own\n // default instead of taking the rest of the stylesheet with it.\n if (!color || !isSafeCssValue(color)) {\n return null;\n }\n return ` --color-${cssIdentifier(key)}: ${color};`;\n })\n .filter((declaration): declaration is string => declaration !== null)\n .join('\\n');\n\n const lightDeclarations = declarationsFor('light');\n const darkDeclarations = declarationsFor('dark');\n\n // See the file header's point 1: two dark blocks (an explicit attribute\n // selector plus a prefers-color-scheme fallback) instead of upstream's\n // single `.dark` class, mirroring theme.css's own dual mechanism. The\n // light block carries no selector prefix, same as upstream's `THEMES.light\n // === \"\"` — it is the unconditional default every chart instance starts\n // from, which the dark blocks below layer on top of.\n const css = `\n[data-chart='${safeId}'] {\n${lightDeclarations}\n}\n\n[data-theme='dark'] [data-chart='${safeId}'] {\n${darkDeclarations}\n}\n\n@media (prefers-color-scheme: dark) {\n :root:not([data-theme='light']) [data-chart='${safeId}'] {\n${darkDeclarations}\n }\n}\n`;\n\n // Per-instance, consumer-supplied colors have no other way to reach a\n // scoped CSS custom property — there is no static class this kit's build\n // could hash for an arbitrary runtime string. Passing `css` as the\n // `<style>` element's JSX children — rather than through\n // `dangerouslySetInnerHTML` — gets it React 19's own `</style`-escaping on\n // the server (so a value containing a literal `</style><script>…` cannot\n // break out of the tag in SSR output) and, on the client, lands it as a\n // single inert Text node that is never parsed as markup. Either way it\n // cannot execute as script. `isSafeCssValue`/`cssIdentifier` above still\n // matter here even though they're no longer the primary XSS defense: they\n // keep `<`/`>` out of the string entirely, which is what keeps server and\n // client output identical (a raw `</style` would escape only on the\n // server, producing a hydration mismatch).\n return <style>{css}</style>;\n}\n\nexport const ChartTooltip = RechartsPrimitive.Tooltip;\n\nexport type ChartTooltipContentProps = ComponentProps<typeof RechartsPrimitive.Tooltip> &\n Omit<ComponentProps<'div'>, 'className'> & {\n className?: string;\n hideLabel?: boolean;\n hideIndicator?: boolean;\n indicator?: 'line' | 'dot' | 'dashed';\n nameKey?: string;\n labelKey?: string;\n } & Omit<DefaultTooltipContentProps<TooltipValueType, TooltipNameType>, 'accessibilityLayer'>;\n\nexport function ChartTooltipContent({\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n}: ChartTooltipContentProps) {\n const { config } = useChart();\n\n const tooltipLabel = useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null;\n }\n\n const [item] = payload;\n const key = `${labelKey ?? item?.dataKey ?? item?.name ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const value =\n !labelKey && typeof label === 'string' ? (config[label]?.label ?? label) : itemConfig?.label;\n\n if (labelFormatter) {\n return <div className={cx(styles.tooltipLabel, labelClassName)}>{labelFormatter(value, payload)}</div>;\n }\n\n if (!value) {\n return null;\n }\n\n return <div className={cx(styles.tooltipLabel, labelClassName)}>{value}</div>;\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot';\n\n return (\n <div className={cx(styles.tooltipContent, className)}>\n {!nestLabel ? tooltipLabel : null}\n <div className={styles.tooltipItems}>\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey ?? item.name ?? item.dataKey ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const indicatorColor = color ?? item.payload?.fill ?? item.color;\n\n return (\n <div\n key={index}\n className={cx(styles.tooltipItem, indicator === 'dot' && styles.tooltipItemCentered)}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cx(\n styles.indicator,\n indicator === 'dot' && styles.indicatorDot,\n indicator === 'line' && styles.indicatorLine,\n indicator === 'dashed' && styles.indicatorDashed,\n indicator === 'dashed' && nestLabel && styles.indicatorNested,\n )}\n // Two paint targets, not one custom-property pair like\n // upstream's Tailwind `bg-(--color-bg)`/`border-(--color-border)`\n // arbitrary-value classes: dot/line indicators are filled\n // swatches (background only — chart.module.css's `.indicator`\n // sets no border), the dashed indicator is a hollow\n // dashed-border swatch (border only — `.indicatorDashed`\n // keeps its own background transparent). Setting both\n // properties unconditionally, like upstream does via two\n // always-present custom properties, would depend on which\n // Tailwind utility wins the cascade for the dashed case;\n // branching here is unambiguous.\n style={\n indicator === 'dashed'\n ? { borderColor: indicatorColor }\n : { backgroundColor: indicatorColor }\n }\n />\n )\n )}\n <div\n className={cx(\n styles.tooltipItemBody,\n nestLabel ? styles.tooltipItemBodyNested : styles.tooltipItemBodyInline,\n )}\n >\n <div className={styles.tooltipItemLabelGroup}>\n {nestLabel ? tooltipLabel : null}\n <span className={styles.tooltipItemName}>{itemConfig?.label ?? item.name}</span>\n </div>\n {item.value != null && (\n <span className={styles.tooltipItemValue}>\n {typeof item.value === 'number' ? item.value.toLocaleString() : String(item.value)}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n\nexport const ChartLegend = RechartsPrimitive.Legend;\n\nexport type ChartLegendContentProps = Omit<ComponentProps<'div'>, 'className'> & {\n className?: string;\n hideIcon?: boolean;\n nameKey?: string;\n} & DefaultLegendContentProps;\n\nexport function ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = 'bottom',\n nameKey,\n}: ChartLegendContentProps) {\n const { config } = useChart();\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div\n className={cx(\n styles.legendContent,\n verticalAlign === 'top' ? styles.legendTop : styles.legendBottom,\n className,\n )}\n >\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey ?? item.dataKey ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n return (\n <div key={index} className={styles.legendItem}>\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div className={styles.legendSwatch} style={{ backgroundColor: item.color }} />\n )}\n {itemConfig?.label}\n </div>\n );\n })}\n </div>\n );\n}\n\n// Guarded, single-purpose replacement for upstream's two inline\n// `payload[key as keyof typeof payload] as string` assertions: `in` proves\n// the property exists at runtime, this narrows the read value itself\n// instead of asserting the container's shape.\nfunction getStringField(source: object, key: string): string | undefined {\n if (!(key in source)) {\n return undefined;\n }\n const value = (source as Record<string, unknown>)[key];\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction getPayloadConfigFromPayload(\n config: ChartConfig,\n payload: unknown,\n key: string,\n): ChartConfig[string] | undefined {\n if (typeof payload !== 'object' || payload === null) {\n return undefined;\n }\n\n const payloadPayload =\n 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null\n ? payload.payload\n : undefined;\n\n const configLabelKey =\n getStringField(payload, key) ?? (payloadPayload && getStringField(payloadPayload, key)) ?? key;\n\n return configLabelKey in config ? config[configLabelKey] : config[key];\n}\n"],"names":["INITIAL_DIMENSION","ChartContext","createContext","useChart","context","useContext","CSS_IDENT_UNSAFE","CSS_VALUE_UNSAFE","cssIdentifier","value","isSafeCssValue","ChartContainer","id","className","children","config","initialDimension","props","uniqueId","useId","chartId","jsxs","cx","styles","jsx","ChartStyle","RechartsPrimitive","colorConfig","itemConfig","safeId","declarationsFor","theme","key","color","_a","declaration","lightDeclarations","darkDeclarations","css","ChartTooltip","ChartTooltipContent","active","payload","indicator","hideLabel","hideIndicator","label","labelFormatter","labelClassName","formatter","nameKey","labelKey","tooltipLabel","useMemo","item","getPayloadConfigFromPayload","nestLabel","index","indicatorColor","Fragment","ChartLegend","ChartLegendContent","hideIcon","verticalAlign","getStringField","source","payloadPayload","configLabelKey"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDMA,KAAoB,EAAE,OAAO,KAAK,QAAQ,IAAA,GAmB1CC,IAAeC,EAAwC,IAAI;AAEjE,SAASC,IAAW;AAClB,QAAMC,IAAUC,EAAWJ,CAAY;AAEvC,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,mDAAmD;AAGrE,SAAOA;AACT;AAwBA,MAAME,KAAmB,mBAKnBC,KAAmB;AAEzB,SAASC,EAAcC,GAAuB;AAC5C,SAAOA,EAAM,QAAQH,IAAkB,GAAG;AAC5C;AAEA,SAASI,GAAeD,GAAwB;AAC9C,SAAO,CAACF,GAAiB,KAAKE,CAAK;AACrC;AAEO,SAASE,GAAe;AAAA,EAC7B,IAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,kBAAAC,IAAmBhB;AAAA,EACnB,GAAGiB;AACL,GAAwB;AACtB,QAAMC,IAAWC,EAAA,GAIXC,IAAUZ,EAAc,SAASI,KAAMM,CAAQ,EAAE;AAEvD,2BACGjB,EAAa,UAAb,EAAsB,OAAO,EAAE,QAAAc,KAC9B,UAAA,gBAAAM,EAAC,SAAI,cAAYD,GAAS,WAAWE,EAAGC,EAAO,WAAWV,CAAS,GAAI,GAAGI,GACxE,UAAA;AAAA,IAAA,gBAAAO,EAACC,IAAA,EAAW,IAAIL,GAAS,QAAAL,EAAA,CAAgB;AAAA,IACzC,gBAAAS,EAACE,EAAkB,qBAAlB,EAAsC,kBAAAV,GACpC,UAAAF,EAAA,CACH;AAAA,EAAA,EAAA,CACF,EAAA,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AAEF,QAAMxD,IAASwD,EAAmCjC,CAAG;AACrD,SAAO,OAAOvB,KAAU,WAAWA,IAAQ;AAC7C;AAEA,SAAS8C,EACPxC,GACA2B,GACAV,GACiC;AACjC,MAAI,OAAOU,KAAY,YAAYA,MAAY;AAC7C;AAGF,QAAMwB,IACJ,aAAaxB,KAAW,OAAOA,EAAQ,WAAY,YAAYA,EAAQ,YAAY,OAC/EA,EAAQ,UACR,QAEAyB,IACJH,EAAetB,GAASV,CAAG,MAAMkC,KAAkBF,EAAeE,GAAgBlC,CAAG,MAAMA;AAE7F,SAAOmC,KAAkBpD,IAASA,EAAOoD,CAAc,IAAIpD,EAAOiB,CAAG;AACvE;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._wrapper_1yxg6_12{position:relative;display:inline-flex;align-items:center}._wrapper_1yxg6_12[data-disabled]{opacity:.42}._select_1yxg6_45{box-sizing:border-box;display:flex;width:100%;align-items:center;height:var(--control-height-lg);padding:0 var(--space-8) 0 var(--space-3);border:var(--border-width) solid var(--input);border-radius:var(--radius-md);background-color:var(--surface-elevated);color:var(--foreground);font-family:inherit;font-size:var(--text-label-size);line-height:var(--text-label-line-height);font-weight:var(--text-body-weight);letter-spacing:var(--text-label-tracking);-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;outline:none;transition:color .15s ease,border-color .15s ease,box-shadow .15s ease}._select_1yxg6_45:disabled{cursor:not-allowed}._select_1yxg6_45:focus-visible{border-color:var(--ring);box-shadow:inset 0 0 0 var(--ring-inset) var(--ring)}@media(forced-colors:active){._select_1yxg6_45:focus-visible{outline:2px solid Highlight;outline-offset:2px}}._sizeSm_1yxg6_102 ._select_1yxg6_45{height:var(--control-height-sm);font-size:var(--text-meta-size);line-height:var(--text-meta-line-height);letter-spacing:var(--text-meta-tracking)}._option_1yxg6_119,._optgroup_1yxg6_130{background-color:Canvas;color:CanvasText}._icon_1yxg6_135{position:absolute;inset-inline-end:var(--space-3);width:var(--icon-size-sm);height:var(--icon-size-sm);pointer-events:none}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../../src/components/attachment/attachment.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAiC/D,QAAA,MAAM,kBAAkB;;;8EAgBtB,CAAC;AAEH,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,kBAAkB,CAAC;IACrG;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,YAAY,GAAG,OAAO,GAAG,MAAM,CAAC;CAChE;AAED,qCAAqC;AACrC,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,KAAc,EACd,IAAgB,EAChB,WAA0B,EAC1B,GAAG,KAAK,EACT,EAAE,eAAe,+BAYjB;AAED,QAAA,MAAM,uBAAuB;;8EAU3B,CAAC;AAEH,MAAM,WAAW,oBACf,SAAQ,cAAc,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,uBAAuB,CAAC;CAAG;AAEhF;;yBAEyB;AACzB,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../../src/components/attachment/attachment.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,qBAAq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AEpD,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,GAAG;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,yBAAyB,CAAC;AAE9B,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,QAAgB,EAChB,OAAO,EACP,aAAwB,EACxB,OAAO,GACR,EAAE,uBAAuB,sCAkCzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marker.d.ts","sourceRoot":"","sources":["../../../src/components/marker/marker.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAqB5C,QAAA,MAAM,cAAc;;8EAWlB,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,cAAc,CAAC;CAAG;AAE5G,wBAAgB,MAAM,CAAC,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"marker.d.ts","sourceRoot":"","sources":["../../../src/components/marker/marker.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAqB5C,QAAA,MAAM,cAAc;;8EAWlB,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,cAAc,CAAC;CAAG;AAE5G,wBAAgB,MAAM,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,8FAsB3E;AAED,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AAErD;;oCAEoC;AACpC,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,+BAElE;AAED,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AAExD,iCAAiC;AACjC,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,+BAExE"}
|
package/dist/docs/chart.md
CHANGED
|
@@ -127,6 +127,14 @@ plain colour syntax and neither rule is noticeable. If you render
|
|
|
127
127
|
normalized id on your own `data-chart` attribute or the selector will not
|
|
128
128
|
match it.
|
|
129
129
|
|
|
130
|
+
`ChartStyle` renders its per-instance CSS as the `<style>` element's JSX
|
|
131
|
+
children (`<style>{css}</style>`) rather than through
|
|
132
|
+
`dangerouslySetInnerHTML`, which is what upstream and most React chart
|
|
133
|
+
implementations use. Children get React's own server-side `</style`
|
|
134
|
+
escaping (so the string can't break out of the tag in SSR output) and are
|
|
135
|
+
rendered client-side as an inert Text node — a stronger guarantee than
|
|
136
|
+
`dangerouslySetInnerHTML` offers, for the same runtime-built string.
|
|
137
|
+
|
|
130
138
|
## Examples
|
|
131
139
|
|
|
132
140
|
```tsx
|
package/dist/marker.js
CHANGED
|
@@ -1,52 +1,53 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { mergeProps as
|
|
4
|
-
import { useRender as
|
|
5
|
-
import { cx as
|
|
6
|
-
import './chunks/marker.DDxI_rZn.css';const
|
|
7
|
-
marker:
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { mergeProps as m } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender as c } from "@base-ui/react/use-render";
|
|
5
|
+
import { cx as o, cva as d } from "class-variance-authority";
|
|
6
|
+
import './chunks/marker.DDxI_rZn.css';const v = "_marker_1dbba_11", u = "_variantDefault_1dbba_48", _ = "_variantBorder_1dbba_53", f = "_variantSeparator_1dbba_61", k = "_markerIcon_1dbba_78", l = "_markerContent_1dbba_91", a = {
|
|
7
|
+
marker: v,
|
|
8
8
|
variantDefault: u,
|
|
9
9
|
variantBorder: _,
|
|
10
|
-
variantSeparator:
|
|
11
|
-
markerIcon:
|
|
12
|
-
markerContent:
|
|
13
|
-
}, p =
|
|
10
|
+
variantSeparator: f,
|
|
11
|
+
markerIcon: k,
|
|
12
|
+
markerContent: l
|
|
13
|
+
}, p = d(a.marker, {
|
|
14
14
|
variants: {
|
|
15
15
|
variant: {
|
|
16
|
-
default:
|
|
17
|
-
separator:
|
|
18
|
-
border:
|
|
16
|
+
default: a.variantDefault,
|
|
17
|
+
separator: a.variantSeparator,
|
|
18
|
+
border: a.variantBorder
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
defaultVariants: {
|
|
22
22
|
variant: "default"
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
function
|
|
26
|
-
|
|
25
|
+
function D({ className: r, variant: t, render: i, ...s }) {
|
|
26
|
+
const e = t ?? "default";
|
|
27
|
+
return c({
|
|
27
28
|
defaultTagName: "div",
|
|
28
|
-
render:
|
|
29
|
+
render: i,
|
|
29
30
|
// `data-variant` is layered on AFTER mergeProps, not passed through it:
|
|
30
31
|
// mergeProps types its own object literal as the closed DOM attribute
|
|
31
32
|
// set for the tag, which rejects a `data-*` key — the same
|
|
32
33
|
// shadow-proofing needed anywhere a `data-*` prop must survive
|
|
33
34
|
// mergeProps.
|
|
34
35
|
props: {
|
|
35
|
-
...
|
|
36
|
-
"data-variant":
|
|
36
|
+
...m({ className: p({ variant: e, className: r }) }, s),
|
|
37
|
+
"data-variant": e
|
|
37
38
|
}
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
return /* @__PURE__ */
|
|
41
|
+
function N({ className: r, ...t }) {
|
|
42
|
+
return /* @__PURE__ */ n("span", { "aria-hidden": "true", className: o(a.markerIcon, r), ...t });
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
-
return /* @__PURE__ */
|
|
44
|
+
function S({ className: r, ...t }) {
|
|
45
|
+
return /* @__PURE__ */ n("span", { className: o(a.markerContent, r), ...t });
|
|
45
46
|
}
|
|
46
47
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
D as Marker,
|
|
49
|
+
S as MarkerContent,
|
|
50
|
+
N as MarkerIcon,
|
|
50
51
|
p as markerVariants
|
|
51
52
|
};
|
|
52
53
|
//# sourceMappingURL=marker.js.map
|
package/dist/marker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marker.js","sources":["../src/components/marker/marker.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { useRender } from '@base-ui/react/use-render';\nimport { cva, cx, type VariantProps } from 'class-variance-authority';\nimport type { ComponentProps } from 'react';\n\nimport styles from './marker.module.css';\n\n/*\n * A faithful port of shadcn/ui's base Marker\n * (registry/bases/base/ui/marker.tsx): an inline conversation marker for\n * status updates, system notes, bordered rows, and labeled separators.\n * Marker has no Base UI primitive, but gets `render`-prop polymorphism\n * from `useRender`/`mergeProps` — the same utilities Base UI's own\n * primitives are built on, and the same pattern Badge uses — for turning a\n * marker into a link or button.\n *\n * Pairs with the `shimmer` utility (src/styles/utilities.css, this\n * package's global CSS alongside theme.css — see that file's own header)\n * for a streaming-text effect: add the `shimmer` class to `MarkerContent`\n * directly, same as upstream (see marker.md's \"Shimmer\" section). Marker\n * does not apply it automatically — unlike Attachment's title\n * (attachment.tsx), which reacts to an upload `state` axis Marker has no\n * equivalent of.\n */\nconst markerVariants = cva(styles.marker, {\n variants: {\n variant: {\n default: styles.variantDefault,\n separator: styles.variantSeparator,\n border: styles.variantBorder,\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\nexport interface MarkerProps extends useRender.ComponentProps<'div'>, VariantProps<typeof markerVariants> {}\n\nexport function Marker({ className, variant
|
|
1
|
+
{"version":3,"file":"marker.js","sources":["../src/components/marker/marker.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { useRender } from '@base-ui/react/use-render';\nimport { cva, cx, type VariantProps } from 'class-variance-authority';\nimport type { ComponentProps } from 'react';\n\nimport styles from './marker.module.css';\n\n/*\n * A faithful port of shadcn/ui's base Marker\n * (registry/bases/base/ui/marker.tsx): an inline conversation marker for\n * status updates, system notes, bordered rows, and labeled separators.\n * Marker has no Base UI primitive, but gets `render`-prop polymorphism\n * from `useRender`/`mergeProps` — the same utilities Base UI's own\n * primitives are built on, and the same pattern Badge uses — for turning a\n * marker into a link or button.\n *\n * Pairs with the `shimmer` utility (src/styles/utilities.css, this\n * package's global CSS alongside theme.css — see that file's own header)\n * for a streaming-text effect: add the `shimmer` class to `MarkerContent`\n * directly, same as upstream (see marker.md's \"Shimmer\" section). Marker\n * does not apply it automatically — unlike Attachment's title\n * (attachment.tsx), which reacts to an upload `state` axis Marker has no\n * equivalent of.\n */\nconst markerVariants = cva(styles.marker, {\n variants: {\n variant: {\n default: styles.variantDefault,\n separator: styles.variantSeparator,\n border: styles.variantBorder,\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\nexport interface MarkerProps extends useRender.ComponentProps<'div'>, VariantProps<typeof markerVariants> {}\n\nexport function Marker({ className, variant, render, ...props }: MarkerProps) {\n // cva's own VariantProps types this `| null` (a consumer can pass\n // `variant={null}` to explicitly reset to the default), which a default\n // parameter value alone doesn't absorb — only `undefined` does. cva reads\n // that null as \"emit no variant class at all\" while `data-variant` would\n // still be dropped by React, so the marker would come out with neither the\n // default class nor the attribute. Resolved once here, same as item.tsx,\n // so class and attribute always agree.\n const resolvedVariant = variant ?? 'default';\n return useRender({\n defaultTagName: 'div',\n render,\n // `data-variant` is layered on AFTER mergeProps, not passed through it:\n // mergeProps types its own object literal as the closed DOM attribute\n // set for the tag, which rejects a `data-*` key — the same\n // shadow-proofing needed anywhere a `data-*` prop must survive\n // mergeProps.\n props: {\n ...mergeProps<'div'>({ className: markerVariants({ variant: resolvedVariant, className }) }, props),\n 'data-variant': resolvedVariant,\n },\n });\n}\n\nexport { markerVariants };\n\nexport type MarkerIconProps = ComponentProps<'span'>;\n\n/** A decorative icon slot, hidden from assistive tech. For an icon-only\n * marker, give `Marker` itself an `aria-label` or visible text — an\n * icon alone announces as empty. */\nexport function MarkerIcon({ className, ...props }: MarkerIconProps) {\n return <span aria-hidden=\"true\" className={cx(styles.markerIcon, className)} {...props} />;\n}\n\nexport type MarkerContentProps = ComponentProps<'span'>;\n\n/** The marker's text content. */\nexport function MarkerContent({ className, ...props }: MarkerContentProps) {\n return <span className={cx(styles.markerContent, className)} {...props} />;\n}\n"],"names":["markerVariants","cva","styles","Marker","className","variant","render","props","resolvedVariant","useRender","mergeProps","MarkerIcon","jsx","cx","MarkerContent"],"mappings":";;;;;;;;;;;;GA0BMA,IAAiBC,EAAIC,EAAO,QAAQ;AAAA,EACxC,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAASA,EAAO;AAAA,MAChB,WAAWA,EAAO;AAAA,MAClB,QAAQA,EAAO;AAAA,IAAA;AAAA,EACjB;AAAA,EAEF,iBAAiB;AAAA,IACf,SAAS;AAAA,EAAA;AAEb,CAAC;AAIM,SAASC,EAAO,EAAE,WAAAC,GAAW,SAAAC,GAAS,QAAAC,GAAQ,GAAGC,KAAsB;AAQ5E,QAAMC,IAAkBH,KAAW;AACnC,SAAOI,EAAU;AAAA,IACf,gBAAgB;AAAA,IAChB,QAAAH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,OAAO;AAAA,MACL,GAAGI,EAAkB,EAAE,WAAWV,EAAe,EAAE,SAASQ,GAAiB,WAAAJ,EAAA,CAAW,EAAA,GAAKG,CAAK;AAAA,MAClG,gBAAgBC;AAAA,IAAA;AAAA,EAClB,CACD;AACH;AASO,SAASG,EAAW,EAAE,WAAAP,GAAW,GAAGG,KAA0B;AACnE,SAAO,gBAAAK,EAAC,QAAA,EAAK,eAAY,QAAO,WAAWC,EAAGX,EAAO,YAAYE,CAAS,GAAI,GAAGG,EAAA,CAAO;AAC1F;AAKO,SAASO,EAAc,EAAE,WAAAV,GAAW,GAAGG,KAA6B;AACzE,SAAO,gBAAAK,EAAC,UAAK,WAAWC,EAAGX,EAAO,eAAeE,CAAS,GAAI,GAAGG,GAAO;AAC1E;"}
|
package/dist/native-select.js
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
import { jsxs as r, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { cx as
|
|
3
|
-
import { ChevronDownIcon as
|
|
4
|
-
import './chunks/native-select.
|
|
2
|
+
import { cx as c } from "class-variance-authority";
|
|
3
|
+
import { ChevronDownIcon as i } from "lucide-react";
|
|
4
|
+
import './chunks/native-select.DF1QrNz4.css';const a = "_wrapper_1yxg6_12", _ = "_select_1yxg6_45", l = "_sizeSm_1yxg6_102", m = "_option_1yxg6_119", u = "_optgroup_1yxg6_130", g = "_icon_1yxg6_135", o = {
|
|
5
5
|
wrapper: a,
|
|
6
|
-
select:
|
|
7
|
-
sizeSm:
|
|
8
|
-
option:
|
|
9
|
-
|
|
6
|
+
select: _,
|
|
7
|
+
sizeSm: l,
|
|
8
|
+
option: m,
|
|
9
|
+
optgroup: u,
|
|
10
|
+
icon: g
|
|
10
11
|
};
|
|
11
|
-
function
|
|
12
|
+
function y({ className: t, size: e = "default", disabled: n, ...p }) {
|
|
12
13
|
return /* @__PURE__ */ r(
|
|
13
14
|
"div",
|
|
14
15
|
{
|
|
15
|
-
className:
|
|
16
|
-
"data-disabled":
|
|
16
|
+
className: c(o.wrapper, e === "sm" && o.sizeSm, t),
|
|
17
|
+
"data-disabled": n || void 0,
|
|
17
18
|
children: [
|
|
18
19
|
/* @__PURE__ */ s(
|
|
19
20
|
"select",
|
|
20
21
|
{
|
|
21
|
-
className:
|
|
22
|
-
disabled:
|
|
23
|
-
...
|
|
22
|
+
className: o.select,
|
|
23
|
+
disabled: n,
|
|
24
|
+
...p
|
|
24
25
|
}
|
|
25
26
|
),
|
|
26
|
-
/* @__PURE__ */ s(
|
|
27
|
+
/* @__PURE__ */ s(i, { className: o.icon })
|
|
27
28
|
]
|
|
28
29
|
}
|
|
29
30
|
);
|
|
30
31
|
}
|
|
31
|
-
function S({ className:
|
|
32
|
-
return /* @__PURE__ */ s("option", { className:
|
|
32
|
+
function S({ className: t, ...e }) {
|
|
33
|
+
return /* @__PURE__ */ s("option", { className: c(o.option, t), ...e });
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
return /* @__PURE__ */ s("optgroup", { className:
|
|
35
|
+
function v({ className: t, ...e }) {
|
|
36
|
+
return /* @__PURE__ */ s("optgroup", { className: c(o.optgroup, t), ...e });
|
|
36
37
|
}
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
y as NativeSelect,
|
|
40
|
+
v as NativeSelectOptGroup,
|
|
40
41
|
S as NativeSelectOption
|
|
41
42
|
};
|
|
42
43
|
//# sourceMappingURL=native-select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-select.js","sources":["../src/components/native-select/native-select.tsx"],"sourcesContent":["import { cx } from 'class-variance-authority';\nimport { ChevronDownIcon } from 'lucide-react';\nimport type { ComponentProps } from 'react';\n\nimport styles from './native-select.module.css';\n\n/*\n * NativeSelect wraps a real <select> — the source-of-truth control\n * (Base UI ships no NativeSelect primitive; this is the same \"pure styling\n * translation over native markup\" shape as table.tsx, not a Base UI\n * wrapper). The wrapper div exists only because a <select> is a replaced\n * element with no ::before/::after to draw a chevron into — same reasoning\n * as Input's icon/end slots (input.tsx), forced here unconditionally since\n * a select without its dropdown indicator reads as broken, not as a valid\n * \"no slot\" state the way an unslotted Input does.\n */\nexport interface NativeSelectProps extends Omit<ComponentProps<'select'>, 'className' | 'size'> {\n className?: string;\n /** Matches the kit's two-step control scale used elsewhere for compact\n * chrome (Table's `density`, Select's `size`) — `lg` is not offered here,\n * mirroring upstream's own sm/default axis. */\n size?: 'sm' | 'default';\n}\n\nexport function NativeSelect({ className, size = 'default', disabled, ...props }: NativeSelectProps) {\n return (\n <div\n className={cx(styles.wrapper, size === 'sm' && styles.sizeSm, className)}\n data-disabled={disabled || undefined}\n >\n <select\n className={styles.select}\n disabled={disabled}\n {...props}\n />\n <ChevronDownIcon className={styles.icon} />\n </div>\n );\n}\n\nexport type NativeSelectOptionProps = ComponentProps<'option'>;\n\nexport function NativeSelectOption({ className, ...props }: NativeSelectOptionProps) {\n return <option className={cx(styles.option, className)} {...props} />;\n}\n\nexport type NativeSelectOptGroupProps = ComponentProps<'optgroup'>;\n\nexport function NativeSelectOptGroup({ className, ...props }: NativeSelectOptGroupProps) {\n return <optgroup className={cx(styles.
|
|
1
|
+
{"version":3,"file":"native-select.js","sources":["../src/components/native-select/native-select.tsx"],"sourcesContent":["import { cx } from 'class-variance-authority';\nimport { ChevronDownIcon } from 'lucide-react';\nimport type { ComponentProps } from 'react';\n\nimport styles from './native-select.module.css';\n\n/*\n * NativeSelect wraps a real <select> — the source-of-truth control\n * (Base UI ships no NativeSelect primitive; this is the same \"pure styling\n * translation over native markup\" shape as table.tsx, not a Base UI\n * wrapper). The wrapper div exists only because a <select> is a replaced\n * element with no ::before/::after to draw a chevron into — same reasoning\n * as Input's icon/end slots (input.tsx), forced here unconditionally since\n * a select without its dropdown indicator reads as broken, not as a valid\n * \"no slot\" state the way an unslotted Input does.\n */\nexport interface NativeSelectProps extends Omit<ComponentProps<'select'>, 'className' | 'size'> {\n className?: string;\n /** Matches the kit's two-step control scale used elsewhere for compact\n * chrome (Table's `density`, Select's `size`) — `lg` is not offered here,\n * mirroring upstream's own sm/default axis. */\n size?: 'sm' | 'default';\n}\n\nexport function NativeSelect({ className, size = 'default', disabled, ...props }: NativeSelectProps) {\n return (\n <div\n className={cx(styles.wrapper, size === 'sm' && styles.sizeSm, className)}\n data-disabled={disabled || undefined}\n >\n <select\n className={styles.select}\n disabled={disabled}\n {...props}\n />\n <ChevronDownIcon className={styles.icon} />\n </div>\n );\n}\n\nexport type NativeSelectOptionProps = ComponentProps<'option'>;\n\nexport function NativeSelectOption({ className, ...props }: NativeSelectOptionProps) {\n return <option className={cx(styles.option, className)} {...props} />;\n}\n\nexport type NativeSelectOptGroupProps = ComponentProps<'optgroup'>;\n\nexport function NativeSelectOptGroup({ className, ...props }: NativeSelectOptGroupProps) {\n return <optgroup className={cx(styles.optgroup, className)} {...props} />;\n}\n"],"names":["NativeSelect","className","size","disabled","props","jsxs","cx","styles","jsx","ChevronDownIcon","NativeSelectOption","NativeSelectOptGroup"],"mappings":";;;;;;;;;;;AAwBO,SAASA,EAAa,EAAE,WAAAC,GAAW,MAAAC,IAAO,WAAW,UAAAC,GAAU,GAAGC,KAA4B;AACnG,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAGC,EAAO,SAASL,MAAS,QAAQK,EAAO,QAAQN,CAAS;AAAA,MACvE,iBAAeE,KAAY;AAAA,MAE3B,UAAA;AAAA,QAAA,gBAAAK;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD,EAAO;AAAA,YAClB,UAAAJ;AAAA,YACC,GAAGC;AAAA,UAAA;AAAA,QAAA;AAAA,QAEN,gBAAAI,EAACC,GAAA,EAAgB,WAAWF,EAAO,KAAA,CAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG/C;AAIO,SAASG,EAAmB,EAAE,WAAAT,GAAW,GAAGG,KAAkC;AACnF,SAAO,gBAAAI,EAAC,YAAO,WAAWF,EAAGC,EAAO,QAAQN,CAAS,GAAI,GAAGG,GAAO;AACrE;AAIO,SAASO,EAAqB,EAAE,WAAAV,GAAW,GAAGG,KAAoC;AACvF,SAAO,gBAAAI,EAAC,cAAS,WAAWF,EAAGC,EAAO,UAAUN,CAAS,GAAI,GAAGG,GAAO;AACzE;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gears-frontx/ui-kit",
|
|
3
|
-
"version": "0.4.0-alpha.
|
|
3
|
+
"version": "0.4.0-alpha.2",
|
|
4
4
|
"description": "Standard React component base for FrontX templates - Base UI behavior, CSS Modules styling on semantic tokens, CVA variants",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._wrapper_1vuz1_12{position:relative;display:inline-flex;align-items:center}._wrapper_1vuz1_12[data-disabled]{opacity:.42}._select_1vuz1_45{box-sizing:border-box;display:flex;width:100%;align-items:center;height:var(--control-height-lg);padding:0 var(--space-8) 0 var(--space-3);border:var(--border-width) solid var(--input);border-radius:var(--radius-md);background-color:var(--surface-elevated);color:var(--foreground);font-family:inherit;font-size:var(--text-label-size);line-height:var(--text-label-line-height);font-weight:var(--text-body-weight);letter-spacing:var(--text-label-tracking);-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;outline:none;transition:color .15s ease,border-color .15s ease,box-shadow .15s ease}._select_1vuz1_45:disabled{cursor:not-allowed}._select_1vuz1_45:focus-visible{border-color:var(--ring);box-shadow:inset 0 0 0 var(--ring-inset) var(--ring)}@media(forced-colors:active){._select_1vuz1_45:focus-visible{outline:2px solid Highlight;outline-offset:2px}}._sizeSm_1vuz1_102 ._select_1vuz1_45{height:var(--control-height-sm);font-size:var(--text-meta-size);line-height:var(--text-meta-line-height);letter-spacing:var(--text-meta-tracking)}._option_1vuz1_119{background-color:Canvas;color:CanvasText}._icon_1vuz1_124{position:absolute;inset-inline-end:var(--space-3);width:var(--icon-size-sm);height:var(--icon-size-sm);pointer-events:none}
|