@tamagui/select 1.0.1-beta.107 → 1.0.1-beta.110
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/cjs/BubbleSelect.js +2 -15
- package/dist/cjs/BubbleSelect.js.map +1 -1
- package/dist/cjs/Select.js +88 -117
- package/dist/cjs/Select.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/BubbleSelect.js +1 -16
- package/dist/esm/BubbleSelect.js.map +1 -1
- package/dist/esm/Select.js +87 -119
- package/dist/esm/Select.js.map +1 -1
- package/package.json +12 -12
- package/types/Select.d.ts +2 -1
- package/types/Select.d.ts.map +1 -1
package/dist/cjs/BubbleSelect.js
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __objRest = (source, exclude) => {
|
|
10
|
-
var target = {};
|
|
11
|
-
for (var prop in source)
|
|
12
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
13
|
-
target[prop] = source[prop];
|
|
14
|
-
if (source != null && __getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
16
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
17
|
-
target[prop] = source[prop];
|
|
18
|
-
}
|
|
19
|
-
return target;
|
|
20
|
-
};
|
|
21
8
|
var __copyProps = (to, from, except, desc) => {
|
|
22
9
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
10
|
for (let key of __getOwnPropNames(from))
|
|
@@ -31,7 +18,7 @@ var import_react_use_previous = require("@radix-ui/react-use-previous");
|
|
|
31
18
|
var import_compose_refs = require("@tamagui/compose-refs");
|
|
32
19
|
var React = __toESM(require("react"));
|
|
33
20
|
const BubbleSelect = React.forwardRef((props, forwardedRef) => {
|
|
34
|
-
const
|
|
21
|
+
const { value, ...selectProps } = props;
|
|
35
22
|
const ref = React.useRef(null);
|
|
36
23
|
const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);
|
|
37
24
|
const prevValue = (0, import_react_use_previous.usePrevious)(value);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/BubbleSelect.tsx"],
|
|
4
4
|
"sourcesContent": ["import { usePrevious } from '@radix-ui/react-use-previous'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport * as React from 'react'\n\n/* -----------------------------------------------------------------------------------------------*/\nconst BubbleSelect = React.forwardRef<HTMLSelectElement, React.ComponentPropsWithoutRef<'select'>>(\n (props, forwardedRef) => {\n const { value, ...selectProps } = props\n const ref = React.useRef<HTMLSelectElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n const prevValue = usePrevious(value)\n\n // Bubble value change to parents (e.g form change event)\n React.useEffect(() => {\n const select = ref.current!\n const selectProto = window.HTMLSelectElement.prototype\n const descriptor = Object.getOwnPropertyDescriptor(selectProto, 'value') as PropertyDescriptor\n const setValue = descriptor.set\n if (prevValue !== value && setValue) {\n const event = new Event('change', { bubbles: true })\n setValue.call(select, value)\n select.dispatchEvent(event)\n }\n }, [prevValue, value])\n\n /**\n * We purposefully use a `select` here to support form autofill as much\n * as possible.\n *\n * We purposefully do not add the `value` attribute here to allow the value\n * to be set programatically and bubble to any parent form `onChange` event.\n * Adding the `value` will cause React to consider the programatic\n * dispatch a duplicate and it will get swallowed.\n *\n * We use `VisuallyHidden` rather than `display: \"none\"` because Safari autofill\n * won't work otherwise.\n */\n // TODO\n return null\n // return (\n // <VisuallyHidden asChild>\n // <select {...selectProps} ref={composedRefs} defaultValue={value} />\n // </VisuallyHidden>\n // )\n }\n)\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA,gCAA4B;AAC5B,0BAAgC;AAChC,YAAuB;AAGvB,MAAM,eAAe,MAAM,WACzB,CAAC,OAAO,iBAAiB;AACvB,QAAM,EAAE,UAAU,gBAAgB;AAClC,QAAM,MAAM,MAAM,OAA0B,IAAI;AAChD,QAAM,eAAe,yCAAgB,cAAc,GAAG;AACtD,QAAM,YAAY,2CAAY,KAAK;AAGnC,QAAM,UAAU,MAAM;AACpB,UAAM,SAAS,IAAI;AACnB,UAAM,cAAc,OAAO,kBAAkB;AAC7C,UAAM,aAAa,OAAO,yBAAyB,aAAa,OAAO;AACvE,UAAM,WAAW,WAAW;AAC5B,QAAI,cAAc,SAAS,UAAU;AACnC,YAAM,QAAQ,IAAI,MAAM,UAAU,EAAE,SAAS,KAAK,CAAC;AACnD,eAAS,KAAK,QAAQ,KAAK;AAC3B,aAAO,cAAc,KAAK;AAAA,IAC5B;AAAA,EACF,GAAG,CAAC,WAAW,KAAK,CAAC;AAerB,SAAO;AAMT,CACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/Select.js
CHANGED
|
@@ -1,38 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __objRest = (source, exclude) => {
|
|
25
|
-
var target = {};
|
|
26
|
-
for (var prop in source)
|
|
27
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
if (source != null && __getOwnPropSymbols)
|
|
30
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
-
target[prop] = source[prop];
|
|
33
|
-
}
|
|
34
|
-
return target;
|
|
35
|
-
};
|
|
36
8
|
var __export = (target, all) => {
|
|
37
9
|
for (var name in all)
|
|
38
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -96,18 +68,15 @@ const [createSelectContext, createSelectScope] = (0, import_create_context.creat
|
|
|
96
68
|
const [SelectProvider, useSelectContext] = createSelectContext(SELECT_NAME);
|
|
97
69
|
const TRIGGER_NAME = "SelectTrigger";
|
|
98
70
|
const SelectTrigger = React.forwardRef((props, forwardedRef) => {
|
|
99
|
-
const
|
|
71
|
+
const {
|
|
100
72
|
__scopeSelect,
|
|
101
73
|
disabled = false,
|
|
102
|
-
"aria-labelledby": ariaLabelledby
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"disabled",
|
|
106
|
-
"aria-labelledby"
|
|
107
|
-
]);
|
|
74
|
+
"aria-labelledby": ariaLabelledby,
|
|
75
|
+
...triggerProps
|
|
76
|
+
} = props;
|
|
108
77
|
const context = useSelectContext(TRIGGER_NAME, __scopeSelect);
|
|
109
78
|
const labelledBy = ariaLabelledby;
|
|
110
|
-
return /* @__PURE__ */ React.createElement(import_list_item.ListItem,
|
|
79
|
+
return /* @__PURE__ */ React.createElement(import_list_item.ListItem, {
|
|
111
80
|
backgrounded: true,
|
|
112
81
|
radiused: true,
|
|
113
82
|
hoverTheme: true,
|
|
@@ -122,14 +91,15 @@ const SelectTrigger = React.forwardRef((props, forwardedRef) => {
|
|
|
122
91
|
"aria-labelledby": labelledBy,
|
|
123
92
|
dir: context.dir,
|
|
124
93
|
disabled,
|
|
125
|
-
"data-disabled": disabled ? "" : void 0
|
|
126
|
-
|
|
127
|
-
ref: forwardedRef
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
94
|
+
"data-disabled": disabled ? "" : void 0,
|
|
95
|
+
...triggerProps,
|
|
96
|
+
ref: forwardedRef,
|
|
97
|
+
...context.interactions ? context.interactions.getReferenceProps() : {
|
|
98
|
+
onPress() {
|
|
99
|
+
context.setOpen(!context.open);
|
|
100
|
+
}
|
|
131
101
|
}
|
|
132
|
-
})
|
|
102
|
+
});
|
|
133
103
|
});
|
|
134
104
|
SelectTrigger.displayName = TRIGGER_NAME;
|
|
135
105
|
const VALUE_NAME = "SelectValue";
|
|
@@ -196,10 +166,10 @@ const SelectViewportFrame = (0, import_core2.styled)(import_stacks.ThemeableStac
|
|
|
196
166
|
}
|
|
197
167
|
});
|
|
198
168
|
const SelectViewport = React.forwardRef((props, forwardedRef) => {
|
|
199
|
-
var
|
|
200
|
-
const
|
|
169
|
+
var _a;
|
|
170
|
+
const { __scopeSelect, children, ...viewportProps } = props;
|
|
201
171
|
const context = useSelectContext(VIEWPORT_NAME, __scopeSelect);
|
|
202
|
-
const
|
|
172
|
+
const { style, ...floatingProps } = ((_a = context.interactions) == null ? void 0 : _a.getFloatingProps()) ?? {};
|
|
203
173
|
const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint);
|
|
204
174
|
if (breakpointActive || !import_core.isWeb) {
|
|
205
175
|
return /* @__PURE__ */ React.createElement(import_portal.PortalItem, {
|
|
@@ -218,31 +188,28 @@ const SelectViewport = React.forwardRef((props, forwardedRef) => {
|
|
|
218
188
|
}), /* @__PURE__ */ React.createElement(import_react_dom_interactions.FloatingFocusManager, {
|
|
219
189
|
context: context.floatingContext,
|
|
220
190
|
preventTabbing: true
|
|
221
|
-
}, /* @__PURE__ */ React.createElement(SelectViewportFrame,
|
|
191
|
+
}, /* @__PURE__ */ React.createElement(SelectViewportFrame, {
|
|
222
192
|
size: context.size,
|
|
223
193
|
"data-tamagui-select-viewport": "",
|
|
224
|
-
role: "presentation"
|
|
225
|
-
|
|
226
|
-
ref: forwardedRef
|
|
227
|
-
|
|
194
|
+
role: "presentation",
|
|
195
|
+
...viewportProps,
|
|
196
|
+
ref: forwardedRef,
|
|
197
|
+
...floatingProps,
|
|
198
|
+
...style
|
|
199
|
+
}, children)));
|
|
228
200
|
});
|
|
229
201
|
SelectViewport.displayName = VIEWPORT_NAME;
|
|
230
202
|
const ITEM_NAME = "SelectItem";
|
|
231
203
|
const [SelectItemContextProvider, useSelectItemContext] = createSelectContext(ITEM_NAME);
|
|
232
204
|
const SelectItem = React.forwardRef((props, forwardedRef) => {
|
|
233
|
-
const
|
|
205
|
+
const {
|
|
234
206
|
__scopeSelect,
|
|
235
207
|
value,
|
|
236
208
|
disabled = false,
|
|
237
209
|
textValue: textValueProp,
|
|
238
|
-
index
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
"value",
|
|
242
|
-
"disabled",
|
|
243
|
-
"textValue",
|
|
244
|
-
"index"
|
|
245
|
-
]);
|
|
210
|
+
index,
|
|
211
|
+
...itemProps
|
|
212
|
+
} = props;
|
|
246
213
|
const context = useSelectContext(ITEM_NAME, __scopeSelect);
|
|
247
214
|
const isSelected = context.value === value;
|
|
248
215
|
const [textValue, setTextValue] = React.useState(textValueProp ?? "");
|
|
@@ -312,7 +279,7 @@ const SelectItem = React.forwardRef((props, forwardedRef) => {
|
|
|
312
279
|
onItemTextChange: React.useCallback((node) => {
|
|
313
280
|
setTextValue((prevTextValue) => prevTextValue || ((node == null ? void 0 : node.textContent) ?? "").trim());
|
|
314
281
|
}, [])
|
|
315
|
-
}, /* @__PURE__ */ React.createElement(import_list_item.ListItem,
|
|
282
|
+
}, /* @__PURE__ */ React.createElement(import_list_item.ListItem, {
|
|
316
283
|
backgrounded: true,
|
|
317
284
|
pressTheme: true,
|
|
318
285
|
focusTheme: true,
|
|
@@ -324,8 +291,10 @@ const SelectItem = React.forwardRef((props, forwardedRef) => {
|
|
|
324
291
|
"aria-disabled": disabled || void 0,
|
|
325
292
|
"data-disabled": disabled ? "" : void 0,
|
|
326
293
|
tabIndex: disabled ? void 0 : -1,
|
|
327
|
-
size: context.size
|
|
328
|
-
|
|
294
|
+
size: context.size,
|
|
295
|
+
...itemProps,
|
|
296
|
+
...selectItemProps
|
|
297
|
+
}));
|
|
329
298
|
});
|
|
330
299
|
SelectItem.displayName = ITEM_NAME;
|
|
331
300
|
const ITEM_TEXT_NAME = "SelectItemText";
|
|
@@ -334,18 +303,18 @@ const SelectItemTextFrame = (0, import_core2.styled)(import_text.Paragraph, {
|
|
|
334
303
|
selectable: false
|
|
335
304
|
});
|
|
336
305
|
const SelectItemText = React.forwardRef((props, forwardedRef) => {
|
|
337
|
-
const
|
|
306
|
+
const { __scopeSelect, className, ...itemTextProps } = props;
|
|
338
307
|
const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
339
308
|
const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
340
309
|
const ref = React.useRef(null);
|
|
341
310
|
const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref, itemContext.onItemTextChange);
|
|
342
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SelectItemTextFrame,
|
|
311
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SelectItemTextFrame, {
|
|
343
312
|
className,
|
|
344
313
|
size: context.size,
|
|
345
|
-
id: itemContext.textId
|
|
346
|
-
|
|
314
|
+
id: itemContext.textId,
|
|
315
|
+
...itemTextProps,
|
|
347
316
|
ref: composedRefs
|
|
348
|
-
})
|
|
317
|
+
}), itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren ? ReactDOM.createPortal(itemTextProps.children, context.valueNode) : null);
|
|
349
318
|
});
|
|
350
319
|
SelectItemText.displayName = ITEM_TEXT_NAME;
|
|
351
320
|
const ITEM_INDICATOR_NAME = "SelectItemIndicator";
|
|
@@ -353,13 +322,13 @@ const SelectItemIndicatorFrame = (0, import_core2.styled)(import_stacks.XStack,
|
|
|
353
322
|
name: ITEM_TEXT_NAME
|
|
354
323
|
});
|
|
355
324
|
const SelectItemIndicator = React.forwardRef((props, forwardedRef) => {
|
|
356
|
-
const
|
|
325
|
+
const { __scopeSelect, ...itemIndicatorProps } = props;
|
|
357
326
|
const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
358
|
-
return itemContext.isSelected ? /* @__PURE__ */ React.createElement(SelectItemIndicatorFrame,
|
|
359
|
-
"aria-hidden": true
|
|
360
|
-
|
|
327
|
+
return itemContext.isSelected ? /* @__PURE__ */ React.createElement(SelectItemIndicatorFrame, {
|
|
328
|
+
"aria-hidden": true,
|
|
329
|
+
...itemIndicatorProps,
|
|
361
330
|
ref: forwardedRef
|
|
362
|
-
})
|
|
331
|
+
}) : null;
|
|
363
332
|
});
|
|
364
333
|
SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
|
|
365
334
|
const GROUP_NAME = "SelectGroup";
|
|
@@ -369,58 +338,58 @@ const SelectGroupFrame = (0, import_core2.styled)(import_stacks.YStack, {
|
|
|
369
338
|
width: "100%"
|
|
370
339
|
});
|
|
371
340
|
const SelectGroup = React.forwardRef((props, forwardedRef) => {
|
|
372
|
-
const
|
|
341
|
+
const { __scopeSelect, ...groupProps } = props;
|
|
373
342
|
const groupId = (0, import_core3.useId)();
|
|
374
343
|
return /* @__PURE__ */ React.createElement(SelectGroupContextProvider, {
|
|
375
344
|
scope: __scopeSelect,
|
|
376
345
|
id: groupId || ""
|
|
377
|
-
}, /* @__PURE__ */ React.createElement(SelectGroupFrame,
|
|
346
|
+
}, /* @__PURE__ */ React.createElement(SelectGroupFrame, {
|
|
378
347
|
role: "group",
|
|
379
|
-
"aria-labelledby": groupId
|
|
380
|
-
|
|
348
|
+
"aria-labelledby": groupId,
|
|
349
|
+
...groupProps,
|
|
381
350
|
ref: forwardedRef
|
|
382
|
-
}))
|
|
351
|
+
}));
|
|
383
352
|
});
|
|
384
353
|
SelectGroup.displayName = GROUP_NAME;
|
|
385
354
|
const LABEL_NAME = "SelectLabel";
|
|
386
355
|
const SelectLabel = React.forwardRef((props, forwardedRef) => {
|
|
387
|
-
const
|
|
356
|
+
const { __scopeSelect, ...labelProps } = props;
|
|
388
357
|
const context = useSelectContext(LABEL_NAME, __scopeSelect);
|
|
389
358
|
const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
390
|
-
return /* @__PURE__ */ React.createElement(import_list_item.ListItem,
|
|
359
|
+
return /* @__PURE__ */ React.createElement(import_list_item.ListItem, {
|
|
391
360
|
componentName: LABEL_NAME,
|
|
392
361
|
fontWeight: "800",
|
|
393
362
|
id: groupContext.id,
|
|
394
|
-
size: context.size
|
|
395
|
-
|
|
363
|
+
size: context.size,
|
|
364
|
+
...labelProps,
|
|
396
365
|
ref: forwardedRef
|
|
397
|
-
})
|
|
366
|
+
});
|
|
398
367
|
});
|
|
399
368
|
SelectLabel.displayName = LABEL_NAME;
|
|
400
369
|
const SCROLL_UP_BUTTON_NAME = "SelectScrollUpButton";
|
|
401
370
|
const SelectScrollUpButton = React.forwardRef((props, forwardedRef) => {
|
|
402
|
-
return /* @__PURE__ */ React.createElement(SelectScrollButtonImpl,
|
|
403
|
-
componentName: SCROLL_UP_BUTTON_NAME
|
|
404
|
-
|
|
371
|
+
return /* @__PURE__ */ React.createElement(SelectScrollButtonImpl, {
|
|
372
|
+
componentName: SCROLL_UP_BUTTON_NAME,
|
|
373
|
+
...props,
|
|
405
374
|
dir: "up",
|
|
406
375
|
ref: forwardedRef
|
|
407
|
-
})
|
|
376
|
+
});
|
|
408
377
|
});
|
|
409
378
|
SelectScrollUpButton.displayName = SCROLL_UP_BUTTON_NAME;
|
|
410
379
|
const SCROLL_DOWN_BUTTON_NAME = "SelectScrollDownButton";
|
|
411
380
|
const SelectScrollDownButton = React.forwardRef((props, forwardedRef) => {
|
|
412
|
-
return /* @__PURE__ */ React.createElement(SelectScrollButtonImpl,
|
|
413
|
-
componentName: SCROLL_DOWN_BUTTON_NAME
|
|
414
|
-
|
|
381
|
+
return /* @__PURE__ */ React.createElement(SelectScrollButtonImpl, {
|
|
382
|
+
componentName: SCROLL_DOWN_BUTTON_NAME,
|
|
383
|
+
...props,
|
|
415
384
|
dir: "down",
|
|
416
385
|
ref: forwardedRef
|
|
417
|
-
})
|
|
386
|
+
});
|
|
418
387
|
});
|
|
419
388
|
SelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;
|
|
420
389
|
const SelectScrollButtonImpl = React.memo(React.forwardRef((props, forwardedRef) => {
|
|
421
|
-
var
|
|
422
|
-
const
|
|
423
|
-
const
|
|
390
|
+
var _a;
|
|
391
|
+
const { __scopeSelect, dir, componentName, ...scrollIndicatorProps } = props;
|
|
392
|
+
const { floatingRef, increaseHeight, forceUpdate, ...context } = useSelectContext(componentName, __scopeSelect);
|
|
424
393
|
const intervalRef = React.useRef();
|
|
425
394
|
const loopingRef = React.useRef(false);
|
|
426
395
|
const isVisible = context[dir === "down" ? "canScrollDown" : "canScrollUp"];
|
|
@@ -464,16 +433,16 @@ const SelectScrollButtonImpl = React.memo(React.forwardRef((props, forwardedRef)
|
|
|
464
433
|
forceUpdate();
|
|
465
434
|
}
|
|
466
435
|
};
|
|
467
|
-
return /* @__PURE__ */ React.createElement(import_stacks.YStack,
|
|
436
|
+
return /* @__PURE__ */ React.createElement(import_stacks.YStack, {
|
|
468
437
|
ref: composedRefs,
|
|
469
438
|
componentName,
|
|
470
|
-
"aria-hidden": true
|
|
471
|
-
|
|
439
|
+
"aria-hidden": true,
|
|
440
|
+
...scrollIndicatorProps,
|
|
472
441
|
zIndex: 1e3,
|
|
473
442
|
position: strategy,
|
|
474
443
|
left: x || 0,
|
|
475
444
|
top: y || 0,
|
|
476
|
-
width: `calc(${(((
|
|
445
|
+
width: `calc(${(((_a = floatingRef == null ? void 0 : floatingRef.current) == null ? void 0 : _a.offsetWidth) ?? 0) - 2}px)`,
|
|
477
446
|
onPointerMove: () => {
|
|
478
447
|
if (!loopingRef.current) {
|
|
479
448
|
intervalRef.current = setInterval(handleScrollArrowChange, 1e3 / 60);
|
|
@@ -484,7 +453,7 @@ const SelectScrollButtonImpl = React.memo(React.forwardRef((props, forwardedRef)
|
|
|
484
453
|
loopingRef.current = false;
|
|
485
454
|
clearInterval(intervalRef.current);
|
|
486
455
|
}
|
|
487
|
-
})
|
|
456
|
+
});
|
|
488
457
|
}));
|
|
489
458
|
const SelectSeparator = (0, import_core2.styled)(import_separator.Separator, {
|
|
490
459
|
name: "SelectSeparator"
|
|
@@ -815,15 +784,16 @@ const SelectInlineImpl = (props) => {
|
|
|
815
784
|
});
|
|
816
785
|
return () => cancelAnimationFrame(frame);
|
|
817
786
|
}, [open]);
|
|
818
|
-
return /* @__PURE__ */ React.createElement(SelectProvider,
|
|
819
|
-
scope: __scopeSelect
|
|
820
|
-
|
|
787
|
+
return /* @__PURE__ */ React.createElement(SelectProvider, {
|
|
788
|
+
scope: __scopeSelect,
|
|
789
|
+
...selectContext,
|
|
821
790
|
increaseHeight,
|
|
822
791
|
floatingRef,
|
|
823
792
|
setValueAtIndex: (index, value) => {
|
|
824
793
|
listContentRef.current[index] = value;
|
|
825
794
|
},
|
|
826
|
-
interactions:
|
|
795
|
+
interactions: {
|
|
796
|
+
...interactions,
|
|
827
797
|
getReferenceProps() {
|
|
828
798
|
return interactions.getReferenceProps({
|
|
829
799
|
ref: reference,
|
|
@@ -837,19 +807,20 @@ const SelectInlineImpl = (props) => {
|
|
|
837
807
|
});
|
|
838
808
|
},
|
|
839
809
|
getFloatingProps(props2) {
|
|
840
|
-
return interactions.getFloatingProps(
|
|
810
|
+
return interactions.getFloatingProps({
|
|
841
811
|
ref: floating,
|
|
842
|
-
className: "Select"
|
|
843
|
-
|
|
844
|
-
style:
|
|
812
|
+
className: "Select",
|
|
813
|
+
...props2,
|
|
814
|
+
style: {
|
|
845
815
|
position: strategy,
|
|
846
816
|
top: y ?? "",
|
|
847
817
|
left: x ?? "",
|
|
848
818
|
outline: 0,
|
|
849
819
|
listStyleType: "none",
|
|
850
820
|
scrollbarWidth: "none",
|
|
851
|
-
userSelect: "none"
|
|
852
|
-
|
|
821
|
+
userSelect: "none",
|
|
822
|
+
...props2 == null ? void 0 : props2.style
|
|
823
|
+
},
|
|
853
824
|
onPointerEnter() {
|
|
854
825
|
setControlledScrolling(false);
|
|
855
826
|
},
|
|
@@ -862,9 +833,9 @@ const SelectInlineImpl = (props) => {
|
|
|
862
833
|
onScroll(event) {
|
|
863
834
|
setScrollTop(event.currentTarget.scrollTop);
|
|
864
835
|
}
|
|
865
|
-
})
|
|
836
|
+
});
|
|
866
837
|
}
|
|
867
|
-
}
|
|
838
|
+
},
|
|
868
839
|
floatingContext: context,
|
|
869
840
|
activeIndex,
|
|
870
841
|
canScrollDown: !!showDownArrow,
|
|
@@ -872,7 +843,7 @@ const SelectInlineImpl = (props) => {
|
|
|
872
843
|
controlledScrolling: true,
|
|
873
844
|
dataRef: context.dataRef,
|
|
874
845
|
listRef: listItemsRef
|
|
875
|
-
}
|
|
846
|
+
}, children);
|
|
876
847
|
};
|
|
877
848
|
const SelectSheetImpl = (props) => {
|
|
878
849
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, props.children);
|
|
@@ -940,14 +911,14 @@ const Select = (0, import_core2.withStaticProperties)((props) => {
|
|
|
940
911
|
}, /* @__PURE__ */ React.createElement(SelectSheetController, {
|
|
941
912
|
onChangeOpen: setOpen,
|
|
942
913
|
__scopeSelect
|
|
943
|
-
}, /* @__PURE__ */ React.createElement(SelectImpl,
|
|
914
|
+
}, /* @__PURE__ */ React.createElement(SelectImpl, {
|
|
944
915
|
activeIndexRef,
|
|
945
916
|
listContentRef,
|
|
946
|
-
selectedIndexRef
|
|
947
|
-
|
|
917
|
+
selectedIndexRef,
|
|
918
|
+
...props,
|
|
948
919
|
open,
|
|
949
920
|
value
|
|
950
|
-
}
|
|
921
|
+
}, children)));
|
|
951
922
|
}, {
|
|
952
923
|
Content: SelectContent,
|
|
953
924
|
Group: SelectGroup,
|