@cloudscape-design/components 3.0.676 → 3.0.678

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":"index.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMnD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,QAAA,MAAM,cAAc,qGA4CnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAOnD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,QAAA,MAAM,cAAc,qGAgDnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
@@ -3,6 +3,7 @@ import { __rest } from "tslib";
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import React from 'react';
5
5
  import InternalButtonDropdown from './internal';
6
+ import { hasCheckboxItems } from './utils/utils';
6
7
  import { getBaseProps } from '../internal/base-component';
7
8
  import { applyDisplayName } from '../internal/utils/apply-display-name';
8
9
  import useBaseComponent from '../internal/hooks/use-base-component';
@@ -10,6 +11,10 @@ const ButtonDropdown = React.forwardRef((_a, ref) => {
10
11
  var { items, variant = 'normal', loading = false, loadingText, disabled = false, expandableGroups = false, expandToViewport = false, ariaLabel, children, onItemClick, onItemFollow, mainAction } = _a, props = __rest(_a, ["items", "variant", "loading", "loadingText", "disabled", "expandableGroups", "expandToViewport", "ariaLabel", "children", "onItemClick", "onItemFollow", "mainAction"]);
11
12
  const baseComponentProps = useBaseComponent('ButtonDropdown', {
12
13
  props: { expandToViewport, expandableGroups, variant },
14
+ metadata: {
15
+ mainAction: !!mainAction,
16
+ checkboxItems: hasCheckboxItems(items),
17
+ },
13
18
  });
14
19
  const baseProps = getBaseProps(props);
15
20
  return (React.createElement(InternalButtonDropdown, Object.assign({}, baseProps, baseComponentProps, { ref: ref, items: items, variant: variant, loading: loading, loadingText: loadingText, disabled: disabled, expandableGroups: expandableGroups, expandToViewport: expandToViewport, ariaLabel: ariaLabel, onItemClick: onItemClick, onItemFollow: onItemFollow, mainAction: mainAction }), children));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/button-dropdown/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,sBAAsB,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAIpE,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CACrC,CACE,EAcsB,EACtB,GAAuC,EACvC,EAAE;QAhBF,EACE,KAAK,EACL,OAAO,GAAG,QAAQ,EAClB,OAAO,GAAG,KAAK,EACf,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,gBAAgB,GAAG,KAAK,EACxB,gBAAgB,GAAG,KAAK,EACxB,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,UAAU,OAEU,EADjB,KAAK,cAbV,wKAcC,CADS;IAIV,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,gBAAgB,EAAE;QAC5D,KAAK,EAAE,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE;KACvD,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACtC,OAAO,CACL,oBAAC,sBAAsB,oBACjB,SAAS,EACT,kBAAkB,IACtB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,KAErB,QAAQ,CACc,CAC1B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { ButtonDropdownProps } from './interfaces';\nimport InternalButtonDropdown from './internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { ButtonDropdownProps };\n\nconst ButtonDropdown = React.forwardRef(\n (\n {\n items,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n expandableGroups = false,\n expandToViewport = false,\n ariaLabel,\n children,\n onItemClick,\n onItemFollow,\n mainAction,\n ...props\n }: ButtonDropdownProps,\n ref: React.Ref<ButtonDropdownProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('ButtonDropdown', {\n props: { expandToViewport, expandableGroups, variant },\n });\n const baseProps = getBaseProps(props);\n return (\n <InternalButtonDropdown\n {...baseProps}\n {...baseComponentProps}\n ref={ref}\n items={items}\n variant={variant}\n loading={loading}\n loadingText={loadingText}\n disabled={disabled}\n expandableGroups={expandableGroups}\n expandToViewport={expandToViewport}\n ariaLabel={ariaLabel}\n onItemClick={onItemClick}\n onItemFollow={onItemFollow}\n mainAction={mainAction}\n >\n {children}\n </InternalButtonDropdown>\n );\n }\n);\n\napplyDisplayName(ButtonDropdown, 'ButtonDropdown');\nexport default ButtonDropdown;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/button-dropdown/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,sBAAsB,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAIpE,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CACrC,CACE,EAcsB,EACtB,GAAuC,EACvC,EAAE;QAhBF,EACE,KAAK,EACL,OAAO,GAAG,QAAQ,EAClB,OAAO,GAAG,KAAK,EACf,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,gBAAgB,GAAG,KAAK,EACxB,gBAAgB,GAAG,KAAK,EACxB,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,UAAU,OAEU,EADjB,KAAK,cAbV,wKAcC,CADS;IAIV,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,gBAAgB,EAAE;QAC5D,KAAK,EAAE,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE;QACtD,QAAQ,EAAE;YACR,UAAU,EAAE,CAAC,CAAC,UAAU;YACxB,aAAa,EAAE,gBAAgB,CAAC,KAAK,CAAC;SACvC;KACF,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACtC,OAAO,CACL,oBAAC,sBAAsB,oBACjB,SAAS,EACT,kBAAkB,IACtB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,KAErB,QAAQ,CACc,CAC1B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { ButtonDropdownProps } from './interfaces';\nimport InternalButtonDropdown from './internal';\nimport { hasCheckboxItems } from './utils/utils';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { ButtonDropdownProps };\n\nconst ButtonDropdown = React.forwardRef(\n (\n {\n items,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n expandableGroups = false,\n expandToViewport = false,\n ariaLabel,\n children,\n onItemClick,\n onItemFollow,\n mainAction,\n ...props\n }: ButtonDropdownProps,\n ref: React.Ref<ButtonDropdownProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('ButtonDropdown', {\n props: { expandToViewport, expandableGroups, variant },\n metadata: {\n mainAction: !!mainAction,\n checkboxItems: hasCheckboxItems(items),\n },\n });\n const baseProps = getBaseProps(props);\n return (\n <InternalButtonDropdown\n {...baseProps}\n {...baseComponentProps}\n ref={ref}\n items={items}\n variant={variant}\n loading={loading}\n loadingText={loadingText}\n disabled={disabled}\n expandableGroups={expandableGroups}\n expandToViewport={expandToViewport}\n ariaLabel={ariaLabel}\n onItemClick={onItemClick}\n onItemFollow={onItemFollow}\n mainAction={mainAction}\n >\n {children}\n </InternalButtonDropdown>\n );\n }\n);\n\napplyDisplayName(ButtonDropdown, 'ButtonDropdown');\nexport default ButtonDropdown;\n"]}
@@ -7,5 +7,6 @@ interface ItemsTreeApi {
7
7
  getParentIndex: (item: ButtonDropdownProps.ItemOrGroup) => TreeIndex | null;
8
8
  }
9
9
  export default function createItemsTree(items: ButtonDropdownProps.Items): ItemsTreeApi;
10
+ export declare function traverseItems(items: ButtonDropdownProps.Items, act: (item: ButtonDropdownProps.ItemOrGroup, index: TreeIndex) => void, parentIndex?: TreeIndex): void;
10
11
  export {};
11
12
  //# sourceMappingURL=create-items-tree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-items-tree.d.ts","sourceRoot":"","sources":["../../../../src/button-dropdown/utils/create-items-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAMpD,MAAM,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC;AAEjC,UAAU,YAAY;IAEpB,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC;IAGtE,YAAY,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,WAAW,KAAK,SAAS,CAAC;IAEnE,kBAAkB,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,SAAS,GAAG,IAAI,CAAC;IAE9E,cAAc,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,WAAW,KAAK,SAAS,GAAG,IAAI,CAAC;CAC7E;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,EAAE,mBAAmB,CAAC,KAAK,GAAG,YAAY,CAwDtF"}
1
+ {"version":3,"file":"create-items-tree.d.ts","sourceRoot":"","sources":["../../../../src/button-dropdown/utils/create-items-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAMpD,MAAM,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC;AAEjC,UAAU,YAAY;IAEpB,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC;IAGtE,YAAY,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,WAAW,KAAK,SAAS,CAAC;IAEnE,kBAAkB,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,SAAS,GAAG,IAAI,CAAC;IAE9E,cAAc,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,WAAW,KAAK,SAAS,GAAG,IAAI,CAAC;CAC7E;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,EAAE,mBAAmB,CAAC,KAAK,GAAG,YAAY,CAwDtF;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,mBAAmB,CAAC,KAAK,EAChC,GAAG,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,KAAK,IAAI,EACtE,WAAW,GAAE,SAAc,QAU5B"}
@@ -46,7 +46,7 @@ export default function createItemsTree(items) {
46
46
  },
47
47
  };
48
48
  }
49
- function traverseItems(items, act, parentIndex = []) {
49
+ export function traverseItems(items, act, parentIndex = []) {
50
50
  items.forEach((item, index) => {
51
51
  const itemIndex = [...parentIndex, index];
52
52
  act(item, itemIndex);
@@ -1 +1 @@
1
- {"version":3,"file":"create-items-tree.js","sourceRoot":"","sources":["../../../../src/button-dropdown/utils/create-items-tree.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAqBtC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAgC;IACtE,MAAM,WAAW,GAAG,IAAI,GAAG,EAA2C,CAAC;IACvE,MAAM,WAAW,GAAG,IAAI,GAAG,EAA2C,CAAC;IACvE,MAAM,WAAW,GAAa,EAAE,CAAC;IA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CAAC,CAAC;YAEvC,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;aAC5D;YAED,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;YAEnC,YAAY;YACZ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;gBACtB,OAAO,IAAI,CAAC;aACb;YAED,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1C,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CACpB,KAAgC,EAChC,GAAsE,EACtE,cAAyB,EAAE;IAE3B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC5B,MAAM,SAAS,GAAG,CAAC,GAAG,WAAW,EAAE,KAAK,CAAC,CAAC;QAC1C,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAErB,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;YACrB,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;SAC3C;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,KAAgB;IACtC,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AAClD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { isItemGroup } from './utils';\nimport { ButtonDropdownProps } from '../interfaces';\n\n// The function turns a tree of items into a structure optimized for lookup of\n// items and corresponding indices as well as iteration on indices in the given order.\n\n// As trees are multidimensional, the index is represented as an array\nexport type TreeIndex = number[];\n\ninterface ItemsTreeApi {\n // Returns an item for the given tree index or null if not found\n getItem: (index: TreeIndex) => ButtonDropdownProps.ItemOrGroup | null;\n // Returns the tree index of the given item. The item must be present\n // in the tree (referential comparison), or an error will be thrown\n getItemIndex: (item: ButtonDropdownProps.ItemOrGroup) => TreeIndex;\n // Returns the index of next or previous sequential node or null if out of bounds\n getSequentialIndex: (index: TreeIndex, direction: -1 | 1) => TreeIndex | null;\n // Returns parent tree index of a given item or null if no parent is present\n getParentIndex: (item: ButtonDropdownProps.ItemOrGroup) => TreeIndex | null;\n}\n\nexport default function createItemsTree(items: ButtonDropdownProps.Items): ItemsTreeApi {\n const itemToIndex = new Map<ButtonDropdownProps.ItemOrGroup, string>();\n const indexToItem = new Map<string, ButtonDropdownProps.ItemOrGroup>();\n const flatIndices: string[] = [];\n\n traverseItems(items, (item, index) => {\n const indexKey = stringifyIndex(index);\n itemToIndex.set(item, indexKey);\n indexToItem.set(indexKey, item);\n flatIndices.push(indexKey);\n });\n\n return {\n getItem: (index: TreeIndex): ButtonDropdownProps.ItemOrGroup | null => {\n const indexKey = stringifyIndex(index);\n\n return indexToItem.get(indexKey) || null;\n },\n getItemIndex: (item: ButtonDropdownProps.ItemOrGroup): TreeIndex => {\n const indexKey = itemToIndex.get(item);\n\n if (!indexKey) {\n throw new Error('Invariant violation: item is not found.');\n }\n\n return parseIndex(indexKey);\n },\n getSequentialIndex: (index: TreeIndex, direction: -1 | 1): TreeIndex | null => {\n const indexKey = stringifyIndex(index);\n const position = flatIndices.indexOf(indexKey);\n\n const nextIndexKey = flatIndices[position + direction];\n\n if (!nextIndexKey) {\n return null;\n }\n\n return parseIndex(nextIndexKey);\n },\n getParentIndex: (item: ButtonDropdownProps.ItemOrGroup): TreeIndex | null => {\n const indexKey = itemToIndex.get(item);\n\n if (!indexKey) {\n throw new Error('Invariant violation: item is not found.');\n }\n\n const index = parseIndex(indexKey);\n\n // No parent\n if (index.length === 1) {\n return null;\n }\n\n return index.slice(0, index.length - 1);\n },\n };\n}\n\nfunction traverseItems(\n items: ButtonDropdownProps.Items,\n act: (item: ButtonDropdownProps.ItemOrGroup, index: TreeIndex) => void,\n parentIndex: TreeIndex = []\n) {\n items.forEach((item, index) => {\n const itemIndex = [...parentIndex, index];\n act(item, itemIndex);\n\n if (isItemGroup(item)) {\n traverseItems(item.items, act, itemIndex);\n }\n });\n}\n\nfunction stringifyIndex(index: TreeIndex): string {\n return index.join('-');\n}\n\nfunction parseIndex(index: string): TreeIndex {\n return index.split('-').map(it => parseInt(it));\n}\n"]}
1
+ {"version":3,"file":"create-items-tree.js","sourceRoot":"","sources":["../../../../src/button-dropdown/utils/create-items-tree.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAqBtC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAgC;IACtE,MAAM,WAAW,GAAG,IAAI,GAAG,EAA2C,CAAC;IACvE,MAAM,WAAW,GAAG,IAAI,GAAG,EAA2C,CAAC;IACvE,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,aAAa,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACnC,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;QACvC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAChC,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAChC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,CAAC,KAAgB,EAA0C,EAAE;YACpE,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;YAEvC,OAAO,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC;Q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EAAE,EAAE;QAC5B,MAAM,SAAS,GAAG,CAAC,GAAG,WAAW,EAAE,KAAK,CAAC,CAAC;QAC1C,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAErB,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;YACrB,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;SAC3C;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,KAAgB;IACtC,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AAClD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { isItemGroup } from './utils';\nimport { ButtonDropdownProps } from '../interfaces';\n\n// The function turns a tree of items into a structure optimized for lookup of\n// items and corresponding indices as well as iteration on indices in the given order.\n\n// As trees are multidimensional, the index is represented as an array\nexport type TreeIndex = number[];\n\ninterface ItemsTreeApi {\n // Returns an item for the given tree index or null if not found\n getItem: (index: TreeIndex) => ButtonDropdownProps.ItemOrGroup | null;\n // Returns the tree index of the given item. The item must be present\n // in the tree (referential comparison), or an error will be thrown\n getItemIndex: (item: ButtonDropdownProps.ItemOrGroup) => TreeIndex;\n // Returns the index of next or previous sequential node or null if out of bounds\n getSequentialIndex: (index: TreeIndex, direction: -1 | 1) => TreeIndex | null;\n // Returns parent tree index of a given item or null if no parent is present\n getParentIndex: (item: ButtonDropdownProps.ItemOrGroup) => TreeIndex | null;\n}\n\nexport default function createItemsTree(items: ButtonDropdownProps.Items): ItemsTreeApi {\n const itemToIndex = new Map<ButtonDropdownProps.ItemOrGroup, string>();\n const indexToItem = new Map<string, ButtonDropdownProps.ItemOrGroup>();\n const flatIndices: string[] = [];\n\n traverseItems(items, (item, index) => {\n const indexKey = stringifyIndex(index);\n itemToIndex.set(item, indexKey);\n indexToItem.set(indexKey, item);\n flatIndices.push(indexKey);\n });\n\n return {\n getItem: (index: TreeIndex): ButtonDropdownProps.ItemOrGroup | null => {\n const indexKey = stringifyIndex(index);\n\n return indexToItem.get(indexKey) || null;\n },\n getItemIndex: (item: ButtonDropdownProps.ItemOrGroup): TreeIndex => {\n const indexKey = itemToIndex.get(item);\n\n if (!indexKey) {\n throw new Error('Invariant violation: item is not found.');\n }\n\n return parseIndex(indexKey);\n },\n getSequentialIndex: (index: TreeIndex, direction: -1 | 1): TreeIndex | null => {\n const indexKey = stringifyIndex(index);\n const position = flatIndices.indexOf(indexKey);\n\n const nextIndexKey = flatIndices[position + direction];\n\n if (!nextIndexKey) {\n return null;\n }\n\n return parseIndex(nextIndexKey);\n },\n getParentIndex: (item: ButtonDropdownProps.ItemOrGroup): TreeIndex | null => {\n const indexKey = itemToIndex.get(item);\n\n if (!indexKey) {\n throw new Error('Invariant violation: item is not found.');\n }\n\n const index = parseIndex(indexKey);\n\n // No parent\n if (index.length === 1) {\n return null;\n }\n\n return index.slice(0, index.length - 1);\n },\n };\n}\n\nexport function traverseItems(\n items: ButtonDropdownProps.Items,\n act: (item: ButtonDropdownProps.ItemOrGroup, index: TreeIndex) => void,\n parentIndex: TreeIndex = []\n) {\n items.forEach((item, index) => {\n const itemIndex = [...parentIndex, index];\n act(item, itemIndex);\n\n if (isItemGroup(item)) {\n traverseItems(item.items, act, itemIndex);\n }\n });\n}\n\nfunction stringifyIndex(index: TreeIndex): string {\n return index.join('-');\n}\n\nfunction parseIndex(index: string): TreeIndex {\n return index.split('-').map(it => parseInt(it));\n}\n"]}
@@ -5,4 +5,5 @@ export declare const isCheckboxItem: (item: ButtonDropdownProps.ItemOrGroup) =>
5
5
  export declare const getItemTarget: (item: ButtonDropdownProps.Item) => "_blank" | undefined;
6
6
  export declare function indexIncludes(source: number[], target: number[]): boolean;
7
7
  export declare function indexEquals(left: number[], right: number[]): boolean;
8
+ export declare function hasCheckboxItems(items: ButtonDropdownProps.Items): boolean;
8
9
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/button-dropdown/utils/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9D,eAAO,MAAM,WAAW,SAAU,oBAAoB,WAAW,0CACI,CAAC;AAEtE,eAAO,MAAM,UAAU,SAAU,QAAQ,GAAG,oBAAoB,WAAW,qBAC5B,CAAC;AAEhD,eAAO,MAAM,cAAc,SAAU,oBAAoB,WAAW,6CACQ,CAAC;AAE7E,eAAO,MAAM,aAAa,SAAU,oBAAoB,IAAI,yBAA2C,CAAC;AAExG,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAQ/D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,WAY1D"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/button-dropdown/utils/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9D,eAAO,MAAM,WAAW,SAAU,oBAAoB,WAAW,0CACI,CAAC;AAEtE,eAAO,MAAM,UAAU,SAAU,QAAQ,GAAG,oBAAoB,WAAW,qBAC5B,CAAC;AAEhD,eAAO,MAAM,cAAc,SAAU,oBAAoB,WAAW,6CACQ,CAAC;AAE7E,eAAO,MAAM,aAAa,SAAU,oBAAoB,IAAI,yBAA2C,CAAC;AAExG,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAQ/D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,WAY1D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,CAAC,KAAK,WAQhE"}
@@ -1,3 +1,4 @@
1
+ import { traverseItems } from './create-items-tree';
1
2
  export const isItemGroup = (item) => item && item.items !== undefined;
2
3
  export const isLinkItem = (item) => item && item.href !== undefined;
3
4
  export const isCheckboxItem = (item) => item && item.itemType === 'checkbox';
@@ -21,4 +22,13 @@ export function indexEquals(left, right) {
21
22
  }
22
23
  return true;
23
24
  }
25
+ export function hasCheckboxItems(items) {
26
+ let hasCheckboxItems = false;
27
+ traverseItems(items, item => {
28
+ if (item.itemType === 'checkbox') {
29
+ hasCheckboxItems = true;
30
+ }
31
+ });
32
+ return hasCheckboxItems;
33
+ }
24
34
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/button-dropdown/utils/utils.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAqC,EAAyC,EAAE,CAC1G,IAAI,IAAK,IAAsC,CAAC,KAAK,KAAK,SAAS,CAAC;AAEtE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAgD,EAAoB,EAAE,CAC/F,IAAI,IAAK,IAAiB,CAAC,IAAI,KAAK,SAAS,CAAC;AAEhD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAqC,EAA4C,EAAE,CAChH,IAAI,IAAK,IAAyC,CAAC,QAAQ,KAAK,UAAU,CAAC;AAE7E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAA8B,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAExG,MAAM,UAAU,aAAa,CAAC,MAAgB,EAAE,MAAgB;IAC9D,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAClD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE;YACnC,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAc,EAAE,KAAe;IACzD,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE;QAChC,OAAO,KAAK,CAAC;KACd;IAED,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAChD,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,EAAE;YAChC,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonDropdownProps, LinkItem } from '../interfaces';\n\nexport const isItemGroup = (item: ButtonDropdownProps.ItemOrGroup): item is ButtonDropdownProps.ItemGroup =>\n item && (item as ButtonDropdownProps.ItemGroup).items !== undefined;\n\nexport const isLinkItem = (item: LinkItem | ButtonDropdownProps.ItemOrGroup): item is LinkItem =>\n item && (item as LinkItem).href !== undefined;\n\nexport const isCheckboxItem = (item: ButtonDropdownProps.ItemOrGroup): item is ButtonDropdownProps.CheckboxItem =>\n item && (item as ButtonDropdownProps.CheckboxItem).itemType === 'checkbox';\n\nexport const getItemTarget = (item: ButtonDropdownProps.Item) => (item.external ? '_blank' : undefined);\n\nexport function indexIncludes(source: number[], target: number[]) {\n for (let index = 0; index < source.length; index++) {\n if (source[index] !== target[index]) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function indexEquals(left: number[], right: number[]) {\n if (left.length !== right.length) {\n return false;\n }\n\n for (let index = 0; index < left.length; index++) {\n if (left[index] !== right[index]) {\n return false;\n }\n }\n\n return true;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/button-dropdown/utils/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAqC,EAAyC,EAAE,CAC1G,IAAI,IAAK,IAAsC,CAAC,KAAK,KAAK,SAAS,CAAC;AAEtE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAgD,EAAoB,EAAE,CAC/F,IAAI,IAAK,IAAiB,CAAC,IAAI,KAAK,SAAS,CAAC;AAEhD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAqC,EAA4C,EAAE,CAChH,IAAI,IAAK,IAAyC,CAAC,QAAQ,KAAK,UAAU,CAAC;AAE7E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAA8B,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAExG,MAAM,UAAU,aAAa,CAAC,MAAgB,EAAE,MAAgB;IAC9D,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAClD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE;YACnC,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAc,EAAE,KAAe;IACzD,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE;QAChC,OAAO,KAAK,CAAC;KACd;IAED,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAChD,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,EAAE;YAChC,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAgC;IAC/D,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAC7B,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;QAC1B,IAAI,IAAI,CAAC,QAAQ,KAAK,UAAU,EAAE;YAChC,gBAAgB,GAAG,IAAI,CAAC;SACzB;IACH,CAAC,CAAC,CAAC;IACH,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonDropdownProps, LinkItem } from '../interfaces';\nimport { traverseItems } from './create-items-tree';\n\nexport const isItemGroup = (item: ButtonDropdownProps.ItemOrGroup): item is ButtonDropdownProps.ItemGroup =>\n item && (item as ButtonDropdownProps.ItemGroup).items !== undefined;\n\nexport const isLinkItem = (item: LinkItem | ButtonDropdownProps.ItemOrGroup): item is LinkItem =>\n item && (item as LinkItem).href !== undefined;\n\nexport const isCheckboxItem = (item: ButtonDropdownProps.ItemOrGroup): item is ButtonDropdownProps.CheckboxItem =>\n item && (item as ButtonDropdownProps.CheckboxItem).itemType === 'checkbox';\n\nexport const getItemTarget = (item: ButtonDropdownProps.Item) => (item.external ? '_blank' : undefined);\n\nexport function indexIncludes(source: number[], target: number[]) {\n for (let index = 0; index < source.length; index++) {\n if (source[index] !== target[index]) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function indexEquals(left: number[], right: number[]) {\n if (left.length !== right.length) {\n return false;\n }\n\n for (let index = 0; index < left.length; index++) {\n if (left[index] !== right[index]) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function hasCheckboxItems(items: ButtonDropdownProps.Items) {\n let hasCheckboxItems = false;\n traverseItems(items, item => {\n if (item.itemType === 'checkbox') {\n hasCheckboxItems = true;\n }\n });\n return hasCheckboxItems;\n}\n"]}
@@ -1,37 +1,37 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "content-enter": "awsui_content-enter_gwq0h_tp82q_101",
5
- "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_gwq0h_tp82q_1",
6
- "trigger-expanded": "awsui_trigger-expanded_gwq0h_tp82q_123",
7
- "icon": "awsui_icon_gwq0h_tp82q_137",
8
- "root": "awsui_root_gwq0h_tp82q_155",
9
- "expand-button": "awsui_expand-button_gwq0h_tp82q_193",
10
- "expanded": "awsui_expanded_gwq0h_tp82q_201",
11
- "icon-container": "awsui_icon-container_gwq0h_tp82q_211",
12
- "icon-container-container": "awsui_icon-container-container_gwq0h_tp82q_215",
13
- "wrapper": "awsui_wrapper_gwq0h_tp82q_219",
14
- "wrapper-default": "awsui_wrapper-default_gwq0h_tp82q_227",
15
- "wrapper-footer": "awsui_wrapper-footer_gwq0h_tp82q_227",
16
- "wrapper-navigation": "awsui_wrapper-navigation_gwq0h_tp82q_231",
17
- "wrapper-container": "awsui_wrapper-container_gwq0h_tp82q_234",
18
- "wrapper-compact": "awsui_wrapper-compact_gwq0h_tp82q_238",
19
- "header-deprecated": "awsui_header-deprecated_gwq0h_tp82q_251",
20
- "wrapper-expanded": "awsui_wrapper-expanded_gwq0h_tp82q_273",
21
- "header": "awsui_header_gwq0h_tp82q_251",
22
- "header-wrapper": "awsui_header-wrapper_gwq0h_tp82q_293",
23
- "header-actions-wrapper": "awsui_header-actions-wrapper_gwq0h_tp82q_305",
24
- "header-button": "awsui_header-button_gwq0h_tp82q_310",
25
- "header-container-button": "awsui_header-container-button_gwq0h_tp82q_310",
26
- "header-container": "awsui_header-container_gwq0h_tp82q_310",
27
- "header-navigation": "awsui_header-navigation_gwq0h_tp82q_345",
28
- "header-text": "awsui_header-text_gwq0h_tp82q_382",
29
- "content": "awsui_content_gwq0h_tp82q_101",
30
- "content-default": "awsui_content-default_gwq0h_tp82q_389",
31
- "content-footer": "awsui_content-footer_gwq0h_tp82q_393",
32
- "content-expanded": "awsui_content-expanded_gwq0h_tp82q_397",
33
- "content-compact": "awsui_content-compact_gwq0h_tp82q_400",
34
- "focusable": "awsui_focusable_gwq0h_tp82q_404",
35
- "click-target": "awsui_click-target_gwq0h_tp82q_419"
4
+ "content-enter": "awsui_content-enter_gwq0h_8rjzz_101",
5
+ "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_gwq0h_8rjzz_1",
6
+ "trigger-expanded": "awsui_trigger-expanded_gwq0h_8rjzz_123",
7
+ "icon": "awsui_icon_gwq0h_8rjzz_137",
8
+ "root": "awsui_root_gwq0h_8rjzz_155",
9
+ "expand-button": "awsui_expand-button_gwq0h_8rjzz_193",
10
+ "expanded": "awsui_expanded_gwq0h_8rjzz_201",
11
+ "icon-container": "awsui_icon-container_gwq0h_8rjzz_211",
12
+ "icon-container-container": "awsui_icon-container-container_gwq0h_8rjzz_215",
13
+ "wrapper": "awsui_wrapper_gwq0h_8rjzz_219",
14
+ "wrapper-default": "awsui_wrapper-default_gwq0h_8rjzz_227",
15
+ "wrapper-footer": "awsui_wrapper-footer_gwq0h_8rjzz_227",
16
+ "wrapper-navigation": "awsui_wrapper-navigation_gwq0h_8rjzz_231",
17
+ "wrapper-container": "awsui_wrapper-container_gwq0h_8rjzz_234",
18
+ "wrapper-compact": "awsui_wrapper-compact_gwq0h_8rjzz_238",
19
+ "header-deprecated": "awsui_header-deprecated_gwq0h_8rjzz_251",
20
+ "wrapper-expanded": "awsui_wrapper-expanded_gwq0h_8rjzz_273",
21
+ "header": "awsui_header_gwq0h_8rjzz_251",
22
+ "header-wrapper": "awsui_header-wrapper_gwq0h_8rjzz_293",
23
+ "header-actions-wrapper": "awsui_header-actions-wrapper_gwq0h_8rjzz_305",
24
+ "header-button": "awsui_header-button_gwq0h_8rjzz_310",
25
+ "header-container-button": "awsui_header-container-button_gwq0h_8rjzz_310",
26
+ "header-container": "awsui_header-container_gwq0h_8rjzz_310",
27
+ "header-navigation": "awsui_header-navigation_gwq0h_8rjzz_345",
28
+ "header-text": "awsui_header-text_gwq0h_8rjzz_382",
29
+ "content": "awsui_content_gwq0h_8rjzz_101",
30
+ "content-default": "awsui_content-default_gwq0h_8rjzz_389",
31
+ "content-footer": "awsui_content-footer_gwq0h_8rjzz_393",
32
+ "content-expanded": "awsui_content-expanded_gwq0h_8rjzz_397",
33
+ "content-compact": "awsui_content-compact_gwq0h_8rjzz_400",
34
+ "focusable": "awsui_focusable_gwq0h_8rjzz_404",
35
+ "click-target": "awsui_click-target_gwq0h_8rjzz_419"
36
36
  };
37
37
 
@@ -98,10 +98,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
98
98
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
99
99
  SPDX-License-Identifier: Apache-2.0
100
100
  */
101
- .awsui_content-enter_gwq0h_tp82q_101:not(#\9) {
102
- animation: awsui_awsui-motion-fade-in_gwq0h_tp82q_1 var(--motion-duration-show-paced-q2lo2h, 180ms) var(--motion-easing-show-paced-ne2o0s, ease-out);
101
+ .awsui_content-enter_gwq0h_8rjzz_101:not(#\9) {
102
+ animation: awsui_awsui-motion-fade-in_gwq0h_8rjzz_1 var(--motion-duration-show-paced-q2lo2h, 180ms) var(--motion-easing-show-paced-ne2o0s, ease-out);
103
103
  }
104
- @keyframes awsui_awsui-motion-fade-in_gwq0h_tp82q_1 {
104
+ @keyframes awsui_awsui-motion-fade-in_gwq0h_8rjzz_1 {
105
105
  from {
106
106
  opacity: 0.2;
107
107
  }
@@ -110,40 +110,40 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
110
110
  }
111
111
  }
112
112
  @media (prefers-reduced-motion: reduce) {
113
- .awsui_content-enter_gwq0h_tp82q_101:not(#\9) {
113
+ .awsui_content-enter_gwq0h_8rjzz_101:not(#\9) {
114
114
  animation: none;
115
115
  transition: none;
116
116
  }
117
117
  }
118
- .awsui-motion-disabled .awsui_content-enter_gwq0h_tp82q_101:not(#\9), .awsui-mode-entering .awsui_content-enter_gwq0h_tp82q_101:not(#\9) {
118
+ .awsui-motion-disabled .awsui_content-enter_gwq0h_8rjzz_101:not(#\9), .awsui-mode-entering .awsui_content-enter_gwq0h_8rjzz_101:not(#\9) {
119
119
  animation: none;
120
120
  transition: none;
121
121
  }
122
122
 
123
- .awsui_trigger-expanded_gwq0h_tp82q_123:not(#\9) {
123
+ .awsui_trigger-expanded_gwq0h_8rjzz_123:not(#\9) {
124
124
  transition: border-bottom-color var(--motion-duration-show-paced-q2lo2h, 180ms) var(--motion-easing-show-paced-ne2o0s, ease-out);
125
125
  }
126
126
  @media (prefers-reduced-motion: reduce) {
127
- .awsui_trigger-expanded_gwq0h_tp82q_123:not(#\9) {
127
+ .awsui_trigger-expanded_gwq0h_8rjzz_123:not(#\9) {
128
128
  animation: none;
129
129
  transition: none;
130
130
  }
131
131
  }
132
- .awsui-motion-disabled .awsui_trigger-expanded_gwq0h_tp82q_123:not(#\9), .awsui-mode-entering .awsui_trigger-expanded_gwq0h_tp82q_123:not(#\9) {
132
+ .awsui-motion-disabled .awsui_trigger-expanded_gwq0h_8rjzz_123:not(#\9), .awsui-mode-entering .awsui_trigger-expanded_gwq0h_8rjzz_123:not(#\9) {
133
133
  animation: none;
134
134
  transition: none;
135
135
  }
136
136
 
137
- .awsui_icon_gwq0h_tp82q_137:not(#\9) {
137
+ .awsui_icon_gwq0h_8rjzz_137:not(#\9) {
138
138
  transition: transform var(--motion-duration-rotate-90-4ry26y, 135ms) var(--motion-easing-rotate-90-sb4dk7, cubic-bezier(0.165, 0.84, 0.44, 1));
139
139
  }
140
140
  @media (prefers-reduced-motion: reduce) {
141
- .awsui_icon_gwq0h_tp82q_137:not(#\9) {
141
+ .awsui_icon_gwq0h_8rjzz_137:not(#\9) {
142
142
  animation: none;
143
143
  transition: none;
144
144
  }
145
145
  }
146
- .awsui-motion-disabled .awsui_icon_gwq0h_tp82q_137:not(#\9), .awsui-mode-entering .awsui_icon_gwq0h_tp82q_137:not(#\9) {
146
+ .awsui-motion-disabled .awsui_icon_gwq0h_8rjzz_137:not(#\9), .awsui-mode-entering .awsui_icon_gwq0h_8rjzz_137:not(#\9) {
147
147
  animation: none;
148
148
  transition: none;
149
149
  }
@@ -152,7 +152,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
152
152
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
153
153
  SPDX-License-Identifier: Apache-2.0
154
154
  */
155
- .awsui_root_gwq0h_tp82q_155:not(#\9) {
155
+ .awsui_root_gwq0h_8rjzz_155:not(#\9) {
156
156
  border-collapse: separate;
157
157
  border-spacing: 0;
158
158
  box-sizing: border-box;
@@ -191,33 +191,33 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
191
191
  display: block;
192
192
  }
193
193
 
194
- .awsui_expand-button_gwq0h_tp82q_193:not(#\9) {
194
+ .awsui_expand-button_gwq0h_8rjzz_193:not(#\9) {
195
195
  outline: none;
196
196
  }
197
197
 
198
- .awsui_icon_gwq0h_tp82q_137:not(#\9) {
198
+ .awsui_icon_gwq0h_8rjzz_137:not(#\9) {
199
199
  transform: rotate(-90deg);
200
200
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
201
201
  }
202
- .awsui_icon_gwq0h_tp82q_137.awsui_expanded_gwq0h_tp82q_201:not(#\9) {
202
+ .awsui_icon_gwq0h_8rjzz_137.awsui_expanded_gwq0h_8rjzz_201:not(#\9) {
203
203
  transform: rotate(0deg);
204
204
  }
205
- .awsui_icon_gwq0h_tp82q_137:not(#\9):dir(rtl) {
205
+ .awsui_icon_gwq0h_8rjzz_137:not(#\9):dir(rtl) {
206
206
  transform: rotate(90deg);
207
207
  }
208
- .awsui_icon_gwq0h_tp82q_137:not(#\9):dir(rtl).awsui_expanded_gwq0h_tp82q_201 {
208
+ .awsui_icon_gwq0h_8rjzz_137:not(#\9):dir(rtl).awsui_expanded_gwq0h_8rjzz_201 {
209
209
  transform: rotate(0deg);
210
210
  }
211
211
 
212
- .awsui_icon-container_gwq0h_tp82q_211:not(#\9) {
212
+ .awsui_icon-container_gwq0h_8rjzz_211:not(#\9) {
213
213
  position: relative;
214
214
  margin-inline: calc((var(--line-height-body-m-30ar75, 20px) - var(--size-icon-normal-0m1722, 16px)) / -2) calc(var(--space-xxs-p8yyaw, 4px) + var(--border-divider-list-width-27y3k5, 1px));
215
215
  }
216
- .awsui_icon-container-container_gwq0h_tp82q_215:not(#\9) {
216
+ .awsui_icon-container-container_gwq0h_8rjzz_215:not(#\9) {
217
217
  margin-inline-end: var(--space-xs-zb16t3, 8px);
218
218
  }
219
219
 
220
- .awsui_wrapper_gwq0h_tp82q_219:not(#\9) {
220
+ .awsui_wrapper_gwq0h_8rjzz_219:not(#\9) {
221
221
  box-sizing: border-box;
222
222
  border-block: none;
223
223
  border-inline: none;
@@ -225,77 +225,77 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
225
225
  line-height: var(--line-height-body-m-30ar75, 20px);
226
226
  text-align: start;
227
227
  }
228
- .awsui_wrapper-default_gwq0h_tp82q_227:not(#\9), .awsui_wrapper-footer_gwq0h_tp82q_227:not(#\9) {
228
+ .awsui_wrapper-default_gwq0h_8rjzz_227:not(#\9), .awsui_wrapper-footer_gwq0h_8rjzz_227:not(#\9) {
229
229
  border-block: var(--border-divider-section-width-1061zr, 1px) solid transparent;
230
230
  border-inline: var(--border-divider-section-width-1061zr, 1px) solid transparent;
231
231
  }
232
- .awsui_wrapper-navigation_gwq0h_tp82q_231:not(#\9) {
232
+ .awsui_wrapper-navigation_gwq0h_8rjzz_231:not(#\9) {
233
233
  border-inline-start: var(--border-divider-section-width-1061zr, 1px) solid transparent;
234
234
  }
235
- .awsui_wrapper-navigation_gwq0h_tp82q_231:not(#\9), .awsui_wrapper-container_gwq0h_tp82q_234:not(#\9) {
235
+ .awsui_wrapper-navigation_gwq0h_8rjzz_231:not(#\9), .awsui_wrapper-container_gwq0h_8rjzz_234:not(#\9) {
236
236
  display: flex;
237
237
  font-weight: var(--font-weight-heading-s-cwn6wc, 700);
238
238
  }
239
- .awsui_wrapper-default_gwq0h_tp82q_227:not(#\9), .awsui_wrapper-navigation_gwq0h_tp82q_231:not(#\9), .awsui_wrapper-footer_gwq0h_tp82q_227:not(#\9), .awsui_wrapper-compact_gwq0h_tp82q_238:not(#\9) {
239
+ .awsui_wrapper-default_gwq0h_8rjzz_227:not(#\9), .awsui_wrapper-navigation_gwq0h_8rjzz_231:not(#\9), .awsui_wrapper-footer_gwq0h_8rjzz_227:not(#\9), .awsui_wrapper-compact_gwq0h_8rjzz_238:not(#\9) {
240
240
  color: var(--color-text-expandable-section-default-djhi83, #000716);
241
241
  -webkit-font-smoothing: var(--font-smoothing-webkit-m8nc84, antialiased);
242
242
  -moz-osx-font-smoothing: var(--font-smoothing-moz-osx-foywby, grayscale);
243
243
  }
244
- .awsui_wrapper-default_gwq0h_tp82q_227:not(#\9), .awsui_wrapper-navigation_gwq0h_tp82q_231:not(#\9), .awsui_wrapper-footer_gwq0h_tp82q_227:not(#\9) {
244
+ .awsui_wrapper-default_gwq0h_8rjzz_227:not(#\9), .awsui_wrapper-navigation_gwq0h_8rjzz_231:not(#\9), .awsui_wrapper-footer_gwq0h_8rjzz_227:not(#\9) {
245
245
  font-size: var(--font-expandable-heading-size-smdiul, 16px);
246
246
  letter-spacing: var(--letter-spacing-heading-s-jr3mor, -0.005em);
247
247
  }
248
- .awsui_wrapper-default_gwq0h_tp82q_227:not(#\9) {
248
+ .awsui_wrapper-default_gwq0h_8rjzz_227:not(#\9) {
249
249
  padding-block: var(--space-scaled-xxs-7597g1, 4px);
250
250
  padding-inline-end: var(--space-xxs-p8yyaw, 4px);
251
251
  }
252
- .awsui_wrapper-default_gwq0h_tp82q_227.awsui_header-deprecated_gwq0h_tp82q_251:not(#\9) {
252
+ .awsui_wrapper-default_gwq0h_8rjzz_227.awsui_header-deprecated_gwq0h_8rjzz_251:not(#\9) {
253
253
  padding-inline-start: var(--space-xxs-p8yyaw, 4px);
254
254
  }
255
- .awsui_wrapper-default_gwq0h_tp82q_227:not(#\9):not(.awsui_header-deprecated_gwq0h_tp82q_251) {
256
- padding-inline-start: calc(var(--space-xxs-p8yyaw, 4px) + calc(var(--size-icon-normal-0m1722, 16px) + (var(--line-height-body-m-30ar75, 20px) - var(--size-icon-normal-0m1722, 16px)) / -2 + var(--space-xxs-p8yyaw, 4px) + var(--border-divider-list-width-27y3k5, 1px)));
255
+ .awsui_wrapper-default_gwq0h_8rjzz_227:not(#\9):not(.awsui_header-deprecated_gwq0h_8rjzz_251) {
256
+ padding-inline-start: calc(var(--size-icon-normal-0m1722, 16px) + (var(--line-height-body-m-30ar75, 20px) - var(--size-icon-normal-0m1722, 16px)) / -2 + var(--space-xxs-p8yyaw, 4px) + var(--border-divider-list-width-27y3k5, 1px));
257
257
  }
258
- .awsui_wrapper-footer_gwq0h_tp82q_227:not(#\9) {
258
+ .awsui_wrapper-footer_gwq0h_8rjzz_227:not(#\9) {
259
259
  padding-block: var(--space-scaled-xxs-7597g1, 4px);
260
260
  }
261
- .awsui_wrapper-footer_gwq0h_tp82q_227:not(#\9), .awsui_wrapper-compact_gwq0h_tp82q_238:not(#\9) {
261
+ .awsui_wrapper-footer_gwq0h_8rjzz_227:not(#\9), .awsui_wrapper-compact_gwq0h_8rjzz_238:not(#\9) {
262
262
  padding-inline-end: 0;
263
263
  }
264
- .awsui_wrapper-footer_gwq0h_tp82q_227.awsui_header-deprecated_gwq0h_tp82q_251:not(#\9), .awsui_wrapper-compact_gwq0h_tp82q_238.awsui_header-deprecated_gwq0h_tp82q_251:not(#\9) {
264
+ .awsui_wrapper-footer_gwq0h_8rjzz_227.awsui_header-deprecated_gwq0h_8rjzz_251:not(#\9), .awsui_wrapper-compact_gwq0h_8rjzz_238.awsui_header-deprecated_gwq0h_8rjzz_251:not(#\9) {
265
265
  padding-inline-start: 0;
266
266
  }
267
- .awsui_wrapper-footer_gwq0h_tp82q_227:not(#\9):not(.awsui_header-deprecated_gwq0h_tp82q_251), .awsui_wrapper-compact_gwq0h_tp82q_238:not(#\9):not(.awsui_header-deprecated_gwq0h_tp82q_251) {
267
+ .awsui_wrapper-footer_gwq0h_8rjzz_227:not(#\9):not(.awsui_header-deprecated_gwq0h_8rjzz_251), .awsui_wrapper-compact_gwq0h_8rjzz_238:not(#\9):not(.awsui_header-deprecated_gwq0h_8rjzz_251) {
268
268
  padding-inline-start: calc(var(--size-icon-normal-0m1722, 16px) + (var(--line-height-body-m-30ar75, 20px) - var(--size-icon-normal-0m1722, 16px)) / -2 + var(--space-xxs-p8yyaw, 4px) + var(--border-divider-list-width-27y3k5, 1px));
269
269
  }
270
- .awsui_wrapper-container_gwq0h_tp82q_234:not(#\9) {
270
+ .awsui_wrapper-container_gwq0h_8rjzz_234:not(#\9) {
271
271
  padding-block: var(--space-container-header-top-5qav00, 12px) var(--space-container-header-bottom-vj01hn, 8px);
272
272
  padding-inline-end: var(--space-container-horizontal-wfukh3, 20px);
273
273
  }
274
- .awsui_wrapper-container_gwq0h_tp82q_234:not(#\9):not(.awsui_wrapper-expanded_gwq0h_tp82q_273) {
274
+ .awsui_wrapper-container_gwq0h_8rjzz_234:not(#\9):not(.awsui_wrapper-expanded_gwq0h_8rjzz_273) {
275
275
  padding-block-end: var(--space-container-header-top-5qav00, 12px);
276
276
  }
277
- .awsui_wrapper-container_gwq0h_tp82q_234.awsui_header-deprecated_gwq0h_tp82q_251:not(#\9) {
277
+ .awsui_wrapper-container_gwq0h_8rjzz_234.awsui_header-deprecated_gwq0h_8rjzz_251:not(#\9) {
278
278
  padding-inline-start: var(--space-container-horizontal-wfukh3, 20px);
279
279
  }
280
- .awsui_wrapper-container_gwq0h_tp82q_234:not(#\9):not(.awsui_header-deprecated_gwq0h_tp82q_251) {
280
+ .awsui_wrapper-container_gwq0h_8rjzz_234:not(#\9):not(.awsui_header-deprecated_gwq0h_8rjzz_251) {
281
281
  padding-inline-start: calc(var(--space-container-horizontal-wfukh3, 20px) + calc(var(--size-icon-medium-y9xuoq, 20px) + (var(--line-height-body-m-30ar75, 20px) - var(--size-icon-normal-0m1722, 16px)) / -2 + var(--space-xs-zb16t3, 8px)));
282
282
  }
283
- body[data-awsui-focus-visible=true] .awsui_wrapper-container_gwq0h_tp82q_234:not(#\9):focus {
283
+ body[data-awsui-focus-visible=true] .awsui_wrapper-container_gwq0h_8rjzz_234:not(#\9):focus {
284
284
  padding-block: calc(var(--space-scaled-s-aqzyko, 12px) - var(--border-divider-section-width-1061zr, 1px));
285
285
  padding-inline: calc(var(--space-l-t419sm, 20px) - var(--border-divider-section-width-1061zr, 1px));
286
286
  }
287
- .awsui_wrapper-default_gwq0h_tp82q_227.awsui_wrapper-expanded_gwq0h_tp82q_273:not(#\9) {
287
+ .awsui_wrapper-default_gwq0h_8rjzz_227.awsui_wrapper-expanded_gwq0h_8rjzz_273:not(#\9) {
288
288
  border-block-end-color: var(--color-border-divider-default-j74lyz, #b6bec9);
289
289
  }
290
290
 
291
- .awsui_header_gwq0h_tp82q_251:not(#\9) {
291
+ .awsui_header_gwq0h_8rjzz_251:not(#\9) {
292
292
  /* used in test-utils */
293
293
  }
294
- .awsui_header-wrapper_gwq0h_tp82q_293:not(#\9), .awsui_header-deprecated_gwq0h_tp82q_251:not(#\9) {
294
+ .awsui_header-wrapper_gwq0h_8rjzz_293:not(#\9), .awsui_header-deprecated_gwq0h_8rjzz_251:not(#\9) {
295
295
  display: flex;
296
296
  font-weight: var(--font-weight-heading-s-cwn6wc, 700);
297
297
  }
298
- .awsui_header-wrapper_gwq0h_tp82q_293:not(#\9) {
298
+ .awsui_header-wrapper_gwq0h_8rjzz_293:not(#\9) {
299
299
  font-size: inherit;
300
300
  letter-spacing: inherit;
301
301
  margin-block: 0;
@@ -303,19 +303,19 @@ body[data-awsui-focus-visible=true] .awsui_wrapper-container_gwq0h_tp82q_234:not
303
303
  padding-block: 0;
304
304
  padding-inline: 0;
305
305
  }
306
- .awsui_header-actions-wrapper_gwq0h_tp82q_305:not(#\9) {
306
+ .awsui_header-actions-wrapper_gwq0h_8rjzz_305:not(#\9) {
307
307
  display: flex;
308
308
  flex-direction: row;
309
309
  justify-content: space-between;
310
310
  }
311
- body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_tp82q_310:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_tp82q_310:not(#\9):focus {
311
+ body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_8rjzz_310:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_8rjzz_310:not(#\9):focus {
312
312
  position: relative;
313
313
  }
314
- body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_tp82q_310:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_tp82q_310:not(#\9):focus {
314
+ body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_8rjzz_310:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_8rjzz_310:not(#\9):focus {
315
315
  outline: 2px dotted transparent;
316
316
  outline-offset: calc(0px - 1px);
317
317
  }
318
- body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_tp82q_310:not(#\9):focus::before, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_tp82q_310:not(#\9):focus::before {
318
+ body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_8rjzz_310:not(#\9):focus::before, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_8rjzz_310:not(#\9):focus::before {
319
319
  content: " ";
320
320
  display: block;
321
321
  position: absolute;
@@ -329,21 +329,21 @@ body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_tp82q_310:not(#\9
329
329
  border-end-end-radius: var(--border-radius-control-default-focus-ring-u8zbsz, 4px);
330
330
  box-shadow: 0 0 0 2px var(--color-border-item-focused-b2ntyl, #0972d3);
331
331
  }
332
- .awsui_header-button_gwq0h_tp82q_310:not(#\9) {
332
+ .awsui_header-button_gwq0h_8rjzz_310:not(#\9) {
333
333
  box-sizing: border-box;
334
334
  display: flex;
335
335
  margin-inline-start: calc(-1 * calc(var(--size-icon-normal-0m1722, 16px) + (var(--line-height-body-m-30ar75, 20px) - var(--size-icon-normal-0m1722, 16px)) / -2 + var(--space-xxs-p8yyaw, 4px) + var(--border-divider-list-width-27y3k5, 1px)));
336
336
  }
337
- .awsui_header-container-button_gwq0h_tp82q_310:not(#\9) {
337
+ .awsui_header-container-button_gwq0h_8rjzz_310:not(#\9) {
338
338
  margin-inline-start: calc(-1 * calc(var(--size-icon-medium-y9xuoq, 20px) + (var(--line-height-body-m-30ar75, 20px) - var(--size-icon-normal-0m1722, 16px)) / -2 + var(--space-xs-zb16t3, 8px)));
339
339
  }
340
- .awsui_header-container_gwq0h_tp82q_310:not(#\9) {
340
+ .awsui_header-container_gwq0h_8rjzz_310:not(#\9) {
341
341
  inline-size: 100%;
342
342
  }
343
- .awsui_header-container_gwq0h_tp82q_310 > .awsui_icon-container_gwq0h_tp82q_211:not(#\9) {
343
+ .awsui_header-container_gwq0h_8rjzz_310 > .awsui_icon-container_gwq0h_8rjzz_211:not(#\9) {
344
344
  margin-block-start: var(--space-expandable-section-icon-offset-top-ekk5vc, 4px);
345
345
  }
346
- .awsui_header-navigation_gwq0h_tp82q_345 > .awsui_icon-container_gwq0h_tp82q_211:not(#\9) {
346
+ .awsui_header-navigation_gwq0h_8rjzz_345 > .awsui_icon-container_gwq0h_8rjzz_211:not(#\9) {
347
347
  display: inline-flex;
348
348
  cursor: pointer;
349
349
  color: var(--color-text-expandable-section-navigation-icon-default-htcovl, #414d5c);
@@ -356,17 +356,17 @@ body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_tp82q_310:not(#\9
356
356
  text-decoration: none;
357
357
  flex-direction: column;
358
358
  }
359
- .awsui_header-navigation_gwq0h_tp82q_345 > .awsui_icon-container_gwq0h_tp82q_211:not(#\9):hover {
359
+ .awsui_header-navigation_gwq0h_8rjzz_345 > .awsui_icon-container_gwq0h_8rjzz_211:not(#\9):hover {
360
360
  color: var(--color-text-expandable-section-hover-2d1zpj, #0972d3);
361
361
  }
362
- body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_tp82q_345 > .awsui_icon-container_gwq0h_tp82q_211:not(#\9):focus {
362
+ body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_8rjzz_345 > .awsui_icon-container_gwq0h_8rjzz_211:not(#\9):focus {
363
363
  position: relative;
364
364
  }
365
- body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_tp82q_345 > .awsui_icon-container_gwq0h_tp82q_211:not(#\9):focus {
365
+ body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_8rjzz_345 > .awsui_icon-container_gwq0h_8rjzz_211:not(#\9):focus {
366
366
  outline: 2px dotted transparent;
367
367
  outline-offset: calc(2px - 1px);
368
368
  }
369
- body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_tp82q_345 > .awsui_icon-container_gwq0h_tp82q_211:not(#\9):focus::before {
369
+ body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_8rjzz_345 > .awsui_icon-container_gwq0h_8rjzz_211:not(#\9):focus::before {
370
370
  content: " ";
371
371
  display: block;
372
372
  position: absolute;
@@ -380,33 +380,33 @@ body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_tp82q_345 > .
380
380
  border-end-end-radius: var(--border-radius-control-default-focus-ring-u8zbsz, 4px);
381
381
  box-shadow: 0 0 0 2px var(--color-border-item-focused-b2ntyl, #0972d3);
382
382
  }
383
- .awsui_header-text_gwq0h_tp82q_382:not(#\9) {
383
+ .awsui_header-text_gwq0h_8rjzz_382:not(#\9) {
384
384
  /* used in test-utils */
385
385
  }
386
386
 
387
- .awsui_content_gwq0h_tp82q_101:not(#\9) {
387
+ .awsui_content_gwq0h_8rjzz_101:not(#\9) {
388
388
  display: none;
389
389
  }
390
- .awsui_content-default_gwq0h_tp82q_389:not(#\9) {
390
+ .awsui_content-default_gwq0h_8rjzz_389:not(#\9) {
391
391
  padding-block: var(--space-scaled-xs-26e2du, 8px);
392
392
  padding-inline: 0;
393
393
  }
394
- .awsui_content-footer_gwq0h_tp82q_393:not(#\9) {
394
+ .awsui_content-footer_gwq0h_8rjzz_393:not(#\9) {
395
395
  padding-block: var(--space-xs-zb16t3, 8px);
396
396
  padding-inline: 0;
397
397
  }
398
- .awsui_content-expanded_gwq0h_tp82q_397:not(#\9) {
398
+ .awsui_content-expanded_gwq0h_8rjzz_397:not(#\9) {
399
399
  display: block;
400
400
  }
401
- .awsui_content-compact_gwq0h_tp82q_400:not(#\9) {
401
+ .awsui_content-compact_gwq0h_8rjzz_400:not(#\9) {
402
402
  padding-inline-start: calc(var(--size-icon-normal-0m1722, 16px) + (var(--line-height-body-m-30ar75, 20px) - var(--size-icon-normal-0m1722, 16px)) / -2 + var(--space-xxs-p8yyaw, 4px) + var(--border-divider-list-width-27y3k5, 1px));
403
403
  }
404
404
 
405
- .awsui_focusable_gwq0h_tp82q_404:not(#\9):focus {
405
+ .awsui_focusable_gwq0h_8rjzz_404:not(#\9):focus {
406
406
  outline: none;
407
407
  text-decoration: none;
408
408
  }
409
- body[data-awsui-focus-visible=true] .awsui_focusable_gwq0h_tp82q_404:not(#\9):focus {
409
+ body[data-awsui-focus-visible=true] .awsui_focusable_gwq0h_8rjzz_404:not(#\9):focus {
410
410
  outline: 2px dotted transparent;
411
411
  border-block: var(--border-field-width-09w7vk, 2px) solid var(--color-border-item-focused-b2ntyl, #0972d3);
412
412
  border-inline: var(--border-field-width-09w7vk, 2px) solid var(--color-border-item-focused-b2ntyl, #0972d3);
@@ -417,9 +417,9 @@ body[data-awsui-focus-visible=true] .awsui_focusable_gwq0h_tp82q_404:not(#\9):fo
417
417
  box-shadow: 0 0 0 var(--border-control-focus-ring-shadow-spread-0ctpjf, 0px) var(--color-border-item-focused-b2ntyl, #0972d3);
418
418
  }
419
419
 
420
- .awsui_click-target_gwq0h_tp82q_419:not(#\9) {
420
+ .awsui_click-target_gwq0h_8rjzz_419:not(#\9) {
421
421
  cursor: pointer;
422
422
  }
423
- .awsui_click-target_gwq0h_tp82q_419:not(#\9):not(.awsui_wrapper-container_gwq0h_tp82q_234):not(.awsui_header-container-button_gwq0h_tp82q_310):hover {
423
+ .awsui_click-target_gwq0h_8rjzz_419:not(#\9):not(.awsui_wrapper-container_gwq0h_8rjzz_234):not(.awsui_header-container-button_gwq0h_8rjzz_310):hover {
424
424
  color: var(--color-text-expandable-section-hover-2d1zpj, #0972d3);
425
425
  }
@@ -2,37 +2,37 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "content-enter": "awsui_content-enter_gwq0h_tp82q_101",
6
- "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_gwq0h_tp82q_1",
7
- "trigger-expanded": "awsui_trigger-expanded_gwq0h_tp82q_123",
8
- "icon": "awsui_icon_gwq0h_tp82q_137",
9
- "root": "awsui_root_gwq0h_tp82q_155",
10
- "expand-button": "awsui_expand-button_gwq0h_tp82q_193",
11
- "expanded": "awsui_expanded_gwq0h_tp82q_201",
12
- "icon-container": "awsui_icon-container_gwq0h_tp82q_211",
13
- "icon-container-container": "awsui_icon-container-container_gwq0h_tp82q_215",
14
- "wrapper": "awsui_wrapper_gwq0h_tp82q_219",
15
- "wrapper-default": "awsui_wrapper-default_gwq0h_tp82q_227",
16
- "wrapper-footer": "awsui_wrapper-footer_gwq0h_tp82q_227",
17
- "wrapper-navigation": "awsui_wrapper-navigation_gwq0h_tp82q_231",
18
- "wrapper-container": "awsui_wrapper-container_gwq0h_tp82q_234",
19
- "wrapper-compact": "awsui_wrapper-compact_gwq0h_tp82q_238",
20
- "header-deprecated": "awsui_header-deprecated_gwq0h_tp82q_251",
21
- "wrapper-expanded": "awsui_wrapper-expanded_gwq0h_tp82q_273",
22
- "header": "awsui_header_gwq0h_tp82q_251",
23
- "header-wrapper": "awsui_header-wrapper_gwq0h_tp82q_293",
24
- "header-actions-wrapper": "awsui_header-actions-wrapper_gwq0h_tp82q_305",
25
- "header-button": "awsui_header-button_gwq0h_tp82q_310",
26
- "header-container-button": "awsui_header-container-button_gwq0h_tp82q_310",
27
- "header-container": "awsui_header-container_gwq0h_tp82q_310",
28
- "header-navigation": "awsui_header-navigation_gwq0h_tp82q_345",
29
- "header-text": "awsui_header-text_gwq0h_tp82q_382",
30
- "content": "awsui_content_gwq0h_tp82q_101",
31
- "content-default": "awsui_content-default_gwq0h_tp82q_389",
32
- "content-footer": "awsui_content-footer_gwq0h_tp82q_393",
33
- "content-expanded": "awsui_content-expanded_gwq0h_tp82q_397",
34
- "content-compact": "awsui_content-compact_gwq0h_tp82q_400",
35
- "focusable": "awsui_focusable_gwq0h_tp82q_404",
36
- "click-target": "awsui_click-target_gwq0h_tp82q_419"
5
+ "content-enter": "awsui_content-enter_gwq0h_8rjzz_101",
6
+ "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_gwq0h_8rjzz_1",
7
+ "trigger-expanded": "awsui_trigger-expanded_gwq0h_8rjzz_123",
8
+ "icon": "awsui_icon_gwq0h_8rjzz_137",
9
+ "root": "awsui_root_gwq0h_8rjzz_155",
10
+ "expand-button": "awsui_expand-button_gwq0h_8rjzz_193",
11
+ "expanded": "awsui_expanded_gwq0h_8rjzz_201",
12
+ "icon-container": "awsui_icon-container_gwq0h_8rjzz_211",
13
+ "icon-container-container": "awsui_icon-container-container_gwq0h_8rjzz_215",
14
+ "wrapper": "awsui_wrapper_gwq0h_8rjzz_219",
15
+ "wrapper-default": "awsui_wrapper-default_gwq0h_8rjzz_227",
16
+ "wrapper-footer": "awsui_wrapper-footer_gwq0h_8rjzz_227",
17
+ "wrapper-navigation": "awsui_wrapper-navigation_gwq0h_8rjzz_231",
18
+ "wrapper-container": "awsui_wrapper-container_gwq0h_8rjzz_234",
19
+ "wrapper-compact": "awsui_wrapper-compact_gwq0h_8rjzz_238",
20
+ "header-deprecated": "awsui_header-deprecated_gwq0h_8rjzz_251",
21
+ "wrapper-expanded": "awsui_wrapper-expanded_gwq0h_8rjzz_273",
22
+ "header": "awsui_header_gwq0h_8rjzz_251",
23
+ "header-wrapper": "awsui_header-wrapper_gwq0h_8rjzz_293",
24
+ "header-actions-wrapper": "awsui_header-actions-wrapper_gwq0h_8rjzz_305",
25
+ "header-button": "awsui_header-button_gwq0h_8rjzz_310",
26
+ "header-container-button": "awsui_header-container-button_gwq0h_8rjzz_310",
27
+ "header-container": "awsui_header-container_gwq0h_8rjzz_310",
28
+ "header-navigation": "awsui_header-navigation_gwq0h_8rjzz_345",
29
+ "header-text": "awsui_header-text_gwq0h_8rjzz_382",
30
+ "content": "awsui_content_gwq0h_8rjzz_101",
31
+ "content-default": "awsui_content-default_gwq0h_8rjzz_389",
32
+ "content-footer": "awsui_content-footer_gwq0h_8rjzz_393",
33
+ "content-expanded": "awsui_content-expanded_gwq0h_8rjzz_397",
34
+ "content-compact": "awsui_content-compact_gwq0h_8rjzz_400",
35
+ "focusable": "awsui_focusable_gwq0h_8rjzz_404",
36
+ "click-target": "awsui_click-target_gwq0h_8rjzz_419"
37
37
  };
38
38
 
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (dba99012)";
2
+ export var PACKAGE_VERSION = "3.0.0 (40e1d94b)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (dba99012)",
3
+ "PACKAGE_VERSION": "3.0.0 (40e1d94b)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "dba99012a8367a488ec497052ba97f2b58964ed9"
2
+ "commit": "40e1d94b3c478ec102127007b8cc6313a84b369f"
3
3
  }
package/package.json CHANGED
@@ -120,7 +120,7 @@
120
120
  "./internal/base-component/index.js",
121
121
  "./internal/base-component/styles.css.js"
122
122
  ],
123
- "version": "3.0.676",
123
+ "version": "3.0.678",
124
124
  "repository": {
125
125
  "type": "git",
126
126
  "url": "https://github.com/cloudscape-design/components.git"
@@ -15,7 +15,6 @@ interface OptionGroup<T> {
15
15
  options: T[];
16
16
  }
17
17
  export declare const getAllValueSuggestions: (filteringOptions: readonly InternalFilteringOption[], operator: ComparisonOperator | undefined, i18nStrings: I18nStrings, customGroupsText: readonly GroupText[]) => OptionGroup<import("../internal/components/option/interfaces").OptionDefinition>[];
18
- export declare function createPropertiesCompatibilityMap(filteringProperties: readonly InternalFilteringProperty[]): (propertyA: string, propertyB: string) => boolean;
19
18
  export declare function getPropertySuggestions<T>(filteringProperties: readonly InternalFilteringProperty[], customGroupsText: readonly GroupText[], i18nStrings: I18nStrings, filteringPropertyToOption: (filteringProperty: InternalFilteringProperty) => T): OptionGroup<T>[];
20
19
  export declare const getAutosuggestOptions: (parsedText: ParsedText, filteringProperties: readonly InternalFilteringProperty[], filteringOptions: readonly InternalFilteringOption[], customGroupsText: readonly GroupText[], i18nStrings: I18nStrings) => {
21
20
  filterText: string;
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/property-filter/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kBAAkB,EAElB,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,UAAU,EACV,KAAK,EACL,KAAK,EACN,MAAM,cAAc,CAAC;AACtB,OAAO,EAA0B,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAGvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,eAAO,MAAM,eAAe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CAAC;AAEF,eAAO,MAAM,qBAAqB,aAAc,kBAAkB,eAAe,WAAW,uBA4B3F,CAAC"}
@@ -126,28 +126,6 @@ export const getAllValueSuggestions = (filteringOptions, operator = '=', i18nStr
126
126
  });
127
127
  return [defaultGroup, ...Object.keys(customGroups).map(group => customGroups[group])];
128
128
  };
129
- export function createPropertiesCompatibilityMap(filteringProperties) {
130
- const lookup = {};
131
- for (const property of filteringProperties) {
132
- lookup[property.propertyKey] = (property.operators || [])
133
- .map(operator => ({ operator, form: property.getValueFormRenderer(operator) }))
134
- .sort((a, b) => a.operator.localeCompare(b.operator));
135
- }
136
- return (propertyA, propertyB) => {
137
- if (lookup[propertyA].length !== lookup[propertyB].length) {
138
- return false;
139
- }
140
- for (let i = 0; i < lookup[propertyA].length; i++) {
141
- if (lookup[propertyA][i].operator !== lookup[propertyB][i].operator) {
142
- return false;
143
- }
144
- if (lookup[propertyA][i].form !== lookup[propertyB][i].form) {
145
- return false;
146
- }
147
- }
148
- return true;
149
- };
150
- }
151
129
  const filteringPropertyToAutosuggestOption = (filteringProperty) => ({
152
130
  value: filteringProperty.propertyLabel,
153
131
  label: filteringProperty.propertyLabel,
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/property-filter/controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAetC,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;AAEvF,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGhH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAY,EACZ,QAA0C,EAC1C,QAA8C,EAC9C,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,YAAY,GAAG,CAAC,MAAwB,EAAE,SAAwB,EAAE,EAAE,CAC1E,sBAAsB,CAAC,QA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AAW,CAAC,gBAAgB,CAAC;QACtC,KAAK,IAAI;YACP,OAAO,WAAW,CAAC,uBAAuB,CAAC;QAC7C,KAAK,GAAG;YACN,OAAO,WAAW,CAAC,mBAAmB,CAAC;QACzC,KAAK,IAAI;YACP,OAAO,WAAW,CAAC,0BAA0B,CAAC;QAChD,KAAK,GAAG;YACN,OAAO,WAAW,CAAC,oBAAoB,CAAC;QAC1C,KAAK,IAAI;YACP,OAAO,WAAW,CAAC,0BAA0B,CAAC;QAChD,KAAK,GAAG;YACN,OAAO,WAAW,CAAC,kBAAkB,CAAC;QACxC,KAAK,IAAI;YACP,OAAO,WAAW,CAAC,wBAAwB,CAAC;QAC9C,KAAK,GAAG;YACN,OAAO,WAAW,CAAC,sBAAsB,CAAC;QAC5C,KAAK,IAAI;YACP,OAAO,WAAW,CAAC,4BAA4B,CAAC;QAClD,iEAAiE;QACjE,sFAAsF;QACtF,0BAA0B;QAC1B;YACE,OAAO,EAAE,CAAC;KACb;AACH,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ComparisonOperator,\n ExtendedOperatorForm,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n JoinOperation,\n ParsedText,\n Query,\n Token,\n} from './interfaces';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { matchFilteringProperty, matchOperator, matchOperatorPrefix, removeOperator, trimStart } from './utils';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\n\nexport const getQueryActions = (\n query: Query,\n onChange: NonCancelableEventHandler<Query>,\n inputRef: React.RefObject<AutosuggestInputRef>\n) => {\n const { tokens, operation } = query;\n const fireOnChange = (tokens: readonly Token[], operation: JoinOperation) =>\n fireNonCancelableEvent(onChange, { tokens, operation });\n const setToken = (index: number, newToken: Token) => {\n const newTokens = [...tokens];\n if (newTokens && index < newTokens.length) {\n newTokens[index] = newToken;\n }\n fireOnChange(newTokens, operation);\n };\n const removeToken = (index: number) => {\n const newTokens = tokens.filter((_, i) => i !== index);\n fireOnChange(newTokens, operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const removeAllTokens = () => {\n fireOnChange([], operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const addToken = (newToken: Token) => {\n const newTokens = [...tokens];\n newTokens.push(newToken);\n fireOnChange(newTokens, operation);\n };\n const setOperation = (newOperation: JoinOperation) => {\n fireOnChange(tokens, newOperation);\n };\n return {\n setToken,\n removeToken,\n removeAllTokens,\n addToken,\n setOperation,\n };\n};\n\nexport const getAllowedOperators = (property: InternalFilteringProperty): ComparisonOperator[] => {\n const { operators = [], defaultOperator } = property;\n const operatorOrder = ['=', '!=', ':', '!:', '^', '!^', '>=', '<=', '<', '>'] as const;\n const operatorSet = new Set([defaultOperator, ...operators]);\n return operatorOrder.filter(op => operatorSet.has(op));\n};\n\n/*\n * parses the value of the filtering input to figure out the current step of entering the token:\n * - \"property\": means that a filter on a particular column is being added, with operator already finalized\n * - \"operator\": means that a filter on a particular column is being added, with operator not yet finalized\n * - \"free-text\": means that a \"free text\" token is being added\n */\nexport const parseText = (\n filteringText: string,\n filteringProperties: readonly InternalFilteringProperty[],\n freeTextFiltering: InternalFreeTextFiltering\n): ParsedText => {\n const property = matchFilteringProperty(filteringProperties, filteringText);\n if (!property) {\n if (!freeTextFiltering.disabled) {\n // For free text filtering, we allow ! as a shortcut for !:\n const freeTextOperators =\n freeTextFiltering.operators.indexOf('!:') >= 0\n ? ['!', ...freeTextFiltering.operators]\n : freeTextFiltering.operators;\n const operator = matchOperator(freeTextOperators, filteringText);\n if (operator) {\n return {\n step: 'free-text',\n operator: operator === '!' ? '!:' : operator,\n value: removeOperator(filteringText, operator),\n };\n }\n }\n\n return {\n step: 'free-text',\n value: filteringText,\n };\n }\n\n const allowedOps = getAllowedOperators(property);\n\n const textWithoutProperty = filteringText.substring(property.propertyLabel.length);\n const operator = matchOperator(allowedOps, trimStart(textWithoutProperty));\n if (operator) {\n return {\n step: 'property',\n property,\n operator,\n value: removeOperator(textWithoutProperty, operator),\n };\n }\n\n const operatorPrefix = matchOperatorPrefix(allowedOps, trimStart(textWithoutProperty));\n if (operatorPrefix !== null) {\n return { step: 'operator', property, operatorPrefix };\n }\n\n return {\n step: 'free-text',\n value: filteringText,\n };\n};\n\ninterface OptionGroup<T> {\n label: string;\n options: T[];\n}\n\nexport const getAllValueSuggestions = (\n filteringOptions: readonly InternalFilteringOption[],\n operator: ComparisonOperator | undefined = '=',\n i18nStrings: I18nStrings,\n customGroupsText: readonly GroupText[]\n) => {\n const defaultGroup: OptionGroup<AutosuggestProps.Option> = {\n label: i18nStrings.groupValuesText ?? '',\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<AutosuggestProps.Option> } = {};\n filteringOptions.forEach(filteringOption => {\n const property = filteringOption.property;\n // given option refers to a non-existent filtering property\n if (!property) {\n return;\n }\n // this option's filtering property does not support current operator\n if (getAllowedOperators(property).indexOf(operator) === -1) {\n return;\n }\n if (property.propertyGroup && !customGroups[property.propertyGroup]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === property.propertyGroup ? customGroup.values : acc),\n ''\n );\n customGroups[property.propertyGroup] = {\n label,\n options: [],\n };\n }\n const propertyGroup = property.propertyGroup ? customGroups[property.propertyGroup] : defaultGroup;\n propertyGroup.options.push({\n value: property.propertyLabel + ' ' + (operator || '=') + ' ' + filteringOption.value,\n label: filteringOption.label,\n __labelPrefix: property.propertyLabel + ' ' + (operator || '='),\n });\n });\n return [defaultGroup, ...Object.keys(customGroups).map(group => customGroups[group])];\n};\n\nexport function createPropertiesCompatibilityMap(\n filteringProperties: readonly InternalFilteringProperty[]\n): (propertyA: string, propertyB: string) => boolean {\n const lookup: {\n [propertyKey: string]: { operator: string; form: ExtendedOperatorForm<any> | null }[];\n } = {};\n\n for (const property of filteringProperties) {\n lookup[property.propertyKey] = (property.operators || [])\n .map(operator => ({ operator, form: property.getValueFormRenderer(operator) }))\n .sort((a, b) => a.operator.localeCompare(b.operator));\n }\n\n return (propertyA: string, propertyB: string) => {\n if (lookup[propertyA].length !== lookup[propertyB].length) {\n return false;\n }\n for (let i = 0; i < lookup[propertyA].length; i++) {\n if (lookup[propertyA][i].operator !== lookup[propertyB][i].operator) {\n return false;\n }\n if (lookup[propertyA][i].form !== lookup[propertyB][i].form) {\n return false;\n }\n }\n return true;\n };\n}\n\nconst filteringPropertyToAutosuggestOption = (filteringProperty: InternalFilteringProperty) => ({\n value: filteringProperty.propertyLabel,\n label: filteringProperty.propertyLabel,\n keepOpenOnSelect: true,\n});\n\nexport function getPropertySuggestions<T>(\n filteringProperties: readonly InternalFilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings,\n filteringPropertyToOption: (filteringProperty: InternalFilteringProperty) => T\n) {\n const defaultGroup: OptionGroup<T> = {\n label: i18nStrings.groupPropertiesText ?? '',\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<T> } = {};\n\n filteringProperties.forEach(filteringProperty => {\n const { propertyGroup } = filteringProperty;\n let optionsGroup = defaultGroup;\n if (propertyGroup) {\n if (!customGroups[propertyGroup]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === propertyGroup ? customGroup.properties : acc),\n ''\n );\n customGroups[propertyGroup] = { options: [], label };\n }\n optionsGroup = customGroups[propertyGroup];\n }\n optionsGroup.options.push(filteringPropertyToOption(filteringProperty));\n });\n const defaultGroupArray = defaultGroup.options.length ? [defaultGroup] : [];\n const customGroupsArray = Object.keys(customGroups).map(groupKey => customGroups[groupKey]);\n return [...defaultGroupArray, ...customGroupsArray];\n}\n\nexport const getAutosuggestOptions = (\n parsedText: ParsedText,\n filteringProperties: readonly InternalFilteringProperty[],\n filteringOptions: readonly InternalFilteringOption[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings\n) => {\n switch (parsedText.step) {\n case 'property': {\n const { propertyLabel, groupValuesLabel } = parsedText.property;\n const options = filteringOptions.filter(o => o.property === parsedText.property);\n return {\n filterText: parsedText.value,\n options: [\n {\n options: options.map(({ label, value }) => ({\n value: propertyLabel + ' ' + parsedText.operator + ' ' + value,\n label: label,\n __labelPrefix: propertyLabel + ' ' + parsedText.operator,\n })),\n label: groupValuesLabel,\n },\n ],\n };\n }\n case 'operator': {\n return {\n filterText: parsedText.property.propertyLabel + ' ' + parsedText.operatorPrefix,\n options: [\n ...getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n ),\n {\n options: getAllowedOperators(parsedText.property).map(value => ({\n value: parsedText.property.propertyLabel + ' ' + value + ' ',\n label: parsedText.property.propertyLabel + ' ' + value,\n description: operatorToDescription(value, i18nStrings),\n keepOpenOnSelect: true,\n })),\n label: i18nStrings.operatorsText,\n },\n ],\n };\n }\n case 'free-text': {\n const needsValueSuggestions = !!parsedText.value;\n const needsPropertySuggestions = !(parsedText.step === 'free-text' && parsedText.operator === '!:');\n return {\n filterText: parsedText.value,\n options: [\n ...(needsPropertySuggestions\n ? getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n )\n : []),\n ...(needsValueSuggestions\n ? getAllValueSuggestions(filteringOptions, parsedText.operator, i18nStrings, customGroupsText)\n : []),\n ],\n };\n }\n }\n};\n\nexport const operatorToDescription = (operator: ComparisonOperator, i18nStrings: I18nStrings) => {\n switch (operator) {\n case '<':\n return i18nStrings.operatorLessText;\n case '<=':\n return i18nStrings.operatorLessOrEqualText;\n case '>':\n return i18nStrings.operatorGreaterText;\n case '>=':\n return i18nStrings.operatorGreaterOrEqualText;\n case ':':\n return i18nStrings.operatorContainsText;\n case '!:':\n return i18nStrings.operatorDoesNotContainText;\n case '=':\n return i18nStrings.operatorEqualsText;\n case '!=':\n return i18nStrings.operatorDoesNotEqualText;\n case '^':\n return i18nStrings.operatorStartsWithText;\n case '!^':\n return i18nStrings.operatorDoesNotStartWithText;\n // The line is ignored from coverage because it is not reachable.\n // The purpose of it is to prevent TS errors if ComparisonOperator type gets extended.\n /* istanbul ignore next */\n default:\n return '';\n }\n};\n"]}
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/property-filter/controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AActC,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;AAEvF,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGhH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAY,EACZ,QAA0C,EAC1C,QAA8C,EAC9C,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,YAAY,GAAG,CAAC,MAAwB,EAAE,SAAwB,EAAE,EAAE,CAC1E,sBAAsB,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,QAAe,EAAE,EAAE;QAClD,MAAM,SAAS,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;QAC9B,IAAI,SAAS,IAAI,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE;YACzC,SAAS,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;SAC7B;QACD,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACrC,CAAC,CAAC;IACF,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE;;QACpC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC;QACvD,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC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,CAAC,4BAA4B,CAAC;QAClD,iEAAiE;QACjE,sFAAsF;QACtF,0BAA0B;QAC1B;YACE,OAAO,EAAE,CAAC;KACb;AACH,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ComparisonOperator,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n JoinOperation,\n ParsedText,\n Query,\n Token,\n} from './interfaces';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { matchFilteringProperty, matchOperator, matchOperatorPrefix, removeOperator, trimStart } from './utils';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\n\nexport const getQueryActions = (\n query: Query,\n onChange: NonCancelableEventHandler<Query>,\n inputRef: React.RefObject<AutosuggestInputRef>\n) => {\n const { tokens, operation } = query;\n const fireOnChange = (tokens: readonly Token[], operation: JoinOperation) =>\n fireNonCancelableEvent(onChange, { tokens, operation });\n const setToken = (index: number, newToken: Token) => {\n const newTokens = [...tokens];\n if (newTokens && index < newTokens.length) {\n newTokens[index] = newToken;\n }\n fireOnChange(newTokens, operation);\n };\n const removeToken = (index: number) => {\n const newTokens = tokens.filter((_, i) => i !== index);\n fireOnChange(newTokens, operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const removeAllTokens = () => {\n fireOnChange([], operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const addToken = (newToken: Token) => {\n const newTokens = [...tokens];\n newTokens.push(newToken);\n fireOnChange(newTokens, operation);\n };\n const setOperation = (newOperation: JoinOperation) => {\n fireOnChange(tokens, newOperation);\n };\n return {\n setToken,\n removeToken,\n removeAllTokens,\n addToken,\n setOperation,\n };\n};\n\nexport const getAllowedOperators = (property: InternalFilteringProperty): ComparisonOperator[] => {\n const { operators = [], defaultOperator } = property;\n const operatorOrder = ['=', '!=', ':', '!:', '^', '!^', '>=', '<=', '<', '>'] as const;\n const operatorSet = new Set([defaultOperator, ...operators]);\n return operatorOrder.filter(op => operatorSet.has(op));\n};\n\n/*\n * parses the value of the filtering input to figure out the current step of entering the token:\n * - \"property\": means that a filter on a particular column is being added, with operator already finalized\n * - \"operator\": means that a filter on a particular column is being added, with operator not yet finalized\n * - \"free-text\": means that a \"free text\" token is being added\n */\nexport const parseText = (\n filteringText: string,\n filteringProperties: readonly InternalFilteringProperty[],\n freeTextFiltering: InternalFreeTextFiltering\n): ParsedText => {\n const property = matchFilteringProperty(filteringProperties, filteringText);\n if (!property) {\n if (!freeTextFiltering.disabled) {\n // For free text filtering, we allow ! as a shortcut for !:\n const freeTextOperators =\n freeTextFiltering.operators.indexOf('!:') >= 0\n ? ['!', ...freeTextFiltering.operators]\n : freeTextFiltering.operators;\n const operator = matchOperator(freeTextOperators, filteringText);\n if (operator) {\n return {\n step: 'free-text',\n operator: operator === '!' ? '!:' : operator,\n value: removeOperator(filteringText, operator),\n };\n }\n }\n\n return {\n step: 'free-text',\n value: filteringText,\n };\n }\n\n const allowedOps = getAllowedOperators(property);\n\n const textWithoutProperty = filteringText.substring(property.propertyLabel.length);\n const operator = matchOperator(allowedOps, trimStart(textWithoutProperty));\n if (operator) {\n return {\n step: 'property',\n property,\n operator,\n value: removeOperator(textWithoutProperty, operator),\n };\n }\n\n const operatorPrefix = matchOperatorPrefix(allowedOps, trimStart(textWithoutProperty));\n if (operatorPrefix !== null) {\n return { step: 'operator', property, operatorPrefix };\n }\n\n return {\n step: 'free-text',\n value: filteringText,\n };\n};\n\ninterface OptionGroup<T> {\n label: string;\n options: T[];\n}\n\nexport const getAllValueSuggestions = (\n filteringOptions: readonly InternalFilteringOption[],\n operator: ComparisonOperator | undefined = '=',\n i18nStrings: I18nStrings,\n customGroupsText: readonly GroupText[]\n) => {\n const defaultGroup: OptionGroup<AutosuggestProps.Option> = {\n label: i18nStrings.groupValuesText ?? '',\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<AutosuggestProps.Option> } = {};\n filteringOptions.forEach(filteringOption => {\n const property = filteringOption.property;\n // given option refers to a non-existent filtering property\n if (!property) {\n return;\n }\n // this option's filtering property does not support current operator\n if (getAllowedOperators(property).indexOf(operator) === -1) {\n return;\n }\n if (property.propertyGroup && !customGroups[property.propertyGroup]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === property.propertyGroup ? customGroup.values : acc),\n ''\n );\n customGroups[property.propertyGroup] = {\n label,\n options: [],\n };\n }\n const propertyGroup = property.propertyGroup ? customGroups[property.propertyGroup] : defaultGroup;\n propertyGroup.options.push({\n value: property.propertyLabel + ' ' + (operator || '=') + ' ' + filteringOption.value,\n label: filteringOption.label,\n __labelPrefix: property.propertyLabel + ' ' + (operator || '='),\n });\n });\n return [defaultGroup, ...Object.keys(customGroups).map(group => customGroups[group])];\n};\n\nconst filteringPropertyToAutosuggestOption = (filteringProperty: InternalFilteringProperty) => ({\n value: filteringProperty.propertyLabel,\n label: filteringProperty.propertyLabel,\n keepOpenOnSelect: true,\n});\n\nexport function getPropertySuggestions<T>(\n filteringProperties: readonly InternalFilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings,\n filteringPropertyToOption: (filteringProperty: InternalFilteringProperty) => T\n) {\n const defaultGroup: OptionGroup<T> = {\n label: i18nStrings.groupPropertiesText ?? '',\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<T> } = {};\n\n filteringProperties.forEach(filteringProperty => {\n const { propertyGroup } = filteringProperty;\n let optionsGroup = defaultGroup;\n if (propertyGroup) {\n if (!customGroups[propertyGroup]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === propertyGroup ? customGroup.properties : acc),\n ''\n );\n customGroups[propertyGroup] = { options: [], label };\n }\n optionsGroup = customGroups[propertyGroup];\n }\n optionsGroup.options.push(filteringPropertyToOption(filteringProperty));\n });\n const defaultGroupArray = defaultGroup.options.length ? [defaultGroup] : [];\n const customGroupsArray = Object.keys(customGroups).map(groupKey => customGroups[groupKey]);\n return [...defaultGroupArray, ...customGroupsArray];\n}\n\nexport const getAutosuggestOptions = (\n parsedText: ParsedText,\n filteringProperties: readonly InternalFilteringProperty[],\n filteringOptions: readonly InternalFilteringOption[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings\n) => {\n switch (parsedText.step) {\n case 'property': {\n const { propertyLabel, groupValuesLabel } = parsedText.property;\n const options = filteringOptions.filter(o => o.property === parsedText.property);\n return {\n filterText: parsedText.value,\n options: [\n {\n options: options.map(({ label, value }) => ({\n value: propertyLabel + ' ' + parsedText.operator + ' ' + value,\n label: label,\n __labelPrefix: propertyLabel + ' ' + parsedText.operator,\n })),\n label: groupValuesLabel,\n },\n ],\n };\n }\n case 'operator': {\n return {\n filterText: parsedText.property.propertyLabel + ' ' + parsedText.operatorPrefix,\n options: [\n ...getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n ),\n {\n options: getAllowedOperators(parsedText.property).map(value => ({\n value: parsedText.property.propertyLabel + ' ' + value + ' ',\n label: parsedText.property.propertyLabel + ' ' + value,\n description: operatorToDescription(value, i18nStrings),\n keepOpenOnSelect: true,\n })),\n label: i18nStrings.operatorsText,\n },\n ],\n };\n }\n case 'free-text': {\n const needsValueSuggestions = !!parsedText.value;\n const needsPropertySuggestions = !(parsedText.step === 'free-text' && parsedText.operator === '!:');\n return {\n filterText: parsedText.value,\n options: [\n ...(needsPropertySuggestions\n ? getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n )\n : []),\n ...(needsValueSuggestions\n ? getAllValueSuggestions(filteringOptions, parsedText.operator, i18nStrings, customGroupsText)\n : []),\n ],\n };\n }\n }\n};\n\nexport const operatorToDescription = (operator: ComparisonOperator, i18nStrings: I18nStrings) => {\n switch (operator) {\n case '<':\n return i18nStrings.operatorLessText;\n case '<=':\n return i18nStrings.operatorLessOrEqualText;\n case '>':\n return i18nStrings.operatorGreaterText;\n case '>=':\n return i18nStrings.operatorGreaterOrEqualText;\n case ':':\n return i18nStrings.operatorContainsText;\n case '!:':\n return i18nStrings.operatorDoesNotContainText;\n case '=':\n return i18nStrings.operatorEqualsText;\n case '!=':\n return i18nStrings.operatorDoesNotEqualText;\n case '^':\n return i18nStrings.operatorStartsWithText;\n case '!^':\n return i18nStrings.operatorDoesNotStartWithText;\n // The line is ignored from coverage because it is not reachable.\n // The purpose of it is to prevent TS errors if ComparisonOperator type gets extended.\n /* istanbul ignore next */\n default:\n return '';\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"token-editor.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAMhD,OAAO,EAEL,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,eAAe,EACf,KAAK,EACN,MAAM,cAAc,CAAC;AAStB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AA8JxF,UAAU,gBAAgB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,mBAAmB,CAAC;IAChC,gBAAgB,EAAE,SAAS,SAAS,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,yBAAyB,CAAC;IAC7C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,CAAC;IAC1D,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACrD,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAC;IACzD,QAAQ,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IACpC,KAAK,EAAE,aAAa,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC;AAED,wBAAgB,WAAW,CAAC,EAC1B,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,QAAQ,EACR,KAAK,EACL,gBAAgB,GACjB,EAAE,gBAAgB,eA6GlB"}
1
+ {"version":3,"file":"token-editor.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAMhD,OAAO,EAEL,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,eAAe,EACf,KAAK,EACN,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAkJxF,UAAU,gBAAgB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,mBAAmB,CAAC;IAChC,gBAAgB,EAAE,SAAS,SAAS,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,yBAAyB,CAAC;IAC7C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,CAAC;IAC1D,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACrD,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAC;IACzD,QAAQ,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IACpC,KAAK,EAAE,aAAa,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC;AAED,wBAAgB,WAAW,CAAC,EAC1B,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,QAAQ,EACR,KAAK,EACL,gBAAgB,GACjB,EAAE,gBAAgB,eA6GlB"}
@@ -6,7 +6,7 @@ import InternalAutosuggest from '../autosuggest/internal';
6
6
  import InternalPopover from '../popover/internal';
7
7
  import styles from './styles.css.js';
8
8
  import { useLoadItems } from './use-load-items';
9
- import { createPropertiesCompatibilityMap, getAllowedOperators, operatorToDescription, getPropertySuggestions, } from './controller';
9
+ import { getAllowedOperators, operatorToDescription, getPropertySuggestions } from './controller';
10
10
  import InternalButton from '../button/internal';
11
11
  import InternalFormField from '../form-field/internal';
12
12
  import { matchTokenValue } from './utils';
@@ -19,17 +19,6 @@ function PropertyInput({ property, onChangePropertyKey, asyncProps, filteringPro
19
19
  label: propertyLabel,
20
20
  dontCloseOnSelect: true,
21
21
  }));
22
- // Disallow selecting properties that have different representation.
23
- const checkPropertiesCompatible = createPropertiesCompatibilityMap(filteringProperties);
24
- propertyOptions.forEach(optionGroup => {
25
- if ('options' in optionGroup) {
26
- optionGroup.options.forEach(option => {
27
- if ((property === null || property === void 0 ? void 0 : property.propertyKey) && option.value) {
28
- option.disabled = !checkPropertiesCompatible(option.value, property.propertyKey);
29
- }
30
- });
31
- }
32
- });
33
22
  const allPropertiesOption = {
34
23
  label: i18nStrings.allPropertiesLabel,
35
24
  value: undefined,
@@ -87,7 +76,7 @@ export function TokenEditor({ asyncProperties, asyncProps, customGroupsText, fre
87
76
  ? temporaryToken.operator
88
77
  : allowedOperators[0];
89
78
  const matchedProperty = (_a = filteringProperties.find(property => property.propertyKey === newPropertyKey)) !== null && _a !== void 0 ? _a : null;
90
- setTemporaryToken(Object.assign(Object.assign({}, temporaryToken), { property: matchedProperty, operator }));
79
+ setTemporaryToken(Object.assign(Object.assign({}, temporaryToken), { property: matchedProperty, operator, value: null }));
91
80
  };
92
81
  const operator = temporaryToken.operator;
93
82
  const onChangeOperator = (newOperator) => {
@@ -1 +1 @@
1
- {"version":3,"file":"token-editor.js","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAC1D,OAAO,eAAuC,MAAM,qBAAqB,CAAC;AAY1E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,gCAAgC,EAChC,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAGtB,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAa1C,SAAS,aAAa,CAAC,EACrB,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,iBAAiB,GACE;;IACnB,MAAM,sBAAsB,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,wBAAwB,GAAG,UAAU,CAAC,CAAC,iCAAM,UAAU,GAAK,sBAAsB,EAAG,CAAC,CAAC,EAAE,CAAC;IAChG,MAAM,eAAe,GAAqD,sBAAsB,CAC9F,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;QACnC,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,aAAa;QACpB,iBAAiB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-License-Identifier: Apache-2.0\nimport React, { useState, useRef } from 'react';\n\nimport { SelectProps } from '../select/interfaces';\nimport InternalSelect from '../select/internal';\nimport InternalAutosuggest from '../autosuggest/internal';\nimport InternalPopover, { InternalPopoverRef } from '../popover/internal';\nimport {\n ComparisonOperator,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n InternalToken,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport styles from './styles.css.js';\nimport { useLoadItems } from './use-load-items';\nimport {\n createPropertiesCompatibilityMap,\n getAllowedOperators,\n operatorToDescription,\n getPropertySuggestions,\n} from './controller';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport InternalButton from '../button/internal';\nimport InternalFormField from '../form-field/internal';\nimport { matchTokenValue } from './utils';\n\ninterface PropertyInputProps {\n asyncProps: null | DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n freeTextFiltering: InternalFreeTextFiltering;\n filteringProperties: readonly InternalFilteringProperty[];\n i18nStrings: I18nStrings;\n onChangePropertyKey: (propertyKey: undefined | string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n property: null | InternalFilteringProperty;\n}\n\nfunction PropertyInput({\n property,\n onChangePropertyKey,\n asyncProps,\n filteringProperties,\n onLoadItems,\n customGroupsText,\n i18nStrings,\n freeTextFiltering,\n}: PropertyInputProps) {\n const propertySelectHandlers = useLoadItems(onLoadItems);\n const asyncPropertySelectProps = asyncProps ? { ...asyncProps, ...propertySelectHandlers } : {};\n const propertyOptions: (SelectProps.Option | SelectProps.OptionGroup)[] = getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n ({ propertyKey, propertyLabel }) => ({\n value: propertyKey,\n label: propertyLabel,\n dontCloseOnSelect: true,\n })\n );\n\n // Disallow selecting properties that have different representation.\n const checkPropertiesCompatible = createPropertiesCompatibilityMap(filteringProperties);\n propertyOptions.forEach(optionGroup => {\n if ('options' in optionGroup) {\n optionGroup.options.forEach(option => {\n if (property?.propertyKey && option.value) {\n option.disabled = !checkPropertiesCompatible(option.value, property.propertyKey);\n }\n });\n }\n });\n\n const allPropertiesOption = {\n label: i18nStrings.allPropertiesLabel,\n value: undefined,\n };\n if (!freeTextFiltering.disabled) {\n propertyOptions.unshift(allPropertiesOption);\n }\n return (\n <InternalSelect\n options={propertyOptions}\n selectedOption={\n property\n ? {\n value: property.propertyKey ?? undefined,\n label: property.propertyLabel,\n }\n : allPropertiesOption\n }\n onChange={e => onChangePropertyKey(e.detail.selectedOption.value)}\n {...asyncPropertySelectProps}\n />\n );\n}\n\ninterface OperatorInputProps {\n i18nStrings: I18nStrings;\n onChangeOperator: (operator: ComparisonOperator) => void;\n operator: undefined | ComparisonOperator;\n property: null | InternalFilteringProperty;\n freeTextFiltering: InternalFreeTextFiltering;\n}\n\nfunction OperatorInput({ property, operator, onChangeOperator, i18nStrings, freeTextFiltering }: OperatorInputProps) {\n const operatorOptions = (property ? getAllowedOperators(property) : freeTextFiltering.operators).map(operator => ({\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }));\n return (\n <InternalSelect\n options={operatorOptions}\n triggerVariant=\"option\"\n selectedOption={\n operator\n ? {\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }\n : null\n }\n onChange={e => onChangeOperator(e.detail.selectedOption.value as ComparisonOperator)}\n />\n );\n}\n\ninterface ValueInputProps {\n asyncProps: DropdownStatusProps;\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStrings;\n onChangeValue: (value: string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n operator: undefined | ComparisonOperator;\n property: null | InternalFilteringProperty;\n value: undefined | string;\n}\n\nfunction ValueInput({\n property,\n operator,\n value,\n onChangeValue,\n asyncProps,\n filteringOptions,\n onLoadItems,\n i18nStrings,\n}: ValueInputProps) {\n const valueOptions = property\n ? filteringOptions\n .filter(option => option.property?.propertyKey === property.propertyKey)\n .map(({ label, value }) => ({ label, value }))\n : [];\n\n const valueAutosuggestHandlers = useLoadItems(onLoadItems, '', property?.externalProperty);\n const asyncValueAutosuggestProps = property?.propertyKey\n ? { ...valueAutosuggestHandlers, ...asyncProps }\n : { empty: asyncProps.empty };\n const [matchedOption] = valueOptions.filter(option => option.value === value);\n\n const OperatorForm = property?.propertyKey && operator && property?.getValueFormRenderer(operator);\n\n return OperatorForm ? (\n <OperatorForm value={value} onChange={onChangeValue} operator={operator} />\n ) : (\n <InternalAutosuggest\n enteredTextLabel={i18nStrings.enteredTextLabel ?? (value => value)}\n value={matchedOption?.label ?? value ?? ''}\n clearAriaLabel={i18nStrings.clearAriaLabel}\n onChange={e => onChangeValue(e.detail.value)}\n disabled={!operator}\n options={valueOptions}\n {...asyncValueAutosuggestProps}\n virtualScroll={true}\n />\n );\n}\n\ninterface TokenEditorProps {\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n disabled?: boolean;\n freeTextFiltering: InternalFreeTextFiltering;\n expandToViewport?: boolean;\n filteringProperties: readonly InternalFilteringProperty[];\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStrings;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n setToken: (newToken: Token) => void;\n token: InternalToken;\n triggerComponent?: React.ReactNode;\n}\n\nexport function TokenEditor({\n asyncProperties,\n asyncProps,\n customGroupsText,\n freeTextFiltering,\n expandToViewport,\n filteringProperties,\n filteringOptions,\n i18nStrings,\n onLoadItems,\n setToken,\n token,\n triggerComponent,\n}: TokenEditorProps) {\n const [temporaryToken, setTemporaryToken] = useState<InternalToken>(token);\n const popoverRef = useRef<InternalPopoverRef>(null);\n const closePopover = () => {\n popoverRef.current && popoverRef.current.dismissPopover();\n };\n\n const property = temporaryToken.property;\n const onChangePropertyKey = (newPropertyKey: undefined | string) => {\n const filteringProperty = filteringProperties.reduce<InternalFilteringProperty | undefined>(\n (acc, property) => (property.propertyKey === newPropertyKey ? property : acc),\n undefined\n );\n const allowedOperators = filteringProperty ? getAllowedOperators(filteringProperty) : freeTextFiltering.operators;\n const operator =\n temporaryToken.operator && allowedOperators.indexOf(temporaryToken.operator) !== -1\n ? temporaryToken.operator\n : allowedOperators[0];\n const matchedProperty = filteringProperties.find(property => property.propertyKey === newPropertyKey) ?? null;\n setTemporaryToken({ ...temporaryToken, property: matchedProperty, operator });\n };\n\n const operator = temporaryToken.operator;\n const onChangeOperator = (newOperator: ComparisonOperator) => {\n setTemporaryToken({ ...temporaryToken, operator: newOperator });\n };\n\n const value = temporaryToken.value;\n const onChangeValue = (newValue: string) => {\n setTemporaryToken({ ...temporaryToken, value: newValue });\n };\n\n return (\n <InternalPopover\n ref={popoverRef}\n className={styles['token-label']}\n triggerType=\"text\"\n header={i18nStrings.editTokenHeader}\n size=\"large\"\n position=\"right\"\n dismissAriaLabel={i18nStrings.dismissAriaLabel}\n __onOpen={() => setTemporaryToken(token)}\n renderWithPortal={expandToViewport}\n content={\n <div className={styles['token-editor']}>\n <div className={styles['token-editor-form']}>\n <InternalFormField label={i18nStrings.propertyText} className={styles['token-editor-field-property']}>\n <PropertyInput\n property={property}\n onChangePropertyKey={onChangePropertyKey}\n asyncProps={asyncProperties ? asyncProps : null}\n filteringProperties={filteringProperties}\n onLoadItems={onLoadItems}\n customGroupsText={customGroupsText}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n </InternalFormField>\n\n <InternalFormField label={i18nStrings.operatorText} className={styles['token-editor-field-operator']}>\n <OperatorInput\n property={property}\n operator={operator}\n onChangeOperator={onChangeOperator}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n </InternalFormField>\n\n <InternalFormField label={i18nStrings.valueText} className={styles['token-editor-field-value']}>\n <ValueInput\n property={property}\n operator={operator}\n value={value}\n onChangeValue={onChangeValue}\n asyncProps={asyncProps}\n filteringOptions={filteringOptions}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n />\n </InternalFormField>\n </div>\n\n <div className={styles['token-editor-actions']}>\n <InternalButton\n formAction=\"none\"\n variant=\"link\"\n className={styles['token-editor-cancel']}\n onClick={closePopover}\n >\n {i18nStrings.cancelActionText}\n </InternalButton>\n <InternalButton\n className={styles['token-editor-submit']}\n formAction=\"none\"\n onClick={() => {\n setToken(matchTokenValue(temporaryToken, filteringOptions));\n closePopover();\n }}\n >\n {i18nStrings.applyActionText}\n </InternalButton>\n </div>\n </div>\n }\n >\n {triggerComponent}\n </InternalPopover>\n );\n}\n"]}
1
+ {"version":3,"file":"token-editor.js","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAC1D,OAAO,eAAuC,MAAM,qBAAqB,CAAC;AAY1E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGlG,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAa1C,SAAS,aAAa,CAAC,EACrB,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,iBAAiB,GACE;;IACnB,MAAM,sBAAsB,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,wBAAwB,GAAG,UAAU,CAAC,CAAC,iCAAM,UAAU,GAAK,sB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AE,gBAAgB,EAClC,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,GACpC,CACgB;gBAEpB,oBAAC,iBAAiB,IAAC,KAAK,EAAE,WAAW,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,0BAA0B,CAAC;oBAC5F,oBAAC,UAAU,IACT,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,GACxB,CACgB,CAChB;YAEN,6BAAK,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC;gBAC5C,oBAAC,cAAc,IACb,UAAU,EAAC,MAAM,EACjB,OAAO,EAAC,MAAM,EACd,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC,EACxC,OAAO,EAAE,YAAY,IAEpB,WAAW,CAAC,gBAAgB,CACd;gBACjB,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC,EACxC,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE;wBACZ,QAAQ,CAAC,eAAe,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC,CAAC;wBAC5D,YAAY,EAAE,CAAC;oBACjB,CAAC,IAEA,WAAW,CAAC,eAAe,CACb,CACb,CACF,IAGP,gBAAgB,CACD,CACnB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState, useRef } from 'react';\n\nimport { SelectProps } from '../select/interfaces';\nimport InternalSelect from '../select/internal';\nimport InternalAutosuggest from '../autosuggest/internal';\nimport InternalPopover, { InternalPopoverRef } from '../popover/internal';\nimport {\n ComparisonOperator,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n InternalToken,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport styles from './styles.css.js';\nimport { useLoadItems } from './use-load-items';\nimport { getAllowedOperators, operatorToDescription, getPropertySuggestions } from './controller';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport InternalButton from '../button/internal';\nimport InternalFormField from '../form-field/internal';\nimport { matchTokenValue } from './utils';\n\ninterface PropertyInputProps {\n asyncProps: null | DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n freeTextFiltering: InternalFreeTextFiltering;\n filteringProperties: readonly InternalFilteringProperty[];\n i18nStrings: I18nStrings;\n onChangePropertyKey: (propertyKey: undefined | string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n property: null | InternalFilteringProperty;\n}\n\nfunction PropertyInput({\n property,\n onChangePropertyKey,\n asyncProps,\n filteringProperties,\n onLoadItems,\n customGroupsText,\n i18nStrings,\n freeTextFiltering,\n}: PropertyInputProps) {\n const propertySelectHandlers = useLoadItems(onLoadItems);\n const asyncPropertySelectProps = asyncProps ? { ...asyncProps, ...propertySelectHandlers } : {};\n const propertyOptions: (SelectProps.Option | SelectProps.OptionGroup)[] = getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n ({ propertyKey, propertyLabel }) => ({\n value: propertyKey,\n label: propertyLabel,\n dontCloseOnSelect: true,\n })\n );\n\n const allPropertiesOption = {\n label: i18nStrings.allPropertiesLabel,\n value: undefined,\n };\n if (!freeTextFiltering.disabled) {\n propertyOptions.unshift(allPropertiesOption);\n }\n return (\n <InternalSelect\n options={propertyOptions}\n selectedOption={\n property\n ? {\n value: property.propertyKey ?? undefined,\n label: property.propertyLabel,\n }\n : allPropertiesOption\n }\n onChange={e => onChangePropertyKey(e.detail.selectedOption.value)}\n {...asyncPropertySelectProps}\n />\n );\n}\n\ninterface OperatorInputProps {\n i18nStrings: I18nStrings;\n onChangeOperator: (operator: ComparisonOperator) => void;\n operator: undefined | ComparisonOperator;\n property: null | InternalFilteringProperty;\n freeTextFiltering: InternalFreeTextFiltering;\n}\n\nfunction OperatorInput({ property, operator, onChangeOperator, i18nStrings, freeTextFiltering }: OperatorInputProps) {\n const operatorOptions = (property ? getAllowedOperators(property) : freeTextFiltering.operators).map(operator => ({\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }));\n return (\n <InternalSelect\n options={operatorOptions}\n triggerVariant=\"option\"\n selectedOption={\n operator\n ? {\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }\n : null\n }\n onChange={e => onChangeOperator(e.detail.selectedOption.value as ComparisonOperator)}\n />\n );\n}\n\ninterface ValueInputProps {\n asyncProps: DropdownStatusProps;\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStrings;\n onChangeValue: (value: string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n operator: undefined | ComparisonOperator;\n property: null | InternalFilteringProperty;\n value: undefined | string;\n}\n\nfunction ValueInput({\n property,\n operator,\n value,\n onChangeValue,\n asyncProps,\n filteringOptions,\n onLoadItems,\n i18nStrings,\n}: ValueInputProps) {\n const valueOptions = property\n ? filteringOptions\n .filter(option => option.property?.propertyKey === property.propertyKey)\n .map(({ label, value }) => ({ label, value }))\n : [];\n\n const valueAutosuggestHandlers = useLoadItems(onLoadItems, '', property?.externalProperty);\n const asyncValueAutosuggestProps = property?.propertyKey\n ? { ...valueAutosuggestHandlers, ...asyncProps }\n : { empty: asyncProps.empty };\n const [matchedOption] = valueOptions.filter(option => option.value === value);\n\n const OperatorForm = property?.propertyKey && operator && property?.getValueFormRenderer(operator);\n\n return OperatorForm ? (\n <OperatorForm value={value} onChange={onChangeValue} operator={operator} />\n ) : (\n <InternalAutosuggest\n enteredTextLabel={i18nStrings.enteredTextLabel ?? (value => value)}\n value={matchedOption?.label ?? value ?? ''}\n clearAriaLabel={i18nStrings.clearAriaLabel}\n onChange={e => onChangeValue(e.detail.value)}\n disabled={!operator}\n options={valueOptions}\n {...asyncValueAutosuggestProps}\n virtualScroll={true}\n />\n );\n}\n\ninterface TokenEditorProps {\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n disabled?: boolean;\n freeTextFiltering: InternalFreeTextFiltering;\n expandToViewport?: boolean;\n filteringProperties: readonly InternalFilteringProperty[];\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStrings;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n setToken: (newToken: Token) => void;\n token: InternalToken;\n triggerComponent?: React.ReactNode;\n}\n\nexport function TokenEditor({\n asyncProperties,\n asyncProps,\n customGroupsText,\n freeTextFiltering,\n expandToViewport,\n filteringProperties,\n filteringOptions,\n i18nStrings,\n onLoadItems,\n setToken,\n token,\n triggerComponent,\n}: TokenEditorProps) {\n const [temporaryToken, setTemporaryToken] = useState<InternalToken>(token);\n const popoverRef = useRef<InternalPopoverRef>(null);\n const closePopover = () => {\n popoverRef.current && popoverRef.current.dismissPopover();\n };\n\n const property = temporaryToken.property;\n const onChangePropertyKey = (newPropertyKey: undefined | string) => {\n const filteringProperty = filteringProperties.reduce<InternalFilteringProperty | undefined>(\n (acc, property) => (property.propertyKey === newPropertyKey ? property : acc),\n undefined\n );\n const allowedOperators = filteringProperty ? getAllowedOperators(filteringProperty) : freeTextFiltering.operators;\n const operator =\n temporaryToken.operator && allowedOperators.indexOf(temporaryToken.operator) !== -1\n ? temporaryToken.operator\n : allowedOperators[0];\n const matchedProperty = filteringProperties.find(property => property.propertyKey === newPropertyKey) ?? null;\n setTemporaryToken({ ...temporaryToken, property: matchedProperty, operator, value: null });\n };\n\n const operator = temporaryToken.operator;\n const onChangeOperator = (newOperator: ComparisonOperator) => {\n setTemporaryToken({ ...temporaryToken, operator: newOperator });\n };\n\n const value = temporaryToken.value;\n const onChangeValue = (newValue: string) => {\n setTemporaryToken({ ...temporaryToken, value: newValue });\n };\n\n return (\n <InternalPopover\n ref={popoverRef}\n className={styles['token-label']}\n triggerType=\"text\"\n header={i18nStrings.editTokenHeader}\n size=\"large\"\n position=\"right\"\n dismissAriaLabel={i18nStrings.dismissAriaLabel}\n __onOpen={() => setTemporaryToken(token)}\n renderWithPortal={expandToViewport}\n content={\n <div className={styles['token-editor']}>\n <div className={styles['token-editor-form']}>\n <InternalFormField label={i18nStrings.propertyText} className={styles['token-editor-field-property']}>\n <PropertyInput\n property={property}\n onChangePropertyKey={onChangePropertyKey}\n asyncProps={asyncProperties ? asyncProps : null}\n filteringProperties={filteringProperties}\n onLoadItems={onLoadItems}\n customGroupsText={customGroupsText}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n </InternalFormField>\n\n <InternalFormField label={i18nStrings.operatorText} className={styles['token-editor-field-operator']}>\n <OperatorInput\n property={property}\n operator={operator}\n onChangeOperator={onChangeOperator}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n </InternalFormField>\n\n <InternalFormField label={i18nStrings.valueText} className={styles['token-editor-field-value']}>\n <ValueInput\n property={property}\n operator={operator}\n value={value}\n onChangeValue={onChangeValue}\n asyncProps={asyncProps}\n filteringOptions={filteringOptions}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n />\n </InternalFormField>\n </div>\n\n <div className={styles['token-editor-actions']}>\n <InternalButton\n formAction=\"none\"\n variant=\"link\"\n className={styles['token-editor-cancel']}\n onClick={closePopover}\n >\n {i18nStrings.cancelActionText}\n </InternalButton>\n <InternalButton\n className={styles['token-editor-submit']}\n formAction=\"none\"\n onClick={() => {\n setToken(matchTokenValue(temporaryToken, filteringOptions));\n closePopover();\n }}\n >\n {i18nStrings.applyActionText}\n </InternalButton>\n </div>\n </div>\n }\n >\n {triggerComponent}\n </InternalPopover>\n );\n}\n"]}