@a-type/ui 4.0.3 → 4.0.6
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/cjs/components/dialog/Dialog.d.ts +4 -3
- package/dist/cjs/components/dialog/Dialog.js +4 -2
- package/dist/cjs/components/dialog/Dialog.js.map +1 -1
- package/dist/cjs/components/dialog/Dialog.stories.d.ts +1 -1
- package/dist/cjs/components/dialog/Dialog.stories.js +2 -1
- package/dist/cjs/components/dialog/Dialog.stories.js.map +1 -1
- package/dist/cjs/components/scrollArea/ScrollArea.d.ts +10 -4
- package/dist/cjs/components/scrollArea/ScrollArea.js +15 -7
- package/dist/cjs/components/scrollArea/ScrollArea.js.map +1 -1
- package/dist/cjs/components/scrollArea/ScrollArea.stories.d.ts +1 -0
- package/dist/cjs/components/scrollArea/ScrollArea.stories.js +13 -2
- package/dist/cjs/components/scrollArea/ScrollArea.stories.js.map +1 -1
- package/dist/cjs/components/switch/Switch.js +2 -2
- package/dist/cjs/components/switch/Switch.js.map +1 -1
- package/dist/css/main.css +2 -2
- package/dist/esm/components/dialog/Dialog.d.ts +4 -3
- package/dist/esm/components/dialog/Dialog.js +4 -2
- package/dist/esm/components/dialog/Dialog.js.map +1 -1
- package/dist/esm/components/dialog/Dialog.stories.d.ts +1 -1
- package/dist/esm/components/dialog/Dialog.stories.js +2 -1
- package/dist/esm/components/dialog/Dialog.stories.js.map +1 -1
- package/dist/esm/components/scrollArea/ScrollArea.d.ts +10 -4
- package/dist/esm/components/scrollArea/ScrollArea.js +15 -7
- package/dist/esm/components/scrollArea/ScrollArea.js.map +1 -1
- package/dist/esm/components/scrollArea/ScrollArea.stories.d.ts +1 -0
- package/dist/esm/components/scrollArea/ScrollArea.stories.js +13 -2
- package/dist/esm/components/scrollArea/ScrollArea.stories.js.map +1 -1
- package/dist/esm/components/switch/Switch.js +2 -2
- package/dist/esm/components/switch/Switch.js.map +1 -1
- package/package.json +1 -1
- package/src/components/dialog/Dialog.stories.tsx +5 -0
- package/src/components/dialog/Dialog.tsx +17 -2
- package/src/components/scrollArea/ScrollArea.stories.tsx +96 -71
- package/src/components/scrollArea/ScrollArea.tsx +37 -10
- package/src/components/switch/Switch.tsx +2 -2
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ScrollArea as BaseScrollArea,
|
|
3
|
+
ScrollAreaContentProps,
|
|
3
4
|
ScrollAreaRootProps,
|
|
4
5
|
ScrollAreaScrollbarProps,
|
|
5
6
|
} from '@base-ui/react/scroll-area';
|
|
7
|
+
import { Ref } from 'react';
|
|
6
8
|
import { withClassName } from '../../hooks.js';
|
|
7
9
|
|
|
8
10
|
export type * from '@base-ui/react/scroll-area';
|
|
9
11
|
|
|
10
12
|
export const ScrollAreaRoot = withClassName(
|
|
11
13
|
BaseScrollArea.Root,
|
|
12
|
-
'layer-components:(min-w-0 min-h-0 flex flex-col)',
|
|
14
|
+
'layer-components:(min-w-0 min-h-0 flex flex-col box-border)',
|
|
13
15
|
);
|
|
14
16
|
|
|
15
17
|
export const ScrollAreaViewport = withClassName(
|
|
16
18
|
BaseScrollArea.Viewport,
|
|
17
|
-
'layer-components:(h-full outline-none
|
|
19
|
+
'layer-components:(h-full outline-none min-h-0)',
|
|
18
20
|
'layer-components:focus-visible:(outline-none ring-2 ring-accent)',
|
|
19
21
|
);
|
|
20
22
|
|
|
21
23
|
export const ScrollAreaVerticalFades = withClassName(
|
|
22
24
|
'div',
|
|
23
25
|
'layer-components:(pointer-events-none absolute inset-0 [--scroll-area-overflow-y-start:inherit] [--scroll-area-overflow-y-end:inherit])',
|
|
24
|
-
'layer-components:before:(content-empty [--scroll-area-overflow-y-start:inherit] top-0 block left-0 w-full absolute transition-height h-[min(40px,var(--scroll-area-overflow-y-start
|
|
25
|
-
'layer-components:after:(content-empty [--scroll-area-overflow-y-end:inherit] bottom-0 block left-0 w-full absolute transition-height h-[min(40px,var(--scroll-area-overflow-y-end
|
|
26
|
+
'layer-components:before:(content-empty [--scroll-area-overflow-y-start:inherit] top-0 block left-0 w-full absolute transition-height h-[min(40px,var(--scroll-area-overflow-y-start,40px))] bg-gradient-to-b bg-gradient-from-bg bg-gradient-to-transparent)',
|
|
27
|
+
'layer-components:after:(content-empty [--scroll-area-overflow-y-end:inherit] bottom-0 block left-0 w-full absolute transition-height h-[min(40px,var(--scroll-area-overflow-y-end,40px))] bg-gradient-to-t bg-gradient-from-bg bg-gradient-to-transparent)',
|
|
26
28
|
);
|
|
27
29
|
|
|
28
30
|
export const ScrollAreaHorizontalFades = withClassName(
|
|
29
31
|
'div',
|
|
30
32
|
'layer-components:(pointer-events-none absolute inset-0 [--scroll-area-overflow-x-start:inherit] [--scroll-area-overflow-x-end:inherit])',
|
|
31
|
-
'layer-components:before:(content-empty [--scroll-area-overflow-x-start:inherit] left-0 block top-0 h-full absolute transition-width w-[min(40px,var(--scroll-area-overflow-x-start
|
|
32
|
-
'layer-components:after:(content-empty [--scroll-area-overflow-x-end:inherit] right-0 block top-0 h-full absolute transition-width w-[min(40px,var(--scroll-area-overflow-x-end
|
|
33
|
+
'layer-components:before:(content-empty [--scroll-area-overflow-x-start:inherit] left-0 block top-0 h-full absolute transition-width w-[min(40px,var(--scroll-area-overflow-x-start,40px))] bg-gradient-to-r bg-gradient-from-bg bg-gradient-to-transparent)',
|
|
34
|
+
'layer-components:after:(content-empty [--scroll-area-overflow-x-end:inherit] right-0 block top-0 h-full absolute transition-width w-[min(40px,var(--scroll-area-overflow-x-end,40px))] bg-gradient-to-l bg-gradient-from-bg bg-gradient-to-transparent)',
|
|
33
35
|
);
|
|
34
36
|
|
|
35
37
|
export const ScrollAreaViewportFades = () => (
|
|
@@ -39,9 +41,20 @@ export const ScrollAreaViewportFades = () => (
|
|
|
39
41
|
</>
|
|
40
42
|
);
|
|
41
43
|
|
|
44
|
+
const BaseScrollContentWithoutMinWidth = (
|
|
45
|
+
props: ScrollAreaContentProps & { ref?: Ref<HTMLDivElement> },
|
|
46
|
+
) => (
|
|
47
|
+
<BaseScrollArea.Content
|
|
48
|
+
{...props}
|
|
49
|
+
style={{ ...props.style, minWidth: undefined }}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
BaseScrollContentWithoutMinWidth.displayName = 'ScrollAreaContent';
|
|
53
|
+
|
|
42
54
|
export const ScrollAreaContent = withClassName(
|
|
43
|
-
|
|
55
|
+
BaseScrollContentWithoutMinWidth,
|
|
44
56
|
'layer-components:(flex flex-col)',
|
|
57
|
+
'layer-components:[[data-scroll-direction=horizontal]>&,[data-scroll-direction=both]>&]:min-w-min-content',
|
|
45
58
|
);
|
|
46
59
|
|
|
47
60
|
export const ScrollAreaThumb = withClassName(
|
|
@@ -80,17 +93,31 @@ export const ScrollAreaCorner = withClassName(
|
|
|
80
93
|
|
|
81
94
|
const ScrollAreaDefault = ({
|
|
82
95
|
disableFades,
|
|
96
|
+
direction,
|
|
83
97
|
...props
|
|
84
98
|
}: ScrollAreaRootProps & {
|
|
85
99
|
disableFades?: boolean;
|
|
100
|
+
direction?: 'vertical' | 'horizontal' | 'both';
|
|
86
101
|
}) => (
|
|
87
102
|
<ScrollAreaRoot {...props}>
|
|
88
|
-
<ScrollAreaViewport
|
|
103
|
+
<ScrollAreaViewport
|
|
104
|
+
style={{
|
|
105
|
+
overflow:
|
|
106
|
+
direction === 'vertical'
|
|
107
|
+
? 'clip scroll'
|
|
108
|
+
: direction === 'horizontal'
|
|
109
|
+
? 'scroll clip'
|
|
110
|
+
: 'scroll scroll',
|
|
111
|
+
}}
|
|
112
|
+
data-scroll-direction={direction}
|
|
113
|
+
>
|
|
89
114
|
{props.children}
|
|
90
115
|
{!disableFades && <ScrollAreaViewportFades />}
|
|
91
116
|
</ScrollAreaViewport>
|
|
92
|
-
<ScrollAreaScrollbar />
|
|
93
|
-
|
|
117
|
+
{direction !== 'horizontal' && <ScrollAreaScrollbar />}
|
|
118
|
+
{direction !== 'vertical' && (
|
|
119
|
+
<ScrollAreaScrollbar orientation="horizontal" />
|
|
120
|
+
)}
|
|
94
121
|
<ScrollAreaCorner />
|
|
95
122
|
</ScrollAreaRoot>
|
|
96
123
|
);
|
|
@@ -3,7 +3,7 @@ import { withClassName } from '../../hooks/withClassName.js';
|
|
|
3
3
|
|
|
4
4
|
const SwitchRoot = withClassName(
|
|
5
5
|
BaseSwitch.Root,
|
|
6
|
-
'layer-components:(unset appearance-none flex transition-all cursor-pointer w-42px h-25px p-
|
|
6
|
+
'layer-components:(unset appearance-none flex transition-all cursor-pointer w-42px h-25px p-3px bg-gray-light rounded-lg relative border-default flex-shrink-0 shadow-sm shadow-inset)',
|
|
7
7
|
'layer-components:data-[checked]:bg-main',
|
|
8
8
|
'layer-components:hover:[&:not(:disabled)]:(bg-lighten-2 ring-2 ring-bg)',
|
|
9
9
|
'layer-components:active:[&:not(:disabled)]:(bg-darken-1 ring-4)',
|
|
@@ -13,7 +13,7 @@ const SwitchRoot = withClassName(
|
|
|
13
13
|
|
|
14
14
|
const SwitchThumb = withClassName(
|
|
15
15
|
BaseSwitch.Thumb,
|
|
16
|
-
'layer-components:(block aspect-1 h-full bg-white rounded-lg border-default transition-transform will-change-transform)',
|
|
16
|
+
'layer-components:(block aspect-1 h-full bg-white rounded-lg border-default transition-transform will-change-transform shadow-sm)',
|
|
17
17
|
'layer-components:data-[checked]:(translate-x-1rem)',
|
|
18
18
|
'layer-components:data-[checked]:before:(content-["✓"] flex items-center justify-center absolute top-0 left-0 w-full h-full text-xs text-main-ink)',
|
|
19
19
|
);
|