@kanso-labs/react-native-kanso-ui 0.10.0 → 0.11.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/dist/collection/index.js +107 -80
- package/dist/collection/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +4 -1
- package/dist/components/chip/index.js +229 -161
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +5 -5
- package/dist/components/dialog/index.js +5 -5
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/drop-zone/index.d.ts +3 -3
- package/dist/components/drop-zone/index.js +2 -2
- package/dist/components/drop-zone/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +3 -3
- package/dist/components/menu/index.js +3 -3
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +2 -2
- package/dist/components/popover/index.js +2 -2
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/search-view/index.d.ts +3 -2
- package/dist/components/search-view/index.js +3 -2
- package/dist/components/search-view/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +16 -7
- package/dist/components/sheet/index.js +157 -152
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/table/index.d.ts +391 -0
- package/dist/components/table/index.js +1708 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/token-field/index.d.ts +105 -0
- package/dist/components/token-field/index.js +574 -0
- package/dist/components/token-field/index.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +2 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/field/index.js +50 -1
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +9 -1
- package/dist/field/styles.js.map +1 -1
- package/dist/glyphs/index.js +37 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +17 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +340 -0
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/slider/index.js +1 -1
- package/dist/slider/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useTheme } from "../../theme/scope.js";
|
|
2
2
|
import { composeStyles } from "../../theme/styles.js";
|
|
3
3
|
import { usePressFeedback } from "../../press/index.js";
|
|
4
|
-
import { AnimatedPressable, toggleState, useButtonAction } from "../../button/index.js";
|
|
4
|
+
import { AnimatedPressable, toggleState, useButtonAction, useSlotTrigger } from "../../button/index.js";
|
|
5
5
|
import { shadowsOf, stylesOf } from "../../chip/styles.js";
|
|
6
6
|
import { ChipGlyph, ChipLabel, measureThen, paintOf, targetOf, useEasedColors } from "../../chip/index.js";
|
|
7
7
|
import { c } from "react/compiler-runtime";
|
|
@@ -20,13 +20,18 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
20
20
|
* `variant="assist"` and `variant="suggestion"` draw the page's two action
|
|
21
21
|
* chips instead: plain buttons, pressed with `onPress`, never selected.
|
|
22
22
|
*
|
|
23
|
+
* A chip placed directly inside `Menu`, `Popover`, `Dialog` or `Sheet` is its
|
|
24
|
+
* trigger, as a `Button` is, and a press on it opens what it is placed in.
|
|
25
|
+
*
|
|
23
26
|
* A column stretches a chip across it, as it does any view; a row of chips is
|
|
24
27
|
* a row that wraps. `style`, `ref` and `testID` land on the `Pressable`.
|
|
25
28
|
*/
|
|
26
29
|
function Chip(t0) {
|
|
27
|
-
const $ = c(
|
|
30
|
+
const $ = c(102);
|
|
31
|
+
let accessibilityHint;
|
|
28
32
|
let children;
|
|
29
33
|
let defaultSelected;
|
|
34
|
+
let delayLongPress;
|
|
30
35
|
let hitSlop;
|
|
31
36
|
let icon;
|
|
32
37
|
let isSelected;
|
|
@@ -36,56 +41,66 @@ function Chip(t0) {
|
|
|
36
41
|
let onHoverIn;
|
|
37
42
|
let onHoverOut;
|
|
38
43
|
let onLayout;
|
|
44
|
+
let onLongPress;
|
|
39
45
|
let onPress;
|
|
40
46
|
let onPressIn;
|
|
41
47
|
let onPressOut;
|
|
42
48
|
let props;
|
|
49
|
+
let ref;
|
|
43
50
|
let style;
|
|
44
51
|
let t1;
|
|
45
52
|
let t2;
|
|
46
53
|
let t3;
|
|
47
54
|
if ($[0] !== t0) {
|
|
48
|
-
({children, defaultSelected, elevated: t1, hitSlop, icon, isDisabled: t2, isSelected, onBlur, onChange, onFocus, onHoverIn, onHoverOut, onLayout, onPress, onPressIn, onPressOut, style, variant: t3, ...props} = t0);
|
|
55
|
+
({accessibilityHint, children, defaultSelected, delayLongPress, elevated: t1, hitSlop, icon, isDisabled: t2, isSelected, onBlur, onChange, onFocus, onHoverIn, onHoverOut, onLayout, onLongPress, onPress, onPressIn, onPressOut, ref, style, variant: t3, ...props} = t0);
|
|
49
56
|
$[0] = t0;
|
|
50
|
-
$[1] =
|
|
51
|
-
$[2] =
|
|
52
|
-
$[3] =
|
|
53
|
-
$[4] =
|
|
54
|
-
$[5] =
|
|
55
|
-
$[6] =
|
|
56
|
-
$[7] =
|
|
57
|
-
$[8] =
|
|
58
|
-
$[9] =
|
|
59
|
-
$[10] =
|
|
60
|
-
$[11] =
|
|
61
|
-
$[12] =
|
|
62
|
-
$[13] =
|
|
63
|
-
$[14] =
|
|
64
|
-
$[15] =
|
|
65
|
-
$[16] =
|
|
66
|
-
$[17] =
|
|
67
|
-
$[18] =
|
|
68
|
-
$[19] =
|
|
57
|
+
$[1] = accessibilityHint;
|
|
58
|
+
$[2] = children;
|
|
59
|
+
$[3] = defaultSelected;
|
|
60
|
+
$[4] = delayLongPress;
|
|
61
|
+
$[5] = hitSlop;
|
|
62
|
+
$[6] = icon;
|
|
63
|
+
$[7] = isSelected;
|
|
64
|
+
$[8] = onBlur;
|
|
65
|
+
$[9] = onChange;
|
|
66
|
+
$[10] = onFocus;
|
|
67
|
+
$[11] = onHoverIn;
|
|
68
|
+
$[12] = onHoverOut;
|
|
69
|
+
$[13] = onLayout;
|
|
70
|
+
$[14] = onLongPress;
|
|
71
|
+
$[15] = onPress;
|
|
72
|
+
$[16] = onPressIn;
|
|
73
|
+
$[17] = onPressOut;
|
|
74
|
+
$[18] = props;
|
|
75
|
+
$[19] = ref;
|
|
76
|
+
$[20] = style;
|
|
77
|
+
$[21] = t1;
|
|
78
|
+
$[22] = t2;
|
|
79
|
+
$[23] = t3;
|
|
69
80
|
} else {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
accessibilityHint = $[1];
|
|
82
|
+
children = $[2];
|
|
83
|
+
defaultSelected = $[3];
|
|
84
|
+
delayLongPress = $[4];
|
|
85
|
+
hitSlop = $[5];
|
|
86
|
+
icon = $[6];
|
|
87
|
+
isSelected = $[7];
|
|
88
|
+
onBlur = $[8];
|
|
89
|
+
onChange = $[9];
|
|
90
|
+
onFocus = $[10];
|
|
91
|
+
onHoverIn = $[11];
|
|
92
|
+
onHoverOut = $[12];
|
|
93
|
+
onLayout = $[13];
|
|
94
|
+
onLongPress = $[14];
|
|
95
|
+
onPress = $[15];
|
|
96
|
+
onPressIn = $[16];
|
|
97
|
+
onPressOut = $[17];
|
|
98
|
+
props = $[18];
|
|
99
|
+
ref = $[19];
|
|
100
|
+
style = $[20];
|
|
101
|
+
t1 = $[21];
|
|
102
|
+
t2 = $[22];
|
|
103
|
+
t3 = $[23];
|
|
89
104
|
}
|
|
90
105
|
const elevated = t1 === void 0 ? false : t1;
|
|
91
106
|
const isDisabled = t2 === void 0 ? false : t2;
|
|
@@ -94,7 +109,7 @@ function Chip(t0) {
|
|
|
94
109
|
const [width, setWidth] = useState(48);
|
|
95
110
|
const isToggle = variant === "filter";
|
|
96
111
|
let t4;
|
|
97
|
-
if ($[
|
|
112
|
+
if ($[24] !== defaultSelected || $[25] !== isSelected || $[26] !== isToggle || $[27] !== onChange || $[28] !== onPress) {
|
|
98
113
|
t4 = {
|
|
99
114
|
defaultSelected,
|
|
100
115
|
href: void 0,
|
|
@@ -102,154 +117,207 @@ function Chip(t0) {
|
|
|
102
117
|
isToggle,
|
|
103
118
|
onChange,
|
|
104
119
|
onPress,
|
|
120
|
+
slot: "default",
|
|
105
121
|
type: void 0
|
|
106
122
|
};
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
} else t4 = $[
|
|
123
|
+
$[24] = defaultSelected;
|
|
124
|
+
$[25] = isSelected;
|
|
125
|
+
$[26] = isToggle;
|
|
126
|
+
$[27] = onChange;
|
|
127
|
+
$[28] = onPress;
|
|
128
|
+
$[29] = t4;
|
|
129
|
+
} else t4 = $[29];
|
|
114
130
|
const action = useButtonAction(t4);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
131
|
+
let t5;
|
|
132
|
+
if ($[30] !== accessibilityHint || $[31] !== delayLongPress || $[32] !== onHoverIn || $[33] !== onHoverOut || $[34] !== onLongPress || $[35] !== onPressIn || $[36] !== onPressOut || $[37] !== ref) {
|
|
133
|
+
t5 = {
|
|
134
|
+
accessibilityHint,
|
|
135
|
+
delayLongPress,
|
|
136
|
+
href: void 0,
|
|
137
|
+
onHoverIn,
|
|
138
|
+
onHoverOut,
|
|
139
|
+
onLongPress,
|
|
140
|
+
onPressIn,
|
|
141
|
+
onPressOut,
|
|
142
|
+
ref,
|
|
143
|
+
slot: void 0
|
|
144
|
+
};
|
|
145
|
+
$[30] = accessibilityHint;
|
|
146
|
+
$[31] = delayLongPress;
|
|
147
|
+
$[32] = onHoverIn;
|
|
148
|
+
$[33] = onHoverOut;
|
|
149
|
+
$[34] = onLongPress;
|
|
150
|
+
$[35] = onPressIn;
|
|
151
|
+
$[36] = onPressOut;
|
|
152
|
+
$[37] = ref;
|
|
153
|
+
$[38] = t5;
|
|
154
|
+
} else t5 = $[38];
|
|
155
|
+
const t6 = useSlotTrigger(t5);
|
|
156
|
+
let hoverIn;
|
|
157
|
+
let hoverOut;
|
|
158
|
+
let longPress;
|
|
159
|
+
let pressIn;
|
|
160
|
+
let pressOut;
|
|
161
|
+
let triggerProps;
|
|
162
|
+
if ($[39] !== t6) {
|
|
163
|
+
({onHoverIn: hoverIn, onHoverOut: hoverOut, onLongPress: longPress, onPressIn: pressIn, onPressOut: pressOut, ...triggerProps} = t6);
|
|
164
|
+
$[39] = t6;
|
|
165
|
+
$[40] = hoverIn;
|
|
166
|
+
$[41] = hoverOut;
|
|
167
|
+
$[42] = longPress;
|
|
168
|
+
$[43] = pressIn;
|
|
169
|
+
$[44] = pressOut;
|
|
170
|
+
$[45] = triggerProps;
|
|
171
|
+
} else {
|
|
172
|
+
hoverIn = $[40];
|
|
173
|
+
hoverOut = $[41];
|
|
174
|
+
longPress = $[42];
|
|
175
|
+
pressIn = $[43];
|
|
176
|
+
pressOut = $[44];
|
|
177
|
+
triggerProps = $[45];
|
|
178
|
+
}
|
|
179
|
+
const t7 = variant === "assist";
|
|
180
|
+
let t8;
|
|
181
|
+
if ($[46] !== action.selected || $[47] !== elevated || $[48] !== isDisabled || $[49] !== t7 || $[50] !== theme) {
|
|
182
|
+
t8 = paintOf(theme, {
|
|
183
|
+
assist: t7,
|
|
120
184
|
disabled: isDisabled,
|
|
121
185
|
elevated,
|
|
122
186
|
selected: action.selected
|
|
123
187
|
});
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
} else
|
|
131
|
-
const paint =
|
|
188
|
+
$[46] = action.selected;
|
|
189
|
+
$[47] = elevated;
|
|
190
|
+
$[48] = isDisabled;
|
|
191
|
+
$[49] = t7;
|
|
192
|
+
$[50] = theme;
|
|
193
|
+
$[51] = t8;
|
|
194
|
+
} else t8 = $[51];
|
|
195
|
+
const paint = t8;
|
|
132
196
|
const eased = useEasedColors(paint);
|
|
133
|
-
let
|
|
134
|
-
if ($[
|
|
135
|
-
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
} else
|
|
139
|
-
let
|
|
140
|
-
if ($[
|
|
141
|
-
|
|
197
|
+
let t9;
|
|
198
|
+
if ($[52] !== theme.radii.sm) {
|
|
199
|
+
t9 = { borderRadius: theme.radii.sm };
|
|
200
|
+
$[52] = theme.radii.sm;
|
|
201
|
+
$[53] = t9;
|
|
202
|
+
} else t9 = $[53];
|
|
203
|
+
let t10;
|
|
204
|
+
if ($[54] !== hoverIn || $[55] !== hoverOut || $[56] !== isDisabled || $[57] !== onBlur || $[58] !== onFocus || $[59] !== paint.layer || $[60] !== pressIn || $[61] !== pressOut || $[62] !== t9) {
|
|
205
|
+
t10 = {
|
|
142
206
|
color: paint.layer,
|
|
143
|
-
corners:
|
|
207
|
+
corners: t9,
|
|
144
208
|
disabled: isDisabled,
|
|
145
209
|
onBlur,
|
|
146
210
|
onFocus,
|
|
147
|
-
onHoverIn,
|
|
148
|
-
onHoverOut,
|
|
149
|
-
onPressIn,
|
|
150
|
-
onPressOut
|
|
211
|
+
onHoverIn: hoverIn,
|
|
212
|
+
onHoverOut: hoverOut,
|
|
213
|
+
onPressIn: pressIn,
|
|
214
|
+
onPressOut: pressOut
|
|
151
215
|
};
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
} else
|
|
163
|
-
const feedback = usePressFeedback(
|
|
164
|
-
let t9;
|
|
165
|
-
if ($[44] !== action.selected || $[45] !== isToggle) {
|
|
166
|
-
t9 = isToggle ? toggleState(action.selected) : void 0;
|
|
167
|
-
$[44] = action.selected;
|
|
168
|
-
$[45] = isToggle;
|
|
169
|
-
$[46] = t9;
|
|
170
|
-
} else t9 = $[46];
|
|
171
|
-
const t10 = feedback.handlers;
|
|
216
|
+
$[54] = hoverIn;
|
|
217
|
+
$[55] = hoverOut;
|
|
218
|
+
$[56] = isDisabled;
|
|
219
|
+
$[57] = onBlur;
|
|
220
|
+
$[58] = onFocus;
|
|
221
|
+
$[59] = paint.layer;
|
|
222
|
+
$[60] = pressIn;
|
|
223
|
+
$[61] = pressOut;
|
|
224
|
+
$[62] = t9;
|
|
225
|
+
$[63] = t10;
|
|
226
|
+
} else t10 = $[63];
|
|
227
|
+
const feedback = usePressFeedback(t10);
|
|
172
228
|
let t11;
|
|
173
|
-
if ($[
|
|
174
|
-
t11 =
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
let
|
|
181
|
-
if ($[
|
|
182
|
-
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
|
|
186
|
-
|
|
229
|
+
if ($[64] !== action.selected || $[65] !== isToggle) {
|
|
230
|
+
t11 = isToggle ? toggleState(action.selected) : void 0;
|
|
231
|
+
$[64] = action.selected;
|
|
232
|
+
$[65] = isToggle;
|
|
233
|
+
$[66] = t11;
|
|
234
|
+
} else t11 = $[66];
|
|
235
|
+
const t12 = feedback.handlers;
|
|
236
|
+
let t13;
|
|
237
|
+
if ($[67] !== hitSlop || $[68] !== theme || $[69] !== width) {
|
|
238
|
+
t13 = hitSlop ?? targetOf(width, theme);
|
|
239
|
+
$[67] = hitSlop;
|
|
240
|
+
$[68] = theme;
|
|
241
|
+
$[69] = width;
|
|
242
|
+
$[70] = t13;
|
|
243
|
+
} else t13 = $[70];
|
|
187
244
|
let t14;
|
|
188
|
-
if ($[
|
|
189
|
-
t14 =
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
$[
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
245
|
+
if ($[71] !== onLayout) {
|
|
246
|
+
t14 = measureThen(setWidth, onLayout);
|
|
247
|
+
$[71] = onLayout;
|
|
248
|
+
$[72] = t14;
|
|
249
|
+
} else t14 = $[72];
|
|
250
|
+
const t15 = action.onPress;
|
|
251
|
+
let t16;
|
|
252
|
+
if ($[73] !== eased.container || $[74] !== elevated || $[75] !== feedback.hovered || $[76] !== feedback.ring || $[77] !== isDisabled || $[78] !== style || $[79] !== theme) {
|
|
253
|
+
t16 = composeStyles(stylesOf(theme).pill, eased.container, elevated && !isDisabled ? shadowsOf(theme)[feedback.hovered ? "elevation2" : "elevation1"] : void 0, feedback.ring, style);
|
|
254
|
+
$[73] = eased.container;
|
|
255
|
+
$[74] = elevated;
|
|
256
|
+
$[75] = feedback.hovered;
|
|
257
|
+
$[76] = feedback.ring;
|
|
258
|
+
$[77] = isDisabled;
|
|
259
|
+
$[78] = style;
|
|
260
|
+
$[79] = theme;
|
|
261
|
+
$[80] = t16;
|
|
262
|
+
} else t16 = $[80];
|
|
263
|
+
let t17;
|
|
264
|
+
if ($[81] !== action.selected || $[82] !== icon || $[83] !== paint.glyph) {
|
|
265
|
+
t17 = /* @__PURE__ */ jsx(ChipGlyph, {
|
|
202
266
|
color: paint.glyph,
|
|
203
267
|
icon,
|
|
204
268
|
selected: action.selected
|
|
205
269
|
});
|
|
206
|
-
$[
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
209
|
-
$[
|
|
210
|
-
} else
|
|
211
|
-
let
|
|
212
|
-
if ($[
|
|
213
|
-
|
|
270
|
+
$[81] = action.selected;
|
|
271
|
+
$[82] = icon;
|
|
272
|
+
$[83] = paint.glyph;
|
|
273
|
+
$[84] = t17;
|
|
274
|
+
} else t17 = $[84];
|
|
275
|
+
let t18;
|
|
276
|
+
if ($[85] !== children || $[86] !== eased.label) {
|
|
277
|
+
t18 = /* @__PURE__ */ jsx(ChipLabel, {
|
|
214
278
|
color: eased.label,
|
|
215
279
|
children
|
|
216
280
|
});
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
$[
|
|
220
|
-
} else
|
|
221
|
-
let
|
|
222
|
-
if ($[
|
|
223
|
-
|
|
281
|
+
$[85] = children;
|
|
282
|
+
$[86] = eased.label;
|
|
283
|
+
$[87] = t18;
|
|
284
|
+
} else t18 = $[87];
|
|
285
|
+
let t19;
|
|
286
|
+
if ($[88] !== action.onPress || $[89] !== feedback.handlers || $[90] !== feedback.layer || $[91] !== isDisabled || $[92] !== longPress || $[93] !== props || $[94] !== t11 || $[95] !== t13 || $[96] !== t14 || $[97] !== t16 || $[98] !== t17 || $[99] !== t18 || $[100] !== triggerProps) {
|
|
287
|
+
t19 = /* @__PURE__ */ jsxs(AnimatedPressable, {
|
|
224
288
|
role: "button",
|
|
225
|
-
...
|
|
289
|
+
...t11,
|
|
226
290
|
...props,
|
|
227
|
-
...
|
|
291
|
+
...triggerProps,
|
|
292
|
+
...t12,
|
|
228
293
|
disabled: isDisabled,
|
|
229
|
-
hitSlop:
|
|
230
|
-
onLayout:
|
|
231
|
-
|
|
232
|
-
|
|
294
|
+
hitSlop: t13,
|
|
295
|
+
onLayout: t14,
|
|
296
|
+
onLongPress: longPress,
|
|
297
|
+
onPress: t15,
|
|
298
|
+
style: t16,
|
|
233
299
|
children: [
|
|
234
300
|
feedback.layer,
|
|
235
|
-
|
|
236
|
-
|
|
301
|
+
t17,
|
|
302
|
+
t18
|
|
237
303
|
]
|
|
238
304
|
});
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
|
|
252
|
-
|
|
305
|
+
$[88] = action.onPress;
|
|
306
|
+
$[89] = feedback.handlers;
|
|
307
|
+
$[90] = feedback.layer;
|
|
308
|
+
$[91] = isDisabled;
|
|
309
|
+
$[92] = longPress;
|
|
310
|
+
$[93] = props;
|
|
311
|
+
$[94] = t11;
|
|
312
|
+
$[95] = t13;
|
|
313
|
+
$[96] = t14;
|
|
314
|
+
$[97] = t16;
|
|
315
|
+
$[98] = t17;
|
|
316
|
+
$[99] = t18;
|
|
317
|
+
$[100] = triggerProps;
|
|
318
|
+
$[101] = t19;
|
|
319
|
+
} else t19 = $[101];
|
|
320
|
+
return t19;
|
|
253
321
|
}
|
|
254
322
|
//#endregion
|
|
255
323
|
export { Chip };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","PressableProps","StyleProp","View","ViewStyle","AnimatedStyle","useState","AnimatedPressable","toggleState","useButtonAction","ChipGlyph","ChipLabel","measureThen","paintOf","targetOf","useEasedColors","shadowsOf","stylesOf","TARGET_SIZE","usePressFeedback","useTheme","composeStyles","ChipActionProps","ChipBaseProps","defaultSelected","isSelected","onChange","variant","Omit","children","elevated","icon","isDisabled","ref","style","ChipFilterProps","ChipProps","ChipVariant","Chip","t0","$","_c","hitSlop","onBlur","onFocus","onHoverIn","onHoverOut","onLayout","onPress","onPressIn","onPressOut","props","t1","t2","t3","undefined","theme","width","setWidth","isToggle","t4","href","type","action","t5","t6","selected","assist","disabled","paint","eased","t7","radii","sm","borderRadius","t8","layer","color","corners","feedback","t9","t10","handlers","t11","t12","t13","t14","container","hovered","ring","pill","t15","glyph","t16","label","t17","_c"],"sources":["../../../src/components/chip/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { PressableProps, StyleProp, View, ViewStyle } from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\n\nimport { useState } from 'react'\n\nimport { AnimatedPressable, toggleState, useButtonAction } from '../../button'\nimport {\n ChipGlyph,\n ChipLabel,\n measureThen,\n paintOf,\n targetOf,\n useEasedColors,\n} from '../../chip'\nimport { shadowsOf, stylesOf } from '../../chip/styles'\nimport { TARGET_SIZE, usePressFeedback } from '../../press'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles } from '../../theme/styles'\n\n// Three of the chips page's four chips, as kanso-ui's Chip draws them. The\n// pill is src/chip's, shared with ChipGroup's chip as on web, which sets out\n// its measurements, colours, motion and target. `variant` picks the chip:\n//\n// - **A filter chip**, the default, is a toggle that reports its state as a\n// toggle Button does, and takes the secondary container pair and the check\n// once selected.\n// - **An assist or suggestion chip** is an action, so nothing is reported as\n// selected and nothing ever is. The two differ in the label alone: on\n// surface on an assist chip, on surface variant on a suggestion chip as on\n// a filter one.\n\n/** An assist or suggestion chip: an action, drawn as a plain button. */\ntype ChipActionProps = ChipBaseProps & {\n readonly defaultSelected?: never\n readonly isSelected?: never\n readonly onChange?: never\n /**\n * `assist` for an action the chip's context suggests, and `suggestion`\n * for one the product generates. Either is an action rather than a\n * selection, so neither is ever selected.\n */\n readonly variant: 'assist' | 'suggestion'\n}\n\ntype ChipBaseProps = Omit<PressableProps, 'children' | 'disabled' | 'style'> & {\n /**\n * The chip's label. Required: the page draws no chip without one, and a\n * chip with none is an empty button to a screen reader.\n */\n readonly children: ReactNode\n /**\n * Raises the chip off the page on a container of its own, at the page's\n * elevation 1, in place of the outline. A selected filter chip keeps the\n * secondary container.\n * @default false\n */\n readonly elevated?: boolean\n /**\n * An icon before the label, in the page's 18dp slot and the primary role,\n * which the slot hands it through `useIconStyle()`. A filter chip's check\n * takes its place while the chip is selected, so the chip keeps its width.\n */\n readonly icon?: ReactNode\n /**\n * Draws the chip disabled, and takes no presses.\n * @default false\n */\n readonly isDisabled?: boolean\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n}\n\n/** A filter chip: a two-state button, the default. */\ntype ChipFilterProps = ChipBaseProps & {\n /**\n * Whether the chip starts selected, when it keeps its own state.\n * @default false\n */\n readonly defaultSelected?: boolean\n /**\n * Whether the chip is selected, when the call site holds the state. Pass\n * it with `onChange`.\n */\n readonly isSelected?: boolean\n /** Called with the new state when the chip is pressed, after `onPress`. */\n readonly onChange?: (isSelected: boolean) => void\n /**\n * A filter chip, a two-state button.\n * @default 'filter'\n */\n readonly variant?: 'filter'\n}\n\ntype ChipProps = ChipActionProps | ChipFilterProps\n\n/** Which of the chips page's chips a Chip is. */\ntype ChipVariant = 'assist' | 'filter' | 'suggestion'\n\n/**\n * A chip. By default a filter chip, which is a two-state button reporting\n * its state as a toggle Button does: pass `isSelected` with `onChange` to\n * control it, or `defaultSelected` to let it keep its own state.\n *\n * ```tsx\n * <Chip defaultSelected>Label</Chip>\n * ```\n *\n * `variant=\"assist\"` and `variant=\"suggestion\"` draw the page's two action\n * chips instead: plain buttons, pressed with `onPress`, never selected.\n *\n * A column stretches a chip across it, as it does any view; a row of chips is\n * a row that wraps. `style`, `ref` and `testID` land on the `Pressable`.\n */\nfunction Chip({\n children,\n defaultSelected,\n elevated = false,\n hitSlop,\n icon,\n isDisabled = false,\n isSelected,\n onBlur,\n onChange,\n onFocus,\n onHoverIn,\n onHoverOut,\n onLayout,\n onPress,\n onPressIn,\n onPressOut,\n style,\n variant = 'filter',\n ...props\n}: ChipProps) {\n const theme = useTheme()\n // Until the chip is measured it takes no reach across, rather than one\n // sized for a chip of no width.\n const [width, setWidth] = useState(TARGET_SIZE)\n\n const isToggle = variant === 'filter'\n const action = useButtonAction({\n defaultSelected,\n href: undefined,\n isSelected,\n isToggle,\n onChange,\n onPress,\n type: undefined,\n })\n const paint = paintOf(theme, {\n assist: variant === 'assist',\n disabled: isDisabled,\n elevated,\n selected: action.selected,\n })\n const eased = useEasedColors(paint)\n\n const feedback = usePressFeedback({\n color: paint.layer,\n corners: { borderRadius: theme.radii.sm },\n disabled: isDisabled,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onPressIn,\n onPressOut,\n })\n\n return (\n <AnimatedPressable\n role=\"button\"\n {...(isToggle ? toggleState(action.selected) : undefined)}\n {...props}\n {...feedback.handlers}\n disabled={isDisabled}\n hitSlop={hitSlop ?? targetOf(width, theme)}\n onLayout={measureThen(setWidth, onLayout)}\n onPress={action.onPress}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n stylesOf(theme).pill,\n eased.container,\n elevated && !isDisabled\n ? shadowsOf(theme)[feedback.hovered ? 'elevation2' : 'elevation1']\n : undefined,\n feedback.ring,\n style,\n )}\n >\n {feedback.layer}\n <ChipGlyph color={paint.glyph} icon={icon} selected={action.selected} />\n <ChipLabel color={eased.label}>{children}</ChipLabel>\n </AnimatedPressable>\n )\n}\n\nexport { Chip }\nexport type { ChipActionProps, ChipFilterProps, ChipProps, ChipVariant }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkHA,SAAAwC,KAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAZ;CAAA,IAAAL;CAAA,IAAAkB;CAAA,IAAAX;CAAA,IAAAN;CAAA,IAAAkB;CAAA,IAAAjB;CAAA,IAAAkB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAjB;CAAA,IAAAkB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAd,EAAA,OAAAD,IAAA;EAAc,CAAA,CAAAV,UAAAL,iBAAAM,UAAAsB,IAAAV,SAAAX,MAAAC,YAAAqB,IAAA5B,YAAAkB,QAAAjB,UAAAkB,SAAAC,WAAAC,YAAAC,UAAAC,SAAAC,WAAAC,YAAAhB,OAAAP,SAAA2B,IAAA,GAAAH,SAAAZ;EAoBFC,EAAA,KAAAD;EAAAC,EAAA,KAAAX;EAAAW,EAAA,KAAAhB;EAAAgB,EAAA,KAAAE;EAAAF,EAAA,KAAAT;EAAAS,EAAA,KAAAf;EAAAe,EAAA,KAAAG;EAAAH,EAAA,KAAAd;EAAAc,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;E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GACL8B;GACMjD,UAAAA;GACD,SAAAmD;GACC,UAAAC;GACD,SAAAC;GACF,OAAAC;GATT,UAAA;IAmBGP,SAAQH;IACTe;IACAE;GArBgB;;EAsBErD,EAAA,MAAAuB,OAAAf;EAAAR,EAAA,MAAAuC,SAAAG;EAAA1C,EAAA,MAAAuC,SAAAH;EAAApC,EAAA,MAAAR;EAAAQ,EAAA,MAAAW;EAAAX,EAAA,MAAA2C;EAAA3C,EAAA,MAAA4C;EAAA5C,EAAA,MAAA8C;EAAA9C,EAAA,MAAAmD;EAAAnD,EAAA,MAAAqD;EAAArD,EAAA,MAAAwC;EAAAxC,EAAA,MAAAuD;CAAA,OAAAA,MAAAvD,EAAA;CAAA,OAtBpBuD;AAsBoB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","PressableProps","StyleProp","View","ViewStyle","AnimatedStyle","useState","AnimatedPressable","toggleState","useButtonAction","useSlotTrigger","ChipGlyph","ChipLabel","measureThen","paintOf","targetOf","useEasedColors","shadowsOf","stylesOf","TARGET_SIZE","usePressFeedback","useTheme","composeStyles","ChipActionProps","ChipBaseProps","defaultSelected","isSelected","onChange","variant","Omit","children","elevated","icon","isDisabled","ref","style","ChipFilterProps","ChipProps","ChipVariant","Chip","t0","$","_c","accessibilityHint","delayLongPress","hitSlop","onBlur","onFocus","onHoverIn","onHoverOut","onLayout","onLongPress","onPress","onPressIn","onPressOut","props","t1","t2","t3","undefined","theme","width","setWidth","isToggle","t4","href","slot","type","action","t5","t6","hoverIn","hoverOut","longPress","pressIn","pressOut","triggerProps","t7","t8","selected","assist","disabled","paint","eased","t9","radii","sm","borderRadius","t10","layer","color","corners","feedback","t11","t12","handlers","t13","t14","t15","t16","container","hovered","ring","pill","t17","glyph","t18","label","t19","_c"],"sources":["../../../src/components/chip/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { PressableProps, StyleProp, View, ViewStyle } from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\n\nimport { useState } from 'react'\n\nimport {\n AnimatedPressable,\n toggleState,\n useButtonAction,\n useSlotTrigger,\n} from '../../button'\nimport {\n ChipGlyph,\n ChipLabel,\n measureThen,\n paintOf,\n targetOf,\n useEasedColors,\n} from '../../chip'\nimport { shadowsOf, stylesOf } from '../../chip/styles'\nimport { TARGET_SIZE, usePressFeedback } from '../../press'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles } from '../../theme/styles'\n\n// Three of the chips page's four chips, as kanso-ui's Chip draws them. The\n// pill is src/chip's, shared with ChipGroup's chip as on web, which sets out\n// its measurements, colours, motion and target. `variant` picks the chip:\n//\n// - **A filter chip**, the default, is a toggle that reports its state as a\n// toggle Button does, and takes the secondary container pair and the check\n// once selected.\n// - **An assist or suggestion chip** is an action, so nothing is reported as\n// selected and nothing ever is. The two differ in the label alone: on\n// surface on an assist chip, on surface variant on a suggestion chip as on\n// a filter one.\n//\n// **A chip placed directly inside an overlay is its trigger**, as a Button\n// is, and as any React Aria pressable is on web: it fills the default slot\n// src/button's slots.ts sets out, so a press inside `Menu`, `Popover`,\n// `Dialog` or `Sheet` opens it, a menu's `trigger=\"longPress\"` opens from a\n// held press, the chip says whether what it opens is open, and an anchored\n// overlay is placed against it. A filter chip there still changes its state\n// with each press, as web's toggle does.\n\n/** An assist or suggestion chip: an action, drawn as a plain button. */\ntype ChipActionProps = ChipBaseProps & {\n readonly defaultSelected?: never\n readonly isSelected?: never\n readonly onChange?: never\n /**\n * `assist` for an action the chip's context suggests, and `suggestion`\n * for one the product generates. Either is an action rather than a\n * selection, so neither is ever selected.\n */\n readonly variant: 'assist' | 'suggestion'\n}\n\ntype ChipBaseProps = Omit<PressableProps, 'children' | 'disabled' | 'style'> & {\n /**\n * The chip's label. Required: the page draws no chip without one, and a\n * chip with none is an empty button to a screen reader.\n */\n readonly children: ReactNode\n /**\n * Raises the chip off the page on a container of its own, at the page's\n * elevation 1, in place of the outline. A selected filter chip keeps the\n * secondary container.\n * @default false\n */\n readonly elevated?: boolean\n /**\n * An icon before the label, in the page's 18dp slot and the primary role,\n * which the slot hands it through `useIconStyle()`. A filter chip's check\n * takes its place while the chip is selected, so the chip keeps its width.\n */\n readonly icon?: ReactNode\n /**\n * Draws the chip disabled, and takes no presses.\n * @default false\n */\n readonly isDisabled?: boolean\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n}\n\n/** A filter chip: a two-state button, the default. */\ntype ChipFilterProps = ChipBaseProps & {\n /**\n * Whether the chip starts selected, when it keeps its own state.\n * @default false\n */\n readonly defaultSelected?: boolean\n /**\n * Whether the chip is selected, when the call site holds the state. Pass\n * it with `onChange`.\n */\n readonly isSelected?: boolean\n /** Called with the new state when the chip is pressed, after `onPress`. */\n readonly onChange?: (isSelected: boolean) => void\n /**\n * A filter chip, a two-state button.\n * @default 'filter'\n */\n readonly variant?: 'filter'\n}\n\ntype ChipProps = ChipActionProps | ChipFilterProps\n\n/** Which of the chips page's chips a Chip is. */\ntype ChipVariant = 'assist' | 'filter' | 'suggestion'\n\n/**\n * A chip. By default a filter chip, which is a two-state button reporting\n * its state as a toggle Button does: pass `isSelected` with `onChange` to\n * control it, or `defaultSelected` to let it keep its own state.\n *\n * ```tsx\n * <Chip defaultSelected>Label</Chip>\n * ```\n *\n * `variant=\"assist\"` and `variant=\"suggestion\"` draw the page's two action\n * chips instead: plain buttons, pressed with `onPress`, never selected.\n *\n * A chip placed directly inside `Menu`, `Popover`, `Dialog` or `Sheet` is its\n * trigger, as a `Button` is, and a press on it opens what it is placed in.\n *\n * A column stretches a chip across it, as it does any view; a row of chips is\n * a row that wraps. `style`, `ref` and `testID` land on the `Pressable`.\n */\nfunction Chip({\n accessibilityHint,\n children,\n defaultSelected,\n delayLongPress,\n elevated = false,\n hitSlop,\n icon,\n isDisabled = false,\n isSelected,\n onBlur,\n onChange,\n onFocus,\n onHoverIn,\n onHoverOut,\n onLayout,\n onLongPress,\n onPress,\n onPressIn,\n onPressOut,\n ref,\n style,\n variant = 'filter',\n ...props\n}: ChipProps) {\n const theme = useTheme()\n // Until the chip is measured it takes no reach across, rather than one\n // sized for a chip of no width.\n const [width, setWidth] = useState(TARGET_SIZE)\n\n const isToggle = variant === 'filter'\n const action = useButtonAction({\n defaultSelected,\n href: undefined,\n isSelected,\n isToggle,\n onChange,\n onPress,\n slot: 'default',\n type: undefined,\n })\n const {\n onHoverIn: hoverIn,\n onHoverOut: hoverOut,\n onLongPress: longPress,\n onPressIn: pressIn,\n onPressOut: pressOut,\n ...triggerProps\n } = useSlotTrigger({\n accessibilityHint,\n delayLongPress,\n href: undefined,\n onHoverIn,\n onHoverOut,\n onLongPress,\n onPressIn,\n onPressOut,\n ref,\n slot: undefined,\n })\n const paint = paintOf(theme, {\n assist: variant === 'assist',\n disabled: isDisabled,\n elevated,\n selected: action.selected,\n })\n const eased = useEasedColors(paint)\n\n const feedback = usePressFeedback({\n color: paint.layer,\n corners: { borderRadius: theme.radii.sm },\n disabled: isDisabled,\n onBlur,\n onFocus,\n onHoverIn: hoverIn,\n onHoverOut: hoverOut,\n onPressIn: pressIn,\n onPressOut: pressOut,\n })\n\n return (\n <AnimatedPressable\n role=\"button\"\n {...(isToggle ? toggleState(action.selected) : undefined)}\n {...props}\n {...triggerProps}\n {...feedback.handlers}\n disabled={isDisabled}\n hitSlop={hitSlop ?? targetOf(width, theme)}\n onLayout={measureThen(setWidth, onLayout)}\n onLongPress={longPress}\n onPress={action.onPress}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n stylesOf(theme).pill,\n eased.container,\n elevated && !isDisabled\n ? shadowsOf(theme)[feedback.hovered ? 'elevation2' : 'elevation1']\n : undefined,\n feedback.ring,\n style,\n )}\n >\n {feedback.layer}\n <ChipGlyph color={paint.glyph} icon={icon} selected={action.selected} />\n <ChipLabel color={eased.label}>{children}</ChipLabel>\n </AnimatedPressable>\n )\n}\n\nexport { Chip }\nexport type { ChipActionProps, ChipFilterProps, ChipProps, ChipVariant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AAA,MAAA2B,OAAAhB;EAAAX,EAAA,MAAAmD,SAAAG;EAAAtD,EAAA,MAAAmD,SAAAH;EAAAhD,EAAA,MAAAR;EAAAQ,EAAA,MAAAgC;EAAAhC,EAAA,MAAAc;EAAAd,EAAA,MAAAoD;EAAApD,EAAA,MAAAuD;EAAAvD,EAAA,MAAAwD;EAAAxD,EAAA,MAAA0D;EAAA1D,EAAA,MAAA+D;EAAA/D,EAAA,MAAAiE;EAAAjE,EAAA,OAAAmC;EAAAnC,EAAA,OAAAmE;CAAA,OAAAA,MAAAnE,EAAA;CAAA,OAxBpBmE;AAwBoB"}
|
|
@@ -73,11 +73,11 @@ type DialogTitleProps = Omit<TextProps, 'role'> & {
|
|
|
73
73
|
* ```
|
|
74
74
|
*
|
|
75
75
|
* Composed rather than configured by props, as web's is, since a dialog's
|
|
76
|
-
* header, body and actions all take arbitrary content. A `Button
|
|
77
|
-
* `IconButton` inside `Dialog` and outside its content opens it,
|
|
78
|
-
* given `slot="close"` anywhere inside the content closes it. A
|
|
79
|
-
* the screen opens leaves `Dialog` out and passes `isOpen`
|
|
80
|
-
* `onOpenChange` to `Dialog.Content` instead.
|
|
76
|
+
* header, body and actions all take arbitrary content. A `Button`,
|
|
77
|
+
* `IconButton` or `Chip` inside `Dialog` and outside its content opens it,
|
|
78
|
+
* and a button given `slot="close"` anywhere inside the content closes it. A
|
|
79
|
+
* dialog nothing on the screen opens leaves `Dialog` out and passes `isOpen`
|
|
80
|
+
* and `onOpenChange` to `Dialog.Content` instead.
|
|
81
81
|
*/
|
|
82
82
|
declare function Dialog({ children, defaultOpen, isOpen, onOpenChange }: DialogProps): import("react").JSX.Element;
|
|
83
83
|
declare namespace Dialog {
|
|
@@ -121,11 +121,11 @@ function bodyPaddingOf({ basic, parts }, spacing) {
|
|
|
121
121
|
* ```
|
|
122
122
|
*
|
|
123
123
|
* Composed rather than configured by props, as web's is, since a dialog's
|
|
124
|
-
* header, body and actions all take arbitrary content. A `Button
|
|
125
|
-
* `IconButton` inside `Dialog` and outside its content opens it,
|
|
126
|
-
* given `slot="close"` anywhere inside the content closes it. A
|
|
127
|
-
* the screen opens leaves `Dialog` out and passes `isOpen`
|
|
128
|
-
* `onOpenChange` to `Dialog.Content` instead.
|
|
124
|
+
* header, body and actions all take arbitrary content. A `Button`,
|
|
125
|
+
* `IconButton` or `Chip` inside `Dialog` and outside its content opens it,
|
|
126
|
+
* and a button given `slot="close"` anywhere inside the content closes it. A
|
|
127
|
+
* dialog nothing on the screen opens leaves `Dialog` out and passes `isOpen`
|
|
128
|
+
* and `onOpenChange` to `Dialog.Content` instead.
|
|
129
129
|
*/
|
|
130
130
|
function Dialog(t0) {
|
|
131
131
|
const $ = c(10);
|