@shipfox/react-ui 0.31.1 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert/alert.d.ts +1 -1
- package/dist/components/alert/alert.js +1 -1
- package/dist/components/avatar/avatar.d.ts +1 -1
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/command/command.d.ts +2 -2
- package/dist/components/command/command.js +1 -1
- package/dist/components/dashboard/components/charts/bar-chart.js +4 -0
- package/dist/components/dashboard/components/charts/chart-tooltip.js +1 -1
- package/dist/components/dashboard/components/charts/line-chart.js +4 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/components/form/form.d.ts +1 -1
- package/dist/components/form/form.js +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/inline-tips/inline-tips.d.ts +1 -1
- package/dist/components/inline-tips/inline-tips.js +1 -1
- package/dist/components/modal/modal.d.ts +2 -2
- package/dist/components/modal/modal.js +1 -1
- package/dist/components/popover/popover.d.ts +1 -1
- package/dist/components/popover/popover.js +1 -1
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.js +1 -1
- package/dist/components/sheet/sheet.d.ts +2 -2
- package/dist/components/sheet/sheet.js +1 -1
- package/dist/components/shiny-text/shiny-text.d.ts +1 -1
- package/dist/components/shipql-editor/index.d.ts +1 -1
- package/dist/components/shipql-editor/lexical/shipql-leaf-node.d.ts +3 -2
- package/dist/components/shipql-editor/lexical/shipql-leaf-node.js +8 -4
- package/dist/components/shipql-editor/lexical/shipql-plugin.d.ts +2 -1
- package/dist/components/shipql-editor/lexical/shipql-plugin.js +7 -3
- package/dist/components/shipql-editor/shipql-editor-inner.d.ts +1 -1
- package/dist/components/shipql-editor/shipql-editor-inner.js +7 -2
- package/dist/components/shipql-editor/shipql-editor.d.ts +3 -2
- package/dist/components/shipql-editor/shipql-editor.js +7 -1
- package/dist/components/shipql-editor/suggestions/generate-suggestions.js +1 -1
- package/dist/components/shipql-editor/suggestions/shipql-range-facet-panel.js +101 -62
- package/dist/components/shipql-editor/suggestions/shipql-suggestions-plugin.js +17 -1
- package/dist/components/shipql-editor/suggestions/types.d.ts +4 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +3 -0
- package/dist/components/switch/switch.d.ts +12 -0
- package/dist/components/switch/switch.js +48 -0
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.js +1 -1
- package/dist/components/tabs/tabs.d.ts +1 -1
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/toast/toast.d.ts +1 -1
- package/dist/components/toast/toast.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +7 -6
- package/dist/components/dropdown-input/dropdown-input.d.ts +0 -25
- package/dist/components/dropdown-input/dropdown-input.js +0 -188
- package/dist/components/dropdown-input/index.d.ts +0 -2
- package/dist/components/dropdown-input/index.js +0 -3
|
@@ -5,6 +5,22 @@ import { Slider } from '../../../components/slider/index.js';
|
|
|
5
5
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
import { cn } from '../../../utils/cn.js';
|
|
7
7
|
const RECENT_MAX = 5;
|
|
8
|
+
const RANGE_BRACKET_RE = /^\[(\S+)\s+TO\s+(\S+)\]$/;
|
|
9
|
+
const RANGE_OP_RE = /^([<>]=?)(.+)$/;
|
|
10
|
+
function formatRangeDisplay(raw, fmt) {
|
|
11
|
+
const bracketMatch = RANGE_BRACKET_RE.exec(raw);
|
|
12
|
+
if (bracketMatch) {
|
|
13
|
+
const min = bracketMatch[1];
|
|
14
|
+
const max = bracketMatch[2];
|
|
15
|
+
if (min && max) return `[${fmt(min)} TO ${fmt(max)}]`;
|
|
16
|
+
}
|
|
17
|
+
const opMatch = RANGE_OP_RE.exec(raw);
|
|
18
|
+
if (opMatch) {
|
|
19
|
+
const v = opMatch[2];
|
|
20
|
+
if (v) return `${opMatch[1]}${fmt(v)}`;
|
|
21
|
+
}
|
|
22
|
+
return raw;
|
|
23
|
+
}
|
|
8
24
|
const INPUT_CLASSES = 'w-40 shrink-0 rounded-4 border border-border-neutral-base-component bg-background-field-base shadow-button-neutral transition-[color,box-shadow] outline-none px-4 py-2 text-center text-xs text-foreground-neutral-base focus-visible:shadow-border-interactive-with-active [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none';
|
|
9
25
|
function getRecentKey(facetName) {
|
|
10
26
|
return `shipql-range-recent-${facetName}`;
|
|
@@ -37,7 +53,7 @@ function clearRecent(facetName) {
|
|
|
37
53
|
// ignore storage errors
|
|
38
54
|
}
|
|
39
55
|
}
|
|
40
|
-
function PresetRow({ value, onClick, isRecent, isHighlighted, rowRef }) {
|
|
56
|
+
function PresetRow({ value, displayValue, onClick, isRecent, isHighlighted, rowRef }) {
|
|
41
57
|
return /*#__PURE__*/ _jsxs("button", {
|
|
42
58
|
ref: rowRef,
|
|
43
59
|
type: "button",
|
|
@@ -53,7 +69,7 @@ function PresetRow({ value, onClick, isRecent, isHighlighted, rowRef }) {
|
|
|
53
69
|
}),
|
|
54
70
|
/*#__PURE__*/ _jsx("span", {
|
|
55
71
|
className: "flex-1 truncate text-sm text-foreground-neutral-subtle",
|
|
56
|
-
children: value
|
|
72
|
+
children: displayValue ?? value
|
|
57
73
|
})
|
|
58
74
|
]
|
|
59
75
|
});
|
|
@@ -61,6 +77,7 @@ function PresetRow({ value, onClick, isRecent, isHighlighted, rowRef }) {
|
|
|
61
77
|
export function ShipQLRangeFacetPanel({ facetName, config, onApply, isSelectingRef }) {
|
|
62
78
|
const absMin = Number(config.min);
|
|
63
79
|
const absMax = Number(config.max);
|
|
80
|
+
const fmt = config.format ?? String;
|
|
64
81
|
const [sliderValues, setSliderValues] = useState([
|
|
65
82
|
absMin,
|
|
66
83
|
absMax
|
|
@@ -71,19 +88,59 @@ export function ShipQLRangeFacetPanel({ facetName, config, onApply, isSelectingR
|
|
|
71
88
|
selectedPresetIndexRef.current = selectedPresetIndex;
|
|
72
89
|
const presetRowRefs = useRef([]);
|
|
73
90
|
// Local string state for inputs so mid-edit typing isn't clamped
|
|
74
|
-
const [minText, setMinText] = useState(String(absMin));
|
|
75
|
-
const [maxText, setMaxText] = useState(String(absMax));
|
|
91
|
+
const [minText, setMinText] = useState(fmt(String(absMin)));
|
|
92
|
+
const [maxText, setMaxText] = useState(fmt(String(absMax)));
|
|
93
|
+
const [isEditingMin, setIsEditingMin] = useState(false);
|
|
94
|
+
const [isEditingMax, setIsEditingMax] = useState(false);
|
|
76
95
|
const [lo, hi] = sliderValues;
|
|
77
|
-
// Keep input text in sync when slider moves
|
|
96
|
+
// Keep input text in sync when slider moves (only when not actively editing)
|
|
78
97
|
useEffect(()=>{
|
|
79
|
-
setMinText(String(lo));
|
|
98
|
+
if (!isEditingMin) setMinText(fmt(String(lo)));
|
|
80
99
|
}, [
|
|
81
|
-
lo
|
|
100
|
+
lo,
|
|
101
|
+
fmt,
|
|
102
|
+
isEditingMin
|
|
82
103
|
]);
|
|
83
104
|
useEffect(()=>{
|
|
84
|
-
setMaxText(String(hi));
|
|
105
|
+
if (!isEditingMax) setMaxText(fmt(String(hi)));
|
|
85
106
|
}, [
|
|
86
|
-
hi
|
|
107
|
+
hi,
|
|
108
|
+
fmt,
|
|
109
|
+
isEditingMax
|
|
110
|
+
]);
|
|
111
|
+
const commitMin = useCallback((text)=>{
|
|
112
|
+
setIsEditingMin(false);
|
|
113
|
+
const n = Number(text);
|
|
114
|
+
if (!Number.isNaN(n)) {
|
|
115
|
+
const clamped = Math.max(absMin, Math.min(n, hi));
|
|
116
|
+
setSliderValues([
|
|
117
|
+
clamped,
|
|
118
|
+
hi
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
setMinText(fmt(String(lo)));
|
|
122
|
+
}, [
|
|
123
|
+
absMin,
|
|
124
|
+
hi,
|
|
125
|
+
lo,
|
|
126
|
+
fmt
|
|
127
|
+
]);
|
|
128
|
+
const commitMax = useCallback((text)=>{
|
|
129
|
+
setIsEditingMax(false);
|
|
130
|
+
const n = Number(text);
|
|
131
|
+
if (!Number.isNaN(n)) {
|
|
132
|
+
const clamped = Math.max(lo, Math.min(n, absMax));
|
|
133
|
+
setSliderValues([
|
|
134
|
+
lo,
|
|
135
|
+
clamped
|
|
136
|
+
]);
|
|
137
|
+
}
|
|
138
|
+
setMaxText(fmt(String(hi)));
|
|
139
|
+
}, [
|
|
140
|
+
absMax,
|
|
141
|
+
lo,
|
|
142
|
+
hi,
|
|
143
|
+
fmt
|
|
87
144
|
]);
|
|
88
145
|
// Hold dropdown open for any pointer interaction inside the panel
|
|
89
146
|
const panelRef = useRef(null);
|
|
@@ -109,15 +166,18 @@ export function ShipQLRangeFacetPanel({ facetName, config, onApply, isSelectingR
|
|
|
109
166
|
isSelectingRef
|
|
110
167
|
]);
|
|
111
168
|
const addLabel = useMemo(()=>{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (hi === absMax) return `Add ">=${
|
|
115
|
-
return `Add "
|
|
169
|
+
const fmtLo = fmt(String(lo));
|
|
170
|
+
const fmtHi = fmt(String(hi));
|
|
171
|
+
if (lo === absMin && hi === absMax) return `Add ">=${fmtLo},<=${fmtHi}"`;
|
|
172
|
+
if (lo === absMin) return `Add "<=${fmtHi}"`;
|
|
173
|
+
if (hi === absMax) return `Add ">=${fmtLo}"`;
|
|
174
|
+
return `Add ">=${fmtLo},<=${fmtHi}"`;
|
|
116
175
|
}, [
|
|
117
176
|
lo,
|
|
118
177
|
hi,
|
|
119
178
|
absMin,
|
|
120
|
-
absMax
|
|
179
|
+
absMax,
|
|
180
|
+
fmt
|
|
121
181
|
]);
|
|
122
182
|
const buildValue = useCallback(()=>{
|
|
123
183
|
if (lo === absMin && hi === absMax) return `[${lo} TO ${hi}]`;
|
|
@@ -206,44 +266,6 @@ export function ShipQLRangeFacetPanel({ facetName, config, onApply, isSelectingR
|
|
|
206
266
|
}, [
|
|
207
267
|
selectedPresetIndex
|
|
208
268
|
]);
|
|
209
|
-
// Commit min input on blur or Enter
|
|
210
|
-
const commitMin = useCallback(()=>{
|
|
211
|
-
const v = Number(minText);
|
|
212
|
-
if (!Number.isNaN(v)) {
|
|
213
|
-
const clamped = Math.min(Math.max(v, absMin), hi);
|
|
214
|
-
setSliderValues([
|
|
215
|
-
clamped,
|
|
216
|
-
hi
|
|
217
|
-
]);
|
|
218
|
-
setMinText(String(clamped));
|
|
219
|
-
} else {
|
|
220
|
-
setMinText(String(lo));
|
|
221
|
-
}
|
|
222
|
-
}, [
|
|
223
|
-
minText,
|
|
224
|
-
absMin,
|
|
225
|
-
hi,
|
|
226
|
-
lo
|
|
227
|
-
]);
|
|
228
|
-
// Commit max input on blur or Enter
|
|
229
|
-
const commitMax = useCallback(()=>{
|
|
230
|
-
const v = Number(maxText);
|
|
231
|
-
if (!Number.isNaN(v)) {
|
|
232
|
-
const clamped = Math.max(Math.min(v, absMax), lo);
|
|
233
|
-
setSliderValues([
|
|
234
|
-
lo,
|
|
235
|
-
clamped
|
|
236
|
-
]);
|
|
237
|
-
setMaxText(String(clamped));
|
|
238
|
-
} else {
|
|
239
|
-
setMaxText(String(hi));
|
|
240
|
-
}
|
|
241
|
-
}, [
|
|
242
|
-
maxText,
|
|
243
|
-
absMax,
|
|
244
|
-
lo,
|
|
245
|
-
hi
|
|
246
|
-
]);
|
|
247
269
|
return /*#__PURE__*/ _jsxs("div", {
|
|
248
270
|
ref: panelRef,
|
|
249
271
|
className: "flex flex-col",
|
|
@@ -262,19 +284,27 @@ export function ShipQLRangeFacetPanel({ facetName, config, onApply, isSelectingR
|
|
|
262
284
|
className: "flex items-center gap-12",
|
|
263
285
|
children: [
|
|
264
286
|
/*#__PURE__*/ _jsx("input", {
|
|
265
|
-
type: "
|
|
287
|
+
type: "text",
|
|
288
|
+
className: INPUT_CLASSES,
|
|
266
289
|
value: minText,
|
|
267
|
-
onChange: (e)=>
|
|
268
|
-
|
|
290
|
+
onChange: (e)=>{
|
|
291
|
+
setIsEditingMin(true);
|
|
292
|
+
setMinText(e.target.value);
|
|
293
|
+
},
|
|
294
|
+
onBlur: (e)=>commitMin(e.target.value),
|
|
269
295
|
onKeyDown: (e)=>{
|
|
270
|
-
if (e.key === 'Enter')
|
|
296
|
+
if (e.key === 'Enter') e.target.blur();
|
|
271
297
|
},
|
|
272
|
-
|
|
298
|
+
onFocus: ()=>{
|
|
299
|
+
setIsEditingMin(true);
|
|
300
|
+
setMinText(String(lo));
|
|
301
|
+
}
|
|
273
302
|
}),
|
|
274
303
|
/*#__PURE__*/ _jsx(Slider, {
|
|
275
304
|
className: "flex-1",
|
|
276
305
|
min: absMin,
|
|
277
306
|
max: absMax,
|
|
307
|
+
step: config.step,
|
|
278
308
|
value: sliderValues,
|
|
279
309
|
onValueChange: (vals)=>{
|
|
280
310
|
const newLo = vals[0];
|
|
@@ -288,14 +318,21 @@ export function ShipQLRangeFacetPanel({ facetName, config, onApply, isSelectingR
|
|
|
288
318
|
}
|
|
289
319
|
}),
|
|
290
320
|
/*#__PURE__*/ _jsx("input", {
|
|
291
|
-
type: "
|
|
321
|
+
type: "text",
|
|
322
|
+
className: INPUT_CLASSES,
|
|
292
323
|
value: maxText,
|
|
293
|
-
onChange: (e)=>
|
|
294
|
-
|
|
324
|
+
onChange: (e)=>{
|
|
325
|
+
setIsEditingMax(true);
|
|
326
|
+
setMaxText(e.target.value);
|
|
327
|
+
},
|
|
328
|
+
onBlur: (e)=>commitMax(e.target.value),
|
|
295
329
|
onKeyDown: (e)=>{
|
|
296
|
-
if (e.key === 'Enter')
|
|
330
|
+
if (e.key === 'Enter') e.target.blur();
|
|
297
331
|
},
|
|
298
|
-
|
|
332
|
+
onFocus: ()=>{
|
|
333
|
+
setIsEditingMax(true);
|
|
334
|
+
setMaxText(String(hi));
|
|
335
|
+
}
|
|
299
336
|
})
|
|
300
337
|
]
|
|
301
338
|
}),
|
|
@@ -336,6 +373,7 @@ export function ShipQLRangeFacetPanel({ facetName, config, onApply, isSelectingR
|
|
|
336
373
|
}),
|
|
337
374
|
recentValues.slice(0, 3).map((v, i)=>/*#__PURE__*/ _jsx(PresetRow, {
|
|
338
375
|
value: v,
|
|
376
|
+
displayValue: formatRangeDisplay(v, fmt),
|
|
339
377
|
onClick: handlePreset,
|
|
340
378
|
isRecent: true,
|
|
341
379
|
isHighlighted: selectedPresetIndex === i,
|
|
@@ -358,6 +396,7 @@ export function ShipQLRangeFacetPanel({ facetName, config, onApply, isSelectingR
|
|
|
358
396
|
const idx = recentValues.slice(0, 3).length + i;
|
|
359
397
|
return /*#__PURE__*/ _jsx(PresetRow, {
|
|
360
398
|
value: v,
|
|
399
|
+
displayValue: formatRangeDisplay(v, fmt),
|
|
361
400
|
onClick: handlePreset,
|
|
362
401
|
isHighlighted: selectedPresetIndex === idx,
|
|
363
402
|
rowRef: (el)=>{
|
|
@@ -3,6 +3,17 @@ import { $createRangeSelection, $createTextNode, $getRoot, $getSelection, $isRan
|
|
|
3
3
|
import { useEffect, useRef } from 'react';
|
|
4
4
|
import { $isShipQLLeafNode } from '../lexical/shipql-leaf-node.js';
|
|
5
5
|
import { buildSuggestionItems, detectFacetContext, extractFacetFromLeaf, negationPrefixFromSource, normalizeFacets, stripNegationPrefix, tryParse } from './generate-suggestions.js';
|
|
6
|
+
const NEEDS_QUOTING = /[\s"()[\]]/;
|
|
7
|
+
const RANGE_SYNTAX = /^(\[.*\s+TO\s+.*\]|[<>]=?.+)$/;
|
|
8
|
+
const ALREADY_QUOTED = /^"[^"]*"$/;
|
|
9
|
+
function quoteIfNeeded(value) {
|
|
10
|
+
if (RANGE_SYNTAX.test(value)) return value;
|
|
11
|
+
if (ALREADY_QUOTED.test(value)) return value;
|
|
12
|
+
if (value === '' || NEEDS_QUOTING.test(value)) {
|
|
13
|
+
return `"${value}"`;
|
|
14
|
+
}
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
6
17
|
function getActiveSegment(para) {
|
|
7
18
|
const children = para.getChildren();
|
|
8
19
|
let active = '';
|
|
@@ -15,6 +26,11 @@ function getActiveSegment(para) {
|
|
|
15
26
|
const leafText = child.getTextContent();
|
|
16
27
|
if (active.length > 0 && active[0] !== ' ' && leafText.includes(':')) {
|
|
17
28
|
active = leafText + active;
|
|
29
|
+
} else if (active.length === 0 && leafText.endsWith(':')) {
|
|
30
|
+
// Cursor is immediately after a facet leaf like "status:" (no trailing
|
|
31
|
+
// text yet). Include the leaf so detectFacetContext can identify the
|
|
32
|
+
// facet and show value suggestions instead of facet-name suggestions.
|
|
33
|
+
active = leafText;
|
|
18
34
|
}
|
|
19
35
|
break;
|
|
20
36
|
}
|
|
@@ -153,7 +169,7 @@ export function ShipQLSuggestionsPlugin({ facets, currentFacet, setCurrentFacet,
|
|
|
153
169
|
editor.update(()=>{
|
|
154
170
|
const para = $getRoot().getFirstChild();
|
|
155
171
|
if (!para) return;
|
|
156
|
-
const insertText = currentFacetRef.current ? `${negationPrefixRef.current}${currentFacetRef.current}:${selectedValue} ` : `${negationPrefixRef.current}${selectedValue}:`;
|
|
172
|
+
const insertText = currentFacetRef.current ? `${negationPrefixRef.current}${currentFacetRef.current}:${quoteIfNeeded(selectedValue)} ` : `${negationPrefixRef.current}${selectedValue}:`;
|
|
157
173
|
// Case 1: Cursor is inside a focused leaf chip — replace the chip in-place
|
|
158
174
|
if (focusedLeafNodeRef.current) {
|
|
159
175
|
const sel = $getSelection();
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import type { AstNode } from '@shipfox/shipql-parser';
|
|
1
2
|
export interface RangeFacetConfig {
|
|
2
3
|
type: 'range';
|
|
3
4
|
min: string;
|
|
4
5
|
max: string;
|
|
6
|
+
step?: number;
|
|
5
7
|
presets?: string[];
|
|
8
|
+
format?: (value: string) => string;
|
|
6
9
|
}
|
|
7
10
|
export type FacetDef = string | {
|
|
8
11
|
name: string;
|
|
9
12
|
config: RangeFacetConfig;
|
|
10
13
|
};
|
|
14
|
+
export type FormatLeafDisplay = (source: string, node: AstNode) => string;
|
|
11
15
|
export interface SuggestionItem {
|
|
12
16
|
value: string;
|
|
13
17
|
label: React.ReactNode;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import type { ComponentProps } from 'react';
|
|
4
|
+
export declare const switchVariants: (props?: ({
|
|
5
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export declare const switchThumbVariants: (props?: ({
|
|
8
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
export type SwitchProps = ComponentProps<typeof SwitchPrimitive.Root> & VariantProps<typeof switchVariants>;
|
|
11
|
+
export declare function Switch({ className, size, ...props }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=switch.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from '../../utils/cn.js';
|
|
5
|
+
export const switchVariants = cva('peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-none outline-none transition-colors duration-200', {
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
sm: 'h-20 w-36',
|
|
9
|
+
md: 'h-24 w-44',
|
|
10
|
+
lg: 'h-28 w-52'
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
size: 'md'
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export const switchThumbVariants = cva('pointer-events-none block rounded-full bg-white shadow-button-neutral transition-transform duration-200', {
|
|
18
|
+
variants: {
|
|
19
|
+
size: {
|
|
20
|
+
sm: 'size-16 data-[state=checked]:translate-x-18 data-[state=unchecked]:translate-x-2',
|
|
21
|
+
md: 'size-20 data-[state=checked]:translate-x-22 data-[state=unchecked]:translate-x-2',
|
|
22
|
+
lg: 'size-24 data-[state=checked]:translate-x-26 data-[state=unchecked]:translate-x-2'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
size: 'md'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export function Switch({ className, size, ...props }) {
|
|
30
|
+
return /*#__PURE__*/ _jsx(SwitchPrimitive.Root, {
|
|
31
|
+
"data-slot": "switch",
|
|
32
|
+
className: cn(switchVariants({
|
|
33
|
+
size
|
|
34
|
+
}), // Unchecked state
|
|
35
|
+
'bg-background-switch-off', 'hover:bg-background-switch-off-hover', // Checked state
|
|
36
|
+
'data-[state=checked]:bg-checkbox-checked-bg', 'data-[state=checked]:hover:bg-checkbox-checked-bg-hover', // Focus
|
|
37
|
+
'focus-visible:shadow-checkbox-unchecked-focus', 'data-[state=checked]:focus-visible:shadow-checkbox-checked-focus', // Disabled
|
|
38
|
+
'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50', className),
|
|
39
|
+
...props,
|
|
40
|
+
children: /*#__PURE__*/ _jsx(SwitchPrimitive.Thumb, {
|
|
41
|
+
className: cn(switchThumbVariants({
|
|
42
|
+
size
|
|
43
|
+
}))
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=switch.js.map
|
|
@@ -7,5 +7,5 @@ declare function TableRow({ className, ...props }: ComponentProps<'tr'>): import
|
|
|
7
7
|
declare function TableHead({ className, ...props }: ComponentProps<'th'>): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
declare function TableCell({ className, ...props }: ComponentProps<'td'>): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
declare function TableCaption({ className, ...props }: ComponentProps<'caption'>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export { Table,
|
|
10
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
11
11
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -60,6 +60,6 @@ function TableCaption({ className, ...props }) {
|
|
|
60
60
|
...props
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
export { Table,
|
|
63
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
64
64
|
|
|
65
65
|
//# sourceMappingURL=table.js.map
|
|
@@ -46,5 +46,5 @@ type TabsContentProps = ComponentProps<'div'> & {
|
|
|
46
46
|
children: ReactNode;
|
|
47
47
|
};
|
|
48
48
|
declare function TabsContent({ children, value, className, ...props }: TabsContentProps): import("react/jsx-runtime").JSX.Element | null;
|
|
49
|
-
export { Tabs,
|
|
49
|
+
export { Tabs, TabsContent, type TabsContentProps, TabsContents, type TabsContentsProps, type TabsContextType, TabsList, type TabsListProps, type TabsProps, TabsTrigger, type TabsTriggerProps, useTabs, };
|
|
50
50
|
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -238,6 +238,6 @@ function TabsContent({ children, value, className, ...props }) {
|
|
|
238
238
|
children: children
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
|
-
export { Tabs,
|
|
241
|
+
export { Tabs, TabsContent, TabsContents, TabsList, TabsTrigger, useTabs };
|
|
242
242
|
|
|
243
243
|
//# sourceMappingURL=tabs.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ToasterProps as SonnerToasterProps, toast as sonnerToast } from 'sonner';
|
|
2
2
|
type ToasterProps = Omit<SonnerToasterProps, 'theme'>;
|
|
3
3
|
declare function Toaster({ ...props }: ToasterProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export {
|
|
4
|
+
export { sonnerToast as toast, Toaster, type ToasterProps };
|
|
5
5
|
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -15,6 +15,6 @@ type TooltipContentProps = ComponentProps<typeof TooltipPrimitive.Content> & Var
|
|
|
15
15
|
transition?: Transition;
|
|
16
16
|
};
|
|
17
17
|
declare function TooltipContent({ className, sideOffset, children, variant, size, animated, transition, ...props }: TooltipContentProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, tooltipContentVariants, defaultTransition, };
|
|
19
18
|
export type { TooltipContentProps };
|
|
19
|
+
export { defaultTransition, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, tooltipContentVariants, };
|
|
20
20
|
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -93,6 +93,6 @@ function TooltipContent({ className, sideOffset = 8, children, variant, size, an
|
|
|
93
93
|
})
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
export {
|
|
96
|
+
export { defaultTransition, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, tooltipContentVariants };
|
|
97
97
|
|
|
98
98
|
//# sourceMappingURL=tooltip.js.map
|