@planningcenter/tapestry 4.9.1-rc.0 → 4.9.1-rc.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"CollectionEditorsLazy.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/CollectionEditorsLazy.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAgD,MAAM,OAAO,CAAA;AAEpE,OAAO,KAAK,EACV,2BAA2B,EAG5B,MAAM,2BAA2B,CAAA;AAsBlC,wBAAgB,0BAA0B,CAAC,EACzC,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,GACN,EAAE,2BAA2B,qBA4C7B;AA+FD,wBAAgB,OAAO,sBAEtB;AAED,wBAAgB,SAAS,sBAMxB"}
1
+ {"version":3,"file":"CollectionEditorsLazy.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/CollectionEditorsLazy.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAgD,MAAM,OAAO,CAAA;AAGpE,OAAO,KAAK,EACV,2BAA2B,EAG5B,MAAM,2BAA2B,CAAA;AAsBlC,wBAAgB,0BAA0B,CAAC,EACzC,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,GACN,EAAE,2BAA2B,qBA4C7B;AA+FD,wBAAgB,OAAO,sBAOtB;AAED,wBAAgB,SAAS,sBAMxB"}
@@ -1,6 +1,9 @@
1
1
  import { ComboBoxItem } from '../combo-box/ComboBox.js';
2
+ import LoadingSpinner from '../internal/LoadingSpinner.js';
3
+ import '../internal/tooltip/Tooltip.js';
2
4
  import { useDebouncedValue } from '../../utilities/useDebouncedValue.js';
3
5
  import React__default, { useCallback, useState, useEffect } from 'react';
6
+ import styles from './CollectionEditorsLazy.module.css.js';
4
7
  import { CollectionEditorCombobox } from './CollectionEditorsShared.js';
5
8
  import { CollectionEditorCheckboxes, CollectionEditorRadios, CollectionEditorSelect } from './CollectionEditorsStatic.js';
6
9
  import { useLazyOptions } from './useLazyOptions.js';
@@ -77,10 +80,12 @@ function CollectionEditorComboboxLazy({ error, onCommit, options, query, loading
77
80
  }));
78
81
  }
79
82
  function Loading() {
80
- return React__default.createElement("div", { style: { color: "hotpink", fontWeight: "bold" } }, "Loading...");
83
+ return (React__default.createElement("div", { className: styles["loading"], role: "status" },
84
+ React__default.createElement("span", null, "Loading..."),
85
+ React__default.createElement(LoadingSpinner, null)));
81
86
  }
82
87
  function LoadError() {
83
- return (React__default.createElement("div", { style: { color: "hotpink", fontWeight: "bold" } }, "Failed to load options"));
88
+ return (React__default.createElement("div", { className: styles["load-error"], role: "alert" }, "Error: Failed to load options"));
84
89
  }
