panelui-native 0.2.0 → 0.4.0
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/README.md +251 -0
- package/lib/module/components/alert/index.js +106 -13
- package/lib/module/components/alert/index.js.map +1 -1
- package/lib/module/components/badge/index.js +3 -3
- package/lib/module/components/badge/index.js.map +1 -1
- package/lib/module/components/button/index.js +44 -15
- package/lib/module/components/button/index.js.map +1 -1
- package/lib/module/components/checkbox/index.js +20 -7
- package/lib/module/components/checkbox/index.js.map +1 -1
- package/lib/module/components/empty-state/index.js +178 -0
- package/lib/module/components/empty-state/index.js.map +1 -0
- package/lib/module/components/input-group/index.js +132 -0
- package/lib/module/components/input-group/index.js.map +1 -0
- package/lib/module/components/label/index.js +117 -0
- package/lib/module/components/label/index.js.map +1 -0
- package/lib/module/components/progress/index.js +138 -0
- package/lib/module/components/progress/index.js.map +1 -0
- package/lib/module/components/steps/index.js +354 -0
- package/lib/module/components/steps/index.js.map +1 -0
- package/lib/module/components/tabs/index.js +9 -3
- package/lib/module/components/tabs/index.js.map +1 -1
- package/lib/module/components/toast/index.js +479 -0
- package/lib/module/components/toast/index.js.map +1 -0
- package/lib/module/components/toast/toast-store.js +81 -0
- package/lib/module/components/toast/toast-store.js.map +1 -0
- package/lib/module/components/typography/index.js +126 -0
- package/lib/module/components/typography/index.js.map +1 -0
- package/lib/module/icons/index.js +223 -2
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/index.js +9 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/providers/panel-ui-provider.js +2 -1
- package/lib/module/providers/panel-ui-provider.js.map +1 -1
- package/lib/module/theme/use-theme.js +90 -3
- package/lib/module/theme/use-theme.js.map +1 -1
- package/lib/typescript/src/components/alert/index.d.ts +56 -4
- package/lib/typescript/src/components/alert/index.d.ts.map +1 -1
- package/lib/typescript/src/components/button/index.d.ts +39 -0
- package/lib/typescript/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/checkbox/index.d.ts +8 -0
- package/lib/typescript/src/components/checkbox/index.d.ts.map +1 -1
- package/lib/typescript/src/components/empty-state/index.d.ts +73 -0
- package/lib/typescript/src/components/empty-state/index.d.ts.map +1 -0
- package/lib/typescript/src/components/input-group/index.d.ts +34 -0
- package/lib/typescript/src/components/input-group/index.d.ts.map +1 -0
- package/lib/typescript/src/components/label/index.d.ts +28 -0
- package/lib/typescript/src/components/label/index.d.ts.map +1 -0
- package/lib/typescript/src/components/progress/index.d.ts +132 -0
- package/lib/typescript/src/components/progress/index.d.ts.map +1 -0
- package/lib/typescript/src/components/steps/index.d.ts +62 -0
- package/lib/typescript/src/components/steps/index.d.ts.map +1 -0
- package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/index.d.ts +176 -0
- package/lib/typescript/src/components/toast/index.d.ts.map +1 -0
- package/lib/typescript/src/components/toast/toast-store.d.ts +65 -0
- package/lib/typescript/src/components/toast/toast-store.d.ts.map +1 -0
- package/lib/typescript/src/components/typography/index.d.ts +77 -0
- package/lib/typescript/src/components/typography/index.d.ts.map +1 -0
- package/lib/typescript/src/icons/index.d.ts +25 -0
- package/lib/typescript/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +10 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/providers/panel-ui-provider.d.ts.map +1 -1
- package/lib/typescript/src/theme/use-theme.d.ts +64 -4
- package/lib/typescript/src/theme/use-theme.d.ts.map +1 -1
- package/package.json +22 -4
- package/src/components/alert/index.tsx +102 -16
- package/src/components/badge/index.tsx +3 -3
- package/src/components/button/index.tsx +47 -7
- package/src/components/checkbox/index.tsx +17 -3
- package/src/components/empty-state/index.tsx +136 -0
- package/src/components/input-group/index.tsx +164 -0
- package/src/components/label/index.tsx +128 -0
- package/src/components/progress/index.tsx +147 -0
- package/src/components/steps/index.tsx +343 -0
- package/src/components/tabs/index.tsx +10 -2
- package/src/components/toast/index.tsx +447 -0
- package/src/components/toast/toast-store.ts +120 -0
- package/src/components/typography/index.tsx +121 -0
- package/src/icons/index.tsx +152 -1
- package/src/index.ts +76 -3
- package/src/providers/panel-ui-provider.tsx +3 -0
- package/src/theme/use-theme.ts +119 -4
- package/theme.css +330 -7
|
@@ -13,7 +13,9 @@ const checkboxVariants = tv({
|
|
|
13
13
|
row: 'flex-row items-center gap-2.5',
|
|
14
14
|
box: 'h-5 w-5 items-center justify-center rounded-md border border-input bg-background',
|
|
15
15
|
fill: 'absolute inset-0 items-center justify-center rounded-md bg-primary',
|
|
16
|
-
|
|
16
|
+
content: 'flex-1 gap-0.5',
|
|
17
|
+
label: 'text-sm text-foreground',
|
|
18
|
+
description: 'text-sm text-muted-foreground'
|
|
17
19
|
},
|
|
18
20
|
variants: {
|
|
19
21
|
disabled: {
|
|
@@ -28,7 +30,8 @@ export const Checkbox = /*#__PURE__*/forwardRef(({
|
|
|
28
30
|
checked,
|
|
29
31
|
onCheckedChange,
|
|
30
32
|
disabled,
|
|
31
|
-
label
|
|
33
|
+
label,
|
|
34
|
+
description
|
|
32
35
|
}, ref) => {
|
|
33
36
|
const progress = useSharedValue(checked ? 1 : 0);
|
|
34
37
|
const slots = checkboxVariants({
|
|
@@ -58,11 +61,15 @@ export const Checkbox = /*#__PURE__*/forwardRef(({
|
|
|
58
61
|
disabled: !!disabled
|
|
59
62
|
},
|
|
60
63
|
accessibilityLabel: label,
|
|
64
|
+
accessibilityHint: description,
|
|
61
65
|
disabled: disabled,
|
|
62
66
|
onPress: () => onCheckedChange?.(!checked),
|
|
63
|
-
hitSlop: 8
|
|
67
|
+
hitSlop: 8
|
|
68
|
+
// A description makes the row two lines tall — align the box to the
|
|
69
|
+
// label rather than centring it against the whole block.
|
|
70
|
+
,
|
|
64
71
|
className: slots.row({
|
|
65
|
-
className
|
|
72
|
+
className: description ? `items-start ${className ?? ''}` : className
|
|
66
73
|
}),
|
|
67
74
|
children: [/*#__PURE__*/_jsx(View, {
|
|
68
75
|
className: slots.box(),
|
|
@@ -74,9 +81,15 @@ export const Checkbox = /*#__PURE__*/forwardRef(({
|
|
|
74
81
|
color: typeof checkColor === 'string' ? checkColor : '#fff'
|
|
75
82
|
})
|
|
76
83
|
})
|
|
77
|
-
}), label ? /*#__PURE__*/
|
|
78
|
-
className: slots.
|
|
79
|
-
children: label
|
|
84
|
+
}), label || description ? /*#__PURE__*/_jsxs(View, {
|
|
85
|
+
className: slots.content(),
|
|
86
|
+
children: [label ? /*#__PURE__*/_jsx(Text, {
|
|
87
|
+
className: slots.label(),
|
|
88
|
+
children: label
|
|
89
|
+
}) : null, description ? /*#__PURE__*/_jsx(Text, {
|
|
90
|
+
className: slots.description(),
|
|
91
|
+
children: description
|
|
92
|
+
}) : null]
|
|
80
93
|
}) : null]
|
|
81
94
|
});
|
|
82
95
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useEffect","Pressable","View","Animated","useAnimatedStyle","useSharedValue","withSpring","withTiming","tv","useCSSVariable","CheckIcon","Text","jsx","_jsx","jsxs","_jsxs","checkboxVariants","slots","row","box","fill","label","variants","disabled","true","Checkbox","className","checked","onCheckedChange","ref","progress","checkColor","value","damping","stiffness","mass","duration","fillStyle","opacity","transform","scale","accessibilityRole","accessibilityState","accessibilityLabel","onPress","hitSlop","children","style","size","color","displayName"],"sourceRoot":"../../../../src","sources":["components/checkbox/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC7C,SAASC,SAAS,EAAEC,IAAI,QAAQ,cAAc;AAC9C,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,SAAS,QAAQ,sBAAa;AACvC,SAASC,IAAI,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7C,MAAMC,gBAAgB,GAAGR,EAAE,CAAC;EAC1BS,KAAK,EAAE;IACLC,GAAG,EAAE,+BAA+B;IACpCC,GAAG,EAAE,kFAAkF;IACvFC,IAAI,EAAE,oEAAoE;IAC1EC,KAAK,EAAE;
|
|
1
|
+
{"version":3,"names":["forwardRef","useEffect","Pressable","View","Animated","useAnimatedStyle","useSharedValue","withSpring","withTiming","tv","useCSSVariable","CheckIcon","Text","jsx","_jsx","jsxs","_jsxs","checkboxVariants","slots","row","box","fill","content","label","description","variants","disabled","true","Checkbox","className","checked","onCheckedChange","ref","progress","checkColor","value","damping","stiffness","mass","duration","fillStyle","opacity","transform","scale","accessibilityRole","accessibilityState","accessibilityLabel","accessibilityHint","onPress","hitSlop","children","style","size","color","displayName"],"sourceRoot":"../../../../src","sources":["components/checkbox/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC7C,SAASC,SAAS,EAAEC,IAAI,QAAQ,cAAc;AAC9C,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,SAAS,QAAQ,sBAAa;AACvC,SAASC,IAAI,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7C,MAAMC,gBAAgB,GAAGR,EAAE,CAAC;EAC1BS,KAAK,EAAE;IACLC,GAAG,EAAE,+BAA+B;IACpCC,GAAG,EAAE,kFAAkF;IACvFC,IAAI,EAAE,oEAAoE;IAC1EC,OAAO,EAAE,gBAAgB;IACzBC,KAAK,EAAE,yBAAyB;IAChCC,WAAW,EAAE;EACf,CAAC;EACDC,QAAQ,EAAE;IACRC,QAAQ,EAAE;MACRC,IAAI,EAAE;QAAER,GAAG,EAAE;MAAa;IAC5B;EACF;A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|
5
|
+
*
|
|
6
|
+
* Adapted from: cosscom/coss packages/ui/src/components/empty.tsx
|
|
7
|
+
* (centered Header / Media / Title / Description / Content anatomy, and the
|
|
8
|
+
* `icon` media variant that stacks two rotated ghost cards behind the icon).
|
|
9
|
+
* Coss does that with CSS pseudo-elements; on native it is two absolutely
|
|
10
|
+
* positioned siblings with static rotate transforms.
|
|
11
|
+
*/
|
|
12
|
+
import { forwardRef } from 'react';
|
|
13
|
+
import { View } from 'react-native';
|
|
14
|
+
import { tv } from 'tailwind-variants';
|
|
15
|
+
import { Text } from "../../primitives/text.js";
|
|
16
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
const emptyStateVariants = tv({
|
|
18
|
+
slots: {
|
|
19
|
+
root: 'w-full flex-1 items-center justify-center gap-6 px-6 py-12',
|
|
20
|
+
header: 'w-full max-w-sm items-center gap-1',
|
|
21
|
+
title: 'text-center text-xl font-semibold text-foreground',
|
|
22
|
+
description: 'text-center text-sm text-muted-foreground',
|
|
23
|
+
content: 'w-full max-w-sm items-center gap-3'
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const mediaVariants = tv({
|
|
27
|
+
slots: {
|
|
28
|
+
wrapper: 'items-center justify-center',
|
|
29
|
+
card: 'h-9 w-9 shrink-0 items-center justify-center',
|
|
30
|
+
ghost: 'absolute h-9 w-9 rounded-md border border-border bg-card'
|
|
31
|
+
},
|
|
32
|
+
variants: {
|
|
33
|
+
variant: {
|
|
34
|
+
default: {
|
|
35
|
+
card: 'bg-transparent',
|
|
36
|
+
ghost: 'hidden'
|
|
37
|
+
},
|
|
38
|
+
icon: {
|
|
39
|
+
card: 'rounded-md border border-border bg-card'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
defaultVariants: {
|
|
44
|
+
variant: 'default'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const EmptyStateRoot = /*#__PURE__*/forwardRef(({
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}, ref) => {
|
|
51
|
+
const {
|
|
52
|
+
root
|
|
53
|
+
} = emptyStateVariants();
|
|
54
|
+
return /*#__PURE__*/_jsx(View, {
|
|
55
|
+
ref: ref,
|
|
56
|
+
className: root({
|
|
57
|
+
className
|
|
58
|
+
}),
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
EmptyStateRoot.displayName = 'EmptyState';
|
|
63
|
+
|
|
64
|
+
/** Groups Media, Title and Description into one centered column. */
|
|
65
|
+
const EmptyStateHeader = /*#__PURE__*/forwardRef(({
|
|
66
|
+
className,
|
|
67
|
+
...props
|
|
68
|
+
}, ref) => {
|
|
69
|
+
const {
|
|
70
|
+
header
|
|
71
|
+
} = emptyStateVariants();
|
|
72
|
+
return /*#__PURE__*/_jsx(View, {
|
|
73
|
+
ref: ref,
|
|
74
|
+
className: header({
|
|
75
|
+
className
|
|
76
|
+
}),
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
EmptyStateHeader.displayName = 'EmptyState.Header';
|
|
81
|
+
/**
|
|
82
|
+
* Visual anchor above the title. `variant="icon"` frames the child in a small
|
|
83
|
+
* card with two rotated ghost cards fanned out behind it.
|
|
84
|
+
*/
|
|
85
|
+
const EmptyStateMedia = /*#__PURE__*/forwardRef(({
|
|
86
|
+
className,
|
|
87
|
+
variant = 'default',
|
|
88
|
+
children,
|
|
89
|
+
...props
|
|
90
|
+
}, ref) => {
|
|
91
|
+
const {
|
|
92
|
+
wrapper,
|
|
93
|
+
card,
|
|
94
|
+
ghost
|
|
95
|
+
} = mediaVariants({
|
|
96
|
+
variant
|
|
97
|
+
});
|
|
98
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
99
|
+
ref: ref,
|
|
100
|
+
className: wrapper({
|
|
101
|
+
className: `mb-4 ${className ?? ''}`
|
|
102
|
+
}),
|
|
103
|
+
...props,
|
|
104
|
+
children: [variant === 'icon' ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
105
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
106
|
+
accessibilityElementsHidden: true,
|
|
107
|
+
importantForAccessibility: "no-hide-descendants",
|
|
108
|
+
className: `${ghost()} -translate-x-2 -rotate-[10deg] scale-90`
|
|
109
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
110
|
+
accessibilityElementsHidden: true,
|
|
111
|
+
importantForAccessibility: "no-hide-descendants",
|
|
112
|
+
className: `${ghost()} translate-x-2 rotate-[10deg] scale-90`
|
|
113
|
+
})]
|
|
114
|
+
}) : null, /*#__PURE__*/_jsx(View, {
|
|
115
|
+
className: card(),
|
|
116
|
+
children: children
|
|
117
|
+
})]
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
EmptyStateMedia.displayName = 'EmptyState.Media';
|
|
121
|
+
const EmptyStateTitle = /*#__PURE__*/forwardRef(({
|
|
122
|
+
className,
|
|
123
|
+
...props
|
|
124
|
+
}, ref) => {
|
|
125
|
+
const {
|
|
126
|
+
title
|
|
127
|
+
} = emptyStateVariants();
|
|
128
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
129
|
+
ref: ref,
|
|
130
|
+
className: title({
|
|
131
|
+
className
|
|
132
|
+
}),
|
|
133
|
+
...props
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
EmptyStateTitle.displayName = 'EmptyState.Title';
|
|
137
|
+
const EmptyStateDescription = /*#__PURE__*/forwardRef(({
|
|
138
|
+
className,
|
|
139
|
+
...props
|
|
140
|
+
}, ref) => {
|
|
141
|
+
const {
|
|
142
|
+
description
|
|
143
|
+
} = emptyStateVariants();
|
|
144
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
145
|
+
ref: ref,
|
|
146
|
+
className: description({
|
|
147
|
+
className
|
|
148
|
+
}),
|
|
149
|
+
...props
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
EmptyStateDescription.displayName = 'EmptyState.Description';
|
|
153
|
+
|
|
154
|
+
/** Slot below the header, for actions such as a primary button. */
|
|
155
|
+
const EmptyStateContent = /*#__PURE__*/forwardRef(({
|
|
156
|
+
className,
|
|
157
|
+
...props
|
|
158
|
+
}, ref) => {
|
|
159
|
+
const {
|
|
160
|
+
content
|
|
161
|
+
} = emptyStateVariants();
|
|
162
|
+
return /*#__PURE__*/_jsx(View, {
|
|
163
|
+
ref: ref,
|
|
164
|
+
className: content({
|
|
165
|
+
className
|
|
166
|
+
}),
|
|
167
|
+
...props
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
EmptyStateContent.displayName = 'EmptyState.Content';
|
|
171
|
+
export const EmptyState = Object.assign(EmptyStateRoot, {
|
|
172
|
+
Header: EmptyStateHeader,
|
|
173
|
+
Media: EmptyStateMedia,
|
|
174
|
+
Title: EmptyStateTitle,
|
|
175
|
+
Description: EmptyStateDescription,
|
|
176
|
+
Content: EmptyStateContent
|
|
177
|
+
});
|
|
178
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","View","tv","Text","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","emptyStateVariants","slots","root","header","title","description","content","mediaVariants","wrapper","card","ghost","variants","variant","default","icon","defaultVariants","EmptyStateRoot","className","props","ref","displayName","EmptyStateHeader","EmptyStateMedia","children","accessibilityElementsHidden","importantForAccessibility","EmptyStateTitle","EmptyStateDescription","EmptyStateContent","EmptyState","Object","assign","Header","Media","Title","Description","Content"],"sourceRoot":"../../../../src","sources":["components/empty-state/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAU,QAAwB,OAAO;AAClD,SAASC,IAAI,QAA6C,cAAc;AACxE,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,IAAI,QAAwB,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAA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ACX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* InputGroup — an Input with leading and/or trailing decorators.
|
|
5
|
+
*
|
|
6
|
+
* Adapted from: heroui-inc/heroui-native src/components/input-group/
|
|
7
|
+
* Prefix and Suffix are absolutely positioned and their measured widths become
|
|
8
|
+
* padding on the Input, so text never runs underneath a decorator regardless
|
|
9
|
+
* of how wide that decorator turns out to be.
|
|
10
|
+
*/
|
|
11
|
+
import { createContext, forwardRef, useCallback, useContext, useMemo, useState } from 'react';
|
|
12
|
+
import { View } from 'react-native';
|
|
13
|
+
import { tv } from 'tailwind-variants';
|
|
14
|
+
import { Input } from "../input/index.js";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
const inputGroupVariants = tv({
|
|
17
|
+
slots: {
|
|
18
|
+
root: 'w-full',
|
|
19
|
+
prefix: 'absolute bottom-0 left-0 top-0 z-10 flex-row items-center justify-center gap-2 px-3',
|
|
20
|
+
suffix: 'absolute bottom-0 right-0 top-0 z-10 flex-row items-center justify-center gap-2 px-3'
|
|
21
|
+
},
|
|
22
|
+
variants: {
|
|
23
|
+
isDisabled: {
|
|
24
|
+
true: {
|
|
25
|
+
prefix: 'opacity-[0.64]',
|
|
26
|
+
suffix: 'opacity-[0.64]'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const InputGroupContext = /*#__PURE__*/createContext(null);
|
|
32
|
+
function useInputGroup() {
|
|
33
|
+
return useContext(InputGroupContext);
|
|
34
|
+
}
|
|
35
|
+
const InputGroupRoot = /*#__PURE__*/forwardRef(({
|
|
36
|
+
className,
|
|
37
|
+
isDisabled = false,
|
|
38
|
+
children,
|
|
39
|
+
...props
|
|
40
|
+
}, ref) => {
|
|
41
|
+
const {
|
|
42
|
+
root
|
|
43
|
+
} = inputGroupVariants();
|
|
44
|
+
const [prefixWidth, setPrefixWidth] = useState(0);
|
|
45
|
+
const [suffixWidth, setSuffixWidth] = useState(0);
|
|
46
|
+
const value = useMemo(() => ({
|
|
47
|
+
isDisabled,
|
|
48
|
+
prefixWidth,
|
|
49
|
+
suffixWidth,
|
|
50
|
+
setPrefixWidth,
|
|
51
|
+
setSuffixWidth
|
|
52
|
+
}), [isDisabled, prefixWidth, suffixWidth]);
|
|
53
|
+
return /*#__PURE__*/_jsx(InputGroupContext.Provider, {
|
|
54
|
+
value: value,
|
|
55
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
56
|
+
ref: ref,
|
|
57
|
+
className: root({
|
|
58
|
+
className
|
|
59
|
+
}),
|
|
60
|
+
...props,
|
|
61
|
+
children: children
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
InputGroupRoot.displayName = 'InputGroup';
|
|
66
|
+
/** Builds Prefix/Suffix, which differ only in which side they measure. */
|
|
67
|
+
function createDecorator(side) {
|
|
68
|
+
const Decorator = /*#__PURE__*/forwardRef(({
|
|
69
|
+
className,
|
|
70
|
+
isDecorative = false,
|
|
71
|
+
onLayout,
|
|
72
|
+
children,
|
|
73
|
+
...props
|
|
74
|
+
}, ref) => {
|
|
75
|
+
const group = useInputGroup();
|
|
76
|
+
const slots = inputGroupVariants({
|
|
77
|
+
isDisabled: group?.isDisabled ?? false
|
|
78
|
+
});
|
|
79
|
+
const setWidth = side === 'prefix' ? group?.setPrefixWidth : group?.setSuffixWidth;
|
|
80
|
+
const handleLayout = useCallback(event => {
|
|
81
|
+
setWidth?.(event.nativeEvent.layout.width);
|
|
82
|
+
onLayout?.(event);
|
|
83
|
+
}, [setWidth, onLayout]);
|
|
84
|
+
return /*#__PURE__*/_jsx(View, {
|
|
85
|
+
ref: ref,
|
|
86
|
+
onLayout: handleLayout,
|
|
87
|
+
pointerEvents: isDecorative ? 'none' : 'auto',
|
|
88
|
+
accessibilityElementsHidden: isDecorative,
|
|
89
|
+
importantForAccessibility: isDecorative ? 'no-hide-descendants' : 'auto',
|
|
90
|
+
className: slots[side]({
|
|
91
|
+
className
|
|
92
|
+
}),
|
|
93
|
+
...props,
|
|
94
|
+
children: children
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
Decorator.displayName = side === 'prefix' ? 'InputGroup.Prefix' : 'InputGroup.Suffix';
|
|
98
|
+
return Decorator;
|
|
99
|
+
}
|
|
100
|
+
const InputGroupPrefix = createDecorator('prefix');
|
|
101
|
+
const InputGroupSuffix = createDecorator('suffix');
|
|
102
|
+
/**
|
|
103
|
+
* The Input itself. Receives left/right padding matching the measured
|
|
104
|
+
* decorator widths, so its text always clears them.
|
|
105
|
+
*/
|
|
106
|
+
const InputGroupInput = /*#__PURE__*/forwardRef(({
|
|
107
|
+
style,
|
|
108
|
+
disabled,
|
|
109
|
+
...props
|
|
110
|
+
}, ref) => {
|
|
111
|
+
const group = useInputGroup();
|
|
112
|
+
return /*#__PURE__*/_jsx(Input, {
|
|
113
|
+
ref: ref,
|
|
114
|
+
disabled: disabled ?? group?.isDisabled,
|
|
115
|
+
style: [
|
|
116
|
+
// Only override padding on the side that actually has a decorator —
|
|
117
|
+
// a 0 here would wipe out the field's default horizontal padding.
|
|
118
|
+
group?.prefixWidth ? {
|
|
119
|
+
paddingLeft: group.prefixWidth
|
|
120
|
+
} : null, group?.suffixWidth ? {
|
|
121
|
+
paddingRight: group.suffixWidth
|
|
122
|
+
} : null, style],
|
|
123
|
+
...props
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
InputGroupInput.displayName = 'InputGroup.Input';
|
|
127
|
+
export const InputGroup = Object.assign(InputGroupRoot, {
|
|
128
|
+
Prefix: InputGroupPrefix,
|
|
129
|
+
Input: InputGroupInput,
|
|
130
|
+
Suffix: InputGroupSuffix
|
|
131
|
+
});
|
|
132
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","forwardRef","useCallback","useContext","useMemo","useState","View","tv","Input","jsx","_jsx","inputGroupVariants","slots","root","prefix","suffix","variants","isDisabled","true","InputGroupContext","useInputGroup","InputGroupRoot","className","children","props","ref","prefixWidth","setPrefixWidth","suffixWidth","setSuffixWidth","value","Provider","displayName","createDecorator","side","Decorator","isDecorative","onLayout","group","setWidth","handleLayout","event","nativeEvent","layout","width","pointerEvents","accessibilityElementsHidden","importantForAccessibility","InputGroupPrefix","InputGroupSuffix","InputGroupInput","style","disabled","paddingLeft","paddingRight","InputGroup","Object","assign","Prefix","Suffix"],"sourceRoot":"../../../../src","sources":["components/input-group/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,aAAa,EACbC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QAEH,OAAO;AACd,SACEC,IAAI,QAIC,cAAc;AACrB,SAASC,EAAE,QAAQ,mBAAmB;AACtC,SAASC,KAAK,QAAyB,mBAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElD,MAAMC,kBAAkB,GAAGJ,EAAE,CAAC;EAC5BK,KAAK,EAAE;IACLC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE,qFAAqF;IAC7FC,MAAM,EAAE;EACV,CAAC;EACDC,QAAQ,EAAE;IACRC,UAAU,EAAE;MACVC,IAAI,EAAE;QAAEJ,MAAM,EAAE,gBAAgB;QAAEC,MAAM,EAAE;MAAiB;IAC7D;EACF;AACF,CAAC,CAAC;AAUF,MAAMI,iBAAiB,gBAAGnB,aAAa,CAAyB,IAAI,CAAC;AAErE,SAASoB,aAAaA,CAAA,EAAG;EACvB,OAAOjB,UAAU,CAACgB,iBAAiB,CAAC;AACtC;AASA,MAAME,cAAc,gBAAGpB,UAAU,CAC/B,CAAC;EAAEqB,SAAS;EAAEL,UAAU,GAAG,KAAK;EAAEM,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EAC9D,MAAM;IAAEZ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GAAG,IAAI,EAC/DuB,KAAK,CACL;IAAA,GACE3B;EAAK,CACV,CAAC;AAEN,CACF,CAAC;AACD0B,eAAe,CAAClB,WAAW,GAAG,kBAAkB;AAEhD,OAAO,MAAMuB,UAAU,GAAGC,MAAM,CAACC,MAAM,CAACpC,cAAc,EAAE;EACtDqC,MAAM,EAAEV,gBAAgB;EACxBxC,KAAK,EAAE0C,eAAe;EACtBS,MAAM,EAAEV;AACV,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Label — text that names a form field.
|
|
5
|
+
*
|
|
6
|
+
* Adapted from: heroui-inc/heroui-native src/components/label/ (root +
|
|
7
|
+
* Label.Text anatomy, string children auto-wrapping, the required asterisk,
|
|
8
|
+
* and the isInvalid / isDisabled recolouring).
|
|
9
|
+
*/
|
|
10
|
+
import { createContext, forwardRef, useContext, useMemo } from 'react';
|
|
11
|
+
import { View } from 'react-native';
|
|
12
|
+
import { tv } from 'tailwind-variants';
|
|
13
|
+
import { Text } from "../../primitives/text.js";
|
|
14
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
const labelVariants = tv({
|
|
16
|
+
slots: {
|
|
17
|
+
root: 'flex-row items-center gap-1',
|
|
18
|
+
text: 'text-sm font-medium text-foreground',
|
|
19
|
+
asterisk: 'text-sm font-medium text-destructive'
|
|
20
|
+
},
|
|
21
|
+
variants: {
|
|
22
|
+
isDisabled: {
|
|
23
|
+
true: {
|
|
24
|
+
root: 'opacity-[0.64]',
|
|
25
|
+
asterisk: 'text-muted-foreground'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
isInvalid: {
|
|
29
|
+
true: {
|
|
30
|
+
text: 'text-destructive'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const LabelContext = /*#__PURE__*/createContext({
|
|
36
|
+
isRequired: false,
|
|
37
|
+
isInvalid: false,
|
|
38
|
+
isDisabled: false
|
|
39
|
+
});
|
|
40
|
+
const LabelRoot = /*#__PURE__*/forwardRef(({
|
|
41
|
+
className,
|
|
42
|
+
isRequired = false,
|
|
43
|
+
isInvalid = false,
|
|
44
|
+
isDisabled = false,
|
|
45
|
+
children,
|
|
46
|
+
...props
|
|
47
|
+
}, ref) => {
|
|
48
|
+
const {
|
|
49
|
+
root
|
|
50
|
+
} = labelVariants({
|
|
51
|
+
isDisabled,
|
|
52
|
+
isInvalid
|
|
53
|
+
});
|
|
54
|
+
const state = useMemo(() => ({
|
|
55
|
+
isRequired,
|
|
56
|
+
isInvalid,
|
|
57
|
+
isDisabled
|
|
58
|
+
}), [isRequired, isInvalid, isDisabled]);
|
|
59
|
+
return /*#__PURE__*/_jsx(LabelContext.Provider, {
|
|
60
|
+
value: state,
|
|
61
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
62
|
+
ref: ref,
|
|
63
|
+
className: root({
|
|
64
|
+
className
|
|
65
|
+
}),
|
|
66
|
+
accessibilityState: {
|
|
67
|
+
disabled: isDisabled
|
|
68
|
+
},
|
|
69
|
+
...props,
|
|
70
|
+
children: typeof children === 'string' ? /*#__PURE__*/_jsx(LabelText, {
|
|
71
|
+
children: children
|
|
72
|
+
}) : children
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
LabelRoot.displayName = 'Label';
|
|
77
|
+
const LabelText = /*#__PURE__*/forwardRef(({
|
|
78
|
+
className,
|
|
79
|
+
asteriskClassName,
|
|
80
|
+
children,
|
|
81
|
+
...props
|
|
82
|
+
}, ref) => {
|
|
83
|
+
const {
|
|
84
|
+
isRequired,
|
|
85
|
+
isInvalid,
|
|
86
|
+
isDisabled
|
|
87
|
+
} = useContext(LabelContext);
|
|
88
|
+
const {
|
|
89
|
+
text,
|
|
90
|
+
asterisk
|
|
91
|
+
} = labelVariants({
|
|
92
|
+
isDisabled,
|
|
93
|
+
isInvalid
|
|
94
|
+
});
|
|
95
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
96
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
97
|
+
ref: ref,
|
|
98
|
+
className: text({
|
|
99
|
+
className
|
|
100
|
+
}),
|
|
101
|
+
...props,
|
|
102
|
+
children: children
|
|
103
|
+
}), isRequired ? /*#__PURE__*/_jsx(Text, {
|
|
104
|
+
accessibilityElementsHidden: true,
|
|
105
|
+
importantForAccessibility: "no-hide-descendants",
|
|
106
|
+
className: asterisk({
|
|
107
|
+
className: asteriskClassName
|
|
108
|
+
}),
|
|
109
|
+
children: "*"
|
|
110
|
+
}) : null]
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
LabelText.displayName = 'Label.Text';
|
|
114
|
+
export const Label = Object.assign(LabelRoot, {
|
|
115
|
+
Text: LabelText
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","forwardRef","useContext","useMemo","View","tv","Text","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","labelVariants","slots","root","text","asterisk","variants","isDisabled","true","isInvalid","LabelContext","isRequired","LabelRoot","className","children","props","ref","state","Provider","value","accessibilityState","disabled","LabelText","displayName","asteriskClassName","accessibilityElementsHidden","importantForAccessibility","Label","Object","assign"],"sourceRoot":"../../../../src","sources":["components/label/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,aAAa,EACbC,UAAU,EACVC,UAAU,EACVC,OAAO,QAEF,OAAO;AACd,SAASC,IAAI,QAA6C,cAAc;AACxE,SAASC,EAAE,QAAQ,mBAAmB;AACtC,SAASC,IAAI,QAAwB,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7D,MAAMC,aAAa,GAAGR,E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,SAAS;QAAAR,QAAA,EAAEA;MAAQ,CAAY,CAAC,GAAGA;IAAQ,CACxE;EAAC,CACc,CAAC;AAE5B,CACF,CAAC;AACDF,SAAS,CAACW,WAAW,GAAG,OAAO;AAQ/B,MAAMD,SAAS,gBAAGjC,UAAU,CAC1B,CAAC;EAAEwB,SAAS;EAAEW,iBAAiB;EAAEV,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EAC7D,MAAM;IAAEL,UAAU;IAAEF,SAAS;IAAEF;EAAW,CAAC,GAAGjB,UAAU,CAACoB,YAAY,CAAC;EACtE,MAAM;IAAEN,IAAI;IAAEC;EAAS,CAAC,GAAGJ,aAAa,CAAC;IAAEM,UAAU;IAAEE;EAAU,CAAC,CAAC;EAEnE,oBACET,KAAA,CAAAF,SAAA;IAAAgB,QAAA,gBACElB,IAAA,CAACF,IAAI;MAACsB,GAAG,EAAEA,GAAI;MAACH,SAAS,EAAET,IAAI,CAAC;QAAES;MAAU,CAAC,CAAE;MAAA,GAAKE,KAAK;MAAAD,QAAA,EACtDA;IAAQ,CACL,CAAC,EACNH,UAAU,gBACTf,IAAA,CAACF,IAAI;MACH+B,2BAA2B;MAC3BC,yBAAyB,EAAC,qBAAqB;MAC/Cb,SAAS,EAAER,QAAQ,CAAC;QAAEQ,SAAS,EAAEW;MAAkB,CAAC,CAAE;MAAAV,QAAA,EACvD;IAED,CAAM,CAAC,GACL,IAAI;EAAA,CACR,CAAC;AAEP,CACF,CAAC;AACDQ,SAAS,CAACC,WAAW,GAAG,YAAY;AAEpC,OAAO,MAAMI,KAAK,GAAGC,MAAM,CAACC,MAAM,CAACjB,SAAS,EAAE;EAC5ClB,IAAI,EAAE4B;AACR,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useEffect } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import Animated, { Easing, cancelAnimation, interpolate, useAnimatedStyle, useSharedValue, withRepeat, withSpring, withTiming } from 'react-native-reanimated';
|
|
6
|
+
import { tv } from 'tailwind-variants';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const SPRING = {
|
|
9
|
+
damping: 20,
|
|
10
|
+
stiffness: 180,
|
|
11
|
+
mass: 0.6
|
|
12
|
+
};
|
|
13
|
+
/** Fraction of the track covered by the sliding bar in indeterminate mode. */
|
|
14
|
+
const INDETERMINATE_WIDTH = 0.4;
|
|
15
|
+
const progressVariants = tv({
|
|
16
|
+
slots: {
|
|
17
|
+
track: 'w-full overflow-hidden rounded-full',
|
|
18
|
+
indicator: 'h-full rounded-full'
|
|
19
|
+
},
|
|
20
|
+
variants: {
|
|
21
|
+
color: {
|
|
22
|
+
primary: {
|
|
23
|
+
track: 'bg-primary/16',
|
|
24
|
+
indicator: 'bg-primary'
|
|
25
|
+
},
|
|
26
|
+
success: {
|
|
27
|
+
track: 'bg-success/16',
|
|
28
|
+
indicator: 'bg-success'
|
|
29
|
+
},
|
|
30
|
+
warning: {
|
|
31
|
+
track: 'bg-warning/16',
|
|
32
|
+
indicator: 'bg-warning'
|
|
33
|
+
},
|
|
34
|
+
destructive: {
|
|
35
|
+
track: 'bg-destructive/16',
|
|
36
|
+
indicator: 'bg-destructive'
|
|
37
|
+
},
|
|
38
|
+
info: {
|
|
39
|
+
track: 'bg-info/16',
|
|
40
|
+
indicator: 'bg-info'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
size: {
|
|
44
|
+
sm: {
|
|
45
|
+
track: 'h-1.5'
|
|
46
|
+
},
|
|
47
|
+
md: {
|
|
48
|
+
track: 'h-2'
|
|
49
|
+
},
|
|
50
|
+
lg: {
|
|
51
|
+
track: 'h-3'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
color: 'primary',
|
|
57
|
+
size: 'md'
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
function clamp(value) {
|
|
61
|
+
'worklet';
|
|
62
|
+
|
|
63
|
+
if (value < 0) return 0;
|
|
64
|
+
if (value > 100) return 100;
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Determinate or indeterminate progress bar. The fill width (determinate) and
|
|
70
|
+
* the sliding bar (indeterminate) are both driven on the UI thread, so updates
|
|
71
|
+
* never re-render past the value change itself.
|
|
72
|
+
*/
|
|
73
|
+
export const Progress = /*#__PURE__*/forwardRef(({
|
|
74
|
+
className,
|
|
75
|
+
indicatorClassName,
|
|
76
|
+
value = 0,
|
|
77
|
+
indeterminate = false,
|
|
78
|
+
color,
|
|
79
|
+
size,
|
|
80
|
+
...props
|
|
81
|
+
}, ref) => {
|
|
82
|
+
const slots = progressVariants({
|
|
83
|
+
color,
|
|
84
|
+
size
|
|
85
|
+
});
|
|
86
|
+
const trackWidth = useSharedValue(0);
|
|
87
|
+
const progress = useSharedValue(clamp(value) / 100);
|
|
88
|
+
const slide = useSharedValue(0);
|
|
89
|
+
const target = clamp(value) / 100;
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (indeterminate) {
|
|
92
|
+
slide.value = withRepeat(withTiming(1, {
|
|
93
|
+
duration: 1100,
|
|
94
|
+
easing: Easing.inOut(Easing.ease)
|
|
95
|
+
}), -1, false);
|
|
96
|
+
return () => cancelAnimation(slide);
|
|
97
|
+
}
|
|
98
|
+
progress.value = withSpring(target, SPRING);
|
|
99
|
+
return undefined;
|
|
100
|
+
}, [indeterminate, target, progress, slide]);
|
|
101
|
+
const onLayout = event => {
|
|
102
|
+
trackWidth.value = event.nativeEvent.layout.width;
|
|
103
|
+
};
|
|
104
|
+
const determinateStyle = useAnimatedStyle(() => ({
|
|
105
|
+
width: trackWidth.value * progress.value
|
|
106
|
+
}));
|
|
107
|
+
const indeterminateStyle = useAnimatedStyle(() => {
|
|
108
|
+
const barWidth = trackWidth.value * INDETERMINATE_WIDTH;
|
|
109
|
+
return {
|
|
110
|
+
width: barWidth,
|
|
111
|
+
transform: [{
|
|
112
|
+
translateX: interpolate(slide.value, [0, 1], [-barWidth, trackWidth.value])
|
|
113
|
+
}]
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
return /*#__PURE__*/_jsx(View, {
|
|
117
|
+
ref: ref,
|
|
118
|
+
accessibilityRole: "progressbar",
|
|
119
|
+
accessibilityValue: indeterminate ? undefined : {
|
|
120
|
+
min: 0,
|
|
121
|
+
max: 100,
|
|
122
|
+
now: clamp(value)
|
|
123
|
+
},
|
|
124
|
+
className: slots.track({
|
|
125
|
+
className
|
|
126
|
+
}),
|
|
127
|
+
onLayout: onLayout,
|
|
128
|
+
...props,
|
|
129
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
130
|
+
style: indeterminate ? indeterminateStyle : determinateStyle,
|
|
131
|
+
className: slots.indicator({
|
|
132
|
+
className: indicatorClassName
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
Progress.displayName = 'Progress';
|
|
138
|
+
//# sourceMappingURL=index.js.map
|