@cdx-ui/components 0.0.1-beta.64 → 0.0.1-beta.66
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/lib/commonjs/components/AlertDialog/index.js +12 -10
- package/lib/commonjs/components/AlertDialog/index.js.map +1 -1
- package/lib/commonjs/components/Avatar/index.js +125 -25
- package/lib/commonjs/components/Avatar/index.js.map +1 -1
- package/lib/commonjs/components/Button/index.js +127 -28
- package/lib/commonjs/components/Button/index.js.map +1 -1
- package/lib/commonjs/components/Button/styles.js +9 -3
- package/lib/commonjs/components/Button/styles.js.map +1 -1
- package/lib/commonjs/components/CLAUDE.md +115 -11
- package/lib/commonjs/components/Checkbox/index.js +69 -22
- package/lib/commonjs/components/Checkbox/index.js.map +1 -1
- package/lib/commonjs/components/Checkbox/styles.js +1 -1
- package/lib/commonjs/components/Checkbox/styles.js.map +1 -1
- package/lib/commonjs/components/Chip/index.js +44 -36
- package/lib/commonjs/components/Chip/index.js.map +1 -1
- package/lib/commonjs/components/Chip/styles.js +6 -35
- package/lib/commonjs/components/Chip/styles.js.map +1 -1
- package/lib/commonjs/components/Dialog/index.js +92 -72
- package/lib/commonjs/components/Dialog/index.js.map +1 -1
- package/lib/commonjs/components/Field/index.js +70 -26
- package/lib/commonjs/components/Field/index.js.map +1 -1
- package/lib/commonjs/components/Form/index.js +5 -12
- package/lib/commonjs/components/Form/index.js.map +1 -1
- package/lib/commonjs/components/IconButton/index.js +5 -33
- package/lib/commonjs/components/IconButton/index.js.map +1 -1
- package/lib/commonjs/components/Input/index.js +50 -20
- package/lib/commonjs/components/Input/index.js.map +1 -1
- package/lib/commonjs/components/Link/index.js +14 -7
- package/lib/commonjs/components/Link/index.js.map +1 -1
- package/lib/commonjs/components/ListItem/index.js +129 -54
- package/lib/commonjs/components/ListItem/index.js.map +1 -1
- package/lib/commonjs/components/OtpInput/index.js +94 -28
- package/lib/commonjs/components/OtpInput/index.js.map +1 -1
- package/lib/commonjs/components/ProgressBar/index.js +8 -13
- package/lib/commonjs/components/ProgressBar/index.js.map +1 -1
- package/lib/commonjs/components/Radio/index.js +51 -53
- package/lib/commonjs/components/Radio/index.js.map +1 -1
- package/lib/commonjs/components/Select/index.js +112 -46
- package/lib/commonjs/components/Select/index.js.map +1 -1
- package/lib/commonjs/components/Select/styles.js +2 -2
- package/lib/commonjs/components/Select/styles.js.map +1 -1
- package/lib/commonjs/components/Skeleton/index.js +37 -0
- package/lib/commonjs/components/Skeleton/index.js.map +1 -0
- package/lib/commonjs/components/Skeleton/styles.js +9 -0
- package/lib/commonjs/components/Skeleton/styles.js.map +1 -0
- package/lib/commonjs/components/Switch/BaseSwitch.js +23 -13
- package/lib/commonjs/components/Switch/BaseSwitch.js.map +1 -1
- package/lib/commonjs/components/Switch/BaseSwitch.web.js +25 -21
- package/lib/commonjs/components/Switch/BaseSwitch.web.js.map +1 -1
- package/lib/commonjs/components/Switch/index.js +34 -3
- package/lib/commonjs/components/Switch/index.js.map +1 -1
- package/lib/commonjs/components/Tile/index.js +150 -77
- package/lib/commonjs/components/Tile/index.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/Chip.figma.js +2 -2
- package/lib/commonjs/figma/Chip.figma.js.map +1 -1
- package/lib/commonjs/utils/positionToDataIcon.js +41 -0
- package/lib/commonjs/utils/positionToDataIcon.js.map +1 -0
- package/lib/module/components/AlertDialog/index.js +13 -11
- package/lib/module/components/AlertDialog/index.js.map +1 -1
- package/lib/module/components/Avatar/index.js +128 -28
- package/lib/module/components/Avatar/index.js.map +1 -1
- package/lib/module/components/Button/index.js +130 -32
- package/lib/module/components/Button/index.js.map +1 -1
- package/lib/module/components/Button/styles.js +8 -2
- package/lib/module/components/Button/styles.js.map +1 -1
- package/lib/module/components/CLAUDE.md +115 -11
- package/lib/module/components/Checkbox/index.js +72 -25
- package/lib/module/components/Checkbox/index.js.map +1 -1
- package/lib/module/components/Checkbox/styles.js +1 -1
- package/lib/module/components/Checkbox/styles.js.map +1 -1
- package/lib/module/components/Chip/index.js +47 -39
- package/lib/module/components/Chip/index.js.map +1 -1
- package/lib/module/components/Chip/styles.js +6 -35
- package/lib/module/components/Chip/styles.js.map +1 -1
- package/lib/module/components/Dialog/index.js +96 -76
- package/lib/module/components/Dialog/index.js.map +1 -1
- package/lib/module/components/Field/index.js +74 -31
- package/lib/module/components/Field/index.js.map +1 -1
- package/lib/module/components/Form/index.js +7 -14
- package/lib/module/components/Form/index.js.map +1 -1
- package/lib/module/components/IconButton/index.js +6 -34
- package/lib/module/components/IconButton/index.js.map +1 -1
- package/lib/module/components/Input/index.js +53 -23
- package/lib/module/components/Input/index.js.map +1 -1
- package/lib/module/components/Link/index.js +16 -8
- package/lib/module/components/Link/index.js.map +1 -1
- package/lib/module/components/ListItem/index.js +134 -59
- package/lib/module/components/ListItem/index.js.map +1 -1
- package/lib/module/components/OtpInput/index.js +94 -28
- package/lib/module/components/OtpInput/index.js.map +1 -1
- package/lib/module/components/ProgressBar/index.js +9 -14
- package/lib/module/components/ProgressBar/index.js.map +1 -1
- package/lib/module/components/Radio/index.js +54 -57
- package/lib/module/components/Radio/index.js.map +1 -1
- package/lib/module/components/Select/index.js +118 -52
- package/lib/module/components/Select/index.js.map +1 -1
- package/lib/module/components/Select/styles.js +2 -2
- package/lib/module/components/Select/styles.js.map +1 -1
- package/lib/module/components/Skeleton/index.js +32 -0
- package/lib/module/components/Skeleton/index.js.map +1 -0
- package/lib/module/components/Skeleton/styles.js +5 -0
- package/lib/module/components/Skeleton/styles.js.map +1 -0
- package/lib/module/components/Switch/BaseSwitch.js +24 -14
- package/lib/module/components/Switch/BaseSwitch.js.map +1 -1
- package/lib/module/components/Switch/BaseSwitch.web.js +26 -22
- package/lib/module/components/Switch/BaseSwitch.web.js.map +1 -1
- package/lib/module/components/Switch/index.js +35 -4
- package/lib/module/components/Switch/index.js.map +1 -1
- package/lib/module/components/Tile/index.js +155 -83
- package/lib/module/components/Tile/index.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/Chip.figma.js +2 -2
- package/lib/module/figma/Chip.figma.js.map +1 -1
- package/lib/module/utils/positionToDataIcon.js +38 -0
- package/lib/module/utils/positionToDataIcon.js.map +1 -0
- package/lib/typescript/components/AlertDialog/index.d.ts.map +1 -1
- package/lib/typescript/components/Avatar/index.d.ts +6 -2
- package/lib/typescript/components/Avatar/index.d.ts.map +1 -1
- package/lib/typescript/components/Button/index.d.ts +31 -8
- package/lib/typescript/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/components/Button/styles.d.ts +2 -1
- package/lib/typescript/components/Button/styles.d.ts.map +1 -1
- package/lib/typescript/components/Checkbox/index.d.ts +3 -1
- package/lib/typescript/components/Checkbox/index.d.ts.map +1 -1
- package/lib/typescript/components/Chip/index.d.ts +19 -9
- package/lib/typescript/components/Chip/index.d.ts.map +1 -1
- package/lib/typescript/components/Chip/styles.d.ts +0 -1
- package/lib/typescript/components/Chip/styles.d.ts.map +1 -1
- package/lib/typescript/components/Dialog/index.d.ts +12 -6
- package/lib/typescript/components/Dialog/index.d.ts.map +1 -1
- package/lib/typescript/components/Dialog/styles.d.ts +1 -1
- package/lib/typescript/components/Field/index.d.ts +14 -7
- package/lib/typescript/components/Field/index.d.ts.map +1 -1
- package/lib/typescript/components/Form/index.d.ts +4 -4
- package/lib/typescript/components/Form/index.d.ts.map +1 -1
- package/lib/typescript/components/IconButton/index.d.ts.map +1 -1
- package/lib/typescript/components/Input/index.d.ts +11 -3
- package/lib/typescript/components/Input/index.d.ts.map +1 -1
- package/lib/typescript/components/Link/index.d.ts +2 -0
- package/lib/typescript/components/Link/index.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/index.d.ts +28 -6
- package/lib/typescript/components/ListItem/index.d.ts.map +1 -1
- package/lib/typescript/components/OtpInput/index.d.ts +1 -1
- package/lib/typescript/components/OtpInput/index.d.ts.map +1 -1
- package/lib/typescript/components/ProgressBar/index.d.ts +4 -4
- package/lib/typescript/components/ProgressBar/index.d.ts.map +1 -1
- package/lib/typescript/components/Radio/index.d.ts +4 -0
- package/lib/typescript/components/Radio/index.d.ts.map +1 -1
- package/lib/typescript/components/Select/index.d.ts +35 -2
- package/lib/typescript/components/Select/index.d.ts.map +1 -1
- package/lib/typescript/components/Select/styles.d.ts.map +1 -1
- package/lib/typescript/components/Skeleton/index.d.ts +9 -0
- package/lib/typescript/components/Skeleton/index.d.ts.map +1 -0
- package/lib/typescript/components/Skeleton/styles.d.ts +4 -0
- package/lib/typescript/components/Skeleton/styles.d.ts.map +1 -0
- package/lib/typescript/components/Switch/BaseSwitch.d.ts +12 -5
- package/lib/typescript/components/Switch/BaseSwitch.d.ts.map +1 -1
- package/lib/typescript/components/Switch/BaseSwitch.web.d.ts +11 -5
- package/lib/typescript/components/Switch/BaseSwitch.web.d.ts.map +1 -1
- package/lib/typescript/components/Switch/index.d.ts +5 -1
- package/lib/typescript/components/Switch/index.d.ts.map +1 -1
- package/lib/typescript/components/Tile/index.d.ts +8 -2
- package/lib/typescript/components/Tile/index.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/utils/positionToDataIcon.d.ts +29 -0
- package/lib/typescript/utils/positionToDataIcon.d.ts.map +1 -0
- package/package.json +5 -5
- package/src/components/AlertDialog/index.tsx +13 -14
- package/src/components/Avatar/index.tsx +134 -44
- package/src/components/Button/index.tsx +216 -44
- package/src/components/Button/styles.ts +50 -38
- package/src/components/CLAUDE.md +115 -11
- package/src/components/Checkbox/index.tsx +93 -32
- package/src/components/Checkbox/styles.ts +1 -1
- package/src/components/Chip/index.tsx +88 -61
- package/src/components/Chip/styles.ts +6 -18
- package/src/components/Dialog/index.tsx +139 -99
- package/src/components/Field/index.tsx +113 -49
- package/src/components/Form/index.tsx +18 -14
- package/src/components/IconButton/index.tsx +7 -31
- package/src/components/Input/index.tsx +75 -32
- package/src/components/Link/index.tsx +38 -12
- package/src/components/ListItem/index.tsx +158 -73
- package/src/components/OtpInput/index.tsx +126 -43
- package/src/components/ProgressBar/index.tsx +11 -16
- package/src/components/Radio/index.tsx +76 -54
- package/src/components/Select/index.tsx +174 -59
- package/src/components/Select/styles.ts +1 -2
- package/src/components/Skeleton/index.tsx +42 -0
- package/src/components/Skeleton/styles.ts +5 -0
- package/src/components/Switch/BaseSwitch.tsx +38 -16
- package/src/components/Switch/BaseSwitch.web.tsx +28 -35
- package/src/components/Switch/index.tsx +51 -4
- package/src/components/Tile/index.tsx +145 -94
- package/src/components/index.ts +1 -0
- package/src/utils/positionToDataIcon.ts +34 -0
- package/lib/commonjs/components/Field/FieldLabel.js +0 -33
- package/lib/commonjs/components/Field/FieldLabel.js.map +0 -1
- package/lib/commonjs/components/Field/FieldLabel.web.js +0 -22
- package/lib/commonjs/components/Field/FieldLabel.web.js.map +0 -1
- package/lib/commonjs/components/Form/FormRoot.js +0 -25
- package/lib/commonjs/components/Form/FormRoot.js.map +0 -1
- package/lib/commonjs/components/Form/FormRoot.web.js +0 -17
- package/lib/commonjs/components/Form/FormRoot.web.js.map +0 -1
- package/lib/commonjs/components/Input/BaseInput.android.js +0 -20
- package/lib/commonjs/components/Input/BaseInput.android.js.map +0 -1
- package/lib/commonjs/components/Input/BaseInput.js +0 -13
- package/lib/commonjs/components/Input/BaseInput.js.map +0 -1
- package/lib/commonjs/components/Input/BaseInput.web.js +0 -50
- package/lib/commonjs/components/Input/BaseInput.web.js.map +0 -1
- package/lib/commonjs/components/Select/SelectTriggerHost.js +0 -10
- package/lib/commonjs/components/Select/SelectTriggerHost.js.map +0 -1
- package/lib/commonjs/components/Select/SelectTriggerHost.web.js +0 -102
- package/lib/commonjs/components/Select/SelectTriggerHost.web.js.map +0 -1
- package/lib/module/components/Field/FieldLabel.js +0 -29
- package/lib/module/components/Field/FieldLabel.js.map +0 -1
- package/lib/module/components/Field/FieldLabel.web.js +0 -17
- package/lib/module/components/Field/FieldLabel.web.js.map +0 -1
- package/lib/module/components/Form/FormRoot.js +0 -21
- package/lib/module/components/Form/FormRoot.js.map +0 -1
- package/lib/module/components/Form/FormRoot.web.js +0 -12
- package/lib/module/components/Form/FormRoot.web.js.map +0 -1
- package/lib/module/components/Input/BaseInput.android.js +0 -16
- package/lib/module/components/Input/BaseInput.android.js.map +0 -1
- package/lib/module/components/Input/BaseInput.js +0 -4
- package/lib/module/components/Input/BaseInput.js.map +0 -1
- package/lib/module/components/Input/BaseInput.web.js +0 -45
- package/lib/module/components/Input/BaseInput.web.js.map +0 -1
- package/lib/module/components/Select/SelectTriggerHost.js +0 -7
- package/lib/module/components/Select/SelectTriggerHost.js.map +0 -1
- package/lib/module/components/Select/SelectTriggerHost.web.js +0 -97
- package/lib/module/components/Select/SelectTriggerHost.web.js.map +0 -1
- package/lib/typescript/components/Field/FieldLabel.d.ts +0 -18
- package/lib/typescript/components/Field/FieldLabel.d.ts.map +0 -1
- package/lib/typescript/components/Field/FieldLabel.web.d.ts +0 -16
- package/lib/typescript/components/Field/FieldLabel.web.d.ts.map +0 -1
- package/lib/typescript/components/Form/FormRoot.d.ts +0 -14
- package/lib/typescript/components/Form/FormRoot.d.ts.map +0 -1
- package/lib/typescript/components/Form/FormRoot.web.d.ts +0 -10
- package/lib/typescript/components/Form/FormRoot.web.d.ts.map +0 -1
- package/lib/typescript/components/Input/BaseInput.android.d.ts +0 -3
- package/lib/typescript/components/Input/BaseInput.android.d.ts.map +0 -1
- package/lib/typescript/components/Input/BaseInput.d.ts +0 -2
- package/lib/typescript/components/Input/BaseInput.d.ts.map +0 -1
- package/lib/typescript/components/Input/BaseInput.web.d.ts +0 -3
- package/lib/typescript/components/Input/BaseInput.web.d.ts.map +0 -1
- package/lib/typescript/components/Select/SelectTriggerHost.d.ts +0 -3
- package/lib/typescript/components/Select/SelectTriggerHost.d.ts.map +0 -1
- package/lib/typescript/components/Select/SelectTriggerHost.web.d.ts +0 -16
- package/lib/typescript/components/Select/SelectTriggerHost.web.d.ts.map +0 -1
- package/src/components/Field/FieldLabel.tsx +0 -33
- package/src/components/Field/FieldLabel.web.tsx +0 -25
- package/src/components/Form/FormRoot.tsx +0 -20
- package/src/components/Form/FormRoot.web.tsx +0 -12
- package/src/components/Input/BaseInput.android.tsx +0 -13
- package/src/components/Input/BaseInput.tsx +0 -1
- package/src/components/Input/BaseInput.web.tsx +0 -41
- package/src/components/Select/SelectTriggerHost.tsx +0 -4
- package/src/components/Select/SelectTriggerHost.web.tsx +0 -143
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { forwardRef, useEffect } from 'react';
|
|
4
|
-
import { ActivityIndicator,
|
|
5
|
-
import {
|
|
6
|
-
import { cn,
|
|
3
|
+
import React, { forwardRef, useEffect, useMemo } from 'react';
|
|
4
|
+
import { ActivityIndicator, Text, View } from 'react-native';
|
|
5
|
+
import { ButtonRoot as ButtonRootPrimitive, Slot, dataAttributes, mergeDataAttributes } from '@cdx-ui/primitives';
|
|
6
|
+
import { cn, flattenChildren, ParentContext, useParentContext, useStyleContext } from '@cdx-ui/utils';
|
|
7
7
|
import { Icon } from '../Icon';
|
|
8
|
-
import {
|
|
8
|
+
import { positionToDataIcon } from '../../utils/positionToDataIcon';
|
|
9
|
+
import { buttonGroupVariants, buttonIconVariants, buttonRootVariants, buttonSpinnerColorVariants, buttonSpinnerVariants, buttonTextVariants } from './styles';
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
const SCOPE = 'BUTTON';
|
|
11
|
-
const Root = withStyleContext(Pressable, SCOPE);
|
|
12
12
|
const useButtonStyleContext = () => useStyleContext(SCOPE);
|
|
13
|
-
const ButtonPrimitive = createButton({
|
|
14
|
-
Root,
|
|
15
|
-
Text,
|
|
16
|
-
Group: View,
|
|
17
|
-
Spinner: ActivityIndicator,
|
|
18
|
-
Icon: View
|
|
19
|
-
});
|
|
20
13
|
|
|
21
14
|
// =============================================================================
|
|
22
15
|
// STYLED ROOT COMPONENT
|
|
@@ -49,27 +42,38 @@ const ButtonRoot = /*#__PURE__*/forwardRef(({
|
|
|
49
42
|
size,
|
|
50
43
|
fullWidth
|
|
51
44
|
}), className);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
context: {
|
|
45
|
+
const parent = useParentContext();
|
|
46
|
+
const ctx = useMemo(() => ({
|
|
47
|
+
...parent,
|
|
48
|
+
[SCOPE]: {
|
|
57
49
|
variant,
|
|
58
50
|
color,
|
|
59
51
|
size,
|
|
60
52
|
fullWidth
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
}
|
|
54
|
+
}), [parent, variant, color, size, fullWidth]);
|
|
55
|
+
return /*#__PURE__*/_jsx(ParentContext.Provider, {
|
|
56
|
+
value: ctx,
|
|
57
|
+
children: /*#__PURE__*/_jsx(ButtonRootPrimitive, {
|
|
58
|
+
ref: ref,
|
|
59
|
+
className: computedClassName,
|
|
60
|
+
style: style,
|
|
61
|
+
...props,
|
|
62
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
63
|
+
slot: 'button'
|
|
64
|
+
})),
|
|
65
|
+
children: children
|
|
66
|
+
})
|
|
64
67
|
});
|
|
65
68
|
});
|
|
66
69
|
ButtonRoot.displayName = 'Button';
|
|
67
70
|
|
|
68
71
|
// =============================================================================
|
|
69
|
-
// STYLED
|
|
72
|
+
// STYLED LABEL COMPONENT
|
|
70
73
|
// =============================================================================
|
|
71
74
|
|
|
72
75
|
const ButtonLabel = /*#__PURE__*/forwardRef(({
|
|
76
|
+
asChild,
|
|
73
77
|
className,
|
|
74
78
|
children,
|
|
75
79
|
style,
|
|
@@ -85,46 +89,110 @@ const ButtonLabel = /*#__PURE__*/forwardRef(({
|
|
|
85
89
|
color,
|
|
86
90
|
size
|
|
87
91
|
}), className);
|
|
88
|
-
|
|
92
|
+
const Comp = asChild ? Slot : Text;
|
|
93
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
89
94
|
ref: ref,
|
|
90
95
|
className: computedClassName,
|
|
91
96
|
style: style,
|
|
92
97
|
...props,
|
|
98
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
99
|
+
slot: 'button-label'
|
|
100
|
+
})),
|
|
93
101
|
children: children
|
|
94
102
|
});
|
|
95
103
|
});
|
|
96
104
|
ButtonLabel.displayName = 'Button.Label';
|
|
97
105
|
|
|
106
|
+
// =============================================================================
|
|
107
|
+
// STYLED GROUP COMPONENT
|
|
108
|
+
// =============================================================================
|
|
109
|
+
|
|
98
110
|
// TODO: Use ButtonGroupVariantProps
|
|
99
111
|
|
|
100
112
|
const ButtonGroup = /*#__PURE__*/forwardRef(({
|
|
113
|
+
asChild,
|
|
101
114
|
className,
|
|
102
115
|
children,
|
|
103
116
|
style,
|
|
104
117
|
flexDirection = 'row',
|
|
105
118
|
isAttached,
|
|
119
|
+
isDisabled,
|
|
120
|
+
isReversed,
|
|
121
|
+
reversed,
|
|
106
122
|
...props
|
|
107
123
|
}, ref) => {
|
|
124
|
+
const direction = flexDirection.includes('reverse') ? flexDirection === 'column-reverse' ? 'column' : 'row' : flexDirection;
|
|
125
|
+
let childrenArray = React.Children.toArray(flattenChildren(children));
|
|
126
|
+
childrenArray = isReversed || reversed ? [...childrenArray].reverse() : childrenArray;
|
|
127
|
+
const computedChildren = childrenArray.map((child, index) => {
|
|
128
|
+
if (typeof child === 'string' || typeof child === 'number') {
|
|
129
|
+
return child;
|
|
130
|
+
}
|
|
131
|
+
const attachedStyles = {};
|
|
132
|
+
if (index === 0) {
|
|
133
|
+
if (direction === 'column') {
|
|
134
|
+
attachedStyles.borderBottomLeftRadius = 0;
|
|
135
|
+
attachedStyles.borderBottomRightRadius = 0;
|
|
136
|
+
} else {
|
|
137
|
+
attachedStyles.borderTopRightRadius = 0;
|
|
138
|
+
attachedStyles.borderBottomRightRadius = 0;
|
|
139
|
+
}
|
|
140
|
+
} else if (index === childrenArray.length - 1) {
|
|
141
|
+
if (direction === 'column') {
|
|
142
|
+
attachedStyles.borderTopLeftRadius = 0;
|
|
143
|
+
attachedStyles.borderTopRightRadius = 0;
|
|
144
|
+
} else {
|
|
145
|
+
attachedStyles.borderTopLeftRadius = 0;
|
|
146
|
+
attachedStyles.borderBottomLeftRadius = 0;
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
attachedStyles.borderRadius = 0;
|
|
150
|
+
}
|
|
151
|
+
const childProps = {
|
|
152
|
+
isDisabled,
|
|
153
|
+
...child.props,
|
|
154
|
+
style: {
|
|
155
|
+
...(isAttached ? attachedStyles : {}),
|
|
156
|
+
...child.props.style
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
160
|
+
children: /*#__PURE__*/React.cloneElement(child, childProps)
|
|
161
|
+
}, child.key ?? `spaced-child-${index.toString()}`);
|
|
162
|
+
});
|
|
108
163
|
const groupClassName = cn(buttonGroupVariants({
|
|
109
164
|
flexDirection,
|
|
110
165
|
isAttached: !!isAttached
|
|
111
166
|
}), className);
|
|
112
|
-
|
|
167
|
+
const Comp = asChild ? Slot : View;
|
|
168
|
+
const gapProp = isAttached ? {
|
|
169
|
+
gap: 0
|
|
170
|
+
} : {};
|
|
171
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
113
172
|
ref: ref,
|
|
114
173
|
className: groupClassName,
|
|
115
174
|
style: [{
|
|
116
175
|
flexDirection
|
|
117
|
-
}, style],
|
|
118
|
-
isAttached: isAttached,
|
|
176
|
+
}, style, gapProp],
|
|
119
177
|
...props,
|
|
120
|
-
|
|
178
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
179
|
+
slot: 'button-group'
|
|
180
|
+
})),
|
|
181
|
+
children: computedChildren
|
|
121
182
|
});
|
|
122
183
|
});
|
|
123
184
|
ButtonGroup.displayName = 'Button.Group';
|
|
185
|
+
|
|
186
|
+
// =============================================================================
|
|
187
|
+
// STYLED ICON COMPONENT
|
|
188
|
+
// =============================================================================
|
|
189
|
+
|
|
124
190
|
const ButtonIcon = ({
|
|
191
|
+
asChild,
|
|
125
192
|
className,
|
|
126
193
|
style,
|
|
127
194
|
as,
|
|
195
|
+
position,
|
|
128
196
|
...props
|
|
129
197
|
}) => {
|
|
130
198
|
const {
|
|
@@ -137,34 +205,64 @@ const ButtonIcon = ({
|
|
|
137
205
|
color,
|
|
138
206
|
size
|
|
139
207
|
}), className);
|
|
208
|
+
if (asChild) {
|
|
209
|
+
return /*#__PURE__*/_jsx(Slot, {
|
|
210
|
+
className: computedClassName,
|
|
211
|
+
style: style,
|
|
212
|
+
...props,
|
|
213
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
214
|
+
slot: 'button-icon'
|
|
215
|
+
}), positionToDataIcon(position))
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
if (!as) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
140
221
|
return /*#__PURE__*/_jsx(Icon, {
|
|
141
222
|
as: as,
|
|
142
223
|
className: computedClassName,
|
|
143
224
|
style: style,
|
|
144
|
-
...props
|
|
225
|
+
...props,
|
|
226
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
227
|
+
slot: 'button-icon'
|
|
228
|
+
}), positionToDataIcon(position))
|
|
145
229
|
});
|
|
146
230
|
};
|
|
147
231
|
ButtonIcon.displayName = 'Button.Icon';
|
|
232
|
+
|
|
233
|
+
// =============================================================================
|
|
234
|
+
// STYLED SPINNER COMPONENT
|
|
235
|
+
// =============================================================================
|
|
236
|
+
|
|
148
237
|
const ButtonSpinner = /*#__PURE__*/forwardRef(({
|
|
238
|
+
asChild,
|
|
149
239
|
className,
|
|
150
240
|
colorClassName,
|
|
151
241
|
style,
|
|
242
|
+
position,
|
|
243
|
+
accessibilityLabel = 'Loading',
|
|
152
244
|
...props
|
|
153
245
|
}, ref) => {
|
|
154
246
|
const {
|
|
155
247
|
variant,
|
|
156
248
|
color
|
|
157
249
|
} = useButtonStyleContext();
|
|
158
|
-
const
|
|
250
|
+
const computedClassName = cn(buttonSpinnerVariants(), className);
|
|
251
|
+
const computedColorClassName = cn(buttonSpinnerColorVariants({
|
|
159
252
|
variant,
|
|
160
253
|
color
|
|
161
254
|
}), colorClassName);
|
|
162
|
-
|
|
255
|
+
const Comp = asChild ? Slot : ActivityIndicator;
|
|
256
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
163
257
|
ref: ref,
|
|
164
|
-
className:
|
|
258
|
+
className: computedClassName,
|
|
165
259
|
colorClassName: computedColorClassName,
|
|
166
260
|
style: style,
|
|
167
|
-
|
|
261
|
+
accessibilityLabel: accessibilityLabel,
|
|
262
|
+
...props,
|
|
263
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
264
|
+
slot: 'button-spinner'
|
|
265
|
+
}), positionToDataIcon(position))
|
|
168
266
|
});
|
|
169
267
|
});
|
|
170
268
|
ButtonSpinner.displayName = 'Button.Spinner';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useEffect","
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useEffect","useMemo","ActivityIndicator","Text","View","ButtonRoot","ButtonRootPrimitive","Slot","dataAttributes","mergeDataAttributes","cn","flattenChildren","ParentContext","useParentContext","useStyleContext","Icon","positionToDataIcon","buttonGroupVariants","buttonIconVariants","buttonRootVariants","buttonSpinnerColorVariants","buttonSpinnerVariants","buttonTextVariants","jsx","_jsx","SCOPE","useButtonStyleContext","hasWarnedStrongButtonVariant","variant","variantProp","color","size","fullWidth","className","children","style","props","ref","process","env","NODE_ENV","console","warn","computedClassName","parent","ctx","Provider","value","slot","displayName","ButtonLabel","asChild","Comp","ButtonGroup","flexDirection","isAttached","isDisabled","isReversed","reversed","direction","includes","childrenArray","Children","toArray","reverse","computedChildren","map","child","index","attachedStyles","borderBottomLeftRadius","borderBottomRightRadius","borderTopRightRadius","length","borderTopLeftRadius","borderRadius","childProps","Fragment","cloneElement","key","toString","groupClassName","gapProp","gap","ButtonIcon","as","position","ButtonSpinner","colorClassName","accessibilityLabel","computedColorClassName","Button","Object","assign","Label","Group","Spinner"],"sourceRoot":"../../../../src","sources":["components/Button/index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,OAAO,QAA2C,OAAO;AAChG,SACEC,iBAAiB,EACjBC,IAAI,EACJC,IAAI,QAKC,cAAc;AACrB,SACEC,UAAU,IAAIC,mBAAmB,EACjCC,IAAI,EACJC,cAAc,EACdC,mBAAmB,QAEd,oBAAoB;AAC3B,SACEC,EAAE,EACFC,eAAe,EACfC,aAAa,EACbC,gBAAgB,EAChBC,eAAe,QACV,eAAe;AACtB,SAASC,IAAI,QAAmB,SAAS;AACzC,SAASC,kBAAkB,QAA+B,gCAAgC;AAC1F,SAGEC,mBAAmB,EACnBC,kBAAkB,EAClBC,kBAAkB,EAClBC,0BAA0B,EAC1BC,qBAAqB,EACrBC,kBAAkB,QACb,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElB,MAAMC,KAAK,GAAG,QAAQ;AAEtB,MAAMC,qBAAqB,GAAGA,CAAA,KAAMZ,eAAe,CAACW,KAAK,CAAuB;;AAEhF;AACA;AACA;;AAIA;;AAGA,IAAIE,4BAA4B,GAAG,KAAK;AAkBxC,MAAMtB,UAAU,gBAAGN,UAAU,CAC3B,CACE;EACE6B,OAAO,EAAEC,WAAW,GAAG,OAAO;EAC9BC,KAAK,GAAG,QAAQ;EAChBC,IAAI,GAAG,SAAS;EAChBC,SAAS,GAAG,KAAK;EACjBC,SAAS;EACTC,QAAQ;EACRC,KAAK;EACL,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH;EACArC,SAAS,CAAC,MAAM;IACd,IACE,OAAOsC,OAAO,KAAK,WAAW,IAC9BA,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IACrCX,WAAW,KAAK,QAAQ,IACxB,CAACF,4BAA4B,EAC7B;MACAA,4BAA4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EACL5B,cAAc,CAAC;MAAEwC,IAAI,EAAE;IAAiB,CAAC,CAAC,EAC1ChC,kBAAkB,CAACsE,QAAQ,CAC7B;EAAC,CACF,CAAC;AAEN,CACF,CAAC;AAEDC,aAAa,CAACtC,WAAW,GAAG,gBAAgB;AAS5C,OAAO,MAAM0C,MAAM,GAAGC,MAAM,CAACC,MAAM,CAACxF,UAAU,EAAE;EAC9CyF,KAAK,EAAE5C,WAAW;EAClB6C,KAAK,EAAE1C,WAAW;EAClBtC,IAAI,EAAEqE,UAAU;EAChBY,OAAO,EAAET;AACX,CAAC,CAA4B","ignoreList":[]}
|
|
@@ -219,7 +219,13 @@ export const buttonTextVariants = cva(['font-medium', 'text-center'], {
|
|
|
219
219
|
size: 'default'
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
|
-
export const buttonSpinnerVariants = cva([],
|
|
222
|
+
export const buttonSpinnerVariants = cva(['data-[icon=inline-start]:me-1.5', 'data-[icon=inline-end]:ms-1.5']);
|
|
223
|
+
|
|
224
|
+
// Spinner color is set via Uniwind's `colorClassName` prop (maps to the native
|
|
225
|
+
// `color` prop on `ActivityIndicator`). `accent-*` utilities ONLY take effect
|
|
226
|
+
// when passed through `colorClassName` — putting them on `className` is a no-op
|
|
227
|
+
// because the underlying `color` prop is not part of the `style` object.
|
|
228
|
+
export const buttonSpinnerColorVariants = cva([], {
|
|
223
229
|
variants: {
|
|
224
230
|
variant: {
|
|
225
231
|
solid: [],
|
|
@@ -314,7 +320,7 @@ export const buttonGroupVariants = cva([], {
|
|
|
314
320
|
isAttached: false
|
|
315
321
|
}
|
|
316
322
|
});
|
|
317
|
-
export const buttonIconVariants = cva([], {
|
|
323
|
+
export const buttonIconVariants = cva(['data-[icon=inline-start]:me-1.5', 'data-[icon=inline-end]:ms-1.5'], {
|
|
318
324
|
variants: {
|
|
319
325
|
variant: {
|
|
320
326
|
solid: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","cva","DISABLED_CURSOR","TRANSITION_COLORS","buttonRootVariants","variants","variant","solid","outline","ghost","color","action","danger","warning","success","info","size","default","small","fullWidth","true","false","compoundVariants","className","select","web","defaultVariants","buttonTextVariants","buttonSpinnerVariants","buttonGroupVariants","flexDirection","row","column","isAttached","buttonIconVariants"],"sourceRoot":"../../../../src","sources":["components/Button/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAA2B,0BAA0B;AACjE,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,yBAAyB;;AAE5E;;AAEA,OAAO,MAAMC,kBAAkB,GAAGH,GAAG,CACnC,CACE,sCAAsC,EACtC,uCAAuC,EACvC,wEAAwE,EACxEE,iBAAiB,EACjB,wDAAwD,EACxDD,eAAe,EACf,kIAAkI,CACnI,EACD;EACEG,QAAQ,EAAE;IACRC,OAAO,EAAE;MACPC,KAAK,EAAE,CAAC,4BAA4B,CAAC;MAAE;MACvCC,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;MAC3DC,KAAK,EAAE,CAAC,gBAAgB;IAC1B,CAAC;IACDC,KAAK,EAAE;MACLC,MAAM,EAAE,EAAE;MACVC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE,EAAE;MACXC,OAAO,EAAE,EAAE;MACXC,IAAI,EAAE;IACR,CAAC;IACDC,IAAI,EAAE;MACJC,OAAO,EAAE,iBAAiB;MAC1BC,KAAK,EAAE;IACT,CAAC;IACDC,SAAS,EAAE;MACTC,IAAI,EAAE,QAAQ;MACdC,KAAK,EAAE;IACT;EACF,CAAC;EACDC,gBAAgB,EAAE;EAChB;EACA;IACEhB,OAAO,EAAE,OAAO;IAChBI,KAAK,EAAE,QAAQ;IACfa,SAAS,EAAE,CACT,0BAA0B,EAC1BvB,QAAQ,CAACwB,MAAM,CAAC;MACdP,OAAO,EAAE,oDAAoD;MAC7DQ,GAAG,EAAE;IACP,CAAC,CAAC;EAEN,CAAC,EACD;IACEnB,OAAO,EA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E,MAAM;IAAEa,SAAS,EAAE;EAA8B,CAAC;EAE7E;EACA;IAAEjB,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;IAAEI,KAAK,EAAE,QAAQ;IAAEa,SAAS,EAAE;EAAsB,CAAC,EACpF;IAAEjB,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;IAAEI,KAAK,EAAE,QAAQ;IAAEa,SAAS,EAAE;EAAsB,CAAC,EACpF;IAAEjB,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;IAAEI,KAAK,EAAE,SAAS;IAAEa,SAAS,EAAE;EAAuB,CAAC,EACtF;IAAEjB,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;IAAEI,KAAK,EAAE,SAAS;IAAEa,SAAS,EAAE;EAAuB,CAAC,EACtF;IAAEjB,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;IAAEI,KAAK,EAAE,MAAM;IAAEa,SAAS,EAAE;EAAoB,CAAC,CACjF;EACDG,eAAe,EAAE;IACfpB,OAAO,EAAE,OAAO;IAChBI,KAAK,EAAE,QAAQ;IACfM,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAEF,OAAO,MAAMY,qBAAqB,GAAG3B,GAAG,CAAC,EAAE,EAAE;
|
|
1
|
+
{"version":3,"names":["Platform","cva","DISABLED_CURSOR","TRANSITION_COLORS","buttonRootVariants","variants","variant","solid","outline","ghost","color","action","danger","warning","success","info","size","default","small","fullWidth","true","false","compoundVariants","className","select","web","defaultVariants","buttonTextVariants","buttonSpinnerVariants","buttonSpinnerColorVariants","buttonGroupVariants","flexDirection","row","column","isAttached","buttonIconVariants"],"sourceRoot":"../../../../src","sources":["components/Button/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAA2B,0BAA0B;AACjE,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,yBAAyB;;AAE5E;;AAEA,OAAO,MAAMC,kBAAkB,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,EAAE,QAAQ;IAAEa,SAAS,EAAE;EAAsB,CAAC,EACpF;IAAEjB,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;IAAEI,KAAK,EAAE,SAAS;IAAEa,SAAS,EAAE;EAAuB,CAAC,EACtF;IAAEjB,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;IAAEI,KAAK,EAAE,SAAS;IAAEa,SAAS,EAAE;EAAuB,CAAC,EACtF;IAAEjB,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;IAAEI,KAAK,EAAE,MAAM;IAAEa,SAAS,EAAE;EAAoB,CAAC,CACjF;EACDG,eAAe,EAAE;IACfpB,OAAO,EAAE,OAAO;IAChBI,KAAK,EAAE,QAAQ;IACfM,IAAI,EAAE;EACR;AACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -13,17 +13,117 @@ Styled components in `@cdx-ui/components` follow a consistent pattern. Read the
|
|
|
13
13
|
- `docs/internal/practices/types.md` — prop types, `I*Props` vs `*Props`, exporting
|
|
14
14
|
- `docs/internal/practices/styling.md` — `cn()`, CVA, token classes, `Platform.select()`
|
|
15
15
|
- `docs/internal/practices/state.md` — `useControllableState`, `composeEventHandlers`
|
|
16
|
-
- `docs/internal/practices/data-attributes.md` — `data-[state]` and `data-
|
|
16
|
+
- `docs/internal/practices/data-attributes.md` — `data-[state]`, `data-slot`, and `data-icon` conventions
|
|
17
|
+
- `docs/internal/practices/as-child.md` — styled-layer `asChild` via re-exported `Slot`
|
|
18
|
+
|
|
19
|
+
## Six standards (Standards 4–6 apply here)
|
|
20
|
+
|
|
21
|
+
Standards 1–3 govern primitive-layer authoring (see `packages/primitives/src/CLAUDE.md`).
|
|
22
|
+
Standards 4–6 govern the styled layer:
|
|
23
|
+
|
|
24
|
+
### Standard 4 — `data-slot` attributes
|
|
25
|
+
|
|
26
|
+
Every public styled slot emits a stable `data-slot="<component>-<part>"` attribute on its outermost rendered element. The convention is lowercase, kebab-case, `<component>` then `-<slot>` if not the root.
|
|
27
|
+
|
|
28
|
+
| Slot | Attribute |
|
|
29
|
+
| ------------------ | ---------------------------- |
|
|
30
|
+
| `<Button>` root | `data-slot="button"` |
|
|
31
|
+
| `<Button.Label>` | `data-slot="button-label"` |
|
|
32
|
+
| `<Button.Icon>` | `data-slot="button-icon"` |
|
|
33
|
+
| `<Button.Spinner>` | `data-slot="button-spinner"` |
|
|
34
|
+
| `<Button.Group>` | `data-slot="button-group"` |
|
|
35
|
+
| `<IconButton>` | `data-slot="icon-button"` |
|
|
36
|
+
| `<Dialog.Content>` | `data-slot="dialog-content"` |
|
|
37
|
+
|
|
38
|
+
Use `dataAttributes({ slot: '<component>-<part>' })` from `@cdx-ui/primitives` so the helper handles native (flat `data-*` keys) and web (RNW `dataSet`) correctly.
|
|
39
|
+
|
|
40
|
+
#### Combining multiple data-attribute sources — use `mergeDataAttributes`
|
|
41
|
+
|
|
42
|
+
When the same element receives `data-*` from more than one source (e.g. a slot identifier plus a position hint, or consumer-supplied data attrs flowing in through props), do **not** chain multiple `{...dataAttributes(...)}` spreads — on web each call returns `{ dataSet: {...} }` and a plain JSX spread replaces the `dataSet` key entirely, so the second source wipes out the first. Use `mergeDataAttributes(...)` from `@cdx-ui/primitives` to combine sources; later args win on key conflicts:
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { dataAttributes, mergeDataAttributes } from '@cdx-ui/primitives';
|
|
46
|
+
|
|
47
|
+
<Element
|
|
48
|
+
ref={ref}
|
|
49
|
+
className={...}
|
|
50
|
+
style={style}
|
|
51
|
+
{...props}
|
|
52
|
+
{...mergeDataAttributes(
|
|
53
|
+
props, // pulls in any consumer-supplied data attrs
|
|
54
|
+
dataAttributes({ slot: '<component>-<part>' }),
|
|
55
|
+
positionToDataIcon(position), // optional, may be undefined
|
|
56
|
+
)}
|
|
57
|
+
/>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Spread `{...props}` first, then the merge — so any keys that `mergeDataAttributes` produces overwrite their counterparts in props with the merged values.
|
|
61
|
+
|
|
62
|
+
When the styled component renders a primitive Root, the primitive Root applies the same pattern internally — incoming data attrs (slot from the styled layer) are merged with the primitive's own interaction-state data attrs and emitted once. The styled layer doesn't need to do anything special; just pass `data-slot` through and the primitive's merge does the rest.
|
|
63
|
+
|
|
64
|
+
### Standard 5 — Static design variants vs. interaction state
|
|
65
|
+
|
|
66
|
+
Variant functions take only static design inputs (`variant`/`color`/`size`/`fullWidth`/etc.). Interaction states (`hover`/`focus`/`active`/`disabled`/`focus-visible`) are expressed as `data-[...]:` selectors **inside** CVA variant strings, never as variant inputs.
|
|
67
|
+
|
|
68
|
+
- CSS-layer state changes are free of React work: when the primitive flips `data-hover=true`, the CSS engine (web) and Uniwind's native style layer reconcile styles without re-rendering React, re-running CVA, or invoking `cn()`/`tailwind-merge`.
|
|
69
|
+
- Variant-input state changes cascade React work: CVA re-runs, `cn()` re-merges, and className-prop reconciliation cascades through the tree.
|
|
70
|
+
- Sub-slots can react to root state via parent selectors (`data-[hover=true]:`) without each slot subscribing to context (per Standard 1).
|
|
71
|
+
|
|
72
|
+
### Standard 6 — Position hints (`data-icon="inline-start|inline-end"`)
|
|
73
|
+
|
|
74
|
+
Icon-/spinner-bearing styled slots accept an optional `position?: 'leading' | 'trailing'` prop that emits `data-icon="inline-start|inline-end"`. Spacing rules in CVA target the `data-icon` attribute via logical-property utilities (`me-*`/`ms-*`) so RTL is handled for free.
|
|
75
|
+
|
|
76
|
+
Mapping (via the shared `positionToDataIcon` helper at `packages/components/src/utils/positionToDataIcon.ts`):
|
|
77
|
+
|
|
78
|
+
- `position="leading"` → `data-icon="inline-start"`
|
|
79
|
+
- `position="trailing"` → `data-icon="inline-end"`
|
|
80
|
+
- `position` omitted → no `data-icon` attribute, baseline spacing applies
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { positionToDataIcon, type IconSlotPosition } from '../../utils/positionToDataIcon';
|
|
84
|
+
|
|
85
|
+
interface ButtonIconProps {
|
|
86
|
+
position?: IconSlotPosition;
|
|
87
|
+
// ...
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
<Icon {...positionToDataIcon(position)} {...props} />;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
<Button>
|
|
95
|
+
<Button.Icon as={CheckIcon} position="leading" />
|
|
96
|
+
<Button.Label>Confirm</Button.Label>
|
|
97
|
+
</Button>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
CVA expresses padding via logical-property selectors:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
cva(['data-[icon=inline-start]:me-1.5 data-[icon=inline-end]:ms-1.5'], { ... });
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Where: **styled layer.** Pure styling hint with no behavior or a11y semantics — fails Standard 3, so no primitive involvement.
|
|
107
|
+
|
|
108
|
+
## Canonical reference
|
|
109
|
+
|
|
110
|
+
`packages/components/src/components/Button/index.tsx` + `Button/styles.ts` is the canonical example for Standards 4–6:
|
|
111
|
+
|
|
112
|
+
- `data-slot` on `Button`, `Button.Label`, `Button.Icon`, `Button.Spinner`, `Button.Group`
|
|
113
|
+
- `asChild` re-uses `Slot` from `@cdx-ui/primitives` — no new primitive needed for sub-slots
|
|
114
|
+
- `buttonIconVariants` / `buttonSpinnerVariants` carry `data-[icon=inline-start]:me-1.5 data-[icon=inline-end]:ms-1.5` so leading/trailing padding works without per-call overrides
|
|
115
|
+
|
|
116
|
+
`packages/components/src/components/IconButton/index.tsx` shows the second axis of Standard 1: a styled-layer slot (the glyph) is the place that opts into `useButtonContext()` when its styling reacts to interaction state. The pattern is the same as the primitive Root — call `useButtonContext()`, spread `dataAttributes({ ... })` — only it lives in the styled layer.
|
|
17
117
|
|
|
18
118
|
### Pattern summary
|
|
19
119
|
|
|
20
|
-
Each component follows this structure (see `Button/index.tsx`
|
|
120
|
+
Each component follows this structure (see `Button/index.tsx`):
|
|
21
121
|
|
|
22
|
-
1. **Imports** — RN base components, primitive from `@cdx-ui/primitives`, `cn` + style context from `@cdx-ui/utils`, variant functions from `./styles`
|
|
23
|
-
2. **Scope constant** — `const SCOPE = 'COMPONENT_NAME'` for `withStyleContext` / `useStyleContext`
|
|
24
|
-
3. **Root
|
|
25
|
-
4. **
|
|
26
|
-
5. **
|
|
122
|
+
1. **Imports** — RN base components, primitive `Root` and `Slot` from `@cdx-ui/primitives`, `cn` + style context from `@cdx-ui/utils`, variant functions from `./styles`
|
|
123
|
+
2. **Scope constant** — `const SCOPE = 'COMPONENT_NAME'` for `withStyleContext` / `useStyleContext` (or a `ParentContext.Provider` wrapper for static variant context)
|
|
124
|
+
3. **Root component** — renders the primitive Root (or a host element directly when no primitive exists), spreads `dataAttributes({ slot: '<component>' })`
|
|
125
|
+
4. **Sub-slots** — each accepts `asChild`, renders a host element via `const Comp = asChild ? Slot : DefaultElement`, spreads `dataAttributes({ slot: '<component>-<slot>' })`. Sub-slots **do not** call `useButtonContext()` (or its equivalent) unless their own styling reacts to interaction state.
|
|
126
|
+
5. **Position-aware sub-slots** — icon/spinner-style slots accept `position?: 'leading' | 'trailing'` and emit `data-icon` via `dataAttributes({ icon: '...' })`.
|
|
27
127
|
6. **Compound export** — `Object.assign(RootComponent, { Sub1, Sub2 }) as CompoundType`
|
|
28
128
|
|
|
29
129
|
### Key rules
|
|
@@ -36,6 +136,9 @@ Each component follows this structure (see `Button/index.tsx` as the canonical e
|
|
|
36
136
|
- Never hardcode colors — use semantic token classes (`bg-surface-*`, `text-content-*`, `border-stroke-*`)
|
|
37
137
|
- Event handlers composed via `composeEventHandlers` from `@cdx-ui/utils`
|
|
38
138
|
- Third-party libraries fully abstracted — no adopted library types leak to consumers
|
|
139
|
+
- **`data-slot`** emitted on every styled slot via `dataAttributes({ slot: '<component>-<part>' })`
|
|
140
|
+
- **`asChild`** supported on every styled slot — `const Comp = asChild ? Slot : DefaultElement`
|
|
141
|
+
- **`position`** prop on icon/spinner-style slots maps to `data-icon="inline-start|inline-end"`
|
|
39
142
|
|
|
40
143
|
---
|
|
41
144
|
|
|
@@ -44,7 +147,7 @@ Each component follows this structure (see `Button/index.tsx` as the canonical e
|
|
|
44
147
|
Variant definitions live in co-located `styles.ts` files using CVA. Read the full guides before making changes:
|
|
45
148
|
|
|
46
149
|
- `docs/internal/practices/styling.md` — `cn()`, CVA, token architecture, dark mode, `Platform.select()`
|
|
47
|
-
- `docs/internal/practices/data-attributes.md` — `data-[state]`
|
|
150
|
+
- `docs/internal/practices/data-attributes.md` — `data-[state]` and `data-icon` selectors
|
|
48
151
|
|
|
49
152
|
### Pattern summary
|
|
50
153
|
|
|
@@ -57,11 +160,11 @@ import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/primitives';
|
|
|
57
160
|
|
|
58
161
|
export const componentRootVariants = cva(
|
|
59
162
|
[
|
|
60
|
-
/* base classes */
|
|
163
|
+
/* base classes + interaction state selectors (data-[hover=true]:..., data-[active=true]:...) */
|
|
61
164
|
],
|
|
62
165
|
{
|
|
63
166
|
variants: {
|
|
64
|
-
/*
|
|
167
|
+
/* static design axes only — variant, color, size, fullWidth, etc. */
|
|
65
168
|
},
|
|
66
169
|
compoundVariants: [
|
|
67
170
|
/* variant × variant combinations */
|
|
@@ -78,7 +181,8 @@ export type ComponentVariantProps = VariantProps<typeof componentRootVariants>;
|
|
|
78
181
|
### Key rules
|
|
79
182
|
|
|
80
183
|
- **Semantic token classes only** — use `bg-surface-action-strong`, `text-content-primary`, `border-stroke-primary`, etc. Never hardcode hex colors, `bg-white`, `text-black`, or raw Tailwind color scales for themed values.
|
|
81
|
-
- **`data-[state]` selectors** — use `data-[disabled=true]:`, `data-[hover=true]:`, `data-[active=true]:`, `data-[focus-visible=true]:` for interaction states. Primitives emit these data attributes.
|
|
184
|
+
- **`data-[state]` selectors** — use `data-[disabled=true]:`, `data-[hover=true]:`, `data-[active=true]:`, `data-[focus-visible=true]:` for interaction states. Primitives emit these data attributes (Standard 1). **Interaction state is never a CVA variant input** (Standard 5).
|
|
185
|
+
- **`data-[icon=inline-start|inline-end]` selectors** for icon/spinner position spacing (Standard 6) — pair with logical-property utilities (`me-*`/`ms-*`) so RTL flips automatically.
|
|
82
186
|
- **`Platform.select()`** for platform-specific classes — web gets `data-[hover=true]` styles (hover exists on web); native responds only to `data-[active=true]` (press). Always set `default` (native) and `web` keys.
|
|
83
187
|
- **Shared style primitives** — import `DISABLED_CURSOR`, `TRANSITION_COLORS`, etc. from `../../styles/primitives` for cross-component consistency.
|
|
84
188
|
- **`web:` prefix** for web-only utilities — e.g., `web:outline-none`, `web:focus-visible:ring-2`.
|