@financedistrict/apps-ui 0.1.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/LICENSE +19 -0
- package/README.md +119 -0
- package/dist/Radio-BYWz1n7p.d.cts +32 -0
- package/dist/Radio-BYWz1n7p.d.ts +32 -0
- package/dist/SelectTrigger-By0iPBI3.d.cts +78 -0
- package/dist/SelectTrigger-By0iPBI3.d.ts +78 -0
- package/dist/accordion.cjs +322 -0
- package/dist/accordion.d.cts +156 -0
- package/dist/accordion.d.ts +156 -0
- package/dist/accordion.js +2 -0
- package/dist/apps-ui.umd.js +1 -0
- package/dist/button.cjs +366 -0
- package/dist/button.d.cts +52 -0
- package/dist/button.d.ts +52 -0
- package/dist/button.js +3 -0
- package/dist/checkbox.cjs +74 -0
- package/dist/checkbox.d.cts +63 -0
- package/dist/checkbox.d.ts +63 -0
- package/dist/checkbox.js +2 -0
- package/dist/chunk-3RU7JMFE.js +27 -0
- package/dist/chunk-5TWRK4NW.js +783 -0
- package/dist/chunk-7EOSDFS3.js +9 -0
- package/dist/chunk-AIQ4UOGK.js +142 -0
- package/dist/chunk-B3MMGTPV.js +200 -0
- package/dist/chunk-DAHQYLUI.js +146 -0
- package/dist/chunk-DGBXADSS.js +1 -0
- package/dist/chunk-E6KPNTWW.js +295 -0
- package/dist/chunk-EOAB6G2D.js +149 -0
- package/dist/chunk-FAOVKDVM.js +32 -0
- package/dist/chunk-FV76Z4Z2.js +78 -0
- package/dist/chunk-GLTLBUZ7.js +285 -0
- package/dist/chunk-GTZFV43T.js +154 -0
- package/dist/chunk-HRGZNL4A.js +88 -0
- package/dist/chunk-IEVN3J2F.js +98 -0
- package/dist/chunk-IRS3T6LF.js +352 -0
- package/dist/chunk-IYYHCQXG.js +146 -0
- package/dist/chunk-JIXW3455.js +89 -0
- package/dist/chunk-N4VAP2GB.js +77 -0
- package/dist/chunk-SJ2ZRYVV.js +167 -0
- package/dist/chunk-SNU4YXOR.js +66 -0
- package/dist/chunk-TT6JQATV.js +99 -0
- package/dist/chunk-UPQ3ZPCO.js +66 -0
- package/dist/chunk-UVUSVFOH.js +264 -0
- package/dist/chunk-WJFPGGJB.js +255 -0
- package/dist/chunk-WXEBQA7A.js +371 -0
- package/dist/chunk-Y2O4YYZQ.js +184 -0
- package/dist/cut-corner.cjs +111 -0
- package/dist/cut-corner.d.cts +49 -0
- package/dist/cut-corner.d.ts +49 -0
- package/dist/cut-corner.js +1 -0
- package/dist/dialog.cjs +441 -0
- package/dist/dialog.d.cts +240 -0
- package/dist/dialog.d.ts +240 -0
- package/dist/dialog.js +3 -0
- package/dist/feature-card.cjs +182 -0
- package/dist/feature-card.d.cts +54 -0
- package/dist/feature-card.d.ts +54 -0
- package/dist/feature-card.js +2 -0
- package/dist/filter.cjs +873 -0
- package/dist/filter.d.cts +129 -0
- package/dist/filter.d.ts +129 -0
- package/dist/filter.js +6 -0
- package/dist/index.cjs +4583 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +27 -0
- package/dist/inline-select.cjs +856 -0
- package/dist/inline-select.d.cts +92 -0
- package/dist/inline-select.d.ts +92 -0
- package/dist/inline-select.js +6 -0
- package/dist/input.cjs +263 -0
- package/dist/input.d.cts +157 -0
- package/dist/input.d.ts +157 -0
- package/dist/input.js +4 -0
- package/dist/panel.cjs +185 -0
- package/dist/panel.d.cts +103 -0
- package/dist/panel.d.ts +103 -0
- package/dist/panel.js +2 -0
- package/dist/property-grid.cjs +110 -0
- package/dist/property-grid.d.cts +56 -0
- package/dist/property-grid.d.ts +56 -0
- package/dist/property-grid.js +2 -0
- package/dist/radio.cjs +74 -0
- package/dist/radio.d.cts +39 -0
- package/dist/radio.d.ts +39 -0
- package/dist/radio.js +2 -0
- package/dist/scrollbar.cjs +34 -0
- package/dist/scrollbar.d.cts +35 -0
- package/dist/scrollbar.d.ts +35 -0
- package/dist/scrollbar.js +1 -0
- package/dist/search-bar.cjs +408 -0
- package/dist/search-bar.d.cts +42 -0
- package/dist/search-bar.d.ts +42 -0
- package/dist/search-bar.js +4 -0
- package/dist/select.cjs +998 -0
- package/dist/select.d.cts +357 -0
- package/dist/select.d.ts +357 -0
- package/dist/select.js +5 -0
- package/dist/selectable-feature-card.cjs +159 -0
- package/dist/selectable-feature-card.d.cts +74 -0
- package/dist/selectable-feature-card.d.ts +74 -0
- package/dist/selectable-feature-card.js +3 -0
- package/dist/sidebar-item.cjs +175 -0
- package/dist/sidebar-item.d.cts +75 -0
- package/dist/sidebar-item.d.ts +75 -0
- package/dist/sidebar-item.js +2 -0
- package/dist/switch.cjs +86 -0
- package/dist/switch.d.cts +72 -0
- package/dist/switch.d.ts +72 -0
- package/dist/switch.js +2 -0
- package/dist/table-cell.cjs +196 -0
- package/dist/table-cell.d.cts +76 -0
- package/dist/table-cell.d.ts +76 -0
- package/dist/table-cell.js +2 -0
- package/dist/table-title.cjs +34 -0
- package/dist/table-title.d.cts +16 -0
- package/dist/table-title.d.ts +16 -0
- package/dist/table-title.js +2 -0
- package/dist/tabs.cjs +299 -0
- package/dist/tabs.d.cts +116 -0
- package/dist/tabs.d.ts +116 -0
- package/dist/tabs.js +2 -0
- package/dist/toast.cjs +87 -0
- package/dist/toast.d.cts +48 -0
- package/dist/toast.d.ts +48 -0
- package/dist/toast.js +2 -0
- package/dist/token-input.cjs +415 -0
- package/dist/token-input.d.cts +90 -0
- package/dist/token-input.d.ts +90 -0
- package/dist/token-input.js +3 -0
- package/dist/tooltip.cjs +384 -0
- package/dist/tooltip.d.cts +142 -0
- package/dist/tooltip.d.ts +142 -0
- package/dist/tooltip.js +2 -0
- package/package.json +200 -0
- package/src/fonts.css +33 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { inputVariants } from './chunk-IEVN3J2F.js';
|
|
2
|
+
import { cn } from './chunk-7EOSDFS3.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { WarningIcon, InfoIcon } from '@phosphor-icons/react';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
function Input({
|
|
8
|
+
className,
|
|
9
|
+
fieldClassName,
|
|
10
|
+
wrapperClassName,
|
|
11
|
+
variation = "field",
|
|
12
|
+
size = "lg",
|
|
13
|
+
error = false,
|
|
14
|
+
// LINE-only bottom-line toggle. Destructured OUT of `props` so it never
|
|
15
|
+
// spreads onto the native <input> (invalid DOM attribute → React warning).
|
|
16
|
+
showBottomLine = true,
|
|
17
|
+
label,
|
|
18
|
+
optional = false,
|
|
19
|
+
hint,
|
|
20
|
+
leftSlot,
|
|
21
|
+
rightSlot,
|
|
22
|
+
disabled,
|
|
23
|
+
id: idProp,
|
|
24
|
+
ref,
|
|
25
|
+
...props
|
|
26
|
+
}) {
|
|
27
|
+
const generatedId = React.useId();
|
|
28
|
+
const id = idProp ?? generatedId;
|
|
29
|
+
const hintId = hint ? `${id}-hint` : void 0;
|
|
30
|
+
const iconStateClass = cn(
|
|
31
|
+
error ? "text-input-destructive-foreground-accent" : "text-input-foreground",
|
|
32
|
+
disabled && "text-input-foreground-muted"
|
|
33
|
+
);
|
|
34
|
+
const HintIcon = error ? WarningIcon : InfoIcon;
|
|
35
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1.5", wrapperClassName), children: [
|
|
36
|
+
label != null && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
37
|
+
/* @__PURE__ */ jsx(
|
|
38
|
+
"label",
|
|
39
|
+
{
|
|
40
|
+
htmlFor: id,
|
|
41
|
+
"data-slot": "input-label",
|
|
42
|
+
className: cn(
|
|
43
|
+
"caption-03-medium uppercase",
|
|
44
|
+
error ? "text-input-destructive-foreground-accent" : "text-input-foreground",
|
|
45
|
+
disabled && "text-input-foreground-muted"
|
|
46
|
+
),
|
|
47
|
+
children: label
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
optional && /* @__PURE__ */ jsx(
|
|
51
|
+
"span",
|
|
52
|
+
{
|
|
53
|
+
"data-slot": "input-optional",
|
|
54
|
+
className: "body-04 text-input-foreground-muted",
|
|
55
|
+
children: "Optional"
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
] }),
|
|
59
|
+
/* @__PURE__ */ jsxs(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
"data-slot": "input-field",
|
|
63
|
+
"data-variation": variation,
|
|
64
|
+
"data-error": error || void 0,
|
|
65
|
+
className: cn(
|
|
66
|
+
inputVariants({ variation, size, error, showBottomLine }),
|
|
67
|
+
// Icon slots inherit the shared state colour; 16px default size.
|
|
68
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
69
|
+
iconStateClass,
|
|
70
|
+
fieldClassName
|
|
71
|
+
),
|
|
72
|
+
children: [
|
|
73
|
+
leftSlot != null && /* @__PURE__ */ jsx(
|
|
74
|
+
"span",
|
|
75
|
+
{
|
|
76
|
+
"data-slot": "input-leading",
|
|
77
|
+
"aria-hidden": "true",
|
|
78
|
+
className: "flex items-center",
|
|
79
|
+
children: leftSlot
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
"input",
|
|
84
|
+
{
|
|
85
|
+
id,
|
|
86
|
+
"data-slot": "input",
|
|
87
|
+
disabled,
|
|
88
|
+
"aria-invalid": error || void 0,
|
|
89
|
+
"aria-describedby": hintId,
|
|
90
|
+
className: cn(
|
|
91
|
+
// Typography (Figma `body-03`) + fill the row. `min-w-0` lets the
|
|
92
|
+
// input shrink inside the flex row instead of overflowing.
|
|
93
|
+
"body-03 w-full min-w-0 bg-transparent outline-none",
|
|
94
|
+
// Typed text + caret colour (Figma `input-foreground-accent`).
|
|
95
|
+
"text-input-foreground-accent caret-input-foreground-accent",
|
|
96
|
+
// Placeholder colour (Figma `input-foreground-muted`).
|
|
97
|
+
"placeholder:text-input-foreground-muted",
|
|
98
|
+
// Disabled text goes muted; keep the not-allowed cursor.
|
|
99
|
+
"disabled:cursor-not-allowed disabled:text-input-foreground-muted",
|
|
100
|
+
className
|
|
101
|
+
),
|
|
102
|
+
ref,
|
|
103
|
+
...props
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
rightSlot != null && // NOT aria-hidden: the trailing slot may host an interactive control
|
|
107
|
+
// (e.g. SearchBar's clear button) that must stay reachable by AT +
|
|
108
|
+
// keyboard, and a focusable element inside aria-hidden is an ARIA
|
|
109
|
+
// violation. Decorative bare-<svg> icons are silent to AT on their own
|
|
110
|
+
// (no role / no accessible name), so dropping aria-hidden here does not
|
|
111
|
+
// make them announced. The leading slot stays decorative (aria-hidden).
|
|
112
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "input-trailing", className: "flex items-center", children: rightSlot })
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
hint != null && /* @__PURE__ */ jsxs(
|
|
117
|
+
"p",
|
|
118
|
+
{
|
|
119
|
+
id: hintId,
|
|
120
|
+
"data-slot": "input-hint",
|
|
121
|
+
className: cn(
|
|
122
|
+
"body-04 flex items-center gap-1",
|
|
123
|
+
error ? "text-input-destructive-foreground-accent" : "text-input-foreground",
|
|
124
|
+
disabled && "text-input-foreground-muted"
|
|
125
|
+
),
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ jsx(
|
|
128
|
+
HintIcon,
|
|
129
|
+
{
|
|
130
|
+
"aria-hidden": "true",
|
|
131
|
+
weight: "regular",
|
|
132
|
+
className: "size-4 shrink-0"
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
hint
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
] });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export { Input };
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { useSelectListbox, SelectListbox } from './chunk-5TWRK4NW.js';
|
|
2
|
+
import { cn } from './chunk-7EOSDFS3.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { CaretUpIcon, CaretDownIcon } from '@phosphor-icons/react';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
6
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var filterTriggerVariants = cva(
|
|
9
|
+
[
|
|
10
|
+
// Layout — chip row: label + optional badge + caret, 6px gap (spacing/1-5).
|
|
11
|
+
"inline-flex h-10 w-fit shrink-0 items-center gap-1.5",
|
|
12
|
+
"rounded-sm px-3",
|
|
13
|
+
"cursor-pointer text-left align-middle transition-colors",
|
|
14
|
+
// Surface — card/neutral/primary (the `neutral` segment is stripped in the
|
|
15
|
+
// token name transform → `card-primary-*`).
|
|
16
|
+
"bg-card-primary-background border border-card-primary-border",
|
|
17
|
+
// System focus ring (ADR-0010/0014). `outline-solid` restores the style the
|
|
18
|
+
// base `outline-none` zeroed (TW4 gotcha) so the 2px ring actually paints.
|
|
19
|
+
"outline-none",
|
|
20
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",
|
|
21
|
+
// Decorative svgs (caret) never intercept the click and keep explicit sizes.
|
|
22
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
23
|
+
],
|
|
24
|
+
{
|
|
25
|
+
variants: {
|
|
26
|
+
disabled: {
|
|
27
|
+
// Muted + not-allowed; the ring is suppressed (a disabled control is not
|
|
28
|
+
// focusable, but belt-and-braces if a consumer forces focus).
|
|
29
|
+
true: "cursor-not-allowed focus-visible:outline-none",
|
|
30
|
+
false: ""
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
defaultVariants: {
|
|
34
|
+
disabled: false
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
var filterCountBadgeVariants = cva([
|
|
39
|
+
"inline-flex h-5 min-w-5 items-center justify-center px-0.5",
|
|
40
|
+
"rounded-xs bg-brand-primary-background",
|
|
41
|
+
// `body-04` = the Figma badge text style (Archivo Regular 12/16) — NOT
|
|
42
|
+
// a `caption-*` utility (those render Chakra Petch, `font-caption`).
|
|
43
|
+
"body-04 text-brand-primary-foreground"
|
|
44
|
+
]);
|
|
45
|
+
function FilterTrigger({
|
|
46
|
+
displayText,
|
|
47
|
+
count = 0,
|
|
48
|
+
open = false,
|
|
49
|
+
disabled = false,
|
|
50
|
+
id,
|
|
51
|
+
className,
|
|
52
|
+
ref,
|
|
53
|
+
...props
|
|
54
|
+
}) {
|
|
55
|
+
const Caret = open ? CaretUpIcon : CaretDownIcon;
|
|
56
|
+
const caretColor = disabled ? "text-card-primary-foreground-muted" : open ? "text-card-primary-foreground" : "text-card-primary-foreground-muted group-hover:text-card-primary-foreground";
|
|
57
|
+
return /* @__PURE__ */ jsxs(
|
|
58
|
+
"button",
|
|
59
|
+
{
|
|
60
|
+
type: "button",
|
|
61
|
+
id,
|
|
62
|
+
ref,
|
|
63
|
+
role: "combobox",
|
|
64
|
+
"data-slot": "filter-trigger",
|
|
65
|
+
"data-open": open || void 0,
|
|
66
|
+
disabled,
|
|
67
|
+
className: cn("group", filterTriggerVariants({ disabled }), className),
|
|
68
|
+
...props,
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
"span",
|
|
72
|
+
{
|
|
73
|
+
"data-slot": "filter-label",
|
|
74
|
+
className: cn(
|
|
75
|
+
"body-03 truncate",
|
|
76
|
+
disabled ? "text-card-primary-foreground-muted" : "text-card-primary-foreground"
|
|
77
|
+
),
|
|
78
|
+
children: displayText
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
count > 0 && /* @__PURE__ */ jsx(
|
|
82
|
+
"span",
|
|
83
|
+
{
|
|
84
|
+
"data-slot": "filter-count",
|
|
85
|
+
"aria-hidden": "true",
|
|
86
|
+
className: filterCountBadgeVariants(),
|
|
87
|
+
children: count
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
"span",
|
|
92
|
+
{
|
|
93
|
+
"data-slot": "filter-caret",
|
|
94
|
+
"aria-hidden": "true",
|
|
95
|
+
className: "flex items-center",
|
|
96
|
+
children: /* @__PURE__ */ jsx(
|
|
97
|
+
Caret,
|
|
98
|
+
{
|
|
99
|
+
weight: "fill",
|
|
100
|
+
className: cn("size-3 transition-transform", caretColor)
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
function Filter({
|
|
110
|
+
options,
|
|
111
|
+
value: valueProp,
|
|
112
|
+
defaultValue,
|
|
113
|
+
onValueChange,
|
|
114
|
+
multiple = false,
|
|
115
|
+
label,
|
|
116
|
+
disabled,
|
|
117
|
+
id: idProp,
|
|
118
|
+
className,
|
|
119
|
+
ref,
|
|
120
|
+
...props
|
|
121
|
+
}) {
|
|
122
|
+
const generatedId = React.useId();
|
|
123
|
+
const id = idProp ?? generatedId;
|
|
124
|
+
const {
|
|
125
|
+
selected,
|
|
126
|
+
open,
|
|
127
|
+
setTriggerRef,
|
|
128
|
+
triggerProps,
|
|
129
|
+
listboxProps,
|
|
130
|
+
reset,
|
|
131
|
+
text
|
|
132
|
+
} = useSelectListbox({
|
|
133
|
+
options,
|
|
134
|
+
value: valueProp,
|
|
135
|
+
defaultValue,
|
|
136
|
+
onValueChange,
|
|
137
|
+
multiple,
|
|
138
|
+
disabled,
|
|
139
|
+
// Filter's dropdown persists after a pick (single stays open like multi).
|
|
140
|
+
closeOnSelect: false,
|
|
141
|
+
id,
|
|
142
|
+
ref,
|
|
143
|
+
// The single-select empty state shows the filter `label`, not a generic
|
|
144
|
+
// "Select" placeholder — so `selectTriggerLabel`'s placeholder IS `label`.
|
|
145
|
+
// (In multi the trigger text is always `label` regardless — see below.)
|
|
146
|
+
placeholder: label
|
|
147
|
+
});
|
|
148
|
+
const displayText = multiple ? label : text;
|
|
149
|
+
const count = multiple ? selected.length : 0;
|
|
150
|
+
const canReset = selected.length > 0;
|
|
151
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
152
|
+
/* @__PURE__ */ jsx(
|
|
153
|
+
FilterTrigger,
|
|
154
|
+
{
|
|
155
|
+
ref: setTriggerRef,
|
|
156
|
+
id,
|
|
157
|
+
displayText,
|
|
158
|
+
count,
|
|
159
|
+
open,
|
|
160
|
+
disabled,
|
|
161
|
+
"aria-label": label,
|
|
162
|
+
className,
|
|
163
|
+
...triggerProps,
|
|
164
|
+
...props
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
open && /* @__PURE__ */ jsx(
|
|
168
|
+
SelectListbox,
|
|
169
|
+
{
|
|
170
|
+
...listboxProps,
|
|
171
|
+
widthMode: "auto",
|
|
172
|
+
"aria-label": label,
|
|
173
|
+
footer: /* @__PURE__ */ jsx(
|
|
174
|
+
"button",
|
|
175
|
+
{
|
|
176
|
+
type: "button",
|
|
177
|
+
"data-slot": "filter-reset",
|
|
178
|
+
disabled: !canReset,
|
|
179
|
+
onClick: () => {
|
|
180
|
+
if (canReset) reset();
|
|
181
|
+
},
|
|
182
|
+
className: cn(
|
|
183
|
+
// A ghost button styled as `button/neutral/secondary`
|
|
184
|
+
// (`button-secondary-*`): foreground when enabled, muted when
|
|
185
|
+
// disabled. System focus ring (ADR-0010/0014) — `outline-solid`
|
|
186
|
+
// beside `outline-2` so it actually paints (TW4 gotcha).
|
|
187
|
+
"button-01 inline-flex h-8 items-center rounded-xs bg-transparent",
|
|
188
|
+
"outline-none transition-colors",
|
|
189
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",
|
|
190
|
+
canReset ? "cursor-pointer text-button-secondary-foreground hover:text-button-secondary-foreground-accent" : "cursor-not-allowed text-button-secondary-foreground-muted"
|
|
191
|
+
),
|
|
192
|
+
children: "Reset"
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
] });
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export { Filter, FilterTrigger, filterCountBadgeVariants, filterTriggerVariants };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { cn } from './chunk-7EOSDFS3.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var sidebarItemVariants = cva(
|
|
7
|
+
[
|
|
8
|
+
"group flex h-9 w-full items-center rounded-xs border-l-2 border-transparent px-3",
|
|
9
|
+
"no-underline transition-colors outline-none"
|
|
10
|
+
],
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
active: {
|
|
14
|
+
true: "bg-brand-background border-brand-border",
|
|
15
|
+
false: ""
|
|
16
|
+
},
|
|
17
|
+
interactive: {
|
|
18
|
+
true: [
|
|
19
|
+
"cursor-pointer",
|
|
20
|
+
// Ring only — no fill/text change on focus (see file docstring).
|
|
21
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-focus"
|
|
22
|
+
],
|
|
23
|
+
false: ""
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
compoundVariants: [
|
|
27
|
+
// Hover fill only on a non-active, interactive item.
|
|
28
|
+
{ active: false, interactive: true, class: "hover:bg-background" }
|
|
29
|
+
],
|
|
30
|
+
defaultVariants: { active: false, interactive: false }
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
var sidebarItemLabelVariants = cva(
|
|
34
|
+
["button-01 min-w-0 flex-1 truncate"],
|
|
35
|
+
{
|
|
36
|
+
variants: {
|
|
37
|
+
active: {
|
|
38
|
+
true: "text-brand-foreground",
|
|
39
|
+
false: "text-foreground-muted"
|
|
40
|
+
},
|
|
41
|
+
interactive: { true: "", false: "" }
|
|
42
|
+
},
|
|
43
|
+
compoundVariants: [
|
|
44
|
+
{
|
|
45
|
+
active: false,
|
|
46
|
+
interactive: true,
|
|
47
|
+
class: "group-hover:text-foreground"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
defaultVariants: { active: false, interactive: false }
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
function setRef(ref, node) {
|
|
54
|
+
if (typeof ref === "function") ref(node);
|
|
55
|
+
else if (ref) ref.current = node;
|
|
56
|
+
}
|
|
57
|
+
function SidebarItem({
|
|
58
|
+
active = false,
|
|
59
|
+
asChild = false,
|
|
60
|
+
href,
|
|
61
|
+
className,
|
|
62
|
+
children,
|
|
63
|
+
ref,
|
|
64
|
+
...props
|
|
65
|
+
}) {
|
|
66
|
+
const interactive = asChild || href != null;
|
|
67
|
+
const rootClassName = cn(
|
|
68
|
+
sidebarItemVariants({ active, interactive }),
|
|
69
|
+
className
|
|
70
|
+
);
|
|
71
|
+
const label = (labelNode) => /* @__PURE__ */ jsx(
|
|
72
|
+
"span",
|
|
73
|
+
{
|
|
74
|
+
"data-slot": "sidebar-item-label",
|
|
75
|
+
className: sidebarItemLabelVariants({ active, interactive }),
|
|
76
|
+
children: labelNode
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
const dataState = active ? "active" : void 0;
|
|
80
|
+
const ariaCurrent = active ? "page" : void 0;
|
|
81
|
+
if (asChild) {
|
|
82
|
+
if (!React.isValidElement(children)) {
|
|
83
|
+
throw new Error(
|
|
84
|
+
"SidebarItem: `asChild` requires a single React element child"
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
const child = children;
|
|
88
|
+
const childProps = child.props;
|
|
89
|
+
return React.cloneElement(
|
|
90
|
+
child,
|
|
91
|
+
{
|
|
92
|
+
...props,
|
|
93
|
+
...childProps,
|
|
94
|
+
"data-slot": "sidebar-item",
|
|
95
|
+
"data-state": dataState,
|
|
96
|
+
"aria-current": ariaCurrent,
|
|
97
|
+
className: cn(
|
|
98
|
+
rootClassName,
|
|
99
|
+
childProps.className
|
|
100
|
+
),
|
|
101
|
+
ref: (node) => {
|
|
102
|
+
setRef(ref, node);
|
|
103
|
+
setRef(childProps.ref, node);
|
|
104
|
+
},
|
|
105
|
+
onClick: (event) => {
|
|
106
|
+
props.onClick?.(event);
|
|
107
|
+
childProps.onClick?.(event);
|
|
108
|
+
},
|
|
109
|
+
style: {
|
|
110
|
+
...props.style,
|
|
111
|
+
...childProps.style
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
label(childProps.children)
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
if (href != null) {
|
|
118
|
+
return /* @__PURE__ */ jsx(
|
|
119
|
+
"a",
|
|
120
|
+
{
|
|
121
|
+
"data-slot": "sidebar-item",
|
|
122
|
+
"data-state": dataState,
|
|
123
|
+
"aria-current": ariaCurrent,
|
|
124
|
+
href,
|
|
125
|
+
className: rootClassName,
|
|
126
|
+
ref,
|
|
127
|
+
...props,
|
|
128
|
+
children: label(children)
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
return /* @__PURE__ */ jsx(
|
|
133
|
+
"div",
|
|
134
|
+
{
|
|
135
|
+
"data-slot": "sidebar-item",
|
|
136
|
+
"data-state": dataState,
|
|
137
|
+
"aria-current": ariaCurrent,
|
|
138
|
+
className: rootClassName,
|
|
139
|
+
ref,
|
|
140
|
+
...props,
|
|
141
|
+
children: label(children)
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export { SidebarItem, sidebarItemLabelVariants, sidebarItemVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|