panelui-native 0.2.0 → 0.5.1
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 +258 -0
- package/lib/module/components/accordion/index.js +312 -0
- package/lib/module/components/accordion/index.js.map +1 -0
- package/lib/module/components/alert/index.js +106 -13
- package/lib/module/components/alert/index.js.map +1 -1
- package/lib/module/components/avatar/index.js +58 -17
- package/lib/module/components/avatar/index.js.map +1 -1
- package/lib/module/components/badge/index.js +29 -8
- package/lib/module/components/badge/index.js.map +1 -1
- package/lib/module/components/button/index.js +87 -26
- package/lib/module/components/button/index.js.map +1 -1
- package/lib/module/components/checkbox/index.js +59 -18
- 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/frame/index.js +64 -13
- package/lib/module/components/frame/index.js.map +1 -1
- 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/timeline/index.js +633 -0
- package/lib/module/components/timeline/index.js.map +1 -0
- package/lib/module/components/toast/index.js +569 -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 +590 -8
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/index.js +11 -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/accordion/index.d.ts +56 -0
- package/lib/typescript/src/components/accordion/index.d.ts.map +1 -0
- 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/avatar/index.d.ts +8 -1
- package/lib/typescript/src/components/avatar/index.d.ts.map +1 -1
- package/lib/typescript/src/components/badge/index.d.ts +38 -0
- package/lib/typescript/src/components/badge/index.d.ts.map +1 -1
- package/lib/typescript/src/components/button/index.d.ts +57 -0
- package/lib/typescript/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/checkbox/index.d.ts +50 -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/frame/index.d.ts +39 -5
- package/lib/typescript/src/components/frame/index.d.ts.map +1 -1
- 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/timeline/index.d.ts +96 -0
- package/lib/typescript/src/components/timeline/index.d.ts.map +1 -0
- 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 +60 -0
- package/lib/typescript/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +13 -4
- 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/accordion/index.tsx +344 -0
- package/src/components/alert/index.tsx +102 -16
- package/src/components/avatar/index.tsx +68 -20
- package/src/components/badge/index.tsx +38 -9
- package/src/components/button/index.tsx +102 -19
- package/src/components/checkbox/index.tsx +64 -12
- package/src/components/empty-state/index.tsx +136 -0
- package/src/components/frame/index.tsx +101 -31
- 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/timeline/index.tsx +456 -0
- package/src/components/toast/index.tsx +568 -0
- package/src/components/toast/toast-store.ts +120 -0
- package/src/components/typography/index.tsx +121 -0
- package/src/icons/index.tsx +423 -7
- package/src/index.ts +114 -4
- package/src/providers/panel-ui-provider.tsx +3 -0
- package/src/theme/use-theme.ts +119 -4
- package/theme.css +330 -7
|
@@ -13,14 +13,40 @@ 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: {
|
|
21
|
+
variant: {
|
|
22
|
+
default: {},
|
|
23
|
+
/**
|
|
24
|
+
* The whole surface is the target — for pickable options where the
|
|
25
|
+
* checkbox is a confirmation rather than the affordance itself.
|
|
26
|
+
*/
|
|
27
|
+
card: {
|
|
28
|
+
row: 'w-full items-start gap-3 rounded-xl border border-border bg-card p-4',
|
|
29
|
+
label: 'text-base font-medium'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
checked: {
|
|
33
|
+
true: {}
|
|
34
|
+
},
|
|
19
35
|
disabled: {
|
|
20
36
|
true: {
|
|
21
37
|
row: 'opacity-50'
|
|
22
38
|
}
|
|
23
39
|
}
|
|
40
|
+
},
|
|
41
|
+
compoundVariants: [{
|
|
42
|
+
variant: 'card',
|
|
43
|
+
checked: true,
|
|
44
|
+
class: {
|
|
45
|
+
row: 'border-primary bg-accent'
|
|
46
|
+
}
|
|
47
|
+
}],
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
variant: 'default'
|
|
24
50
|
}
|
|
25
51
|
});
|
|
26
52
|
export const Checkbox = /*#__PURE__*/forwardRef(({
|
|
@@ -28,10 +54,14 @@ export const Checkbox = /*#__PURE__*/forwardRef(({
|
|
|
28
54
|
checked,
|
|
29
55
|
onCheckedChange,
|
|
30
56
|
disabled,
|
|
31
|
-
label
|
|
57
|
+
label,
|
|
58
|
+
description,
|
|
59
|
+
variant
|
|
32
60
|
}, ref) => {
|
|
33
61
|
const progress = useSharedValue(checked ? 1 : 0);
|
|
34
62
|
const slots = checkboxVariants({
|
|
63
|
+
variant,
|
|
64
|
+
checked,
|
|
35
65
|
disabled: !!disabled
|
|
36
66
|
});
|
|
37
67
|
const checkColor = useCSSVariable('--color-primary-foreground');
|
|
@@ -50,6 +80,17 @@ export const Checkbox = /*#__PURE__*/forwardRef(({
|
|
|
50
80
|
scale: 0.6 + progress.value * 0.4
|
|
51
81
|
}]
|
|
52
82
|
}));
|
|
83
|
+
const box = /*#__PURE__*/_jsx(View, {
|
|
84
|
+
className: slots.box(),
|
|
85
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
86
|
+
style: fillStyle,
|
|
87
|
+
className: slots.fill(),
|
|
88
|
+
children: /*#__PURE__*/_jsx(CheckIcon, {
|
|
89
|
+
size: 12,
|
|
90
|
+
color: typeof checkColor === 'string' ? checkColor : '#fff'
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
});
|
|
53
94
|
return /*#__PURE__*/_jsxs(Pressable, {
|
|
54
95
|
ref: ref,
|
|
55
96
|
accessibilityRole: "checkbox",
|
|
@@ -58,26 +99,26 @@ export const Checkbox = /*#__PURE__*/forwardRef(({
|
|
|
58
99
|
disabled: !!disabled
|
|
59
100
|
},
|
|
60
101
|
accessibilityLabel: label,
|
|
102
|
+
accessibilityHint: description,
|
|
61
103
|
disabled: disabled,
|
|
62
104
|
onPress: () => onCheckedChange?.(!checked),
|
|
63
|
-
hitSlop: 8
|
|
105
|
+
hitSlop: 8
|
|
106
|
+
// A description makes the row two lines tall — align the box to the
|
|
107
|
+
// label rather than centring it against the whole block.
|
|
108
|
+
,
|
|
64
109
|
className: slots.row({
|
|
65
|
-
className
|
|
110
|
+
className: description && variant !== 'card' ? `items-start ${className ?? ''}` : className
|
|
66
111
|
}),
|
|
67
|
-
children: [/*#__PURE__*/
|
|
68
|
-
className: slots.
|
|
69
|
-
children: /*#__PURE__*/_jsx(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}), label ? /*#__PURE__*/_jsx(Text, {
|
|
78
|
-
className: slots.label(),
|
|
79
|
-
children: label
|
|
80
|
-
}) : null]
|
|
112
|
+
children: [variant === 'card' ? null : box, label || description ? /*#__PURE__*/_jsxs(View, {
|
|
113
|
+
className: slots.content(),
|
|
114
|
+
children: [label ? /*#__PURE__*/_jsx(Text, {
|
|
115
|
+
className: slots.label(),
|
|
116
|
+
children: label
|
|
117
|
+
}) : null, description ? /*#__PURE__*/_jsx(Text, {
|
|
118
|
+
className: slots.description(),
|
|
119
|
+
children: description
|
|
120
|
+
}) : null]
|
|
121
|
+
}) : null, variant === 'card' ? box : null]
|
|
81
122
|
});
|
|
82
123
|
});
|
|
83
124
|
Checkbox.displayName = 'Checkbox';
|
|
@@ -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","
|
|
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","variant","default","card","checked","true","disabled","compoundVariants","class","defaultVariants","Checkbox","className","onCheckedChange","ref","progress","checkColor","value","damping","stiffness","mass","duration","fillStyle","opacity","transform","scale","children","style","size","color","accessibilityRole","accessibilityState","accessibilityLabel","accessibilityHint","onPress","hitSlop","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,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B,OAAO,KAAK,MAAM,GAAG,IAAI,GAAGN,GAAG,EAC/BG,KAAK,IAAIC,WAAW,gBACnBR,KAAA,CAACb,IAAI;MAACiC,SAAS,EAAElB,KAAK,CAACI,OAAO,CAAC,CAAE;MAAA4B,QAAA,GAC9B3B,KAAK,gBAAGT,IAAA,CAACF,IAAI;QAACwB,SAAS,EAAElB,KAAK,CAACK,KAAK,CAAC,CAAE;QAAA2B,QAAA,EAAE3B;MAAK,CAAO,CAAC,GAAG,IAAI,EAC7DC,WAAW,gBACVV,IAAA,CAACF,IAAI;QAACwB,SAAS,EAAElB,KAAK,CAACM,WAAW,CAAC,CAAE;QAAA0B,QAAA,EAAE1B;MAAW,CAAO,CAAC,GACxD,IAAI;IAAA,CACJ,CAAC,GACL,IAAI,EACPE,OAAO,KAAK,MAAM,GAAGN,GAAG,GAAG,IAAI;EAAA,CACvB,CAAC;AAEhB,CACF,CAAC;AAEDe,QAAQ,CAACyB,WAAW,GAAG,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* EmptyState — the placeholder shown when a list or view has no content.
|
|
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,EAAAC,IAAA,IAAAC,KAAA;AAE7D,MAAMC,kBAAkB,GAAGR,EAAE,CAAC;EAC5BS,KAAK,EAAE;IACLC,IAAI,EAAE,4DAA4D;IAClEC,MAAM,EAAE,oCAAoC;IAC5CC,KAAK,EAAE,mDAAmD;IAC1DC,WAAW,EAAE,2CAA2C;IACxDC,OAAO,EAAE;EACX;AACF,CAAC,CAAC;AAEF,MAAMC,aAAa,GAAGf,EAAE,CAAC;EACvBS,KAAK,EAAE;IACLO,OAAO,EAAE,6BAA6B;IACtCC,IAAI,EAAE,8CAA8C;IACpDC,KAAK,EAAE;EACT,CAAC;EACDC,QAAQ,EAAE;IACRC,OAAO,EAAE;MACPC,OAAO,EAAE;QACPJ,IAAI,EAAE,gBAAgB;QACtBC,KAAK,EAAE;MACT,CAAC;MACD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AAI;IAACF,SAAS,EAAEZ,WAAW,CAAC;MAAEY;IAAU,CAAC,CAAE;IAAA,GAAKC;EAAK,CAAG,CAAC;AAC7E,CACF,CAAC;AACDS,qBAAqB,CAACP,WAAW,GAAG,wBAAwB;;AAE5D;AACA,MAAMQ,iBAAiB,gBAAGtC,UAAU,CAClC,CAAC;EAAE2B,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EAChC,MAAM;IAAEb;EAAQ,CAAC,GAAGN,kBAAkB,CAAC,CAAC;EACxC,oBAAOL,IAAA,CAACJ,IAAI;IAAC4B,GAAG,EAAEA,GAAI;IAACF,SAAS,EAAEX,OAAO,CAAC;MAAEW;IAAU,CAAC,CAAE;IAAA,GAAKC;EAAK,CAAG,CAAC;AACzE,CACF,CAAC;AACDU,iBAAiB,CAACR,WAAW,GAAG,oBAAoB;AAEpD,OAAO,MAAMS,UAAU,GAAGC,MAAM,CAACC,MAAM,CAACf,cAAc,EAAE;EACtDgB,MAAM,EAAEX,gBAAgB;EACxBY,KAAK,EAAEX,eAAe;EACtBY,KAAK,EAAER,eAAe;EACtBS,WAAW,EAAER,qBAAqB;EAClCS,OAAO,EAAER;AACX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,30 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Frame — a widget shell: a titled surface wrapping an inset panel of rows,
|
|
5
|
+
* with an optional action on the header row and a caption underneath.
|
|
6
|
+
*
|
|
7
|
+
* Layout follows the nested-radius rule (inner radius = outer radius minus the
|
|
8
|
+
* gap between them), which is why the panel is `rounded-xl` inside a
|
|
9
|
+
* `rounded-2xl` shell. Since v0.4.0 the radius scale is theme-scoped, so this
|
|
10
|
+
* relationship holds while the absolute values change per theme.
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Frame>
|
|
14
|
+
* <Frame.Header>
|
|
15
|
+
* <Frame.Title>Usage Type</Frame.Title>
|
|
16
|
+
* <Frame.Action>Amount</Frame.Action>
|
|
17
|
+
* </Frame.Header>
|
|
18
|
+
* <Frame.Panel>
|
|
19
|
+
* <Frame.Row>…</Frame.Row>
|
|
20
|
+
* <Frame.Row divided>…</Frame.Row>
|
|
21
|
+
* </Frame.Panel>
|
|
22
|
+
* <Frame.Footer>Updated 2 minutes ago</Frame.Footer>
|
|
23
|
+
* </Frame>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
3
26
|
import { forwardRef } from 'react';
|
|
4
27
|
import { View } from 'react-native';
|
|
5
28
|
import { Text } from "../../primitives/text.js";
|
|
6
29
|
import { cn } from "../../utils/cn.js";
|
|
7
30
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
/**
|
|
9
|
-
* Grouping container (Coss UI's CardFrame): a tinted, rounded surface that
|
|
10
|
-
* holds a header, one or more inset panels, and a footer. Use it to group
|
|
11
|
-
* related settings or list sections under a single title.
|
|
12
|
-
*/
|
|
13
31
|
const FrameRoot = /*#__PURE__*/forwardRef(({
|
|
14
32
|
className,
|
|
15
33
|
...props
|
|
16
34
|
}, ref) => /*#__PURE__*/_jsx(View, {
|
|
17
35
|
ref: ref,
|
|
18
|
-
className: cn('
|
|
36
|
+
className: cn('rounded-2xl border border-border bg-surface p-1.5', className),
|
|
19
37
|
...props
|
|
20
38
|
}));
|
|
21
39
|
FrameRoot.displayName = 'Frame';
|
|
40
|
+
/**
|
|
41
|
+
* The header row: title on the left, `Frame.Action` on the right. Add
|
|
42
|
+
* `className="flex-col items-start"` when you want a description underneath.
|
|
43
|
+
*/
|
|
22
44
|
const FrameHeader = /*#__PURE__*/forwardRef(({
|
|
23
45
|
className,
|
|
24
46
|
...props
|
|
25
47
|
}, ref) => /*#__PURE__*/_jsx(View, {
|
|
26
48
|
ref: ref,
|
|
27
|
-
className: cn('gap-
|
|
49
|
+
className: cn('flex-row items-center justify-between gap-3 px-3 pb-2.5 pt-2', className),
|
|
28
50
|
...props
|
|
29
51
|
}));
|
|
30
52
|
FrameHeader.displayName = 'Frame.Header';
|
|
@@ -34,11 +56,32 @@ const FrameTitle = /*#__PURE__*/forwardRef(({
|
|
|
34
56
|
}, ref) => /*#__PURE__*/_jsx(Text, {
|
|
35
57
|
ref: ref,
|
|
36
58
|
size: "base",
|
|
37
|
-
weight: "
|
|
59
|
+
weight: "medium",
|
|
38
60
|
className: cn('text-foreground', className),
|
|
39
61
|
...props
|
|
40
62
|
}));
|
|
41
63
|
FrameTitle.displayName = 'Frame.Title';
|
|
64
|
+
/**
|
|
65
|
+
* Trailing slot on the header row — a column label, a count, a button, a badge.
|
|
66
|
+
* Plain strings render as muted text; anything else renders as-is.
|
|
67
|
+
*/
|
|
68
|
+
const FrameAction = /*#__PURE__*/forwardRef(({
|
|
69
|
+
className,
|
|
70
|
+
children,
|
|
71
|
+
...props
|
|
72
|
+
}, ref) => /*#__PURE__*/_jsx(View, {
|
|
73
|
+
ref: ref,
|
|
74
|
+
className: cn('flex-row items-center gap-2', className),
|
|
75
|
+
...props,
|
|
76
|
+
children: typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
77
|
+
size: "base",
|
|
78
|
+
muted: true,
|
|
79
|
+
children: children
|
|
80
|
+
}) : children
|
|
81
|
+
}));
|
|
82
|
+
FrameAction.displayName = 'Frame.Action';
|
|
83
|
+
|
|
84
|
+
/** Secondary line under the title, inside a column-wrapped header. */
|
|
42
85
|
const FrameDescription = /*#__PURE__*/forwardRef(({
|
|
43
86
|
className,
|
|
44
87
|
...props
|
|
@@ -52,15 +95,15 @@ const FrameDescription = /*#__PURE__*/forwardRef(({
|
|
|
52
95
|
FrameDescription.displayName = 'Frame.Description';
|
|
53
96
|
|
|
54
97
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
98
|
+
* The inset card holding the frame's content — the raised surface sitting in
|
|
99
|
+
* from the shell's edges, with its own smaller radius.
|
|
57
100
|
*/
|
|
58
101
|
const FramePanel = /*#__PURE__*/forwardRef(({
|
|
59
102
|
className,
|
|
60
103
|
...props
|
|
61
104
|
}, ref) => /*#__PURE__*/_jsx(View, {
|
|
62
105
|
ref: ref,
|
|
63
|
-
className: cn('
|
|
106
|
+
className: cn('overflow-hidden rounded-xl border border-border bg-card', className),
|
|
64
107
|
...props
|
|
65
108
|
}));
|
|
66
109
|
FramePanel.displayName = 'Frame.Panel';
|
|
@@ -80,18 +123,26 @@ const FrameRow = /*#__PURE__*/forwardRef(({
|
|
|
80
123
|
...props
|
|
81
124
|
}));
|
|
82
125
|
FrameRow.displayName = 'Frame.Row';
|
|
126
|
+
/** Muted caption under the panel. Strings are wrapped for you. */
|
|
83
127
|
const FrameFooter = /*#__PURE__*/forwardRef(({
|
|
84
128
|
className,
|
|
129
|
+
children,
|
|
85
130
|
...props
|
|
86
131
|
}, ref) => /*#__PURE__*/_jsx(View, {
|
|
87
132
|
ref: ref,
|
|
88
|
-
className: cn('flex-row items-center gap-2 px-5
|
|
89
|
-
...props
|
|
133
|
+
className: cn('flex-row items-center gap-2 px-3 pb-1.5 pt-2.5', className),
|
|
134
|
+
...props,
|
|
135
|
+
children: typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
136
|
+
size: "sm",
|
|
137
|
+
muted: true,
|
|
138
|
+
children: children
|
|
139
|
+
}) : children
|
|
90
140
|
}));
|
|
91
141
|
FrameFooter.displayName = 'Frame.Footer';
|
|
92
142
|
export const Frame = Object.assign(FrameRoot, {
|
|
93
143
|
Header: FrameHeader,
|
|
94
144
|
Title: FrameTitle,
|
|
145
|
+
Action: FrameAction,
|
|
95
146
|
Description: FrameDescription,
|
|
96
147
|
Panel: FramePanel,
|
|
97
148
|
Row: FrameRow,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","View","Text","cn","jsx","_jsx","FrameRoot","className","props","ref","displayName","FrameHeader","FrameTitle","size","weight","
|
|
1
|
+
{"version":3,"names":["forwardRef","View","Text","cn","jsx","_jsx","FrameRoot","className","props","ref","displayName","FrameHeader","FrameTitle","size","weight","FrameAction","children","muted","FrameDescription","FramePanel","FrameRow","divided","FrameFooter","Frame","Object","assign","Header","Title","Action","Description","Panel","Row","Footer"],"sourceRoot":"../../../../src","sources":["components/frame/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAU,QAAwB,OAAO;AAClD,SAASC,IAAI,QAA6C,cAAc;AACxE,SAASC,IAAI,QAAwB,0BAAuB;AAC5D,SAASC,EAAE,QAAQ,mBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMpC,MAAMC,SAAS,gBAAGN,UAAU,CAAmB,CAAC;EAAEO,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBAC1EJ,IAAA,CAACJ,IAAI;EACHQ,GAAG,EAAEA,GAAI;EACTF,SAAS,EAAEJ,EAAE,CAAC,mDAAmD,EAAEI,SAAS,CAAE;EAAA,GAC1EC;AAAK,CACV,CACF,CAAC;AACFF,SAAS,CAACI,WAAW,GAAG,OAAO;AAM/B;AACA;AACA;AACA;AACA,MAAMC,WAAW,gBAAGX,UAAU,CAC5B,CAAC;EAAEO,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBAC3BJ,IAAA,CAACJ,IAAI;EACHQ,GAAG,EAAEA,GAAI;EACTF,SAAS,EAAEJ,EAAE,CACX,8DAA8D,EAC9DI,SACF,CAAE;EAAA,GACEC;AAAK,CACV,CAEL,CAAC;AACDG,WAAW,CAACD,WAAW,GAAG,cAAc;AAExC,MAAME,UAAU,gBAAGZ,UAAU,CAAoB,CAAC;EAAEO,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBAC5EJ,IAAA,CAACH,IAAI;EACHO,GAAG,EAAEA,GAAI;EACTI,IAAI,EAAC,MAAM;EACXC,MAAM,EAAC,QAAQ;EACfP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|
+
* 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;EAAK,CAAC,GAAGF,kBAAkB,CAAC,CAAC;EACrC,MAAM,CAACe,WAAW,EAAEC,cAAc,CAAC,GAAGtB,QAAQ,CAAC,CAAC,CAAC;EACjD,MAAM,CAACuB,WAAW,EAAEC,cAAc,CAAC,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