@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,25 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { cn,
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
|
+
import { Text, View } from 'react-native';
|
|
5
|
+
import { ListItemRoot as ListItemRootPrimitive, Slot, dataAttributes, mergeDataAttributes } from '@cdx-ui/primitives';
|
|
6
|
+
import { cn, ParentContext, useParentContext, useStyleContext } from '@cdx-ui/utils';
|
|
7
7
|
import { listItemContentVariants, listItemDescriptionVariants, listItemLeadingSlotVariants, listItemMetaVariants, listItemRootVariants, listItemSectionHeaderLabelVariants, listItemSectionHeaderVariants, listItemTitleVariants, listItemTrailingSlotVariants } from './styles';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
const SCOPE = 'LIST_ITEM';
|
|
10
|
-
const RootView = withStyleContext(View, SCOPE);
|
|
11
|
-
const RootPressable = withStyleContext(Pressable, SCOPE);
|
|
12
|
-
const ListItemPrimitive = createListItem({
|
|
13
|
-
View: RootView,
|
|
14
|
-
Pressable: RootPressable,
|
|
15
|
-
LeadingSlot: View,
|
|
16
|
-
Content: View,
|
|
17
|
-
Title: Text,
|
|
18
|
-
Description: Text,
|
|
19
|
-
Meta: Text,
|
|
20
|
-
TrailingSlot: View,
|
|
21
|
-
SectionHeader: View
|
|
22
|
-
});
|
|
23
10
|
const useListItemStyleContext = () => {
|
|
24
11
|
const ctx = useStyleContext(SCOPE);
|
|
25
12
|
return {
|
|
@@ -34,27 +21,36 @@ const useListItemStyleContext = () => {
|
|
|
34
21
|
const ListItemRoot = /*#__PURE__*/forwardRef(({
|
|
35
22
|
size = 'default',
|
|
36
23
|
showSeparator = true,
|
|
37
|
-
crossAlign = 'center',
|
|
24
|
+
crossAlign: crossAlignProp = 'center',
|
|
38
25
|
className,
|
|
39
26
|
style,
|
|
40
27
|
...props
|
|
41
28
|
}, ref) => {
|
|
29
|
+
const crossAlign = crossAlignProp ?? 'center';
|
|
30
|
+
const parent = useParentContext();
|
|
31
|
+
const ctx = useMemo(() => ({
|
|
32
|
+
...parent,
|
|
33
|
+
[SCOPE]: {
|
|
34
|
+
crossAlign
|
|
35
|
+
}
|
|
36
|
+
}), [parent, crossAlign]);
|
|
42
37
|
const computedClassName = cn(listItemRootVariants({
|
|
43
38
|
size,
|
|
44
39
|
showSeparator,
|
|
45
40
|
crossAlign
|
|
46
41
|
}), className);
|
|
47
|
-
return /*#__PURE__*/_jsx(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
return /*#__PURE__*/_jsx(ParentContext.Provider, {
|
|
43
|
+
value: ctx,
|
|
44
|
+
children: /*#__PURE__*/_jsx(ListItemRootPrimitive, {
|
|
45
|
+
ref: ref,
|
|
46
|
+
className: computedClassName,
|
|
47
|
+
crossAlign: crossAlign,
|
|
48
|
+
style: style,
|
|
49
|
+
...props,
|
|
50
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
51
|
+
slot: 'list-item'
|
|
52
|
+
}))
|
|
53
|
+
})
|
|
58
54
|
});
|
|
59
55
|
});
|
|
60
56
|
ListItemRoot.displayName = 'ListItem';
|
|
@@ -63,18 +59,38 @@ ListItemRoot.displayName = 'ListItem';
|
|
|
63
59
|
// SLOTS & TEXT
|
|
64
60
|
// =============================================================================
|
|
65
61
|
|
|
62
|
+
const leadingSlotStyle = {
|
|
63
|
+
flexShrink: 0
|
|
64
|
+
};
|
|
66
65
|
const ListItemLeadingSlot = /*#__PURE__*/forwardRef(({
|
|
66
|
+
asChild,
|
|
67
67
|
className,
|
|
68
68
|
style,
|
|
69
|
+
'aria-hidden': ariaHidden,
|
|
69
70
|
...props
|
|
70
|
-
}, ref) =>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
}, ref) => {
|
|
72
|
+
const accessibilityElementsHidden = ariaHidden !== false;
|
|
73
|
+
const Comp = asChild ? Slot : View;
|
|
74
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
75
|
+
ref: ref,
|
|
76
|
+
accessibilityElementsHidden: accessibilityElementsHidden,
|
|
77
|
+
"aria-hidden": ariaHidden ?? true,
|
|
78
|
+
className: cn(listItemLeadingSlotVariants(), className),
|
|
79
|
+
style: [leadingSlotStyle, style],
|
|
80
|
+
...props,
|
|
81
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
82
|
+
slot: 'list-item-leading'
|
|
83
|
+
}))
|
|
84
|
+
});
|
|
85
|
+
});
|
|
76
86
|
ListItemLeadingSlot.displayName = 'ListItem.LeadingSlot';
|
|
87
|
+
const contentStyle = {
|
|
88
|
+
flex: 1,
|
|
89
|
+
flexDirection: 'column',
|
|
90
|
+
minWidth: 0
|
|
91
|
+
};
|
|
77
92
|
const ListItemContent = /*#__PURE__*/forwardRef(({
|
|
93
|
+
asChild,
|
|
78
94
|
className,
|
|
79
95
|
style,
|
|
80
96
|
...props
|
|
@@ -82,60 +98,80 @@ const ListItemContent = /*#__PURE__*/forwardRef(({
|
|
|
82
98
|
const {
|
|
83
99
|
crossAlign
|
|
84
100
|
} = useListItemStyleContext();
|
|
85
|
-
|
|
101
|
+
const Comp = asChild ? Slot : View;
|
|
102
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
86
103
|
ref: ref,
|
|
87
104
|
className: cn(listItemContentVariants({
|
|
88
105
|
crossAlign
|
|
89
106
|
}), className),
|
|
90
|
-
style: style,
|
|
91
|
-
...props
|
|
107
|
+
style: [contentStyle, style],
|
|
108
|
+
...props,
|
|
109
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
110
|
+
slot: 'list-item-content'
|
|
111
|
+
}))
|
|
92
112
|
});
|
|
93
113
|
});
|
|
94
114
|
ListItemContent.displayName = 'ListItem.Content';
|
|
95
115
|
const ListItemTitle = /*#__PURE__*/forwardRef(({
|
|
116
|
+
asChild,
|
|
96
117
|
className,
|
|
97
118
|
numberOfLines = 1,
|
|
98
119
|
style,
|
|
99
120
|
...props
|
|
100
121
|
}, ref) => {
|
|
101
|
-
|
|
122
|
+
const Comp = asChild ? Slot : Text;
|
|
123
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
102
124
|
ref: ref,
|
|
103
125
|
className: cn(listItemTitleVariants(), className),
|
|
104
126
|
numberOfLines: numberOfLines,
|
|
105
127
|
style: style,
|
|
106
|
-
...props
|
|
128
|
+
...props,
|
|
129
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
130
|
+
slot: 'list-item-title'
|
|
131
|
+
}))
|
|
107
132
|
});
|
|
108
133
|
});
|
|
109
134
|
ListItemTitle.displayName = 'ListItem.Title';
|
|
110
135
|
const ListItemDescription = /*#__PURE__*/forwardRef(({
|
|
136
|
+
asChild,
|
|
111
137
|
className,
|
|
112
138
|
style,
|
|
113
139
|
...props
|
|
114
140
|
}, ref) => {
|
|
115
|
-
|
|
141
|
+
const Comp = asChild ? Slot : Text;
|
|
142
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
116
143
|
ref: ref,
|
|
117
144
|
className: cn(listItemDescriptionVariants(), className),
|
|
118
145
|
style: style,
|
|
119
|
-
...props
|
|
146
|
+
...props,
|
|
147
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
148
|
+
slot: 'list-item-description'
|
|
149
|
+
}))
|
|
120
150
|
});
|
|
121
151
|
});
|
|
122
152
|
ListItemDescription.displayName = 'ListItem.Description';
|
|
123
153
|
const ListItemMeta = /*#__PURE__*/forwardRef(({
|
|
154
|
+
asChild,
|
|
124
155
|
className,
|
|
125
156
|
numberOfLines = 1,
|
|
126
157
|
style,
|
|
127
158
|
...props
|
|
128
159
|
}, ref) => {
|
|
129
|
-
|
|
160
|
+
const Comp = asChild ? Slot : Text;
|
|
161
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
130
162
|
ref: ref,
|
|
131
163
|
className: cn(listItemMetaVariants(), className),
|
|
132
164
|
numberOfLines: numberOfLines,
|
|
133
165
|
style: style,
|
|
134
|
-
...props
|
|
166
|
+
...props,
|
|
167
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
168
|
+
slot: 'list-item-meta'
|
|
169
|
+
}))
|
|
135
170
|
});
|
|
136
171
|
});
|
|
137
172
|
ListItemMeta.displayName = 'ListItem.Meta';
|
|
138
173
|
const ListItemTrailingSlot = /*#__PURE__*/forwardRef(({
|
|
174
|
+
asChild,
|
|
139
175
|
className,
|
|
140
176
|
style,
|
|
141
177
|
...props
|
|
@@ -143,13 +179,19 @@ const ListItemTrailingSlot = /*#__PURE__*/forwardRef(({
|
|
|
143
179
|
const {
|
|
144
180
|
crossAlign
|
|
145
181
|
} = useListItemStyleContext();
|
|
146
|
-
|
|
182
|
+
const Comp = asChild ? Slot : View;
|
|
183
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
147
184
|
ref: ref,
|
|
148
185
|
className: cn(listItemTrailingSlotVariants({
|
|
149
186
|
crossAlign
|
|
150
187
|
}), className),
|
|
151
|
-
style:
|
|
152
|
-
|
|
188
|
+
style: [{
|
|
189
|
+
flexShrink: 0
|
|
190
|
+
}, style],
|
|
191
|
+
...props,
|
|
192
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
193
|
+
slot: 'list-item-trailing'
|
|
194
|
+
}))
|
|
153
195
|
});
|
|
154
196
|
});
|
|
155
197
|
ListItemTrailingSlot.displayName = 'ListItem.TrailingSlot';
|
|
@@ -167,24 +209,57 @@ const wrapSectionHeaderLabel = children => {
|
|
|
167
209
|
// SECTION HEADER
|
|
168
210
|
// =============================================================================
|
|
169
211
|
|
|
212
|
+
// TODO: ListItem.SectionHeader doesn't follow composition patterns (composing text, trailing prop, etc).
|
|
213
|
+
|
|
214
|
+
const sectionHeaderRow = {
|
|
215
|
+
flexDirection: 'row',
|
|
216
|
+
alignItems: 'center',
|
|
217
|
+
justifyContent: 'space-between',
|
|
218
|
+
gap: 8
|
|
219
|
+
};
|
|
220
|
+
const sectionHeaderLabelCell = {
|
|
221
|
+
flex: 1,
|
|
222
|
+
minWidth: 0,
|
|
223
|
+
/** Keeps the label column from stretching to a taller trailing sibling (e.g. Chip). */
|
|
224
|
+
alignSelf: 'center'
|
|
225
|
+
};
|
|
226
|
+
const sectionHeaderTrailingCell = {
|
|
227
|
+
flexShrink: 0,
|
|
228
|
+
/** Prevents the trailing slot from stretching vertically and “filling” the row. */
|
|
229
|
+
alignSelf: 'center'
|
|
230
|
+
};
|
|
170
231
|
const ListItemSectionHeader = /*#__PURE__*/forwardRef(({
|
|
232
|
+
asChild,
|
|
171
233
|
children,
|
|
172
234
|
className,
|
|
173
235
|
showDivider = true,
|
|
174
236
|
style,
|
|
175
237
|
trailing,
|
|
238
|
+
accessibilityRole = 'header',
|
|
176
239
|
...props
|
|
177
|
-
}, ref) =>
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
240
|
+
}, ref) => {
|
|
241
|
+
const Comp = asChild ? Slot : View;
|
|
242
|
+
return /*#__PURE__*/_jsxs(Comp, {
|
|
243
|
+
ref: ref,
|
|
244
|
+
accessibilityRole: accessibilityRole,
|
|
245
|
+
className: cn(listItemSectionHeaderVariants({
|
|
246
|
+
showDivider
|
|
247
|
+
}), className),
|
|
248
|
+
style: [sectionHeaderRow, style],
|
|
249
|
+
...props,
|
|
250
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
251
|
+
slot: 'list-section-header',
|
|
252
|
+
divider: showDivider
|
|
253
|
+
})),
|
|
254
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
255
|
+
style: sectionHeaderLabelCell,
|
|
256
|
+
children: wrapSectionHeaderLabel(children)
|
|
257
|
+
}), trailing ? /*#__PURE__*/_jsx(View, {
|
|
258
|
+
style: sectionHeaderTrailingCell,
|
|
259
|
+
children: trailing
|
|
260
|
+
}) : null]
|
|
261
|
+
});
|
|
262
|
+
});
|
|
188
263
|
ListItemSectionHeader.displayName = 'ListItem.SectionHeader';
|
|
189
264
|
|
|
190
265
|
// =============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","
|
|
1
|
+
{"version":3,"names":["forwardRef","useMemo","Text","View","ListItemRoot","ListItemRootPrimitive","Slot","dataAttributes","mergeDataAttributes","cn","ParentContext","useParentContext","useStyleContext","listItemContentVariants","listItemDescriptionVariants","listItemLeadingSlotVariants","listItemMetaVariants","listItemRootVariants","listItemSectionHeaderLabelVariants","listItemSectionHeaderVariants","listItemTitleVariants","listItemTrailingSlotVariants","jsx","_jsx","jsxs","_jsxs","SCOPE","useListItemStyleContext","ctx","crossAlign","size","showSeparator","crossAlignProp","className","style","props","ref","parent","computedClassName","Provider","value","children","slot","displayName","leadingSlotStyle","flexShrink","ListItemLeadingSlot","asChild","ariaHidden","accessibilityElementsHidden","Comp","contentStyle","flex","flexDirection","minWidth","ListItemContent","ListItemTitle","numberOfLines","ListItemDescription","ListItemMeta","ListItemTrailingSlot","wrapSectionHeaderLabel","sectionHeaderRow","alignItems","justifyContent","gap","sectionHeaderLabelCell","alignSelf","sectionHeaderTrailingCell","ListItemSectionHeader","showDivider","trailing","accessibilityRole","divider","ListItem","Object","assign","LeadingSlot","Content","Title","Description","Meta","TrailingSlot","SectionHeader"],"sourceRoot":"../../../../src","sources":["components/ListItem/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,OAAO,QAAwB,OAAO;AAC3D,SAASC,IAAI,EAAEC,IAAI,QAAwC,cAAc;AACzE,SACEC,YAAY,IAAIC,qBAAqB,EACrCC,IAAI,EACJC,cAAc,EACdC,mBAAmB,QAGd,oBAAoB;AAC3B,SAASC,EAAE,EAAEC,aAAa,EAAEC,gBAAgB,EAAEC,eAAe,QAAQ,eAAe;AACpF,SACEC,uBAAuB,EACvBC,2BAA2B,EAC3BC,2BAA2B,EAC3BC,oBAAoB,EACpBC,oBAAoB,EACpBC,kCAAkC,EAClCC,6BAA6B,EAC7BC,qBAAqB,EACrBC,4BAA4B,QAEvB,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAElB,MAAMC,KAAK,GAAG,WAAW;AAEzB,MAAMC,uBAAuB,GAAGA,CAAA,KAAgD;EAC9E,MAAMC,GAAG,GAAGhB,eAAe,CAACc,KAAK,CAAqC;EACtE,OAAO;IAAEG,UAAU,EAAED,GAAG,EAAEC,UAAU,IAAI;EAAS,CAAC;AACpD,CAAC;;AAED;AACA;AACA;;AAMA,MAAMzB,YAAY,gBAAGJ,UAAU,CAC7B,CACE;EACE8B,IAAI,GAAG,SAAS;EAChBC,aAAa,GAAG,IAAI;EACpBF,UAAU,EAAEG,cAAc,GAAG,QAAQ;EACrCC,SAAS;EACTC,KAAK;EACL,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMP,UAA8B,GAAGG,cAAc,IAAI,QAAQ;EACjE,MAAMK,MAAM,GAAG1B,gBAAgB,CAAC,CAAC;EACjC,MAAMiB,GAAG,GAAG3B,OAAO,CAAC,OAAO;IAAE,GAAGoC,MAAM;IAAE,CAACX,KAAK,GAAG;MAAEG;IAAW;EAAE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AQ,CAAO,CAAC,GAAG,IAAI;EAAA,CACxE,CAAC;AAEX,CACF,CAAC;AAEDF,qBAAqB,CAAC1B,WAAW,GAAG,wBAAwB;;AAE5D;AACA;AACA;;AAYA,OAAO,MAAM+B,QAAQ,GAAGC,MAAM,CAACC,MAAM,CAACxE,YAAY,EAAE;EAClDyE,WAAW,EAAE/B,mBAAmB;EAChCgC,OAAO,EAAEvB,eAAe;EACxBwB,KAAK,EAAEvB,aAAa;EACpBwB,WAAW,EAAEtB,mBAAmB;EAChCuB,IAAI,EAAEtB,YAAY;EAClBuB,YAAY,EAAEtB,oBAAoB;EAClCuB,aAAa,EAAEd;AACjB,CAAC,CAAqB;AAGtB,SACExD,uBAAuB,EACvBC,2BAA2B,EAC3BC,2BAA2B,EAC3BC,oBAAoB,EACpBC,oBAAoB,EACpBC,kCAAkC,EAClCC,6BAA6B,EAC7BC,qBAAqB,EACrBC,4BAA4B,QACvB,UAAU","ignoreList":[]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { OtpCellIndexProvider, OtpInputField, OtpInputProvider, dataAttributes, mergeDataAttributes, useInputContext, useOtpInput } from '@cdx-ui/primitives';
|
|
6
|
+
import { ParentContext, cn, useParentContext, useStyleContext } from '@cdx-ui/utils';
|
|
7
7
|
import { Input } from '../Input';
|
|
8
|
+
import { inputFieldVariants } from '../Input/styles';
|
|
8
9
|
import { otpCellVariants, otpFieldVariants, otpRootVariants } from './styles';
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
const SCOPE = 'OTP_INPUT';
|
|
11
|
-
const OtpRoot = withStyleContext(HStack, SCOPE);
|
|
12
12
|
const useOtpInputStyleContext = () => useStyleContext(SCOPE);
|
|
13
13
|
const OtpStyledCell = /*#__PURE__*/forwardRef(({
|
|
14
14
|
className,
|
|
@@ -31,48 +31,114 @@ const OtpStyledCell = /*#__PURE__*/forwardRef(({
|
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
OtpStyledCell.displayName = 'OtpInput.Cell';
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Bridges OtpInputField focus/blur events to the parent Input's context so
|
|
37
|
+
* InputRoot emits `data-focus=true` and the `border-stroke-action` CSS activates.
|
|
38
|
+
* The primitive OtpInputField doesn't know about InputContext — that coupling
|
|
39
|
+
* belongs here in the styled layer.
|
|
40
|
+
*/
|
|
41
|
+
const OtpStyledField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
38
42
|
const {
|
|
39
|
-
|
|
40
|
-
} =
|
|
41
|
-
return /*#__PURE__*/_jsx(
|
|
43
|
+
setIsFocused
|
|
44
|
+
} = useInputContext();
|
|
45
|
+
return /*#__PURE__*/_jsx(OtpInputField, {
|
|
42
46
|
ref: ref,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
...props,
|
|
48
|
+
onFocus: e => {
|
|
49
|
+
setIsFocused?.(true);
|
|
50
|
+
props.onFocus?.(e);
|
|
51
|
+
},
|
|
52
|
+
onBlur: e => {
|
|
53
|
+
setIsFocused?.(false);
|
|
54
|
+
props.onBlur?.(e);
|
|
55
|
+
}
|
|
47
56
|
});
|
|
48
57
|
});
|
|
49
58
|
OtpStyledField.displayName = 'OtpInput.Field';
|
|
50
|
-
const OtpPrimitive = createOtpInput({
|
|
51
|
-
Root: OtpRoot,
|
|
52
|
-
Cell: OtpStyledCell,
|
|
53
|
-
Field: OtpStyledField
|
|
54
|
-
});
|
|
55
59
|
export const OtpInput = /*#__PURE__*/forwardRef(({
|
|
56
60
|
variant = 'outline',
|
|
57
61
|
size = 'default',
|
|
58
62
|
fullWidth = true,
|
|
59
63
|
className,
|
|
60
64
|
style,
|
|
65
|
+
cellCount,
|
|
66
|
+
value,
|
|
67
|
+
onChangeText,
|
|
68
|
+
onComplete,
|
|
69
|
+
isDisabled,
|
|
70
|
+
isInvalid,
|
|
71
|
+
isReadOnly,
|
|
72
|
+
smsOtpAutofill,
|
|
73
|
+
filterInput,
|
|
74
|
+
allowedCharacters,
|
|
75
|
+
characterPattern,
|
|
76
|
+
getCellProps,
|
|
77
|
+
cellTestIdPrefix,
|
|
78
|
+
accessibilityLabel,
|
|
61
79
|
...rest
|
|
62
80
|
}, ref) => {
|
|
81
|
+
const otpContext = useOtpInput({
|
|
82
|
+
cellCount,
|
|
83
|
+
value,
|
|
84
|
+
onChangeText,
|
|
85
|
+
onComplete,
|
|
86
|
+
isDisabled,
|
|
87
|
+
isInvalid,
|
|
88
|
+
isReadOnly,
|
|
89
|
+
smsOtpAutofill,
|
|
90
|
+
filterInput,
|
|
91
|
+
allowedCharacters,
|
|
92
|
+
characterPattern,
|
|
93
|
+
getCellProps,
|
|
94
|
+
cellTestIdPrefix,
|
|
95
|
+
accessibilityLabel
|
|
96
|
+
});
|
|
63
97
|
const rootClassName = cn(otpRootVariants({
|
|
64
98
|
size,
|
|
65
99
|
fullWidth
|
|
66
100
|
}), className);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
context: {
|
|
101
|
+
const parent = useParentContext();
|
|
102
|
+
const ctx = useMemo(() => ({
|
|
103
|
+
...parent,
|
|
104
|
+
[SCOPE]: {
|
|
72
105
|
variant,
|
|
73
106
|
size
|
|
74
|
-
}
|
|
75
|
-
|
|
107
|
+
}
|
|
108
|
+
}), [parent, variant, size]);
|
|
109
|
+
const fieldClassName = cn(inputFieldVariants({
|
|
110
|
+
size
|
|
111
|
+
}), otpFieldVariants({
|
|
112
|
+
size
|
|
113
|
+
}));
|
|
114
|
+
const cells = [];
|
|
115
|
+
for (let i = 0; i < cellCount; i++) {
|
|
116
|
+
cells.push(/*#__PURE__*/_jsx(OtpCellIndexProvider, {
|
|
117
|
+
value: {
|
|
118
|
+
cellIndex: i
|
|
119
|
+
},
|
|
120
|
+
children: /*#__PURE__*/_jsx(OtpStyledCell, {
|
|
121
|
+
children: /*#__PURE__*/_jsx(OtpStyledField, {
|
|
122
|
+
className: fieldClassName
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
|
+
}, i));
|
|
126
|
+
}
|
|
127
|
+
return /*#__PURE__*/_jsx(ParentContext.Provider, {
|
|
128
|
+
value: ctx,
|
|
129
|
+
children: /*#__PURE__*/_jsx(OtpInputProvider, {
|
|
130
|
+
value: otpContext,
|
|
131
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
132
|
+
ref: ref,
|
|
133
|
+
className: rootClassName,
|
|
134
|
+
style: style,
|
|
135
|
+
...rest,
|
|
136
|
+
...mergeDataAttributes(rest, dataAttributes({
|
|
137
|
+
slot: 'otp-input'
|
|
138
|
+
})),
|
|
139
|
+
children: cells
|
|
140
|
+
})
|
|
141
|
+
})
|
|
76
142
|
});
|
|
77
143
|
});
|
|
78
144
|
OtpInput.displayName = 'OtpInput';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","
|
|
1
|
+
{"version":3,"names":["forwardRef","useMemo","View","OtpCellIndexProvider","OtpInputField","OtpInputProvider","dataAttributes","mergeDataAttributes","useInputContext","useOtpInput","ParentContext","cn","useParentContext","useStyleContext","Input","inputFieldVariants","otpCellVariants","otpFieldVariants","otpRootVariants","jsx","_jsx","SCOPE","useOtpInputStyleContext","OtpStyledCell","className","children","props","ref","size","variant","displayName","OtpStyledField","setIsFocused","onFocus","e","onBlur","OtpInput","fullWidth","style","cellCount","value","onChangeText","onComplete","isDisabled","isInvalid","isReadOnly","smsOtpAutofill","filterInput","allowedCharacters","characterPattern","getCellProps","cellTestIdPrefix","accessibilityLabel","rest","otpContext","rootClassName","parent","ctx","fieldClassName","cells","i","push","cellIndex","Provider","slot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2
2
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import { createProgress } from '@cdx-ui/primitives';
|
|
4
|
+
import { ProgressBarRoot, ProgressBarIndicator } from '@cdx-ui/primitives';
|
|
6
5
|
import { cn } from '@cdx-ui/utils';
|
|
7
6
|
import { progressBarIndicatorVariants, progressBarTrackVariants } from './styles';
|
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const
|
|
10
|
-
Root: View,
|
|
11
|
-
Indicator: View
|
|
12
|
-
});
|
|
13
|
-
const ProgressBarRoot = /*#__PURE__*/forwardRef(({
|
|
8
|
+
const ProgressBarRootComponent = /*#__PURE__*/forwardRef(({
|
|
14
9
|
className,
|
|
15
10
|
style,
|
|
16
11
|
...props
|
|
17
12
|
}, ref) => {
|
|
18
13
|
const trackClass = cn(progressBarTrackVariants(), className);
|
|
19
|
-
return /*#__PURE__*/_jsx(
|
|
14
|
+
return /*#__PURE__*/_jsx(ProgressBarRoot, {
|
|
20
15
|
ref: ref,
|
|
21
16
|
className: trackClass,
|
|
22
17
|
style: style,
|
|
23
18
|
...props
|
|
24
19
|
});
|
|
25
20
|
});
|
|
26
|
-
|
|
27
|
-
const
|
|
21
|
+
ProgressBarRootComponent.displayName = 'ProgressBar';
|
|
22
|
+
const ProgressBarIndicatorComponent = /*#__PURE__*/forwardRef(({
|
|
28
23
|
className,
|
|
29
24
|
style,
|
|
30
25
|
...props
|
|
31
|
-
}, ref) => /*#__PURE__*/_jsx(
|
|
26
|
+
}, ref) => /*#__PURE__*/_jsx(ProgressBarIndicator, {
|
|
32
27
|
ref: ref,
|
|
33
28
|
className: cn(progressBarIndicatorVariants(), className),
|
|
34
29
|
style: style,
|
|
35
30
|
...props
|
|
36
31
|
}));
|
|
37
|
-
|
|
38
|
-
export const ProgressBar = Object.assign(
|
|
39
|
-
Indicator:
|
|
32
|
+
ProgressBarIndicatorComponent.displayName = 'ProgressBar.Indicator';
|
|
33
|
+
export const ProgressBar = Object.assign(ProgressBarRootComponent, {
|
|
34
|
+
Indicator: ProgressBarIndicatorComponent
|
|
40
35
|
});
|
|
41
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","
|
|
1
|
+
{"version":3,"names":["forwardRef","ProgressBarRoot","ProgressBarIndicator","cn","progressBarIndicatorVariants","progressBarTrackVariants","jsx","_jsx","ProgressBarRootComponent","className","style","props","ref","trackClass","displayName","ProgressBarIndicatorComponent","ProgressBar","Object","assign","Indicator"],"sourceRoot":"../../../../src","sources":["components/ProgressBar/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAElC,SAASC,eAAe,EAAEC,oBAAoB,QAA6B,oBAAoB;AAC/F,SAASC,EAAE,QAAQ,eAAe;AAClC,SACEC,4BAA4B,EAC5BC,wBAAwB,QAEnB,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAUlB,MAAMC,wBAAwB,gBAAGR,UAAU,CACzC,CAAC;EAAES,SAAS;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EACvC,MAAMC,UAAU,GAAGV,EAAE,CAACE,wBAAwB,CAAC,CAAC,EAAEI,SAAS,CAAC;EAE5D,oBAAOF,IAAA,CAACN,eAAe;IAACW,GAAG,EAAEA,GAAI;IAACH,SAAS,EAAEI,UAAW;IAACH,KAAK,EAAEA,KAAM;IAAA,GAAKC;EAAK,CAAG,CAAC;AACtF,CACF,CAAC;AAEDH,wBAAwB,CAACM,WAAW,GAAG,aAAa;AAEpD,MAAMC,6BAA6B,gBAAGf,UAAU,CAC9C,CAAC;EAAES,SAAS;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBAClCL,IAAA,CAACL,oBAAoB;EACnBU,GAAG,EAAEA,GAAI;EACTH,SAAS,EAAEN,EAAE,CAACC,4BAA4B,CAAC,CAAC,EAAEK,SAAS,CAAE;EACzDC,KAAK,EAAEA,KAAM;EAAA,GACTC;AAAK,CACV,CAEL,CAAC;AAEDI,6BAA6B,CAACD,WAAW,GAAG,uBAAuB;AAMnE,OAAO,MAAME,WAAW,GAAGC,MAAM,CAACC,MAAM,CAACV,wBAAwB,EAAE;EACjEW,SAAS,EAAEJ;AACb,CAAC,CAAiC","ignoreList":[]}
|