@gears-frontx/ui-kit 0.3.0-alpha.1 → 0.3.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/badge.js +39 -19
- package/dist/badge.js.map +1 -1
- package/dist/button.js +40 -40
- package/dist/button.js.map +1 -1
- package/dist/checkbox.js +5 -5
- package/dist/chunks/badge.BcdxDzJ7.css +1 -0
- package/dist/chunks/button.DNo8DTR3.css +1 -0
- package/dist/chunks/checkbox.D3kdAalh.css +1 -0
- package/dist/chunks/input.C8RDCC-a.css +1 -0
- package/dist/chunks/radio-group.zAFY9yCF.css +1 -0
- package/dist/chunks/select.Dt0diN4P.css +1 -0
- package/dist/chunks/switch.CsaIRnCA.css +1 -0
- package/dist/chunks/{table.r8ppNt1W.css → table.BuWHXL6e.css} +1 -1
- package/dist/chunks/tabs.KEksCAxN.css +1 -0
- package/dist/chunks/{textarea.BKWvs6fD.css → textarea.N3iiWUuz.css} +1 -1
- package/dist/chunks/toast.DMUpK07T.css +1 -0
- package/dist/components/badge/badge.d.ts +14 -2
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/input/input.d.ts +17 -1
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/docs/badge.md +22 -8
- package/dist/docs/button.md +43 -8
- package/dist/docs/input.md +32 -6
- package/dist/docs/select.md +13 -9
- package/dist/input.js +27 -21
- package/dist/input.js.map +1 -1
- package/dist/radio-group.js +8 -8
- package/dist/select.js +57 -65
- package/dist/select.js.map +1 -1
- package/dist/switch.js +8 -8
- package/dist/table.js +33 -33
- package/dist/tabs.js +20 -20
- package/dist/textarea.js +4 -4
- package/dist/theme.css +31 -6
- package/dist/toast.js +60 -60
- package/llms.txt +26 -17
- package/package.json +1 -1
- package/dist/chunks/badge.ej-3-Xs4.css +0 -1
- package/dist/chunks/button.CKfALaMe.css +0 -1
- package/dist/chunks/checkbox.Dd6YDr20.css +0 -1
- package/dist/chunks/input.CrRQ0OAn.css +0 -1
- package/dist/chunks/radio-group.1Y6B0lXt.css +0 -1
- package/dist/chunks/select.BmyP2S2q.css +0 -1
- package/dist/chunks/switch.B_ebMSxR.css +0 -1
- package/dist/chunks/tabs.DqJE9cX3.css +0 -1
- package/dist/chunks/toast.DMl31Mq4.css +0 -1
package/dist/docs/button.md
CHANGED
|
@@ -36,6 +36,42 @@ polymorphism, correct disabled/focus behavior, `type="button"` by default
|
|
|
36
36
|
All other props are native `<button>` props (`onClick`, `disabled`, `type`,
|
|
37
37
|
`aria-*`, ...) and are forwarded as-is.
|
|
38
38
|
|
|
39
|
+
## Custom colors
|
|
40
|
+
|
|
41
|
+
Variant colors are consumed through CSS custom properties, so a one-off
|
|
42
|
+
brand/status button is a consumer class away — no new variant needed:
|
|
43
|
+
|
|
44
|
+
| Property | Drives |
|
|
45
|
+
|----------|--------|
|
|
46
|
+
| `--button-bg` / `--button-fg` | fill / text at rest |
|
|
47
|
+
| `--button-bg-hover` / `--button-fg-hover` | fill / text on hover |
|
|
48
|
+
| `--button-border` | border color on every variant (transparent by default outside `outline`) |
|
|
49
|
+
|
|
50
|
+
```css
|
|
51
|
+
.buy { --button-bg: var(--success); --button-bg-hover: color-mix(in oklab, var(--success) 90%, var(--foreground) 10%); --button-fg: var(--primary-foreground); }
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
<Button className={styles.buy}>Buy now</Button>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Setting only `--button-bg` keeps the button that color in EVERY state
|
|
59
|
+
(hover falls back to your rest color, never back to the variant's token);
|
|
60
|
+
add `--button-bg-hover` to restore hover feedback. Contrast is yours to
|
|
61
|
+
keep once you override: check your pairs against WCAG like the kit does
|
|
62
|
+
for its own variants, and give the focus ring the same care via
|
|
63
|
+
`--button-focus-ring` (see Anti-patterns) — it is drawn outside the button
|
|
64
|
+
as an `outline`, so only one tone is needed; it only ever borders the page
|
|
65
|
+
background, never your custom fill.
|
|
66
|
+
|
|
67
|
+
These properties are inherited custom properties and `.button` never resets
|
|
68
|
+
them, so where you set them matters: on the button's own class (`.buy`
|
|
69
|
+
above) it recolors that one button; on a container it themes every Button
|
|
70
|
+
underneath, including ones you didn't mean to touch — a clear button
|
|
71
|
+
sitting in an Input's `end` slot inside that container, for instance. Use
|
|
72
|
+
container-level scoping deliberately, or scope to the button itself to
|
|
73
|
+
avoid the surprise.
|
|
74
|
+
|
|
39
75
|
Icon-only is derived, not a size: `icon` with no children renders a square
|
|
40
76
|
button of the current `size`. There is no `size="icon"`.
|
|
41
77
|
|
|
@@ -83,14 +119,13 @@ import { Button } from '@gears-frontx/ui-kit';
|
|
|
83
119
|
|
|
84
120
|
## Anti-patterns
|
|
85
121
|
|
|
86
|
-
- Do not restyle via inline `style` or ad-hoc CSS
|
|
87
|
-
the theme tokens (`theme.css`
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
properties together when rebranding either variant's ring.
|
|
122
|
+
- Do not restyle via inline `style` or ad-hoc CSS rules against the kit's
|
|
123
|
+
classes — kit-wide brand changes belong in the theme tokens (`theme.css`
|
|
124
|
+
CSS variables), one-off button colors in the `--button-*` properties
|
|
125
|
+
above. If you rebrand the focus ring specifically via
|
|
126
|
+
`--button-focus-ring`, check your color against WCAG 1.4.11's 3:1 floor
|
|
127
|
+
on `--background` — the only surface the ring touches, since it is drawn
|
|
128
|
+
outside the button as an `outline` rather than on its edge.
|
|
94
129
|
- Do not put an icon in `children` next to text — it lands in the `icon`
|
|
95
130
|
slot, which is what sizes it, spaces it, hides it during `loading`, and
|
|
96
131
|
keeps it out of the accessible name.
|
package/dist/docs/input.md
CHANGED
|
@@ -23,16 +23,34 @@ error, validation state) when rendered inside one.
|
|
|
23
23
|
|------|------|---------|
|
|
24
24
|
| `value` / `defaultValue` | controlled / uncontrolled value | — |
|
|
25
25
|
| `onValueChange` | `(value: string, eventDetails) => void` — fires on every change | — |
|
|
26
|
+
| `icon` | `ReactNode` — leading icon slot, decorative (`aria-hidden`, no pointer events); pair with the right native `type` for semantics | — |
|
|
27
|
+
| `end` | `ReactNode` — trailing slot for live content (icon-button, adornment); rendered after the input, sized for an icon or a compact `size="sm"` icon-only Button | — |
|
|
26
28
|
| `className` | `string` — merged after the kit class | — |
|
|
27
29
|
|
|
28
30
|
All other props are native `<input>` props (`type`, `placeholder`,
|
|
29
31
|
`disabled`, `required`, `aria-invalid`, ...) and are forwarded as-is.
|
|
30
32
|
`aria-invalid` switches the border and ring to the destructive color.
|
|
31
33
|
|
|
32
|
-
`
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
Icons are explicit: `icon` draws a leading icon inside the field (via a
|
|
35
|
+
presentational wrapper the component adds only when a slot is present),
|
|
36
|
+
`end` overlays trailing content such as a clear button. Semantics still
|
|
37
|
+
come from the native `type` — a search field is `type="search"` (searchbox
|
|
38
|
+
role) plus a magnifier passed to `icon`; nothing renders automatically.
|
|
39
|
+
A disabled input dims its `icon` and `end` slots too (0.42 opacity) — a
|
|
40
|
+
clear button left in `end` doesn't stay visually live just because it isn't
|
|
41
|
+
the native control. That dimming fires regardless of *why* the input is
|
|
42
|
+
disabled (the direct `disabled` prop or a `<Field disabled>` ancestor both
|
|
43
|
+
land on the real `<input>`). Removing `end`'s tab stop is a separate fix
|
|
44
|
+
and only covers the direct prop: passing `disabled` straight to `Input`
|
|
45
|
+
also sets `inert` on the `end` wrapper, which drops it from the tab order
|
|
46
|
+
and blocks activation — the actual fix for a keyboard user, since dimming
|
|
47
|
+
alone (`pointer-events: none`) only disarms the mouse. A field disabled
|
|
48
|
+
through `<Field disabled>`'s context still dims `end`, but Input has no way
|
|
49
|
+
to observe that context-driven disable from its own props, so it cannot set
|
|
50
|
+
`inert` for that path — an interactive `end` slot under a `Field`-disabled
|
|
51
|
+
input stays dim yet still tabbable and clickable via keyboard activation.
|
|
52
|
+
Consumers composing `end` from a `Field` should disable their own
|
|
53
|
+
interactive `end` content directly rather than relying on this.
|
|
36
54
|
|
|
37
55
|
## Examples
|
|
38
56
|
|
|
@@ -42,8 +60,14 @@ import { Input } from '@gears-frontx/ui-kit';
|
|
|
42
60
|
// Uncontrolled with placeholder
|
|
43
61
|
<Input placeholder="Project name" />
|
|
44
62
|
|
|
45
|
-
// Search field
|
|
46
|
-
|
|
63
|
+
// Search field: the native type brings the searchbox role, the icon slot
|
|
64
|
+
// brings the magnifier, and `end` can hold a clear button
|
|
65
|
+
<Input
|
|
66
|
+
type="search"
|
|
67
|
+
placeholder="Search projects…"
|
|
68
|
+
icon={<MagnifierIcon />}
|
|
69
|
+
end={<Button variant="ghost" size="sm" icon={<CrossIcon />} aria-label="Clear" />}
|
|
70
|
+
/>
|
|
47
71
|
|
|
48
72
|
// Controlled
|
|
49
73
|
<Input value={email} onValueChange={setEmail} type="email" />
|
|
@@ -63,3 +87,5 @@ import { Input } from '@gears-frontx/ui-kit';
|
|
|
63
87
|
containers, colors to theme tokens.
|
|
64
88
|
- Do not build a labelled input by hand — the `Field` composition handles
|
|
65
89
|
label/error/description wiring.
|
|
90
|
+
- Do not put an interactive control in `icon` — that slot is aria-hidden
|
|
91
|
+
and pointer-transparent; live content goes in `end`.
|
package/dist/docs/select.md
CHANGED
|
@@ -6,7 +6,10 @@ form submission (hidden native input on the root) come from Base UI.
|
|
|
6
6
|
|
|
7
7
|
Composition: `Select` (root, holds the value) → `SelectTrigger` (+
|
|
8
8
|
`SelectValue` for the current label) → `SelectContent` → `SelectGroup` /
|
|
9
|
-
`SelectLabel` / `SelectItem` / `SelectSeparator`.
|
|
9
|
+
`SelectLabel` / `SelectItem` / `SelectSeparator`. `SelectGroup` is only for
|
|
10
|
+
labelled sections — it is optional; the dropdown's inner padding lives on
|
|
11
|
+
the list itself, not on the group, so items placed directly under
|
|
12
|
+
`SelectContent` are padded the same either way.
|
|
10
13
|
|
|
11
14
|
## When to use
|
|
12
15
|
|
|
@@ -35,12 +38,15 @@ raw value instead of the label until the popup has been opened once.
|
|
|
35
38
|
| `className` | `string` — merged after the kit class | — |
|
|
36
39
|
|
|
37
40
|
`SelectValue`: renders the selected item's label. Pass `placeholder`
|
|
38
|
-
directly to `SelectValue` (see example). `SelectContent`
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
directly to `SelectValue` (see example). `SelectContent` always opens the
|
|
42
|
+
list on its `side` (below the trigger by default) — it never overlays the
|
|
43
|
+
trigger the way a native `<select>` does. With no value selected the list
|
|
44
|
+
starts scrolled to the top; when the selected option is beyond the fold,
|
|
45
|
+
it is scrolled into view on open. `SelectContent` accepts positioning
|
|
46
|
+
props (`side`, `sideOffset`, `align`, `alignOffset`, plus the escape
|
|
47
|
+
hatch for triggers inside a `transform`/`filter` container:
|
|
48
|
+
`positionMethod="fixed"`, `collisionBoundary`, `collisionPadding`) and
|
|
49
|
+
`container` — the popup portals to `<body>`
|
|
44
50
|
by default, so if your theme lives on a subtree (`data-theme` on a
|
|
45
51
|
section instead of `<html>`), pass that section as `container` or the
|
|
46
52
|
popup renders with the root theme. `SelectItem` takes `value` (required) and
|
|
@@ -92,8 +98,6 @@ const REGIONS = [
|
|
|
92
98
|
|
|
93
99
|
## Anti-patterns
|
|
94
100
|
|
|
95
|
-
- Do not put items directly under `SelectContent` without a `SelectGroup`
|
|
96
|
-
— the group carries the list padding.
|
|
97
101
|
- Do not use a select for navigation — that is a menu/link pattern.
|
|
98
102
|
- Do not omit a placeholder or default value — an empty trigger gives the
|
|
99
103
|
user (and the agent) nothing to read.
|
package/dist/input.js
CHANGED
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Input as
|
|
3
|
-
import { cx as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as a, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { Input as d } from "@base-ui/react/input";
|
|
3
|
+
import { cx as u } from "class-variance-authority";
|
|
4
|
+
import { Children as e } from "react";
|
|
5
|
+
import './chunks/input.C8RDCC-a.css';const l = "_input_1v93o_6", I = "_wrap_1v93o_122", f = "_icon_1v93o_128", v = "_end_1v93o_143", E = "_hasIcon_1v93o_172", w = "_hasEnd_1v93o_178", n = {
|
|
6
|
+
input: l,
|
|
7
|
+
wrap: I,
|
|
8
|
+
icon: f,
|
|
9
|
+
end: v,
|
|
10
|
+
hasIcon: E,
|
|
11
|
+
hasEnd: w
|
|
9
12
|
};
|
|
10
|
-
function
|
|
11
|
-
const c = /* @__PURE__ */
|
|
12
|
-
|
|
13
|
+
function A({ className: _, icon: r, end: c, disabled: i, ...h }) {
|
|
14
|
+
const o = e.toArray(r).some((t) => t !== ""), s = e.toArray(c).some((t) => t !== ""), p = /* @__PURE__ */ a(
|
|
15
|
+
d,
|
|
13
16
|
{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
className: u(
|
|
18
|
+
n.input,
|
|
19
|
+
o && n.hasIcon,
|
|
20
|
+
s && n.hasEnd,
|
|
21
|
+
_
|
|
22
|
+
),
|
|
23
|
+
disabled: i,
|
|
24
|
+
...h
|
|
17
25
|
}
|
|
18
26
|
);
|
|
19
|
-
return
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
] }),
|
|
24
|
-
c
|
|
27
|
+
return !o && !s ? p : /* @__PURE__ */ m("span", { className: n.wrap, children: [
|
|
28
|
+
o && /* @__PURE__ */ a("span", { className: n.icon, "aria-hidden": "true", children: r }),
|
|
29
|
+
p,
|
|
30
|
+
s && /* @__PURE__ */ a("span", { className: n.end, inert: i, children: c })
|
|
25
31
|
] });
|
|
26
32
|
}
|
|
27
33
|
export {
|
|
28
|
-
|
|
34
|
+
A as Input
|
|
29
35
|
};
|
|
30
36
|
//# sourceMappingURL=input.js.map
|
package/dist/input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sources":["../src/components/input/input.tsx"],"sourcesContent":["import { Input as InputPrimitive } from '@base-ui/react/input';\nimport { cx } from 'class-variance-authority';\n\nimport styles from './input.module.css';\n\nexport interface InputProps extends Omit<InputPrimitive.Props, 'className'> {\n className?: string;\n
|
|
1
|
+
{"version":3,"file":"input.js","sources":["../src/components/input/input.tsx"],"sourcesContent":["import { Input as InputPrimitive } from '@base-ui/react/input';\nimport { cx } from 'class-variance-authority';\nimport { Children, type ReactNode } from 'react';\n\nimport styles from './input.module.css';\n\nexport interface InputProps extends Omit<InputPrimitive.Props, 'className'> {\n className?: string;\n /**\n * Leading icon slot — decorative only: rendered aria-hidden with pointer\n * events off, so it never carries the field's name or steals a click.\n * Semantics stay on the input itself — a search field is `type=\"search\"`\n * plus a magnifier passed here.\n */\n icon?: ReactNode;\n /**\n * Trailing slot for live content — an icon-button (clear, reveal\n * password) or a small static adornment. Rendered after the <input> in\n * the DOM, so tab order is field first, then slot. The input clears a\n * compact icon-button's width (32px, size=\"sm\") of end padding; anything\n * wider is the consumer's padding to extend.\n */\n end?: ReactNode;\n}\n\n/*\n * An <input> is a replaced element — no ::before to draw into, and a\n * background-image can't read the theme's color tokens — so the slots need\n * a presentational wrapper. Only a slotted input pays for it: with neither\n * prop this stays a bare <input>, and the consumer className stays on the\n * input either way, so styling targets the same element regardless. Field\n * wiring is unaffected — the primitive is still the control Field talks to.\n */\nexport function Input({ className, icon, end, disabled, ...props }: InputProps) {\n // `icon != null`/`end != null` are true for `icon={false}`/`end={false}` —\n // a valid ReactNode that renders nothing — which is exactly what\n // `icon={cond && <Icon/>}` passes when `cond` is false. Same predicate as\n // Button's `hasLabel`, applied to a slot instead of children: it answers\n // \"is this renderable\" rather than \"is this set\".\n const hasIcon = Children.toArray(icon).some((child) => child !== '');\n const hasEnd = Children.toArray(end).some((child) => child !== '');\n const input = (\n <InputPrimitive\n className={cx(\n styles.input,\n hasIcon && styles.hasIcon,\n hasEnd && styles.hasEnd,\n className,\n )}\n disabled={disabled}\n {...props}\n />\n );\n if (!hasIcon && !hasEnd) {\n return input;\n }\n return (\n <span className={styles.wrap}>\n {hasIcon && (\n <span className={styles.icon} aria-hidden=\"true\">\n {icon}\n </span>\n )}\n {input}\n {/*\n * `inert` removes `end` from the tab order and blocks activation —\n * dimming alone (see input.module.css) stops nothing for a keyboard\n * user, since a Button inside `end` keeps its tab stop and still\n * fires on Enter/Space. Only wired from this direct `disabled` prop:\n * a Field-driven disable (`<Field disabled>`) reaches the rendered\n * <input> through Base UI's own FieldControl, deeper than this\n * component's props, so it can't be observed here — see input.md.\n */}\n {hasEnd && (\n <span className={styles.end} inert={disabled}>\n {end}\n </span>\n )}\n </span>\n );\n}\n"],"names":["Input","className","icon","end","disabled","props","hasIcon","Children","child","hasEnd","input","jsx","InputPrimitive","cx","styles","jsxs"],"mappings":";;;;;;;;;;;;AAiCO,SAASA,EAAM,EAAE,WAAAC,GAAW,MAAAC,GAAM,KAAAC,GAAK,UAAAC,GAAU,GAAGC,KAAqB;AAM9E,QAAMC,IAAUC,EAAS,QAAQL,CAAI,EAAE,KAAK,CAACM,MAAUA,MAAU,EAAE,GAC7DC,IAASF,EAAS,QAAQJ,CAAG,EAAE,KAAK,CAACK,MAAUA,MAAU,EAAE,GAC3DE,IACJ,gBAAAC;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACTC,EAAO;AAAA,QACPR,KAAWQ,EAAO;AAAA,QAClBL,KAAUK,EAAO;AAAA,QACjBb;AAAA,MAAA;AAAA,MAEF,UAAAG;AAAA,MACC,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGR,SAAI,CAACC,KAAW,CAACG,IACRC,IAGP,gBAAAK,EAAC,QAAA,EAAK,WAAWD,EAAO,MACrB,UAAA;AAAA,IAAAR,uBACE,QAAA,EAAK,WAAWQ,EAAO,MAAM,eAAY,QACvC,UAAAZ,EAAA,CACH;AAAA,IAEDQ;AAAA,IAUAD,uBACE,QAAA,EAAK,WAAWK,EAAO,KAAK,OAAOV,GACjC,UAAAD,EAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;"}
|
package/dist/radio-group.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { Radio as
|
|
3
|
-
import { RadioGroup as
|
|
4
|
-
import { cx as
|
|
5
|
-
import './chunks/radio-group.
|
|
2
|
+
import { Radio as n } from "@base-ui/react/radio";
|
|
3
|
+
import { RadioGroup as c } from "@base-ui/react/radio-group";
|
|
4
|
+
import { cx as a } from "class-variance-authority";
|
|
5
|
+
import './chunks/radio-group.zAFY9yCF.css';const s = "_group_19jni_6", m = "_item_19jni_12", d = "_indicator_19jni_93", e = "_dot_19jni_101", i = {
|
|
6
6
|
group: s,
|
|
7
7
|
item: m,
|
|
8
8
|
indicator: d,
|
|
9
9
|
dot: e
|
|
10
10
|
};
|
|
11
|
-
function f({ className:
|
|
12
|
-
return /* @__PURE__ */ o(
|
|
11
|
+
function f({ className: t, ...r }) {
|
|
12
|
+
return /* @__PURE__ */ o(c, { className: a(i.group, t), ...r });
|
|
13
13
|
}
|
|
14
|
-
function R({ className:
|
|
15
|
-
return /* @__PURE__ */ o(
|
|
14
|
+
function R({ className: t, ...r }) {
|
|
15
|
+
return /* @__PURE__ */ o(n.Root, { className: a(i.item, t), ...r, children: /* @__PURE__ */ o(n.Indicator, { className: i.indicator, children: /* @__PURE__ */ o("span", { className: i.dot }) }) });
|
|
16
16
|
}
|
|
17
17
|
export {
|
|
18
18
|
f as RadioGroup,
|
package/dist/select.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
1
|
+
import { jsx as r, jsxs as c } from "react/jsx-runtime";
|
|
2
2
|
import { Select as n } from "@base-ui/react/select";
|
|
3
|
-
import { cx as
|
|
4
|
-
import './chunks/select.
|
|
5
|
-
trigger:
|
|
6
|
-
sizeDefault:
|
|
7
|
-
sizeSm:
|
|
8
|
-
variantDefault:
|
|
9
|
-
variantFilter:
|
|
10
|
-
triggerIcon:
|
|
11
|
-
value:
|
|
12
|
-
positioner:
|
|
13
|
-
popup:
|
|
14
|
-
|
|
3
|
+
import { cx as i, cva as f } from "class-variance-authority";
|
|
4
|
+
import './chunks/select.Dt0diN4P.css';const z = "_trigger_15wyz_6", v = "_sizeDefault_15wyz_9", S = "_sizeSm_15wyz_9", y = "_variantDefault_15wyz_102", I = "_variantFilter_15wyz_111", h = "_triggerIcon_15wyz_116", N = "_value_15wyz_122", A = "_positioner_15wyz_132", D = "_popup_15wyz_137", x = "_list_15wyz_151", L = "_group_15wyz_252", k = "_groupLabel_15wyz_256", T = "_item_15wyz_263", b = "_itemText_15wyz_306", U = "_itemIndicator_15wyz_269", j = "_separator_15wyz_337", B = "_scrollArrow_15wyz_151", C = "_scrollArrowUp_15wyz_377", F = "_scrollArrowDown_15wyz_381", V = "_svgIcon_15wyz_385", e = {
|
|
5
|
+
trigger: z,
|
|
6
|
+
sizeDefault: v,
|
|
7
|
+
sizeSm: S,
|
|
8
|
+
variantDefault: y,
|
|
9
|
+
variantFilter: I,
|
|
10
|
+
triggerIcon: h,
|
|
11
|
+
value: N,
|
|
12
|
+
positioner: A,
|
|
13
|
+
popup: D,
|
|
14
|
+
list: x,
|
|
15
|
+
group: L,
|
|
15
16
|
groupLabel: k,
|
|
16
17
|
item: T,
|
|
17
|
-
itemText:
|
|
18
|
-
itemIndicator:
|
|
19
|
-
separator:
|
|
20
|
-
scrollArrow:
|
|
21
|
-
scrollArrowUp:
|
|
22
|
-
scrollArrowDown:
|
|
23
|
-
svgIcon:
|
|
18
|
+
itemText: b,
|
|
19
|
+
itemIndicator: U,
|
|
20
|
+
separator: j,
|
|
21
|
+
scrollArrow: B,
|
|
22
|
+
scrollArrowUp: C,
|
|
23
|
+
scrollArrowDown: F,
|
|
24
|
+
svgIcon: V
|
|
24
25
|
};
|
|
25
26
|
function u({ direction: t, className: o }) {
|
|
26
27
|
return /* @__PURE__ */ r(
|
|
27
28
|
"svg",
|
|
28
29
|
{
|
|
29
|
-
className:
|
|
30
|
+
className: i(e.svgIcon, o),
|
|
30
31
|
viewBox: "0 0 24 24",
|
|
31
32
|
fill: "none",
|
|
32
33
|
stroke: "currentColor",
|
|
@@ -40,9 +41,9 @@ function u({ direction: t, className: o }) {
|
|
|
40
41
|
}
|
|
41
42
|
const q = n.Root;
|
|
42
43
|
function E({ className: t, ...o }) {
|
|
43
|
-
return /* @__PURE__ */ r(n.Value, { className:
|
|
44
|
+
return /* @__PURE__ */ r(n.Value, { className: i(e.value, t), ...o });
|
|
44
45
|
}
|
|
45
|
-
const
|
|
46
|
+
const G = f(e.trigger, {
|
|
46
47
|
variants: {
|
|
47
48
|
size: {
|
|
48
49
|
default: e.sizeDefault,
|
|
@@ -64,62 +65,53 @@ const P = v(e.trigger, {
|
|
|
64
65
|
variant: "default"
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
|
-
function H({ className: t, size: o, variant:
|
|
68
|
-
return /* @__PURE__ */
|
|
69
|
-
|
|
68
|
+
function H({ className: t, size: o, variant: s, children: l, ...a }) {
|
|
69
|
+
return /* @__PURE__ */ c(n.Trigger, { className: G({ size: o, variant: s, className: t }), ...a, children: [
|
|
70
|
+
l,
|
|
70
71
|
/* @__PURE__ */ r(n.Icon, { render: /* @__PURE__ */ r(u, { direction: "down", className: e.triggerIcon }) })
|
|
71
72
|
] });
|
|
72
73
|
}
|
|
73
74
|
function J({
|
|
74
75
|
className: t,
|
|
75
76
|
children: o,
|
|
76
|
-
container:
|
|
77
|
-
side:
|
|
78
|
-
sideOffset:
|
|
77
|
+
container: s,
|
|
78
|
+
side: l = "bottom",
|
|
79
|
+
sideOffset: a = 4,
|
|
79
80
|
align: _ = "center",
|
|
80
81
|
alignOffset: p = 0,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
...b
|
|
82
|
+
positionMethod: m,
|
|
83
|
+
collisionBoundary: w,
|
|
84
|
+
collisionPadding: d,
|
|
85
|
+
...g
|
|
86
86
|
}) {
|
|
87
|
-
return /* @__PURE__ */ r(n.Portal, { container:
|
|
87
|
+
return /* @__PURE__ */ r(n.Portal, { container: s, children: /* @__PURE__ */ r(
|
|
88
88
|
n.Positioner,
|
|
89
89
|
{
|
|
90
|
-
side:
|
|
91
|
-
sideOffset:
|
|
90
|
+
side: l,
|
|
91
|
+
sideOffset: a,
|
|
92
92
|
align: _,
|
|
93
93
|
alignOffset: p,
|
|
94
|
-
alignItemWithTrigger:
|
|
95
|
-
positionMethod:
|
|
96
|
-
collisionBoundary:
|
|
97
|
-
collisionPadding:
|
|
94
|
+
alignItemWithTrigger: !1,
|
|
95
|
+
positionMethod: m,
|
|
96
|
+
collisionBoundary: w,
|
|
97
|
+
collisionPadding: d,
|
|
98
98
|
className: e.positioner,
|
|
99
|
-
children: /* @__PURE__ */
|
|
100
|
-
|
|
101
|
-
{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
...b,
|
|
105
|
-
children: [
|
|
106
|
-
/* @__PURE__ */ r(y, {}),
|
|
107
|
-
/* @__PURE__ */ r(n.List, { children: o }),
|
|
108
|
-
/* @__PURE__ */ r(M, {})
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
)
|
|
99
|
+
children: /* @__PURE__ */ c(n.Popup, { className: i(e.popup, t), ...g, children: [
|
|
100
|
+
/* @__PURE__ */ r(P, {}),
|
|
101
|
+
/* @__PURE__ */ r(n.List, { className: e.list, children: o }),
|
|
102
|
+
/* @__PURE__ */ r(W, {})
|
|
103
|
+
] })
|
|
112
104
|
}
|
|
113
105
|
) });
|
|
114
106
|
}
|
|
115
107
|
function K({ className: t, ...o }) {
|
|
116
|
-
return /* @__PURE__ */ r(n.Group, { className:
|
|
108
|
+
return /* @__PURE__ */ r(n.Group, { className: i(e.group, t), ...o });
|
|
117
109
|
}
|
|
118
110
|
function O({ className: t, ...o }) {
|
|
119
|
-
return /* @__PURE__ */ r(n.GroupLabel, { className:
|
|
111
|
+
return /* @__PURE__ */ r(n.GroupLabel, { className: i(e.groupLabel, t), ...o });
|
|
120
112
|
}
|
|
121
|
-
function Q({ className: t, children: o, ...
|
|
122
|
-
return /* @__PURE__ */
|
|
113
|
+
function Q({ className: t, children: o, ...s }) {
|
|
114
|
+
return /* @__PURE__ */ c(n.Item, { className: i(e.item, t), ...s, children: [
|
|
123
115
|
/* @__PURE__ */ r(n.ItemText, { className: e.itemText, children: o }),
|
|
124
116
|
/* @__PURE__ */ r(n.ItemIndicator, { render: /* @__PURE__ */ r("span", { className: e.itemIndicator }), children: /* @__PURE__ */ r(
|
|
125
117
|
"svg",
|
|
@@ -138,23 +130,23 @@ function Q({ className: t, children: o, ...c }) {
|
|
|
138
130
|
] });
|
|
139
131
|
}
|
|
140
132
|
function X({ className: t, ...o }) {
|
|
141
|
-
return /* @__PURE__ */ r(n.Separator, { className:
|
|
133
|
+
return /* @__PURE__ */ r(n.Separator, { className: i(e.separator, t), ...o });
|
|
142
134
|
}
|
|
143
|
-
function
|
|
135
|
+
function P({ className: t, ...o }) {
|
|
144
136
|
return /* @__PURE__ */ r(
|
|
145
137
|
n.ScrollUpArrow,
|
|
146
138
|
{
|
|
147
|
-
className:
|
|
139
|
+
className: i(e.scrollArrow, e.scrollArrowUp, t),
|
|
148
140
|
...o,
|
|
149
141
|
children: /* @__PURE__ */ r(u, { direction: "up" })
|
|
150
142
|
}
|
|
151
143
|
);
|
|
152
144
|
}
|
|
153
|
-
function
|
|
145
|
+
function W({ className: t, ...o }) {
|
|
154
146
|
return /* @__PURE__ */ r(
|
|
155
147
|
n.ScrollDownArrow,
|
|
156
148
|
{
|
|
157
|
-
className:
|
|
149
|
+
className: i(e.scrollArrow, e.scrollArrowDown, t),
|
|
158
150
|
...o,
|
|
159
151
|
children: /* @__PURE__ */ r(u, { direction: "down" })
|
|
160
152
|
}
|
|
@@ -166,8 +158,8 @@ export {
|
|
|
166
158
|
K as SelectGroup,
|
|
167
159
|
Q as SelectItem,
|
|
168
160
|
O as SelectLabel,
|
|
169
|
-
|
|
170
|
-
|
|
161
|
+
W as SelectScrollDownButton,
|
|
162
|
+
P as SelectScrollUpButton,
|
|
171
163
|
X as SelectSeparator,
|
|
172
164
|
H as SelectTrigger,
|
|
173
165
|
E as SelectValue
|
package/dist/select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sources":["../src/components/select/select.tsx"],"sourcesContent":["import { Select as SelectPrimitive } from '@base-ui/react/select';\nimport { cva, cx, type VariantProps } from 'class-variance-authority';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport styles from './select.module.css';\n\n/* Inline lucide paths (ISC) — the kit carries no icon dependency. */\nfunction Chevron({ direction, className }: { direction: 'up' | 'down'; className?: string }) {\n return (\n <svg\n className={cx(styles.svgIcon, className)}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d={direction === 'down' ? 'm6 9 6 6 6-6' : 'm18 15-6-6-6 6'} />\n </svg>\n );\n}\n\nexport const Select = SelectPrimitive.Root;\n/**\n * The root is a Base UI pass-through, but its props type is still exported:\n * a consumer writing a typed wrapper imports it from this kit — Base UI is\n * this package's dependency, not necessarily theirs. Generic like the root\n * itself: `Value` is the selected value's type, `Multiple` widens `value`/\n * `onValueChange` to arrays when true.\n */\nexport type SelectProps<\n Value,\n Multiple extends boolean | undefined = false,\n> = SelectPrimitive.Root.Props<Value, Multiple>;\n\nexport interface SelectValueProps extends Omit<SelectPrimitive.Value.Props, 'className'> {\n className?: string;\n}\n\nexport function SelectValue({ className, ...props }: SelectValueProps) {\n return <SelectPrimitive.Value className={cx(styles.value, className)} {...props} />;\n}\n\nconst triggerVariants = cva(styles.trigger, {\n variants: {\n size: {\n default: styles.sizeDefault,\n sm: styles.sizeSm,\n },\n /*\n * `filter` is the mockups' Field/filter type (Figma frame 193:433): the\n * same select, compacted into a toolbar filter chip — 36px, label in\n * --muted-foreground even with a value chosen, because in a filter the\n * enduring message is \"this narrows the list\", not the picked value.\n */\n variant: {\n default: styles.variantDefault,\n filter: styles.variantFilter,\n },\n },\n defaultVariants: {\n size: 'default',\n variant: 'default',\n },\n});\n\nexport interface SelectTriggerProps\n extends Omit<SelectPrimitive.Trigger.Props, 'className'>, VariantProps<typeof triggerVariants> {\n className?: string;\n}\n\nexport function SelectTrigger({ className, size, variant, children, ...props }: SelectTriggerProps) {\n return (\n <SelectPrimitive.Trigger className={triggerVariants({ size, variant, className })} {...props}>\n {children}\n <SelectPrimitive.Icon render={<Chevron direction=\"down\" className={styles.triggerIcon} />} />\n </SelectPrimitive.Trigger>\n );\n}\n\nexport interface SelectContentProps\n extends Omit<SelectPrimitive.Popup.Props, 'className'>,\n Pick<\n SelectPrimitive.Positioner.Props,\n // positionMethod/collision*: see dropdown-menu.tsx — the escape hatch\n // for anchors inside a transform/filter container.\n | 'align'\n | 'alignOffset'\n | 'side'\n | 'sideOffset'\n | 'alignItemWithTrigger'\n | 'positionMethod'\n | 'collisionBoundary'\n | 'collisionPadding'\n > {\n className?: string;\n /**\n * Where to portal the popup. Defaults to <body>. Pass a themed container\n * when the theme is scoped to a subtree (data-theme on a section rather\n * than <html>) so the popup inherits its tokens and font.\n */\n container?: SelectPrimitive.Portal.Props['container'];\n}\n\nexport function SelectContent({\n className,\n children,\n container,\n side = 'bottom',\n sideOffset = 4,\n align = 'center',\n alignOffset = 0,\n alignItemWithTrigger = true,\n positionMethod,\n collisionBoundary,\n collisionPadding,\n ...props\n}: SelectContentProps) {\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={alignItemWithTrigger}\n positionMethod={positionMethod}\n collisionBoundary={collisionBoundary}\n collisionPadding={collisionPadding}\n className={styles.positioner}\n >\n <SelectPrimitive.Popup\n data-align-trigger={alignItemWithTrigger}\n className={cx(styles.popup, className)}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n}\n\nexport interface SelectGroupProps extends Omit<SelectPrimitive.Group.Props, 'className'> {\n className?: string;\n}\n\nexport function SelectGroup({ className, ...props }: SelectGroupProps) {\n return <SelectPrimitive.Group className={cx(styles.group, className)} {...props} />;\n}\n\nexport interface SelectLabelProps extends Omit<SelectPrimitive.GroupLabel.Props, 'className'> {\n className?: string;\n}\n\nexport function SelectLabel({ className, ...props }: SelectLabelProps) {\n return <SelectPrimitive.GroupLabel className={cx(styles.groupLabel, className)} {...props} />;\n}\n\nexport interface SelectItemProps extends Omit<SelectPrimitive.Item.Props, 'className'> {\n className?: string;\n children?: ReactNode;\n}\n\nexport function SelectItem({ className, children, ...props }: SelectItemProps) {\n return (\n <SelectPrimitive.Item className={cx(styles.item, className)} {...props}>\n <SelectPrimitive.ItemText className={styles.itemText}>{children}</SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator render={<span className={styles.itemIndicator} />}>\n <svg\n className={styles.svgIcon}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n );\n}\n\nexport interface SelectSeparatorProps extends Omit<SelectPrimitive.Separator.Props, 'className'> {\n className?: string;\n}\n\nexport function SelectSeparator({ className, ...props }: SelectSeparatorProps) {\n return <SelectPrimitive.Separator className={cx(styles.separator, className)} {...props} />;\n}\n\nexport interface SelectScrollUpButtonProps\n extends Omit<ComponentProps<typeof SelectPrimitive.ScrollUpArrow>, 'className'> {\n className?: string;\n}\n\nexport function SelectScrollUpButton({ className, ...props }: SelectScrollUpButtonProps) {\n return (\n <SelectPrimitive.ScrollUpArrow\n className={cx(styles.scrollArrow, styles.scrollArrowUp, className)}\n {...props}\n >\n <Chevron direction=\"up\" />\n </SelectPrimitive.ScrollUpArrow>\n );\n}\n\nexport interface SelectScrollDownButtonProps\n extends Omit<ComponentProps<typeof SelectPrimitive.ScrollDownArrow>, 'className'> {\n className?: string;\n}\n\nexport function SelectScrollDownButton({ className, ...props }: SelectScrollDownButtonProps) {\n return (\n <SelectPrimitive.ScrollDownArrow\n className={cx(styles.scrollArrow, styles.scrollArrowDown, className)}\n {...props}\n >\n <Chevron direction=\"down\" />\n </SelectPrimitive.ScrollDownArrow>\n );\n}\n"],"names":["Chevron","direction","className","jsx","cx","styles","Select","SelectPrimitive","SelectValue","props","triggerVariants","cva","SelectTrigger","size","variant","children","jsxs","SelectContent","container","side","sideOffset","align","alignOffset","alignItemWithTrigger","positionMethod","collisionBoundary","collisionPadding","SelectScrollUpButton","SelectScrollDownButton","SelectGroup","SelectLabel","SelectItem","SelectSeparator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAOA,SAASA,EAAQ,EAAE,WAAAC,GAAW,WAAAC,KAA+D;AAC3F,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAGC,EAAO,SAASH,CAAS;AAAA,MACvC,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,eAAY;AAAA,MAEZ,4BAAC,QAAA,EAAK,GAAGD,MAAc,SAAS,iBAAiB,iBAAA,CAAkB;AAAA,IAAA;AAAA,EAAA;AAGzE;AAEO,MAAMK,IAASC,EAAgB;AAiB/B,SAASC,EAAY,EAAE,WAAAN,GAAW,GAA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EAA8B,0BAAS,QAAA,EAAK,WAAWF,EAAO,eAAe,GAC5E,UAAA,gBAAAF;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWE,EAAO;AAAA,QAClB,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,QAAO;AAAA,QACP,aAAY;AAAA,QACZ,eAAc;AAAA,QACd,gBAAe;AAAA,QACf,eAAY;AAAA,QAEZ,UAAA,gBAAAF,EAAC,QAAA,EAAK,GAAE,kBAAA,CAAkB;AAAA,MAAA;AAAA,IAAA,EAC5B,CACF;AAAA,EAAA,GACF;AAEJ;AAMO,SAAS6B,EAAgB,EAAE,WAAA9B,GAAW,GAAGO,KAA+B;AAC7E,SAAO,gBAAAN,EAACI,EAAgB,WAAhB,EAA0B,WAAWH,EAAGC,EAAO,WAAWH,CAAS,GAAI,GAAGO,EAAA,CAAO;AAC3F;AAOO,SAASkB,EAAqB,EAAE,WAAAzB,GAAW,GAAGO,KAAoC;AACvF,SACE,gBAAAN;AAAA,IAACI,EAAgB;AAAA,IAAhB;AAAA,MACC,WAAWH,EAAGC,EAAO,aAAaA,EAAO,eAAeH,CAAS;AAAA,MAChE,GAAGO;AAAA,MAEJ,UAAA,gBAAAN,EAACH,GAAA,EAAQ,WAAU,KAAA,CAAK;AAAA,IAAA;AAAA,EAAA;AAG9B;AAOO,SAAS4B,EAAuB,EAAE,WAAA1B,GAAW,GAAGO,KAAsC;AAC3F,SACE,gBAAAN;AAAA,IAACI,EAAgB;AAAA,IAAhB;AAAA,MACC,WAAWH,EAAGC,EAAO,aAAaA,EAAO,iBAAiBH,CAAS;AAAA,MAClE,GAAGO;AAAA,MAEJ,UAAA,gBAAAN,EAACH,GAAA,EAAQ,WAAU,OAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAGhC;"}
|
|
1
|
+
{"version":3,"file":"select.js","sources":["../src/components/select/select.tsx"],"sourcesContent":["import { Select as SelectPrimitive } from '@base-ui/react/select';\nimport { cva, cx, type VariantProps } from 'class-variance-authority';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport styles from './select.module.css';\n\n/* Inline lucide paths (ISC) — the kit carries no icon dependency. */\nfunction Chevron({ direction, className }: { direction: 'up' | 'down'; className?: string }) {\n return (\n <svg\n className={cx(styles.svgIcon, className)}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d={direction === 'down' ? 'm6 9 6 6 6-6' : 'm18 15-6-6-6 6'} />\n </svg>\n );\n}\n\nexport const Select = SelectPrimitive.Root;\n/**\n * The root is a Base UI pass-through, but its props type is still exported:\n * a consumer writing a typed wrapper imports it from this kit — Base UI is\n * this package's dependency, not necessarily theirs. Generic like the root\n * itself: `Value` is the selected value's type, `Multiple` widens `value`/\n * `onValueChange` to arrays when true.\n */\nexport type SelectProps<\n Value,\n Multiple extends boolean | undefined = false,\n> = SelectPrimitive.Root.Props<Value, Multiple>;\n\nexport interface SelectValueProps extends Omit<SelectPrimitive.Value.Props, 'className'> {\n className?: string;\n}\n\nexport function SelectValue({ className, ...props }: SelectValueProps) {\n return <SelectPrimitive.Value className={cx(styles.value, className)} {...props} />;\n}\n\nconst triggerVariants = cva(styles.trigger, {\n variants: {\n size: {\n default: styles.sizeDefault,\n sm: styles.sizeSm,\n },\n /*\n * `filter` is the mockups' Field/filter type (Figma frame 193:433): the\n * same select, compacted into a toolbar filter chip — 36px, label in\n * --muted-foreground even with a value chosen, because in a filter the\n * enduring message is \"this narrows the list\", not the picked value.\n */\n variant: {\n default: styles.variantDefault,\n filter: styles.variantFilter,\n },\n },\n defaultVariants: {\n size: 'default',\n variant: 'default',\n },\n});\n\nexport interface SelectTriggerProps\n extends Omit<SelectPrimitive.Trigger.Props, 'className'>, VariantProps<typeof triggerVariants> {\n className?: string;\n}\n\nexport function SelectTrigger({ className, size, variant, children, ...props }: SelectTriggerProps) {\n return (\n <SelectPrimitive.Trigger className={triggerVariants({ size, variant, className })} {...props}>\n {children}\n <SelectPrimitive.Icon render={<Chevron direction=\"down\" className={styles.triggerIcon} />} />\n </SelectPrimitive.Trigger>\n );\n}\n\nexport interface SelectContentProps\n extends Omit<SelectPrimitive.Popup.Props, 'className'>,\n Pick<\n SelectPrimitive.Positioner.Props,\n // positionMethod/collision*: see dropdown-menu.tsx — the escape hatch\n // for anchors inside a transform/filter container.\n | 'align'\n | 'alignOffset'\n | 'side'\n | 'sideOffset'\n | 'positionMethod'\n | 'collisionBoundary'\n | 'collisionPadding'\n > {\n className?: string;\n /**\n * Where to portal the popup. Defaults to <body>. Pass a themed container\n * when the theme is scoped to a subtree (data-theme on a section rather\n * than <html>) so the popup inherits its tokens and font.\n */\n container?: SelectPrimitive.Portal.Props['container'];\n}\n\nexport function SelectContent({\n className,\n children,\n container,\n side = 'bottom',\n sideOffset = 4,\n align = 'center',\n alignOffset = 0,\n positionMethod,\n collisionBoundary,\n collisionPadding,\n ...props\n}: SelectContentProps) {\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n /*\n * Never the Base UI default overlay mode (selected item aligned over\n * the trigger): the popup always opens on `side`, below by default.\n * With nothing selected the list starts at the top; a selected item\n * beyond the fold is scrolled into view natively on open — Floating\n * UI's useListNavigation calls scrollIntoView({block: 'nearest'})\n * when a selectedIndex exists (verified against @base-ui/react 1.6.0\n * sources), so no scroll code of ours is needed.\n */\n alignItemWithTrigger={false}\n positionMethod={positionMethod}\n collisionBoundary={collisionBoundary}\n collisionPadding={collisionPadding}\n className={styles.positioner}\n >\n <SelectPrimitive.Popup className={cx(styles.popup, className)} {...props}>\n <SelectScrollUpButton />\n <SelectPrimitive.List className={styles.list}>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n}\n\nexport interface SelectGroupProps extends Omit<SelectPrimitive.Group.Props, 'className'> {\n className?: string;\n}\n\nexport function SelectGroup({ className, ...props }: SelectGroupProps) {\n return <SelectPrimitive.Group className={cx(styles.group, className)} {...props} />;\n}\n\nexport interface SelectLabelProps extends Omit<SelectPrimitive.GroupLabel.Props, 'className'> {\n className?: string;\n}\n\nexport function SelectLabel({ className, ...props }: SelectLabelProps) {\n return <SelectPrimitive.GroupLabel className={cx(styles.groupLabel, className)} {...props} />;\n}\n\nexport interface SelectItemProps extends Omit<SelectPrimitive.Item.Props, 'className'> {\n className?: string;\n children?: ReactNode;\n}\n\nexport function SelectItem({ className, children, ...props }: SelectItemProps) {\n return (\n <SelectPrimitive.Item className={cx(styles.item, className)} {...props}>\n <SelectPrimitive.ItemText className={styles.itemText}>{children}</SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator render={<span className={styles.itemIndicator} />}>\n <svg\n className={styles.svgIcon}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n );\n}\n\nexport interface SelectSeparatorProps extends Omit<SelectPrimitive.Separator.Props, 'className'> {\n className?: string;\n}\n\nexport function SelectSeparator({ className, ...props }: SelectSeparatorProps) {\n return <SelectPrimitive.Separator className={cx(styles.separator, className)} {...props} />;\n}\n\nexport interface SelectScrollUpButtonProps\n extends Omit<ComponentProps<typeof SelectPrimitive.ScrollUpArrow>, 'className'> {\n className?: string;\n}\n\nexport function SelectScrollUpButton({ className, ...props }: SelectScrollUpButtonProps) {\n return (\n <SelectPrimitive.ScrollUpArrow\n className={cx(styles.scrollArrow, styles.scrollArrowUp, className)}\n {...props}\n >\n <Chevron direction=\"up\" />\n </SelectPrimitive.ScrollUpArrow>\n );\n}\n\nexport interface SelectScrollDownButtonProps\n extends Omit<ComponentProps<typeof SelectPrimitive.ScrollDownArrow>, 'className'> {\n className?: string;\n}\n\nexport function SelectScrollDownButton({ className, ...props }: SelectScrollDownButtonProps) {\n return (\n <SelectPrimitive.ScrollDownArrow\n className={cx(styles.scrollArrow, styles.scrollArrowDown, className)}\n {...props}\n >\n <Chevron direction=\"down\" />\n </SelectPrimitive.ScrollDownArrow>\n );\n}\n"],"names":["Chevron","direction","className","jsx","cx","styles","Select","SelectPrimitive","SelectValue","props","triggerVariants","cva","SelectTrigger","size","variant","children","jsxs","SelectContent","container","side","sideOffset","align","alignOffset","positionMethod","collisionBoundary","collisionPadding","SelectScrollUpButton","SelectScrollDownButton","SelectGroup","SelectLabel","SelectItem","SelectSeparator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAOA,SAASA,EAAQ,EAAE,WAAAC,GAAW,WAAAC,KAA+D;AAC3F,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAGC,EAAO,SAASH,CAAS;AAAA,MACvC,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,eAAY;AAAA,MAEZ,4BAAC,QAAA,EAAK,GAAGD,MAAc,SAAS,iBAAiB,iBAAA,CAAkB;AAAA,IAAA;AAAA,EAAA;AAGzE;AAEO,MAAMK,IAASC,EAAgB;AAiB/B,SAASC,EAAY,EAAE,WAAAN,GAAW,GAAGO,KAA2B;AACrE,SAAO,gBAAAN,EAACI,EAAgB,OAAhB,EAAsB,WAAWH,EAAGC,EAAO,OAAOH,CAAS,GAAI,GAAGO,EAAA,CAAO;AACnF;AAEA,MAAMC,IAAkBC,EAAIN,EAAO,SAAS;AAAA,EAC1C,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,SAASA,EAAO;AAAA,MAChB,IAAIA,EAAO;AAAA,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AAA7B,GAAW,GAAGO,KAA+B;AAC7E,SAAO,gBAAAN,EAACI,EAAgB,WAAhB,EAA0B,WAAWH,EAAGC,EAAO,WAAWH,CAAS,GAAI,GAAGO,EAAA,CAAO;AAC3F;AAOO,SAASiB,EAAqB,EAAE,WAAAxB,GAAW,GAAGO,KAAoC;AACvF,SACE,gBAAAN;AAAA,IAACI,EAAgB;AAAA,IAAhB;AAAA,MACC,WAAWH,EAAGC,EAAO,aAAaA,EAAO,eAAeH,CAAS;AAAA,MAChE,GAAGO;AAAA,MAEJ,UAAA,gBAAAN,EAACH,GAAA,EAAQ,WAAU,KAAA,CAAK;AAAA,IAAA;AAAA,EAAA;AAG9B;AAOO,SAAS2B,EAAuB,EAAE,WAAAzB,GAAW,GAAGO,KAAsC;AAC3F,SACE,gBAAAN;AAAA,IAACI,EAAgB;AAAA,IAAhB;AAAA,MACC,WAAWH,EAAGC,EAAO,aAAaA,EAAO,iBAAiBH,CAAS;AAAA,MAClE,GAAGO;AAAA,MAEJ,UAAA,gBAAAN,EAACH,GAAA,EAAQ,WAAU,OAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAGhC;"}
|
package/dist/switch.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { Switch as i } from "@base-ui/react/switch";
|
|
3
3
|
import { cva as c } from "class-variance-authority";
|
|
4
|
-
import './chunks/switch.
|
|
5
|
-
switch: "
|
|
6
|
-
sizeDefault:
|
|
7
|
-
sizeSm:
|
|
8
|
-
thumb:
|
|
4
|
+
import './chunks/switch.CsaIRnCA.css';const o = "_sizeDefault_1baz9_10", u = "_sizeSm_1baz9_10", z = "_thumb_1baz9_87", t = {
|
|
5
|
+
switch: "_switch_1baz9_6",
|
|
6
|
+
sizeDefault: o,
|
|
7
|
+
sizeSm: u,
|
|
8
|
+
thumb: z
|
|
9
9
|
}, h = c(t.switch, {
|
|
10
10
|
variants: {
|
|
11
11
|
size: {
|
|
@@ -17,10 +17,10 @@ import './chunks/switch.B_ebMSxR.css';const n = "_sizeDefault_n8bm9_10", o = "_s
|
|
|
17
17
|
size: "default"
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
function
|
|
21
|
-
return /* @__PURE__ */ s(i.Root, { className: h({ size:
|
|
20
|
+
function f({ className: a, size: e, ...m }) {
|
|
21
|
+
return /* @__PURE__ */ s(i.Root, { className: h({ size: e, className: a }), ...m, children: /* @__PURE__ */ s(i.Thumb, { className: t.thumb }) });
|
|
22
22
|
}
|
|
23
23
|
export {
|
|
24
|
-
|
|
24
|
+
f as Switch
|
|
25
25
|
};
|
|
26
26
|
//# sourceMappingURL=switch.js.map
|