@cytario/design 1.6.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +611 -58
- package/dist/index.js +2361 -32
- package/dist/index.js.map +1 -0
- package/package.json +10 -5
- package/src/tokens/variables-dark.css +148 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +0 -11
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts.map +0 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +0 -9
- package/dist/components/Breadcrumbs/index.d.ts +0 -3
- package/dist/components/Breadcrumbs/index.d.ts.map +0 -1
- package/dist/components/Breadcrumbs/index.js +0 -1
- package/dist/components/Button/Button.d.ts +0 -18
- package/dist/components/Button/Button.d.ts.map +0 -1
- package/dist/components/Button/Button.js +0 -51
- package/dist/components/Button/index.d.ts +0 -3
- package/dist/components/Button/index.d.ts.map +0 -1
- package/dist/components/Button/index.js +0 -1
- package/dist/components/ButtonLink/ButtonLink.d.ts +0 -35
- package/dist/components/ButtonLink/ButtonLink.d.ts.map +0 -1
- package/dist/components/ButtonLink/ButtonLink.js +0 -47
- package/dist/components/ButtonLink/index.d.ts +0 -3
- package/dist/components/ButtonLink/index.d.ts.map +0 -1
- package/dist/components/ButtonLink/index.js +0 -1
- package/dist/components/Checkbox/Checkbox.d.ts +0 -8
- package/dist/components/Checkbox/Checkbox.d.ts.map +0 -1
- package/dist/components/Checkbox/Checkbox.js +0 -19
- package/dist/components/Checkbox/index.d.ts +0 -3
- package/dist/components/Checkbox/index.d.ts.map +0 -1
- package/dist/components/Checkbox/index.js +0 -1
- package/dist/components/Dialog/Dialog.d.ts +0 -11
- package/dist/components/Dialog/Dialog.d.ts.map +0 -1
- package/dist/components/Dialog/Dialog.js +0 -31
- package/dist/components/Dialog/index.d.ts +0 -3
- package/dist/components/Dialog/index.d.ts.map +0 -1
- package/dist/components/Dialog/index.js +0 -1
- package/dist/components/EmptyState/EmptyState.d.ts +0 -11
- package/dist/components/EmptyState/EmptyState.d.ts.map +0 -1
- package/dist/components/EmptyState/EmptyState.js +0 -10
- package/dist/components/EmptyState/index.d.ts +0 -3
- package/dist/components/EmptyState/index.d.ts.map +0 -1
- package/dist/components/EmptyState/index.js +0 -1
- package/dist/components/Field/Field.d.ts +0 -13
- package/dist/components/Field/Field.d.ts.map +0 -1
- package/dist/components/Field/Field.js +0 -15
- package/dist/components/Field/index.d.ts +0 -3
- package/dist/components/Field/index.d.ts.map +0 -1
- package/dist/components/Field/index.js +0 -1
- package/dist/components/Fieldset/Fieldset.d.ts +0 -8
- package/dist/components/Fieldset/Fieldset.d.ts.map +0 -1
- package/dist/components/Fieldset/Fieldset.js +0 -15
- package/dist/components/Fieldset/index.d.ts +0 -3
- package/dist/components/Fieldset/index.d.ts.map +0 -1
- package/dist/components/Fieldset/index.js +0 -1
- package/dist/components/Heading/Heading.d.ts +0 -19
- package/dist/components/Heading/Heading.d.ts.map +0 -1
- package/dist/components/Heading/Heading.js +0 -39
- package/dist/components/Heading/index.d.ts +0 -3
- package/dist/components/Heading/index.d.ts.map +0 -1
- package/dist/components/Heading/index.js +0 -1
- package/dist/components/Icon/Icon.d.ts +0 -15
- package/dist/components/Icon/Icon.d.ts.map +0 -1
- package/dist/components/Icon/Icon.js +0 -11
- package/dist/components/Icon/index.d.ts +0 -3
- package/dist/components/Icon/index.d.ts.map +0 -1
- package/dist/components/Icon/index.js +0 -1
- package/dist/components/IconButton/IconButton.d.ts +0 -23
- package/dist/components/IconButton/IconButton.d.ts.map +0 -1
- package/dist/components/IconButton/IconButton.js +0 -59
- package/dist/components/IconButton/index.d.ts +0 -3
- package/dist/components/IconButton/index.d.ts.map +0 -1
- package/dist/components/IconButton/index.js +0 -1
- package/dist/components/Input/Input.d.ts +0 -23
- package/dist/components/Input/Input.d.ts.map +0 -1
- package/dist/components/Input/Input.js +0 -97
- package/dist/components/Input/index.d.ts +0 -3
- package/dist/components/Input/index.d.ts.map +0 -1
- package/dist/components/Input/index.js +0 -1
- package/dist/components/InputAddon/InputAddon.d.ts +0 -7
- package/dist/components/InputAddon/InputAddon.d.ts.map +0 -1
- package/dist/components/InputAddon/InputAddon.js +0 -35
- package/dist/components/InputAddon/index.d.ts +0 -3
- package/dist/components/InputAddon/index.d.ts.map +0 -1
- package/dist/components/InputAddon/index.js +0 -1
- package/dist/components/InputGroup/InputGroup.d.ts +0 -7
- package/dist/components/InputGroup/InputGroup.d.ts.map +0 -1
- package/dist/components/InputGroup/InputGroup.js +0 -16
- package/dist/components/InputGroup/InputGroupContext.d.ts +0 -9
- package/dist/components/InputGroup/InputGroupContext.d.ts.map +0 -1
- package/dist/components/InputGroup/InputGroupContext.js +0 -8
- package/dist/components/InputGroup/index.d.ts +0 -5
- package/dist/components/InputGroup/index.d.ts.map +0 -1
- package/dist/components/InputGroup/index.js +0 -2
- package/dist/components/Label/Label.d.ts +0 -7
- package/dist/components/Label/Label.d.ts.map +0 -1
- package/dist/components/Label/Label.js +0 -12
- package/dist/components/Label/index.d.ts +0 -3
- package/dist/components/Label/index.d.ts.map +0 -1
- package/dist/components/Label/index.js +0 -1
- package/dist/components/Link/Link.d.ts +0 -10
- package/dist/components/Link/Link.d.ts.map +0 -1
- package/dist/components/Link/Link.js +0 -22
- package/dist/components/Link/index.d.ts +0 -3
- package/dist/components/Link/index.d.ts.map +0 -1
- package/dist/components/Link/index.js +0 -1
- package/dist/components/Menu/Menu.d.ts +0 -24
- package/dist/components/Menu/Menu.d.ts.map +0 -1
- package/dist/components/Menu/Menu.js +0 -29
- package/dist/components/Menu/index.d.ts +0 -3
- package/dist/components/Menu/index.d.ts.map +0 -1
- package/dist/components/Menu/index.js +0 -1
- package/dist/components/Popover/Popover.d.ts +0 -44
- package/dist/components/Popover/Popover.d.ts.map +0 -1
- package/dist/components/Popover/Popover.js +0 -46
- package/dist/components/Popover/index.d.ts +0 -3
- package/dist/components/Popover/index.d.ts.map +0 -1
- package/dist/components/Popover/index.js +0 -1
- package/dist/components/Radio/Radio.d.ts +0 -18
- package/dist/components/Radio/Radio.d.ts.map +0 -1
- package/dist/components/Radio/Radio.js +0 -43
- package/dist/components/Radio/index.d.ts +0 -3
- package/dist/components/Radio/index.d.ts.map +0 -1
- package/dist/components/Radio/index.js +0 -1
- package/dist/components/Select/Select.d.ts +0 -17
- package/dist/components/Select/Select.d.ts.map +0 -1
- package/dist/components/Select/Select.js +0 -42
- package/dist/components/Select/index.d.ts +0 -3
- package/dist/components/Select/index.d.ts.map +0 -1
- package/dist/components/Select/index.js +0 -1
- package/dist/components/Spinner/Spinner.d.ts +0 -10
- package/dist/components/Spinner/Spinner.d.ts.map +0 -1
- package/dist/components/Spinner/Spinner.js +0 -12
- package/dist/components/Spinner/index.d.ts +0 -3
- package/dist/components/Spinner/index.d.ts.map +0 -1
- package/dist/components/Spinner/index.js +0 -1
- package/dist/components/Switch/Switch.d.ts +0 -12
- package/dist/components/Switch/Switch.d.ts.map +0 -1
- package/dist/components/Switch/Switch.js +0 -34
- package/dist/components/Switch/index.d.ts +0 -3
- package/dist/components/Switch/index.d.ts.map +0 -1
- package/dist/components/Switch/index.js +0 -1
- package/dist/components/Table/Table.d.ts +0 -13
- package/dist/components/Table/Table.d.ts.map +0 -1
- package/dist/components/Table/Table.js +0 -61
- package/dist/components/Table/index.d.ts +0 -3
- package/dist/components/Table/index.d.ts.map +0 -1
- package/dist/components/Table/index.js +0 -1
- package/dist/components/Tabs/Tabs.d.ts +0 -32
- package/dist/components/Tabs/Tabs.d.ts.map +0 -1
- package/dist/components/Tabs/Tabs.js +0 -100
- package/dist/components/Tabs/index.d.ts +0 -3
- package/dist/components/Tabs/index.d.ts.map +0 -1
- package/dist/components/Tabs/index.js +0 -1
- package/dist/components/Toast/Toast.d.ts +0 -33
- package/dist/components/Toast/Toast.d.ts.map +0 -1
- package/dist/components/Toast/Toast.js +0 -102
- package/dist/components/Toast/index.d.ts +0 -3
- package/dist/components/Toast/index.d.ts.map +0 -1
- package/dist/components/Toast/index.js +0 -1
- package/dist/components/ToggleButton/ToggleButton.d.ts +0 -13
- package/dist/components/ToggleButton/ToggleButton.d.ts.map +0 -1
- package/dist/components/ToggleButton/ToggleButton.js +0 -42
- package/dist/components/ToggleButton/index.d.ts +0 -3
- package/dist/components/ToggleButton/index.d.ts.map +0 -1
- package/dist/components/ToggleButton/index.js +0 -1
- package/dist/components/Tooltip/Tooltip.d.ts +0 -15
- package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/components/Tooltip/Tooltip.js +0 -20
- package/dist/components/Tooltip/index.d.ts +0 -3
- package/dist/components/Tooltip/index.d.ts.map +0 -1
- package/dist/components/Tooltip/index.js +0 -1
- package/dist/components/_shared/styles.d.ts +0 -5
- package/dist/components/_shared/styles.d.ts.map +0 -1
- package/dist/components/_shared/styles.js +0 -43
- package/dist/index.d.ts.map +0 -1
- package/dist/test-setup.d.ts +0 -2
- package/dist/test-setup.d.ts.map +0 -1
- package/dist/test-setup.js +0 -1
- package/dist/tokens/tokens.d.ts +0 -144
- package/dist/tokens/tokens.d.ts.map +0 -1
- package/dist/tokens/tokens.js +0 -143
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type React from "react";
|
|
2
|
-
import { type RadioGroupProps as AriaRadioGroupProps, type RadioProps as AriaRadioProps } from "react-aria-components";
|
|
3
|
-
export interface RadioGroupProps extends Omit<AriaRadioGroupProps, "children" | "className"> {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
className?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface RadioProps extends Omit<AriaRadioProps, "children" | "className"> {
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
-
className?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface RadioButtonProps extends Omit<AriaRadioProps, "children" | "className"> {
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
className?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function RadioGroup({ children, className, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export declare function Radio({ children, className, ...props }: RadioProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export declare function RadioButton({ children, className, ...props }: RadioButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
//# sourceMappingURL=Radio.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../src/components/Radio/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,KAAK,eAAe,IAAI,mBAAmB,EAC3C,KAAK,UAAU,IAAI,cAAc,EAClC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,WAAW,CAAC;IAC3D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,WAAW,CAAC;IACtD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,WAAW,CAAC;IACtD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAe5E;AAED,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,2CAiClE;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CA4B9E"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { RadioGroup as AriaRadioGroup, Radio as AriaRadio, } from "react-aria-components";
|
|
3
|
-
export function RadioGroup({ children, className, ...props }) {
|
|
4
|
-
return (_jsx(AriaRadioGroup, { ...props, className: [
|
|
5
|
-
"flex flex-col gap-2",
|
|
6
|
-
"disabled:opacity-50",
|
|
7
|
-
className,
|
|
8
|
-
]
|
|
9
|
-
.filter(Boolean)
|
|
10
|
-
.join(" "), children: children }));
|
|
11
|
-
}
|
|
12
|
-
export function Radio({ children, className, ...props }) {
|
|
13
|
-
return (_jsx(AriaRadio, { ...props, className: [
|
|
14
|
-
"group flex items-center gap-2 text-[length:var(--font-size-sm)] text-[var(--color-text-primary)] cursor-pointer",
|
|
15
|
-
"disabled:opacity-50 disabled:cursor-default",
|
|
16
|
-
className,
|
|
17
|
-
]
|
|
18
|
-
.filter(Boolean)
|
|
19
|
-
.join(" "), children: ({ isSelected }) => (_jsxs(_Fragment, { children: [_jsx("div", { className: [
|
|
20
|
-
"flex items-center justify-center w-5 h-5 shrink-0",
|
|
21
|
-
"rounded-full border-2 transition-colors",
|
|
22
|
-
"group-focus-visible:ring-2 group-focus-visible:ring-[var(--color-border-focus)] group-focus-visible:ring-offset-2",
|
|
23
|
-
isSelected
|
|
24
|
-
? "border-[var(--color-action-primary)]"
|
|
25
|
-
: "border-[var(--color-border-default)] group-hover:border-[var(--color-border-strong)]",
|
|
26
|
-
].join(" "), children: isSelected && (_jsx("div", { className: "w-2.5 h-2.5 rounded-full bg-[var(--color-action-primary)]" })) }), children && _jsx("span", { children: children })] })) }));
|
|
27
|
-
}
|
|
28
|
-
export function RadioButton({ children, className, ...props }) {
|
|
29
|
-
return (_jsx(AriaRadio, { ...props, className: [
|
|
30
|
-
"group cursor-pointer",
|
|
31
|
-
"disabled:opacity-50 disabled:cursor-default",
|
|
32
|
-
className,
|
|
33
|
-
]
|
|
34
|
-
.filter(Boolean)
|
|
35
|
-
.join(" "), children: ({ isSelected }) => (_jsx("div", { className: [
|
|
36
|
-
"px-4 py-2 text-[length:var(--font-size-sm)] font-[number:var(--font-weight-medium)]",
|
|
37
|
-
"rounded-[var(--border-radius-md)] border transition-colors text-center",
|
|
38
|
-
"group-focus-visible:ring-2 group-focus-visible:ring-[var(--color-border-focus)] group-focus-visible:ring-offset-2",
|
|
39
|
-
isSelected
|
|
40
|
-
? "bg-[var(--color-action-primary)] border-[var(--color-action-primary)] text-[var(--color-text-inverse)]"
|
|
41
|
-
: "bg-[var(--color-surface-default)] border-[var(--color-border-default)] text-[var(--color-text-primary)] hover:border-[var(--color-border-strong)]",
|
|
42
|
-
].join(" "), children: children })) }));
|
|
43
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Radio/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACzD,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { RadioGroup, Radio, RadioButton } from "./Radio";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type SelectProps as AriaSelectProps } from "react-aria-components";
|
|
2
|
-
export interface SelectItem {
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
}
|
|
6
|
-
export interface SelectProps extends Omit<AriaSelectProps<SelectItem>, "children"> {
|
|
7
|
-
/** Label displayed above the trigger (always visible) */
|
|
8
|
-
label: string;
|
|
9
|
-
/** Options to display in the dropdown */
|
|
10
|
-
items: SelectItem[];
|
|
11
|
-
/** Placeholder text when no item is selected */
|
|
12
|
-
placeholder?: string;
|
|
13
|
-
/** Error message displayed below the trigger */
|
|
14
|
-
errorMessage?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare function Select({ label, items, placeholder, errorMessage, isDisabled, isRequired, className, ...props }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,WAAW,IAAI,eAAe,EAEpC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IACrD,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAoCD,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,KAAK,EACL,WAAgC,EAChC,YAAY,EACZ,UAAU,EACV,UAAU,EACV,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,2CA4Fb"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Label, ListBox, ListBoxItem, Popover, Select as AriaSelect, SelectValue, } from "react-aria-components";
|
|
3
|
-
function ChevronDown() {
|
|
4
|
-
return (_jsx("svg", { "aria-hidden": "true", className: "h-4 w-4 text-[var(--color-text-secondary)]", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: "M4 6l4 4 4-4" }) }));
|
|
5
|
-
}
|
|
6
|
-
function CheckIcon() {
|
|
7
|
-
return (_jsx("svg", { "aria-hidden": "true", className: "h-4 w-4 text-[var(--color-action-primary)]", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: "M3 8.5l3.5 3.5 6.5-7" }) }));
|
|
8
|
-
}
|
|
9
|
-
export function Select({ label, items, placeholder = "Select an option", errorMessage, isDisabled, isRequired, className, ...props }) {
|
|
10
|
-
const hasError = Boolean(errorMessage);
|
|
11
|
-
return (_jsxs(AriaSelect, { ...props, isDisabled: isDisabled, isRequired: isRequired, isInvalid: hasError, className: ["flex flex-col gap-1", className].filter(Boolean).join(" "), children: [_jsxs(Label, { className: [
|
|
12
|
-
"text-sm font-[var(--font-weight-medium)] text-[var(--color-text-primary)]",
|
|
13
|
-
].join(" "), children: [label, isRequired && (_jsx("span", { "aria-hidden": "true", className: "ml-0.5 text-[var(--color-text-danger)]", children: "*" }))] }), _jsxs(Button, { className: [
|
|
14
|
-
"inline-flex items-center justify-between",
|
|
15
|
-
"w-full rounded-[var(--border-radius-md)] px-4 py-2",
|
|
16
|
-
"text-base text-left",
|
|
17
|
-
"border outline-none transition-colors",
|
|
18
|
-
hasError
|
|
19
|
-
? "border-[var(--color-border-danger)]"
|
|
20
|
-
: "border-[var(--color-border-default)]",
|
|
21
|
-
"focus-visible:ring-2 focus-visible:ring-[var(--color-border-focus)] focus-visible:ring-offset-2",
|
|
22
|
-
"disabled:opacity-50 disabled:pointer-events-none",
|
|
23
|
-
"bg-[var(--color-surface-default)]",
|
|
24
|
-
].join(" "), children: [_jsx(SelectValue, { className: "truncate data-[placeholder]:text-[var(--color-text-tertiary)]", children: ({ selectedText }) => selectedText || placeholder }), _jsx(ChevronDown, {})] }), hasError && (_jsx("span", { className: "text-sm text-[var(--color-text-danger)]", children: errorMessage })), _jsx(Popover, { className: [
|
|
25
|
-
"w-[var(--trigger-width)]",
|
|
26
|
-
"rounded-[var(--border-radius-md)]",
|
|
27
|
-
"border border-[var(--color-border-default)]",
|
|
28
|
-
"bg-[var(--color-surface-default)]",
|
|
29
|
-
"shadow-lg",
|
|
30
|
-
"overflow-auto",
|
|
31
|
-
"entering:animate-in entering:fade-in entering:slide-in-from-top-1",
|
|
32
|
-
"exiting:animate-out exiting:fade-out exiting:slide-out-to-top-1",
|
|
33
|
-
].join(" "), children: _jsx(ListBox, { className: "p-1 outline-none", items: items, children: (item) => (_jsx(ListBoxItem, { id: item.id, textValue: item.name, className: [
|
|
34
|
-
"flex items-center justify-between gap-2",
|
|
35
|
-
"px-4 py-2 rounded-[var(--border-radius-sm)]",
|
|
36
|
-
"text-base text-[var(--color-text-primary)]",
|
|
37
|
-
"cursor-pointer outline-none",
|
|
38
|
-
"hover:bg-[var(--color-surface-muted)]",
|
|
39
|
-
"focus:bg-[var(--color-surface-muted)]",
|
|
40
|
-
"selected:text-[var(--color-action-primary)] selected:font-[var(--font-weight-medium)]",
|
|
41
|
-
].join(" "), children: ({ isSelected }) => (_jsxs(_Fragment, { children: [_jsx("span", { className: "truncate", children: item.name }), isSelected && _jsx(CheckIcon, {})] })) })) }) })] }));
|
|
42
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Select } from "./Select";
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface SpinnerProps {
|
|
2
|
-
/** Size preset */
|
|
3
|
-
size?: "sm" | "md" | "lg";
|
|
4
|
-
/** Accessible label — when provided, the spinner is announced to screen readers */
|
|
5
|
-
"aria-label"?: string;
|
|
6
|
-
/** Additional CSS classes */
|
|
7
|
-
className?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function Spinner({ size, "aria-label": ariaLabel, className, }: SpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
//# sourceMappingURL=Spinner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../../src/components/Spinner/Spinner.tsx"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,kBAAkB;IAClB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,mFAAmF;IACnF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAQD,wBAAgB,OAAO,CAAC,EACtB,IAAW,EACX,YAAY,EAAE,SAAS,EACvB,SAAS,GACV,EAAE,YAAY,2CA6Bd"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
const sizeMap = {
|
|
3
|
-
sm: "h-4 w-4",
|
|
4
|
-
md: "h-5 w-5",
|
|
5
|
-
lg: "h-6 w-6",
|
|
6
|
-
};
|
|
7
|
-
export function Spinner({ size = "md", "aria-label": ariaLabel, className, }) {
|
|
8
|
-
const isDecorative = !ariaLabel;
|
|
9
|
-
return (_jsxs("svg", { role: isDecorative ? undefined : "status", "aria-label": ariaLabel, "aria-hidden": isDecorative ? "true" : undefined, className: [sizeMap[size], "animate-spin", className]
|
|
10
|
-
.filter(Boolean)
|
|
11
|
-
.join(" "), viewBox: "0 0 24 24", fill: "none", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })] }));
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Spinner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Spinner } from "./Spinner";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type React from "react";
|
|
2
|
-
import { type SwitchProps as AriaSwitchProps } from "react-aria-components";
|
|
3
|
-
type PresetColor = "primary" | "success" | "destructive";
|
|
4
|
-
export interface SwitchProps extends Omit<AriaSwitchProps, "children" | "className"> {
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
/** Preset color name or any valid CSS color string for the track when selected */
|
|
7
|
-
color?: PresetColor | (string & {});
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function Switch({ children, color, className, ...props }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=Switch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,KAAK,WAAW,IAAI,eAAe,EACpC,MAAM,uBAAuB,CAAC;AAE/B,KAAK,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC;AAEzD,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,WAAW,CAAC;IACvD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,kFAAkF;IAClF,KAAK,CAAC,EAAE,WAAW,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAcD,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,KAAiB,EACjB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,2CA4Cb"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Switch as AriaSwitch, } from "react-aria-components";
|
|
3
|
-
const trackColorMap = {
|
|
4
|
-
primary: "bg-[var(--color-action-primary)]",
|
|
5
|
-
success: "bg-[var(--color-action-success)]",
|
|
6
|
-
destructive: "bg-[var(--color-action-danger)]",
|
|
7
|
-
};
|
|
8
|
-
const presetColors = new Set(Object.keys(trackColorMap));
|
|
9
|
-
function isPresetColor(color) {
|
|
10
|
-
return presetColors.has(color);
|
|
11
|
-
}
|
|
12
|
-
export function Switch({ children, color = "primary", className, ...props }) {
|
|
13
|
-
const isPreset = isPresetColor(color);
|
|
14
|
-
return (_jsx(AriaSwitch, { ...props, className: [
|
|
15
|
-
"group flex items-center gap-2 text-[length:var(--font-size-sm)] text-[var(--color-text-primary)] cursor-pointer",
|
|
16
|
-
"disabled:opacity-50 disabled:cursor-default",
|
|
17
|
-
className,
|
|
18
|
-
]
|
|
19
|
-
.filter(Boolean)
|
|
20
|
-
.join(" "), children: ({ isSelected }) => (_jsxs(_Fragment, { children: [_jsx("div", { className: [
|
|
21
|
-
"w-9 h-5 rounded-full transition-colors shrink-0 p-0.5",
|
|
22
|
-
"group-focus-visible:ring-2 group-focus-visible:ring-[var(--color-border-focus)] group-focus-visible:ring-offset-2",
|
|
23
|
-
isSelected && isPreset
|
|
24
|
-
? trackColorMap[color]
|
|
25
|
-
: !isSelected
|
|
26
|
-
? "bg-[var(--color-border-strong)]"
|
|
27
|
-
: "",
|
|
28
|
-
].join(" "), style: isSelected && !isPreset
|
|
29
|
-
? { backgroundColor: color }
|
|
30
|
-
: undefined, children: _jsx("div", { className: [
|
|
31
|
-
"w-4 h-4 rounded-full bg-[var(--color-surface-default)] transition-transform shadow-sm",
|
|
32
|
-
isSelected ? "translate-x-4" : "translate-x-0",
|
|
33
|
-
].join(" ") }) }), children && _jsx("span", { children: children })] })) }));
|
|
34
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Switch } from "./Switch";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type CellProps, type ColumnProps, type RowProps, type TableBodyProps, type TableHeaderProps, type TableProps } from "react-aria-components";
|
|
2
|
-
export type TableSize = "compact" | "comfortable";
|
|
3
|
-
export interface DataTableProps extends TableProps {
|
|
4
|
-
/** Row density */
|
|
5
|
-
size?: TableSize;
|
|
6
|
-
}
|
|
7
|
-
export declare function Table({ size, className, ...props }: DataTableProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare function TableHeader<T extends object>(props: TableHeaderProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export declare function Column(props: ColumnProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare function TableBody<T extends object>(props: TableBodyProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare function Row<T extends object>(props: RowProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export declare function Cell(props: CellProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/components/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAChB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC;AAMlD,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,kBAAkB;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAOD,wBAAgB,KAAK,CAAC,EAAE,IAAoB,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAalF;AAMD,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,2CAEvE;AAMD,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CAuBxC;AAMD,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,2CAEnE;AAMD,wBAAgB,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,2CAcvD;AAMD,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,2CAWpC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Cell as AriaCell, Column as AriaColumn, Row as AriaRow, Table as AriaTable, TableBody as AriaTableBody, TableHeader as AriaTableHeader, } from "react-aria-components";
|
|
3
|
-
const tableSizeClass = {
|
|
4
|
-
compact: "[--table-row-py:theme(spacing.1)]",
|
|
5
|
-
comfortable: "[--table-row-py:theme(spacing.3)]",
|
|
6
|
-
};
|
|
7
|
-
export function Table({ size = "comfortable", className, ...props }) {
|
|
8
|
-
return (_jsx(AriaTable, { ...props, className: [
|
|
9
|
-
"w-full border-collapse text-[var(--font-size-sm)] text-[var(--color-text-primary)]",
|
|
10
|
-
tableSizeClass[size],
|
|
11
|
-
className,
|
|
12
|
-
]
|
|
13
|
-
.filter(Boolean)
|
|
14
|
-
.join(" ") }));
|
|
15
|
-
}
|
|
16
|
-
/* ------------------------------------------------------------------ */
|
|
17
|
-
/* TableHeader */
|
|
18
|
-
/* ------------------------------------------------------------------ */
|
|
19
|
-
export function TableHeader(props) {
|
|
20
|
-
return _jsx(AriaTableHeader, { ...props });
|
|
21
|
-
}
|
|
22
|
-
/* ------------------------------------------------------------------ */
|
|
23
|
-
/* Column */
|
|
24
|
-
/* ------------------------------------------------------------------ */
|
|
25
|
-
export function Column(props) {
|
|
26
|
-
return (_jsx(AriaColumn, { ...props, className: [
|
|
27
|
-
"px-3 py-2 text-left font-[var(--font-weight-semibold)] text-[var(--color-text-secondary)]",
|
|
28
|
-
"border-b-2 border-[var(--color-border-default)]",
|
|
29
|
-
"cursor-default select-none outline-none",
|
|
30
|
-
"focus-visible:outline-2 focus-visible:outline-[var(--color-border-focus)] focus-visible:outline-offset-[-2px]",
|
|
31
|
-
].join(" "), children: ({ allowsSorting, sortDirection }) => (_jsxs("span", { className: "inline-flex items-center gap-1", children: [props.children, allowsSorting && (_jsx("span", { "aria-hidden": "true", className: "text-[var(--color-text-tertiary)]", children: sortDirection === "ascending" ? "\u25B2" : sortDirection === "descending" ? "\u25BC" : "\u25B4" }))] })) }));
|
|
32
|
-
}
|
|
33
|
-
/* ------------------------------------------------------------------ */
|
|
34
|
-
/* TableBody */
|
|
35
|
-
/* ------------------------------------------------------------------ */
|
|
36
|
-
export function TableBody(props) {
|
|
37
|
-
return _jsx(AriaTableBody, { ...props });
|
|
38
|
-
}
|
|
39
|
-
/* ------------------------------------------------------------------ */
|
|
40
|
-
/* Row */
|
|
41
|
-
/* ------------------------------------------------------------------ */
|
|
42
|
-
export function Row(props) {
|
|
43
|
-
return (_jsx(AriaRow, { ...props, className: [
|
|
44
|
-
"border-b border-[var(--color-border-default)]",
|
|
45
|
-
"even:bg-[var(--color-neutral-50)]",
|
|
46
|
-
"hover:bg-[var(--color-teal-50)]",
|
|
47
|
-
"outline-none",
|
|
48
|
-
"focus-visible:outline-2 focus-visible:outline-[var(--color-border-focus)] focus-visible:outline-offset-[-2px]",
|
|
49
|
-
"transition-colors",
|
|
50
|
-
].join(" ") }));
|
|
51
|
-
}
|
|
52
|
-
/* ------------------------------------------------------------------ */
|
|
53
|
-
/* Cell */
|
|
54
|
-
/* ------------------------------------------------------------------ */
|
|
55
|
-
export function Cell(props) {
|
|
56
|
-
return (_jsx(AriaCell, { ...props, className: [
|
|
57
|
-
"px-3 py-[var(--table-row-py)]",
|
|
58
|
-
"outline-none",
|
|
59
|
-
"focus-visible:outline-2 focus-visible:outline-[var(--color-border-focus)] focus-visible:outline-offset-[-2px]",
|
|
60
|
-
].join(" ") }));
|
|
61
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC3E,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Table, TableHeader, Column, TableBody, Row, Cell } from "./Table";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
import { type TabsProps as AriaTabsProps, type TabListProps as AriaTabListProps, type TabProps as AriaTabProps, type TabPanelProps as AriaTabPanelProps } from "react-aria-components";
|
|
3
|
-
export type TabsVariant = "underline" | "pills";
|
|
4
|
-
export type TabsSize = "sm" | "md" | "lg";
|
|
5
|
-
export interface TabsProps extends Omit<AriaTabsProps, "className" | "orientation"> {
|
|
6
|
-
/** Visual style variant */
|
|
7
|
-
variant?: TabsVariant;
|
|
8
|
-
/** Size preset */
|
|
9
|
-
size?: TabsSize;
|
|
10
|
-
/** Layout orientation */
|
|
11
|
-
orientation?: "horizontal" | "vertical";
|
|
12
|
-
/** Additional CSS classes */
|
|
13
|
-
className?: string;
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
}
|
|
16
|
-
export declare function Tabs({ variant, size, orientation, className, children, ...props }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export interface TabListProps<T extends object> extends Omit<AriaTabListProps<T>, "className"> {
|
|
18
|
-
/** Additional CSS classes */
|
|
19
|
-
className?: string;
|
|
20
|
-
}
|
|
21
|
-
export declare function TabList<T extends object>({ className, ...props }: TabListProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export interface TabProps extends Omit<AriaTabProps, "className"> {
|
|
23
|
-
/** Additional CSS classes */
|
|
24
|
-
className?: string;
|
|
25
|
-
}
|
|
26
|
-
export declare function Tab({ className, ...props }: TabProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
export interface TabPanelProps extends Omit<AriaTabPanelProps, "className"> {
|
|
28
|
-
/** Additional CSS classes */
|
|
29
|
-
className?: string;
|
|
30
|
-
}
|
|
31
|
-
export declare function TabPanel({ className, ...props }: TabPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
-
//# sourceMappingURL=Tabs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAKL,KAAK,SAAS,IAAI,aAAa,EAC/B,KAAK,YAAY,IAAI,gBAAgB,EACrC,KAAK,QAAQ,IAAI,YAAY,EAC7B,KAAK,aAAa,IAAI,iBAAiB,EAExC,MAAM,uBAAuB,CAAC;AAM/B,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,OAAO,CAAC;AAChD,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AA0B1C,MAAM,WAAW,SACf,SAAQ,IAAI,CAAC,aAAa,EAAE,WAAW,GAAG,aAAa,CAAC;IACxD,2BAA2B;IAC3B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,kBAAkB;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,yBAAyB;IACzB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,IAAI,CAAC,EACnB,OAAqB,EACrB,IAAW,EACX,WAA0B,EAC1B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,SAAS,2CAiBX;AAMD,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM,CAC5C,SAAQ,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC;IAC9C,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,EACxC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,YAAY,CAAC,CAAC,CAAC,2CA4BjB;AAMD,MAAM,WAAW,QAAS,SAAQ,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC;IAC/D,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,QAAQ,2CAoCpD;AAmDD,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC;IACzE,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,2CAO9D"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
3
|
-
import { Tabs as AriaTabs, TabList as AriaTabList, Tab as AriaTab, TabPanel as AriaTabPanel, } from "react-aria-components";
|
|
4
|
-
const TabsContext = createContext({
|
|
5
|
-
variant: "underline",
|
|
6
|
-
size: "md",
|
|
7
|
-
});
|
|
8
|
-
// ---------------------------------------------------------------------------
|
|
9
|
-
// Style maps
|
|
10
|
-
// ---------------------------------------------------------------------------
|
|
11
|
-
const sizeStyles = {
|
|
12
|
-
sm: "px-3 py-1.5 text-sm",
|
|
13
|
-
md: "px-4 py-2 text-base",
|
|
14
|
-
lg: "px-6 py-3 text-lg",
|
|
15
|
-
};
|
|
16
|
-
export function Tabs({ variant = "underline", size = "md", orientation = "horizontal", className, children, ...props }) {
|
|
17
|
-
return (_jsx(TabsContext.Provider, { value: { variant, size }, children: _jsx(AriaTabs, { ...props, orientation: orientation, className: [
|
|
18
|
-
orientation === "vertical" ? "flex" : "",
|
|
19
|
-
className,
|
|
20
|
-
]
|
|
21
|
-
.filter(Boolean)
|
|
22
|
-
.join(" "), children: children }) }));
|
|
23
|
-
}
|
|
24
|
-
export function TabList({ className, ...props }) {
|
|
25
|
-
const { variant } = useContext(TabsContext);
|
|
26
|
-
const baseStyles = variant === "underline"
|
|
27
|
-
? "flex items-center border-b border-[var(--color-border-default)]"
|
|
28
|
-
: "inline-flex items-center bg-[var(--color-surface-muted)] rounded-[var(--border-radius-lg)] p-1 gap-1";
|
|
29
|
-
// Vertical orientation overrides
|
|
30
|
-
const verticalStyles = variant === "underline"
|
|
31
|
-
? "flex-col border-b-0 border-r border-[var(--color-border-default)]"
|
|
32
|
-
: "flex-col";
|
|
33
|
-
return (_jsx(AriaTabList, { ...props, className: ({ orientation }) => [
|
|
34
|
-
baseStyles,
|
|
35
|
-
orientation === "vertical" ? verticalStyles : "",
|
|
36
|
-
className,
|
|
37
|
-
]
|
|
38
|
-
.filter(Boolean)
|
|
39
|
-
.join(" ") }));
|
|
40
|
-
}
|
|
41
|
-
export function Tab({ className, ...props }) {
|
|
42
|
-
const { variant, size } = useContext(TabsContext);
|
|
43
|
-
return (_jsx(AriaTab, { ...props, className: ({ isSelected, isDisabled, isHovered, isPressed }) => [
|
|
44
|
-
// Base
|
|
45
|
-
"cursor-pointer outline-none transition-colors",
|
|
46
|
-
"font-[var(--font-weight-medium)]",
|
|
47
|
-
// Focus ring
|
|
48
|
-
"focus-visible:ring-2 focus-visible:ring-[var(--color-border-focus)] focus-visible:ring-offset-2",
|
|
49
|
-
// Disabled
|
|
50
|
-
isDisabled ? "opacity-50 pointer-events-none" : "",
|
|
51
|
-
// Size
|
|
52
|
-
sizeStyles[size],
|
|
53
|
-
// Variant-specific styles
|
|
54
|
-
...getTabVariantStyles(variant, {
|
|
55
|
-
isSelected,
|
|
56
|
-
isHovered,
|
|
57
|
-
isPressed,
|
|
58
|
-
isDisabled,
|
|
59
|
-
}),
|
|
60
|
-
className,
|
|
61
|
-
]
|
|
62
|
-
.filter(Boolean)
|
|
63
|
-
.join(" ") }));
|
|
64
|
-
}
|
|
65
|
-
function getTabVariantStyles(variant, state) {
|
|
66
|
-
if (variant === "underline") {
|
|
67
|
-
return [
|
|
68
|
-
// Shape
|
|
69
|
-
"relative rounded-t-[var(--border-radius-sm)]",
|
|
70
|
-
// Color states
|
|
71
|
-
state.isSelected
|
|
72
|
-
? [
|
|
73
|
-
"text-[var(--color-teal-700)] font-[var(--font-weight-semibold)]",
|
|
74
|
-
// Bottom indicator via pseudo-element
|
|
75
|
-
"after:absolute after:bottom-[-1px] after:left-0 after:right-0 after:h-0.5 after:bg-[var(--color-teal-600)]",
|
|
76
|
-
].join(" ")
|
|
77
|
-
: state.isPressed
|
|
78
|
-
? "text-[var(--color-text-primary)] bg-[var(--color-neutral-100)]"
|
|
79
|
-
: state.isHovered
|
|
80
|
-
? "text-[var(--color-text-primary)] bg-[var(--color-neutral-50)]"
|
|
81
|
-
: "text-[var(--color-text-secondary)] bg-transparent",
|
|
82
|
-
];
|
|
83
|
-
}
|
|
84
|
-
// Pills variant
|
|
85
|
-
return [
|
|
86
|
-
// Shape
|
|
87
|
-
"rounded-[var(--border-radius-md)]",
|
|
88
|
-
// Color states
|
|
89
|
-
state.isSelected
|
|
90
|
-
? "text-[var(--color-text-primary)] font-[var(--font-weight-semibold)] bg-[var(--color-surface-default)] shadow-sm"
|
|
91
|
-
: state.isPressed
|
|
92
|
-
? "text-[var(--color-text-primary)] bg-[var(--color-neutral-50)] shadow-none"
|
|
93
|
-
: state.isHovered
|
|
94
|
-
? "text-[var(--color-text-primary)] bg-[var(--color-neutral-200)]"
|
|
95
|
-
: "text-[var(--color-text-secondary)] bg-transparent",
|
|
96
|
-
];
|
|
97
|
-
}
|
|
98
|
-
export function TabPanel({ className, ...props }) {
|
|
99
|
-
return (_jsx(AriaTabPanel, { ...props, className: ["mt-4 outline-none", className].filter(Boolean).join(" ") }));
|
|
100
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACtD,YAAY,EACV,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,WAAW,EACX,QAAQ,GACT,MAAM,QAAQ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Tabs, TabList, Tab, TabPanel } from "./Tabs";
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
export type ToastVariant = "success" | "error" | "info";
|
|
3
|
-
export interface ToastData {
|
|
4
|
-
id: string;
|
|
5
|
-
variant: ToastVariant;
|
|
6
|
-
message: string;
|
|
7
|
-
duration?: number;
|
|
8
|
-
}
|
|
9
|
-
export interface ToastContextValue {
|
|
10
|
-
toasts: ToastData[];
|
|
11
|
-
addToast: (toast: Omit<ToastData, "id">) => void;
|
|
12
|
-
removeToast: (id: string) => void;
|
|
13
|
-
}
|
|
14
|
-
export interface ToastBridge {
|
|
15
|
-
/** Call from anywhere (including outside React) to show a toast. */
|
|
16
|
-
emit: (toast: Omit<ToastData, "id">) => void;
|
|
17
|
-
/** Used internally by ToastProvider to subscribe to external emits. */
|
|
18
|
-
subscribe: (fn: (toast: Omit<ToastData, "id">) => void) => () => void;
|
|
19
|
-
}
|
|
20
|
-
export declare function createToastBridge(): ToastBridge;
|
|
21
|
-
interface ToastProviderProps {
|
|
22
|
-
children: ReactNode;
|
|
23
|
-
/** Optional bridge for receiving toasts from outside the React tree. */
|
|
24
|
-
bridge?: ToastBridge;
|
|
25
|
-
}
|
|
26
|
-
export declare function ToastProvider({ children, bridge }: ToastProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
export declare function useToast(): {
|
|
28
|
-
toast: (toast: Omit<ToastData, "id">) => void;
|
|
29
|
-
toasts: ToastData[];
|
|
30
|
-
removeToast: (id: string) => void;
|
|
31
|
-
};
|
|
32
|
-
export {};
|
|
33
|
-
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAExD,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC;IACjD,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAuGD,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC;IAC7C,uEAAuE;IACvE,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;CACvE;AAED,wBAAgB,iBAAiB,IAAI,WAAW,CAa/C;AAMD,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,wEAAwE;IACxE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,kBAAkB,2CAwBrE;AAED,wBAAgB,QAAQ;mBAnKJ,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,IAAI;;sBAC9B,MAAM,KAAK,IAAI;EA4KlC"}
|