@a-type/ui 5.0.8 → 5.0.9
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/css/main.css +7 -7
- package/dist/esm/components/button/Button.js +1 -1
- package/dist/esm/components/button/Button.js.map +1 -1
- package/dist/esm/components/button/classes.js +2 -2
- package/dist/esm/components/button/classes.js.map +1 -1
- package/dist/esm/components/camera/Camera.js +1 -1
- package/dist/esm/components/camera/Camera.js.map +1 -1
- package/dist/esm/components/card/Card.js +3 -3
- package/dist/esm/components/card/Card.js.map +1 -1
- package/dist/esm/components/checkbox/Checkbox.js +2 -2
- package/dist/esm/components/checkbox/Checkbox.js.map +1 -1
- package/dist/esm/components/datePicker/Calendar.js +1 -1
- package/dist/esm/components/datePicker/Calendar.js.map +1 -1
- package/dist/esm/components/datePicker/DateRangePicker.js +1 -1
- package/dist/esm/components/datePicker/DateRangePicker.js.map +1 -1
- package/dist/esm/components/editableText/EditableText.js +1 -1
- package/dist/esm/components/editableText/EditableText.js.map +1 -1
- package/dist/esm/components/horizontalList/HorizontalList.js +2 -2
- package/dist/esm/components/horizontalList/HorizontalList.js.map +1 -1
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/input/Input.js.map +1 -1
- package/dist/esm/components/lightbox/Lightbox.js +1 -1
- package/dist/esm/components/lightbox/Lightbox.js.map +1 -1
- package/dist/esm/components/navBar/NavBar.js +5 -5
- package/dist/esm/components/navBar/NavBar.js.map +1 -1
- package/dist/esm/components/note/Note.js +1 -1
- package/dist/esm/components/note/Note.js.map +1 -1
- package/dist/esm/components/primitives/menus.js +1 -1
- package/dist/esm/components/primitives/menus.js.map +1 -1
- package/dist/esm/components/progress/Progress.js +5 -5
- package/dist/esm/components/progress/Progress.js.map +1 -1
- package/dist/esm/components/provider/Provider.d.ts +2 -1
- package/dist/esm/components/provider/Provider.js +3 -2
- package/dist/esm/components/provider/Provider.js.map +1 -1
- package/dist/esm/components/provider/TweakPane.d.ts +1 -0
- package/dist/esm/components/provider/TweakPane.js +36 -0
- package/dist/esm/components/provider/TweakPane.js.map +1 -0
- package/dist/esm/components/scrollArea/ScrollArea.js +5 -5
- package/dist/esm/components/scrollArea/ScrollArea.js.map +1 -1
- package/dist/esm/components/slider/Slider.d.ts +1 -0
- package/dist/esm/components/slider/Slider.js +9 -4
- package/dist/esm/components/slider/Slider.js.map +1 -1
- package/dist/esm/components/slider/Slider.stories.d.ts +1 -0
- package/dist/esm/components/switch/Switch.js +2 -2
- package/dist/esm/components/switch/Switch.js.map +1 -1
- package/dist/esm/components/tabs/tabs.js +1 -1
- package/dist/esm/components/tabs/tabs.js.map +1 -1
- package/dist/esm/components/toggleGroup/toggleGroup.js +1 -1
- package/dist/esm/components/toggleGroup/toggleGroup.js.map +1 -1
- package/dist/esm/components/viewport/Viewport.js +1 -1
- package/dist/esm/components/viewport/Viewport.js.map +1 -1
- package/dist/esm/hooks/useVisualViewportOffset.d.ts +2 -2
- package/dist/esm/hooks/useVisualViewportOffset.js +15 -9
- package/dist/esm/hooks/useVisualViewportOffset.js.map +1 -1
- package/dist/esm/themes.stories.js +2 -2
- package/dist/esm/themes.stories.js.map +1 -1
- package/dist/esm/uno/logic/properties.d.ts +6 -0
- package/dist/esm/uno/logic/properties.js +6 -0
- package/dist/esm/uno/logic/properties.js.map +1 -1
- package/dist/esm/uno/preflights/user.d.ts +2 -1
- package/dist/esm/uno/preflights/user.js +8 -1
- package/dist/esm/uno/preflights/user.js.map +1 -1
- package/dist/esm/uno/rules/focus.d.ts +3 -0
- package/dist/esm/uno/rules/focus.js +43 -0
- package/dist/esm/uno/rules/focus.js.map +1 -0
- package/dist/esm/uno/rules/index.d.ts +1 -1
- package/dist/esm/uno/rules/index.js +2 -0
- package/dist/esm/uno/rules/index.js.map +1 -1
- package/dist/esm/uno/theme/colors.d.ts +1 -1
- package/dist/esm/uno/theme/colors.js +3 -3
- package/dist/esm/uno/theme/colors.js.map +1 -1
- package/package.json +1 -1
- package/src/__screenshots__/themes.snapshots.tsx/snapshot-chromium-win32.png +0 -0
- package/src/components/button/Button.tsx +1 -1
- package/src/components/button/classes.tsx +3 -4
- package/src/components/camera/Camera.tsx +5 -5
- package/src/components/card/Card.tsx +6 -6
- package/src/components/checkbox/Checkbox.tsx +2 -2
- package/src/components/datePicker/Calendar.tsx +2 -2
- package/src/components/datePicker/DateRangePicker.tsx +3 -3
- package/src/components/editableText/EditableText.tsx +2 -1
- package/src/components/horizontalList/HorizontalList.tsx +2 -1
- package/src/components/input/Input.tsx +2 -2
- package/src/components/lightbox/Lightbox.tsx +1 -1
- package/src/components/navBar/NavBar.tsx +101 -101
- package/src/components/note/Note.tsx +3 -3
- package/src/components/primitives/menus.tsx +1 -1
- package/src/components/progress/Progress.tsx +101 -101
- package/src/components/provider/Provider.tsx +4 -0
- package/src/components/provider/TweakPane.tsx +139 -0
- package/src/components/scrollArea/ScrollArea.tsx +15 -15
- package/src/components/slider/Slider.tsx +103 -97
- package/src/components/switch/Switch.tsx +38 -38
- package/src/components/tabs/tabs.tsx +2 -1
- package/src/components/toggleGroup/toggleGroup.tsx +1 -1
- package/src/components/viewport/Viewport.tsx +1 -1
- package/src/hooks/useVisualViewportOffset.ts +15 -13
- package/src/themes.stories.tsx +2 -0
- package/src/uno/logic/properties.ts +6 -0
- package/src/uno/preflights/user.ts +13 -0
- package/src/uno/rules/focus.ts +46 -0
- package/src/uno/rules/index.ts +2 -0
- package/src/uno/theme/colors.ts +7 -3
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Progress as ProgressPrimitive,
|
|
3
|
-
ProgressRootProps,
|
|
4
|
-
ProgressValueProps,
|
|
5
|
-
} from '@base-ui/react/progress';
|
|
6
|
-
import clsx from 'clsx';
|
|
7
|
-
import { withClassName } from '../../hooks.js';
|
|
8
|
-
import { PaletteName } from '../../uno/index.js';
|
|
9
|
-
|
|
10
|
-
export const ProgressRoot = withClassName(
|
|
11
|
-
ProgressPrimitive.Root,
|
|
12
|
-
'layer-components:
|
|
13
|
-
);
|
|
14
|
-
export const ProgressIndicator = withClassName(
|
|
15
|
-
ProgressPrimitive.Indicator,
|
|
16
|
-
'layer-components:(
|
|
17
|
-
'layer-components:data-[complete]:(bg-success)',
|
|
18
|
-
);
|
|
19
|
-
export const ProgressTrack = withClassName(
|
|
20
|
-
ProgressPrimitive.Track,
|
|
21
|
-
'layer-components:(w-full
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
const ProgressBase = function ProgressBase({
|
|
25
|
-
ref,
|
|
26
|
-
children,
|
|
27
|
-
color,
|
|
28
|
-
max = 100,
|
|
29
|
-
value,
|
|
30
|
-
className,
|
|
31
|
-
...props
|
|
32
|
-
}: ProgressRootProps & {
|
|
33
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
34
|
-
color?: PaletteName;
|
|
35
|
-
}) {
|
|
36
|
-
return (
|
|
37
|
-
<ProgressPrimitive.Root
|
|
38
|
-
{...props}
|
|
39
|
-
className={clsx(
|
|
40
|
-
color && `palette-${color}`,
|
|
41
|
-
'layer-components:w-full',
|
|
42
|
-
className,
|
|
43
|
-
)}
|
|
44
|
-
value={value}
|
|
45
|
-
max={max}
|
|
46
|
-
ref={ref}
|
|
47
|
-
>
|
|
48
|
-
<ProgressTrack>
|
|
49
|
-
<ProgressIndicator />
|
|
50
|
-
</ProgressTrack>
|
|
51
|
-
{children}
|
|
52
|
-
</ProgressPrimitive.Root>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const ProgressLabel = withClassName(
|
|
57
|
-
ProgressPrimitive.Label,
|
|
58
|
-
'layer-components:(font-size-xs color-gray-ink
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
const ProgressValue = withClassName(
|
|
62
|
-
ProgressPrimitive.Value,
|
|
63
|
-
'layer-components:(
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
export const ProgressLabeled = function ProgressLabeled({
|
|
67
|
-
ref,
|
|
68
|
-
label,
|
|
69
|
-
className,
|
|
70
|
-
color,
|
|
71
|
-
formatValue,
|
|
72
|
-
...props
|
|
73
|
-
}: Omit<ProgressRootProps, 'children'> & {
|
|
74
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
75
|
-
label: React.ReactNode;
|
|
76
|
-
color?: PaletteName;
|
|
77
|
-
formatValue?: ProgressValueProps['children'];
|
|
78
|
-
}) {
|
|
79
|
-
return (
|
|
80
|
-
<ProgressRoot
|
|
81
|
-
ref={ref}
|
|
82
|
-
className={clsx(color && `palette-${color}`, className)}
|
|
83
|
-
{...props}
|
|
84
|
-
>
|
|
85
|
-
<ProgressLabel>{label}</ProgressLabel>
|
|
86
|
-
<ProgressValue>{formatValue}</ProgressValue>
|
|
87
|
-
<ProgressTrack className="col-span-2">
|
|
88
|
-
<ProgressIndicator />
|
|
89
|
-
</ProgressTrack>
|
|
90
|
-
</ProgressRoot>
|
|
91
|
-
);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export const Progress = Object.assign(ProgressBase, {
|
|
95
|
-
Root: ProgressRoot,
|
|
96
|
-
Indicator: ProgressIndicator,
|
|
97
|
-
Track: ProgressTrack,
|
|
98
|
-
Labeled: ProgressLabeled,
|
|
99
|
-
Label: ProgressLabel,
|
|
100
|
-
Value: ProgressValue,
|
|
101
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
Progress as ProgressPrimitive,
|
|
3
|
+
ProgressRootProps,
|
|
4
|
+
ProgressValueProps,
|
|
5
|
+
} from '@base-ui/react/progress';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { withClassName } from '../../hooks.js';
|
|
8
|
+
import { PaletteName } from '../../uno/index.js';
|
|
9
|
+
|
|
10
|
+
export const ProgressRoot = withClassName(
|
|
11
|
+
ProgressPrimitive.Root,
|
|
12
|
+
'layer-components:grid-columns-[1fr_1fr] layer-components:(grid w-full items-center gap-col-md gap-row-xs)',
|
|
13
|
+
);
|
|
14
|
+
export const ProgressIndicator = withClassName(
|
|
15
|
+
ProgressPrimitive.Indicator,
|
|
16
|
+
'layer-components:(w-full rounded-lg transition-transform bg-main)',
|
|
17
|
+
'layer-components:data-[complete]:(bg-success)',
|
|
18
|
+
);
|
|
19
|
+
export const ProgressTrack = withClassName(
|
|
20
|
+
ProgressPrimitive.Track,
|
|
21
|
+
'layer-components:(relative h-8px w-full overflow-hidden border rounded-lg border-black)',
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const ProgressBase = function ProgressBase({
|
|
25
|
+
ref,
|
|
26
|
+
children,
|
|
27
|
+
color,
|
|
28
|
+
max = 100,
|
|
29
|
+
value,
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}: ProgressRootProps & {
|
|
33
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
34
|
+
color?: PaletteName;
|
|
35
|
+
}) {
|
|
36
|
+
return (
|
|
37
|
+
<ProgressPrimitive.Root
|
|
38
|
+
{...props}
|
|
39
|
+
className={clsx(
|
|
40
|
+
color && `palette-${color}`,
|
|
41
|
+
'layer-components:w-full',
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
value={value}
|
|
45
|
+
max={max}
|
|
46
|
+
ref={ref}
|
|
47
|
+
>
|
|
48
|
+
<ProgressTrack>
|
|
49
|
+
<ProgressIndicator />
|
|
50
|
+
</ProgressTrack>
|
|
51
|
+
{children}
|
|
52
|
+
</ProgressPrimitive.Root>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const ProgressLabel = withClassName(
|
|
57
|
+
ProgressPrimitive.Label,
|
|
58
|
+
'layer-components:(col-start-1 row-start-1 font-size-xs color-gray-ink)',
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const ProgressValue = withClassName(
|
|
62
|
+
ProgressPrimitive.Value,
|
|
63
|
+
'layer-components:(col-start-2 row-start-1 justify-self-end font-size-xs font-semibold color-gray-ink)',
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
export const ProgressLabeled = function ProgressLabeled({
|
|
67
|
+
ref,
|
|
68
|
+
label,
|
|
69
|
+
className,
|
|
70
|
+
color,
|
|
71
|
+
formatValue,
|
|
72
|
+
...props
|
|
73
|
+
}: Omit<ProgressRootProps, 'children'> & {
|
|
74
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
75
|
+
label: React.ReactNode;
|
|
76
|
+
color?: PaletteName;
|
|
77
|
+
formatValue?: ProgressValueProps['children'];
|
|
78
|
+
}) {
|
|
79
|
+
return (
|
|
80
|
+
<ProgressRoot
|
|
81
|
+
ref={ref}
|
|
82
|
+
className={clsx(color && `palette-${color}`, className)}
|
|
83
|
+
{...props}
|
|
84
|
+
>
|
|
85
|
+
<ProgressLabel>{label}</ProgressLabel>
|
|
86
|
+
<ProgressValue>{formatValue}</ProgressValue>
|
|
87
|
+
<ProgressTrack className="col-span-2">
|
|
88
|
+
<ProgressIndicator />
|
|
89
|
+
</ProgressTrack>
|
|
90
|
+
</ProgressRoot>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const Progress = Object.assign(ProgressBase, {
|
|
95
|
+
Root: ProgressRoot,
|
|
96
|
+
Indicator: ProgressIndicator,
|
|
97
|
+
Track: ProgressTrack,
|
|
98
|
+
Labeled: ProgressLabeled,
|
|
99
|
+
Label: ProgressLabel,
|
|
100
|
+
Value: ProgressValue,
|
|
101
|
+
});
|
|
@@ -10,6 +10,7 @@ import { ParticleLayer } from '../particles/index.js';
|
|
|
10
10
|
import { PwaInstall } from '../pwaInstall/PwaInstall.js';
|
|
11
11
|
import { DefaultToastProvider, Toaster } from '../toasts/toasts.js';
|
|
12
12
|
import { TooltipProvider } from '../tooltip/index.js';
|
|
13
|
+
import { TweakPane } from './TweakPane.js';
|
|
13
14
|
|
|
14
15
|
export interface ProviderProps {
|
|
15
16
|
children?: ReactNode;
|
|
@@ -18,6 +19,7 @@ export interface ProviderProps {
|
|
|
18
19
|
virtualKeyboardBehavior?: 'overlay' | 'displace';
|
|
19
20
|
disableTitleBarColor?: boolean;
|
|
20
21
|
manifestPath?: string;
|
|
22
|
+
tweaks?: boolean;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
/**
|
|
@@ -30,6 +32,7 @@ export function Provider({
|
|
|
30
32
|
virtualKeyboardBehavior = 'displace',
|
|
31
33
|
disableTitleBarColor,
|
|
32
34
|
manifestPath,
|
|
35
|
+
tweaks,
|
|
33
36
|
}: ProviderProps) {
|
|
34
37
|
useVisualViewportOffset(disableViewportOffset);
|
|
35
38
|
useVirtualKeyboardFocusBehavior();
|
|
@@ -44,6 +47,7 @@ export function Provider({
|
|
|
44
47
|
<IconSpritesheet />
|
|
45
48
|
<Toaster />
|
|
46
49
|
<PwaInstall manifestPath={manifestPath} />
|
|
50
|
+
{tweaks && <TweakPane />}
|
|
47
51
|
</>
|
|
48
52
|
);
|
|
49
53
|
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { useDeferredValue, useEffect, useState } from 'react';
|
|
2
|
+
import { PROPS } from '../../uno/index.js';
|
|
3
|
+
import { Box } from '../box/Box.js';
|
|
4
|
+
import { Button } from '../button/Button.js';
|
|
5
|
+
import { Collapsible } from '../collapsible/Collapsible.js';
|
|
6
|
+
import { Icon } from '../icon/Icon.js';
|
|
7
|
+
import { Slider } from '../slider/Slider.js';
|
|
8
|
+
|
|
9
|
+
function getPropertyValue(prop: string, defaultValue: number) {
|
|
10
|
+
const value = document.documentElement.style.getPropertyValue(prop);
|
|
11
|
+
const parsed = parseFloat(value);
|
|
12
|
+
return isNaN(parsed) ? defaultValue : parsed;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function useTweakProperty(prop: string, defaultValue: number) {
|
|
16
|
+
const [value, setValue] = useState(() => {
|
|
17
|
+
const v = document.documentElement.style.getPropertyValue(prop);
|
|
18
|
+
const parsed = parseFloat(v);
|
|
19
|
+
return isNaN(parsed) ? defaultValue : parsed;
|
|
20
|
+
});
|
|
21
|
+
const delayedValue = useDeferredValue(value);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
document.documentElement.style.setProperty(prop, `${delayedValue}`);
|
|
24
|
+
}, [delayedValue]);
|
|
25
|
+
return [value, setValue] as const;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function TweakSlider({
|
|
29
|
+
prop,
|
|
30
|
+
min,
|
|
31
|
+
max,
|
|
32
|
+
label,
|
|
33
|
+
step,
|
|
34
|
+
defaultValue,
|
|
35
|
+
}: {
|
|
36
|
+
prop: string;
|
|
37
|
+
min: number;
|
|
38
|
+
max: number;
|
|
39
|
+
label: string;
|
|
40
|
+
step?: number;
|
|
41
|
+
defaultValue: number;
|
|
42
|
+
}) {
|
|
43
|
+
const [value, setValue] = useTweakProperty(prop, defaultValue);
|
|
44
|
+
return (
|
|
45
|
+
<Slider.Root
|
|
46
|
+
value={value}
|
|
47
|
+
onValueChange={(v) => {
|
|
48
|
+
setValue(Slider.getSingle(v));
|
|
49
|
+
}}
|
|
50
|
+
min={min}
|
|
51
|
+
max={max}
|
|
52
|
+
step={step}
|
|
53
|
+
className="w-200px flex flex-col gap-xs"
|
|
54
|
+
>
|
|
55
|
+
<div className="w-full flex flex-row items-center justify-between">
|
|
56
|
+
<label>{label}</label>
|
|
57
|
+
<Slider.Value />
|
|
58
|
+
</div>
|
|
59
|
+
<Slider.Ui />
|
|
60
|
+
</Slider.Root>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function TweakPane() {
|
|
65
|
+
return (
|
|
66
|
+
<Box
|
|
67
|
+
elevated="lg"
|
|
68
|
+
surface="white"
|
|
69
|
+
border
|
|
70
|
+
className="fixed right-xs top-xs z-1000000"
|
|
71
|
+
>
|
|
72
|
+
<Collapsible>
|
|
73
|
+
<Collapsible.Trigger render={<Button size="small" emphasis="ghost" />}>
|
|
74
|
+
<Icon name="gear" />
|
|
75
|
+
</Collapsible.Trigger>
|
|
76
|
+
<Collapsible.Content>
|
|
77
|
+
<Box col p gap="sm">
|
|
78
|
+
<TweakSlider
|
|
79
|
+
prop={PROPS.USER.COLOR.PRIMARY_HUE}
|
|
80
|
+
min={0}
|
|
81
|
+
max={360}
|
|
82
|
+
step={1}
|
|
83
|
+
defaultValue={80}
|
|
84
|
+
label="Primary hue"
|
|
85
|
+
/>
|
|
86
|
+
<TweakSlider
|
|
87
|
+
prop={PROPS.USER.COLOR.ACCENT_HUE}
|
|
88
|
+
min={0}
|
|
89
|
+
max={360}
|
|
90
|
+
step={1}
|
|
91
|
+
defaultValue={340}
|
|
92
|
+
label="Accent hue"
|
|
93
|
+
/>
|
|
94
|
+
<TweakSlider
|
|
95
|
+
prop={PROPS.USER.SATURATION}
|
|
96
|
+
min={0}
|
|
97
|
+
max={1}
|
|
98
|
+
step={0.05}
|
|
99
|
+
defaultValue={1}
|
|
100
|
+
label="Saturation"
|
|
101
|
+
/>
|
|
102
|
+
<TweakSlider
|
|
103
|
+
prop={PROPS.USER.SHADOW_SPREAD}
|
|
104
|
+
min={0}
|
|
105
|
+
max={1}
|
|
106
|
+
step={0.25}
|
|
107
|
+
defaultValue={0}
|
|
108
|
+
label="Shadow Spread"
|
|
109
|
+
/>
|
|
110
|
+
<TweakSlider
|
|
111
|
+
prop={PROPS.USER.BORDER_SCALE}
|
|
112
|
+
min={0}
|
|
113
|
+
max={4}
|
|
114
|
+
step={0.25}
|
|
115
|
+
defaultValue={1}
|
|
116
|
+
label="Border Scale"
|
|
117
|
+
/>
|
|
118
|
+
<TweakSlider
|
|
119
|
+
prop={PROPS.USER.CORNER_SCALE}
|
|
120
|
+
min={0}
|
|
121
|
+
max={2}
|
|
122
|
+
step={0.125}
|
|
123
|
+
defaultValue={1}
|
|
124
|
+
label="Corner Scale"
|
|
125
|
+
/>
|
|
126
|
+
<TweakSlider
|
|
127
|
+
prop={PROPS.USER.SPACING_SCALE}
|
|
128
|
+
min={0}
|
|
129
|
+
max={2}
|
|
130
|
+
step={0.125}
|
|
131
|
+
defaultValue={1}
|
|
132
|
+
label="Spacing Scale"
|
|
133
|
+
/>
|
|
134
|
+
</Box>
|
|
135
|
+
</Collapsible.Content>
|
|
136
|
+
</Collapsible>
|
|
137
|
+
</Box>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
@@ -11,27 +11,27 @@ export type * from '@base-ui/react/scroll-area';
|
|
|
11
11
|
|
|
12
12
|
export const ScrollAreaRoot = withClassName(
|
|
13
13
|
BaseScrollArea.Root,
|
|
14
|
-
'layer-components:(min-
|
|
14
|
+
'layer-components:(box-border min-h-0 min-w-0 flex flex-col)',
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
export const ScrollAreaViewport = withClassName(
|
|
18
18
|
BaseScrollArea.Viewport,
|
|
19
|
-
'layer-components:(h-full
|
|
20
|
-
'layer-components:
|
|
19
|
+
'layer-components:(h-full min-h-0 outline-none)',
|
|
20
|
+
'layer-components:foc',
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
export const ScrollAreaVerticalFades = withClassName(
|
|
24
24
|
'div',
|
|
25
|
-
'layer-components:(
|
|
26
|
-
'layer-components:before:(
|
|
27
|
-
'layer-components:after:(
|
|
25
|
+
'layer-components:([--scroll-area-overflow-y-end:inherit] [--scroll-area-overflow-y-start:inherit] pointer-events-none absolute inset-0)',
|
|
26
|
+
'layer-components:before:([--scroll-area-overflow-y-start:inherit] absolute left-0 top-0 block h-[min(40px,var(--scroll-area-overflow-y-start,40px))] w-full bg-gradient-from-bg bg-gradient-to-transparent bg-gradient-to-b transition-height content-empty)',
|
|
27
|
+
'layer-components:after:([--scroll-area-overflow-y-end:inherit] absolute bottom-0 left-0 block h-[min(40px,var(--scroll-area-overflow-y-end,40px))] w-full bg-gradient-from-bg bg-gradient-to-transparent bg-gradient-to-t transition-height content-empty)',
|
|
28
28
|
);
|
|
29
29
|
|
|
30
30
|
export const ScrollAreaHorizontalFades = withClassName(
|
|
31
31
|
'div',
|
|
32
|
-
'layer-components:(
|
|
33
|
-
'layer-components:before:(
|
|
34
|
-
'layer-components:after:(
|
|
32
|
+
'layer-components:([--scroll-area-overflow-x-end:inherit] [--scroll-area-overflow-x-start:inherit] pointer-events-none absolute inset-0)',
|
|
33
|
+
'layer-components:before:([--scroll-area-overflow-x-start:inherit] absolute left-0 top-0 block h-full w-[min(40px,var(--scroll-area-overflow-x-start,40px))] bg-gradient-from-bg bg-gradient-to-transparent bg-gradient-to-r transition-width content-empty)',
|
|
34
|
+
'layer-components:after:([--scroll-area-overflow-x-end:inherit] absolute right-0 top-0 block h-full w-[min(40px,var(--scroll-area-overflow-x-end,40px))] bg-gradient-from-bg bg-gradient-to-transparent bg-gradient-to-l transition-width content-empty)',
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
export const ScrollAreaViewportFades = () => (
|
|
@@ -76,14 +76,14 @@ ComposedScrollbar.displayName = 'ScrollAreaScrollbar';
|
|
|
76
76
|
|
|
77
77
|
export const ScrollAreaScrollbar = withClassName(
|
|
78
78
|
ComposedScrollbar,
|
|
79
|
-
'layer-components:(
|
|
80
|
-
'layer-components:(
|
|
81
|
-
'layer-components:data-[hovering]:(
|
|
79
|
+
'layer-components:(pointer-events-none relative m-xxs flex touch-none select-none rounded-full opacity-0)',
|
|
80
|
+
'layer-components:(transition-[opacity,height,width] bg-fg/5)',
|
|
81
|
+
'layer-components:data-[hovering]:(pointer-events-auto opacity-100)',
|
|
82
82
|
'layer-components:data-[scrolling]:(duration-0)',
|
|
83
|
-
'layer-components:before:(content-empty
|
|
83
|
+
'layer-components:before:(absolute content-empty)',
|
|
84
84
|
|
|
85
|
-
'layer-components:data-[orientation=vertical]:(w-0.25rem justify-center before:
|
|
86
|
-
'layer-components:data-[orientation=horizontal]:(h-0.25rem items-center before:
|
|
85
|
+
'layer-components:data-[orientation=vertical]:(w-0.25rem justify-center before:h-full before:w-1.25rem hover:w-0.5rem)',
|
|
86
|
+
'layer-components:data-[orientation=horizontal]:(h-0.25rem items-center before:h-1.25rem before:w-full hover:h-0.5rem)',
|
|
87
87
|
);
|
|
88
88
|
|
|
89
89
|
export const ScrollAreaCorner = withClassName(
|
|
@@ -1,97 +1,103 @@
|
|
|
1
|
-
import { Slider as BaseSlider, SliderRootProps } from '@base-ui/react/slider';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { Ref } from 'react';
|
|
4
|
-
import { withClassName } from '../../hooks.js';
|
|
5
|
-
import { PaletteName } from '../../uno/index.js';
|
|
6
|
-
|
|
7
|
-
export const SliderRoot = withClassName(
|
|
8
|
-
BaseSlider.Root,
|
|
9
|
-
'layer-components:w-full',
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
export const SliderControl = withClassName(
|
|
13
|
-
BaseSlider.Control,
|
|
14
|
-
'layer-components:(relative
|
|
15
|
-
'layer-variants:[&[data-orientation=vertical]]:(
|
|
16
|
-
);
|
|
17
|
-
export const SliderTrack = withClassName(
|
|
18
|
-
BaseSlider.Track,
|
|
19
|
-
'layer-components:(
|
|
20
|
-
'layer-variants:[&[data-orientation=vertical]]:(w-7px
|
|
21
|
-
);
|
|
22
|
-
export const SliderRange = withClassName(
|
|
23
|
-
BaseSlider.Indicator,
|
|
24
|
-
'layer-components:(
|
|
25
|
-
'layer-variants:[&[data-orientation=vertical]]:(bg-main)',
|
|
26
|
-
);
|
|
27
|
-
export const SliderThumb = withClassName(
|
|
28
|
-
BaseSlider.Thumb,
|
|
29
|
-
'layer-components:(
|
|
30
|
-
'layer-components:hover:(shadow-md)',
|
|
31
|
-
'layer-components:active:(shadow-lg ring-4 ring-
|
|
32
|
-
'layer-components:focus-visible:(shadow-lg
|
|
33
|
-
'
|
|
34
|
-
'layer-components:
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
1
|
+
import { Slider as BaseSlider, SliderRootProps } from '@base-ui/react/slider';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { Ref } from 'react';
|
|
4
|
+
import { withClassName } from '../../hooks.js';
|
|
5
|
+
import { PaletteName } from '../../uno/index.js';
|
|
6
|
+
|
|
7
|
+
export const SliderRoot = withClassName(
|
|
8
|
+
BaseSlider.Root,
|
|
9
|
+
'layer-components:w-full',
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export const SliderControl = withClassName(
|
|
13
|
+
BaseSlider.Control,
|
|
14
|
+
'layer-components:(relative h-30px w-full flex translate-z-0 touch-none select-none items-center)',
|
|
15
|
+
'layer-variants:[&[data-orientation=vertical]]:(h-full w-30px flex-col)',
|
|
16
|
+
);
|
|
17
|
+
export const SliderTrack = withClassName(
|
|
18
|
+
BaseSlider.Track,
|
|
19
|
+
'layer-components:(relative h-7px grow select-none rounded-lg ring-1 transition-colors bg-transparent ring-black)',
|
|
20
|
+
'layer-variants:[&[data-orientation=vertical]]:(h-full w-7px flex-1)',
|
|
21
|
+
);
|
|
22
|
+
export const SliderRange = withClassName(
|
|
23
|
+
BaseSlider.Indicator,
|
|
24
|
+
'layer-components:(rounded-lg transition-colors bg-main)',
|
|
25
|
+
'layer-variants:[&[data-orientation=vertical]]:(bg-main)',
|
|
26
|
+
);
|
|
27
|
+
export const SliderThumb = withClassName(
|
|
28
|
+
BaseSlider.Thumb,
|
|
29
|
+
'layer-components:(h-5 w-5 flex cursor-pointer touch-none items-center justify-center rounded-lg leading-none shadow-sm ring-2 transition-color bg-white ring-black)',
|
|
30
|
+
'layer-components:hover:(shadow-md)',
|
|
31
|
+
'layer-components:active:(shadow-lg ring-4 ring-opacity-50 bg-main-light ring-main-dark)',
|
|
32
|
+
'layer-components:focus-visible:(shadow-lg bg-main-light)',
|
|
33
|
+
'foc-lg',
|
|
34
|
+
'layer-components:focus:(outline-none)',
|
|
35
|
+
'layer-components:disabled:(opacity-50)',
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export const SliderBase = ({
|
|
39
|
+
children,
|
|
40
|
+
color,
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}: SliderProps) => {
|
|
44
|
+
return (
|
|
45
|
+
<SliderRoot
|
|
46
|
+
{...props}
|
|
47
|
+
className={clsx(color && `palette-${color}`, className)}
|
|
48
|
+
>
|
|
49
|
+
<SliderControl>{children}</SliderControl>
|
|
50
|
+
</SliderRoot>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A pre-configured Slider UI component. Meant to compose
|
|
56
|
+
* under Slider.Root when you want to use Slider.Value, too
|
|
57
|
+
*/
|
|
58
|
+
export const SliderUi = ({
|
|
59
|
+
label,
|
|
60
|
+
className,
|
|
61
|
+
}: {
|
|
62
|
+
label?: string;
|
|
63
|
+
className?: string;
|
|
64
|
+
}) => (
|
|
65
|
+
<Slider.Control className={className}>
|
|
66
|
+
<SliderTrack>
|
|
67
|
+
<SliderRange />
|
|
68
|
+
<SliderThumb aria-label={label} />
|
|
69
|
+
</SliderTrack>
|
|
70
|
+
</Slider.Control>
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
export interface SliderProps extends SliderRootProps {
|
|
74
|
+
color?: PaletteName;
|
|
75
|
+
ref?: Ref<HTMLDivElement>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const Slider = Object.assign(
|
|
79
|
+
function Slider(props: SliderProps) {
|
|
80
|
+
return (
|
|
81
|
+
<SliderRoot {...props}>
|
|
82
|
+
<SliderUi />
|
|
83
|
+
</SliderRoot>
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
Root: SliderRoot,
|
|
88
|
+
Base: SliderBase,
|
|
89
|
+
Control: SliderControl,
|
|
90
|
+
Track: SliderTrack,
|
|
91
|
+
/** @deprecated - use Indicator */
|
|
92
|
+
Range: SliderRange,
|
|
93
|
+
Indicator: SliderRange,
|
|
94
|
+
Thumb: SliderThumb,
|
|
95
|
+
Value: BaseSlider.Value,
|
|
96
|
+
Ui: SliderUi,
|
|
97
|
+
|
|
98
|
+
getSingle: (v: number | readonly number[]) => {
|
|
99
|
+
if (Array.isArray(v)) return v[0];
|
|
100
|
+
return v;
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
);
|