@homebound/beam 2.415.5 → 2.416.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/{chunk-ZQBDHF22.js → chunk-XH44AYND.js} +2 -1
- package/dist/chunk-XH44AYND.js.map +1 -0
- package/dist/index.cjs +57 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +105 -78
- package/dist/index.js.map +1 -1
- package/dist/utils/rtlUtils.cjs.map +1 -1
- package/dist/utils/rtlUtils.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-ZQBDHF22.js.map +0 -1
|
@@ -35,6 +35,7 @@ function fail(message) {
|
|
|
35
35
|
function toToggleState(isSelected, onChange) {
|
|
36
36
|
return {
|
|
37
37
|
isSelected,
|
|
38
|
+
defaultSelected: false,
|
|
38
39
|
setSelected: onChange,
|
|
39
40
|
toggle: () => onChange(!isSelected)
|
|
40
41
|
};
|
|
@@ -92,4 +93,4 @@ export {
|
|
|
92
93
|
isDefined,
|
|
93
94
|
pluralize
|
|
94
95
|
};
|
|
95
|
-
//# sourceMappingURL=chunk-
|
|
96
|
+
//# sourceMappingURL=chunk-XH44AYND.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/defaultTestId.ts","../src/utils/useTestIds.tsx","../src/utils/index.ts"],"sourcesContent":["import { camelCase } from \"change-case\";\n\n/**\n * Guesses an id based on a label string, i.e. given `Homeowner Contract`,\n * returns `homeownerContract`.\n *\n * This is useful for our (non-bound) form fields that will probably have a label,\n * but may not have a `data-testid` set by the encompassing page.\n *\n * (Bound form fields typically set their test id from their form-state field's key.)\n */\nexport function defaultTestId(label: string): string {\n // Strip `m:4` to `m4` to prevent it from becoming `m_4` which our rtl-utils assumes\n // means \"the 4th element with a data-testid value of 'm'\".\n return camelCase(label.replace(\":\", \"\"));\n}\n","import { defaultTestId } from \"src/utils/defaultTestId\";\n\nexport type TestIds = Record<string, object>;\n\n/**\n * Provides a way to easily generate `data-testid`s.\n *\n * The test ids are made of a `${prefix}_${key}`, where:\n *\n * - The prefix is the component name, like \"profile\", and\n * - The key is the specific DOM element that's being tagged, like \"firstName\"\n *\n * To determine the prefix, the component passes us their props, which we'll use\n * to look for an incoming `data-testid` to become the prefix the `data-testid`s\n * that we create. I.e.:\n *\n * ```tsx\n * const { a, b } = props;\n * const tid = useTestIds(props);\n *\n * return <Foo {...tid.foo} />;\n * ```\n *\n * This allows components that embed the component to customize the prefix, i.e.\n * `<TextField data-testid=\"firstName\" />` and `<TextField data-testid=\"lastName\" />`\n * would produce, within `TextField` itself, ids like:\n *\n * - `firstName_input`\n * - `firstName_errors`\n * - `lastName_input`\n * - `lastName_errors`\n *\n * @param props the component's `props` object, which we'll scan for `data-testid` to use as the prefix\n * @param defaultPrefix the default prefix to use if no `data-testid` is found on `props`\n */\nexport function useTestIds(props: object, defaultPrefix?: string): Record<string, object> {\n const prefix: string | undefined =\n (props as any)[\"data-testid\"] ||\n // Pass defaultPrefix through defaultTestId to allow `useTestIds(..., label)` usage\n (defaultPrefix ? defaultTestId(defaultPrefix) : undefined);\n const rootId = { \"data-testid\": prefix };\n return newMethodMissingProxy(rootId, (key) => {\n // If we get tagged ids, remove the colon so that we can do `r.foo_m2` for `m:2`\n key = key.replace(\":\", \"\");\n return { \"data-testid\": prefix ? `${prefix}_${key}` : key };\n }) as any;\n}\n\n/** Uses `object` for any keys that exist on it, otherwise calls `methodMissing` fn. */\nexport function newMethodMissingProxy<T extends object, Y>(\n object: T,\n methodMissing: (key: string) => Y,\n): T & Record<string, Y> {\n return new Proxy(object, {\n get(object, property) {\n if (Reflect.has(object, property)) {\n return Reflect.get(object, property);\n } else if (property === \"then\") {\n return undefined;\n } else {\n return methodMissing(String(property));\n }\n },\n }) as any;\n}\n","import { MutableRefObject } from \"react\";\nimport type { CheckboxGroupState, ToggleState } from \"react-stately\";\n\nexport function fail(message?: string): never {\n throw new Error(message || \"Failed\");\n}\n\n/** Adapts our state to what useToggleState returns in a stateless manner. */\nexport function toToggleState(isSelected: boolean, onChange: (value: boolean) => void): ToggleState {\n return {\n isSelected,\n defaultSelected: false,\n setSelected: onChange,\n toggle: () => onChange(!isSelected),\n };\n}\n\n/** Adapts our state to what use*Group returns in a stateless manner. */\nexport function toGroupState<T extends string>(values: T[], onChange: (value: T[]) => void): CheckboxGroupState {\n const addValue = (value: T) => onChange([...values, value]);\n const removeValue = (value: T) => onChange(values.filter((_value) => _value !== value));\n\n return {\n value: values,\n defaultValue: [],\n setValue: onChange,\n isSelected: (value: T) => values.includes(value),\n addValue,\n removeValue,\n toggleValue: (value: T) => (values.includes(value) ? addValue(value) : removeValue(value)),\n isDisabled: false,\n isReadOnly: false,\n // We do not use the validation state, as our Switch groups do not support error states. However, this field is required by the `CheckboxGroupState` so we need to include it.\n // If we ever update our SwitchGroup component to support error states, we'll need to update this.\n validationState: \"valid\",\n isInvalid: false,\n isRequired: false,\n setInvalid: () => {},\n realtimeValidation: { isInvalid: false, validationErrors: [], validationDetails: {} as ValidityState },\n displayValidation: { isInvalid: false, validationErrors: [], validationDetails: {} as ValidityState },\n updateValidation: () => {},\n resetValidation: () => {},\n commitValidation: () => {},\n };\n}\n\n/**\n * Utility to maybe call a function if undefined with arguments\n *\n * @example\n * maybeCall(onChange, true)\n * maybeCall(onBlur)\n * maybeCall(onSelect, { id: 1, value: \"book 1\"}, true)\n */\nexport function maybeCall(callback: Function | undefined, ...args: any[]) {\n return callback && callback(...args);\n}\n\nexport * from \"./useTestIds\";\n\n/** Casts `Object.keys` to \"what it should be\", as long as your instance doesn't have keys it shouldn't. */\nexport function safeKeys<T>(instance: T): (keyof T)[] {\n return Object.getOwnPropertyNames(instance) as any;\n}\n\n// Returns object with specified key removed\nexport const omitKey = <T, K extends keyof T>(key: K, { [key]: _, ...obj }: T) => obj as T;\n\nexport const noop = (..._: any) => {};\n\ntype Entries<T> = {\n [K in keyof T]: [K, T[K]];\n}[keyof T][];\n\nexport function safeEntries<T extends object>(obj: T): Entries<T> {\n return Object.entries(obj) as any;\n}\n\nexport class EmptyRef<T> implements MutableRefObject<T> {\n get current(): T {\n throw new Error(\"BeamProvider is missing\");\n }\n\n set current(_) {\n throw new Error(\"BeamProvider is missing\");\n }\n}\n\nexport const isAbsoluteUrl = (url: string) => /^(http(s?)):\\/\\//i.test(url);\n\nexport function areArraysEqual(a: any[], b: any[]): boolean {\n return a.length === b.length && a.every((val, idx) => val === b[idx]);\n}\n\nexport function isPromise(obj: any | Promise<any>): obj is Promise<any> {\n return typeof obj === \"object\" && \"then\" in obj && typeof obj.then === \"function\";\n}\n\nexport function isFunction(f: any): f is Function {\n return typeof f === \"function\";\n}\n\nexport function isDefined<T extends any>(param: T | undefined | null): param is T {\n return param !== null && param !== undefined;\n}\n\nexport function pluralize(count: number | unknown[], noun: string, pluralNoun?: string): string {\n if ((Array.isArray(count) ? count.length : count) === 1) return noun;\n return pluralNoun || `${noun}s`;\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAWnB,SAAS,cAAc,OAAuB;AAGnD,SAAO,UAAU,MAAM,QAAQ,KAAK,EAAE,CAAC;AACzC;;;ACoBO,SAAS,WAAW,OAAe,eAAgD;AACxF,QAAM,SACH,MAAc,aAAa;AAAA,GAE3B,gBAAgB,cAAc,aAAa,IAAI;AAClD,QAAM,SAAS,EAAE,eAAe,OAAO;AACvC,SAAO,sBAAsB,QAAQ,CAAC,QAAQ;AAE5C,UAAM,IAAI,QAAQ,KAAK,EAAE;AACzB,WAAO,EAAE,eAAe,SAAS,GAAG,MAAM,IAAI,GAAG,KAAK,IAAI;AAAA,EAC5D,CAAC;AACH;AAGO,SAAS,sBACd,QACA,eACuB;AACvB,SAAO,IAAI,MAAM,QAAQ;AAAA,IACvB,IAAIA,SAAQ,UAAU;AACpB,UAAI,QAAQ,IAAIA,SAAQ,QAAQ,GAAG;AACjC,eAAO,QAAQ,IAAIA,SAAQ,QAAQ;AAAA,MACrC,WAAW,aAAa,QAAQ;AAC9B,eAAO;AAAA,MACT,OAAO;AACL,eAAO,cAAc,OAAO,QAAQ,CAAC;AAAA,MACvC;AAAA,IACF;AAAA,EACF,CAAC;AACH;;;AC7DO,SAAS,KAAK,SAAyB;AAC5C,QAAM,IAAI,MAAM,WAAW,QAAQ;AACrC;AAGO,SAAS,cAAc,YAAqB,UAAiD;AAClG,SAAO;AAAA,IACL;AAAA,IACA,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,QAAQ,MAAM,SAAS,CAAC,UAAU;AAAA,EACpC;AACF;AAuCO,SAAS,UAAU,aAAmC,MAAa;AACxE,SAAO,YAAY,SAAS,GAAG,IAAI;AACrC;AAKO,SAAS,SAAY,UAA0B;AACpD,SAAO,OAAO,oBAAoB,QAAQ;AAC5C;AAGO,IAAM,UAAU,CAAuB,KAAQ,EAAE,CAAC,MAAM,GAAG,GAAG,IAAI,MAAS;AAE3E,IAAM,OAAO,IAAI,MAAW;AAAC;AAM7B,SAAS,YAA8B,KAAoB;AAChE,SAAO,OAAO,QAAQ,GAAG;AAC3B;AAEO,IAAM,WAAN,MAAiD;AAAA,EACtD,IAAI,UAAa;AACf,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC3C;AAAA,EAEA,IAAI,QAAQ,GAAG;AACb,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC3C;AACF;AAEO,IAAM,gBAAgB,CAAC,QAAgB,oBAAoB,KAAK,GAAG;AAMnE,SAAS,UAAU,KAA8C;AACtE,SAAO,OAAO,QAAQ,YAAY,UAAU,OAAO,OAAO,IAAI,SAAS;AACzE;AAEO,SAAS,WAAW,GAAuB;AAChD,SAAO,OAAO,MAAM;AACtB;AAEO,SAAS,UAAyB,OAAyC;AAChF,SAAO,UAAU,QAAQ,UAAU;AACrC;AAEO,SAAS,UAAU,OAA2B,MAAc,YAA6B;AAC9F,OAAK,MAAM,QAAQ,KAAK,IAAI,MAAM,SAAS,WAAW,EAAG,QAAO;AAChE,SAAO,cAAc,GAAG,IAAI;AAC9B;","names":["object"]}
|
package/dist/index.cjs
CHANGED
|
@@ -4388,6 +4388,7 @@ function fail(message) {
|
|
|
4388
4388
|
function toToggleState(isSelected, onChange) {
|
|
4389
4389
|
return {
|
|
4390
4390
|
isSelected,
|
|
4391
|
+
defaultSelected: false,
|
|
4391
4392
|
setSelected: onChange,
|
|
4392
4393
|
toggle: () => onChange(!isSelected)
|
|
4393
4394
|
};
|
|
@@ -8501,7 +8502,7 @@ var RowState = class {
|
|
|
8501
8502
|
}
|
|
8502
8503
|
}
|
|
8503
8504
|
/** Used by node when doing `console.log(rs)`. */
|
|
8504
|
-
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
8505
|
+
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
|
|
8505
8506
|
return `RowState@${this.row.id}`;
|
|
8506
8507
|
}
|
|
8507
8508
|
};
|
|
@@ -9077,7 +9078,7 @@ function Menu(props) {
|
|
|
9077
9078
|
const { items: items2, ...others } = tree;
|
|
9078
9079
|
const [itemsSection, persistentSection] = items2;
|
|
9079
9080
|
if (search) {
|
|
9080
|
-
const filteredChildren = itemsSection.children.filter((item) => contains(item.value.label, search));
|
|
9081
|
+
const filteredChildren = (itemsSection.children ?? []).filter((item) => contains(item.value.label, search));
|
|
9081
9082
|
const { items: items3, ...otherValues } = itemsSection.value;
|
|
9082
9083
|
const filteredValue = items3?.filter((item) => contains(item.label, search));
|
|
9083
9084
|
return {
|
|
@@ -9518,18 +9519,21 @@ function ListBoxChip({ label }) {
|
|
|
9518
9519
|
}
|
|
9519
9520
|
|
|
9520
9521
|
// src/inputs/Value.ts
|
|
9522
|
+
var VALUE_PREFIX = "__VALUE--";
|
|
9521
9523
|
function keyToValue(key) {
|
|
9522
9524
|
if (typeof key === "number") {
|
|
9523
9525
|
return key;
|
|
9524
9526
|
} else if (typeof key === "string") {
|
|
9525
|
-
if (key === "__VALUE:null") {
|
|
9527
|
+
if (key === `${VALUE_PREFIX}null` || key === "__VALUE:null") {
|
|
9526
9528
|
return null;
|
|
9527
|
-
} else if (key === "__VALUE:undefined") {
|
|
9529
|
+
} else if (key === `${VALUE_PREFIX}undefined` || key === "__VALUE:undefined") {
|
|
9528
9530
|
return void 0;
|
|
9529
|
-
} else if (key.startsWith("__VALUE:boolean:")) {
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9531
|
+
} else if (key.startsWith(`${VALUE_PREFIX}boolean--`) || key.startsWith("__VALUE:boolean:")) {
|
|
9532
|
+
const parts = key.includes("--boolean--") ? key.split("--") : key.split(":");
|
|
9533
|
+
return parts[parts.length - 1] === "true";
|
|
9534
|
+
} else if (key.startsWith(`${VALUE_PREFIX}number--`) || key.startsWith("__VALUE:number:")) {
|
|
9535
|
+
const parts = key.includes("--number--") ? key.split("--") : key.split(":");
|
|
9536
|
+
return Number(parts[parts.length - 1]);
|
|
9533
9537
|
} else {
|
|
9534
9538
|
return key;
|
|
9535
9539
|
}
|
|
@@ -9541,13 +9545,13 @@ function valueToKey(value) {
|
|
|
9541
9545
|
if (typeof value === "string") {
|
|
9542
9546
|
return value;
|
|
9543
9547
|
} else if (typeof value === "number") {
|
|
9544
|
-
return
|
|
9548
|
+
return `${VALUE_PREFIX}number--${value}`;
|
|
9545
9549
|
} else if (typeof value === "boolean") {
|
|
9546
|
-
return
|
|
9550
|
+
return `${VALUE_PREFIX}boolean--${value}`;
|
|
9547
9551
|
} else if (value === null) {
|
|
9548
|
-
return
|
|
9552
|
+
return `${VALUE_PREFIX}null`;
|
|
9549
9553
|
} else if (value === void 0) {
|
|
9550
|
-
return
|
|
9554
|
+
return `${VALUE_PREFIX}undefined`;
|
|
9551
9555
|
} else {
|
|
9552
9556
|
throw new Error(`Unsupported value ${value}`);
|
|
9553
9557
|
}
|
|
@@ -10118,7 +10122,8 @@ function VirtualizedOptions(props) {
|
|
|
10118
10122
|
allowCollapsing
|
|
10119
10123
|
} = props;
|
|
10120
10124
|
const virtuosoRef = (0, import_react45.useRef)(null);
|
|
10121
|
-
const
|
|
10125
|
+
const focusedKey = state.selectionManager.focusedKey;
|
|
10126
|
+
const focusedItem = focusedKey != null ? state.collection.getItem(focusedKey) : null;
|
|
10122
10127
|
const selectedItem = state.selectionManager.selectedKeys.size > 0 ? state.collection.getItem([...state.selectionManager.selectedKeys.values()][0]) : void 0;
|
|
10123
10128
|
(0, import_react45.useEffect)(
|
|
10124
10129
|
() => {
|
|
@@ -10562,23 +10567,22 @@ function TreeSelectFieldBase(props) {
|
|
|
10562
10567
|
}));
|
|
10563
10568
|
}
|
|
10564
10569
|
}
|
|
10570
|
+
const comboBoxChildren = (0, import_react47.useCallback)(
|
|
10571
|
+
([item]) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_stately6.Item, { textValue: getOptionLabel(item), children: getOptionMenuLabel(item) }, valueToKey(getOptionValue(item))),
|
|
10572
|
+
[getOptionValue, getOptionLabel, getOptionMenuLabel]
|
|
10573
|
+
);
|
|
10565
10574
|
const comboBoxProps = {
|
|
10566
10575
|
...otherProps,
|
|
10567
10576
|
disabledKeys: Object.keys(disabledOptionsWithReasons),
|
|
10568
10577
|
placeholder: !values || values.length === 0 ? placeholder : "",
|
|
10569
10578
|
label: props.label,
|
|
10570
10579
|
inputValue: fieldState.inputValue,
|
|
10571
|
-
// where we might want to do flatmap and return diff kind of array (children ? add level prop) inside children callback - can put markup wrapper div adds padding
|
|
10572
|
-
// so we're not doing it multiple places
|
|
10573
10580
|
items: fieldState.filteredOptions,
|
|
10574
10581
|
isDisabled,
|
|
10575
10582
|
isReadOnly,
|
|
10576
10583
|
onInputChange,
|
|
10577
10584
|
onOpenChange,
|
|
10578
|
-
children:
|
|
10579
|
-
// what we're telling it to render. look at padding here - don't have to pass down to tree option - filtered options is where we're flat mapping
|
|
10580
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_stately6.Item, { textValue: getOptionLabel(item), children: getOptionMenuLabel(item) }, valueToKey(getOptionValue(item)))
|
|
10581
|
-
)
|
|
10585
|
+
children: comboBoxChildren
|
|
10582
10586
|
};
|
|
10583
10587
|
const state = (0, import_react_stately6.useComboBoxState)({
|
|
10584
10588
|
...comboBoxProps,
|
|
@@ -10588,6 +10592,7 @@ function TreeSelectFieldBase(props) {
|
|
|
10588
10592
|
state.selectionManager.state = (0, import_react_stately6.useMultipleSelectionState)({
|
|
10589
10593
|
selectionMode: "multiple",
|
|
10590
10594
|
selectedKeys: fieldState.selectedKeys,
|
|
10595
|
+
disabledKeys: Object.keys(disabledOptionsWithReasons),
|
|
10591
10596
|
onSelectionChange: (newKeys) => {
|
|
10592
10597
|
if (newKeys === "all") {
|
|
10593
10598
|
return;
|
|
@@ -10880,7 +10885,9 @@ function ComboBoxInput(props) {
|
|
|
10880
10885
|
onKeyDown: (e) => {
|
|
10881
10886
|
if (isMultiSelect) {
|
|
10882
10887
|
if (isTree) {
|
|
10883
|
-
const
|
|
10888
|
+
const focusedKey = state.selectionManager.focusedKey;
|
|
10889
|
+
if (focusedKey == null) return;
|
|
10890
|
+
const item = state.collection.getItem(focusedKey);
|
|
10884
10891
|
if (item && (e.key === "ArrowRight" || e.key === "ArrowLeft")) {
|
|
10885
10892
|
if (!isLeveledNode(item)) return;
|
|
10886
10893
|
const leveledOption = item.value;
|
|
@@ -10902,7 +10909,10 @@ function ComboBoxInput(props) {
|
|
|
10902
10909
|
if (state.isOpen) {
|
|
10903
10910
|
e.preventDefault();
|
|
10904
10911
|
}
|
|
10905
|
-
state.selectionManager.
|
|
10912
|
+
const focusedKey = state.selectionManager.focusedKey;
|
|
10913
|
+
if (focusedKey != null) {
|
|
10914
|
+
state.selectionManager.toggleSelection(focusedKey);
|
|
10915
|
+
}
|
|
10906
10916
|
return;
|
|
10907
10917
|
}
|
|
10908
10918
|
if (e.key === "Escape") {
|
|
@@ -11090,6 +11100,10 @@ function ComboBoxBase(props) {
|
|
|
11090
11100
|
const listBoxRef = (0, import_react49.useRef)(null);
|
|
11091
11101
|
const popoverRef = (0, import_react49.useRef)(null);
|
|
11092
11102
|
const disabledOptionsWithReasons = Object.fromEntries(disabledOptions?.map(disabledOptionToKeyedTuple) ?? []);
|
|
11103
|
+
const comboBoxChildren = (0, import_react49.useCallback)(
|
|
11104
|
+
(item) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react_stately7.Item, { textValue: getOptionLabel(item), children: getOptionMenuLabel(item) }, valueToKey(getOptionValue(item))),
|
|
11105
|
+
[getOptionValue, getOptionLabel, getOptionMenuLabel]
|
|
11106
|
+
);
|
|
11093
11107
|
const comboBoxProps = {
|
|
11094
11108
|
...otherProps,
|
|
11095
11109
|
disabledKeys: Object.keys(disabledOptionsWithReasons),
|
|
@@ -11099,7 +11113,7 @@ function ComboBoxBase(props) {
|
|
|
11099
11113
|
isReadOnly,
|
|
11100
11114
|
onInputChange,
|
|
11101
11115
|
onOpenChange,
|
|
11102
|
-
children:
|
|
11116
|
+
children: comboBoxChildren
|
|
11103
11117
|
};
|
|
11104
11118
|
const state = (0, import_react_stately7.useComboBoxState)({
|
|
11105
11119
|
...comboBoxProps,
|
|
@@ -11124,7 +11138,8 @@ function ComboBoxBase(props) {
|
|
|
11124
11138
|
// Do not allow an empty selection if single select mode
|
|
11125
11139
|
disallowEmptySelection: !multiselect,
|
|
11126
11140
|
selectedKeys,
|
|
11127
|
-
onSelectionChange
|
|
11141
|
+
onSelectionChange,
|
|
11142
|
+
disabledKeys: Object.keys(disabledOptionsWithReasons)
|
|
11128
11143
|
});
|
|
11129
11144
|
const [debouncedSearch] = (0, import_use_debounce5.useDebounce)(searchValue, 300);
|
|
11130
11145
|
(0, import_react49.useEffect)(() => {
|
|
@@ -11298,6 +11313,10 @@ function Autocomplete(props) {
|
|
|
11298
11313
|
...others
|
|
11299
11314
|
} = props;
|
|
11300
11315
|
const disabledOptionsWithReasons = Object.fromEntries(disabledOptions?.map(disabledOptionToKeyedTuple) ?? []);
|
|
11316
|
+
const comboBoxChildren = (0, import_react50.useCallback)(
|
|
11317
|
+
(item) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_stately8.Item, { textValue: getOptionLabel(item), children: getOptionMenuLabel ? getOptionMenuLabel(item) : getOptionLabel(item) }, getOptionValue(item)),
|
|
11318
|
+
[getOptionValue, getOptionLabel, getOptionMenuLabel]
|
|
11319
|
+
);
|
|
11301
11320
|
const comboBoxProps = {
|
|
11302
11321
|
isDisabled: !!disabled,
|
|
11303
11322
|
disabledKeys: Object.keys(disabledOptionsWithReasons),
|
|
@@ -11306,8 +11325,9 @@ function Autocomplete(props) {
|
|
|
11306
11325
|
items: options,
|
|
11307
11326
|
// Allow the user to type in a value that is not in the list. Allows for the text to stay in the input when the user clicks away
|
|
11308
11327
|
allowsCustomValue: true,
|
|
11309
|
-
children:
|
|
11328
|
+
children: comboBoxChildren,
|
|
11310
11329
|
onSelectionChange: (key) => {
|
|
11330
|
+
if (key == null) return;
|
|
11311
11331
|
const selectedItem = options.find((i) => getOptionValue(i) === key);
|
|
11312
11332
|
if (selectedItem) {
|
|
11313
11333
|
onInputChange(getOptionLabel(selectedItem));
|
|
@@ -12146,7 +12166,6 @@ function RadioGroupField(props) {
|
|
|
12146
12166
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Label, { label, ...labelProps, ...tid.label, hidden: labelStyle === "hidden" }),
|
|
12147
12167
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { ...radioGroupProps, children: [
|
|
12148
12168
|
options.map((option) => {
|
|
12149
|
-
const isDisabled = state.isDisabled || !!option.disabled;
|
|
12150
12169
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react58.Fragment, { children: maybeTooltip({
|
|
12151
12170
|
title: resolveTooltip(option.disabled),
|
|
12152
12171
|
placement: "bottom",
|
|
@@ -12155,7 +12174,8 @@ function RadioGroupField(props) {
|
|
|
12155
12174
|
{
|
|
12156
12175
|
parentId: name,
|
|
12157
12176
|
option,
|
|
12158
|
-
state
|
|
12177
|
+
state,
|
|
12178
|
+
isOptionDisabled: !!option.disabled,
|
|
12159
12179
|
...otherProps,
|
|
12160
12180
|
...tid[option.value]
|
|
12161
12181
|
}
|
|
@@ -12173,13 +12193,18 @@ function Radio(props) {
|
|
|
12173
12193
|
parentId,
|
|
12174
12194
|
option: { description, label, value },
|
|
12175
12195
|
state,
|
|
12196
|
+
isOptionDisabled,
|
|
12176
12197
|
...others
|
|
12177
12198
|
} = props;
|
|
12178
|
-
const disabled = state.isDisabled;
|
|
12179
12199
|
const labelId = `${parentId}-${value}-label`;
|
|
12180
12200
|
const descriptionId = `${parentId}-${value}-description`;
|
|
12181
12201
|
const ref = (0, import_react58.useRef)(null);
|
|
12182
|
-
const { inputProps } = (0, import_react_aria34.useRadio)(
|
|
12202
|
+
const { inputProps, isDisabled } = (0, import_react_aria34.useRadio)(
|
|
12203
|
+
{ value, "aria-labelledby": labelId, isDisabled: isOptionDisabled },
|
|
12204
|
+
state,
|
|
12205
|
+
ref
|
|
12206
|
+
);
|
|
12207
|
+
const disabled = isDisabled;
|
|
12183
12208
|
const { focusProps, isFocusVisible } = (0, import_react_aria34.useFocusRing)();
|
|
12184
12209
|
const { hoverProps, isHovered } = (0, import_react_aria34.useHover)({ isDisabled: disabled });
|
|
12185
12210
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("label", { css: Css.df.cursorPointer.mb1.if(disabled).add("cursor", "initial").$, ...hoverProps, children: [
|
|
@@ -17825,7 +17850,10 @@ function ButtonDatePicker(props) {
|
|
|
17825
17850
|
const { defaultOpen, disabled, trigger, onSelect, ...datePickerProps } = props;
|
|
17826
17851
|
const state = (0, import_react_stately18.useMenuTriggerState)({ isOpen: defaultOpen });
|
|
17827
17852
|
const buttonRef = (0, import_react105.useRef)(null);
|
|
17828
|
-
const {
|
|
17853
|
+
const {
|
|
17854
|
+
menuTriggerProps,
|
|
17855
|
+
menuProps: { autoFocus: _af, ...menuProps }
|
|
17856
|
+
} = (0, import_react_aria46.useMenuTrigger)({ isDisabled: !!disabled }, state, buttonRef);
|
|
17829
17857
|
const tid = useTestIds(
|
|
17830
17858
|
props,
|
|
17831
17859
|
isTextButton(trigger) ? defaultTestId(labelOr(trigger, "buttonDatePicker")) : isNavLinkButton(trigger) ? defaultTestId(trigger.navLabel) : isIconButton(trigger) ? trigger.icon : trigger.name
|