@cdx-ui/components 0.1.3 → 0.1.4
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/coverage.svg +1 -1
- package/lib/commonjs/components/Avatar/index.js +30 -8
- package/lib/commonjs/components/Avatar/index.js.map +1 -1
- package/lib/commonjs/components/Avatar/styles.js +163 -7
- package/lib/commonjs/components/Avatar/styles.js.map +1 -1
- package/lib/commonjs/components/CLAUDE.md +2 -1
- package/lib/commonjs/components/Chip/styles.js +1 -1
- package/lib/commonjs/components/Chip/styles.js.map +1 -1
- package/lib/commonjs/components/Drawer/animation.js +13 -0
- package/lib/commonjs/components/Drawer/animation.js.map +1 -0
- package/lib/commonjs/components/Drawer/index.js +739 -0
- package/lib/commonjs/components/Drawer/index.js.map +1 -0
- package/lib/commonjs/components/Drawer/styles.js +185 -0
- package/lib/commonjs/components/Drawer/styles.js.map +1 -0
- package/lib/commonjs/components/Drawer/utils.js +95 -0
- package/lib/commonjs/components/Drawer/utils.js.map +1 -0
- package/lib/commonjs/components/InsuranceDisclosure/styles.js +1 -1
- package/lib/commonjs/components/InsuranceDisclosure/styles.js.map +1 -1
- package/lib/commonjs/components/Menu/index.js +187 -61
- package/lib/commonjs/components/Menu/index.js.map +1 -1
- package/lib/commonjs/components/Menu/styles.js +32 -37
- package/lib/commonjs/components/Menu/styles.js.map +1 -1
- package/lib/commonjs/components/Select/index.js +2 -10
- package/lib/commonjs/components/Select/index.js.map +1 -1
- package/lib/commonjs/components/Tabs/styles.js +9 -10
- package/lib/commonjs/components/Tabs/styles.js.map +1 -1
- package/lib/commonjs/components/Toast/styles.js +1 -1
- package/lib/commonjs/components/Toast/styles.js.map +1 -1
- package/lib/commonjs/components/index.js +12 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/figma/Avatar.figma.js +18 -4
- package/lib/commonjs/figma/Avatar.figma.js.map +1 -1
- package/lib/commonjs/figma/Drawer.Content.figma.js +29 -0
- package/lib/commonjs/figma/Drawer.Content.figma.js.map +1 -0
- package/lib/commonjs/figma/Drawer.Description.figma.js +20 -0
- package/lib/commonjs/figma/Drawer.Description.figma.js.map +1 -0
- package/lib/commonjs/figma/Drawer.Footer.figma.js +41 -0
- package/lib/commonjs/figma/Drawer.Footer.figma.js.map +1 -0
- package/lib/commonjs/figma/Drawer.Header.figma.js +45 -0
- package/lib/commonjs/figma/Drawer.Header.figma.js.map +1 -0
- package/lib/commonjs/figma/Drawer.Title.figma.js +20 -0
- package/lib/commonjs/figma/Drawer.Title.figma.js.map +1 -0
- package/lib/commonjs/figma/Drawer.figma.js +41 -0
- package/lib/commonjs/figma/Drawer.figma.js.map +1 -0
- package/lib/commonjs/figma/Menu.Item.figma.js +33 -5
- package/lib/commonjs/figma/Menu.Item.figma.js.map +1 -1
- package/lib/commonjs/figma/icons.figma.batch.json +262 -2
- package/lib/module/components/Avatar/index.js +30 -8
- package/lib/module/components/Avatar/index.js.map +1 -1
- package/lib/module/components/Avatar/styles.js +163 -7
- package/lib/module/components/Avatar/styles.js.map +1 -1
- package/lib/module/components/CLAUDE.md +2 -1
- package/lib/module/components/Chip/styles.js +1 -1
- package/lib/module/components/Chip/styles.js.map +1 -1
- package/lib/module/components/Drawer/animation.js +7 -0
- package/lib/module/components/Drawer/animation.js.map +1 -0
- package/lib/module/components/Drawer/index.js +724 -0
- package/lib/module/components/Drawer/index.js.map +1 -0
- package/lib/module/components/Drawer/styles.js +181 -0
- package/lib/module/components/Drawer/styles.js.map +1 -0
- package/lib/module/components/Drawer/utils.js +86 -0
- package/lib/module/components/Drawer/utils.js.map +1 -0
- package/lib/module/components/InsuranceDisclosure/styles.js +1 -1
- package/lib/module/components/InsuranceDisclosure/styles.js.map +1 -1
- package/lib/module/components/Menu/index.js +178 -52
- package/lib/module/components/Menu/index.js.map +1 -1
- package/lib/module/components/Menu/styles.js +31 -36
- package/lib/module/components/Menu/styles.js.map +1 -1
- package/lib/module/components/Select/index.js +3 -11
- package/lib/module/components/Select/index.js.map +1 -1
- package/lib/module/components/Tabs/styles.js +9 -10
- package/lib/module/components/Tabs/styles.js.map +1 -1
- package/lib/module/components/Toast/styles.js +1 -1
- package/lib/module/components/Toast/styles.js.map +1 -1
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/figma/Avatar.figma.js +18 -4
- package/lib/module/figma/Avatar.figma.js.map +1 -1
- package/lib/module/figma/Drawer.Content.figma.js +23 -0
- package/lib/module/figma/Drawer.Content.figma.js.map +1 -0
- package/lib/module/figma/Drawer.Description.figma.js +14 -0
- package/lib/module/figma/Drawer.Description.figma.js.map +1 -0
- package/lib/module/figma/Drawer.Footer.figma.js +35 -0
- package/lib/module/figma/Drawer.Footer.figma.js.map +1 -0
- package/lib/module/figma/Drawer.Header.figma.js +39 -0
- package/lib/module/figma/Drawer.Header.figma.js.map +1 -0
- package/lib/module/figma/Drawer.Title.figma.js +14 -0
- package/lib/module/figma/Drawer.Title.figma.js.map +1 -0
- package/lib/module/figma/Drawer.figma.js +35 -0
- package/lib/module/figma/Drawer.figma.js.map +1 -0
- package/lib/module/figma/Menu.Item.figma.js +33 -5
- package/lib/module/figma/Menu.Item.figma.js.map +1 -1
- package/lib/module/figma/icons.figma.batch.json +262 -2
- package/lib/typescript/components/Avatar/index.d.ts +19 -1
- package/lib/typescript/components/Avatar/index.d.ts.map +1 -1
- package/lib/typescript/components/Avatar/styles.d.ts +10 -1
- package/lib/typescript/components/Avatar/styles.d.ts.map +1 -1
- package/lib/typescript/components/Drawer/animation.d.ts +9 -0
- package/lib/typescript/components/Drawer/animation.d.ts.map +1 -0
- package/lib/typescript/components/Drawer/index.d.ts +106 -0
- package/lib/typescript/components/Drawer/index.d.ts.map +1 -0
- package/lib/typescript/components/Drawer/styles.d.ts +32 -0
- package/lib/typescript/components/Drawer/styles.d.ts.map +1 -0
- package/lib/typescript/components/Drawer/utils.d.ts +23 -0
- package/lib/typescript/components/Drawer/utils.d.ts.map +1 -0
- package/lib/typescript/components/InsuranceDisclosure/styles.d.ts.map +1 -1
- package/lib/typescript/components/Menu/index.d.ts +29 -2
- package/lib/typescript/components/Menu/index.d.ts.map +1 -1
- package/lib/typescript/components/Menu/styles.d.ts +6 -2
- package/lib/typescript/components/Menu/styles.d.ts.map +1 -1
- package/lib/typescript/components/Select/index.d.ts.map +1 -1
- package/lib/typescript/components/Tabs/styles.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/figma/Avatar.figma.d.ts.map +1 -1
- package/lib/typescript/figma/Drawer.Content.figma.d.ts +8 -0
- package/lib/typescript/figma/Drawer.Content.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Drawer.Description.figma.d.ts +8 -0
- package/lib/typescript/figma/Drawer.Description.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Drawer.Footer.figma.d.ts +11 -0
- package/lib/typescript/figma/Drawer.Footer.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Drawer.Header.figma.d.ts +8 -0
- package/lib/typescript/figma/Drawer.Header.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Drawer.Title.figma.d.ts +8 -0
- package/lib/typescript/figma/Drawer.Title.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Drawer.figma.d.ts +8 -0
- package/lib/typescript/figma/Drawer.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Menu.Item.figma.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/Avatar/index.tsx +45 -9
- package/src/components/Avatar/styles.ts +106 -23
- package/src/components/CLAUDE.md +2 -1
- package/src/components/Chip/styles.ts +1 -1
- package/src/components/Drawer/animation.ts +11 -0
- package/src/components/Drawer/index.tsx +896 -0
- package/src/components/Drawer/styles.ts +188 -0
- package/src/components/Drawer/utils.ts +83 -0
- package/src/components/InsuranceDisclosure/styles.ts +1 -3
- package/src/components/Menu/index.tsx +204 -62
- package/src/components/Menu/styles.ts +44 -54
- package/src/components/Select/index.tsx +7 -9
- package/src/components/Tabs/styles.ts +9 -10
- package/src/components/Toast/styles.ts +1 -1
- package/src/components/index.ts +1 -0
|
@@ -28,7 +28,6 @@ export const menuRootVariants = cva(
|
|
|
28
28
|
export const menuItemVariants = cva(
|
|
29
29
|
[
|
|
30
30
|
'flex-row items-center gap-2',
|
|
31
|
-
'min-h-9',
|
|
32
31
|
'rounded-lg',
|
|
33
32
|
TRANSITION_COLORS,
|
|
34
33
|
'data-[disabled=true]:opacity-50 data-[disabled=true]:pointer-events-none',
|
|
@@ -36,80 +35,63 @@ export const menuItemVariants = cva(
|
|
|
36
35
|
'data-[state=checked]:bg-surface-action-tint data-[state=checked]:font-medium',
|
|
37
36
|
Platform.select({
|
|
38
37
|
default: 'data-[active=true]:bg-surface-action-tint-active',
|
|
39
|
-
|
|
38
|
+
// Pointer clicks set `data-highlighted` for the roving tab stop. That must not
|
|
39
|
+
// keep the hover fill after the pointer leaves an unchecked item. Keyboard
|
|
40
|
+
// focus paints the fill via `data-focus-visible`.
|
|
41
|
+
web: 'data-[hover=true]:bg-surface-action-tint-hover data-[active=true]:data-[hover=true]:bg-surface-action-tint-active data-[focus-visible=true]:bg-surface-action-tint-hover',
|
|
40
42
|
}),
|
|
41
43
|
],
|
|
42
44
|
{
|
|
43
45
|
variants: {
|
|
44
46
|
color: {
|
|
45
47
|
neutral: 'text-content-primary',
|
|
46
|
-
danger:
|
|
47
|
-
'text-content-danger
|
|
48
|
+
danger: [
|
|
49
|
+
'text-content-danger',
|
|
50
|
+
'data-[hover=true]:bg-surface-danger-tint-hover',
|
|
51
|
+
Platform.select({
|
|
52
|
+
default: 'data-[highlighted=true]:bg-surface-danger-tint-hover',
|
|
53
|
+
web: 'data-[focus-visible=true]:bg-surface-danger-tint-hover',
|
|
54
|
+
}),
|
|
55
|
+
].join(' '),
|
|
48
56
|
},
|
|
49
57
|
inset: {
|
|
50
|
-
|
|
51
|
-
|
|
58
|
+
// Label lines up with icon items: px-3 + size-5 icon + gap-2.
|
|
59
|
+
true: 'ps-8 pe-3 py-2',
|
|
60
|
+
false: 'px-3 py-2',
|
|
52
61
|
},
|
|
53
|
-
|
|
54
|
-
default: '
|
|
55
|
-
|
|
62
|
+
layout: {
|
|
63
|
+
default: 'min-h-9',
|
|
64
|
+
// Filter padding overrides inset so filter chrome stays compact.
|
|
65
|
+
filter: 'min-h-0 px-2 py-1.5',
|
|
56
66
|
},
|
|
57
67
|
},
|
|
58
|
-
compoundVariants: [
|
|
59
|
-
{
|
|
60
|
-
inset: true,
|
|
61
|
-
size: 'default',
|
|
62
|
-
class: 'ps-8 pe-3 py-2',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
inset: true,
|
|
66
|
-
size: 'small',
|
|
67
|
-
class: 'ps-8 pe-2.5 py-1.5',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
inset: false,
|
|
71
|
-
size: 'default',
|
|
72
|
-
class: 'px-3 py-2',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
inset: false,
|
|
76
|
-
size: 'small',
|
|
77
|
-
class: 'px-2.5 py-1.5',
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
68
|
defaultVariants: {
|
|
81
69
|
color: 'neutral',
|
|
82
70
|
inset: false,
|
|
83
|
-
|
|
71
|
+
layout: 'default',
|
|
84
72
|
},
|
|
85
73
|
},
|
|
86
74
|
);
|
|
87
75
|
|
|
88
|
-
export const menuItemLabelVariants = cva(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
web: 'min-w-0 flex-1',
|
|
94
|
-
}),
|
|
95
|
-
],
|
|
96
|
-
{
|
|
97
|
-
variants: {
|
|
98
|
-
size: {
|
|
99
|
-
default: 'text-[0.875rem]',
|
|
100
|
-
small: 'text-[0.75rem]',
|
|
101
|
-
},
|
|
102
|
-
color: {
|
|
103
|
-
neutral: 'text-content-primary',
|
|
104
|
-
danger: 'text-content-danger',
|
|
105
|
-
},
|
|
76
|
+
export const menuItemLabelVariants = cva(['text-start', 'text-[0.875rem]'], {
|
|
77
|
+
variants: {
|
|
78
|
+
color: {
|
|
79
|
+
neutral: 'text-content-primary',
|
|
80
|
+
danger: 'text-content-danger',
|
|
106
81
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
82
|
+
layout: {
|
|
83
|
+
default: Platform.select({
|
|
84
|
+
default: 'shrink-0',
|
|
85
|
+
web: 'min-w-0 flex-1',
|
|
86
|
+
}),
|
|
87
|
+
filter: 'min-w-0 flex-1 break-words',
|
|
110
88
|
},
|
|
111
89
|
},
|
|
112
|
-
|
|
90
|
+
defaultVariants: {
|
|
91
|
+
color: 'neutral',
|
|
92
|
+
layout: 'default',
|
|
93
|
+
},
|
|
94
|
+
});
|
|
113
95
|
|
|
114
96
|
export const menuItemIconVariants = cva(['shrink-0', 'size-5'], {
|
|
115
97
|
variants: {
|
|
@@ -149,5 +131,13 @@ export const menuSeparatorVariants = cva([
|
|
|
149
131
|
|
|
150
132
|
export const menuSeparatorLineVariants = cva(['h-px w-full bg-stroke-secondary']);
|
|
151
133
|
|
|
134
|
+
export const menuGroupHeaderVariants = cva(['flex-row items-center gap-2', 'px-2 py-1.5']);
|
|
135
|
+
|
|
136
|
+
export const menuItemActionVariants = cva(['ms-auto shrink-0']);
|
|
137
|
+
|
|
138
|
+
export const menuItemControlVariants = cva(['shrink-0']);
|
|
139
|
+
|
|
140
|
+
export const menuItemCountVariants = cva(['shrink-0 text-content-secondary', 'text-[0.875rem]']);
|
|
141
|
+
|
|
152
142
|
export type MenuRootVariantProps = VariantProps<typeof menuRootVariants>;
|
|
153
143
|
export type MenuItemVariantProps = VariantProps<typeof menuItemVariants>;
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import { cn, ParentContext, useParentContext, useStyleContext } from '@cdx-ui/utils';
|
|
22
22
|
import { Icon, IconProps } from '../Icon';
|
|
23
23
|
import { Menu } from '../Menu';
|
|
24
|
-
import {
|
|
24
|
+
import { menuItemVariants } from '../Menu/styles';
|
|
25
25
|
import { positionToDataIcon, type IconSlotPosition } from '../../utils/positionToDataIcon';
|
|
26
26
|
import {
|
|
27
27
|
type SelectVariantProps,
|
|
@@ -34,9 +34,6 @@ const SCOPE = 'SELECT';
|
|
|
34
34
|
|
|
35
35
|
const useSelectStyleContext = () => useStyleContext(SCOPE) as SelectVariantProps;
|
|
36
36
|
|
|
37
|
-
const toMenuItemSize = (size: SelectVariantProps['size'] | undefined) =>
|
|
38
|
-
size === 'small' ? 'small' : 'default';
|
|
39
|
-
|
|
40
37
|
// =============================================================================
|
|
41
38
|
// STYLED ROOT
|
|
42
39
|
// =============================================================================
|
|
@@ -297,10 +294,13 @@ const SelectItem = forwardRef<View, SelectItemProps>(
|
|
|
297
294
|
({ asChild, indicator, className, children, style, value: itemValue, ...props }, ref) => {
|
|
298
295
|
const { size } = useSelectStyleContext();
|
|
299
296
|
const { value: selectedValue } = useSelectContext();
|
|
300
|
-
const menuSize = toMenuItemSize(size);
|
|
301
297
|
const checked = selectedValue === itemValue;
|
|
302
298
|
|
|
303
|
-
const computedClassName = cn(
|
|
299
|
+
const computedClassName = cn(
|
|
300
|
+
menuItemVariants(),
|
|
301
|
+
size === 'small' ? 'px-2.5 py-1.5' : undefined,
|
|
302
|
+
className,
|
|
303
|
+
);
|
|
304
304
|
const selectedIndicator =
|
|
305
305
|
indicator === undefined ? (
|
|
306
306
|
<Menu.ItemIndicator isChecked={checked} />
|
|
@@ -351,15 +351,13 @@ const SelectItemLabel = forwardRef<Text, SelectItemLabelProps>(
|
|
|
351
351
|
({ asChild, className, style, children, ...props }, ref) => {
|
|
352
352
|
const { size } = useSelectStyleContext();
|
|
353
353
|
const { checked } = useSelectItemContext();
|
|
354
|
-
const menuSize = toMenuItemSize(size);
|
|
355
354
|
|
|
356
355
|
return (
|
|
357
356
|
<Menu.ItemLabel
|
|
358
357
|
ref={ref}
|
|
359
358
|
asChild={asChild}
|
|
360
359
|
isChecked={checked}
|
|
361
|
-
|
|
362
|
-
className={cn(menuItemLabelVariants({ size: menuSize }), className)}
|
|
360
|
+
className={cn(size === 'small' ? 'text-[0.75rem]' : undefined, className)}
|
|
363
361
|
style={style}
|
|
364
362
|
{...props}
|
|
365
363
|
{...mergeDataAttributes(
|
|
@@ -321,16 +321,15 @@ export const tabsTabLabelVariants = cva('body-md', {
|
|
|
321
321
|
state: {
|
|
322
322
|
// Selection state is a CVA input (not a `data-[]` selector) so inactive/active
|
|
323
323
|
// typography reconciles on native — `data-[state=active]:` on `Text` is unreliable
|
|
324
|
-
// there
|
|
325
|
-
//
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}),
|
|
324
|
+
// there.
|
|
325
|
+
//
|
|
326
|
+
// Weight comes from `font-medium` / `font-semibold` over the family `body-md`
|
|
327
|
+
// already sets, which is how every other component expresses weight and is
|
|
328
|
+
// correct on all three platforms. The `font-sans-medium` family tokens are a
|
|
329
|
+
// native concern (React Native needs a family per face) and are not authoring
|
|
330
|
+
// API — see packages/styles/src/webFonts.ts.
|
|
331
|
+
inactive: 'font-medium text-content-secondary',
|
|
332
|
+
active: 'font-semibold text-content-primary',
|
|
334
333
|
},
|
|
335
334
|
},
|
|
336
335
|
defaultVariants: { state: 'inactive' },
|
|
@@ -132,7 +132,7 @@ export const toastWrapperVariants = cva(
|
|
|
132
132
|
},
|
|
133
133
|
);
|
|
134
134
|
|
|
135
|
-
export const toastLabelVariants = cva(['text-base font-
|
|
135
|
+
export const toastLabelVariants = cva(['text-base font-medium'], {
|
|
136
136
|
variants: {
|
|
137
137
|
color: {
|
|
138
138
|
neutral: 'text-content-primary',
|
package/src/components/index.ts
CHANGED