@razorpay/blade 12.19.0 → 12.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/ActionList/ActionListItem.js +1 -1
- package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/native/components/DatePicker/FilterChipDatePicker/FilterChipDatePicker.native.js +7 -0
- package/build/lib/native/components/DatePicker/FilterChipDatePicker/FilterChipDatePicker.native.js.map +1 -0
- package/build/lib/native/components/Dropdown/Dropdown.js +1 -1
- package/build/lib/native/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/native/components/Dropdown/FilterChipGroup.native.js +7 -0
- package/build/lib/native/components/Dropdown/FilterChipGroup.native.js.map +1 -0
- package/build/lib/native/components/Dropdown/FilterChipSelectInput.native.js +7 -0
- package/build/lib/native/components/Dropdown/FilterChipSelectInput.native.js.map +1 -0
- package/build/lib/native/components/Dropdown/dropdownComponentIds.js +1 -1
- package/build/lib/native/components/Dropdown/dropdownComponentIds.js.map +1 -1
- package/build/lib/native/components/Dropdown/useDropdown.js +1 -1
- package/build/lib/native/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/native/components/ListView/ListView.native.js +12 -0
- package/build/lib/native/components/ListView/ListView.native.js.map +1 -0
- package/build/lib/native/components/ListView/ListViewFilters.native.js +12 -0
- package/build/lib/native/components/ListView/ListViewFilters.native.js.map +1 -0
- package/build/lib/native/components/index.js +5 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js +32 -17
- package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js +516 -0
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js.map +1 -0
- package/build/lib/web/development/components/DatePicker/DatePicker.web.js +7 -421
- package/build/lib/web/development/components/DatePicker/DatePicker.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/FilterChipDatePicker/DatePickerFilterChip.web.js +67 -0
- package/build/lib/web/development/components/DatePicker/FilterChipDatePicker/DatePickerFilterChip.web.js.map +1 -0
- package/build/lib/web/development/components/DatePicker/FilterChipDatePicker/FilterChipDatePicker.web.js +14 -0
- package/build/lib/web/development/components/DatePicker/FilterChipDatePicker/FilterChipDatePicker.web.js.map +1 -0
- package/build/lib/web/development/components/DatePicker/FilterChipDatePicker/index.js +2 -0
- package/build/lib/web/development/components/DatePicker/FilterChipDatePicker/index.js.map +1 -0
- package/build/lib/web/development/components/DatePicker/index.js +1 -0
- package/build/lib/web/development/components/DatePicker/index.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/useDatesState.js +7 -1
- package/build/lib/web/development/components/DatePicker/useDatesState.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/Dropdown.js +21 -12
- package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/FilterChipGroup.web.js +74 -0
- package/build/lib/web/development/components/Dropdown/FilterChipGroup.web.js.map +1 -0
- package/build/lib/web/development/components/Dropdown/FilterChipGroupContext.web.js +18 -0
- package/build/lib/web/development/components/Dropdown/FilterChipGroupContext.web.js.map +1 -0
- package/build/lib/web/development/components/Dropdown/FilterChipSelectInput.web.js +217 -0
- package/build/lib/web/development/components/Dropdown/FilterChipSelectInput.web.js.map +1 -0
- package/build/lib/web/development/components/Dropdown/dropdownComponentIds.js +2 -1
- package/build/lib/web/development/components/Dropdown/dropdownComponentIds.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/index.js +2 -0
- package/build/lib/web/development/components/Dropdown/index.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/useDropdown.js +2 -0
- package/build/lib/web/development/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/development/components/FilterChip/BaseFilterChip.web.js +218 -0
- package/build/lib/web/development/components/FilterChip/BaseFilterChip.web.js.map +1 -0
- package/build/lib/web/development/components/FilterChip/tokens.js +9 -0
- package/build/lib/web/development/components/FilterChip/tokens.js.map +1 -0
- package/build/lib/web/development/components/ListView/ListView.web.js +28 -0
- package/build/lib/web/development/components/ListView/ListView.web.js.map +1 -0
- package/build/lib/web/development/components/ListView/ListViewFilters.web.js +240 -0
- package/build/lib/web/development/components/ListView/ListViewFilters.web.js.map +1 -0
- package/build/lib/web/development/components/ListView/ListViewFiltersContext.web.js +16 -0
- package/build/lib/web/development/components/ListView/ListViewFiltersContext.web.js.map +1 -0
- package/build/lib/web/development/components/ListView/index.js +3 -0
- package/build/lib/web/development/components/ListView/index.js.map +1 -0
- package/build/lib/web/development/components/index.js +6 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js +4 -0
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js +32 -17
- package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js +516 -0
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js.map +1 -0
- package/build/lib/web/production/components/DatePicker/DatePicker.web.js +7 -421
- package/build/lib/web/production/components/DatePicker/DatePicker.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/FilterChipDatePicker/DatePickerFilterChip.web.js +67 -0
- package/build/lib/web/production/components/DatePicker/FilterChipDatePicker/DatePickerFilterChip.web.js.map +1 -0
- package/build/lib/web/production/components/DatePicker/FilterChipDatePicker/FilterChipDatePicker.web.js +14 -0
- package/build/lib/web/production/components/DatePicker/FilterChipDatePicker/FilterChipDatePicker.web.js.map +1 -0
- package/build/lib/web/production/components/DatePicker/FilterChipDatePicker/index.js +2 -0
- package/build/lib/web/production/components/DatePicker/FilterChipDatePicker/index.js.map +1 -0
- package/build/lib/web/production/components/DatePicker/index.js +1 -0
- package/build/lib/web/production/components/DatePicker/index.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/useDatesState.js +7 -1
- package/build/lib/web/production/components/DatePicker/useDatesState.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/Dropdown.js +21 -12
- package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/FilterChipGroup.web.js +74 -0
- package/build/lib/web/production/components/Dropdown/FilterChipGroup.web.js.map +1 -0
- package/build/lib/web/production/components/Dropdown/FilterChipGroupContext.web.js +18 -0
- package/build/lib/web/production/components/Dropdown/FilterChipGroupContext.web.js.map +1 -0
- package/build/lib/web/production/components/Dropdown/FilterChipSelectInput.web.js +217 -0
- package/build/lib/web/production/components/Dropdown/FilterChipSelectInput.web.js.map +1 -0
- package/build/lib/web/production/components/Dropdown/dropdownComponentIds.js +2 -1
- package/build/lib/web/production/components/Dropdown/dropdownComponentIds.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/index.js +2 -0
- package/build/lib/web/production/components/Dropdown/index.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/useDropdown.js +2 -0
- package/build/lib/web/production/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/production/components/FilterChip/BaseFilterChip.web.js +218 -0
- package/build/lib/web/production/components/FilterChip/BaseFilterChip.web.js.map +1 -0
- package/build/lib/web/production/components/FilterChip/tokens.js +9 -0
- package/build/lib/web/production/components/FilterChip/tokens.js.map +1 -0
- package/build/lib/web/production/components/ListView/ListView.web.js +28 -0
- package/build/lib/web/production/components/ListView/ListView.web.js.map +1 -0
- package/build/lib/web/production/components/ListView/ListViewFilters.web.js +240 -0
- package/build/lib/web/production/components/ListView/ListViewFilters.web.js.map +1 -0
- package/build/lib/web/production/components/ListView/ListViewFiltersContext.web.js +16 -0
- package/build/lib/web/production/components/ListView/ListViewFiltersContext.web.js.map +1 -0
- package/build/lib/web/production/components/ListView/index.js +3 -0
- package/build/lib/web/production/components/ListView/index.js.map +1 -0
- package/build/lib/web/production/components/index.js +6 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js +4 -0
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/types/components/index.d.ts +143 -589
- package/build/types/components/index.native.d.ts +82 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterChipSelectInput.web.js","sources":["../../../../../../src/components/Dropdown/FilterChipSelectInput.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\n\nimport React, { useEffect } from 'react';\nimport { useDropdown } from './useDropdown';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { useFilterChipGroupContext } from './FilterChipGroupContext.web';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { BaseFilterChip } from '~components/FilterChip/BaseFilterChip';\nimport { getActionListContainerRole } from '~components/ActionList/getA11yRoles';\nimport type { BaseFilterChipProps } from '~components/FilterChip/types';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { useId } from '~utils/useId';\nimport { useListViewFilterContext } from '~components/ListView/ListViewFiltersContext.web';\nimport { useFirstRender } from '~utils/useFirstRender';\n\ntype FilterChipSelectInputProps = Pick<\n BaseFilterChipProps,\n 'onKeyDown' | 'value' | 'label' | 'testID' | 'onClick' | 'selectionType' | 'onBlur'\n> & {\n accessibilityLabel?: string;\n onChange?: (props: { name: string; values: string[] }) => void;\n name?: string;\n onClearButtonClick?: (props: { name: string; values: string[] }) => void;\n} & DataAnalyticsAttribute;\n\nconst _FilterChipSelectInput = (props: FilterChipSelectInputProps): React.ReactElement => {\n const idBase = useId('filter-chip-select-input');\n const {\n onClick,\n onBlur,\n onKeyDown,\n accessibilityLabel,\n testID,\n value,\n onClearButtonClick,\n label,\n onChange,\n name,\n ...rest\n } = props;\n const [uncontrolledInputValue, setUncontrolledInputValue] = React.useState<string[]>([]);\n const isFirstRender = useFirstRender();\n\n const {\n options,\n selectedIndices,\n onTriggerClick,\n onTriggerKeydown,\n dropdownBaseId,\n isOpen,\n activeIndex,\n hasFooterAction,\n triggererRef,\n selectionType,\n isControlled,\n setHasUnControlledFilterChipSelectInput,\n setSelectedIndices,\n controlledValueIndices,\n changeCallbackTriggerer,\n } = useDropdown();\n\n const isUnControlled = options.length > 0 && props.value === undefined;\n // Currently we are having 2 context for selectedFilters. One is for FilterChipGroup and other is for ListView\n const { listViewSelectedFilters, setListViewSelectedFilters } = useListViewFilterContext();\n const {\n clearFilterCallbackTriggerer,\n setFilterChipGroupSelectedFilters,\n } = useFilterChipGroupContext();\n\n const getValuesArrayFromIndices = (): string[] => {\n let indices: number[] = [];\n if (isControlled) {\n indices = controlledValueIndices;\n } else {\n indices = selectedIndices;\n }\n\n return indices.map((selectionIndex) => options[selectionIndex].value);\n };\n\n useEffect(() => {\n if (isUnControlled) {\n setHasUnControlledFilterChipSelectInput(true);\n if (listViewSelectedFilters[label]) {\n const value = (listViewSelectedFilters[label] as unknown) as number[];\n setSelectedIndices(value);\n const inputValue = value.map((selectionIndex) => options[selectionIndex].value);\n setUncontrolledInputValue(inputValue);\n setFilterChipGroupSelectedFilters((prev) =>\n prev.includes(label) ? prev : [...prev, label],\n );\n }\n } else if (listViewSelectedFilters[label]) {\n const value = (listViewSelectedFilters[label] as unknown) as number[];\n setSelectedIndices(value);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isUnControlled]);\n\n const getTitleFromValue = (value: string): string => {\n const option = options.find((option) => option.value === value);\n return option ? option.title : '';\n };\n\n const getUnControlledFilterChipValue = (): string | string[] => {\n if (selectionType === 'single') {\n if (uncontrolledInputValue.length > 0) {\n return getTitleFromValue(uncontrolledInputValue[0]);\n }\n return '';\n }\n return uncontrolledInputValue;\n };\n\n const handleClearButtonClick = (): void => {\n props.onClearButtonClick?.({ name: name ?? idBase, values: getValuesArrayFromIndices() });\n props.onChange?.({ name: name ?? idBase, values: [] });\n if (isUnControlled) {\n setUncontrolledInputValue([]);\n setSelectedIndices([]);\n }\n setFilterChipGroupSelectedFilters((prev) => prev.filter((filter) => filter !== label));\n setListViewSelectedFilters((prev) => {\n const { [label]: _, ...updatedFilters } = prev;\n return updatedFilters;\n });\n };\n\n useEffect(() => {\n if (clearFilterCallbackTriggerer) {\n handleClearButtonClick();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [clearFilterCallbackTriggerer]);\n\n useEffect(() => {\n if (!isFirstRender) {\n props.onChange?.({\n name: props.name || idBase,\n values: getValuesArrayFromIndices(),\n });\n if (isUnControlled) {\n setUncontrolledInputValue(getValuesArrayFromIndices());\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [changeCallbackTriggerer]);\n useEffect(() => {\n const isValueEmpty = selectedIndices.length === 0;\n if (!isFirstRender && !isValueEmpty) {\n setFilterChipGroupSelectedFilters((prev) => (prev.includes(label) ? prev : [...prev, label]));\n setListViewSelectedFilters((prev) => ({\n ...prev,\n [label]: selectedIndices as number[],\n }));\n } else if (!isFirstRender && isValueEmpty) {\n setFilterChipGroupSelectedFilters((prev) => prev.filter((filter) => filter !== label));\n setListViewSelectedFilters((prev) => {\n const { [label]: _, ...updatedFilters } = prev;\n return updatedFilters;\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [changeCallbackTriggerer]);\n\n return (\n <BaseFilterChip\n label={label}\n value={value ?? getUnControlledFilterChipValue()}\n onClearButtonClick={handleClearButtonClick}\n selectionType={selectionType}\n {...rest}\n ref={triggererRef as any}\n accessibilityProps={{\n label: accessibilityLabel ?? label,\n hasPopup: getActionListContainerRole(hasFooterAction, 'FilterChipSelectInput'),\n expanded: isOpen,\n controls: `${dropdownBaseId}-actionlist`,\n activeDescendant: activeIndex >= 0 ? `${dropdownBaseId}-${activeIndex}` : undefined,\n }}\n onClick={(e) => {\n onTriggerClick();\n // Setting it for web fails it on native typecheck and vice versa\n onClick?.(e as any);\n }}\n onBlur={(e) => {\n // With button trigger, there is no \"value\" as such. It's just clickable items\n // Setting it for web fails it on native typecheck and vice versa\n onBlur?.(e as any);\n }}\n onKeyDown={(e) => {\n onTriggerKeydown?.({ event: e as any });\n // Setting it for web fails it on native typecheck and vice versa\n onKeyDown?.(e as any);\n }}\n />\n );\n};\n\nconst FilterChipSelectInput = assignWithoutSideEffects(_FilterChipSelectInput, {\n componentId: dropdownComponentIds.triggers.FilterChipSelectInput,\n});\n\nexport { FilterChipSelectInput };\n"],"names":["_FilterChipSelectInput","props","idBase","useId","onClick","onBlur","onKeyDown","accessibilityLabel","testID","value","onClearButtonClick","label","onChange","name","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","uncontrolledInputValue","setUncontrolledInputValue","isFirstRender","useFirstRender","_useDropdown","useDropdown","options","selectedIndices","onTriggerClick","onTriggerKeydown","dropdownBaseId","isOpen","activeIndex","hasFooterAction","triggererRef","selectionType","isControlled","setHasUnControlledFilterChipSelectInput","setSelectedIndices","controlledValueIndices","changeCallbackTriggerer","isUnControlled","length","undefined","_useListViewFilterCon","useListViewFilterContext","listViewSelectedFilters","setListViewSelectedFilters","_useFilterChipGroupCo","useFilterChipGroupContext","clearFilterCallbackTriggerer","setFilterChipGroupSelectedFilters","getValuesArrayFromIndices","indices","map","selectionIndex","useEffect","inputValue","prev","includes","concat","_toConsumableArray","getTitleFromValue","option","find","title","getUnControlledFilterChipValue","handleClearButtonClick","_props$onClearButtonC","_props$onChange","call","values","filter","_","updatedFilters","_toPropertyKey","_props$onChange2","isValueEmpty","_objectSpread","_defineProperty","_jsx","BaseFilterChip","ref","accessibilityProps","hasPopup","getActionListContainerRole","expanded","controls","activeDescendant","e","event","FilterChipSelectInput","assignWithoutSideEffects","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAIC,KAAiC,EAAy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AgB,CAAG;AAAE6D,QAAAA,KAAK,EAAED,CAAAA;AAAS,OAAC,CAAC,CAAA;AACvC;AACArF,MAAAA,UAAS,aAATA,UAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAATA,UAAS,CAAGqF,CAAQ,CAAC,CAAA;AACvB,KAAA;AAAE,GAAA,CACH,CAAC,CAAA;AAEN,CAAC,CAAA;AAED,IAAME,qBAAqB,gBAAGC,wBAAwB,CAAC9F,sBAAsB,EAAE;AAC7E+F,EAAAA,WAAW,EAAEC,oBAAoB,CAACC,QAAQ,CAACJ,qBAAAA;AAC7C,CAAC;;;;"}
|
|
@@ -8,7 +8,8 @@ var dropdownComponentIds = {
|
|
|
8
8
|
DropdownLink: 'DropdownLink',
|
|
9
9
|
AutoComplete: 'AutoComplete',
|
|
10
10
|
SearchInput: 'SearchInput',
|
|
11
|
-
DropdownIconButton: 'DropdownIconButton'
|
|
11
|
+
DropdownIconButton: 'DropdownIconButton',
|
|
12
|
+
FilterChipSelectInput: 'FilterChipSelectInput'
|
|
12
13
|
}
|
|
13
14
|
};
|
|
14
15
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdownComponentIds.js","sources":["../../../../../../src/components/Dropdown/dropdownComponentIds.ts"],"sourcesContent":["export const dropdownComponentIds = {\n DropdownOverlay: 'DropdownOverlay',\n Dropdown: 'Dropdown',\n BaseBox: 'BaseBox',\n triggers: {\n SelectInput: 'SelectInput',\n DropdownButton: 'DropdownButton',\n DropdownLink: 'DropdownLink',\n AutoComplete: 'AutoComplete',\n SearchInput: 'SearchInput',\n DropdownIconButton: 'DropdownIconButton',\n },\n};\n"],"names":["dropdownComponentIds","DropdownOverlay","Dropdown","BaseBox","triggers","SelectInput","DropdownButton","DropdownLink","AutoComplete","SearchInput","DropdownIconButton"],"mappings":"AAAO,IAAMA,oBAAoB,GAAG;AAClCC,EAAAA,eAAe,EAAE,iBAAiB;AAClCC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,WAAW,EAAE,aAAa;AAC1BC,IAAAA,cAAc,EAAE,gBAAgB;AAChCC,IAAAA,YAAY,EAAE,cAAc;AAC5BC,IAAAA,YAAY,EAAE,cAAc;AAC5BC,IAAAA,WAAW,EAAE,aAAa;AAC1BC,IAAAA,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"dropdownComponentIds.js","sources":["../../../../../../src/components/Dropdown/dropdownComponentIds.ts"],"sourcesContent":["export const dropdownComponentIds = {\n DropdownOverlay: 'DropdownOverlay',\n Dropdown: 'Dropdown',\n BaseBox: 'BaseBox',\n triggers: {\n SelectInput: 'SelectInput',\n DropdownButton: 'DropdownButton',\n DropdownLink: 'DropdownLink',\n AutoComplete: 'AutoComplete',\n SearchInput: 'SearchInput',\n DropdownIconButton: 'DropdownIconButton',\n FilterChipSelectInput: 'FilterChipSelectInput',\n },\n};\n"],"names":["dropdownComponentIds","DropdownOverlay","Dropdown","BaseBox","triggers","SelectInput","DropdownButton","DropdownLink","AutoComplete","SearchInput","DropdownIconButton","FilterChipSelectInput"],"mappings":"AAAO,IAAMA,oBAAoB,GAAG;AAClCC,EAAAA,eAAe,EAAE,iBAAiB;AAClCC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,WAAW,EAAE,aAAa;AAC1BC,IAAAA,cAAc,EAAE,gBAAgB;AAChCC,IAAAA,YAAY,EAAE,cAAc;AAC5BC,IAAAA,YAAY,EAAE,cAAc;AAC5BC,IAAAA,WAAW,EAAE,aAAa;AAC1BC,IAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,IAAAA,qBAAqB,EAAE,uBAAA;AACzB,GAAA;AACF;;;;"}
|
|
@@ -5,4 +5,6 @@ export { DropdownLink } from './DropdownLink.js';
|
|
|
5
5
|
export { DropdownIconButton } from './DropdownIconButton.js';
|
|
6
6
|
export { DropdownFooter, DropdownHeader } from './DropdownHeaderFooter.js';
|
|
7
7
|
import './types.js';
|
|
8
|
+
export { FilterChipSelectInput } from './FilterChipSelectInput.web.js';
|
|
9
|
+
export { FilterChipGroup } from './FilterChipGroup.web.js';
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -44,6 +44,8 @@ var DropdownContext = /*#__PURE__*/React__default.createContext({
|
|
|
44
44
|
setChangeCallbackTriggerer: noop,
|
|
45
45
|
isControlled: false,
|
|
46
46
|
setIsControlled: noop,
|
|
47
|
+
hasUnControlledFilterChipSelectInput: false,
|
|
48
|
+
setHasUnControlledFilterChipSelectInput: noop,
|
|
47
49
|
dropdownBaseId: '',
|
|
48
50
|
actionListItemRef: {
|
|
49
51
|
current: null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDropdown.js","sources":["../../../../../../src/components/Dropdown/useDropdown.ts"],"sourcesContent":["import React from 'react';\n\nimport {\n ensureScrollVisiblity,\n getActionFromKey,\n getIndexByLetter,\n getUpdatedIndex,\n makeInputDisplayValue,\n makeInputValue,\n performAction,\n} from './dropdownUtils';\nimport type { SelectActionsType } from './dropdownUtils';\nimport type { DropdownProps } from './types';\n\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport type { FormInputHandleOnKeyDownEvent } from '~components/Form/FormTypes';\nimport { isReactNative, isBrowser } from '~utils';\nimport type { ContainerElementType } from '~utils/types';\nimport { fireNativeEvent } from '~utils/fireNativeEvent';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\ntype OptionsType = {\n title: string;\n value: string;\n onClickTrigger?: (isSelected: boolean) => void;\n}[];\n\ntype DropdownContextType = {\n isOpen: boolean;\n setIsOpen: (isOpen: boolean) => void;\n close: () => void;\n /**\n * contains the indexes of selected items\n */\n selectedIndices: number[];\n setSelectedIndices: (value: number[]) => void;\n /**\n * contains the indexes of selected items during controlled selection\n */\n controlledValueIndices: number[];\n setControlledValueIndices: (value: number[]) => void;\n /**\n * contains information about all the options inside actionlist\n */\n options: OptionsType;\n setOptions: (value: OptionsType) => void;\n\n /**\n * Filtered values for AutoComplete Inputs\n */\n filteredValues: string[];\n setFilteredValues: (values: string[]) => void;\n\n /** Currently active (focussed) index */\n activeIndex: number;\n setActiveIndex: (value: number) => void;\n\n /** Currently active (focussed) tag */\n activeTagIndex: number;\n setActiveTagIndex: (value: number) => void;\n\n /**\n * Sometimes we want to ignore the blur event to keep dropdown open but not ignore the blur animation from selectinput\n * E.g. When someone clicks on Footer, we just want to ignore the blur event and not the blur animation\n */\n shouldIgnoreBlurAnimation: boolean;\n setShouldIgnoreBlurAnimation: (value: boolean) => void;\n /** Tells you if keyboard was used. Its false by default and turns into true when keydown is called */\n isKeydownPressed: boolean;\n setIsKeydownPressed: (value: boolean) => void;\n /** common baseId which is prepended to multiple other ids inside this dropdown */\n dropdownBaseId: string;\n /** Which element has triggered the dropdown */\n dropdownTriggerer?:\n | 'SelectInput'\n | 'DropdownButton'\n | 'DropdownIconButton'\n | 'AutoComplete'\n | 'DropdownLink'\n | 'SearchInput';\n /** ref of triggerer. Used to call focus in certain places */\n triggererRef: React.MutableRefObject<HTMLButtonElement | null>;\n triggererWrapperRef: React.MutableRefObject<ContainerElementType | null>;\n actionListItemRef: React.RefObject<HTMLDivElement | null>;\n isTagDismissedRef: React.RefObject<{ value: boolean } | null>;\n visibleTagsCountRef: React.RefObject<{ value: number } | null>;\n\n selectionType?: DropdownProps['selectionType'];\n /** whether footer has an action item.\n * certain a11y behaviour changes happen here\n * E.g. tabbing moves focus to that action instead of outside\n */\n hasFooterAction: boolean;\n setHasFooterAction: (value: boolean) => void;\n\n /**\n * Apart from dropdownTriggerer prop, we also set this boolean because in BottomSheet, the initial trigger can be Select but also have autocomplete inside of it\n */\n hasAutoCompleteInBottomSheetHeader: boolean;\n setHasAutoCompleteInBottomSheetHeader: (value: boolean) => void;\n\n /**\n * A value that can be used in dependency array to know when Dropdown value is changed.\n *\n * E.g.\n * ```ts\n * useEffect(() => {\n * console.log('Uncontrolled value change');\n * }, [changeCallbackTriggerer])\n * ```\n */\n changeCallbackTriggerer: number;\n setChangeCallbackTriggerer: (changeCallbackTriggerer: number) => void;\n\n /**\n * true when SelectInput has `value` prop (when it is controlled)\n */\n isControlled: boolean;\n setIsControlled: (isControlled: boolean) => void;\n};\n\nconst DropdownContext = React.createContext<DropdownContextType>({\n isOpen: false,\n setIsOpen: noop,\n close: noop,\n selectedIndices: [],\n setSelectedIndices: noop,\n controlledValueIndices: [],\n setControlledValueIndices: noop,\n options: [],\n setOptions: noop,\n filteredValues: [],\n setFilteredValues: noop,\n activeIndex: -1,\n setActiveIndex: noop,\n activeTagIndex: -1,\n setActiveTagIndex: noop,\n shouldIgnoreBlurAnimation: false,\n setShouldIgnoreBlurAnimation: noop,\n hasFooterAction: false,\n setHasFooterAction: noop,\n hasAutoCompleteInBottomSheetHeader: false,\n setHasAutoCompleteInBottomSheetHeader: noop,\n isKeydownPressed: false,\n setIsKeydownPressed: noop,\n changeCallbackTriggerer: 0,\n setChangeCallbackTriggerer: noop,\n isControlled: false,\n setIsControlled: noop,\n dropdownBaseId: '',\n actionListItemRef: {\n current: null,\n },\n triggererRef: {\n current: null,\n },\n isTagDismissedRef: {\n current: null,\n },\n visibleTagsCountRef: {\n current: null,\n },\n triggererWrapperRef: {\n current: null,\n },\n});\n\nlet searchTimeout: number;\nlet searchString = '';\n\ntype UseDropdownReturnValue = DropdownContextType & {\n /**\n * Click event on combobox. Toggles the dropdown\n */\n onTriggerClick: () => void;\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n onTriggerKeydown: FormInputHandleOnKeyDownEvent | undefined;\n\n /**\n * Handles the click even on option.\n *\n * Contains the logic that selects the option, moves the focus, etc\n */\n onOptionClick: (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ) => void;\n\n /**\n * Removes the option with given optionsIndex\n */\n removeOption: (index: number) => void;\n\n /**\n * value that is used during form submissions\n */\n value: string;\n /**\n * This is the value that is displayed inside select after selection\n */\n displayValue: string;\n};\n\n/**\n * Handles almost all the functionality of dropdown.\n *\n * Returns the values from DropdownContext along with some helper functions and event handlers\n *\n */\nconst useDropdown = (): UseDropdownReturnValue => {\n const {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n options,\n selectionType,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setControlledValueIndices,\n filteredValues,\n dropdownTriggerer,\n ...rest\n } = React.useContext(DropdownContext);\n\n type SelectOptionType = (\n index: number,\n properties?: {\n closeOnSelection?: boolean;\n },\n ) => boolean;\n\n const setIndices = (indices: number[]): void => {\n if (isControlled) {\n setControlledValueIndices(indices);\n } else {\n setSelectedIndices(indices);\n }\n };\n\n const removeOption = (index: number): void => {\n // remove existing item\n const existingItemIndex = selectedIndices.indexOf(index);\n if (existingItemIndex < 0) {\n return;\n }\n\n setIndices([\n ...selectedIndices.slice(0, existingItemIndex),\n ...selectedIndices.slice(existingItemIndex + 1),\n ]);\n };\n\n /**\n * Marks the given index as selected.\n *\n * In single select, it also closes the menu.\n * In multiselect, it keeps the menu open for more selections\n */\n const selectOption: SelectOptionType = (\n index,\n properties = {\n closeOnSelection: true,\n },\n ) => {\n let isSelected = false;\n\n if (index < 0 || index > options.length - 1) {\n return isSelected;\n }\n\n if (selectionType === 'multiple') {\n if (selectedIndices.includes(index)) {\n removeOption(index);\n isSelected = false;\n } else {\n setIndices([...selectedIndices, index]);\n isSelected = true;\n }\n } else {\n setIndices([index]);\n isSelected = true;\n }\n\n // Triggers `onChange` on SelectInput\n setChangeCallbackTriggerer(changeCallbackTriggerer + 1);\n\n if (activeIndex !== index) {\n setActiveIndex(index);\n }\n\n if (properties?.closeOnSelection && selectionType !== 'multiple') {\n close();\n }\n\n return isSelected;\n };\n\n /**\n * Click listener for combobox (or any triggerer of the dropdown)\n */\n const onTriggerClick = (): void => {\n if (isOpen) {\n close();\n } else {\n setIsOpen(true);\n }\n };\n\n /**\n * Function that we call when we want to move focus from one option to other\n */\n const onOptionChange = (actionType: SelectActionsType, index?: number): void => {\n setActiveTagIndex(-1);\n const newIndex = index ?? activeIndex;\n let updatedIndex: number;\n const hasAutoComplete =\n rest.hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n if (hasAutoComplete && filteredValues.length > 0) {\n // When its autocomplete, we don't loop over all options. We only loop on filtered options\n\n const filteredIndexes = filteredValues\n .map((filteredValue) => options.findIndex((option) => option.value === filteredValue))\n .sort((a, b) => a - b);\n\n updatedIndex =\n filteredIndexes[\n getUpdatedIndex({\n currentIndex: filteredIndexes.indexOf(newIndex),\n maxIndex: filteredIndexes.length - 1,\n actionType,\n })\n ];\n } else {\n updatedIndex = getUpdatedIndex({\n currentIndex: newIndex,\n maxIndex: options.length - 1,\n actionType,\n });\n }\n setActiveIndex(updatedIndex);\n\n const optionValues = options.map((option) => option.value);\n ensureScrollVisiblity(updatedIndex, rest.actionListItemRef.current, optionValues);\n if (isBrowser()) {\n fireNativeEvent(rest.actionListItemRef as React.RefObject<HTMLElement>, ['change', 'input']);\n }\n };\n\n /**\n * Click handler when user clicks on any particular option.\n *\n * It\n * - changes the option focus\n * - selects that option\n * - moves focus to combobox\n */\n const onOptionClick = (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ): void => {\n const actionType = getActionFromKey(e, isOpen, dropdownTriggerer);\n if (typeof actionType === 'number') {\n onOptionChange(actionType, index);\n }\n selectOption(index);\n if (!isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n };\n\n /**\n * Function we call to handle the typeahead.\n *\n * It takes a letter, stores that letter in searchString (and clears it after timeout) to maintain a word\n *\n * Then searches for that word in options and moves focus there.\n */\n const onComboType = (letter: string, actionType: SelectActionsType): void => {\n // open the listbox if it is closed\n setIsOpen(true);\n\n if (\n rest.hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete\n ) {\n return;\n }\n\n if (typeof searchTimeout === 'number') {\n window.clearTimeout(searchTimeout);\n }\n\n searchTimeout = window.setTimeout(() => {\n searchString = '';\n }, 500);\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n searchString = searchString + letter;\n const optionTitles = options.map((option) => option.title);\n const searchIndex = getIndexByLetter(optionTitles, searchString, activeIndex + 1);\n\n // if a match was found, go to it\n if (searchIndex >= 0) {\n onOptionChange(actionType, searchIndex);\n }\n // if no matches, clear the timeout and search string\n else {\n window.clearTimeout(searchTimeout);\n searchString = '';\n }\n };\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n const onTriggerKeydown = (e: {\n event: React.KeyboardEvent<HTMLInputElement | HTMLButtonElement>;\n }): void => {\n if (!isKeydownPressed && ![' ', 'Enter', 'Escape', 'Meta'].includes(e.event.key)) {\n // When keydown is not already pressed and its not Enter, Space, Command, or Escape key (those are generic keys and we only want to handle arrow keys or home buttons etc)\n setIsKeydownPressed(true);\n }\n\n const actionType = getActionFromKey(e.event, isOpen, dropdownTriggerer);\n\n if (actionType) {\n performAction(actionType, e, {\n setIsOpen,\n close,\n onOptionChange,\n onComboType,\n selectCurrentOption: () => {\n if (activeIndex < 0) {\n return;\n }\n\n const isSelected = selectOption(activeIndex);\n if (rest.hasFooterAction && !isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n\n options[activeIndex].onClickTrigger?.(isSelected);\n },\n });\n }\n };\n\n return {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n filteredValues,\n removeOption,\n setControlledValueIndices,\n onTriggerClick,\n onTriggerKeydown,\n onOptionClick,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n options,\n value: makeInputValue(selectedIndices, options),\n displayValue: makeInputDisplayValue(selectedIndices, options),\n selectionType,\n dropdownTriggerer,\n ...rest,\n };\n};\n\nexport type { DropdownContextType, OptionsType };\nexport { useDropdown, DropdownContext };\n"],"names":["noop","DropdownContext","React","createContext","isOpen","setIsOpen","close","selectedIndices","setSelectedIndices","controlledValueIndices","setControlledValueIndices","options","setOptions","filteredValues","setFilteredValues","activeIndex","setActiveIndex","activeTagIndex","setActiveTagIndex","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","hasFooterAction","setHasFooterAction","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","isKeydownPressed","setIsKeydownPressed","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setIsControlled","dropdownBaseId","actionListItemRef","current","triggererRef","isTagDismissedRef","visibleTagsCountRef","triggererWrapperRef","searchTimeout","searchString","useDropdown","_React$useContext","useContext","selectionType","dropdownTriggerer","rest","_objectWithoutProperties","_excluded","setIndices","indices","removeOption","index","existingItemIndex","indexOf","concat","_toConsumableArray","slice","selectOption","properties","arguments","length","undefined","closeOnSelection","isSelected","includes","onTriggerClick","onOptionChange","actionType","newIndex","updatedIndex","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredIndexes","map","filteredValue","findIndex","option","value","sort","a","b","getUpdatedIndex","currentIndex","maxIndex","optionValues","ensureScrollVisiblity","isBrowser","fireNativeEvent","onOptionClick","e","getActionFromKey","isReactNative","_rest$triggererRef$cu","focus","onComboType","letter","window","clearTimeout","setTimeout","optionTitles","title","searchIndex","getIndexByLetter","onTriggerKeydown","event","key","performAction","selectCurrentOption","_options$activeIndex$","_options$activeIndex","_rest$triggererRef$cu2","onClickTrigger","call","_objectSpread","makeInputValue","displayValue","makeInputDisplayValue"],"mappings":";;;;;;;;;;;;;;;;AAoBA;AACA,IAAMA,IAAI,GAAG,SAAPA,IAAIA,GAAe,EAAE,CAAA;AAsG3B,IAAMC,eAAe,gBAAGC,cAAK,CAACC,aAAa,CAAsB;AAC/DC,EAAAA,MAAM,EAAE,KAAK;AACbC,EAAAA,SAAS,EAAEL,IAAI;AACfM,EAAAA,KAAK,EAAEN,IAAI;AACXO,EAAAA,eAAe,EAAE,EAAE;AACnBC,EAAAA,kBAAkB,EAAER,IAAI;AACxBS,EAAAA,sBAAsB,EAAE,EAAE;AAC1BC,EAAAA,yBAAyB,EAAEV,IAAI;AAC/BW,EAAAA,OAAO,EAAE,EAAE;AACXC,EAAAA,UAAU,EAAEZ,IAAI;AAChBa,EAAAA,cAAc,EAAE,EAAE;AAClBC,EAAAA,iBAAiB,EAAEd,IAAI;EACvBe,WAAW,EAAE,CAAC,CAAC;AACfC,EAAAA,cAAc,EAAEhB,IAAI;EACpBiB,cAAc,EAAE,CAAC,CAAC;AAClBC,EAAAA,iBAAiB,EAAElB,IAAI;AACvBmB,EAAAA,yBAAyB,EAAE,KAAK;AAChCC,EAAAA,4BAA4B,EAAEpB,IAAI;AAClCqB,EAAAA,eAAe,EAAE,KAAK;AACtBC,EAAAA,kBAAkB,EAAEtB,IAAI;AACxBuB,EAAAA,kCAAkC,EAAE,KAAK;AACzCC,EAAAA,qCAAqC,EAAExB,IAAI;AAC3CyB,EAAAA,gBAAgB,EAAE,KAAK;AACvBC,EAAAA,mBAAmB,EAAE1B,IAAI;AACzB2B,EAAAA,uBAAuB,EAAE,CAAC;AAC1BC,EAAAA,0BAA0B,EAAE5B,IAAI;AAChC6B,EAAAA,YAAY,EAAE,KAAK;AACnBC,EAAAA,eAAe,EAAE9B,IAAI;AACrB+B,EAA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AA,MAAM,EAANA,MAAM;AACNC,IAAAA,SAAS,EAATA,SAAS;AACTC,IAAAA,KAAK,EAALA,KAAK;AACLC,IAAAA,eAAe,EAAfA,eAAe;AACfC,IAAAA,kBAAkB,EAAlBA,kBAAkB;AAClBK,IAAAA,cAAc,EAAdA,cAAc;AACdqC,IAAAA,YAAY,EAAZA,YAAY;AACZxC,IAAAA,yBAAyB,EAAzBA,yBAAyB;AACzBuD,IAAAA,cAAc,EAAdA,cAAc;AACdwC,IAAAA,gBAAgB,EAAhBA,gBAAgB;AAChBf,IAAAA,aAAa,EAAbA,aAAa;AACb3E,IAAAA,WAAW,EAAXA,WAAW;AACXC,IAAAA,cAAc,EAAdA,cAAc;AACdC,IAAAA,cAAc,EAAdA,cAAc;AACdC,IAAAA,iBAAiB,EAAjBA,iBAAiB;AACjBkB,IAAAA,mBAAmB,EAAnBA,mBAAmB;AACnBX,IAAAA,gBAAgB,EAAhBA,gBAAgB;AAChBC,IAAAA,mBAAmB,EAAnBA,mBAAmB;AACnBC,IAAAA,uBAAuB,EAAvBA,uBAAuB;AACvBC,IAAAA,0BAA0B,EAA1BA,0BAA0B;AAC1BC,IAAAA,YAAY,EAAZA,YAAY;AACZlB,IAAAA,OAAO,EAAPA,OAAO;AACPoE,IAAAA,KAAK,EAAEqC,cAAc,CAAC7G,eAAe,EAAEI,OAAO,CAAC;AAC/C0G,IAAAA,YAAY,EAAEC,qBAAqB,CAAC/G,eAAe,EAAEI,OAAO,CAAC;AAC7DgC,IAAAA,aAAa,EAAbA,aAAa;AACbC,IAAAA,iBAAiB,EAAjBA,iBAAAA;AAAiB,GAAA,EACdC,IAAI,CAAA,CAAA;AAEX;;;;"}
|
|
1
|
+
{"version":3,"file":"useDropdown.js","sources":["../../../../../../src/components/Dropdown/useDropdown.ts"],"sourcesContent":["import React from 'react';\n\nimport {\n ensureScrollVisiblity,\n getActionFromKey,\n getIndexByLetter,\n getUpdatedIndex,\n makeInputDisplayValue,\n makeInputValue,\n performAction,\n} from './dropdownUtils';\nimport type { SelectActionsType } from './dropdownUtils';\nimport type { DropdownProps } from './types';\n\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport type { FormInputHandleOnKeyDownEvent } from '~components/Form/FormTypes';\nimport { isReactNative, isBrowser } from '~utils';\nimport type { ContainerElementType } from '~utils/types';\nimport { fireNativeEvent } from '~utils/fireNativeEvent';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\ntype OptionsType = {\n title: string;\n value: string;\n onClickTrigger?: (isSelected: boolean) => void;\n}[];\n\ntype DropdownContextType = {\n isOpen: boolean;\n setIsOpen: (isOpen: boolean) => void;\n close: () => void;\n /**\n * contains the indexes of selected items\n */\n selectedIndices: number[];\n setSelectedIndices: (value: number[]) => void;\n /**\n * contains the indexes of selected items during controlled selection\n */\n controlledValueIndices: number[];\n setControlledValueIndices: (value: number[]) => void;\n /**\n * contains information about all the options inside actionlist\n */\n options: OptionsType;\n setOptions: (value: OptionsType) => void;\n\n /**\n * Filtered values for AutoComplete Inputs\n */\n filteredValues: string[];\n setFilteredValues: (values: string[]) => void;\n\n /** Currently active (focussed) index */\n activeIndex: number;\n setActiveIndex: (value: number) => void;\n\n /** Currently active (focussed) tag */\n activeTagIndex: number;\n setActiveTagIndex: (value: number) => void;\n\n /**\n * Sometimes we want to ignore the blur event to keep dropdown open but not ignore the blur animation from selectinput\n * E.g. When someone clicks on Footer, we just want to ignore the blur event and not the blur animation\n */\n shouldIgnoreBlurAnimation: boolean;\n setShouldIgnoreBlurAnimation: (value: boolean) => void;\n /** Tells you if keyboard was used. Its false by default and turns into true when keydown is called */\n isKeydownPressed: boolean;\n setIsKeydownPressed: (value: boolean) => void;\n /** common baseId which is prepended to multiple other ids inside this dropdown */\n dropdownBaseId: string;\n /** Which element has triggered the dropdown */\n dropdownTriggerer?:\n | 'SelectInput'\n | 'DropdownButton'\n | 'DropdownIconButton'\n | 'AutoComplete'\n | 'DropdownLink'\n | 'SearchInput'\n | 'FilterChipSelectInput';\n\n /** ref of triggerer. Used to call focus in certain places */\n triggererRef: React.MutableRefObject<HTMLButtonElement | null>;\n triggererWrapperRef: React.MutableRefObject<ContainerElementType | null>;\n actionListItemRef: React.RefObject<HTMLDivElement | null>;\n isTagDismissedRef: React.RefObject<{ value: boolean } | null>;\n visibleTagsCountRef: React.RefObject<{ value: number } | null>;\n\n selectionType?: DropdownProps['selectionType'];\n /** whether footer has an action item.\n * certain a11y behaviour changes happen here\n * E.g. tabbing moves focus to that action instead of outside\n */\n hasFooterAction: boolean;\n setHasFooterAction: (value: boolean) => void;\n\n /**\n * Whether the FilterChipSelectInput is uncontrolled\n */\n hasUnControlledFilterChipSelectInput: boolean;\n setHasUnControlledFilterChipSelectInput: (value: boolean) => void;\n /**\n * Apart from dropdownTriggerer prop, we also set this boolean because in BottomSheet, the initial trigger can be Select but also have autocomplete inside of it\n */\n hasAutoCompleteInBottomSheetHeader: boolean;\n setHasAutoCompleteInBottomSheetHeader: (value: boolean) => void;\n\n /**\n * A value that can be used in dependency array to know when Dropdown value is changed.\n *\n * E.g.\n * ```ts\n * useEffect(() => {\n * console.log('Uncontrolled value change');\n * }, [changeCallbackTriggerer])\n * ```\n */\n changeCallbackTriggerer: number;\n setChangeCallbackTriggerer: (changeCallbackTriggerer: number) => void;\n\n /**\n * true when SelectInput has `value` prop (when it is controlled)\n */\n isControlled: boolean;\n setIsControlled: (isControlled: boolean) => void;\n};\n\nconst DropdownContext = React.createContext<DropdownContextType>({\n isOpen: false,\n setIsOpen: noop,\n close: noop,\n selectedIndices: [],\n setSelectedIndices: noop,\n controlledValueIndices: [],\n setControlledValueIndices: noop,\n options: [],\n setOptions: noop,\n filteredValues: [],\n setFilteredValues: noop,\n activeIndex: -1,\n setActiveIndex: noop,\n activeTagIndex: -1,\n setActiveTagIndex: noop,\n shouldIgnoreBlurAnimation: false,\n setShouldIgnoreBlurAnimation: noop,\n hasFooterAction: false,\n setHasFooterAction: noop,\n hasAutoCompleteInBottomSheetHeader: false,\n setHasAutoCompleteInBottomSheetHeader: noop,\n isKeydownPressed: false,\n setIsKeydownPressed: noop,\n changeCallbackTriggerer: 0,\n setChangeCallbackTriggerer: noop,\n isControlled: false,\n setIsControlled: noop,\n hasUnControlledFilterChipSelectInput: false,\n setHasUnControlledFilterChipSelectInput: noop,\n dropdownBaseId: '',\n actionListItemRef: {\n current: null,\n },\n triggererRef: {\n current: null,\n },\n isTagDismissedRef: {\n current: null,\n },\n visibleTagsCountRef: {\n current: null,\n },\n triggererWrapperRef: {\n current: null,\n },\n});\n\nlet searchTimeout: number;\nlet searchString = '';\n\ntype UseDropdownReturnValue = DropdownContextType & {\n /**\n * Click event on combobox. Toggles the dropdown\n */\n onTriggerClick: () => void;\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n onTriggerKeydown: FormInputHandleOnKeyDownEvent | undefined;\n\n /**\n * Handles the click even on option.\n *\n * Contains the logic that selects the option, moves the focus, etc\n */\n onOptionClick: (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ) => void;\n\n /**\n * Removes the option with given optionsIndex\n */\n removeOption: (index: number) => void;\n\n /**\n * value that is used during form submissions\n */\n value: string;\n /**\n * This is the value that is displayed inside select after selection\n */\n displayValue: string;\n};\n\n/**\n * Handles almost all the functionality of dropdown.\n *\n * Returns the values from DropdownContext along with some helper functions and event handlers\n *\n */\nconst useDropdown = (): UseDropdownReturnValue => {\n const {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n options,\n selectionType,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setControlledValueIndices,\n filteredValues,\n dropdownTriggerer,\n ...rest\n } = React.useContext(DropdownContext);\n\n type SelectOptionType = (\n index: number,\n properties?: {\n closeOnSelection?: boolean;\n },\n ) => boolean;\n\n const setIndices = (indices: number[]): void => {\n if (isControlled) {\n setControlledValueIndices(indices);\n } else {\n setSelectedIndices(indices);\n }\n };\n\n const removeOption = (index: number): void => {\n // remove existing item\n const existingItemIndex = selectedIndices.indexOf(index);\n if (existingItemIndex < 0) {\n return;\n }\n\n setIndices([\n ...selectedIndices.slice(0, existingItemIndex),\n ...selectedIndices.slice(existingItemIndex + 1),\n ]);\n };\n\n /**\n * Marks the given index as selected.\n *\n * In single select, it also closes the menu.\n * In multiselect, it keeps the menu open for more selections\n */\n const selectOption: SelectOptionType = (\n index,\n properties = {\n closeOnSelection: true,\n },\n ) => {\n let isSelected = false;\n\n if (index < 0 || index > options.length - 1) {\n return isSelected;\n }\n\n if (selectionType === 'multiple') {\n if (selectedIndices.includes(index)) {\n removeOption(index);\n isSelected = false;\n } else {\n setIndices([...selectedIndices, index]);\n isSelected = true;\n }\n } else {\n setIndices([index]);\n isSelected = true;\n }\n\n // Triggers `onChange` on SelectInput\n setChangeCallbackTriggerer(changeCallbackTriggerer + 1);\n\n if (activeIndex !== index) {\n setActiveIndex(index);\n }\n\n if (properties?.closeOnSelection && selectionType !== 'multiple') {\n close();\n }\n\n return isSelected;\n };\n\n /**\n * Click listener for combobox (or any triggerer of the dropdown)\n */\n const onTriggerClick = (): void => {\n if (isOpen) {\n close();\n } else {\n setIsOpen(true);\n }\n };\n\n /**\n * Function that we call when we want to move focus from one option to other\n */\n const onOptionChange = (actionType: SelectActionsType, index?: number): void => {\n setActiveTagIndex(-1);\n const newIndex = index ?? activeIndex;\n let updatedIndex: number;\n const hasAutoComplete =\n rest.hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n if (hasAutoComplete && filteredValues.length > 0) {\n // When its autocomplete, we don't loop over all options. We only loop on filtered options\n\n const filteredIndexes = filteredValues\n .map((filteredValue) => options.findIndex((option) => option.value === filteredValue))\n .sort((a, b) => a - b);\n\n updatedIndex =\n filteredIndexes[\n getUpdatedIndex({\n currentIndex: filteredIndexes.indexOf(newIndex),\n maxIndex: filteredIndexes.length - 1,\n actionType,\n })\n ];\n } else {\n updatedIndex = getUpdatedIndex({\n currentIndex: newIndex,\n maxIndex: options.length - 1,\n actionType,\n });\n }\n setActiveIndex(updatedIndex);\n\n const optionValues = options.map((option) => option.value);\n ensureScrollVisiblity(updatedIndex, rest.actionListItemRef.current, optionValues);\n if (isBrowser()) {\n fireNativeEvent(rest.actionListItemRef as React.RefObject<HTMLElement>, ['change', 'input']);\n }\n };\n\n /**\n * Click handler when user clicks on any particular option.\n *\n * It\n * - changes the option focus\n * - selects that option\n * - moves focus to combobox\n */\n const onOptionClick = (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ): void => {\n const actionType = getActionFromKey(e, isOpen, dropdownTriggerer);\n if (typeof actionType === 'number') {\n onOptionChange(actionType, index);\n }\n selectOption(index);\n if (!isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n };\n\n /**\n * Function we call to handle the typeahead.\n *\n * It takes a letter, stores that letter in searchString (and clears it after timeout) to maintain a word\n *\n * Then searches for that word in options and moves focus there.\n */\n const onComboType = (letter: string, actionType: SelectActionsType): void => {\n // open the listbox if it is closed\n setIsOpen(true);\n\n if (\n rest.hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete\n ) {\n return;\n }\n\n if (typeof searchTimeout === 'number') {\n window.clearTimeout(searchTimeout);\n }\n\n searchTimeout = window.setTimeout(() => {\n searchString = '';\n }, 500);\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n searchString = searchString + letter;\n const optionTitles = options.map((option) => option.title);\n const searchIndex = getIndexByLetter(optionTitles, searchString, activeIndex + 1);\n\n // if a match was found, go to it\n if (searchIndex >= 0) {\n onOptionChange(actionType, searchIndex);\n }\n // if no matches, clear the timeout and search string\n else {\n window.clearTimeout(searchTimeout);\n searchString = '';\n }\n };\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n const onTriggerKeydown = (e: {\n event: React.KeyboardEvent<HTMLInputElement | HTMLButtonElement>;\n }): void => {\n if (!isKeydownPressed && ![' ', 'Enter', 'Escape', 'Meta'].includes(e.event.key)) {\n // When keydown is not already pressed and its not Enter, Space, Command, or Escape key (those are generic keys and we only want to handle arrow keys or home buttons etc)\n setIsKeydownPressed(true);\n }\n\n const actionType = getActionFromKey(e.event, isOpen, dropdownTriggerer);\n\n if (actionType) {\n performAction(actionType, e, {\n setIsOpen,\n close,\n onOptionChange,\n onComboType,\n selectCurrentOption: () => {\n if (activeIndex < 0) {\n return;\n }\n\n const isSelected = selectOption(activeIndex);\n if (rest.hasFooterAction && !isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n\n options[activeIndex].onClickTrigger?.(isSelected);\n },\n });\n }\n };\n\n return {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n filteredValues,\n removeOption,\n setControlledValueIndices,\n onTriggerClick,\n onTriggerKeydown,\n onOptionClick,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n options,\n value: makeInputValue(selectedIndices, options),\n displayValue: makeInputDisplayValue(selectedIndices, options),\n selectionType,\n dropdownTriggerer,\n ...rest,\n };\n};\n\nexport type { DropdownContextType, OptionsType };\nexport { useDropdown, DropdownContext };\n"],"names":["noop","DropdownContext","React","createContext","isOpen","setIsOpen","close","selectedIndices","setSelectedIndices","controlledValueIndices","setControlledValueIndices","options","setOptions","filteredValues","setFilteredValues","activeIndex","setActiveIndex","activeTagIndex","setActiveTagIndex","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","hasFooterAction","setHasFooterAction","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","isKeydownPressed","setIsKeydownPressed","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setIsControlled","hasUnControlledFilterChipSelectInput","setHasUnControlledFilterChipSelectInput","dropdownBaseId","actionListItemRef","current","triggererRef","isTagDismissedRef","visibleTagsCountRef","triggererWrapperRef","searchTimeout","searchString","useDropdown","_React$useContext","useContext","selectionType","dropdownTriggerer","rest","_objectWithoutProperties","_excluded","setIndices","indices","removeOption","index","existingItemIndex","indexOf","concat","_toConsumableArray","slice","selectOption","properties","arguments","length","undefined","closeOnSelection","isSelected","includes","onTriggerClick","onOptionChange","actionType","newIndex","updatedIndex","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredIndexes","map","filteredValue","findIndex","option","value","sort","a","b","getUpdatedIndex","currentIndex","maxIndex","optionValues","ensureScrollVisiblity","isBrowser","fireNativeEvent","onOptionClick","e","getActionFromKey","isReactNative","_rest$triggererRef$cu","focus","onComboType","letter","window","clearTimeout","setTimeout","optionTitles","title","searchIndex","getIndexByLetter","onTriggerKeydown","event","key","performAction","selectCurrentOption","_options$activeIndex$","_options$activeIndex","_rest$triggererRef$cu2","onClickTrigger","call","_objectSpread","makeInputValue","displayValue","makeInputDisplayValue"],"mappings":";;;;;;;;;;;;;;;;AAoBA;AACA,IAAMA,IAAI,GAAG,SAAPA,IAAIA,GAAe,EAAE,CAAA;AA6G3B,IAAMC,eAAe,gBAAGC,cAAK,CAACC,aAAa,CAAsB;AAC/DC,EAAAA,MAAM,EAAE,KAAK;AACbC,EAAAA,SAAS,EAAEL,IAAI;AACfM,EAAAA,KAAK,EAAEN,IAAI;AACXO,EAAAA,eAAe,EAAE,EAAE;AACnBC,EAAAA,kBAAkB,EAAER,IAAI;AACxBS,EAAAA,sBAAsB,EAAE,EAAE;AAC1BC,EAAAA,yBAAyB,EAAEV,IAAI;AAC/BW,EAAAA,OAAO,EAAE,EAAE;AACXC,EAAAA,UAAU,EAAEZ,IAAI;AAChBa,EAAAA,cAAc,EAAE,EAAE;AAClBC,EAAAA,iBAAiB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AAA,gBAAgB,EAAhBA,gBAAgB;AAChBC,IAAAA,mBAAmB,EAAnBA,mBAAmB;AACnBC,IAAAA,uBAAuB,EAAvBA,uBAAuB;AACvBC,IAAAA,0BAA0B,EAA1BA,0BAA0B;AAC1BC,IAAAA,YAAY,EAAZA,YAAY;AACZlB,IAAAA,OAAO,EAAPA,OAAO;AACPsE,IAAAA,KAAK,EAAEqC,cAAc,CAAC/G,eAAe,EAAEI,OAAO,CAAC;AAC/C4G,IAAAA,YAAY,EAAEC,qBAAqB,CAACjH,eAAe,EAAEI,OAAO,CAAC;AAC7DkC,IAAAA,aAAa,EAAbA,aAAa;AACbC,IAAAA,iBAAiB,EAAjBA,iBAAAA;AAAiB,GAAA,EACdC,IAAI,CAAA,CAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { FILTER_CHIP_HEIGHT } from './tokens.js';
|
|
6
|
+
import '../Box/index.js';
|
|
7
|
+
import '../Box/BaseBox/index.js';
|
|
8
|
+
import '../Counter/index.js';
|
|
9
|
+
import '../Divider/index.js';
|
|
10
|
+
import '../Icons/index.js';
|
|
11
|
+
import '../Typography/index.js';
|
|
12
|
+
import '../../utils/index.js';
|
|
13
|
+
import '../../utils/getFocusRingStyles/index.js';
|
|
14
|
+
import '../Box/styledProps/index.js';
|
|
15
|
+
import '../../utils/assignWithoutSideEffects/index.js';
|
|
16
|
+
import '../../utils/metaAttribute/index.js';
|
|
17
|
+
import '../../utils/makeAccessible/index.js';
|
|
18
|
+
import '../../utils/makeAnalyticsAttribute/index.js';
|
|
19
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
20
|
+
import { getFocusRingStyles } from '../../utils/getFocusRingStyles/getFocusRingStyles.web.js';
|
|
21
|
+
import { makeSpace } from '../../utils/makeSpace/makeSpace.js';
|
|
22
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
23
|
+
import { makeBorderSize } from '../../utils/makeBorderSize/makeBorderSize.js';
|
|
24
|
+
import { Box } from '../Box/Box.js';
|
|
25
|
+
import { Counter } from '../Counter/Counter.js';
|
|
26
|
+
import { Text } from '../Typography/Text/Text.js';
|
|
27
|
+
import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
|
|
28
|
+
import { getStyledProps } from '../Box/styledProps/getStyledProps.js';
|
|
29
|
+
import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
30
|
+
import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
|
|
31
|
+
import ChevronDownIcon from '../Icons/ChevronDownIcon/ChevronDownIcon.js';
|
|
32
|
+
import { Divider } from '../Divider/Divider.js';
|
|
33
|
+
import CloseIcon from '../Icons/CloseIcon/CloseIcon.js';
|
|
34
|
+
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
35
|
+
import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
36
|
+
|
|
37
|
+
var _excluded = ["value", "onClearButtonClick", "label", "isDisabled", "selectionType", "onClick", "onKeyDown", "accessibilityProps", "id"];
|
|
38
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
39
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
40
|
+
var getInteractiveFilterItemStyles = function getInteractiveFilterItemStyles(_ref) {
|
|
41
|
+
var theme = _ref.theme;
|
|
42
|
+
return {
|
|
43
|
+
display: 'flex',
|
|
44
|
+
height: '100%',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
border: 'none',
|
|
47
|
+
cursor: 'pointer',
|
|
48
|
+
color: 'currentcolor',
|
|
49
|
+
'&:not([disabled]):hover': {
|
|
50
|
+
backgroundColor: theme.colors.interactive.background.gray.faded
|
|
51
|
+
},
|
|
52
|
+
'&[disabled]': {
|
|
53
|
+
cursor: 'not-allowed'
|
|
54
|
+
},
|
|
55
|
+
'&:focus-visible': _objectSpread(_objectSpread({}, getFocusRingStyles({
|
|
56
|
+
theme: theme
|
|
57
|
+
})), {}, {
|
|
58
|
+
outlineOffset: makeSpace(theme.spacing[1])
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
var StyledFilterChip = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
63
|
+
displayName: "BaseFilterChipweb__StyledFilterChip",
|
|
64
|
+
componentId: "sc-7fl0tf-0"
|
|
65
|
+
})(function (_ref2) {
|
|
66
|
+
var theme = _ref2.theme,
|
|
67
|
+
$isDisabled = _ref2.$isDisabled,
|
|
68
|
+
$isSelected = _ref2.$isSelected;
|
|
69
|
+
return {
|
|
70
|
+
borderWidth: makeBorderSize(theme.border.width.thin),
|
|
71
|
+
borderColor: theme.colors.interactive.border.gray[$isDisabled ? 'disabled' : 'highlighted'],
|
|
72
|
+
height: FILTER_CHIP_HEIGHT,
|
|
73
|
+
borderRadius: theme.border.radius.max,
|
|
74
|
+
display: 'flex',
|
|
75
|
+
borderStyle: $isSelected ? 'solid' : 'dashed',
|
|
76
|
+
backgroundColor: theme.colors.surface.background.gray.intense,
|
|
77
|
+
color: theme.colors.interactive.text.gray[$isDisabled ? 'disabled' : 'normal'],
|
|
78
|
+
width: 'fit-content'
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
var StyledFilterTrigger = /*#__PURE__*/styled.button.withConfig({
|
|
82
|
+
displayName: "BaseFilterChipweb__StyledFilterTrigger",
|
|
83
|
+
componentId: "sc-7fl0tf-1"
|
|
84
|
+
})(function (_ref3) {
|
|
85
|
+
var theme = _ref3.theme,
|
|
86
|
+
$isSelected = _ref3.$isSelected;
|
|
87
|
+
var spacing = theme.spacing;
|
|
88
|
+
return _objectSpread({
|
|
89
|
+
backgroundColor: theme.colors.transparent,
|
|
90
|
+
borderRadius: $isSelected ? theme.border.radius.none : theme.border.radius.max,
|
|
91
|
+
borderTopLeftRadius: theme.border.radius.max,
|
|
92
|
+
borderBottomLeftRadius: theme.border.radius.max,
|
|
93
|
+
paddingLeft: makeSpace(spacing[4]),
|
|
94
|
+
paddingRight: $isSelected ? makeSpace(spacing[2]) : makeSpace(spacing[3]),
|
|
95
|
+
gap: makeSpace(spacing[2])
|
|
96
|
+
}, getInteractiveFilterItemStyles({
|
|
97
|
+
theme: theme
|
|
98
|
+
}));
|
|
99
|
+
});
|
|
100
|
+
var StyledFilterCloseButton = /*#__PURE__*/styled.button.withConfig({
|
|
101
|
+
displayName: "BaseFilterChipweb__StyledFilterCloseButton",
|
|
102
|
+
componentId: "sc-7fl0tf-2"
|
|
103
|
+
})(function (_ref4) {
|
|
104
|
+
var theme = _ref4.theme;
|
|
105
|
+
return _objectSpread({
|
|
106
|
+
backgroundColor: theme.colors.transparent,
|
|
107
|
+
borderTopRightRadius: theme.border.radius.max,
|
|
108
|
+
borderBottomRightRadius: theme.border.radius.max,
|
|
109
|
+
paddingLeft: makeSpace(theme.spacing[2]),
|
|
110
|
+
paddingRight: makeSpace(theme.spacing[3]),
|
|
111
|
+
justifyContent: 'center'
|
|
112
|
+
}, getInteractiveFilterItemStyles({
|
|
113
|
+
theme: theme
|
|
114
|
+
}));
|
|
115
|
+
});
|
|
116
|
+
var renderValue = function renderValue(selectionType, value) {
|
|
117
|
+
if (selectionType === 'multiple' && Array.isArray(value)) {
|
|
118
|
+
return /*#__PURE__*/jsx(Box, {
|
|
119
|
+
display: "flex",
|
|
120
|
+
alignItems: "center",
|
|
121
|
+
children: /*#__PURE__*/jsx(Counter, {
|
|
122
|
+
value: value.length,
|
|
123
|
+
color: "primary",
|
|
124
|
+
size: "small"
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return /*#__PURE__*/jsx(Text, {
|
|
129
|
+
as: "span",
|
|
130
|
+
size: "small",
|
|
131
|
+
weight: "semibold",
|
|
132
|
+
color: "interactive.text.primary.normal",
|
|
133
|
+
children: value
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
var _BaseFilterChip = function _BaseFilterChip(_ref5, ref) {
|
|
137
|
+
var _accessibilityProps$r;
|
|
138
|
+
var value = _ref5.value,
|
|
139
|
+
onClearButtonClick = _ref5.onClearButtonClick,
|
|
140
|
+
label = _ref5.label,
|
|
141
|
+
isDisabled = _ref5.isDisabled,
|
|
142
|
+
_ref5$selectionType = _ref5.selectionType,
|
|
143
|
+
selectionType = _ref5$selectionType === void 0 ? 'single' : _ref5$selectionType,
|
|
144
|
+
_onClick = _ref5.onClick,
|
|
145
|
+
onKeyDown = _ref5.onKeyDown,
|
|
146
|
+
accessibilityProps = _ref5.accessibilityProps,
|
|
147
|
+
id = _ref5.id,
|
|
148
|
+
rest = _objectWithoutProperties(_ref5, _excluded);
|
|
149
|
+
var isSelected = selectionType === 'multiple' ? Array.isArray(value) && value.length > 0 : !!value;
|
|
150
|
+
return /*#__PURE__*/jsxs(StyledFilterChip, {
|
|
151
|
+
$isDisabled: isDisabled,
|
|
152
|
+
$isSelected: isSelected,
|
|
153
|
+
ref: ref,
|
|
154
|
+
children: [/*#__PURE__*/jsxs(StyledFilterTrigger, _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
155
|
+
$isSelected: isSelected,
|
|
156
|
+
disabled: isDisabled,
|
|
157
|
+
id: id,
|
|
158
|
+
onClick: function onClick(e) {
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
160
|
+
_onClick === null || _onClick === void 0 ? void 0 : _onClick(e);
|
|
161
|
+
},
|
|
162
|
+
onKeyDown: function onKeyDown(e) {
|
|
163
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
164
|
+
_onClick === null || _onClick === void 0 ? void 0 : _onClick(e);
|
|
165
|
+
}
|
|
166
|
+
}, makeAccessible(_objectSpread(_objectSpread({}, accessibilityProps), {}, {
|
|
167
|
+
role: (_accessibilityProps$r = accessibilityProps === null || accessibilityProps === void 0 ? void 0 : accessibilityProps.role) !== null && _accessibilityProps$r !== void 0 ? _accessibilityProps$r : 'button'
|
|
168
|
+
}))), getStyledProps(rest)), makeAnalyticsAttribute(rest)), metaAttribute({
|
|
169
|
+
testID: rest.testID
|
|
170
|
+
})), {}, {
|
|
171
|
+
children: [/*#__PURE__*/jsxs(Box, {
|
|
172
|
+
display: "flex",
|
|
173
|
+
gap: "spacing.2",
|
|
174
|
+
whiteSpace: "nowrap",
|
|
175
|
+
children: [/*#__PURE__*/jsxs(Text, {
|
|
176
|
+
size: "small",
|
|
177
|
+
weight: "medium",
|
|
178
|
+
color: "currentColor",
|
|
179
|
+
truncateAfterLines: 1,
|
|
180
|
+
children: [label, isSelected ? ':' : null]
|
|
181
|
+
}), isSelected ? renderValue(selectionType, value) : null]
|
|
182
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
183
|
+
display: "flex",
|
|
184
|
+
alignItems: "center",
|
|
185
|
+
paddingRight: "spacing.1",
|
|
186
|
+
children: /*#__PURE__*/jsx(ChevronDownIcon, {
|
|
187
|
+
size: "small",
|
|
188
|
+
color: "currentColor"
|
|
189
|
+
})
|
|
190
|
+
})]
|
|
191
|
+
})), isSelected ? /*#__PURE__*/jsxs(Fragment, {
|
|
192
|
+
children: [/*#__PURE__*/jsx(Divider, {
|
|
193
|
+
orientation: "vertical",
|
|
194
|
+
variant: isDisabled ? 'muted' : 'subtle'
|
|
195
|
+
}), /*#__PURE__*/jsx(StyledFilterCloseButton, {
|
|
196
|
+
"aria-label": "Clear ".concat(label, " value")
|
|
197
|
+
// value can never be undefined because when it's undefined the button itself doesn't render/
|
|
198
|
+
,
|
|
199
|
+
onClick: function onClick() {
|
|
200
|
+
return onClearButtonClick === null || onClearButtonClick === void 0 ? void 0 : onClearButtonClick({
|
|
201
|
+
value: value !== null && value !== void 0 ? value : ''
|
|
202
|
+
});
|
|
203
|
+
},
|
|
204
|
+
disabled: isDisabled,
|
|
205
|
+
children: /*#__PURE__*/jsx(CloseIcon, {
|
|
206
|
+
size: "small",
|
|
207
|
+
color: "currentColor"
|
|
208
|
+
})
|
|
209
|
+
})]
|
|
210
|
+
}) : null]
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
var BaseFilterChip = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.forwardRef(_BaseFilterChip), {
|
|
214
|
+
componentId: MetaConstants.BaseFilterChip
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
export { BaseFilterChip };
|
|
218
|
+
//# sourceMappingURL=BaseFilterChip.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseFilterChip.web.js","sources":["../../../../../../src/components/FilterChip/BaseFilterChip.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { CSSObject } from 'styled-components';\nimport styled from 'styled-components';\nimport { FILTER_CHIP_HEIGHT } from './tokens';\nimport type { BaseFilterChipProps } from './types';\nimport { Box } from '~components/Box';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Counter } from '~components/Counter';\nimport { Divider } from '~components/Divider';\nimport { ChevronDownIcon, CloseIcon } from '~components/Icons';\nimport { Text } from '~components/Typography';\nimport { makeBorderSize, makeSpace } from '~utils';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\nimport type { Theme } from '~components/BladeProvider';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { BladeElementRef } from '~utils/types';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst getInteractiveFilterItemStyles = ({ theme }: { theme: Theme }): CSSObject => {\n return {\n display: 'flex',\n height: '100%',\n alignItems: 'center',\n border: 'none',\n cursor: 'pointer',\n color: 'currentcolor',\n '&:not([disabled]):hover': {\n backgroundColor: theme.colors.interactive.background.gray.faded,\n },\n '&[disabled]': {\n cursor: 'not-allowed',\n },\n '&:focus-visible': {\n ...getFocusRingStyles({ theme }),\n outlineOffset: makeSpace(theme.spacing[1]),\n },\n };\n};\n\nconst StyledFilterChip = styled(BaseBox)<{ $isSelected?: boolean; $isDisabled?: boolean }>(\n ({ theme, $isDisabled, $isSelected }) => {\n return {\n borderWidth: makeBorderSize(theme.border.width.thin),\n borderColor: theme.colors.interactive.border.gray[$isDisabled ? 'disabled' : 'highlighted'],\n height: FILTER_CHIP_HEIGHT,\n borderRadius: theme.border.radius.max,\n display: 'flex',\n borderStyle: $isSelected ? 'solid' : 'dashed',\n backgroundColor: theme.colors.surface.background.gray.intense,\n color: theme.colors.interactive.text.gray[$isDisabled ? 'disabled' : 'normal'],\n width: 'fit-content',\n };\n },\n);\n\nconst StyledFilterTrigger = styled.button<{ $isSelected?: boolean }>(({ theme, $isSelected }) => {\n const { spacing } = theme;\n return {\n backgroundColor: theme.colors.transparent,\n borderRadius: $isSelected ? theme.border.radius.none : theme.border.radius.max,\n borderTopLeftRadius: theme.border.radius.max,\n borderBottomLeftRadius: theme.border.radius.max,\n paddingLeft: makeSpace(spacing[4]),\n paddingRight: $isSelected ? makeSpace(spacing[2]) : makeSpace(spacing[3]),\n gap: makeSpace(spacing[2]),\n ...getInteractiveFilterItemStyles({ theme }),\n };\n});\n\nconst StyledFilterCloseButton = styled.button(({ theme }) => {\n return {\n backgroundColor: theme.colors.transparent,\n borderTopRightRadius: theme.border.radius.max,\n borderBottomRightRadius: theme.border.radius.max,\n paddingLeft: makeSpace(theme.spacing[2]),\n paddingRight: makeSpace(theme.spacing[3]),\n justifyContent: 'center',\n ...getInteractiveFilterItemStyles({ theme }),\n };\n});\n\nconst renderValue = (\n selectionType: BaseFilterChipProps['selectionType'],\n value: BaseFilterChipProps['value'],\n): React.ReactElement => {\n if (selectionType === 'multiple' && Array.isArray(value)) {\n return (\n <Box display=\"flex\" alignItems=\"center\">\n <Counter value={value.length} color=\"primary\" size=\"small\" />\n </Box>\n );\n }\n\n return (\n <Text as=\"span\" size=\"small\" weight=\"semibold\" color=\"interactive.text.primary.normal\">\n {value}\n </Text>\n );\n};\n\nconst _BaseFilterChip: React.ForwardRefRenderFunction<BladeElementRef, BaseFilterChipProps> = (\n {\n value,\n onClearButtonClick,\n label,\n isDisabled,\n selectionType = 'single',\n onClick,\n onKeyDown,\n accessibilityProps,\n id,\n ...rest\n }: BaseFilterChipProps,\n ref: React.Ref<BladeElementRef>,\n): React.ReactElement => {\n const isSelected =\n selectionType === 'multiple' ? Array.isArray(value) && value.length > 0 : !!value;\n\n return (\n <StyledFilterChip\n $isDisabled={isDisabled}\n $isSelected={isSelected}\n ref={ref as React.Ref<HTMLDivElement>}\n >\n <StyledFilterTrigger\n $isSelected={isSelected}\n disabled={isDisabled}\n id={id}\n onClick={(e) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onClick?.(e as any);\n }}\n onKeyDown={(e) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onClick?.(e as any);\n }}\n {...makeAccessible({\n ...accessibilityProps,\n role: accessibilityProps?.role ?? 'button',\n })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n {...metaAttribute({ testID: rest.testID })}\n >\n <Box display=\"flex\" gap=\"spacing.2\" whiteSpace=\"nowrap\">\n <Text size=\"small\" weight=\"medium\" color=\"currentColor\" truncateAfterLines={1}>\n {label}\n {isSelected ? ':' : null}\n </Text>\n {isSelected ? renderValue(selectionType, value) : null}\n </Box>\n <Box display=\"flex\" alignItems=\"center\" paddingRight=\"spacing.1\">\n <ChevronDownIcon size=\"small\" color=\"currentColor\" />\n </Box>\n </StyledFilterTrigger>\n {isSelected ? (\n <>\n <Divider orientation=\"vertical\" variant={isDisabled ? 'muted' : 'subtle'} />\n <StyledFilterCloseButton\n aria-label={`Clear ${label} value`}\n // value can never be undefined because when it's undefined the button itself doesn't render/\n onClick={() => onClearButtonClick?.({ value: value ?? '' })}\n disabled={isDisabled}\n >\n <CloseIcon size=\"small\" color=\"currentColor\" />\n </StyledFilterCloseButton>\n </>\n ) : null}\n </StyledFilterChip>\n );\n};\n\nconst BaseFilterChip = assignWithoutSideEffects(React.forwardRef(_BaseFilterChip), {\n componentId: MetaConstants.BaseFilterChip,\n});\n\nexport { BaseFilterChip };\n"],"names":["getInteractiveFilterItemStyles","_ref","theme","display","height","alignItems","border","cursor","color","backgroundColor","colors","interactive","background","gray","faded","_objectSpread","getFocusRingStyles","outlineOffset","makeSpace","spacing","StyledFilterChip","styled","BaseBox","withConfig","displayName","componentId","_ref2","$isDisabled","$isSelected","borderWidth","makeBorderSize","width","thin","borderColor","FILTER_CHIP_HEIGHT","borderRadius","radius","max","borderStyle","surface","intense","text","StyledFilterTrigger","button","_ref3","transparent","none","borderTopLeftRadius","borderBottomLeftRadius","paddingLeft","paddingRight","gap","StyledFilterCloseButton","_ref4","borderTopRightRadius","borderBottomRightRadius","justifyContent","renderValue","selectionType","value","Array","isArray","_jsx","Box","children","Counter","length","size","Text","as","weight","_BaseFilterChip","_ref5","ref","_accessibilityProps$r","onClearButtonClick","label","isDisabled","_ref5$selectionType","onClick","onKeyDown","accessibilityProps","id","rest","_objectWithoutProperties","_excluded","isSelected","_jsxs","disabled","e","makeAccessible","role","getStyledProps","makeAnalyticsAttribute","metaAttribute","testID","whiteSpace","truncateAfterLines","ChevronDownIcon","_Fragment","Divider","orientation","variant","concat","CloseIcon","BaseFilterChip","assignWithoutSideEffects","React","forwardRef","MetaConstants"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAMA,8BAA8B,GAAG,SAAjCA,8BAA8BA,CAAAC,IAAA,EAA+C;AAAA,EAAA,IAAzCC,KAAK,GAAAD,IAAA,CAALC,KAAK,CAAA;EAC7C,OAAO;AACLC,IAAAA,OAAO,EAAE,MAAM;AACfC,IAAAA,MAAM,EAAE,MAAM;AACdC,IAAAA,UAAU,EAAE,QAAQ;AACpBC,IAAAA,MAAM,EAAE,MAAM;AACdC,IAAAA,MAAM,EAAE,SAAS;AACjBC,IAAAA,KAAK,EAAE,cAAc;AACrB,IAAA,yBAAyB,EAAE;MACzBC,eAAe,EAAEP,KAAK,CAACQ,MAAM,CAACC,WAAW,CAACC,UAAU,CAACC,IAAI,CAACC,KAAAA;KAC3D;AACD,IAAA,aAAa,EAAE;AACbP,MAAAA,MAAM,EAAE,aAAA;KACT;AACD,IAAA,iBAAiB,EAAAQ,aAAA,CAAAA,aAAA,CAAA,EAAA,EACZC,kBAAkB,CAAC;AAAEd,MAAAA,KAAK,EAALA,KAAAA;AAAM,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;MAChCe,aAAa,EAAEC,SAAS,CAAChB,KAAK,CAACiB,OAAO,CAAC,CAAC,CAAC,CAAA;AAAC,KAAA,CAAA;GAE7C,CAAA;AACH,CAAC,CAAA;AAED,IAAMC,gBAAgB,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,qCAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CACtC,CAAA,CAAA,UAAAC,KAAA,EAAyC;AAAA,EAAA,IAAtCxB,KAAK,GAAAwB,KAAA,CAALxB,KAAK;IAAEyB,WAAW,GAAAD,KAAA,CAAXC,WAAW;IAAEC,WAAW,GAAAF,KAAA,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makeSize.js';
|
|
4
|
+
import { size } from '../../tokens/global/size.js';
|
|
5
|
+
|
|
6
|
+
var FILTER_CHIP_HEIGHT = makeSize(size['28']);
|
|
7
|
+
|
|
8
|
+
export { FILTER_CHIP_HEIGHT };
|
|
9
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sources":["../../../../../../src/components/FilterChip/tokens.ts"],"sourcesContent":["import { size } from '~tokens/global';\nimport { makeSize } from '~utils';\n\nconst FILTER_CHIP_HEIGHT = makeSize(size['28']);\n\nexport { FILTER_CHIP_HEIGHT };\n"],"names":["FILTER_CHIP_HEIGHT","makeSize","size"],"mappings":";;;;;AAGMA,IAAAA,kBAAkB,GAAGC,QAAQ,CAACC,IAAI,CAAC,IAAI,CAAC;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import '../../utils/makeAnalyticsAttribute/index.js';
|
|
4
|
+
import '../Box/BaseBox/index.js';
|
|
5
|
+
import '../../utils/metaAttribute/index.js';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
8
|
+
import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
|
|
9
|
+
import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
10
|
+
import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
11
|
+
|
|
12
|
+
var _excluded = ["testID", "children"];
|
|
13
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
+
var ListView = function ListView(_ref) {
|
|
16
|
+
var testID = _ref.testID,
|
|
17
|
+
children = _ref.children,
|
|
18
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread(_objectSpread({}, metaAttribute({
|
|
20
|
+
name: MetaConstants.ListView,
|
|
21
|
+
testID: testID
|
|
22
|
+
})), makeAnalyticsAttribute(rest)), {}, {
|
|
23
|
+
children: children
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { ListView };
|
|
28
|
+
//# sourceMappingURL=ListView.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListView.web.js","sources":["../../../../../../src/components/ListView/ListView.web.tsx"],"sourcesContent":["import type { ListViewProps } from './types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\n\nconst ListView = ({ testID, children, ...rest }: ListViewProps): React.ReactElement => {\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.ListView, testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n {children}\n </BaseBox>\n );\n};\n\nexport { ListView };\n"],"names":["ListView","_ref","testID","children","rest","_objectWithoutProperties","_excluded","_jsx","BaseBox","_objectSpread","metaAttribute","name","MetaConstants","makeAnalyticsAttribute"],"mappings":";;;;;;;;;;;;;;AAKA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAAyE;AAAA,EAAA,IAAnEC,MAAM,GAAAD,IAAA,CAANC,MAAM;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA,CAAA,CAAA;EAC3C,oBACEC,GAAA,CAACC,OAAO,EAAAC,aAAA,CAAAA,aAAA,CAAAA,aAAA,CACFC,EAAAA,EAAAA,aAAa,CAAC;IAAEC,IAAI,EAAEC,aAAa,CAACZ,QAAQ;AAAEE,IAAAA,MAAM,EAANA,MAAAA;AAAO,GAAC,CAAC,CAAA,EACvDW,sBAAsB,CAACT,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAD,IAAAA,QAAA,EAE/BA,QAAAA;AAAQ,GAAA,CACF,CAAC,CAAA;AAEd;;;;"}
|