@cdx-ui/components 0.0.1-beta.65 → 0.0.1-beta.67
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/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/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/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/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/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/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/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/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,20 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { forwardRef, useMemo } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { cn, ParentContext, useParentContext, useStyleContext
|
|
4
|
+
import { Text } from 'react-native';
|
|
5
|
+
import { ChipRoot as ChipRootPrimitive, Slot, dataAttributes, mergeDataAttributes } from '@cdx-ui/primitives';
|
|
6
|
+
import { cn, ParentContext, useParentContext, useStyleContext } from '@cdx-ui/utils';
|
|
7
7
|
import { Avatar } from '../Avatar';
|
|
8
8
|
import { Icon } from '../Icon';
|
|
9
|
+
import { positionToDataIcon } from '../../utils/positionToDataIcon';
|
|
9
10
|
import { chipAvatarVariants, chipIconVariants, chipLabelVariants, chipRootVariants } from './styles';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
const SCOPE = 'CHIP';
|
|
12
|
-
const RootView = withStyleContext(View, SCOPE);
|
|
13
|
-
const RootPressable = withStyleContext(Pressable, SCOPE);
|
|
14
|
-
const ChipPrimitive = createChip({
|
|
15
|
-
View: RootView,
|
|
16
|
-
Pressable: RootPressable
|
|
17
|
-
});
|
|
18
13
|
const useChipStyleContext = () => useStyleContext(SCOPE);
|
|
19
14
|
|
|
20
15
|
// =============================================================================
|
|
@@ -28,43 +23,35 @@ const ChipRoot = /*#__PURE__*/forwardRef(({
|
|
|
28
23
|
color = 'default',
|
|
29
24
|
className,
|
|
30
25
|
style,
|
|
31
|
-
asChild,
|
|
32
26
|
...props
|
|
33
27
|
}, ref) => {
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
...
|
|
28
|
+
const parent = useParentContext();
|
|
29
|
+
const ctx = useMemo(() => ({
|
|
30
|
+
...parent,
|
|
37
31
|
[SCOPE]: {
|
|
38
32
|
variant,
|
|
39
33
|
size,
|
|
40
34
|
color
|
|
41
35
|
}
|
|
42
|
-
}), [
|
|
36
|
+
}), [parent, variant, size, color]);
|
|
43
37
|
const computedClassName = cn(chipRootVariants({
|
|
44
38
|
variant,
|
|
45
39
|
size,
|
|
46
40
|
color
|
|
47
41
|
}), className);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
return /*#__PURE__*/_jsx(ParentContext.Provider, {
|
|
43
|
+
value: ctx,
|
|
44
|
+
children: /*#__PURE__*/_jsx(ChipRootPrimitive, {
|
|
45
|
+
ref: ref,
|
|
46
|
+
className: computedClassName,
|
|
47
|
+
style: style,
|
|
48
|
+
...props,
|
|
49
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
50
|
+
slot: 'chip'
|
|
51
|
+
})),
|
|
52
|
+
children: children
|
|
53
|
+
})
|
|
60
54
|
});
|
|
61
|
-
if (asChild) {
|
|
62
|
-
return /*#__PURE__*/_jsx(ParentContext.Provider, {
|
|
63
|
-
value: styleContextValues,
|
|
64
|
-
children: root
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
return root;
|
|
68
55
|
});
|
|
69
56
|
ChipRoot.displayName = 'Chip';
|
|
70
57
|
|
|
@@ -73,6 +60,7 @@ ChipRoot.displayName = 'Chip';
|
|
|
73
60
|
// =============================================================================
|
|
74
61
|
|
|
75
62
|
const ChipLabel = /*#__PURE__*/forwardRef(({
|
|
63
|
+
asChild,
|
|
76
64
|
className,
|
|
77
65
|
children,
|
|
78
66
|
style,
|
|
@@ -88,11 +76,15 @@ const ChipLabel = /*#__PURE__*/forwardRef(({
|
|
|
88
76
|
variant,
|
|
89
77
|
color
|
|
90
78
|
}), className);
|
|
91
|
-
|
|
79
|
+
const Comp = asChild ? Slot : Text;
|
|
80
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
92
81
|
ref: ref,
|
|
93
82
|
className: computedClassName,
|
|
94
83
|
style: style,
|
|
95
84
|
...props,
|
|
85
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
86
|
+
slot: 'chip-label'
|
|
87
|
+
})),
|
|
96
88
|
children: children
|
|
97
89
|
});
|
|
98
90
|
});
|
|
@@ -103,10 +95,11 @@ ChipLabel.displayName = 'Chip.Label';
|
|
|
103
95
|
// =============================================================================
|
|
104
96
|
|
|
105
97
|
const ChipIcon = ({
|
|
98
|
+
asChild,
|
|
106
99
|
className,
|
|
107
100
|
style,
|
|
108
101
|
as,
|
|
109
|
-
|
|
102
|
+
position,
|
|
110
103
|
...props
|
|
111
104
|
}) => {
|
|
112
105
|
const {
|
|
@@ -115,14 +108,29 @@ const ChipIcon = ({
|
|
|
115
108
|
} = useChipStyleContext();
|
|
116
109
|
const computedClassName = cn(chipIconVariants({
|
|
117
110
|
size,
|
|
118
|
-
color
|
|
119
|
-
slot
|
|
111
|
+
color
|
|
120
112
|
}), className);
|
|
113
|
+
if (asChild) {
|
|
114
|
+
return /*#__PURE__*/_jsx(Slot, {
|
|
115
|
+
className: computedClassName,
|
|
116
|
+
style: style,
|
|
117
|
+
...props,
|
|
118
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
119
|
+
slot: 'chip-icon'
|
|
120
|
+
}), positionToDataIcon(position))
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (!as) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
121
126
|
return /*#__PURE__*/_jsx(Icon, {
|
|
122
127
|
as: as,
|
|
123
128
|
className: computedClassName,
|
|
124
129
|
style: style,
|
|
125
|
-
...props
|
|
130
|
+
...props,
|
|
131
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
132
|
+
slot: 'chip-icon'
|
|
133
|
+
}), positionToDataIcon(position))
|
|
126
134
|
});
|
|
127
135
|
};
|
|
128
136
|
ChipIcon.displayName = 'Chip.Icon';
|
|
@@ -140,7 +148,7 @@ const ChipAvatar = ({
|
|
|
140
148
|
const {
|
|
141
149
|
size
|
|
142
150
|
} = useChipStyleContext();
|
|
143
|
-
// chipAvatarVariants sets w/h and the leading
|
|
151
|
+
// chipAvatarVariants sets w/h and the leading-edge negative margin.
|
|
144
152
|
// Avatar renders with size="sm" (its smallest named size) but chipAvatarVariants
|
|
145
153
|
// overrides the w/h via tailwind-merge so the chip size wins.
|
|
146
154
|
const computedClassName = cn(chipAvatarVariants({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useMemo","
|
|
1
|
+
{"version":3,"names":["forwardRef","useMemo","Text","ChipRoot","ChipRootPrimitive","Slot","dataAttributes","mergeDataAttributes","cn","ParentContext","useParentContext","useStyleContext","Avatar","Icon","positionToDataIcon","chipAvatarVariants","chipIconVariants","chipLabelVariants","chipRootVariants","jsx","_jsx","SCOPE","useChipStyleContext","children","variant","size","color","className","style","props","ref","parent","ctx","computedClassName","Provider","value","slot","displayName","ChipLabel","asChild","Comp","ChipIcon","as","position","ChipAvatar","Chip","Object","assign","Label"],"sourceRoot":"../../../../src","sources":["components/Chip/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,OAAO,QAAwB,OAAO;AAC3D,SAASC,IAAI,QAA8B,cAAc;AACzD,SACEC,QAAQ,IAAIC,iBAAiB,EAC7BC,IAAI,EACJC,cAAc,EACdC,mBAAmB,QAEd,oBAAoB;AAC3B,SAASC,EAAE,EAAEC,aAAa,EAAEC,gBAAgB,EAAEC,eAAe,QAAQ,eAAe;AACpF,SAASC,MAAM,QAA0B,WAAW;AACpD,SAASC,IAAI,QAAwB,SAAS;AAC9C,SAASC,kBAAkB,QAA+B,gCAAgC;AAC1F,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,QAEX,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElB,MAAMC,KAAK,GAAG,MAAM;AAEpB,MAAMC,mBAAmB,GAAGA,CAAA,KAAMX,eAAe,CAACU,KAAK,CAAqB;;AAE5E;AACA;AACA;;AAOA,MAAMlB,QAAQ,gBAAGH,UAAU,CACzB,CACE;EAAEuB,QAAQ;EAAEC,OAAO,GAAG,MAAM;EAAEC,IAAI,GAAG,SAAS;EAAEC,KAAK,GAAG,SAAS;EAAEC,SAAS;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAC/FC,GAAG,KACA;EACH,MAAMC,MAAM,GAAGrB,gBAAgB,CAAC,CAAC;EACjC,MAAMsB,GAAG,GAAG/B,OAAO,CACjB,OAAO;IAAE,GAAG8B,MAAM;IAAE,CAACV,KAAK,GAAG;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WAAW;;AAElC;AACA;AACA;;AAIA,MAAMO,UAAU,GAAGA,CAAC;EAAEjB,SAAS;EAAEC,KAAK;EAAEL,QAAQ;EAAE,GAAGM;AAAuB,CAAC,KAAK;EAChF,MAAM;IAAEJ;EAAK,CAAC,GAAGH,mBAAmB,CAAC,CAAC;EACtC;EACA;EACA;EACA,MAAMW,iBAAiB,GAAGzB,EAAE,CAACO,kBAAkB,CAAC;IAAEU;EAAK,CAAC,CAAC,EAAEE,SAAS,CAAC;EAErE,oBACEP,IAAA,CAACR,MAAM;IAACa,IAAI,EAAC,IAAI;IAACE,SAAS,EAAEM,iBAAkB;IAACL,KAAK,EAAEA,KAAM;IAAA,GAAKC,KAAK;IAAAN,QAAA,EACpEA;EAAQ,CACH,CAAC;AAEb,CAAC;AAEDqB,UAAU,CAACP,WAAW,GAAG,aAAa;;AAEtC;AACA;AACA;;AAQA,OAAO,MAAMQ,IAAI,GAAGC,MAAM,CAACC,MAAM,CAAC5C,QAAQ,EAAE;EAC1C6C,KAAK,EAAEV,SAAS;EAChBzB,IAAI,EAAE4B,QAAQ;EACd7B,MAAM,EAAEgC;AACV,CAAC,CAA0B","ignoreList":[]}
|
|
@@ -172,9 +172,9 @@ export const chipLabelVariants = cva(['font-medium'], {
|
|
|
172
172
|
export const chipIconVariants = cva(['shrink-0'], {
|
|
173
173
|
variants: {
|
|
174
174
|
size: {
|
|
175
|
-
default: 'size-5',
|
|
176
|
-
small: 'size-4',
|
|
177
|
-
xsmall: 'size-2.5'
|
|
175
|
+
default: 'size-5 data-[icon=inline-start]:-ms-1.5 data-[icon=inline-end]:-me-1.5',
|
|
176
|
+
small: 'size-4 data-[icon=inline-start]:-ms-0.5 data-[icon=inline-end]:-me-0.5',
|
|
177
|
+
xsmall: 'size-2.5 data-[icon=inline-start]:-ms-px data-[icon=inline-end]:-me-px'
|
|
178
178
|
},
|
|
179
179
|
color: {
|
|
180
180
|
default: 'text-content-primary',
|
|
@@ -183,37 +183,8 @@ export const chipIconVariants = cva(['shrink-0'], {
|
|
|
183
183
|
warning: 'text-content-warning',
|
|
184
184
|
success: 'text-content-success',
|
|
185
185
|
info: 'text-content-info'
|
|
186
|
-
},
|
|
187
|
-
slot: {
|
|
188
|
-
leading: '',
|
|
189
|
-
trailing: ''
|
|
190
186
|
}
|
|
191
187
|
},
|
|
192
|
-
compoundVariants: [{
|
|
193
|
-
slot: 'leading',
|
|
194
|
-
size: 'default',
|
|
195
|
-
className: '-ml-1.5'
|
|
196
|
-
}, {
|
|
197
|
-
slot: 'leading',
|
|
198
|
-
size: 'small',
|
|
199
|
-
className: '-ml-0.5'
|
|
200
|
-
}, {
|
|
201
|
-
slot: 'leading',
|
|
202
|
-
size: 'xsmall',
|
|
203
|
-
className: '-ml-px'
|
|
204
|
-
}, {
|
|
205
|
-
slot: 'trailing',
|
|
206
|
-
size: 'default',
|
|
207
|
-
className: '-mr-1.5'
|
|
208
|
-
}, {
|
|
209
|
-
slot: 'trailing',
|
|
210
|
-
size: 'small',
|
|
211
|
-
className: '-mr-0.5'
|
|
212
|
-
}, {
|
|
213
|
-
slot: 'trailing',
|
|
214
|
-
size: 'xsmall',
|
|
215
|
-
className: '-mr-px'
|
|
216
|
-
}],
|
|
217
188
|
defaultVariants: {
|
|
218
189
|
size: 'default',
|
|
219
190
|
color: 'default'
|
|
@@ -222,9 +193,9 @@ export const chipIconVariants = cva(['shrink-0'], {
|
|
|
222
193
|
export const chipAvatarVariants = cva(['shrink-0 rounded-full overflow-hidden'], {
|
|
223
194
|
variants: {
|
|
224
195
|
size: {
|
|
225
|
-
default: 'size-5 -
|
|
226
|
-
small: 'size-4 -
|
|
227
|
-
xsmall: 'size-2.5 -
|
|
196
|
+
default: 'size-5 -ms-1.5',
|
|
197
|
+
small: 'size-4 -ms-0.5',
|
|
198
|
+
xsmall: 'size-2.5 -ms-px'
|
|
228
199
|
}
|
|
229
200
|
},
|
|
230
201
|
defaultVariants: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","cva","DISABLED_CURSOR","TRANSITION_COLORS","chipInteractiveRoot","select","web","join","default","chipRootVariants","variants","variant","tint","outline","color","action","danger","warning","success","info","size","small","xsmall","compoundVariants","className","defaultVariants","chipLabelVariants","chipIconVariants","
|
|
1
|
+
{"version":3,"names":["Platform","cva","DISABLED_CURSOR","TRANSITION_COLORS","chipInteractiveRoot","select","web","join","default","chipRootVariants","variants","variant","tint","outline","color","action","danger","warning","success","info","size","small","xsmall","compoundVariants","className","defaultVariants","chipLabelVariants","chipIconVariants","chipAvatarVariants"],"sourceRoot":"../../../../src","sources":["components/Chip/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAA2B,0BAA0B;AACjE,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,yBAAyB;AAE5E,MAAMC,mBAAmB,GAAG,CAC1BD,iBAAiB,EACjB,wDAAwD,EACxDD,eAAe,EACfF,QAAQ,CAACK,MAAM,CAAC;EACdC,GAAG,EAAE,CACH,cAAc,EACd,kIAAkI,CACnI,CAACC,IAAI,CAAC,GAAG,CAAC;EACXC,OAAO,EAAE;AACX,CAAC,CAAC,CACH;AAED,OAAO,MAAMC,gBAAgB,GAAGR,GAAG,CACjC,CAAC,iEAAiE,EAAE,GAAGG,mBAAmB,CAAC,EAC3F;EACEM,QAAQ,EAAE;IACRC,OAAO,EAAE;MACPC,IAAI,EAAE,EAAE;MACRC,OAAO,EAAE,CAAC,gBAAgB,EAAE,QAAQ;IACtC,CAAC;IACDC,KAAK,EAAE;MACLN,OAAO,EAAE,EAAE;MACXO,MAAM,EAAE,EAAE;MACVC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE,EAAE;MACXC,OAAO,EAAE,EAAE;MACXC,IAAI,EAAE;IACR,CAAC;IACDC,IAAI,EAAE;MACJZ,OAAO,EAAE,6CAA6C;MACtDa,KAAK,EAAE,6CAA6C;MACpDC,MAAM,EAAE;IACV;EACF,CAAC;EACDC,gBAAgB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K,EAAE;MACLN,OAAO,EAAE,sBAAsB;MAC/BO,MAAM,EAAE,qBAAqB;MAC7BC,MAAM,EAAE,qBAAqB;MAC7BC,OAAO,EAAE,sBAAsB;MAC/BC,OAAO,EAAE,sBAAsB;MAC/BC,IAAI,EAAE;IACR;EACF,CAAC;EACDM,eAAe,EAAE;IACfL,IAAI,EAAE,SAAS;IACfN,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAEF,OAAO,MAAMc,kBAAkB,GAAG3B,GAAG,CAAC,CAAC,uCAAuC,CAAC,EAAE;EAC/ES,QAAQ,EAAE;IACRU,IAAI,EAAE;MACJZ,OAAO,EAAE,gBAAgB;MACzBa,KAAK,EAAE,gBAAgB;MACvBC,MAAM,EAAE;IACV;EACF,CAAC;EACDG,eAAe,EAAE;IACfL,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
import {
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
|
+
import { Text, View } from 'react-native';
|
|
5
5
|
import { CheckCircle, Close as CloseIcon, EmergencyHome, Warning } from '@cdx-ui/icons';
|
|
6
|
-
import {
|
|
7
|
-
import { cn,
|
|
6
|
+
import { DialogClose as DialogClosePrimitive, DialogPopup as DialogPopupPrimitive, DialogRoot as DialogRootPrimitive, DialogTrigger as DialogTriggerPrimitive, Slot, dataAttributes, mergeDataAttributes, useDialog } from '@cdx-ui/primitives';
|
|
7
|
+
import { cn, ParentContext, useParentContext, useStyleContext } from '@cdx-ui/utils';
|
|
8
8
|
import { Icon } from '../Icon';
|
|
9
9
|
import { dialogCloseIconVariants, dialogCloseVariants, dialogContentVariants, dialogDescriptionVariants, dialogFooterVariants, dialogHeaderVariants, dialogOverlayVariants, dialogPopupVariants, dialogTextVariants, dialogTitleIconVariants, dialogTitleVariants } from './styles';
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -15,40 +15,8 @@ export { useDialog } from '@cdx-ui/primitives';
|
|
|
15
15
|
// =============================================================================
|
|
16
16
|
|
|
17
17
|
const SCOPE = 'DIALOG';
|
|
18
|
-
const Root = withStyleContext(View, SCOPE);
|
|
19
18
|
const useDialogStyleContext = () => useStyleContext(SCOPE);
|
|
20
19
|
|
|
21
|
-
// =============================================================================
|
|
22
|
-
// STYLED OVERLAY (internal — not consumer-facing)
|
|
23
|
-
// =============================================================================
|
|
24
|
-
|
|
25
|
-
const StyledOverlay = /*#__PURE__*/forwardRef(({
|
|
26
|
-
className,
|
|
27
|
-
...props
|
|
28
|
-
}, ref) => /*#__PURE__*/_jsx(Pressable, {
|
|
29
|
-
ref: ref,
|
|
30
|
-
className: cn(dialogOverlayVariants(), className),
|
|
31
|
-
...props
|
|
32
|
-
}));
|
|
33
|
-
StyledOverlay.displayName = 'Dialog.Overlay';
|
|
34
|
-
|
|
35
|
-
// =============================================================================
|
|
36
|
-
// CREATE DIALOG PRIMITIVE
|
|
37
|
-
// =============================================================================
|
|
38
|
-
|
|
39
|
-
const DialogPrimitive = createDialog({
|
|
40
|
-
Root,
|
|
41
|
-
Trigger: Pressable,
|
|
42
|
-
Overlay: StyledOverlay,
|
|
43
|
-
Popup: View,
|
|
44
|
-
Header: View,
|
|
45
|
-
Title: Text,
|
|
46
|
-
Description: Text,
|
|
47
|
-
Content: View,
|
|
48
|
-
Footer: View,
|
|
49
|
-
Close: Pressable
|
|
50
|
-
});
|
|
51
|
-
|
|
52
20
|
// =============================================================================
|
|
53
21
|
// STYLED ROOT
|
|
54
22
|
// =============================================================================
|
|
@@ -60,17 +28,29 @@ const DialogRoot = /*#__PURE__*/forwardRef(({
|
|
|
60
28
|
children,
|
|
61
29
|
style,
|
|
62
30
|
...props
|
|
63
|
-
}, ref) =>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
31
|
+
}, ref) => {
|
|
32
|
+
const parent = useParentContext();
|
|
33
|
+
const ctx = useMemo(() => ({
|
|
34
|
+
...parent,
|
|
35
|
+
[SCOPE]: {
|
|
36
|
+
size,
|
|
37
|
+
fullBleed
|
|
38
|
+
}
|
|
39
|
+
}), [parent, size, fullBleed]);
|
|
40
|
+
return /*#__PURE__*/_jsx(ParentContext.Provider, {
|
|
41
|
+
value: ctx,
|
|
42
|
+
children: /*#__PURE__*/_jsx(DialogRootPrimitive, {
|
|
43
|
+
ref: ref,
|
|
44
|
+
className: className,
|
|
45
|
+
style: style,
|
|
46
|
+
...props,
|
|
47
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
48
|
+
slot: 'dialog'
|
|
49
|
+
})),
|
|
50
|
+
children: children
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
});
|
|
74
54
|
DialogRoot.displayName = 'Dialog';
|
|
75
55
|
|
|
76
56
|
// =============================================================================
|
|
@@ -82,17 +62,20 @@ const DialogTrigger = /*#__PURE__*/forwardRef(({
|
|
|
82
62
|
children,
|
|
83
63
|
style,
|
|
84
64
|
...props
|
|
85
|
-
}, ref) => /*#__PURE__*/_jsx(
|
|
65
|
+
}, ref) => /*#__PURE__*/_jsx(DialogTriggerPrimitive, {
|
|
86
66
|
ref: ref,
|
|
87
67
|
className: className,
|
|
88
68
|
style: style,
|
|
89
69
|
...props,
|
|
70
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
71
|
+
slot: 'dialog-trigger'
|
|
72
|
+
})),
|
|
90
73
|
children: children
|
|
91
74
|
}));
|
|
92
75
|
DialogTrigger.displayName = 'Dialog.Trigger';
|
|
93
76
|
|
|
94
77
|
// =============================================================================
|
|
95
|
-
// STYLED POPUP
|
|
78
|
+
// STYLED POPUP
|
|
96
79
|
// =============================================================================
|
|
97
80
|
|
|
98
81
|
const DialogPopup = /*#__PURE__*/forwardRef(({
|
|
@@ -109,39 +92,49 @@ const DialogPopup = /*#__PURE__*/forwardRef(({
|
|
|
109
92
|
const computedClassName = cn(dialogPopupVariants({
|
|
110
93
|
size
|
|
111
94
|
}), className);
|
|
112
|
-
|
|
95
|
+
const overlayClassName = cn(dialogOverlayVariants());
|
|
96
|
+
return /*#__PURE__*/_jsx(DialogPopupPrimitive, {
|
|
113
97
|
ref: ref,
|
|
114
98
|
className: computedClassName,
|
|
115
99
|
style: style,
|
|
100
|
+
overlayClassName: overlayClassName,
|
|
116
101
|
...props,
|
|
102
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
103
|
+
slot: 'dialog-popup'
|
|
104
|
+
})),
|
|
117
105
|
children: children
|
|
118
106
|
});
|
|
119
107
|
});
|
|
120
108
|
DialogPopup.displayName = 'Dialog.Popup';
|
|
121
109
|
|
|
122
110
|
// =============================================================================
|
|
123
|
-
// STYLED HEADER
|
|
111
|
+
// STYLED HEADER (styled-only sub-slot)
|
|
124
112
|
// =============================================================================
|
|
125
113
|
|
|
126
114
|
const DialogHeader = /*#__PURE__*/forwardRef(({
|
|
115
|
+
asChild,
|
|
127
116
|
className,
|
|
128
117
|
children,
|
|
129
118
|
style,
|
|
130
119
|
...props
|
|
131
120
|
}, ref) => {
|
|
132
121
|
const computedClassName = cn(dialogHeaderVariants(), className);
|
|
133
|
-
|
|
122
|
+
const Comp = asChild ? Slot : View;
|
|
123
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
134
124
|
ref: ref,
|
|
135
125
|
className: computedClassName,
|
|
136
126
|
style: style,
|
|
137
127
|
...props,
|
|
128
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
129
|
+
slot: 'dialog-header'
|
|
130
|
+
})),
|
|
138
131
|
children: children
|
|
139
132
|
});
|
|
140
133
|
});
|
|
141
134
|
DialogHeader.displayName = 'Dialog.Header';
|
|
142
135
|
|
|
143
136
|
// =============================================================================
|
|
144
|
-
// STYLED TITLE
|
|
137
|
+
// STYLED TITLE (styled-only sub-slot with appearance variants)
|
|
145
138
|
// =============================================================================
|
|
146
139
|
|
|
147
140
|
const APPEARANCE_ICON_MAP = {
|
|
@@ -150,6 +143,7 @@ const APPEARANCE_ICON_MAP = {
|
|
|
150
143
|
success: CheckCircle
|
|
151
144
|
};
|
|
152
145
|
const DialogTitle = /*#__PURE__*/forwardRef(({
|
|
146
|
+
asChild,
|
|
153
147
|
appearance = 'default',
|
|
154
148
|
className,
|
|
155
149
|
children,
|
|
@@ -160,6 +154,17 @@ const DialogTitle = /*#__PURE__*/forwardRef(({
|
|
|
160
154
|
appearance
|
|
161
155
|
}), className);
|
|
162
156
|
const IconComponent = appearance && appearance in APPEARANCE_ICON_MAP ? APPEARANCE_ICON_MAP[appearance] : null;
|
|
157
|
+
const Comp = asChild ? Slot : Text;
|
|
158
|
+
const titleElement = /*#__PURE__*/_jsx(Comp, {
|
|
159
|
+
ref: ref,
|
|
160
|
+
className: computedClassName,
|
|
161
|
+
style: style,
|
|
162
|
+
...props,
|
|
163
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
164
|
+
slot: 'dialog-title'
|
|
165
|
+
})),
|
|
166
|
+
children: children
|
|
167
|
+
});
|
|
163
168
|
if (IconComponent) {
|
|
164
169
|
return /*#__PURE__*/_jsxs(View, {
|
|
165
170
|
className: "flex-row items-center gap-1",
|
|
@@ -168,51 +173,49 @@ const DialogTitle = /*#__PURE__*/forwardRef(({
|
|
|
168
173
|
className: dialogTitleIconVariants({
|
|
169
174
|
appearance
|
|
170
175
|
})
|
|
171
|
-
}),
|
|
172
|
-
ref: ref,
|
|
173
|
-
className: computedClassName,
|
|
174
|
-
style: style,
|
|
175
|
-
...props,
|
|
176
|
-
children: children
|
|
177
|
-
})]
|
|
176
|
+
}), titleElement]
|
|
178
177
|
});
|
|
179
178
|
}
|
|
180
|
-
return
|
|
181
|
-
ref: ref,
|
|
182
|
-
className: computedClassName,
|
|
183
|
-
style: style,
|
|
184
|
-
...props,
|
|
185
|
-
children: children
|
|
186
|
-
});
|
|
179
|
+
return titleElement;
|
|
187
180
|
});
|
|
188
181
|
DialogTitle.displayName = 'Dialog.Title';
|
|
189
182
|
|
|
190
183
|
// =============================================================================
|
|
191
|
-
// STYLED DESCRIPTION
|
|
184
|
+
// STYLED DESCRIPTION (styled-only sub-slot — reads dialog context for nativeID)
|
|
192
185
|
// =============================================================================
|
|
193
186
|
|
|
194
187
|
const DialogDescription = /*#__PURE__*/forwardRef(({
|
|
188
|
+
asChild,
|
|
195
189
|
className,
|
|
196
190
|
children,
|
|
197
191
|
style,
|
|
198
192
|
...props
|
|
199
193
|
}, ref) => {
|
|
194
|
+
const {
|
|
195
|
+
nativeID
|
|
196
|
+
} = useDialog();
|
|
200
197
|
const computedClassName = cn(dialogDescriptionVariants(), className);
|
|
201
|
-
|
|
198
|
+
const Comp = asChild ? Slot : Text;
|
|
199
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
202
200
|
ref: ref,
|
|
201
|
+
nativeID: `${nativeID}-description`,
|
|
203
202
|
className: computedClassName,
|
|
204
203
|
style: style,
|
|
205
204
|
...props,
|
|
205
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
206
|
+
slot: 'dialog-description'
|
|
207
|
+
})),
|
|
206
208
|
children: children
|
|
207
209
|
});
|
|
208
210
|
});
|
|
209
211
|
DialogDescription.displayName = 'Dialog.Description';
|
|
210
212
|
|
|
211
213
|
// =============================================================================
|
|
212
|
-
// STYLED CONTENT (
|
|
214
|
+
// STYLED CONTENT (styled-only sub-slot — reads variant context for fullBleed)
|
|
213
215
|
// =============================================================================
|
|
214
216
|
|
|
215
217
|
const DialogContent = /*#__PURE__*/forwardRef(({
|
|
218
|
+
asChild,
|
|
216
219
|
className,
|
|
217
220
|
children,
|
|
218
221
|
style,
|
|
@@ -224,53 +227,67 @@ const DialogContent = /*#__PURE__*/forwardRef(({
|
|
|
224
227
|
const computedClassName = cn(dialogContentVariants({
|
|
225
228
|
fullBleed: fullBleed ?? false
|
|
226
229
|
}), className);
|
|
227
|
-
|
|
230
|
+
const Comp = asChild ? Slot : View;
|
|
231
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
228
232
|
ref: ref,
|
|
229
233
|
className: computedClassName,
|
|
230
234
|
style: style,
|
|
231
235
|
...props,
|
|
236
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
237
|
+
slot: 'dialog-content'
|
|
238
|
+
})),
|
|
232
239
|
children: children
|
|
233
240
|
});
|
|
234
241
|
});
|
|
235
242
|
DialogContent.displayName = 'Dialog.Content';
|
|
236
243
|
|
|
237
244
|
// =============================================================================
|
|
238
|
-
// STYLED TEXT
|
|
245
|
+
// STYLED TEXT (convenience text styling, styled-only)
|
|
239
246
|
// =============================================================================
|
|
240
247
|
|
|
241
248
|
const DialogText = /*#__PURE__*/forwardRef(({
|
|
249
|
+
asChild,
|
|
242
250
|
className,
|
|
243
251
|
children,
|
|
244
252
|
style,
|
|
245
253
|
...props
|
|
246
254
|
}, ref) => {
|
|
247
255
|
const computedClassName = cn(dialogTextVariants(), className);
|
|
248
|
-
|
|
256
|
+
const Comp = asChild ? Slot : Text;
|
|
257
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
249
258
|
ref: ref,
|
|
250
259
|
className: computedClassName,
|
|
251
260
|
style: style,
|
|
252
261
|
...props,
|
|
262
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
263
|
+
slot: 'dialog-text'
|
|
264
|
+
})),
|
|
253
265
|
children: children
|
|
254
266
|
});
|
|
255
267
|
});
|
|
256
268
|
DialogText.displayName = 'Dialog.Text';
|
|
257
269
|
|
|
258
270
|
// =============================================================================
|
|
259
|
-
// STYLED FOOTER
|
|
271
|
+
// STYLED FOOTER (styled-only sub-slot)
|
|
260
272
|
// =============================================================================
|
|
261
273
|
|
|
262
274
|
const DialogFooter = /*#__PURE__*/forwardRef(({
|
|
275
|
+
asChild,
|
|
263
276
|
className,
|
|
264
277
|
children,
|
|
265
278
|
style,
|
|
266
279
|
...props
|
|
267
280
|
}, ref) => {
|
|
268
281
|
const computedClassName = cn(dialogFooterVariants(), className);
|
|
269
|
-
|
|
282
|
+
const Comp = asChild ? Slot : View;
|
|
283
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
270
284
|
ref: ref,
|
|
271
285
|
className: computedClassName,
|
|
272
286
|
style: style,
|
|
273
287
|
...props,
|
|
288
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
289
|
+
slot: 'dialog-footer'
|
|
290
|
+
})),
|
|
274
291
|
children: children
|
|
275
292
|
});
|
|
276
293
|
});
|
|
@@ -288,7 +305,7 @@ const DialogClose = /*#__PURE__*/forwardRef(({
|
|
|
288
305
|
...props
|
|
289
306
|
}, ref) => {
|
|
290
307
|
const computedClassName = cn(dialogCloseVariants(), className);
|
|
291
|
-
return /*#__PURE__*/_jsx(
|
|
308
|
+
return /*#__PURE__*/_jsx(DialogClosePrimitive, {
|
|
292
309
|
ref: ref,
|
|
293
310
|
className: computedClassName,
|
|
294
311
|
style: style,
|
|
@@ -296,6 +313,9 @@ const DialogClose = /*#__PURE__*/forwardRef(({
|
|
|
296
313
|
accessibilityRole: "button",
|
|
297
314
|
accessibilityLabel: accessibilityLabel,
|
|
298
315
|
...props,
|
|
316
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
317
|
+
slot: 'dialog-close'
|
|
318
|
+
})),
|
|
299
319
|
children: children ?? /*#__PURE__*/_jsx(Icon, {
|
|
300
320
|
as: CloseIcon,
|
|
301
321
|
className: dialogCloseIconVariants()
|