@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,41 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
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":[]}
|
|
@@ -1,59 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { Text, View } from 'react-native';
|
|
5
|
+
import { RadioRoot as RadioRootPrimitive, RadioGroup as RadioGroupPrimitive, Slot, dataAttributes, mergeDataAttributes, useRadioContext } from '@cdx-ui/primitives';
|
|
6
6
|
import { cn } from '@cdx-ui/utils';
|
|
7
7
|
import { radioGroupVariants, radioIndicatorVariants, radioInnerDotVariants, radioLabelVariants, radioRootVariants } from './styles';
|
|
8
8
|
|
|
9
|
-
// =============================================================================
|
|
10
|
-
// STYLED INDICATOR BASE
|
|
11
|
-
// =============================================================================
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
const RadioIndicatorBase = /*#__PURE__*/forwardRef(({
|
|
14
|
-
className,
|
|
15
|
-
children,
|
|
16
|
-
style,
|
|
17
|
-
...props
|
|
18
|
-
}, ref) => {
|
|
19
|
-
// On web, data attributes arrive as `dataSet: { checked: true }`.
|
|
20
|
-
// On native, they arrive as individual `data-checked: "true"` props.
|
|
21
|
-
const ds = props.dataSet;
|
|
22
|
-
const isChecked = ds ? ds.checked === true : props['data-checked'] === 'true';
|
|
23
|
-
const isInvalid = ds ? ds.invalid === true : props['data-invalid'] === 'true';
|
|
24
|
-
const isHovered = ds ? ds.hover === true : props['data-hover'] === 'true';
|
|
25
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
26
|
-
ref: ref,
|
|
27
|
-
className: cn(radioIndicatorVariants(), className),
|
|
28
|
-
style: style,
|
|
29
|
-
...props,
|
|
30
|
-
children: [/*#__PURE__*/_jsx(View, {
|
|
31
|
-
className: cn(radioInnerDotVariants()),
|
|
32
|
-
...dataAttributes({
|
|
33
|
-
checked: isChecked,
|
|
34
|
-
invalid: isInvalid,
|
|
35
|
-
hover: isHovered
|
|
36
|
-
})
|
|
37
|
-
}), children]
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
RadioIndicatorBase.displayName = 'Radio.IndicatorBase';
|
|
41
|
-
|
|
42
|
-
// =============================================================================
|
|
43
|
-
// PRIMITIVE ASSEMBLY
|
|
44
|
-
// =============================================================================
|
|
45
|
-
|
|
46
|
-
const RadioPrimitive = createRadio({
|
|
47
|
-
Root: Pressable,
|
|
48
|
-
Indicator: RadioIndicatorBase,
|
|
49
|
-
Label: Text,
|
|
50
|
-
Group: View
|
|
51
|
-
});
|
|
52
|
-
|
|
53
9
|
// =============================================================================
|
|
54
10
|
// RADIO ROOT
|
|
55
11
|
// =============================================================================
|
|
56
|
-
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
57
13
|
const RadioRoot = /*#__PURE__*/forwardRef(({
|
|
58
14
|
className,
|
|
59
15
|
children,
|
|
@@ -61,59 +17,96 @@ const RadioRoot = /*#__PURE__*/forwardRef(({
|
|
|
61
17
|
...props
|
|
62
18
|
}, ref) => {
|
|
63
19
|
const computedClassName = cn(radioRootVariants(), className);
|
|
64
|
-
return /*#__PURE__*/
|
|
20
|
+
return /*#__PURE__*/_jsxs(RadioRootPrimitive, {
|
|
65
21
|
ref: ref,
|
|
66
22
|
className: computedClassName,
|
|
67
23
|
style: style,
|
|
68
24
|
...props,
|
|
69
|
-
|
|
25
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
26
|
+
slot: 'radio'
|
|
27
|
+
})),
|
|
28
|
+
children: [/*#__PURE__*/_jsx(RadioIndicator, {}), children]
|
|
70
29
|
});
|
|
71
30
|
});
|
|
72
31
|
RadioRoot.displayName = 'Radio';
|
|
73
32
|
|
|
74
33
|
// =============================================================================
|
|
75
|
-
// RADIO INDICATOR
|
|
34
|
+
// RADIO INDICATOR (styled-only, reads context for data-* styling)
|
|
76
35
|
// =============================================================================
|
|
77
36
|
|
|
78
37
|
const RadioIndicator = /*#__PURE__*/forwardRef(({
|
|
38
|
+
asChild,
|
|
79
39
|
className,
|
|
80
40
|
children,
|
|
81
41
|
style,
|
|
82
42
|
...props
|
|
83
43
|
}, ref) => {
|
|
84
|
-
|
|
44
|
+
const {
|
|
45
|
+
isChecked,
|
|
46
|
+
isDisabled,
|
|
47
|
+
isHovered,
|
|
48
|
+
isInvalid,
|
|
49
|
+
isReadOnly,
|
|
50
|
+
isPressed,
|
|
51
|
+
isFocusVisible
|
|
52
|
+
} = useRadioContext();
|
|
53
|
+
const computedClassName = cn(radioIndicatorVariants(), className);
|
|
54
|
+
const Comp = asChild ? Slot : View;
|
|
55
|
+
return /*#__PURE__*/_jsxs(Comp, {
|
|
85
56
|
ref: ref,
|
|
86
|
-
className:
|
|
57
|
+
className: computedClassName,
|
|
87
58
|
style: style,
|
|
88
59
|
...props,
|
|
89
|
-
|
|
60
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
61
|
+
slot: 'radio-indicator',
|
|
62
|
+
hover: isHovered,
|
|
63
|
+
checked: isChecked,
|
|
64
|
+
disabled: isDisabled,
|
|
65
|
+
focusVisible: isFocusVisible,
|
|
66
|
+
invalid: isInvalid,
|
|
67
|
+
readonly: isReadOnly,
|
|
68
|
+
active: isPressed
|
|
69
|
+
})),
|
|
70
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
71
|
+
className: cn(radioInnerDotVariants()),
|
|
72
|
+
...dataAttributes({
|
|
73
|
+
checked: isChecked,
|
|
74
|
+
invalid: isInvalid,
|
|
75
|
+
hover: isHovered
|
|
76
|
+
})
|
|
77
|
+
}), children]
|
|
90
78
|
});
|
|
91
79
|
});
|
|
92
80
|
RadioIndicator.displayName = 'Radio.Indicator';
|
|
93
81
|
|
|
94
82
|
// =============================================================================
|
|
95
|
-
// RADIO LABEL
|
|
83
|
+
// RADIO LABEL (styled-only)
|
|
96
84
|
// =============================================================================
|
|
97
85
|
|
|
98
86
|
const RadioLabel = /*#__PURE__*/forwardRef(({
|
|
87
|
+
asChild,
|
|
99
88
|
className,
|
|
100
89
|
children,
|
|
101
90
|
style,
|
|
102
91
|
...props
|
|
103
92
|
}, ref) => {
|
|
104
93
|
const computedClassName = cn(radioLabelVariants(), className);
|
|
105
|
-
|
|
94
|
+
const Comp = asChild ? Slot : Text;
|
|
95
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
106
96
|
ref: ref,
|
|
107
97
|
className: computedClassName,
|
|
108
98
|
style: style,
|
|
109
99
|
...props,
|
|
100
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
101
|
+
slot: 'radio-label'
|
|
102
|
+
})),
|
|
110
103
|
children: children
|
|
111
104
|
});
|
|
112
105
|
});
|
|
113
106
|
RadioLabel.displayName = 'Radio.Label';
|
|
114
107
|
|
|
115
108
|
// =============================================================================
|
|
116
|
-
// RADIO GROUP
|
|
109
|
+
// RADIO GROUP (wraps the primitive)
|
|
117
110
|
// =============================================================================
|
|
118
111
|
|
|
119
112
|
const RadioGroup = /*#__PURE__*/forwardRef(({
|
|
@@ -134,7 +127,7 @@ const RadioGroup = /*#__PURE__*/forwardRef(({
|
|
|
134
127
|
const computedClassName = cn(radioGroupVariants({
|
|
135
128
|
direction
|
|
136
129
|
}), className);
|
|
137
|
-
return /*#__PURE__*/_jsx(
|
|
130
|
+
return /*#__PURE__*/_jsx(RadioGroupPrimitive, {
|
|
138
131
|
ref: ref,
|
|
139
132
|
className: computedClassName,
|
|
140
133
|
style: style,
|
|
@@ -146,7 +139,11 @@ const RadioGroup = /*#__PURE__*/forwardRef(({
|
|
|
146
139
|
isRequired: isRequired,
|
|
147
140
|
isReadOnly: isReadOnly,
|
|
148
141
|
name: name,
|
|
142
|
+
direction: direction,
|
|
149
143
|
...viewProps,
|
|
144
|
+
...mergeDataAttributes(viewProps, dataAttributes({
|
|
145
|
+
slot: 'radio-group'
|
|
146
|
+
})),
|
|
150
147
|
children: children
|
|
151
148
|
});
|
|
152
149
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","
|
|
1
|
+
{"version":3,"names":["forwardRef","Text","View","RadioRoot","RadioRootPrimitive","RadioGroup","RadioGroupPrimitive","Slot","dataAttributes","mergeDataAttributes","useRadioContext","cn","radioGroupVariants","radioIndicatorVariants","radioInnerDotVariants","radioLabelVariants","radioRootVariants","jsx","_jsx","jsxs","_jsxs","className","children","style","props","ref","computedClassName","slot","RadioIndicator","displayName","asChild","isChecked","isDisabled","isHovered","isInvalid","isReadOnly","isPressed","isFocusVisible","Comp","hover","checked","disabled","focusVisible","invalid","readonly","active","RadioLabel","direction","value","defaultValue","onChange","isRequired","name","viewProps","Radio","Object","assign","Indicator","Label","Group"],"sourceRoot":"../../../../src","sources":["components/Radio/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAwB,OAAO;AAClD,SAASC,IAAI,EAAkBC,IAAI,QAAwB,cAAc;AACzE,SACEC,SAAS,IAAIC,kBAAkB,EAC/BC,UAAU,IAAIC,mBAAmB,EACjCC,IAAI,EACJC,cAAc,EACdC,mBAAmB,EACnBC,eAAe,QAEV,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,eAAe;AAClC,SACEC,kBAAkB,EAClBC,sBAAsB,EACtBC,qBAAqB,EACrBC,kBAAkB,EAClBC,iBAAiB,QACZ,UAAU;;AAEjB;AACA;AACA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAOA,MAAMjB,SAAS,gBAAGH,UAAU,CAAmB,CAAC;EAAEqB,SAAS;EAAEC,QAAQ;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EAChG,MAAMC,iBAAiB,GAAGf,EAAE,CAACK,iBAAiB,CAAC,CAAC,EAAEK,SAAS,CAAC;EAE5D,oBACED,KAAA,CAAChB,kBAAkB;IACjBqB,GAAG,EAAEA,GAAI;IACTJ,SAAS,EAAEK,iBAAkB;IAC7BH,KAAK,EAAEA,KAAM;IAAA,GACTC,KAAK;IAAA,GACLf,mBAAmB,CAACe,KAAK,EAAEhB,cAAc,CAAC;MAAEmB,IAAI,EAAE;IAAQ,CAAC,CAAC,CAAC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yB,KAAK,EAAEA,KAAM;IACbC,YAAY,EAAEA,YAAa;IAC3BC,QAAQ,EAAEA,QAAS;IACnBlB,UAAU,EAAEA,UAAW;IACvBE,SAAS,EAAEA,SAAU;IACrBiB,UAAU,EAAEA,UAAW;IACvBhB,UAAU,EAAEA,UAAW;IACvBiB,IAAI,EAAEA,IAAK;IACXL,SAAS,EAAEA,SAAU;IAAA,GACjBM,SAAS;IAAA,GACT5C,mBAAmB,CAAC4C,SAAS,EAAE7C,cAAc,CAAC;MAAEmB,IAAI,EAAE;IAAc,CAAC,CAAC,CAAC;IAAAL,QAAA,EAE1EA;EAAQ,CACU,CAAC;AAE1B,CACF,CAAC;AAEDjB,UAAU,CAACwB,WAAW,GAAG,aAAa;;AAEtC;AACA;AACA;;AAQA,OAAO,MAAMyB,KAAK,GAAGC,MAAM,CAACC,MAAM,CAACrD,SAAS,EAAE;EAC5CsD,SAAS,EAAE7B,cAAc;EACzB8B,KAAK,EAAEZ,UAAU;EACjBa,KAAK,EAAEtD;AACT,CAAC,CAA2B","ignoreList":[]}
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import { KeyboardArrowDown } from '@cdx-ui/icons';
|
|
6
|
-
import {
|
|
7
|
-
import { cn,
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
|
+
import { Text } from 'react-native';
|
|
5
|
+
import { KeyboardArrowDown, KeyboardArrowUp } from '@cdx-ui/icons';
|
|
6
|
+
import { SelectContent as SelectContentPrimitive, SelectItem as SelectItemPrimitive, SelectRoot as SelectRootPrimitive, SelectTrigger as SelectTriggerPrimitive, Slot, dataAttributes, mergeDataAttributes, useSelectContext, useSelectItemContext } from '@cdx-ui/primitives';
|
|
7
|
+
import { cn, ParentContext, useParentContext, useStyleContext } from '@cdx-ui/utils';
|
|
8
8
|
import { Icon } from '../Icon';
|
|
9
|
-
import {
|
|
9
|
+
import { positionToDataIcon } from '../../utils/positionToDataIcon';
|
|
10
10
|
import { selectContentVariants, selectIconVariants, selectItemLabelVariants, selectItemVariants, selectTriggerVariants, selectValueVariants } from './styles';
|
|
11
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
const SCOPE = 'SELECT';
|
|
13
|
-
const Root = withStyleContext(View, SCOPE);
|
|
14
13
|
const useSelectStyleContext = () => useStyleContext(SCOPE);
|
|
15
|
-
const SelectPrimitive = createSelect({
|
|
16
|
-
Root,
|
|
17
|
-
Trigger: SelectTriggerHost,
|
|
18
|
-
Value: Text,
|
|
19
|
-
Icon: View,
|
|
20
|
-
Content: View,
|
|
21
|
-
Item: Pressable,
|
|
22
|
-
ItemLabel: Text
|
|
23
|
-
});
|
|
24
14
|
|
|
25
15
|
// =============================================================================
|
|
26
|
-
// STYLED ROOT
|
|
16
|
+
// STYLED ROOT
|
|
27
17
|
// =============================================================================
|
|
28
18
|
|
|
29
19
|
const SelectRoot = /*#__PURE__*/forwardRef(({
|
|
@@ -34,127 +24,188 @@ const SelectRoot = /*#__PURE__*/forwardRef(({
|
|
|
34
24
|
style,
|
|
35
25
|
...props
|
|
36
26
|
}, ref) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
context: {
|
|
27
|
+
const parent = useParentContext();
|
|
28
|
+
const ctx = useMemo(() => ({
|
|
29
|
+
...parent,
|
|
30
|
+
[SCOPE]: {
|
|
42
31
|
variant,
|
|
43
32
|
size
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
}
|
|
34
|
+
}), [parent, variant, size]);
|
|
35
|
+
return /*#__PURE__*/_jsx(ParentContext.Provider, {
|
|
36
|
+
value: ctx,
|
|
37
|
+
children: /*#__PURE__*/_jsx(SelectRootPrimitive, {
|
|
38
|
+
ref: ref,
|
|
39
|
+
className: className,
|
|
40
|
+
style: style,
|
|
41
|
+
...props,
|
|
42
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
43
|
+
slot: 'select'
|
|
44
|
+
})),
|
|
45
|
+
children: children
|
|
46
|
+
})
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
SelectRoot.displayName = 'Select';
|
|
50
50
|
|
|
51
51
|
// =============================================================================
|
|
52
|
-
// STYLED TRIGGER
|
|
52
|
+
// STYLED TRIGGER
|
|
53
53
|
// =============================================================================
|
|
54
54
|
|
|
55
55
|
const SelectTrigger = /*#__PURE__*/forwardRef(({
|
|
56
|
+
asChild,
|
|
56
57
|
className,
|
|
57
58
|
children,
|
|
58
59
|
style,
|
|
59
60
|
...props
|
|
60
61
|
}, ref) => {
|
|
62
|
+
const {
|
|
63
|
+
open
|
|
64
|
+
} = useSelectContext();
|
|
61
65
|
const {
|
|
62
66
|
variant,
|
|
63
67
|
size
|
|
64
68
|
} = useSelectStyleContext();
|
|
65
|
-
const computedClassName = cn(selectTriggerVariants({
|
|
69
|
+
const computedClassName = asChild ? className : cn(selectTriggerVariants({
|
|
66
70
|
variant,
|
|
67
71
|
size
|
|
68
72
|
}), className);
|
|
69
|
-
return /*#__PURE__*/
|
|
73
|
+
return /*#__PURE__*/_jsx(SelectTriggerPrimitive, {
|
|
70
74
|
ref: ref,
|
|
75
|
+
asChild: asChild,
|
|
71
76
|
className: computedClassName,
|
|
72
77
|
style: style,
|
|
73
78
|
...props,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
})
|
|
79
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
80
|
+
slot: 'select-trigger'
|
|
81
|
+
})),
|
|
82
|
+
children: asChild ? children : /*#__PURE__*/_jsxs(_Fragment, {
|
|
83
|
+
children: [children, /*#__PURE__*/_jsx(SelectIcon, {
|
|
84
|
+
as: open ? KeyboardArrowUp : KeyboardArrowDown
|
|
85
|
+
})]
|
|
86
|
+
})
|
|
77
87
|
});
|
|
78
88
|
});
|
|
79
89
|
SelectTrigger.displayName = 'Select.Trigger';
|
|
80
90
|
|
|
81
91
|
// =============================================================================
|
|
82
|
-
// STYLED VALUE
|
|
92
|
+
// STYLED VALUE (styled-only)
|
|
83
93
|
// =============================================================================
|
|
84
94
|
|
|
85
95
|
const SelectValue = /*#__PURE__*/forwardRef(({
|
|
96
|
+
asChild,
|
|
86
97
|
className,
|
|
87
98
|
style,
|
|
99
|
+
placeholder,
|
|
100
|
+
children,
|
|
88
101
|
...props
|
|
89
102
|
}, ref) => {
|
|
90
103
|
const {
|
|
91
104
|
size
|
|
92
105
|
} = useSelectStyleContext();
|
|
106
|
+
const {
|
|
107
|
+
value,
|
|
108
|
+
items,
|
|
109
|
+
invalid
|
|
110
|
+
} = useSelectContext();
|
|
111
|
+
const hasValue = value !== undefined && value !== '';
|
|
112
|
+
const showPlaceholder = !hasValue;
|
|
113
|
+
const displayText = hasValue ? items.find(item => item.value === value)?.label : placeholder;
|
|
93
114
|
const computedClassName = cn(selectValueVariants({
|
|
94
115
|
size
|
|
95
116
|
}), className);
|
|
96
|
-
|
|
117
|
+
const Comp = asChild ? Slot : Text;
|
|
118
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
97
119
|
ref: ref,
|
|
98
120
|
className: computedClassName,
|
|
99
121
|
style: style,
|
|
100
|
-
...props
|
|
122
|
+
...props,
|
|
123
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
124
|
+
slot: 'select-value',
|
|
125
|
+
placeholder: showPlaceholder,
|
|
126
|
+
invalid
|
|
127
|
+
})),
|
|
128
|
+
children: children ?? displayText
|
|
101
129
|
});
|
|
102
130
|
});
|
|
103
131
|
SelectValue.displayName = 'Select.Value';
|
|
104
132
|
|
|
105
133
|
// =============================================================================
|
|
106
|
-
// STYLED ICON
|
|
134
|
+
// STYLED ICON (styled-only, reads context for state=open / invalid)
|
|
107
135
|
// =============================================================================
|
|
108
136
|
|
|
109
137
|
const SelectIcon = ({
|
|
138
|
+
asChild,
|
|
110
139
|
className,
|
|
111
140
|
style,
|
|
112
|
-
as
|
|
141
|
+
as,
|
|
142
|
+
position,
|
|
113
143
|
...props
|
|
114
144
|
}) => {
|
|
115
145
|
const {
|
|
116
146
|
size
|
|
117
147
|
} = useSelectStyleContext();
|
|
148
|
+
const {
|
|
149
|
+
invalid
|
|
150
|
+
} = useSelectContext();
|
|
118
151
|
const computedClassName = cn(selectIconVariants({
|
|
119
152
|
size
|
|
120
153
|
}), className);
|
|
121
|
-
const
|
|
122
|
-
|
|
154
|
+
const slotData = mergeDataAttributes(props, dataAttributes({
|
|
155
|
+
slot: 'select-icon',
|
|
156
|
+
invalid
|
|
157
|
+
}), positionToDataIcon(position));
|
|
158
|
+
if (asChild) {
|
|
159
|
+
return /*#__PURE__*/_jsx(Slot, {
|
|
160
|
+
className: computedClassName,
|
|
161
|
+
style: style,
|
|
162
|
+
...props,
|
|
163
|
+
...slotData
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
if (!as) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
return /*#__PURE__*/_jsx(Icon, {
|
|
170
|
+
as: as,
|
|
123
171
|
className: computedClassName,
|
|
124
172
|
style: style,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
className: iconSizeClass,
|
|
128
|
-
...props
|
|
129
|
-
})
|
|
173
|
+
...props,
|
|
174
|
+
...slotData
|
|
130
175
|
});
|
|
131
176
|
};
|
|
132
177
|
SelectIcon.displayName = 'Select.Icon';
|
|
133
178
|
|
|
134
179
|
// =============================================================================
|
|
135
|
-
// STYLED CONTENT
|
|
180
|
+
// STYLED CONTENT
|
|
136
181
|
// =============================================================================
|
|
137
182
|
|
|
138
183
|
const SelectContent = /*#__PURE__*/forwardRef(({
|
|
184
|
+
asChild,
|
|
139
185
|
className,
|
|
140
186
|
style,
|
|
141
187
|
...props
|
|
142
188
|
}, ref) => {
|
|
143
189
|
const computedClassName = cn(selectContentVariants(), className);
|
|
144
|
-
return /*#__PURE__*/_jsx(
|
|
190
|
+
return /*#__PURE__*/_jsx(SelectContentPrimitive, {
|
|
145
191
|
ref: ref,
|
|
192
|
+
asChild: asChild,
|
|
146
193
|
className: computedClassName,
|
|
147
194
|
style: style,
|
|
148
|
-
...props
|
|
195
|
+
...props,
|
|
196
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
197
|
+
slot: 'select-content'
|
|
198
|
+
}))
|
|
149
199
|
});
|
|
150
200
|
});
|
|
151
201
|
SelectContent.displayName = 'Select.Content';
|
|
152
202
|
|
|
153
203
|
// =============================================================================
|
|
154
|
-
// STYLED ITEM
|
|
204
|
+
// STYLED ITEM
|
|
155
205
|
// =============================================================================
|
|
156
206
|
|
|
157
207
|
const SelectItem = /*#__PURE__*/forwardRef(({
|
|
208
|
+
asChild,
|
|
158
209
|
className,
|
|
159
210
|
children,
|
|
160
211
|
style,
|
|
@@ -166,36 +217,51 @@ const SelectItem = /*#__PURE__*/forwardRef(({
|
|
|
166
217
|
const computedClassName = cn(selectItemVariants({
|
|
167
218
|
size
|
|
168
219
|
}), className);
|
|
169
|
-
return /*#__PURE__*/_jsx(
|
|
220
|
+
return /*#__PURE__*/_jsx(SelectItemPrimitive, {
|
|
170
221
|
ref: ref,
|
|
222
|
+
asChild: asChild,
|
|
171
223
|
className: computedClassName,
|
|
172
224
|
style: style,
|
|
173
225
|
...props,
|
|
226
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
227
|
+
slot: 'select-item'
|
|
228
|
+
})),
|
|
174
229
|
children: children
|
|
175
230
|
});
|
|
176
231
|
});
|
|
177
232
|
SelectItem.displayName = 'Select.Item';
|
|
178
233
|
|
|
179
234
|
// =============================================================================
|
|
180
|
-
// STYLED ITEM LABEL
|
|
235
|
+
// STYLED ITEM LABEL (styled-only, reads item context for checked state)
|
|
181
236
|
// =============================================================================
|
|
182
237
|
|
|
183
238
|
const SelectItemLabel = /*#__PURE__*/forwardRef(({
|
|
239
|
+
asChild,
|
|
184
240
|
className,
|
|
185
241
|
style,
|
|
242
|
+
children,
|
|
186
243
|
...props
|
|
187
244
|
}, ref) => {
|
|
188
245
|
const {
|
|
189
246
|
size
|
|
190
247
|
} = useSelectStyleContext();
|
|
248
|
+
const {
|
|
249
|
+
checked
|
|
250
|
+
} = useSelectItemContext();
|
|
191
251
|
const computedClassName = cn(selectItemLabelVariants({
|
|
192
252
|
size
|
|
193
253
|
}), className);
|
|
194
|
-
|
|
254
|
+
const Comp = asChild ? Slot : Text;
|
|
255
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
195
256
|
ref: ref,
|
|
196
257
|
className: computedClassName,
|
|
197
258
|
style: style,
|
|
198
|
-
...props
|
|
259
|
+
...props,
|
|
260
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
261
|
+
slot: 'select-item-label',
|
|
262
|
+
state: checked ? 'checked' : 'unchecked'
|
|
263
|
+
})),
|
|
264
|
+
children: children
|
|
199
265
|
});
|
|
200
266
|
});
|
|
201
267
|
SelectItemLabel.displayName = 'Select.ItemLabel';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","
|
|
1
|
+
{"version":3,"names":["forwardRef","useMemo","Text","KeyboardArrowDown","KeyboardArrowUp","SelectContent","SelectContentPrimitive","SelectItem","SelectItemPrimitive","SelectRoot","SelectRootPrimitive","SelectTrigger","SelectTriggerPrimitive","Slot","dataAttributes","mergeDataAttributes","useSelectContext","useSelectItemContext","cn","ParentContext","useParentContext","useStyleContext","Icon","positionToDataIcon","selectContentVariants","selectIconVariants","selectItemLabelVariants","selectItemVariants","selectTriggerVariants","selectValueVariants","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","SCOPE","useSelectStyleContext","variant","size","className","children","style","props","ref","parent","ctx","Provider","value","slot","displayName","asChild","open","computedClassName","SelectIcon","as","SelectValue","placeholder","items","invalid","hasValue","undefined","showPlaceholder","displayText","find","item","label","Comp","position","slotData","SelectItemLabel","checked","state","Select","Object","assign","Trigger","Value","Content","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