@a-type/ui 5.0.7 → 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 +8 -8
- 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 +5 -3
- 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 +22 -10
- package/dist/esm/hooks/useVisualViewportOffset.js.map +1 -1
- package/dist/esm/keyboard.stories.js +3 -3
- package/dist/esm/keyboard.stories.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/index.d.ts +2 -1
- package/dist/esm/uno/preflights/index.js +1 -1
- package/dist/esm/uno/preflights/index.js.map +1 -1
- package/dist/esm/uno/preflights/keyboard.d.ts +4 -1
- package/dist/esm/uno/preflights/keyboard.js +3 -3
- package/dist/esm/uno/preflights/keyboard.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 +10 -1
- 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 +22 -14
- package/src/keyboard.stories.tsx +21 -10
- package/src/themes.stories.tsx +2 -0
- package/src/uno/logic/properties.ts +6 -0
- package/src/uno/preflights/index.ts +4 -3
- package/src/uno/preflights/keyboard.ts +15 -8
- 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 { Button } from '@base-ui/react/button';
|
|
2
|
-
import { UseRenderComponentProps } from '@base-ui/react/use-render';
|
|
3
|
-
import classNames, { clsx } from 'clsx';
|
|
4
|
-
import { ReactElement, ReactNode, Ref } from 'react';
|
|
5
|
-
import { withClassName } from '../../hooks.js';
|
|
6
|
-
import { Icon, IconProps } from '../icon/index.js';
|
|
7
|
-
|
|
8
|
-
export const navBarItemClass = classNames(
|
|
9
|
-
'layer-components:(relative h-full flex flex-col cursor-pointer select-none items-center justify-center gap-6px whitespace-nowrap rounded-sm border-none px-3 py-1 text-sm transition-colors color-black bg-transparent)',
|
|
10
|
-
'layer-components:active:bg-darken-2',
|
|
11
|
-
'layer-components:hover:(bg-main-light)',
|
|
12
|
-
'layer-components:
|
|
13
|
-
'layer-components:[&[data-active=true]]:(color-black color-lighten-2 bg-main-light/50)',
|
|
14
|
-
'layer-responsive:md:(h-auto flex-row-reverse justify-start gap-2 overflow-visible active:bg-darken-2)',
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
export interface NavBarItemProps extends UseRenderComponentProps<'button'> {
|
|
18
|
-
className?: string;
|
|
19
|
-
children?: ReactNode;
|
|
20
|
-
active?: boolean;
|
|
21
|
-
color?: 'primary' | 'gray';
|
|
22
|
-
render?: ReactElement | (() => ReactElement);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const NavBarItem = function NavBarItem({
|
|
26
|
-
ref,
|
|
27
|
-
className,
|
|
28
|
-
active,
|
|
29
|
-
color = 'primary',
|
|
30
|
-
...rest
|
|
31
|
-
}: NavBarItemProps & {
|
|
32
|
-
ref?: React.Ref<HTMLButtonElement>;
|
|
33
|
-
}) {
|
|
34
|
-
return (
|
|
35
|
-
<Button
|
|
36
|
-
ref={ref}
|
|
37
|
-
className={classNames(navBarItemClass, `palette-${color}`, className)}
|
|
38
|
-
data-active={active}
|
|
39
|
-
{...rest}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const NavBarItemIconWrapper = withClassName(
|
|
45
|
-
'div',
|
|
46
|
-
'layer-components:(relative flex)',
|
|
47
|
-
'layer-components:md:
|
|
48
|
-
'layer-variants:md:[*[data-active=true]_&]:bg-[var(--bg)]',
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
export const NavBarItemText = withClassName(
|
|
52
|
-
'span',
|
|
53
|
-
'layer-components:(overflow-hidden
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
interface NavBarItemIconProps extends Omit<IconProps, 'name'> {
|
|
57
|
-
name?: IconProps['name'];
|
|
58
|
-
className?: string;
|
|
59
|
-
children?: ReactNode;
|
|
60
|
-
ref?: Ref<any>;
|
|
61
|
-
}
|
|
62
|
-
export const NavBarItemIcon = function NavBarItemIcon({
|
|
63
|
-
ref,
|
|
64
|
-
className,
|
|
65
|
-
name = 'placeholder',
|
|
66
|
-
...rest
|
|
67
|
-
}: NavBarItemIconProps) {
|
|
68
|
-
return (
|
|
69
|
-
<Icon
|
|
70
|
-
name={name}
|
|
71
|
-
className={clsx(
|
|
72
|
-
'layer-components:(relative z-1 flex color-inherit)',
|
|
73
|
-
'layer-variants:[*[data-active=true]_&]:fill-main',
|
|
74
|
-
className,
|
|
75
|
-
)}
|
|
76
|
-
{...rest}
|
|
77
|
-
ref={ref}
|
|
78
|
-
/>
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const NavBarItemPip = withClassName(
|
|
83
|
-
'div',
|
|
84
|
-
'palette-attention',
|
|
85
|
-
'layer-components:(absolute
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
export const NavBarRoot = withClassName(
|
|
89
|
-
'div',
|
|
90
|
-
'layer-components:(
|
|
91
|
-
'pb-[calc(0.25rem+env(safe-area-inset-bottom,0px))]',
|
|
92
|
-
'layer-components:md:(
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
export const NavBar = Object.assign(NavBarRoot, {
|
|
96
|
-
Item: NavBarItem,
|
|
97
|
-
ItemIcon: NavBarItemIcon,
|
|
98
|
-
ItemText: NavBarItemText,
|
|
99
|
-
ItemIconWrapper: NavBarItemIconWrapper,
|
|
100
|
-
ItemPip: NavBarItemPip,
|
|
101
|
-
});
|
|
1
|
+
import { Button } from '@base-ui/react/button';
|
|
2
|
+
import { UseRenderComponentProps } from '@base-ui/react/use-render';
|
|
3
|
+
import classNames, { clsx } from 'clsx';
|
|
4
|
+
import { ReactElement, ReactNode, Ref } from 'react';
|
|
5
|
+
import { withClassName } from '../../hooks.js';
|
|
6
|
+
import { Icon, IconProps } from '../icon/index.js';
|
|
7
|
+
|
|
8
|
+
export const navBarItemClass = classNames(
|
|
9
|
+
'layer-components:(relative h-full flex flex-col cursor-pointer select-none items-center justify-center gap-6px whitespace-nowrap rounded-sm border-none px-3 py-1 text-sm transition-colors color-black bg-transparent)',
|
|
10
|
+
'layer-components:active:bg-darken-2',
|
|
11
|
+
'layer-components:hover:(bg-main-light)',
|
|
12
|
+
'layer-components:foc-effect',
|
|
13
|
+
'layer-components:[&[data-active=true]]:(color-black color-lighten-2 bg-main-light/50)',
|
|
14
|
+
'layer-responsive:md:(h-auto flex-row-reverse justify-start gap-2 overflow-visible active:bg-darken-2)',
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export interface NavBarItemProps extends UseRenderComponentProps<'button'> {
|
|
18
|
+
className?: string;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
active?: boolean;
|
|
21
|
+
color?: 'primary' | 'gray';
|
|
22
|
+
render?: ReactElement | (() => ReactElement);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const NavBarItem = function NavBarItem({
|
|
26
|
+
ref,
|
|
27
|
+
className,
|
|
28
|
+
active,
|
|
29
|
+
color = 'primary',
|
|
30
|
+
...rest
|
|
31
|
+
}: NavBarItemProps & {
|
|
32
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
33
|
+
}) {
|
|
34
|
+
return (
|
|
35
|
+
<Button
|
|
36
|
+
ref={ref}
|
|
37
|
+
className={classNames(navBarItemClass, `palette-${color}`, className)}
|
|
38
|
+
data-active={active}
|
|
39
|
+
{...rest}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const NavBarItemIconWrapper = withClassName(
|
|
45
|
+
'div',
|
|
46
|
+
'layer-components:(relative flex)',
|
|
47
|
+
'layer-components:md:bg-gray-blend layer-components:md:(rounded-lg p-6px)',
|
|
48
|
+
'layer-variants:md:[*[data-active=true]_&]:bg-[var(--bg)]',
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export const NavBarItemText = withClassName(
|
|
52
|
+
'span',
|
|
53
|
+
'layer-components:(inline-block overflow-hidden text-ellipsis whitespace-nowrap text-xxs) layer-components:md:(text-md leading-normal)',
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
interface NavBarItemIconProps extends Omit<IconProps, 'name'> {
|
|
57
|
+
name?: IconProps['name'];
|
|
58
|
+
className?: string;
|
|
59
|
+
children?: ReactNode;
|
|
60
|
+
ref?: Ref<any>;
|
|
61
|
+
}
|
|
62
|
+
export const NavBarItemIcon = function NavBarItemIcon({
|
|
63
|
+
ref,
|
|
64
|
+
className,
|
|
65
|
+
name = 'placeholder',
|
|
66
|
+
...rest
|
|
67
|
+
}: NavBarItemIconProps) {
|
|
68
|
+
return (
|
|
69
|
+
<Icon
|
|
70
|
+
name={name}
|
|
71
|
+
className={clsx(
|
|
72
|
+
'layer-components:(relative z-1 flex color-inherit)',
|
|
73
|
+
'layer-variants:[*[data-active=true]_&]:fill-main',
|
|
74
|
+
className,
|
|
75
|
+
)}
|
|
76
|
+
{...rest}
|
|
77
|
+
ref={ref}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const NavBarItemPip = withClassName(
|
|
83
|
+
'div',
|
|
84
|
+
'palette-attention',
|
|
85
|
+
'layer-components:(absolute right-6px top-6px h-6px w-6px rounded-lg shadow-sm bg-main)',
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
export const NavBarRoot = withClassName(
|
|
89
|
+
'div',
|
|
90
|
+
'layer-components:([grid-auto-columns:1fr] [grid-auto-flow:column] z-50 grid h-auto w-full justify-items-center overflow-hidden rounded-none p-1)',
|
|
91
|
+
'pb-[calc(0.25rem+env(safe-area-inset-bottom,0px))]',
|
|
92
|
+
'layer-components:md:(h-min-content flex flex-col items-stretch justify-start gap-2 overflow-x-hidden rounded-none border-none pb-10 bg-transparent border-transparent overflow-y-auto shadow-none)',
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
export const NavBar = Object.assign(NavBarRoot, {
|
|
96
|
+
Item: NavBarItem,
|
|
97
|
+
ItemIcon: NavBarItemIcon,
|
|
98
|
+
ItemText: NavBarItemText,
|
|
99
|
+
ItemIconWrapper: NavBarItemIconWrapper,
|
|
100
|
+
ItemPip: NavBarItemPip,
|
|
101
|
+
});
|
|
@@ -14,7 +14,7 @@ function NoteRoot({ className, color, children, ...rest }: NoteProps) {
|
|
|
14
14
|
<div
|
|
15
15
|
className={classNames(
|
|
16
16
|
color && `palette-${color}`,
|
|
17
|
-
'
|
|
17
|
+
'foc-contained',
|
|
18
18
|
'layer-variants:[&:has(input:focus[data-focus-clicked]),&:has(textarea:focus[data-focus-clicked])]:(ring ring-4 bg-lighten-3 ring-main-light)',
|
|
19
19
|
className,
|
|
20
20
|
)}
|
|
@@ -34,7 +34,7 @@ function NoteRoot({ className, color, children, ...rest }: NoteProps) {
|
|
|
34
34
|
aria-hidden
|
|
35
35
|
>
|
|
36
36
|
{/* folded corner */}
|
|
37
|
-
<div className="layer-components:(relative h-[20px] w-[20px] flex-[0_0_20px] border-0 border-solid border-main-dark) layer-variants:(border-b
|
|
37
|
+
<div className="layer-components:(relative h-[20px] w-[20px] flex-[0_0_20px] border-0 border-solid border-main-dark) layer-variants:(border-b border-l)">
|
|
38
38
|
{/* top corner */}
|
|
39
39
|
<div
|
|
40
40
|
className={`layer-components:(box-content h-0 w-0 transform-origin-br translate--7px rotate--45 border-13px border-solid border-transparent border-r-main-wash border-r-darken-1)`}
|
|
@@ -43,7 +43,7 @@ function NoteRoot({ className, color, children, ...rest }: NoteProps) {
|
|
|
43
43
|
<div className="layer-components:(absolute left-9px top--3px h-27px w-0.5px transform-origin-cc rotate--45 bg-main-dark)" />
|
|
44
44
|
</div>
|
|
45
45
|
{/* bottom right corner */}
|
|
46
|
-
<div className="layer-components:(flex-1 border-0 border-solid bg-main-wash bg-darken-1 border-main-dark) layer-variants:(border-b
|
|
46
|
+
<div className="layer-components:(flex-1 border-0 border-solid bg-main-wash bg-darken-1 border-main-dark) layer-variants:(border-b border-r)" />
|
|
47
47
|
</div>
|
|
48
48
|
</div>
|
|
49
49
|
</div>
|
|
@@ -4,7 +4,7 @@ export const popupClassName = clsx(
|
|
|
4
4
|
'layer-primitives:(max-w-90vw min-w-120px border rounded-md shadow-lg transition bg-white border-black)',
|
|
5
5
|
'layer-primitives:transform-origin-[var(--transform-origin)]',
|
|
6
6
|
'layer-primitives:(max-h-[--available-height] max-w-[--available-width])',
|
|
7
|
-
'layer-primitives:
|
|
7
|
+
'layer-primitives:foc',
|
|
8
8
|
|
|
9
9
|
'transform-origin-[--transform-origin] will-change-transform',
|
|
10
10
|
'important:motion-reduce:transition-none',
|
|
@@ -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
|
+
});
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { createContext, ReactNode, useContext } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
useThemedTitleBar,
|
|
4
|
+
useVirtualKeyboardFocusBehavior,
|
|
5
|
+
useVisualViewportOffset,
|
|
6
|
+
} from '../../hooks.js';
|
|
3
7
|
import { useVirtualKeyboardBehavior } from '../../hooks/useVirtualKeyboardBehavior.js';
|
|
4
8
|
import { IconSpritesheet } from '../icon/index.js';
|
|
5
9
|
import { ParticleLayer } from '../particles/index.js';
|
|
6
10
|
import { PwaInstall } from '../pwaInstall/PwaInstall.js';
|
|
7
11
|
import { DefaultToastProvider, Toaster } from '../toasts/toasts.js';
|
|
8
12
|
import { TooltipProvider } from '../tooltip/index.js';
|
|
13
|
+
import { TweakPane } from './TweakPane.js';
|
|
9
14
|
|
|
10
15
|
export interface ProviderProps {
|
|
11
16
|
children?: ReactNode;
|
|
@@ -14,6 +19,7 @@ export interface ProviderProps {
|
|
|
14
19
|
virtualKeyboardBehavior?: 'overlay' | 'displace';
|
|
15
20
|
disableTitleBarColor?: boolean;
|
|
16
21
|
manifestPath?: string;
|
|
22
|
+
tweaks?: boolean;
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
/**
|
|
@@ -26,8 +32,10 @@ export function Provider({
|
|
|
26
32
|
virtualKeyboardBehavior = 'displace',
|
|
27
33
|
disableTitleBarColor,
|
|
28
34
|
manifestPath,
|
|
35
|
+
tweaks,
|
|
29
36
|
}: ProviderProps) {
|
|
30
37
|
useVisualViewportOffset(disableViewportOffset);
|
|
38
|
+
useVirtualKeyboardFocusBehavior();
|
|
31
39
|
const supportedVirtualKeyboardBehavior =
|
|
32
40
|
typeof navigator !== 'undefined' && 'virtualKeyboard' in navigator
|
|
33
41
|
? virtualKeyboardBehavior
|
|
@@ -39,6 +47,7 @@ export function Provider({
|
|
|
39
47
|
<IconSpritesheet />
|
|
40
48
|
<Toaster />
|
|
41
49
|
<PwaInstall manifestPath={manifestPath} />
|
|
50
|
+
{tweaks && <TweakPane />}
|
|
42
51
|
</>
|
|
43
52
|
);
|
|
44
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
|
+
}
|