85
90
  function findLabelFromOptions(options, value, previous) {
86
91
  const previousLabelByValue = buildPreviousLabelByValue(previous);
@@ -1 +1 @@
1
- {"version":3,"file":"CollectionEditorsLazy.js","sources":["../../../src/components/DataTable/CollectionEditorsLazy.tsx"],"sourcesContent":["import { ComboBoxItem } from \"@components/combo-box\"\nimport { useDebouncedValue } from \"@utilities/useDebouncedValue\"\nimport React, { Key, useCallback, useEffect, useState } from \"react\"\n\nimport type {\n CollectionFilterEditorProps,\n CollectionFilterValue,\n CollectionOptionsLazy,\n} from \"./CollectionEditorsShared\"\nimport { CollectionEditorCombobox } from \"./CollectionEditorsShared\"\nimport {\n CollectionEditorCheckboxes,\n CollectionEditorRadios,\n CollectionEditorSelect,\n CollectionEditorStaticProps,\n} from \"./CollectionEditorsStatic\"\nimport { CollectionOption } from \"./collectionFilter\"\nimport type { ActiveFilterLabel } from \"./FilterTypes\"\nimport { useLazyOptions } from \"./useLazyOptions\"\nimport { isEmptyValue } from \"./utils\"\n\ntype CollectionEditorLazyProps = CollectionEditorStaticProps & {\n error: unknown\n loading: boolean\n query: string | undefined\n setQuery: (query: string | undefined) => void\n}\n\nconst DEBOUNCE_MS = 300\n\nexport function CollectionFilterEditorLazy({\n config,\n onChange,\n operator,\n value,\n filter,\n label,\n scope,\n}: CollectionFilterEditorProps) {\n const { display, multiple } = config\n const loadOptions = config.options as CollectionOptionsLazy\n const options = useCallback(\n (query?: string) => loadOptions(query, scope),\n [loadOptions, scope]\n )\n const [query, setQuery] = useState<string | undefined>()\n const debouncedQuery = useDebouncedValue(query, DEBOUNCE_MS)\n const {\n error,\n loading,\n options: resolvedOptions,\n } = useLazyOptions(options, debouncedQuery)\n const onCommit = useCallback(\n (newValue: CollectionFilterValue) => {\n const newLabel = findLabelFromOptions(resolvedOptions, newValue, {\n label,\n value,\n })\n return onChange(\n { label: newLabel, value: newValue },\n { complete: !isEmptyValue(newValue) }\n )\n },\n [resolvedOptions, onChange, value, label]\n )\n const Editor = getLazyEditor({ display, multiple })\n\n return (\n <Editor\n error={error}\n loading={loading}\n query={query}\n setQuery={setQuery}\n value={value}\n onCommit={onCommit}\n options={resolvedOptions}\n multiple={multiple}\n operator={operator}\n filterLabel={filter.label}\n filterName={filter.name}\n />\n )\n}\n\nfunction getLazyEditor({\n display,\n multiple,\n}: {\n display: string\n multiple: boolean\n}) {\n if (display === \"combobox\") return CollectionEditorComboboxLazy\n if (multiple) return CollectionEditorCheckboxesLazy\n if (display === \"checkboxes\") return CollectionEditorRadiosLazy // TODO: This looks like it might be a mistake, should it be CollectionEditorCheckboxes? or at least allow for `radios` as an option?\n return CollectionEditorSelectLazy\n}\n\nfunction CollectionEditorCheckboxesLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorCheckboxes {...props} />\n}\n\nfunction CollectionEditorRadiosLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorRadios {...props} />\n}\n\nfunction CollectionEditorSelectLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorSelect {...props} />\n}\n\nfunction CollectionEditorComboboxLazy({\n error,\n onCommit,\n options,\n query,\n loading,\n setQuery,\n ...props\n}: CollectionEditorLazyProps) {\n const [loadingState, setLoadingState] = useState<\n \"loading\" | \"filtering\" | \"idle\"\n >(loading ? \"loading\" : \"idle\")\n useEffect(() => {\n if (!loading) {\n setLoadingState(\"idle\")\n }\n }, [loading])\n\n return (\n <CollectionEditorCombobox\n {...props}\n loadingState={error ? \"error\" : loadingState}\n inputValue={query}\n onInputChange={(q: string) => {\n setLoadingState(\"filtering\")\n setQuery(q)\n }}\n onChange={(value: Key | Key[] | null) => {\n if (value === null) return\n\n const resolvedValue = Array.isArray(value)\n ? value.map(String)\n : String(value)\n onCommit(resolvedValue)\n }}\n items={options}\n renderEmptyState={error ? <LoadError /> : \"No results\"}\n >\n {(o) => {\n const option = o as CollectionOption\n return (\n <ComboBoxItem key={option.value} id={option.value}>\n {option.label}\n </ComboBoxItem>\n )\n }}\n </CollectionEditorCombobox>\n )\n}\n\nexport function Loading() {\n return <div style={{ color: \"hotpink\", fontWeight: \"bold\" }}>Loading...</div>\n}\n\nexport function LoadError() {\n return (\n <div style={{ color: \"hotpink\", fontWeight: \"bold\" }}>\n Failed to load options\n </div>\n )\n}\n\nfunction findLabelFromOptions(\n options: CollectionOption[],\n value: CollectionFilterValue,\n previous: { label?: ActiveFilterLabel; value: CollectionFilterValue }\n) {\n const previousLabelByValue = buildPreviousLabelByValue(previous)\n const labelFor = (v: string) =>\n options.find((option) => option.value === v)?.label ??\n previousLabelByValue.get(v)\n\n return Array.isArray(value)\n ? value.map(labelFor).filter((label) => label !== undefined)\n : labelFor(value)\n}\n\nfunction buildPreviousLabelByValue(previous: {\n label?: ActiveFilterLabel\n value: CollectionFilterValue\n}): Map<string, string | undefined> {\n const previousValues = normalizeValueToArray(previous.value)\n const previousLabels = normalizeValueToArray(previous.label)\n return new Map(previousValues.map((v, index) => [v, previousLabels[index]]))\n}\n\nfunction normalizeValueToArray(value: string | string[] | undefined): string[] {\n if (value === undefined) return []\n return Array.isArray(value) ? value : [value]\n}\n"],"names":["React"],"mappings":";;;;;;;;AA4BA,MAAM,WAAW,GAAG,GAAG;SAEP,0BAA0B,CAAC,EACzC,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,GACuB,EAAA;AAC5B,IAAA,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM;AACpC,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,OAAgC;IAC3D,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,KAAc,KAAK,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAC7C,CAAC,WAAW,EAAE,KAAK,CAAC,CACrB;IACD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAsB;IACxD,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC;AAC5D,IAAA,MAAM,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EAAE,eAAe,GACzB,GAAG,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC;AAC3C,IAAA,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,QAA+B,KAAI;AAClC,QAAA,MAAM,QAAQ,GAAG,oBAAoB,CAAC,eAAe,EAAE,QAAQ,EAAE;YAC/D,KAAK;YACL,KAAK;AACN,SAAA,CAAC;QACF,OAAO,QAAQ,CACb,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EACpC,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CACtC;IACH,CAAC,EACD,CAAC,eAAe,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAC1C;IACD,MAAM,MAAM,GAAG,aAAa,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IAEnD,QACEA,cAAA,CAAA,aAAA,CAAC,MAAM,E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,EAAA;IACC,MAAM,cAAc,GAAG,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC5D,MAAM,cAAc,GAAG,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC5D,OAAO,IAAI,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC9E;AAEA,SAAS,qBAAqB,CAAC,KAAoC,EAAA;IACjE,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,EAAE;AAClC,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC;AAC/C;;;;"}
1
+ {"version":3,"file":"CollectionEditorsLazy.js","sources":["../../../src/components/DataTable/CollectionEditorsLazy.tsx"],"sourcesContent":["import { ComboBoxItem } from \"@components/combo-box\"\nimport { LoadingSpinner } from \"@components/internal\"\nimport { useDebouncedValue } from \"@utilities/useDebouncedValue\"\nimport React, { Key, useCallback, useEffect, useState } from \"react\"\n\nimport styles from \"./CollectionEditorsLazy.module.css\"\nimport type {\n CollectionFilterEditorProps,\n CollectionFilterValue,\n CollectionOptionsLazy,\n} from \"./CollectionEditorsShared\"\nimport { CollectionEditorCombobox } from \"./CollectionEditorsShared\"\nimport {\n CollectionEditorCheckboxes,\n CollectionEditorRadios,\n CollectionEditorSelect,\n CollectionEditorStaticProps,\n} from \"./CollectionEditorsStatic\"\nimport { CollectionOption } from \"./collectionFilter\"\nimport type { ActiveFilterLabel } from \"./FilterTypes\"\nimport { useLazyOptions } from \"./useLazyOptions\"\nimport { isEmptyValue } from \"./utils\"\n\ntype CollectionEditorLazyProps = CollectionEditorStaticProps & {\n error: unknown\n loading: boolean\n query: string | undefined\n setQuery: (query: string | undefined) => void\n}\n\nconst DEBOUNCE_MS = 300\n\nexport function CollectionFilterEditorLazy({\n config,\n onChange,\n operator,\n value,\n filter,\n label,\n scope,\n}: CollectionFilterEditorProps) {\n const { display, multiple } = config\n const loadOptions = config.options as CollectionOptionsLazy\n const options = useCallback(\n (query?: string) => loadOptions(query, scope),\n [loadOptions, scope]\n )\n const [query, setQuery] = useState<string | undefined>()\n const debouncedQuery = useDebouncedValue(query, DEBOUNCE_MS)\n const {\n error,\n loading,\n options: resolvedOptions,\n } = useLazyOptions(options, debouncedQuery)\n const onCommit = useCallback(\n (newValue: CollectionFilterValue) => {\n const newLabel = findLabelFromOptions(resolvedOptions, newValue, {\n label,\n value,\n })\n return onChange(\n { label: newLabel, value: newValue },\n { complete: !isEmptyValue(newValue) }\n )\n },\n [resolvedOptions, onChange, value, label]\n )\n const Editor = getLazyEditor({ display, multiple })\n\n return (\n <Editor\n error={error}\n loading={loading}\n query={query}\n setQuery={setQuery}\n value={value}\n onCommit={onCommit}\n options={resolvedOptions}\n multiple={multiple}\n operator={operator}\n filterLabel={filter.label}\n filterName={filter.name}\n />\n )\n}\n\nfunction getLazyEditor({\n display,\n multiple,\n}: {\n display: string\n multiple: boolean\n}) {\n if (display === \"combobox\") return CollectionEditorComboboxLazy\n if (multiple) return CollectionEditorCheckboxesLazy\n if (display === \"checkboxes\") return CollectionEditorRadiosLazy // TODO: This looks like it might be a mistake, should it be CollectionEditorCheckboxes? or at least allow for `radios` as an option?\n return CollectionEditorSelectLazy\n}\n\nfunction CollectionEditorCheckboxesLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorCheckboxes {...props} />\n}\n\nfunction CollectionEditorRadiosLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorRadios {...props} />\n}\n\nfunction CollectionEditorSelectLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorSelect {...props} />\n}\n\nfunction CollectionEditorComboboxLazy({\n error,\n onCommit,\n options,\n query,\n loading,\n setQuery,\n ...props\n}: CollectionEditorLazyProps) {\n const [loadingState, setLoadingState] = useState<\n \"loading\" | \"filtering\" | \"idle\"\n >(loading ? \"loading\" : \"idle\")\n useEffect(() => {\n if (!loading) {\n setLoadingState(\"idle\")\n }\n }, [loading])\n\n return (\n <CollectionEditorCombobox\n {...props}\n loadingState={error ? \"error\" : loadingState}\n inputValue={query}\n onInputChange={(q: string) => {\n setLoadingState(\"filtering\")\n setQuery(q)\n }}\n onChange={(value: Key | Key[] | null) => {\n if (value === null) return\n\n const resolvedValue = Array.isArray(value)\n ? value.map(String)\n : String(value)\n onCommit(resolvedValue)\n }}\n items={options}\n renderEmptyState={error ? <LoadError /> : \"No results\"}\n >\n {(o) => {\n const option = o as CollectionOption\n return (\n <ComboBoxItem key={option.value} id={option.value}>\n {option.label}\n </ComboBoxItem>\n )\n }}\n </CollectionEditorCombobox>\n )\n}\n\nexport function Loading() {\n return (\n <div className={styles[\"loading\"]} role=\"status\">\n <span>Loading...</span>\n <LoadingSpinner />\n </div>\n )\n}\n\nexport function LoadError() {\n return (\n <div className={styles[\"load-error\"]} role=\"alert\">\n Error: Failed to load options\n </div>\n )\n}\n\nfunction findLabelFromOptions(\n options: CollectionOption[],\n value: CollectionFilterValue,\n previous: { label?: ActiveFilterLabel; value: CollectionFilterValue }\n) {\n const previousLabelByValue = buildPreviousLabelByValue(previous)\n const labelFor = (v: string) =>\n options.find((option) => option.value === v)?.label ??\n previousLabelByValue.get(v)\n\n return Array.isArray(value)\n ? value.map(labelFor).filter((label) => label !== undefined)\n : labelFor(value)\n}\n\nfunction buildPreviousLabelByValue(previous: {\n label?: ActiveFilterLabel\n value: CollectionFilterValue\n}): Map<string, string | undefined> {\n const previousValues = normalizeValueToArray(previous.value)\n const previousLabels = normalizeValueToArray(previous.label)\n return new Map(previousValues.map((v, index) => [v, previousLabels[index]]))\n}\n\nfunction normalizeValueToArray(value: string | string[] | undefined): string[] {\n if (value === undefined) return []\n return Array.isArray(value) ? value : [value]\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;AA8BA,MAAM,WAAW,GAAG,GAAG;SAEP,0BAA0B,CAAC,EACzC,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,GACuB,EAAA;AAC5B,IAAA,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM;AACpC,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,OAAgC;IAC3D,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,KAAc,KAAK,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAC7C,CAAC,WAAW,EAAE,KAAK,CAAC,CACrB;IACD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAsB;IACxD,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC;AAC5D,IAAA,MAAM,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EAAE,eAAe,GACzB,GAAG,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC;AAC3C,IAAA,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,QAA+B,KAAI;AAClC,QAAA,MAAM,QAAQ,GAAG,oBAAoB,CAAC,eAAe,EAAE,QAAQ,EAAE;YAC/D,KAAK;YACL,KAAK;AACN,SAAA,CAAC;QACF,OAAO,QAAQ,CACb,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EACpC,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CACtC;IACH,CAAC,EACD,CAAC,eAAe,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAC1C;IACD,MAAM,MAAM,GAAG,aAAa,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IAEnD,QACEA,cAAA,CAAA,aAAA,CAAC,MAA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AAC,CAAC,KAAK,KAAK,KAAK,KAAK,SAAS;AAC3D,UAAE,QAAQ,CAAC,KAAK,CAAC;AACrB;AAEA,SAAS,yBAAyB,CAAC,QAGlC,EAAA;IACC,MAAM,cAAc,GAAG,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC5D,MAAM,cAAc,GAAG,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC5D,OAAO,IAAI,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC9E;AAEA,SAAS,qBAAqB,CAAC,KAAoC,EAAA;IACjE,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,EAAE;AAClC,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC;AAC/C;;;;"}
@@ -0,0 +1,4 @@
1
+ var styles = {"loading":"loading-jQw94","load-error":"load-error-os-K9"};
2
+
3
+ export { styles as default };
4
+ //# sourceMappingURL=CollectionEditorsLazy.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollectionEditorsLazy.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
package/dist/index.css CHANGED
@@ -3363,13 +3363,17 @@ tds-sidenav-section:not(.hydrated) > [slot="ssr"]{
3363
3363
  background:transparent;
3364
3364
  }
3365
3365
  .tds-combo-box-empty-state{
3366
- position:relative;
3367
- min-block-size:var(--t-spacing-3);
3368
3366
  padding-block:var(--t-spacing-1);
3369
3367
  padding-inline:var(--t-spacing-2);
3370
3368
  font-size:var(--t-font-size-md);
3371
3369
  color:var(--t-text-color-secondary);
3372
3370
  }
3371
+ .tds-combo-box-empty-state:has(.tds-loading-spinner){
3372
+ --tds-loading-spinner-size:var(--t-spacing-3);
3373
+
3374
+ position:relative;
3375
+ min-block-size:var(--t-spacing-5);
3376
+ }
3373
3377
  .tds-combo-box-load-more{
3374
3378
  position:relative;
3375
3379
  min-block-size:calc(var(--t-spacing-3) + var(--t-spacing-1));