@dloizides/ui-forms 1.56.0 → 1.57.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/index.d.mts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +34 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2216,26 +2216,34 @@ var FIELD_PAD_H = 10;
|
|
|
2216
2216
|
var FIELD_FONT = 13;
|
|
2217
2217
|
var FIELD_RADIUS = 8;
|
|
2218
2218
|
var FIELD_CHEVRON_ROOM = 30;
|
|
2219
|
+
var CHIP_DESKTOP_HEIGHT = 30;
|
|
2220
|
+
var CHIP_GAP = 6;
|
|
2219
2221
|
var CHEVRON_BOX = 16;
|
|
2220
2222
|
var DEFAULT_CONFIG = { look: "default" };
|
|
2221
2223
|
var SelectLookContext = createContext(DEFAULT_CONFIG);
|
|
2222
|
-
function SelectLookProvider({ look, borderColor, children }) {
|
|
2223
|
-
const value = useMemo(() => ({ look, borderColor }), [look, borderColor]);
|
|
2224
|
+
function SelectLookProvider({ look, borderColor, backgroundColor, textColor, children }) {
|
|
2225
|
+
const value = useMemo(() => ({ look, borderColor, backgroundColor, textColor }), [look, borderColor, backgroundColor, textColor]);
|
|
2224
2226
|
return /* @__PURE__ */ jsx(SelectLookContext.Provider, { value, children });
|
|
2225
2227
|
}
|
|
2226
|
-
function selectLookMetrics({ look, borderColor }, windowWidth) {
|
|
2228
|
+
function selectLookMetrics({ look, borderColor, backgroundColor, textColor }, windowWidth) {
|
|
2227
2229
|
if (look === "default") {
|
|
2228
2230
|
return void 0;
|
|
2229
2231
|
}
|
|
2230
2232
|
const isPhone = windowWidth < PHONE_MAX_WIDTH;
|
|
2233
|
+
const isChip = look === "chip";
|
|
2234
|
+
const desktopHeight = isChip ? CHIP_DESKTOP_HEIGHT : FIELD_DESKTOP_HEIGHT;
|
|
2231
2235
|
return {
|
|
2232
|
-
height: isPhone ? FIELD_PHONE_HEIGHT :
|
|
2236
|
+
height: isPhone ? FIELD_PHONE_HEIGHT : desktopHeight,
|
|
2233
2237
|
paddingHorizontal: FIELD_PAD_H,
|
|
2234
2238
|
paddingVertical: 0,
|
|
2235
2239
|
fontSize: FIELD_FONT,
|
|
2236
2240
|
borderRadius: FIELD_RADIUS,
|
|
2237
2241
|
chevronRoom: FIELD_CHEVRON_ROOM,
|
|
2238
|
-
|
|
2242
|
+
hug: isChip,
|
|
2243
|
+
gap: isChip ? CHIP_GAP : void 0,
|
|
2244
|
+
borderColor,
|
|
2245
|
+
backgroundColor,
|
|
2246
|
+
textColor
|
|
2239
2247
|
};
|
|
2240
2248
|
}
|
|
2241
2249
|
function useSelectLookMetrics() {
|
|
@@ -2275,10 +2283,10 @@ function lookSelectStyle(fit, m, colors) {
|
|
|
2275
2283
|
paddingInlineStart: m.paddingHorizontal,
|
|
2276
2284
|
paddingInlineEnd: m.chevronRoom,
|
|
2277
2285
|
borderColor: m.borderColor ?? colors.border,
|
|
2278
|
-
backgroundColor: colors.background,
|
|
2279
|
-
color: colors.text,
|
|
2286
|
+
backgroundColor: m.backgroundColor ?? colors.background,
|
|
2287
|
+
color: m.textColor ?? colors.text,
|
|
2280
2288
|
appearance: "none",
|
|
2281
|
-
backgroundImage: chevronDataUri(colors.chevron),
|
|
2289
|
+
backgroundImage: chevronDataUri(m.textColor ?? colors.chevron),
|
|
2282
2290
|
backgroundRepeat: "no-repeat",
|
|
2283
2291
|
backgroundPosition: `right ${String(CHEVRON_INSET)}px center`,
|
|
2284
2292
|
backgroundSize: "16px 16px"
|
|
@@ -2376,7 +2384,18 @@ var IS_WEB7 = Platform.OS === "web";
|
|
|
2376
2384
|
var CHEVRON_DOWN = "\u25BE";
|
|
2377
2385
|
var CHEVRON_UP = "\u25B4";
|
|
2378
2386
|
function lookTriggerBox(m) {
|
|
2379
|
-
|
|
2387
|
+
if (m === void 0) return void 0;
|
|
2388
|
+
const hug = m.hug ? { justifyContent: "flex-start", alignSelf: "flex-start", gap: m.gap } : void 0;
|
|
2389
|
+
return { minHeight: m.height, height: m.height, paddingHorizontal: m.paddingHorizontal, paddingVertical: m.paddingVertical, borderRadius: m.borderRadius, ...hug };
|
|
2390
|
+
}
|
|
2391
|
+
function triggerInk(m, colors, isEmpty) {
|
|
2392
|
+
const themeText = isEmpty ? colors.textSecondary : colors.text;
|
|
2393
|
+
return {
|
|
2394
|
+
border: m?.borderColor ?? colors.border,
|
|
2395
|
+
background: m?.backgroundColor ?? colors.surfaceElevated,
|
|
2396
|
+
text: m?.textColor ?? themeText,
|
|
2397
|
+
chevron: m?.textColor ?? colors.textSecondary
|
|
2398
|
+
};
|
|
2380
2399
|
}
|
|
2381
2400
|
function listboxTriggerAria(testID, hasList, highlighted) {
|
|
2382
2401
|
return {
|
|
@@ -2426,6 +2445,7 @@ function MenuSelectControl({
|
|
|
2426
2445
|
[onChange]
|
|
2427
2446
|
);
|
|
2428
2447
|
const metrics = useSelectLookMetrics();
|
|
2448
|
+
const ink = triggerInk(metrics, colors, value === "");
|
|
2429
2449
|
const listbox = useSelectListbox({ options, isOpen, open, toggle: toggle2, select });
|
|
2430
2450
|
const isListbox = menuAnchor !== void 0;
|
|
2431
2451
|
const captureKeys = isListbox ? { onKeyDownCapture: listbox.onKeyDown } : {};
|
|
@@ -2444,11 +2464,11 @@ function MenuSelectControl({
|
|
|
2444
2464
|
"aria-labelledby": labelledById,
|
|
2445
2465
|
onBlur: isListbox ? close : void 0,
|
|
2446
2466
|
onPress: toggle2,
|
|
2447
|
-
style: [controlStyles.selectTrigger, lookTriggerBox(metrics), { borderColor:
|
|
2467
|
+
style: [controlStyles.selectTrigger, lookTriggerBox(metrics), { borderColor: ink.border, backgroundColor: ink.background }],
|
|
2448
2468
|
testID: `${testID}-trigger`,
|
|
2449
2469
|
children: [
|
|
2450
|
-
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [controlStyles.selectTriggerText, metrics === void 0 ? void 0 : { fontSize: metrics.fontSize }, { color:
|
|
2451
|
-
metrics === void 0 ? /* @__PURE__ */ jsx(Text, { "aria-hidden": true, style: [controlStyles.chevron, { color:
|
|
2470
|
+
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [controlStyles.selectTriggerText, metrics === void 0 ? void 0 : { fontSize: metrics.fontSize }, { color: ink.text }], children: selectedLabel }),
|
|
2471
|
+
metrics === void 0 ? /* @__PURE__ */ jsx(Text, { "aria-hidden": true, style: [controlStyles.chevron, { color: ink.chevron }], children: isOpen ? CHEVRON_UP : CHEVRON_DOWN }) : /* @__PURE__ */ jsx(SelectChevron, { color: ink.chevron, open: isOpen })
|
|
2452
2472
|
]
|
|
2453
2473
|
}
|
|
2454
2474
|
),
|
|
@@ -2494,7 +2514,7 @@ var SelectField = ({
|
|
|
2494
2514
|
) });
|
|
2495
2515
|
};
|
|
2496
2516
|
var REMOVE_GLYPH = "\xD7";
|
|
2497
|
-
var
|
|
2517
|
+
var CHIP_GAP2 = 4;
|
|
2498
2518
|
var CHIP_PAD_H = 8;
|
|
2499
2519
|
var CHIP_PAD_V = 4;
|
|
2500
2520
|
var CHIP_RADIUS = 999;
|
|
@@ -2503,7 +2523,7 @@ var styles18 = StyleSheet.create({
|
|
|
2503
2523
|
chip: {
|
|
2504
2524
|
flexDirection: "row",
|
|
2505
2525
|
alignItems: "center",
|
|
2506
|
-
gap:
|
|
2526
|
+
gap: CHIP_GAP2,
|
|
2507
2527
|
paddingHorizontal: CHIP_PAD_H,
|
|
2508
2528
|
paddingVertical: CHIP_PAD_V,
|
|
2509
2529
|
borderWidth: 1,
|