@semcore/add-filter 17.2.1 → 17.2.2-prerelease.1
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/CHANGELOG.md +7 -0
- package/lib/cjs/AddFilter.js +11 -17
- package/lib/cjs/AddFilter.js.map +1 -1
- package/lib/cjs/AddFilter.types.js.map +1 -1
- package/lib/cjs/components/AddFilterDropdown.js.map +1 -1
- package/lib/cjs/components/AddFilterInput.js.map +1 -1
- package/lib/cjs/components/AddFilterSelect.js.map +1 -1
- package/lib/cjs/index.js +2 -13
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/AddFilter.js +11 -17
- package/lib/es6/AddFilter.js.map +1 -1
- package/lib/es6/AddFilter.types.js.map +1 -1
- package/lib/es6/components/AddFilterDropdown.js.map +1 -1
- package/lib/es6/components/AddFilterInput.js.map +1 -1
- package/lib/es6/components/AddFilterSelect.js.map +1 -1
- package/lib/es6/index.js +0 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/esm/AddFilter.mjs +11 -16
- package/lib/types/AddFilter.d.ts +90 -2
- package/lib/types/AddFilter.types.d.ts +151 -71
- package/lib/types/components/AddFilterDropdown.d.ts +2 -28
- package/lib/types/components/AddFilterInput.d.ts +2 -18
- package/lib/types/components/AddFilterSelect.d.ts +2 -2
- package/lib/types/index.d.ts +0 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [17.2.2] - 2026-07-10
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Refactor component's types. Deprecated atomic types. Atomic types are
|
|
10
|
+
part of `NSAddFilter` namespace.
|
|
11
|
+
|
|
5
12
|
## [17.2.1] - 2026-06-26
|
|
6
13
|
|
|
7
14
|
### Fixed
|
package/lib/cjs/AddFilter.js
CHANGED
|
@@ -195,16 +195,24 @@ class RootAddFilter extends _core.Component {
|
|
|
195
195
|
render() {
|
|
196
196
|
var _ref = this.asProps;
|
|
197
197
|
const {
|
|
198
|
-
Children
|
|
198
|
+
Children,
|
|
199
|
+
filterData,
|
|
200
|
+
getI18nText
|
|
199
201
|
} = this.asProps;
|
|
200
202
|
const [filters, persistentFilters] = RootAddFilter.getFilterPatternItems(Children);
|
|
201
203
|
const VisibleFilteredChildren = this.getVisibleFilters(filters);
|
|
202
204
|
const filtersSelectionDropdown = this.getFilterSelectionMenuProps();
|
|
203
|
-
const
|
|
205
|
+
const hasFilterData = Object.values(filterData).filter(value => Array.isArray(value) ? value?.length : value).length > 0;
|
|
204
206
|
return /*#__PURE__*/_react.default.createElement(_baseComponents.Flex, (0, _core.assignProps)({
|
|
205
207
|
"gap": 2,
|
|
206
208
|
"flexWrap": true
|
|
207
|
-
}, _ref), persistentFilters, VisibleFilteredChildren, /*#__PURE__*/_react.default.createElement(AddFilterDropdownMenu, filtersSelectionDropdown),
|
|
209
|
+
}, _ref), persistentFilters, VisibleFilteredChildren, /*#__PURE__*/_react.default.createElement(AddFilterDropdownMenu, filtersSelectionDropdown), hasFilterData && /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
210
|
+
use: "tertiary",
|
|
211
|
+
theme: "muted",
|
|
212
|
+
addonLeft: _m.default,
|
|
213
|
+
ml: "auto",
|
|
214
|
+
onClick: () => this.clearAll()
|
|
215
|
+
}, getI18nText('AddFilter.Button.Text')), /*#__PURE__*/_react.default.createElement(_baseComponents.ScreenReaderOnly, {
|
|
208
216
|
"aria-live": "polite",
|
|
209
217
|
role: "status"
|
|
210
218
|
}, this.state.clearFiltersMessage));
|
|
@@ -272,20 +280,6 @@ const AddFilterDropdownMenu = /*#__PURE__*/_react.default.forwardRef(function (p
|
|
|
272
280
|
}
|
|
273
281
|
}, label))));
|
|
274
282
|
});
|
|
275
|
-
function ClearAllFilters({
|
|
276
|
-
hasFilterData,
|
|
277
|
-
clearAll,
|
|
278
|
-
getI18nText
|
|
279
|
-
}) {
|
|
280
|
-
return hasFilterData ? /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
281
|
-
use: "tertiary",
|
|
282
|
-
theme: "muted",
|
|
283
|
-
addonLeft: _m.default,
|
|
284
|
-
ml: "auto",
|
|
285
|
-
onClick: clearAll
|
|
286
|
-
}, getI18nText('AddFilter.Button.Text')) : null;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
283
|
/**
|
|
290
284
|
* AddFilter
|
|
291
285
|
*
|
package/lib/cjs/AddFilter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddFilter.js","names":["_core","require","_baseComponents","_button","_interopRequireDefault","_i18nEnhance","_findComponent","_dropdownMenu","_m","_m2","_react","_AddFilterDropdown","_AddFilterInput","_AddFilterSelect","_intergalacticDynamicLocales","_RootAddFilter","RootAddFilter","Component","constructor","props","_defineProperty2","default","React","createRef","Map","state","clearFiltersMessage","addDropdownItems","getDefaultAddDropdownOptions","children","uncontrolledProps","visibleFilters","componentWillUnmount","clearTimeout","clearMessageTimer","focusFilterAfterItemCleared","name","lastInteraction","isKeyboard","asProps","deletedIndex","findIndex","n","setTimeout","focusFilterName","at","itemToFocus","filtersFocusMap","get","addFilterTrigger","current","focus","getVisibleFilters","allFilters","map","find","getItemCommonProps","filterData","value","setFocusRef","ref","set","onClear","hideFilter","getInputProps","getDropdownAndSelectProps","isEmpty","onVisibleChange","visible","getSelectProps","multiselect","Array","isArray","length","getDropdownProps","clearAll","handlers","onClearAll","announceClearMessageToSR","getI18nText","setState","toggleFieldVisibility","status","Set","add","delete","from","getFilterSelectionMenuProps","options","getClearAllFiltersProps","hasFilterData","Object","values","filter","render","_ref","Children","filters","persistentFilters","getFilterPatternItems","VisibleFilteredChildren","filtersSelectionDropdown","clearAllFiltersProps","createElement","Flex","assignProps","AddFilterDropdownMenu","ClearAllFilters","ScreenReaderOnly","role","i18nEnhance","localizedMessages","i18n","locale","defaultVisibleFilters","extractFrom","componentsNames","displayName","label","forwardRef","setVisible","useState","optionsWithoutVisible","useMemo","includes","Trigger","tag","Button","use","addonLeft","MathPlusM","Menu","Item","key","onClick","theme","CloseM","ml","AddFilter","createComponent","Select","AddFilterSelect","Input","AddFilterInput","Dropdown","AddFilterDropdown","_default","exports"],"sources":["../../src/AddFilter.tsx"],"sourcesContent":["import { Flex, ScreenReaderOnly } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport { createComponent, Component, Root, lastInteraction } from '@semcore/core';\nimport type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { extractFrom } from '@semcore/core/lib/utils/findComponent';\nimport DropdownMenu from '@semcore/dropdown-menu';\nimport CloseM from '@semcore/icon/Close/m';\nimport MathPlusM from '@semcore/icon/MathPlus/m';\nimport type { SelectProps } from '@semcore/select';\nimport React from 'react';\n\nimport type { AddFilterType, AddFilterProps, AddFilterItemProps, AddFilterKey, AddFilterDefaultProps } from './AddFilter.types';\nimport AddFilterDropdown from './components/AddFilterDropdown';\nimport AddFilterInput from './components/AddFilterInput';\nimport AddFilterSelect from './components/AddFilterSelect';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\n\ntype SelectItemProps = SelectProps & AddFilterItemProps;\n\ntype AddFilterDropdownOption = { label: string; value: string };\ntype AddFilterDropdownMenuProps = {\n options: AddFilterDropdownOption[];\n toggleFieldVisibility: (name: AddFilterKey, status: boolean) => void;\n visibleFilters: AddFilterKey[];\n getI18nText: (key: string) => string;\n};\n\ntype ClearAllFiltersButtonProps = {\n hasFilterData: boolean;\n clearAll: () => void;\n getI18nText: (key: string) => string;\n};\n\ntype AddFilterState = {\n clearFiltersMessage: string;\n};\n\nclass RootAddFilter extends Component<\n AddFilterProps,\n typeof RootAddFilter.enhance,\n { visibleFilters: null },\n WithI18nEnhanceProps,\n AddFilterState,\n AddFilterDefaultProps\n> {\n addFilterTrigger = React.createRef<HTMLButtonElement>();\n filtersFocusMap: Map<string | undefined, HTMLElement> = new Map();\n clearMessageTimer: ReturnType<typeof setTimeout> | undefined;\n addDropdownItems: AddFilterDropdownOption[];\n\n static displayName = 'AddFilter';\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n static defaultProps: AddFilterDefaultProps = {\n i18n: localizedMessages,\n locale: 'en',\n defaultVisibleFilters: [],\n };\n\n static componentsNames = ['AddFilter.Input', 'AddFilter.Select', 'AddFilter.Dropdown'];\n static getFilterPatternItems = (children: React.ReactNode) => {\n return extractFrom(children, RootAddFilter.componentsNames);\n };\n\n static getDefaultAddDropdownOptions = (children: React.ReactNode) => {\n const [filters] = RootAddFilter.getFilterPatternItems(children);\n\n return filters.map(({ props }: { props: AddFilterItemProps }) => {\n const { name, displayName } = props;\n return { label: displayName ?? name, value: name };\n });\n };\n\n constructor(props: AddFilterProps) {\n super(props);\n\n this.state = {\n clearFiltersMessage: '',\n };\n\n this.addDropdownItems = RootAddFilter.getDefaultAddDropdownOptions(props.children);\n }\n\n uncontrolledProps() {\n return {\n visibleFilters: null,\n };\n }\n\n componentWillUnmount() {\n clearTimeout(this.clearMessageTimer);\n }\n\n focusFilterAfterItemCleared(name?: string) {\n if (!lastInteraction.isKeyboard()) {\n return;\n }\n\n const { visibleFilters } = this.asProps;\n const deletedIndex = visibleFilters.findIndex((n) => n === name);\n setTimeout(() => {\n const { visibleFilters } = this.asProps;\n const focusFilterName = visibleFilters.at(deletedIndex);\n\n const itemToFocus =\n this.filtersFocusMap.get(focusFilterName) ?? this.addFilterTrigger.current;\n itemToFocus?.focus();\n }, 20);\n }\n\n getVisibleFilters(allFilters: React.ReactElement<AddFilterItemProps>[]) {\n return this.asProps.visibleFilters.map((name) => {\n return allFilters.find(({ props }) => props.name === name);\n });\n }\n\n getItemCommonProps(props: AddFilterItemProps) {\n const { name } = props;\n const { filterData } = this.asProps;\n\n return {\n name,\n value: filterData[name],\n setFocusRef: (ref: HTMLElement) => {\n this.filtersFocusMap.set(name, ref);\n },\n onClear: () => {\n this.hideFilter(name);\n this.focusFilterAfterItemCleared(name);\n },\n };\n }\n\n getInputProps(props: AddFilterItemProps) {\n return this.getItemCommonProps(props);\n }\n\n getDropdownAndSelectProps(props: AddFilterItemProps, isEmpty: () => boolean) {\n const { setFocusRef, value, onClear } = this.getItemCommonProps(props);\n return {\n value,\n onClear,\n setFocusRef,\n onVisibleChange: (visible: boolean) => {\n // waiting for filterData update\n setTimeout(() => {\n const { onClear } = this.getItemCommonProps(props);\n\n if (!visible && isEmpty()) {\n onClear();\n }\n }, 0);\n },\n };\n }\n\n getSelectProps(props: SelectItemProps) {\n const isEmpty = () => {\n const { multiselect } = props;\n const { value } = this.getItemCommonProps(props);\n return multiselect && Array.isArray(value) ? !value?.length : !value;\n };\n\n return this.getDropdownAndSelectProps(props, isEmpty);\n }\n\n getDropdownProps(props: AddFilterItemProps) {\n const isEmpty = () => {\n const { value } = this.getItemCommonProps(props);\n return value == null;\n };\n return this.getDropdownAndSelectProps(props, isEmpty);\n }\n\n clearAll() {\n this.handlers.visibleFilters([]);\n this.props.onClearAll();\n this.announceClearMessageToSR();\n\n // waiting for AddFilter button appear in the DOM\n setTimeout(() => {\n this.addFilterTrigger.current?.focus();\n }, 20);\n }\n\n announceClearMessageToSR() {\n const { getI18nText } = this.asProps;\n const clearFiltersMessage = getI18nText('AddFilter.ScreenReaderMessage.FiltersCleared');\n this.setState({ clearFiltersMessage });\n\n this.clearMessageTimer = setTimeout(() => {\n this.setState({ clearFiltersMessage: '' });\n }, 300);\n }\n\n toggleFieldVisibility(name: string, status: boolean) {\n const visibleFilters = new Set(this.asProps.visibleFilters);\n if (status) {\n visibleFilters.add(name);\n } else {\n visibleFilters.delete(name);\n }\n\n this.handlers.visibleFilters(Array.from(visibleFilters));\n }\n\n hideFilter(name: string) {\n this.toggleFieldVisibility(name, false);\n }\n\n getFilterSelectionMenuProps() {\n const { getI18nText, visibleFilters } = this.asProps;\n\n return {\n ref: this.addFilterTrigger,\n options: this.addDropdownItems,\n toggleFieldVisibility: (name: string, status: boolean) =>\n this.toggleFieldVisibility(name, status),\n visibleFilters,\n getI18nText,\n };\n }\n\n getClearAllFiltersProps() {\n const { getI18nText, filterData } = this.asProps;\n\n return {\n hasFilterData:\n Object.values(filterData).filter((value) => (Array.isArray(value) ? value?.length : value))\n .length > 0,\n clearAll: () => {\n this.clearAll();\n },\n getI18nText,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n const [filters, persistentFilters] = RootAddFilter.getFilterPatternItems(Children);\n const VisibleFilteredChildren = this.getVisibleFilters(filters);\n\n const filtersSelectionDropdown = this.getFilterSelectionMenuProps();\n const clearAllFiltersProps = this.getClearAllFiltersProps();\n return (\n <Root render={Flex} gap={2} flexWrap>\n {persistentFilters}\n {VisibleFilteredChildren}\n <AddFilterDropdownMenu {...filtersSelectionDropdown} />\n <ClearAllFilters {...clearAllFiltersProps} />\n\n <ScreenReaderOnly aria-live='polite' role='status'>\n {this.state.clearFiltersMessage}\n </ScreenReaderOnly>\n </Root>\n );\n }\n}\n\nconst AddFilterDropdownMenu = React.forwardRef<HTMLButtonElement, AddFilterDropdownMenuProps>(\n function (props, ref) {\n const { options, toggleFieldVisibility, visibleFilters, getI18nText } = props;\n const [visible, setVisible] = React.useState(false);\n\n const optionsWithoutVisible = React.useMemo(() => {\n return options.filter((filter) => {\n return !visibleFilters.includes(filter.value);\n });\n }, [options, visibleFilters]);\n\n if (!optionsWithoutVisible.length) {\n return null;\n }\n\n return (\n <DropdownMenu visible={visible} onVisibleChange={setVisible}>\n <DropdownMenu.Trigger ref={ref} tag={Button} use='tertiary' addonLeft={MathPlusM}>\n {getI18nText('AddFilter.DropdownTrigger.Text')}\n </DropdownMenu.Trigger>\n <DropdownMenu.Menu>\n {optionsWithoutVisible.map(({ label, value }) => (\n <DropdownMenu.Item\n key={value}\n onClick={() => {\n toggleFieldVisibility(value, true);\n setVisible(false);\n }}\n >\n {label}\n </DropdownMenu.Item>\n ))}\n </DropdownMenu.Menu>\n </DropdownMenu>\n );\n },\n);\n\nfunction ClearAllFilters({ hasFilterData, clearAll, getI18nText }: ClearAllFiltersButtonProps) {\n return hasFilterData\n ? (\n <Button use='tertiary' theme='muted' addonLeft={CloseM} ml='auto' onClick={clearAll}>\n {getI18nText('AddFilter.Button.Text')}\n </Button>\n )\n : null;\n}\n\n/**\n * AddFilter\n *\n * {@link https://developer.semrush.com/intergalactic/filter-group/add-filter/add-filter-code|Examples}\n */\nconst AddFilter = createComponent<\n AddFilterType,\n typeof RootAddFilter\n>(RootAddFilter, {\n Select: AddFilterSelect,\n Input: AddFilterInput,\n Dropdown: AddFilterDropdown,\n});\n\nexport default AddFilter;\n"],"mappings":";;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAGA,IAAAI,YAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,EAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,GAAA,GAAAL,sBAAA,CAAAH,OAAA;AAEA,IAAAS,MAAA,GAAAN,sBAAA,CAAAH,OAAA;AAGA,IAAAU,kBAAA,GAAAP,sBAAA,CAAAH,OAAA;AACA,IAAAW,eAAA,GAAAR,sBAAA,CAAAH,OAAA;AACA,IAAAY,gBAAA,GAAAT,sBAAA,CAAAH,OAAA;AACA,IAAAa,4BAAA,GAAAb,OAAA;AAAmF,IAAAc,cAAA;AAsBnF,MAAMC,aAAa,SAASC,eAAS,CAOnC;EA6BAC,WAAWA,CAACC,KAAqB,EAAE;IACjC,KAAK,CAACA,KAAK,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,yCA7BIC,cAAK,CAACC,SAAS,CAAoB,C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V;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM2D,SAAS,GAAG,IAAAC,qBAAe,EAG/B3H,aAAa,EAAE;EACf4H,MAAM,EAAEC,wBAAe;EACvBC,KAAK,EAAEC,uBAAc;EACrBC,QAAQ,EAAEC;AACZ,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA9H,OAAA,GAEYqH,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"AddFilter.js","names":["_core","require","_baseComponents","_button","_interopRequireDefault","_i18nEnhance","_findComponent","_dropdownMenu","_m","_m2","_react","_AddFilterDropdown","_AddFilterInput","_AddFilterSelect","_intergalacticDynamicLocales","_RootAddFilter","RootAddFilter","Component","constructor","props","_defineProperty2","default","React","createRef","Map","state","clearFiltersMessage","addDropdownItems","getDefaultAddDropdownOptions","children","uncontrolledProps","visibleFilters","componentWillUnmount","clearTimeout","clearMessageTimer","focusFilterAfterItemCleared","name","lastInteraction","isKeyboard","asProps","deletedIndex","findIndex","n","setTimeout","focusFilterName","at","itemToFocus","filtersFocusMap","get","addFilterTrigger","current","focus","getVisibleFilters","allFilters","map","find","getItemCommonProps","filterData","value","setFocusRef","ref","set","onClear","hideFilter","getInputProps","getDropdownAndSelectProps","isEmpty","onVisibleChange","visible","getSelectProps","multiselect","Array","isArray","length","getDropdownProps","clearAll","handlers","onClearAll","announceClearMessageToSR","getI18nText","setState","toggleFieldVisibility","status","Set","add","delete","from","getFilterSelectionMenuProps","options","getClearAllFiltersProps","hasFilterData","Object","values","filter","render","_ref","Children","filters","persistentFilters","getFilterPatternItems","VisibleFilteredChildren","filtersSelectionDropdown","createElement","Flex","assignProps","AddFilterDropdownMenu","use","theme","addonLeft","CloseM","ml","onClick","ScreenReaderOnly","role","i18nEnhance","localizedMessages","i18n","locale","defaultVisibleFilters","extractFrom","componentsNames","displayName","label","forwardRef","setVisible","useState","optionsWithoutVisible","useMemo","includes","Trigger","tag","Button","MathPlusM","Menu","Item","key","AddFilter","createComponent","Select","AddFilterSelect","Input","AddFilterInput","Dropdown","AddFilterDropdown","_default","exports"],"sources":["../../src/AddFilter.tsx"],"sourcesContent":["import { Flex, ScreenReaderOnly } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, Root, lastInteraction } from '@semcore/core';\nimport type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { extractFrom } from '@semcore/core/lib/utils/findComponent';\nimport DropdownMenu from '@semcore/dropdown-menu';\nimport CloseM from '@semcore/icon/Close/m';\nimport MathPlusM from '@semcore/icon/MathPlus/m';\nimport type { SelectProps } from '@semcore/select';\nimport React from 'react';\n\nimport type { NSAddFilter } from './AddFilter.types';\nimport AddFilterDropdown from './components/AddFilterDropdown';\nimport AddFilterInput from './components/AddFilterInput';\nimport AddFilterSelect from './components/AddFilterSelect';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\n\ntype AddFilterDropdownOption = { label: string; value: string };\ntype AddFilterDropdownMenuProps = {\n options: AddFilterDropdownOption[];\n toggleFieldVisibility: (name: NSAddFilter.Key, status: boolean) => void;\n visibleFilters: NSAddFilter.Key[];\n getI18nText: (key: string) => string;\n};\n\nclass RootAddFilter extends Component<\n Intergalactic.InternalTypings.InferComponentProps<NSAddFilter.Component>,\n typeof RootAddFilter.enhance,\n NSAddFilter.Handlers,\n WithI18nEnhanceProps,\n NSAddFilter.State,\n NSAddFilter.DefaultProps\n> {\n addFilterTrigger = React.createRef<HTMLButtonElement>();\n filtersFocusMap: Map<string | undefined, HTMLElement> = new Map();\n clearMessageTimer: ReturnType<typeof setTimeout> | undefined;\n addDropdownItems: AddFilterDropdownOption[];\n\n static displayName = 'AddFilter';\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n static defaultProps: NSAddFilter.DefaultProps = {\n i18n: localizedMessages,\n locale: 'en',\n defaultVisibleFilters: [],\n };\n\n static componentsNames = ['AddFilter.Input', 'AddFilter.Select', 'AddFilter.Dropdown'];\n static getFilterPatternItems = (children: React.ReactNode) => {\n return extractFrom(children, RootAddFilter.componentsNames);\n };\n\n static getDefaultAddDropdownOptions = (children: React.ReactNode) => {\n const [filters] = RootAddFilter.getFilterPatternItems(children);\n\n return filters.map(({ props }: { props: NSAddFilter.ItemProps }) => {\n const { name, displayName } = props;\n return { label: displayName ?? name, value: name };\n });\n };\n\n constructor(props: NSAddFilter.Props) {\n super(props);\n\n this.state = {\n clearFiltersMessage: '',\n };\n\n this.addDropdownItems = RootAddFilter.getDefaultAddDropdownOptions(props.children);\n }\n\n uncontrolledProps() {\n return {\n visibleFilters: null,\n };\n }\n\n componentWillUnmount() {\n clearTimeout(this.clearMessageTimer);\n }\n\n focusFilterAfterItemCleared(name?: string) {\n if (!lastInteraction.isKeyboard()) {\n return;\n }\n\n const { visibleFilters } = this.asProps;\n const deletedIndex = visibleFilters.findIndex((n) => n === name);\n setTimeout(() => {\n const { visibleFilters } = this.asProps;\n const focusFilterName = visibleFilters.at(deletedIndex);\n\n const itemToFocus =\n this.filtersFocusMap.get(focusFilterName) ?? this.addFilterTrigger.current;\n itemToFocus?.focus();\n }, 20);\n }\n\n getVisibleFilters(allFilters: React.ReactElement<NSAddFilter.ItemProps>[]) {\n return this.asProps.visibleFilters.map((name) => {\n return allFilters.find(({ props }) => props.name === name);\n });\n }\n\n getItemCommonProps(props: NSAddFilter.ItemProps) {\n const { name } = props;\n const { filterData } = this.asProps;\n\n return {\n name,\n value: filterData[name],\n setFocusRef: (ref: HTMLElement) => {\n this.filtersFocusMap.set(name, ref);\n },\n onClear: () => {\n this.hideFilter(name);\n this.focusFilterAfterItemCleared(name);\n },\n };\n }\n\n getInputProps(props: NSAddFilter.ItemProps) {\n return this.getItemCommonProps(props);\n }\n\n getDropdownAndSelectProps(props: NSAddFilter.ItemProps, isEmpty: () => boolean) {\n const { setFocusRef, value, onClear } = this.getItemCommonProps(props);\n return {\n value,\n onClear,\n setFocusRef,\n onVisibleChange: (visible: boolean) => {\n // waiting for filterData update\n setTimeout(() => {\n const { onClear } = this.getItemCommonProps(props);\n\n if (!visible && isEmpty()) {\n onClear();\n }\n }, 0);\n },\n };\n }\n\n getSelectProps(props: NSAddFilter.Select.Props) {\n const isEmpty = () => {\n const { multiselect } = props;\n const { value } = this.getItemCommonProps(props);\n return multiselect && Array.isArray(value) ? !value?.length : !value;\n };\n\n return this.getDropdownAndSelectProps(props, isEmpty);\n }\n\n getDropdownProps(props: NSAddFilter.ItemProps) {\n const isEmpty = () => {\n const { value } = this.getItemCommonProps(props);\n return value == null;\n };\n return this.getDropdownAndSelectProps(props, isEmpty);\n }\n\n clearAll() {\n this.handlers.visibleFilters([]);\n this.props.onClearAll();\n this.announceClearMessageToSR();\n\n // waiting for AddFilter button appear in the DOM\n setTimeout(() => {\n this.addFilterTrigger.current?.focus();\n }, 20);\n }\n\n announceClearMessageToSR() {\n const { getI18nText } = this.asProps;\n const clearFiltersMessage = getI18nText('AddFilter.ScreenReaderMessage.FiltersCleared');\n this.setState({ clearFiltersMessage });\n\n this.clearMessageTimer = setTimeout(() => {\n this.setState({ clearFiltersMessage: '' });\n }, 300);\n }\n\n toggleFieldVisibility(name: string, status: boolean) {\n const visibleFilters = new Set(this.asProps.visibleFilters);\n if (status) {\n visibleFilters.add(name);\n } else {\n visibleFilters.delete(name);\n }\n\n this.handlers.visibleFilters(Array.from(visibleFilters));\n }\n\n hideFilter(name: string) {\n this.toggleFieldVisibility(name, false);\n }\n\n getFilterSelectionMenuProps() {\n const { getI18nText, visibleFilters } = this.asProps;\n\n return {\n ref: this.addFilterTrigger,\n options: this.addDropdownItems,\n toggleFieldVisibility: (name: string, status: boolean) =>\n this.toggleFieldVisibility(name, status),\n visibleFilters,\n getI18nText,\n };\n }\n\n getClearAllFiltersProps() {\n const { getI18nText, filterData } = this.asProps;\n\n return {\n hasFilterData:\n Object.values(filterData).filter((value) => (Array.isArray(value) ? value?.length : value))\n .length > 0,\n clearAll: () => {\n this.clearAll();\n },\n getI18nText,\n };\n }\n\n render() {\n const { Children, filterData, getI18nText } = this.asProps;\n const [filters, persistentFilters] = RootAddFilter.getFilterPatternItems(Children);\n const VisibleFilteredChildren = this.getVisibleFilters(filters);\n\n const filtersSelectionDropdown = this.getFilterSelectionMenuProps();\n const hasFilterData = Object.values(filterData).filter((value) => (Array.isArray(value) ? value?.length : value)).length > 0;\n\n return (\n <Root render={Flex} gap={2} flexWrap>\n {persistentFilters}\n {VisibleFilteredChildren}\n <AddFilterDropdownMenu {...filtersSelectionDropdown} />\n {hasFilterData && (\n <Button use='tertiary' theme='muted' addonLeft={CloseM} ml='auto' onClick={() => this.clearAll()}>\n {getI18nText('AddFilter.Button.Text')}\n </Button>\n )}\n\n <ScreenReaderOnly aria-live='polite' role='status'>\n {this.state.clearFiltersMessage}\n </ScreenReaderOnly>\n </Root>\n );\n }\n}\n\nconst AddFilterDropdownMenu = React.forwardRef<HTMLButtonElement, AddFilterDropdownMenuProps>(\n function (props, ref) {\n const { options, toggleFieldVisibility, visibleFilters, getI18nText } = props;\n const [visible, setVisible] = React.useState(false);\n\n const optionsWithoutVisible = React.useMemo(() => {\n return options.filter((filter) => {\n return !visibleFilters.includes(filter.value);\n });\n }, [options, visibleFilters]);\n\n if (!optionsWithoutVisible.length) {\n return null;\n }\n\n return (\n <DropdownMenu visible={visible} onVisibleChange={setVisible}>\n <DropdownMenu.Trigger ref={ref} tag={Button} use='tertiary' addonLeft={MathPlusM}>\n {getI18nText('AddFilter.DropdownTrigger.Text')}\n </DropdownMenu.Trigger>\n <DropdownMenu.Menu>\n {optionsWithoutVisible.map(({ label, value }) => (\n <DropdownMenu.Item\n key={value}\n onClick={() => {\n toggleFieldVisibility(value, true);\n setVisible(false);\n }}\n >\n {label}\n </DropdownMenu.Item>\n ))}\n </DropdownMenu.Menu>\n </DropdownMenu>\n );\n },\n);\n\nexport type RootAddFilterType = typeof RootAddFilter;\n\n/**\n * AddFilter\n *\n * {@link https://developer.semrush.com/intergalactic/filter-group/add-filter/add-filter-code|Examples}\n */\nconst AddFilter = createComponent<\n NSAddFilter.Component,\n RootAddFilterType\n>(RootAddFilter, {\n Select: AddFilterSelect,\n Input: AddFilterInput,\n Dropdown: AddFilterDropdown,\n});\n\nexport default AddFilter;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAIA,IAAAI,YAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,EAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,GAAA,GAAAL,sBAAA,CAAAH,OAAA;AAEA,IAAAS,MAAA,GAAAN,sBAAA,CAAAH,OAAA;AAGA,IAAAU,kBAAA,GAAAP,sBAAA,CAAAH,OAAA;AACA,IAAAW,eAAA,GAAAR,sBAAA,CAAAH,OAAA;AACA,IAAAY,gBAAA,GAAAT,sBAAA,CAAAH,OAAA;AACA,IAAAa,4BAAA,GAAAb,OAAA;AAAmF,IAAAc,cAAA;AAUnF,MAAMC,aAAa,SAASC,eAAS,CAOnC;EA6BAC,WAAWA,CAACC,KAAwB,EAAE;IACpC,KAAK,CAACA,KAAK,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,yCA7BIC,cAAK,CAACC,SAAS,CAAoB,CAAC;IAAA,IAAAH,gBAAA,CAAAC,OAAA,2BACC,IAAIG,GAAG,CAAC,CAAC;IAAA,IAAAJ,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IA8B/D,IAAI,CAACI,KAAK,GAAG;MACXC,mBAAmB,EAAE;IACvB,CAAC;IAED,IAAI,CAACC,gBAAgB,GAAGX,aAAa,CAACY,4BAA4B,CAACT,KAAK,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YmH,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddFilter.types.js","names":[],"sources":["../../src/AddFilter.types.ts"],"sourcesContent":["import type { FlexProps } from '@semcore/base-components';\nimport type { FilterTrigger } from '@semcore/base-trigger';\nimport type { ButtonLink } from '@semcore/button';\nimport type { Intergalactic } from '@semcore/core';\nimport type Dropdown from '@semcore/dropdown';\nimport type { DropdownTriggerProps } from '@semcore/dropdown';\nimport type Input from '@semcore/input';\nimport type Select from '@semcore/select';\n\nimport type { LocalizedMessages } from './translations/__intergalactic-dynamic-locales';\n\
|
|
1
|
+
{"version":3,"file":"AddFilter.types.js","names":[],"sources":["../../src/AddFilter.types.ts"],"sourcesContent":["import type { FlexProps } from '@semcore/base-components';\nimport type { FilterTrigger } from '@semcore/base-trigger';\nimport type { ButtonLink } from '@semcore/button';\nimport type { Intergalactic } from '@semcore/core';\nimport type Dropdown from '@semcore/dropdown';\nimport type { DropdownTriggerProps } from '@semcore/dropdown';\nimport type Input from '@semcore/input';\nimport type Select from '@semcore/select';\nimport type { SelectProps } from '@semcore/select';\n\nimport type { LocalizedMessages } from './translations/__intergalactic-dynamic-locales';\n\ndeclare namespace NSAddFilter {\n type Key = string;\n type Data = Record<string, any>;\n type Props = FlexProps & {\n /**\n * Action to perform on `Clear filters` button click.\n */\n onClearAll: () => void;\n /**\n * `FilterData` object.\n */\n filterData: NSAddFilter.Data;\n /**\n * List of visible filters keys. Relative to the `name` in AddFilterItemProps.\n */\n visibleFilters?: NSAddFilter.Key[];\n /**\n * Callback for handle changes in visible filters.\n */\n onVisibleFiltersChange?: (visibleFilters: NSAddFilter.Key[]) => void;\n };\n type DefaultProps = {\n i18n: LocalizedMessages;\n locale: 'en';\n defaultVisibleFilters: Props['visibleFilters'];\n };\n type State = {\n clearFiltersMessage: string;\n };\n type Handlers = {\n visibleFilters: null;\n };\n type ItemProps = {\n /**\n * Non-persistent filter item unique `name`. Should be the same as related `key` in `FilterData` item related to Filter Control.\n */\n name: NSAddFilter.Key;\n /**\n * Optional `displayName` to be displayed inside `Add filter` dropdown menu. If not specified, `name` will be used instead.\n */\n displayName?: string;\n /**\n * Action to perform on filter item unmount.\n */\n onUnmount?: () => void;\n\n /**\n * @inner\n */\n visible?: boolean;\n };\n\n namespace Select {\n type Props = SelectProps & ItemProps;\n\n type DefaultProps = {\n defaultVisible: false;\n };\n type Handlers = {\n visible: null;\n };\n\n namespace Trigger {\n type Component = typeof FilterTrigger;\n }\n\n namespace Popper {\n type Component = Intergalactic.Component<typeof Select.Popper, {}, { onApply: () => void }>;\n }\n\n namespace Option {\n type Component = typeof Select.Option;\n }\n\n namespace Menu {\n type Component = typeof Select.Menu;\n }\n\n namespace List {\n type Component = typeof Select.List;\n }\n\n namespace InputSearch {\n type Component = typeof Select.InputSearch;\n }\n\n type Component = Intergalactic.Component<typeof Select, Props> & {\n Trigger: Trigger.Component;\n Popper: Popper.Component;\n Option: Option.Component;\n Menu: Menu.Component;\n List: List.Component;\n InputSearch: InputSearch.Component;\n };\n }\n\n namespace Input {\n namespace Addon {\n type Component = typeof Input.Addon;\n }\n\n namespace Value {\n type Component = typeof Input.Value;\n }\n\n namespace Clear {\n type Component = typeof ButtonLink;\n }\n\n type Component = Intergalactic.Component<typeof Input, NSAddFilter.ItemProps> & {\n Addon: Addon.Component;\n Value: Value.Component;\n Clear: Clear.Component;\n };\n }\n\n namespace Dropdown {\n type DefaultProps = {\n defaultVisible: false;\n };\n type Handlers = {\n visible: null;\n };\n namespace Trigger {\n type Component = Intergalactic.Component<typeof Dropdown.Trigger, DropdownTriggerProps & { onClear: () => void }>;\n }\n\n namespace Popper {\n type Component = Intergalactic.Component<typeof Dropdown.Popper, {}, { onApply: () => void }>;\n }\n\n type Component = Intergalactic.Component<typeof Dropdown, NSAddFilter.ItemProps> & {\n Trigger: Trigger.Component;\n Popper: Popper.Component;\n };\n }\n\n type Component = Intergalactic.Component<'div', Props> & {\n Dropdown: Dropdown.Component;\n Input: Input.Component;\n Select: Select.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type AddFilterKey = NSAddFilter.Key;\n/** @deprecated It will be removed in v18. */\nexport type AddFilterItemProps = NSAddFilter.ItemProps;\n/** @deprecated It will be removed in v18. */\ndeclare const AddFilterSelectType: NSAddFilter.Select.Component;\n/** @deprecated It will be removed in v18. */\ndeclare const AddFilterInputType: NSAddFilter.Input.Component;\n/** @deprecated It will be removed in v18. */\ndeclare const AddFilterDropdownType: NSAddFilter.Dropdown.Component;\n/** @deprecated It will be removed in v18. */\nexport type FilterData = NSAddFilter.Data;\n/** @deprecated It will be removed in v18. */\nexport type AddFilterProps = NSAddFilter.Props;\n/** @deprecated It will be removed in v18. */\nexport type AddFilterDefaultProps = NSAddFilter.DefaultProps;\n/** @deprecated It will be removed in v18. */\nexport type AddFilterType = NSAddFilter.Component;\n\nexport { AddFilterInputType, AddFilterSelectType, AddFilterDropdownType };\nexport type { NSAddFilter };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddFilterDropdown.js","names":["_core","require","_baseTrigger","_dropdown","_interopRequireDefault","_react","AddFilterDropdownRoot","Component","componentDidMount","props","visible","undefined","setTimeout","handlers","uncontrolledProps","componentWillUnmount","asProps","onUnmount","getTriggerProps","value","onClear","setFocusRef","tag","FilterTrigger","triggerRef","empty","autoFocus","getPopperProps","onKeyDown","e","key","onApply","render","_ref","default","createElement","Dropdown","assignProps","_defineProperty2","defaultVisible","AddFilterDropdown","createComponent","Trigger","Popper","_default","exports"],"sources":["../../../src/components/AddFilterDropdown.tsx"],"sourcesContent":["import { FilterTrigger } from '@semcore/base-trigger';\nimport { createComponent, Component, Root } from '@semcore/core';\nimport Dropdown from '@semcore/dropdown';\nimport React from 'react';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"AddFilterDropdown.js","names":["_core","require","_baseTrigger","_dropdown","_interopRequireDefault","_react","AddFilterDropdownRoot","Component","componentDidMount","props","visible","undefined","setTimeout","handlers","uncontrolledProps","componentWillUnmount","asProps","onUnmount","getTriggerProps","value","onClear","setFocusRef","tag","FilterTrigger","triggerRef","empty","autoFocus","getPopperProps","onKeyDown","e","key","onApply","render","_ref","default","createElement","Dropdown","assignProps","_defineProperty2","defaultVisible","AddFilterDropdown","createComponent","Trigger","Popper","_default","exports"],"sources":["../../../src/components/AddFilterDropdown.tsx"],"sourcesContent":["import { FilterTrigger } from '@semcore/base-trigger';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, Root } from '@semcore/core';\nimport Dropdown from '@semcore/dropdown';\nimport React from 'react';\n\nimport type { RootAddFilterType } from '../AddFilter';\nimport type { NSAddFilter } from '../AddFilter.types';\n\nclass AddFilterDropdownRoot extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<NSAddFilter.Dropdown.Component, RootAddFilterType, 'Dropdown'>,\n [],\n NSAddFilter.Dropdown.Handlers,\n {},\n {},\n NSAddFilter.Dropdown.DefaultProps\n> {\n static displayName = 'AddFilterDropdown';\n\n static defaultProps = {\n defaultVisible: false,\n } as const;\n\n componentDidMount() {\n if (this.props.visible === undefined) {\n setTimeout(() => {\n this.handlers.visible(true);\n }, 0);\n }\n }\n\n uncontrolledProps() {\n return {\n visible: null,\n };\n }\n\n componentWillUnmount() {\n this.asProps.onUnmount?.();\n }\n\n getTriggerProps() {\n const { value, onClear, setFocusRef } = this.asProps;\n\n return {\n tag: FilterTrigger,\n triggerRef: setFocusRef,\n empty: value == null,\n onClear,\n autoFocus: true,\n };\n }\n\n getPopperProps() {\n const { value, onClear } = this.asProps;\n\n return {\n onKeyDown: (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (!value && e.key === 'Escape') {\n onClear();\n }\n },\n onApply: () => {\n this.handlers.visible(false);\n },\n };\n }\n\n render() {\n return <Root render={Dropdown} />;\n }\n}\n\nconst AddFilterDropdown = createComponent<\n NSAddFilter.Dropdown.Component,\n typeof AddFilterDropdownRoot\n>(AddFilterDrop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ACH,OAAO,CAAC,KAAK,CAAC;MAC9B;IACF,CAAC;EACH;EAEAsB,MAAMA,CAAA,EAAG;IAAA,IAAAC,IAAA,QAAAjB,OAAA;IACP,oBAAOX,MAAA,CAAA6B,OAAA,CAAAC,aAAA,CAAcC,iBAAQ,MAAApC,KAAA,CAAAqC,WAAA,MAAAJ,IAAA,CAAG,CAAC;EACnC;AACF;AAAC,IAAAK,gBAAA,CAAAJ,OAAA,EA9DK5B,qBAAqB,iBAQJ,mBAAmB;AAAA,IAAAgC,gBAAA,CAAAJ,OAAA,EARpC5B,qBAAqB,kBAUH;EACpBiC,cAAc,EAAE;AAClB,CAAC;AAoDH,MAAMC,iBAAiB,GAAG,IAAAC,qBAAe,EAGvCnC,qBAAqB,EAAE;EACvBoC,OAAO,EAAEN,iBAAQ,CAACM,OAAO;EACzBC,MAAM,EAAEP,iBAAQ,CAACO;AACnB,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAX,OAAA,GAEYM,iBAAiB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddFilterInput.js","names":["_core","require","_button","_input","_interopRequireDefault","_react","AddFilterInputRoot","Component","componentWillUnmount","asProps","onUnmount","getValueProps","props","value","onClear","setFocusRef","ref","onBlur","setTimeout","onKeyDown","e","key","autoFocus","getClearProps","onClick","render","_ref","default","createElement","Input","assignProps","_defineProperty2","Clear","_ref2","arguments[0]","ButtonLink","AddFilterInput","createComponent","Value","Addon","_default","exports"],"sources":["../../../src/components/AddFilterInput.tsx"],"sourcesContent":["import { ButtonLink } from '@semcore/button';\nimport { createComponent, Component, Root } from '@semcore/core';\nimport Input from '@semcore/input';\nimport type {
|
|
1
|
+
{"version":3,"file":"AddFilterInput.js","names":["_core","require","_button","_input","_interopRequireDefault","_react","AddFilterInputRoot","Component","componentWillUnmount","asProps","onUnmount","getValueProps","props","value","onClear","setFocusRef","ref","onBlur","setTimeout","onKeyDown","e","key","autoFocus","getClearProps","onClick","render","_ref","default","createElement","Input","assignProps","_defineProperty2","Clear","_ref2","arguments[0]","ButtonLink","AddFilterInput","createComponent","Value","Addon","_default","exports"],"sources":["../../../src/components/AddFilterInput.tsx"],"sourcesContent":["import { ButtonLink } from '@semcore/button';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, Root } from '@semcore/core';\nimport Input from '@semcore/input';\nimport type { NSInput } from '@semcore/input';\nimport React from 'react';\n\nimport type { RootAddFilterType } from '../AddFilter';\nimport type { NSAddFilter } from '../AddFilter.types';\nclass AddFilterInputRoot extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<NSAddFilter.Input.Component, RootAddFilterType, 'Input'>\n> {\n static displayName = 'AddFilterInput';\n\n componentWillUnmount() {\n this.asProps.onUnmount?.();\n }\n\n getValueProps(props: NSInput.Value.Props) {\n const { value, onClear, setFocusRef } = this.asProps;\n\n return {\n ...props,\n ref: setFocusRef,\n onBlur: () => {\n if (!value) {\n setTimeout(onClear, 200);\n }\n },\n onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (!value && e.key === 'Escape') {\n onClear();\n }\n },\n autoFocus: true,\n };\n }\n\n getClearProps() {\n const { onClear } = this.asProps;\n\n return {\n onClick: onClear,\n };\n }\n\n render() {\n return <Root render={Input} w='auto' inline={false} />;\n }\n}\n\nfunction Clear() {\n return <Root render={ButtonLink} />;\n}\n\nconst AddFilterInput = createComponent<\n NSAddFilter.Input.Component,\n typeof AddFilterInputRoot\n>(AddFilterInputRoot, {\n Value: Input.Value,\n Addon: Input.Addon,\n Clear,\n});\n\nexport default AddFilterInput;\n"],"mappings":";;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,OAAA,GAAAD,OAAA;AAGA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAD,sBAAA,CAAAH,OAAA;AAIA,MAAMK,kBAAkB,SAASC,eAAS,CAExC;EAGAC,oBAAoBA,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AAET,cAAK,CAACS,KAAK;EAClBC,KAAK,EAAEV,cAAK,CAACU,KAAK;EAClBP;AACF,CAAC,CAAC;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAd,OAAA,GAEYS,cAAc","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddFilterSelect.js","names":["_core","require","_baseTrigger","_select","_interopRequireDefault","_react","AddFilterSelectRoot","Component","componentDidMount","props","visible","undefined","setTimeout","handlers","componentWillUnmount","asProps","onUnmount","uncontrolledProps","isValueEmpty","value","multiselect","Array","isArray","length","getTriggerProps","onClear","setFocusRef","tag","FilterTrigger","triggerRef","onKeyDown","e","key","empty","autoFocus","getPopperProps","onApply","render","_ref","default","createElement","Select","assignProps","_defineProperty2","defaultVisible","AddFilterSelect","createComponent","Trigger","Menu","Option","Checkbox","List","Popper","InputSearch","_default","exports"],"sources":["../../../src/components/AddFilterSelect.tsx"],"sourcesContent":["import { FilterTrigger } from '@semcore/base-trigger';\nimport { createComponent, Component, Root } from '@semcore/core';\nimport
|
|
1
|
+
{"version":3,"file":"AddFilterSelect.js","names":["_core","require","_baseTrigger","_select","_interopRequireDefault","_react","AddFilterSelectRoot","Component","componentDidMount","props","visible","undefined","setTimeout","handlers","componentWillUnmount","asProps","onUnmount","uncontrolledProps","isValueEmpty","value","multiselect","Array","isArray","length","getTriggerProps","onClear","setFocusRef","tag","FilterTrigger","triggerRef","onKeyDown","e","key","empty","autoFocus","getPopperProps","onApply","render","_ref","default","createElement","Select","assignProps","_defineProperty2","defaultVisible","AddFilterSelect","createComponent","Trigger","Menu","Option","Checkbox","List","Popper","InputSearch","_default","exports"],"sources":["../../../src/components/AddFilterSelect.tsx"],"sourcesContent":["import { FilterTrigger } from '@semcore/base-trigger';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, Root } from '@semcore/core';\nimport type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport Select from '@semcore/select';\nimport React from 'react';\n\nimport type { RootAddFilterType } from '../AddFilter';\nimport type { NSAddFilter } from '../AddFilter.types';\n\nclass AddFilterSelectRoot extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<NSAddFilter.Select.Component, RootAddFilterType, 'Select'>,\n [],\n NSAddFilter.Select.Handlers,\n WithI18nEnhanceProps,\n {},\n NSAddFilter.Select.DefaultProps\n> {\n static displayName = 'AddFilterSelect';\n\n static defaultProps = {\n defaultVisible: false,\n } as const;\n\n componentDidMount() {\n if (this.props.visible === undefined) {\n setTimeout(() => {\n this.handlers.visible(true);\n }, 0);\n }\n }\n\n componentWillUnmount() {\n this.asProps.onUnmount?.();\n }\n\n uncontrolledProps() {\n return {\n visible: null,\n };\n }\n\n isValueEmpty() {\n const { value, multiselect } = this.asProps;\n return multiselect && Array.isArray(value) ? !value?.length : !value;\n }\n\n getTriggerProps() {\n const { onClear, setFocusRef } = this.asProps;\n\n return {\n tag: FilterTrigger,\n triggerRef: setFocusRef,\n onKeyDown: (e: React.KeyboardEvent<HTMLImageElement>) => {\n if (this.isValueEmpty() && e.key === 'Escape') {\n onClear();\n }\n },\n empty: this.isValueEmpty(),\n onClear,\n autoFocus: true,\n };\n }\n\n getPopperProps() {\n return {\n onApply: () => {\n this.handlers.visible(false);\n },\n };\n }\n\n render() {\n return <Root render={Select} />;\n }\n}\n\nconst AddFilterSelect = createComponent<\n NSAddFilter.Select.Component,\n typeof AddFilterSelectRoot\n>(AddFilterSelectRoot, {\n Trigger: Select.Trigger,\n Menu: Select.Menu,\n Option: [\n Select.Option,\n {\n Checkbox: Select.Option.Checkbox,\n },\n ],\n List: Select.List,\n Popper: Select.Popper,\n InputSearch: Select.InputSearch,\n});\n\nexport default AddFilterSelect;\n"],"mappings":";;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAD,sBA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EAAG;IAAA,IAAAC,IAAA,QAAAvB,OAAA;IACP,oBAAOV,MAAA,CAAAkC,OAAA,CAAAC,aAAA,CAAcC,eAAM,MAAAzC,KAAA,CAAA0C,WAAA,MAAAJ,IAAA,CAAG,CAAC;EACjC;AACF;AAAC,IAAAK,gBAAA,CAAAJ,OAAA,EAjEKjC,mBAAmB,iBAQF,iBAAiB;AAAA,IAAAqC,gBAAA,CAAAJ,OAAA,EARlCjC,mBAAmB,kBAUD;EACpBsC,cAAc,EAAE;AAClB,CAAC;AAuDH,MAAMC,eAAe,GAAG,IAAAC,qBAAe,EAGrCxC,mBAAmB,EAAE;EACrByC,OAAO,EAAEN,eAAM,CAACM,OAAO;EACvBC,IAAI,EAAEP,eAAM,CAACO,IAAI;EACjBC,MAAM,EAAE,CACNR,eAAM,CAACQ,MAAM,EACb;IACEC,QAAQ,EAAET,eAAM,CAACQ,MAAM,CAACC;EAC1B,CAAC,CACF;EACDC,IAAI,EAAEV,eAAM,CAACU,IAAI;EACjBC,MAAM,EAAEX,eAAM,CAACW,MAAM;EACrBC,WAAW,EAAEZ,eAAM,CAACY;AACtB,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhB,OAAA,GAEYM,eAAe","ignoreList":[]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -11,18 +11,7 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
return _AddFilter.default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
var _AddFilter =
|
|
15
|
-
Object.keys(_AddFilter).forEach(function (key) {
|
|
16
|
-
if (key === "default" || key === "__esModule") return;
|
|
17
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
18
|
-
if (key in exports && exports[key] === _AddFilter[key]) return;
|
|
19
|
-
Object.defineProperty(exports, key, {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return _AddFilter[key];
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
});
|
|
14
|
+
var _AddFilter = _interopRequireDefault(require("./AddFilter"));
|
|
26
15
|
var _AddFilter2 = require("./AddFilter.types");
|
|
27
16
|
Object.keys(_AddFilter2).forEach(function (key) {
|
|
28
17
|
if (key === "default" || key === "__esModule") return;
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_AddFilter","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_AddFilter","_interopRequireDefault","require","_AddFilter2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sources":["../../src/index.ts"],"sourcesContent":["export { default } from './AddFilter';\nexport * from './AddFilter.types';\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/lib/es6/AddFilter.js
CHANGED
|
@@ -189,16 +189,24 @@ class RootAddFilter extends Component {
|
|
|
189
189
|
render() {
|
|
190
190
|
var _ref = this.asProps;
|
|
191
191
|
const {
|
|
192
|
-
Children
|
|
192
|
+
Children,
|
|
193
|
+
filterData,
|
|
194
|
+
getI18nText
|
|
193
195
|
} = this.asProps;
|
|
194
196
|
const [filters, persistentFilters] = RootAddFilter.getFilterPatternItems(Children);
|
|
195
197
|
const VisibleFilteredChildren = this.getVisibleFilters(filters);
|
|
196
198
|
const filtersSelectionDropdown = this.getFilterSelectionMenuProps();
|
|
197
|
-
const
|
|
199
|
+
const hasFilterData = Object.values(filterData).filter(value => Array.isArray(value) ? value?.length : value).length > 0;
|
|
198
200
|
return /*#__PURE__*/React.createElement(Flex, _assignProps({
|
|
199
201
|
"gap": 2,
|
|
200
202
|
"flexWrap": true
|
|
201
|
-
}, _ref), persistentFilters, VisibleFilteredChildren, /*#__PURE__*/React.createElement(AddFilterDropdownMenu, filtersSelectionDropdown),
|
|
203
|
+
}, _ref), persistentFilters, VisibleFilteredChildren, /*#__PURE__*/React.createElement(AddFilterDropdownMenu, filtersSelectionDropdown), hasFilterData && /*#__PURE__*/React.createElement(Button, {
|
|
204
|
+
use: "tertiary",
|
|
205
|
+
theme: "muted",
|
|
206
|
+
addonLeft: CloseM,
|
|
207
|
+
ml: "auto",
|
|
208
|
+
onClick: () => this.clearAll()
|
|
209
|
+
}, getI18nText('AddFilter.Button.Text')), /*#__PURE__*/React.createElement(ScreenReaderOnly, {
|
|
202
210
|
"aria-live": "polite",
|
|
203
211
|
role: "status"
|
|
204
212
|
}, this.state.clearFiltersMessage));
|
|
@@ -266,20 +274,6 @@ const AddFilterDropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref
|
|
|
266
274
|
}
|
|
267
275
|
}, label))));
|
|
268
276
|
});
|
|
269
|
-
function ClearAllFilters({
|
|
270
|
-
hasFilterData,
|
|
271
|
-
clearAll,
|
|
272
|
-
getI18nText
|
|
273
|
-
}) {
|
|
274
|
-
return hasFilterData ? /*#__PURE__*/React.createElement(Button, {
|
|
275
|
-
use: "tertiary",
|
|
276
|
-
theme: "muted",
|
|
277
|
-
addonLeft: CloseM,
|
|
278
|
-
ml: "auto",
|
|
279
|
-
onClick: clearAll
|
|
280
|
-
}, getI18nText('AddFilter.Button.Text')) : null;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
277
|
/**
|
|
284
278
|
* AddFilter
|
|
285
279
|
*
|
package/lib/es6/AddFilter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddFilter.js","names":["Flex","ScreenReaderOnly","Button","createComponent","Component","Root","lastInteraction","i18nEnhance","extractFrom","DropdownMenu","CloseM","MathPlusM","React","AddFilterDropdown","AddFilterInput","AddFilterSelect","localizedMessages","RootAddFilter","constructor","props","_defineProperty","createRef","Map","state","clearFiltersMessage","addDropdownItems","getDefaultAddDropdownOptions","children","uncontrolledProps","visibleFilters","componentWillUnmount","clearTimeout","clearMessageTimer","focusFilterAfterItemCleared","name","isKeyboard","asProps","deletedIndex","findIndex","n","setTimeout","focusFilterName","at","itemToFocus","filtersFocusMap","get","addFilterTrigger","current","focus","getVisibleFilters","allFilters","map","find","getItemCommonProps","filterData","value","setFocusRef","ref","set","onClear","hideFilter","getInputProps","getDropdownAndSelectProps","isEmpty","onVisibleChange","visible","getSelectProps","multiselect","Array","isArray","length","getDropdownProps","clearAll","handlers","onClearAll","announceClearMessageToSR","getI18nText","setState","toggleFieldVisibility","status","Set","add","delete","from","getFilterSelectionMenuProps","options","getClearAllFiltersProps","hasFilterData","Object","values","filter","render","_ref","Children","filters","persistentFilters","getFilterPatternItems","VisibleFilteredChildren","filtersSelectionDropdown","clearAllFiltersProps","createElement","_assignProps","AddFilterDropdownMenu","ClearAllFilters","role","_RootAddFilter","i18n","locale","defaultVisibleFilters","componentsNames","displayName","label","forwardRef","setVisible","useState","optionsWithoutVisible","useMemo","includes","Trigger","tag","use","addonLeft","Menu","Item","key","onClick","theme","ml","AddFilter","Select","Input","Dropdown"],"sources":["../../src/AddFilter.tsx"],"sourcesContent":["import { Flex, ScreenReaderOnly } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport { createComponent, Component, Root, lastInteraction } from '@semcore/core';\nimport type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { extractFrom } from '@semcore/core/lib/utils/findComponent';\nimport DropdownMenu from '@semcore/dropdown-menu';\nimport CloseM from '@semcore/icon/Close/m';\nimport MathPlusM from '@semcore/icon/MathPlus/m';\nimport type { SelectProps } from '@semcore/select';\nimport React from 'react';\n\nimport type { AddFilterType, AddFilterProps, AddFilterItemProps, AddFilterKey, AddFilterDefaultProps } from './AddFilter.types';\nimport AddFilterDropdown from './components/AddFilterDropdown';\nimport AddFilterInput from './components/AddFilterInput';\nimport AddFilterSelect from './components/AddFilterSelect';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\n\ntype SelectItemProps = SelectProps & AddFilterItemProps;\n\ntype AddFilterDropdownOption = { label: string; value: string };\ntype AddFilterDropdownMenuProps = {\n options: AddFilterDropdownOption[];\n toggleFieldVisibility: (name: AddFilterKey, status: boolean) => void;\n visibleFilters: AddFilterKey[];\n getI18nText: (key: string) => string;\n};\n\ntype ClearAllFiltersButtonProps = {\n hasFilterData: boolean;\n clearAll: () => void;\n getI18nText: (key: string) => string;\n};\n\ntype AddFilterState = {\n clearFiltersMessage: string;\n};\n\nclass RootAddFilter extends Component<\n AddFilterProps,\n typeof RootAddFilter.enhance,\n { visibleFilters: null },\n WithI18nEnhanceProps,\n AddFilterState,\n AddFilterDefaultProps\n> {\n addFilterTrigger = React.createRef<HTMLButtonElement>();\n filtersFocusMap: Map<string | undefined, HTMLElement> = new Map();\n clearMessageTimer: ReturnType<typeof setTimeout> | undefined;\n addDropdownItems: AddFilterDropdownOption[];\n\n static displayName = 'AddFilter';\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n static defaultProps: AddFilterDefaultProps = {\n i18n: localizedMessages,\n locale: 'en',\n defaultVisibleFilters: [],\n };\n\n static componentsNames = ['AddFilter.Input', 'AddFilter.Select', 'AddFilter.Dropdown'];\n static getFilterPatternItems = (children: React.ReactNode) => {\n return extractFrom(children, RootAddFilter.componentsNames);\n };\n\n static getDefaultAddDropdownOptions = (children: React.ReactNode) => {\n const [filters] = RootAddFilter.getFilterPatternItems(children);\n\n return filters.map(({ props }: { props: AddFilterItemProps }) => {\n const { name, displayName } = props;\n return { label: displayName ?? name, value: name };\n });\n };\n\n constructor(props: AddFilterProps) {\n super(props);\n\n this.state = {\n clearFiltersMessage: '',\n };\n\n this.addDropdownItems = RootAddFilter.getDefaultAddDropdownOptions(props.children);\n }\n\n uncontrolledProps() {\n return {\n visibleFilters: null,\n };\n }\n\n componentWillUnmount() {\n clearTimeout(this.clearMessageTimer);\n }\n\n focusFilterAfterItemCleared(name?: string) {\n if (!lastInteraction.isKeyboard()) {\n return;\n }\n\n const { visibleFilters } = this.asProps;\n const deletedIndex = visibleFilters.findIndex((n) => n === name);\n setTimeout(() => {\n const { visibleFilters } = this.asProps;\n const focusFilterName = visibleFilters.at(deletedIndex);\n\n const itemToFocus =\n this.filtersFocusMap.get(focusFilterName) ?? this.addFilterTrigger.current;\n itemToFocus?.focus();\n }, 20);\n }\n\n getVisibleFilters(allFilters: React.ReactElement<AddFilterItemProps>[]) {\n return this.asProps.visibleFilters.map((name) => {\n return allFilters.find(({ props }) => props.name === name);\n });\n }\n\n getItemCommonProps(props: AddFilterItemProps) {\n const { name } = props;\n const { filterData } = this.asProps;\n\n return {\n name,\n value: filterData[name],\n setFocusRef: (ref: HTMLElement) => {\n this.filtersFocusMap.set(name, ref);\n },\n onClear: () => {\n this.hideFilter(name);\n this.focusFilterAfterItemCleared(name);\n },\n };\n }\n\n getInputProps(props: AddFilterItemProps) {\n return this.getItemCommonProps(props);\n }\n\n getDropdownAndSelectProps(props: AddFilterItemProps, isEmpty: () => boolean) {\n const { setFocusRef, value, onClear } = this.getItemCommonProps(props);\n return {\n value,\n onClear,\n setFocusRef,\n onVisibleChange: (visible: boolean) => {\n // waiting for filterData update\n setTimeout(() => {\n const { onClear } = this.getItemCommonProps(props);\n\n if (!visible && isEmpty()) {\n onClear();\n }\n }, 0);\n },\n };\n }\n\n getSelectProps(props: SelectItemProps) {\n const isEmpty = () => {\n const { multiselect } = props;\n const { value } = this.getItemCommonProps(props);\n return multiselect && Array.isArray(value) ? !value?.length : !value;\n };\n\n return this.getDropdownAndSelectProps(props, isEmpty);\n }\n\n getDropdownProps(props: AddFilterItemProps) {\n const isEmpty = () => {\n const { value } = this.getItemCommonProps(props);\n return value == null;\n };\n return this.getDropdownAndSelectProps(props, isEmpty);\n }\n\n clearAll() {\n this.handlers.visibleFilters([]);\n this.props.onClearAll();\n this.announceClearMessageToSR();\n\n // waiting for AddFilter button appear in the DOM\n setTimeout(() => {\n this.addFilterTrigger.current?.focus();\n }, 20);\n }\n\n announceClearMessageToSR() {\n const { getI18nText } = this.asProps;\n const clearFiltersMessage = getI18nText('AddFilter.ScreenReaderMessage.FiltersCleared');\n this.setState({ clearFiltersMessage });\n\n this.clearMessageTimer = setTimeout(() => {\n this.setState({ clearFiltersMessage: '' });\n }, 300);\n }\n\n toggleFieldVisibility(name: string, status: boolean) {\n const visibleFilters = new Set(this.asProps.visibleFilters);\n if (status) {\n visibleFilters.add(name);\n } else {\n visibleFilters.delete(name);\n }\n\n this.handlers.visibleFilters(Array.from(visibleFilters));\n }\n\n hideFilter(name: string) {\n this.toggleFieldVisibility(name, false);\n }\n\n getFilterSelectionMenuProps() {\n const { getI18nText, visibleFilters } = this.asProps;\n\n return {\n ref: this.addFilterTrigger,\n options: this.addDropdownItems,\n toggleFieldVisibility: (name: string, status: boolean) =>\n this.toggleFieldVisibility(name, status),\n visibleFilters,\n getI18nText,\n };\n }\n\n getClearAllFiltersProps() {\n const { getI18nText, filterData } = this.asProps;\n\n return {\n hasFilterData:\n Object.values(filterData).filter((value) => (Array.isArray(value) ? value?.length : value))\n .length > 0,\n clearAll: () => {\n this.clearAll();\n },\n getI18nText,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n const [filters, persistentFilters] = RootAddFilter.getFilterPatternItems(Children);\n const VisibleFilteredChildren = this.getVisibleFilters(filters);\n\n const filtersSelectionDropdown = this.getFilterSelectionMenuProps();\n const clearAllFiltersProps = this.getClearAllFiltersProps();\n return (\n <Root render={Flex} gap={2} flexWrap>\n {persistentFilters}\n {VisibleFilteredChildren}\n <AddFilterDropdownMenu {...filtersSelectionDropdown} />\n <ClearAllFilters {...clearAllFiltersProps} />\n\n <ScreenReaderOnly aria-live='polite' role='status'>\n {this.state.clearFiltersMessage}\n </ScreenReaderOnly>\n </Root>\n );\n }\n}\n\nconst AddFilterDropdownMenu = React.forwardRef<HTMLButtonElement, AddFilterDropdownMenuProps>(\n function (props, ref) {\n const { options, toggleFieldVisibility, visibleFilters, getI18nText } = props;\n const [visible, setVisible] = React.useState(false);\n\n const optionsWithoutVisible = React.useMemo(() => {\n return options.filter((filter) => {\n return !visibleFilters.includes(filter.value);\n });\n }, [options, visibleFilters]);\n\n if (!optionsWithoutVisible.length) {\n return null;\n }\n\n return (\n <DropdownMenu visible={visible} onVisibleChange={setVisible}>\n <DropdownMenu.Trigger ref={ref} tag={Button} use='tertiary' addonLeft={MathPlusM}>\n {getI18nText('AddFilter.DropdownTrigger.Text')}\n </DropdownMenu.Trigger>\n <DropdownMenu.Menu>\n {optionsWithoutVisible.map(({ label, value }) => (\n <DropdownMenu.Item\n key={value}\n onClick={() => {\n toggleFieldVisibility(value, true);\n setVisible(false);\n }}\n >\n {label}\n </DropdownMenu.Item>\n ))}\n </DropdownMenu.Menu>\n </DropdownMenu>\n );\n },\n);\n\nfunction ClearAllFilters({ hasFilterData, clearAll, getI18nText }: ClearAllFiltersButtonProps) {\n return hasFilterData\n ? (\n <Button use='tertiary' theme='muted' addonLeft={CloseM} ml='auto' onClick={clearAll}>\n {getI18nText('AddFilter.Button.Text')}\n </Button>\n )\n : null;\n}\n\n/**\n * AddFilter\n *\n * {@link https://developer.semrush.com/intergalactic/filter-group/add-filter/add-filter-code|Examples}\n */\nconst AddFilter = createComponent<\n AddFilterType,\n typeof RootAddFilter\n>(RootAddFilter, {\n Select: AddFilterSelect,\n Input: AddFilterInput,\n Dropdown: AddFilterDropdown,\n});\n\nexport default AddFilter;\n"],"mappings":";;;AAAA,SAASA,IAAI,EAAEC,gBAAgB,QAAQ,0BAA0B;AACjE,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,eAAe,QAAQ,eAAe;AAEjF,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,WAAW,QAAQ,uCAAuC;AACnE,OAAOC,YAAY,MAAM,wBAAwB;AACjD,OAAOC,MAAM,MAAM,uBAAuB;AAC1C,OAAOC,SAAS,MAAM,0BAA0B;AAEhD,OAAOC,KAAK,MAAM,OAAO;AAGzB,OAAOC,iBAAiB,MAAM,gCAAgC;AAC9D,OAAOC,cAAc,MAAM,6BAA6B;AACxD,OAAOC,eAAe,MAAM,8BAA8B;AAC1D,SAASC,iBAAiB,QAAQ,gDAAgD;AAsBlF,MAAMC,aAAa,SAASb,SAAS,CAOnC;EA6BAc,WAAWA,CAACC,KAAqB,EAAE;IACjC,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,wCA7BIR,KAAK,CAACS,SAAS,CAAoB,CAAC;IAAAD,eAAA,0BACC,IAAIE,GAAG,CAAC,CAAC;IAAAF,eAAA;IAAAA,eAAA;IA8B/D,IAAI,CAACG,KAAK,GAAG;MACXC,mBAAmB,EAAE;IACvB,CAAC;IAED,IAAI,CAACC,gBAAgB,GAAGR,aAAa,CAACS,4BAA4B,CAACP,KAAK,CAACQ,QAAQ,CAAC;EACpF;EAEAC,iBAAiBA,CAAA,EAAG;IAClB,OAAO;MACLC,cAAc,EAAE;IAClB,CAAC;EACH;EAEAC,oBAAoBA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AM;IACXsE,OAAO,EAAEA,CAAA,KAAM;MACb/C,qBAAqB,CAACvB,KAAK,EAAE,IAAI,CAAC;MAClC0D,UAAU,CAAC,KAAK,CAAC;IACnB;EAAE,GAEDF,KACgB,CACpB,CACgB,CACP,CAAC;AAEnB,CACF,CAAC;AAED,SAASR,eAAeA,CAAC;EAAEhB,aAAa;EAAEf,QAAQ;EAAEI;AAAwC,CAAC,EAAE;EAC7F,OAAOW,aAAa,gBAEd3E,KAAA,CAAAwF,aAAA,CAAClG,MAAM;IAACsH,GAAG,EAAC,UAAU;IAACM,KAAK,EAAC,OAAO;IAACL,SAAS,EAAE/G,MAAO;IAACqH,EAAE,EAAC,MAAM;IAACF,OAAO,EAAErD;EAAS,GACjFI,WAAW,CAAC,uBAAuB,CAC9B,CAAC,GAEX,IAAI;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMoD,SAAS,GAAG7H,eAAe,CAG/Bc,aAAa,EAAE;EACfgH,MAAM,EAAElH,eAAe;EACvBmH,KAAK,EAAEpH,cAAc;EACrBqH,QAAQ,EAAEtH;AACZ,CAAC,CAAC;AAEF,eAAemH,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"AddFilter.js","names":["Flex","ScreenReaderOnly","Button","createComponent","Component","Root","lastInteraction","i18nEnhance","extractFrom","DropdownMenu","CloseM","MathPlusM","React","AddFilterDropdown","AddFilterInput","AddFilterSelect","localizedMessages","RootAddFilter","constructor","props","_defineProperty","createRef","Map","state","clearFiltersMessage","addDropdownItems","getDefaultAddDropdownOptions","children","uncontrolledProps","visibleFilters","componentWillUnmount","clearTimeout","clearMessageTimer","focusFilterAfterItemCleared","name","isKeyboard","asProps","deletedIndex","findIndex","n","setTimeout","focusFilterName","at","itemToFocus","filtersFocusMap","get","addFilterTrigger","current","focus","getVisibleFilters","allFilters","map","find","getItemCommonProps","filterData","value","setFocusRef","ref","set","onClear","hideFilter","getInputProps","getDropdownAndSelectProps","isEmpty","onVisibleChange","visible","getSelectProps","multiselect","Array","isArray","length","getDropdownProps","clearAll","handlers","onClearAll","announceClearMessageToSR","getI18nText","setState","toggleFieldVisibility","status","Set","add","delete","from","getFilterSelectionMenuProps","options","getClearAllFiltersProps","hasFilterData","Object","values","filter","render","_ref","Children","filters","persistentFilters","getFilterPatternItems","VisibleFilteredChildren","filtersSelectionDropdown","createElement","_assignProps","AddFilterDropdownMenu","use","theme","addonLeft","ml","onClick","role","_RootAddFilter","i18n","locale","defaultVisibleFilters","componentsNames","displayName","label","forwardRef","setVisible","useState","optionsWithoutVisible","useMemo","includes","Trigger","tag","Menu","Item","key","AddFilter","Select","Input","Dropdown"],"sources":["../../src/AddFilter.tsx"],"sourcesContent":["import { Flex, ScreenReaderOnly } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, Root, lastInteraction } from '@semcore/core';\nimport type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { extractFrom } from '@semcore/core/lib/utils/findComponent';\nimport DropdownMenu from '@semcore/dropdown-menu';\nimport CloseM from '@semcore/icon/Close/m';\nimport MathPlusM from '@semcore/icon/MathPlus/m';\nimport type { SelectProps } from '@semcore/select';\nimport React from 'react';\n\nimport type { NSAddFilter } from './AddFilter.types';\nimport AddFilterDropdown from './components/AddFilterDropdown';\nimport AddFilterInput from './components/AddFilterInput';\nimport AddFilterSelect from './components/AddFilterSelect';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\n\ntype AddFilterDropdownOption = { label: string; value: string };\ntype AddFilterDropdownMenuProps = {\n options: AddFilterDropdownOption[];\n toggleFieldVisibility: (name: NSAddFilter.Key, status: boolean) => void;\n visibleFilters: NSAddFilter.Key[];\n getI18nText: (key: string) => string;\n};\n\nclass RootAddFilter extends Component<\n Intergalactic.InternalTypings.InferComponentProps<NSAddFilter.Component>,\n typeof RootAddFilter.enhance,\n NSAddFilter.Handlers,\n WithI18nEnhanceProps,\n NSAddFilter.State,\n NSAddFilter.DefaultProps\n> {\n addFilterTrigger = React.createRef<HTMLButtonElement>();\n filtersFocusMap: Map<string | undefined, HTMLElement> = new Map();\n clearMessageTimer: ReturnType<typeof setTimeout> | undefined;\n addDropdownItems: AddFilterDropdownOption[];\n\n static displayName = 'AddFilter';\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n static defaultProps: NSAddFilter.DefaultProps = {\n i18n: localizedMessages,\n locale: 'en',\n defaultVisibleFilters: [],\n };\n\n static componentsNames = ['AddFilter.Input', 'AddFilter.Select', 'AddFilter.Dropdown'];\n static getFilterPatternItems = (children: React.ReactNode) => {\n return extractFrom(children, RootAddFilter.componentsNames);\n };\n\n static getDefaultAddDropdownOptions = (children: React.ReactNode) => {\n const [filters] = RootAddFilter.getFilterPatternItems(children);\n\n return filters.map(({ props }: { props: NSAddFilter.ItemProps }) => {\n const { name, displayName } = props;\n return { label: displayName ?? name, value: name };\n });\n };\n\n constructor(props: NSAddFilter.Props) {\n super(props);\n\n this.state = {\n clearFiltersMessage: '',\n };\n\n this.addDropdownItems = RootAddFilter.getDefaultAddDropdownOptions(props.children);\n }\n\n uncontrolledProps() {\n return {\n visibleFilters: null,\n };\n }\n\n componentWillUnmount() {\n clearTimeout(this.clearMessageTimer);\n }\n\n focusFilterAfterItemCleared(name?: string) {\n if (!lastInteraction.isKeyboard()) {\n return;\n }\n\n const { visibleFilters } = this.asProps;\n const deletedIndex = visibleFilters.findIndex((n) => n === name);\n setTimeout(() => {\n const { visibleFilters } = this.asProps;\n const focusFilterName = visibleFilters.at(deletedIndex);\n\n const itemToFocus =\n this.filtersFocusMap.get(focusFilterName) ?? this.addFilterTrigger.current;\n itemToFocus?.focus();\n }, 20);\n }\n\n getVisibleFilters(allFilters: React.ReactElement<NSAddFilter.ItemProps>[]) {\n return this.asProps.visibleFilters.map((name) => {\n return allFilters.find(({ props }) => props.name === name);\n });\n }\n\n getItemCommonProps(props: NSAddFilter.ItemProps) {\n const { name } = props;\n const { filterData } = this.asProps;\n\n return {\n name,\n value: filterData[name],\n setFocusRef: (ref: HTMLElement) => {\n this.filtersFocusMap.set(name, ref);\n },\n onClear: () => {\n this.hideFilter(name);\n this.focusFilterAfterItemCleared(name);\n },\n };\n }\n\n getInputProps(props: NSAddFilter.ItemProps) {\n return this.getItemCommonProps(props);\n }\n\n getDropdownAndSelectProps(props: NSAddFilter.ItemProps, isEmpty: () => boolean) {\n const { setFocusRef, value, onClear } = this.getItemCommonProps(props);\n return {\n value,\n onClear,\n setFocusRef,\n onVisibleChange: (visible: boolean) => {\n // waiting for filterData update\n setTimeout(() => {\n const { onClear } = this.getItemCommonProps(props);\n\n if (!visible && isEmpty()) {\n onClear();\n }\n }, 0);\n },\n };\n }\n\n getSelectProps(props: NSAddFilter.Select.Props) {\n const isEmpty = () => {\n const { multiselect } = props;\n const { value } = this.getItemCommonProps(props);\n return multiselect && Array.isArray(value) ? !value?.length : !value;\n };\n\n return this.getDropdownAndSelectProps(props, isEmpty);\n }\n\n getDropdownProps(props: NSAddFilter.ItemProps) {\n const isEmpty = () => {\n const { value } = this.getItemCommonProps(props);\n return value == null;\n };\n return this.getDropdownAndSelectProps(props, isEmpty);\n }\n\n clearAll() {\n this.handlers.visibleFilters([]);\n this.props.onClearAll();\n this.announceClearMessageToSR();\n\n // waiting for AddFilter button appear in the DOM\n setTimeout(() => {\n this.addFilterTrigger.current?.focus();\n }, 20);\n }\n\n announceClearMessageToSR() {\n const { getI18nText } = this.asProps;\n const clearFiltersMessage = getI18nText('AddFilter.ScreenReaderMessage.FiltersCleared');\n this.setState({ clearFiltersMessage });\n\n this.clearMessageTimer = setTimeout(() => {\n this.setState({ clearFiltersMessage: '' });\n }, 300);\n }\n\n toggleFieldVisibility(name: string, status: boolean) {\n const visibleFilters = new Set(this.asProps.visibleFilters);\n if (status) {\n visibleFilters.add(name);\n } else {\n visibleFilters.delete(name);\n }\n\n this.handlers.visibleFilters(Array.from(visibleFilters));\n }\n\n hideFilter(name: string) {\n this.toggleFieldVisibility(name, false);\n }\n\n getFilterSelectionMenuProps() {\n const { getI18nText, visibleFilters } = this.asProps;\n\n return {\n ref: this.addFilterTrigger,\n options: this.addDropdownItems,\n toggleFieldVisibility: (name: string, status: boolean) =>\n this.toggleFieldVisibility(name, status),\n visibleFilters,\n getI18nText,\n };\n }\n\n getClearAllFiltersProps() {\n const { getI18nText, filterData } = this.asProps;\n\n return {\n hasFilterData:\n Object.values(filterData).filter((value) => (Array.isArray(value) ? value?.length : value))\n .length > 0,\n clearAll: () => {\n this.clearAll();\n },\n getI18nText,\n };\n }\n\n render() {\n const { Children, filterData, getI18nText } = this.asProps;\n const [filters, persistentFilters] = RootAddFilter.getFilterPatternItems(Children);\n const VisibleFilteredChildren = this.getVisibleFilters(filters);\n\n const filtersSelectionDropdown = this.getFilterSelectionMenuProps();\n const hasFilterData = Object.values(filterData).filter((value) => (Array.isArray(value) ? value?.length : value)).length > 0;\n\n return (\n <Root render={Flex} gap={2} flexWrap>\n {persistentFilters}\n {VisibleFilteredChildren}\n <AddFilterDropdownMenu {...filtersSelectionDropdown} />\n {hasFilterData && (\n <Button use='tertiary' theme='muted' addonLeft={CloseM} ml='auto' onClick={() => this.clearAll()}>\n {getI18nText('AddFilter.Button.Text')}\n </Button>\n )}\n\n <ScreenReaderOnly aria-live='polite' role='status'>\n {this.state.clearFiltersMessage}\n </ScreenReaderOnly>\n </Root>\n );\n }\n}\n\nconst AddFilterDropdownMenu = React.forwardRef<HTMLButtonElement, AddFilterDropdownMenuProps>(\n function (props, ref) {\n const { options, toggleFieldVisibility, visibleFilters, getI18nText } = props;\n const [visible, setVisible] = React.useState(false);\n\n const optionsWithoutVisible = React.useMemo(() => {\n return options.filter((filter) => {\n return !visibleFilters.includes(filter.value);\n });\n }, [options, visibleFilters]);\n\n if (!optionsWithoutVisible.length) {\n return null;\n }\n\n return (\n <DropdownMenu visible={visible} onVisibleChange={setVisible}>\n <DropdownMenu.Trigger ref={ref} tag={Button} use='tertiary' addonLeft={MathPlusM}>\n {getI18nText('AddFilter.DropdownTrigger.Text')}\n </DropdownMenu.Trigger>\n <DropdownMenu.Menu>\n {optionsWithoutVisible.map(({ label, value }) => (\n <DropdownMenu.Item\n key={value}\n onClick={() => {\n toggleFieldVisibility(value, true);\n setVisible(false);\n }}\n >\n {label}\n </DropdownMenu.Item>\n ))}\n </DropdownMenu.Menu>\n </DropdownMenu>\n );\n },\n);\n\nexport type RootAddFilterType = typeof RootAddFilter;\n\n/**\n * AddFilter\n *\n * {@link https://developer.semrush.com/intergalactic/filter-group/add-filter/add-filter-code|Examples}\n */\nconst AddFilter = createComponent<\n NSAddFilter.Component,\n RootAddFilterType\n>(RootAddFilter, {\n Select: AddFilterSelect,\n Input: AddFilterInput,\n Dropdown: AddFilterDropdown,\n});\n\nexport default AddFilter;\n"],"mappings":";;;AAAA,SAASA,IAAI,EAAEC,gBAAgB,QAAQ,0BAA0B;AACjE,OAAOC,MAAM,MAAM,iBAAiB;AAEpC,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,eAAe,QAAQ,eAAe;AAEjF,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,WAAW,QAAQ,uCAAuC;AACnE,OAAOC,YAAY,MAAM,wBAAwB;AACjD,OAAOC,MAAM,MAAM,uBAAuB;AAC1C,OAAOC,SAAS,MAAM,0BAA0B;AAEhD,OAAOC,KAAK,MAAM,OAAO;AAGzB,OAAOC,iBAAiB,MAAM,gCAAgC;AAC9D,OAAOC,cAAc,MAAM,6BAA6B;AACxD,OAAOC,eAAe,MAAM,8BAA8B;AAC1D,SAASC,iBAAiB,QAAQ,gDAAgD;AAUlF,MAAMC,aAAa,SAASb,SAAS,CAOnC;EA6BAc,WAAWA,CAACC,KAAwB,EAAE;IACpC,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,wCA7BIR,KAAK,CAACS,SAAS,CAAoB,CAAC;IAAAD,eAAA,0BACC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AAC;IAC/C,CAAC,CAAC;EACJ,CAAC,EAAE,CAAC8B,OAAO,EAAExD,cAAc,CAAC,CAAC;EAE7B,IAAI,CAACyF,qBAAqB,CAAChD,MAAM,EAAE;IACjC,OAAO,IAAI;EACb;EAEA,oBACE1D,KAAA,CAAAuF,aAAA,CAAC1F,YAAY;IAACwD,OAAO,EAAEA,OAAQ;IAACD,eAAe,EAAEoD;EAAW,gBAC1DxG,KAAA,CAAAuF,aAAA,CAAC1F,YAAY,CAACgH,OAAO;IAAChE,GAAG,EAAEA,GAAI;IAACiE,GAAG,EAAExH,MAAO;IAACoG,GAAG,EAAC,UAAU;IAACE,SAAS,EAAE7F;EAAU,GAC9EiE,WAAW,CAAC,gCAAgC,CACzB,CAAC,eACvBhE,KAAA,CAAAuF,aAAA,CAAC1F,YAAY,CAACkH,IAAI,QACfL,qBAAqB,CAACnE,GAAG,CAAC,CAAC;IAAE+D,KAAK;IAAE3D;EAAM,CAAC,kBAC1C3C,KAAA,CAAAuF,aAAA,CAAC1F,YAAY,CAACmH,IAAI;IAChBC,GAAG,EAAEtE,KAAM;IACXmD,OAAO,EAAEA,CAAA,KAAM;MACb5B,qBAAqB,CAACvB,KAAK,EAAE,IAAI,CAAC;MAClC6D,UAAU,CAAC,KAAK,CAAC;IACnB;EAAE,GAEDF,KACgB,CACpB,CACgB,CACP,CAAC;AAEnB,CACF,CAAC;AAID;AACA;AACA;AACA;AACA;AACA,MAAMY,SAAS,GAAG3H,eAAe,CAG/Bc,aAAa,EAAE;EACf8G,MAAM,EAAEhH,eAAe;EACvBiH,KAAK,EAAElH,cAAc;EACrBmH,QAAQ,EAAEpH;AACZ,CAAC,CAAC;AAEF,eAAeiH,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddFilter.types.js","names":[],"sources":["../../src/AddFilter.types.ts"],"sourcesContent":["import type { FlexProps } from '@semcore/base-components';\nimport type { FilterTrigger } from '@semcore/base-trigger';\nimport type { ButtonLink } from '@semcore/button';\nimport type { Intergalactic } from '@semcore/core';\nimport type Dropdown from '@semcore/dropdown';\nimport type { DropdownTriggerProps } from '@semcore/dropdown';\nimport type Input from '@semcore/input';\nimport type Select from '@semcore/select';\n\nimport type { LocalizedMessages } from './translations/__intergalactic-dynamic-locales';\n\
|
|
1
|
+
{"version":3,"file":"AddFilter.types.js","names":[],"sources":["../../src/AddFilter.types.ts"],"sourcesContent":["import type { FlexProps } from '@semcore/base-components';\nimport type { FilterTrigger } from '@semcore/base-trigger';\nimport type { ButtonLink } from '@semcore/button';\nimport type { Intergalactic } from '@semcore/core';\nimport type Dropdown from '@semcore/dropdown';\nimport type { DropdownTriggerProps } from '@semcore/dropdown';\nimport type Input from '@semcore/input';\nimport type Select from '@semcore/select';\nimport type { SelectProps } from '@semcore/select';\n\nimport type { LocalizedMessages } from './translations/__intergalactic-dynamic-locales';\n\ndeclare namespace NSAddFilter {\n type Key = string;\n type Data = Record<string, any>;\n type Props = FlexProps & {\n /**\n * Action to perform on `Clear filters` button click.\n */\n onClearAll: () => void;\n /**\n * `FilterData` object.\n */\n filterData: NSAddFilter.Data;\n /**\n * List of visible filters keys. Relative to the `name` in AddFilterItemProps.\n */\n visibleFilters?: NSAddFilter.Key[];\n /**\n * Callback for handle changes in visible filters.\n */\n onVisibleFiltersChange?: (visibleFilters: NSAddFilter.Key[]) => void;\n };\n type DefaultProps = {\n i18n: LocalizedMessages;\n locale: 'en';\n defaultVisibleFilters: Props['visibleFilters'];\n };\n type State = {\n clearFiltersMessage: string;\n };\n type Handlers = {\n visibleFilters: null;\n };\n type ItemProps = {\n /**\n * Non-persistent filter item unique `name`. Should be the same as related `key` in `FilterData` item related to Filter Control.\n */\n name: NSAddFilter.Key;\n /**\n * Optional `displayName` to be displayed inside `Add filter` dropdown menu. If not specified, `name` will be used instead.\n */\n displayName?: string;\n /**\n * Action to perform on filter item unmount.\n */\n onUnmount?: () => void;\n\n /**\n * @inner\n */\n visible?: boolean;\n };\n\n namespace Select {\n type Props = SelectProps & ItemProps;\n\n type DefaultProps = {\n defaultVisible: false;\n };\n type Handlers = {\n visible: null;\n };\n\n namespace Trigger {\n type Component = typeof FilterTrigger;\n }\n\n namespace Popper {\n type Component = Intergalactic.Component<typeof Select.Popper, {}, { onApply: () => void }>;\n }\n\n namespace Option {\n type Component = typeof Select.Option;\n }\n\n namespace Menu {\n type Component = typeof Select.Menu;\n }\n\n namespace List {\n type Component = typeof Select.List;\n }\n\n namespace InputSearch {\n type Component = typeof Select.InputSearch;\n }\n\n type Component = Intergalactic.Component<typeof Select, Props> & {\n Trigger: Trigger.Component;\n Popper: Popper.Component;\n Option: Option.Component;\n Menu: Menu.Component;\n List: List.Component;\n InputSearch: InputSearch.Component;\n };\n }\n\n namespace Input {\n namespace Addon {\n type Component = typeof Input.Addon;\n }\n\n namespace Value {\n type Component = typeof Input.Value;\n }\n\n namespace Clear {\n type Component = typeof ButtonLink;\n }\n\n type Component = Intergalactic.Component<typeof Input, NSAddFilter.ItemProps> & {\n Addon: Addon.Component;\n Value: Value.Component;\n Clear: Clear.Component;\n };\n }\n\n namespace Dropdown {\n type DefaultProps = {\n defaultVisible: false;\n };\n type Handlers = {\n visible: null;\n };\n namespace Trigger {\n type Component = Intergalactic.Component<typeof Dropdown.Trigger, DropdownTriggerProps & { onClear: () => void }>;\n }\n\n namespace Popper {\n type Component = Intergalactic.Component<typeof Dropdown.Popper, {}, { onApply: () => void }>;\n }\n\n type Component = Intergalactic.Component<typeof Dropdown, NSAddFilter.ItemProps> & {\n Trigger: Trigger.Component;\n Popper: Popper.Component;\n };\n }\n\n type Component = Intergalactic.Component<'div', Props> & {\n Dropdown: Dropdown.Component;\n Input: Input.Component;\n Select: Select.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type AddFilterKey = NSAddFilter.Key;\n/** @deprecated It will be removed in v18. */\nexport type AddFilterItemProps = NSAddFilter.ItemProps;\n/** @deprecated It will be removed in v18. */\ndeclare const AddFilterSelectType: NSAddFilter.Select.Component;\n/** @deprecated It will be removed in v18. */\ndeclare const AddFilterInputType: NSAddFilter.Input.Component;\n/** @deprecated It will be removed in v18. */\ndeclare const AddFilterDropdownType: NSAddFilter.Dropdown.Component;\n/** @deprecated It will be removed in v18. */\nexport type FilterData = NSAddFilter.Data;\n/** @deprecated It will be removed in v18. */\nexport type AddFilterProps = NSAddFilter.Props;\n/** @deprecated It will be removed in v18. */\nexport type AddFilterDefaultProps = NSAddFilter.DefaultProps;\n/** @deprecated It will be removed in v18. */\nexport type AddFilterType = NSAddFilter.Component;\n\nexport { AddFilterInputType, AddFilterSelectType, AddFilterDropdownType };\nexport type { NSAddFilter };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddFilterDropdown.js","names":["FilterTrigger","createComponent","Component","Root","Dropdown","React","AddFilterDropdownRoot","componentDidMount","props","visible","undefined","setTimeout","handlers","uncontrolledProps","componentWillUnmount","asProps","onUnmount","getTriggerProps","value","onClear","setFocusRef","tag","triggerRef","empty","autoFocus","getPopperProps","onKeyDown","e","key","onApply","render","_ref","createElement","_assignProps","_defineProperty","defaultVisible","AddFilterDropdown","Trigger","Popper"],"sources":["../../../src/components/AddFilterDropdown.tsx"],"sourcesContent":["import { FilterTrigger } from '@semcore/base-trigger';\nimport { createComponent, Component, Root } from '@semcore/core';\nimport Dropdown from '@semcore/dropdown';\nimport React from 'react';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"AddFilterDropdown.js","names":["FilterTrigger","createComponent","Component","Root","Dropdown","React","AddFilterDropdownRoot","componentDidMount","props","visible","undefined","setTimeout","handlers","uncontrolledProps","componentWillUnmount","asProps","onUnmount","getTriggerProps","value","onClear","setFocusRef","tag","triggerRef","empty","autoFocus","getPopperProps","onKeyDown","e","key","onApply","render","_ref","createElement","_assignProps","_defineProperty","defaultVisible","AddFilterDropdown","Trigger","Popper"],"sources":["../../../src/components/AddFilterDropdown.tsx"],"sourcesContent":["import { FilterTrigger } from '@semcore/base-trigger';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, Root } from '@semcore/core';\nimport Dropdown from '@semcore/dropdown';\nimport React from 'react';\n\nimport type { RootAddFilterType } from '../AddFilter';\nimport type { NSAddFilter } from '../AddFilter.types';\n\nclass AddFilterDropdownRoot extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<NSAddFilter.Dropdown.Component, RootAddFilterType, 'Dropdown'>,\n [],\n NSAddFilter.Dropdown.Handlers,\n {},\n {},\n NSAddFilter.Dropdown.DefaultProps\n> {\n static displayName = 'AddFilterDropdown';\n\n static defaultProps = {\n defaultVisible: false,\n } as const;\n\n componentDidMount() {\n if (this.props.visible === undefined) {\n setTimeout(() => {\n this.handlers.visible(true);\n }, 0);\n }\n }\n\n uncontrolledProps() {\n return {\n visible: null,\n };\n }\n\n componentWillUnmount() {\n this.asProps.onUnmount?.();\n }\n\n getTriggerProps() {\n const { value, onClear, setFocusRef } = this.asProps;\n\n return {\n tag: FilterTrigger,\n triggerRef: setFocusRef,\n empty: value == null,\n onClear,\n autoFocus: true,\n };\n }\n\n getPopperProps() {\n const { value, onClear } = this.asProps;\n\n return {\n onKeyDown: (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (!value && e.key === 'Escape') {\n onClear();\n }\n },\n onApply: () => {\n this.handlers.visible(false);\n },\n };\n }\n\n render() {\n return <Root render={Dropdown} />;\n }\n}\n\nconst AddFilterDropdown = createComponent<\n NSAddFilter.Dropdown.Component,\n typeof AddFilterDropdownRoot\n>(AddFilterDropdownRoot, {\n Trigger: Dropdown.Trigger,\n Popper: Dropdown.Popper,\n});\n\nexport default AddFilterDropdown;\n"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,uBAAuB;AAErD,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,QAAQ,eAAe;AAChE,OAAOC,QAAQ,MAAM,mBAAmB;AACxC,OAAOC,KAAK,MAAM,OAAO;AAKzB,MAAMC,qBAAqB,SAASJ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C5B,qBAAqB,kBAUH;EACpB6B,cAAc,EAAE;AAClB,CAAC;AAoDH,MAAMC,iBAAiB,GAAGnC,eAAe,CAGvCK,qBAAqB,EAAE;EACvB+B,OAAO,EAAEjC,QAAQ,CAACiC,OAAO;EACzBC,MAAM,EAAElC,QAAQ,CAACkC;AACnB,CAAC,CAAC;AAEF,eAAeF,iBAAiB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddFilterInput.js","names":["ButtonLink","createComponent","Component","Root","Input","React","AddFilterInputRoot","componentWillUnmount","asProps","onUnmount","getValueProps","props","value","onClear","setFocusRef","ref","onBlur","setTimeout","onKeyDown","e","key","autoFocus","getClearProps","onClick","render","_ref","createElement","_assignProps","_defineProperty","Clear","_ref2","arguments[0]","_assignProps2","AddFilterInput","Value","Addon"],"sources":["../../../src/components/AddFilterInput.tsx"],"sourcesContent":["import { ButtonLink } from '@semcore/button';\nimport { createComponent, Component, Root } from '@semcore/core';\nimport Input from '@semcore/input';\nimport type {
|
|
1
|
+
{"version":3,"file":"AddFilterInput.js","names":["ButtonLink","createComponent","Component","Root","Input","React","AddFilterInputRoot","componentWillUnmount","asProps","onUnmount","getValueProps","props","value","onClear","setFocusRef","ref","onBlur","setTimeout","onKeyDown","e","key","autoFocus","getClearProps","onClick","render","_ref","createElement","_assignProps","_defineProperty","Clear","_ref2","arguments[0]","_assignProps2","AddFilterInput","Value","Addon"],"sources":["../../../src/components/AddFilterInput.tsx"],"sourcesContent":["import { ButtonLink } from '@semcore/button';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, Root } from '@semcore/core';\nimport Input from '@semcore/input';\nimport type { NSInput } from '@semcore/input';\nimport React from 'react';\n\nimport type { RootAddFilterType } from '../AddFilter';\nimport type { NSAddFilter } from '../AddFilter.types';\nclass AddFilterInputRoot extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<NSAddFilter.Input.Component, RootAddFilterType, 'Input'>\n> {\n static displayName = 'AddFilterInput';\n\n componentWillUnmount() {\n this.asProps.onUnmount?.();\n }\n\n getValueProps(props: NSInput.Value.Props) {\n const { value, onClear, setFocusRef } = this.asProps;\n\n return {\n ...props,\n ref: setFocusRef,\n onBlur: () => {\n if (!value) {\n setTimeout(onClear, 200);\n }\n },\n onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (!value && e.key === 'Escape') {\n onClear();\n }\n },\n autoFocus: true,\n };\n }\n\n getClearProps() {\n const { onClear } = this.asProps;\n\n return {\n onClick: onClear,\n };\n }\n\n render() {\n return <Root render={Input} w='auto' inline={false} />;\n }\n}\n\nfunction Clear() {\n return <Root render={ButtonLink} />;\n}\n\nconst AddFilterInput = createComponent<\n NSAddFilter.Input.Component,\n typeof AddFilterInputRoot\n>(AddFilterInputRoot, {\n Value: Input.Value,\n Addon: Input.Addon,\n Clear,\n});\n\nexport default AddFilterInput;\n"],"mappings":";;;AAAA,SAASA,UAAU,QAAQ,iBAAiB;AAE5C,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,QAAQ,eAAe;AAChE,OAAOC,KAAK,MAAM,gBAAgB;AAElC,OAAOC,KAAK,MAAM,OAAO;AAIzB,MAAMC,kBAAkB,SAASJ,SAAS,CAExC;EAGAK,oBAAoBA,CAAA,EAAG;IACrB,IAAI,CAACC,OAAO,CAACC,SAAS,GAAG,CAAC;EAC5B;EAEAC,aAAaA,CAACC,KAA0B,EAAE;IACxC,MAAM;MAAEC,KAAK;MAAEC,OAAO;MAAEC;IAAY,CAAC,GAAG,IAAI,CAACN,OAAO;IAEpD,OAAO;MACL,GAAGG,KAAK;MACRI,GAAG,EAAED,WAAW;MAChBE,MAAM,EAAEA,CAAA,KAAM;QACZ,IAAI,CAACJ,KAAK,EAAE;UACVK,UAAU,CAACJ,OAAO,EAAE,GAAG,CAAC;QAC1B;MACF,CAAC;MACDK,SAAS,EAAGC,CAAwC,IAAK;QACvD,IAAI,CAACP,KAAK,IAAIO,CAAC,CAACC,GAAG,KAAK,QAAQ,EAAE;UAChCP,OAAO,CAAC,CAAC;QACX;MACF,CAAC;MACDQ,SAAS,EAAE;IACb,CAAC;EACH;EAEAC,aAAaA,CAAA,EAAG;IACd,MAAM;MAAET;IAAQ,CAAC,GAAG,IAAI,CAACL,OAAO;IAEhC,OAAO;MACLe,OAAO,EAAEV;IACX,CAAC;EACH;EAEAW,MAAMA,CAAA,EAAG;IAAA,IAAAC,IAAA,QAAAjB,OAAA;IACP,oBAAOH,KAAA,CAAAqB,aAAA,CAActB,KAAK,EAAAuB,YAAA;MAAA,KAAI,MAAM;MAAA,UAAS;IAAK,GAAAF,IAAA,CAAG,CAAC;EACxD;AACF;AAACG,eAAA,CAxCKtB,kBAAkB,iBAGD,gBAAgB;AAuCvC,SAASuB,KAAKA,CAAA,EAAG;EAAA,IAAAC,KAAA,GAAAC,YAAA;EACf,oBAAO1B,KAAA,CAAAqB,aAAA,CAAc1B,UAAU,EAAAgC,aAAA,KAAAF,KAAA,CAAG,CAAC;AACrC;AAEA,MAAMG,cAAc,GAAGhC,eAAe,CAGpCK,kBAAkB,EAAE;EACpB4B,KAAK,EAAE9B,KAAK,CAAC8B,KAAK;EAClBC,KAAK,EAAE/B,KAAK,CAAC+B,KAAK;EAClBN;AACF,CAAC,CAAC;AAEF,eAAeI,cAAc","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddFilterSelect.js","names":["FilterTrigger","createComponent","Component","Root","Select","React","AddFilterSelectRoot","componentDidMount","props","visible","undefined","setTimeout","handlers","componentWillUnmount","asProps","onUnmount","uncontrolledProps","isValueEmpty","value","multiselect","Array","isArray","length","getTriggerProps","onClear","setFocusRef","tag","triggerRef","onKeyDown","e","key","empty","autoFocus","getPopperProps","onApply","render","_ref","createElement","_assignProps","_defineProperty","defaultVisible","AddFilterSelect","Trigger","Menu","Option","Checkbox","List","Popper","InputSearch"],"sources":["../../../src/components/AddFilterSelect.tsx"],"sourcesContent":["import { FilterTrigger } from '@semcore/base-trigger';\nimport { createComponent, Component, Root } from '@semcore/core';\nimport
|
|
1
|
+
{"version":3,"file":"AddFilterSelect.js","names":["FilterTrigger","createComponent","Component","Root","Select","React","AddFilterSelectRoot","componentDidMount","props","visible","undefined","setTimeout","handlers","componentWillUnmount","asProps","onUnmount","uncontrolledProps","isValueEmpty","value","multiselect","Array","isArray","length","getTriggerProps","onClear","setFocusRef","tag","triggerRef","onKeyDown","e","key","empty","autoFocus","getPopperProps","onApply","render","_ref","createElement","_assignProps","_defineProperty","defaultVisible","AddFilterSelect","Trigger","Menu","Option","Checkbox","List","Popper","InputSearch"],"sources":["../../../src/components/AddFilterSelect.tsx"],"sourcesContent":["import { FilterTrigger } from '@semcore/base-trigger';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, Root } from '@semcore/core';\nimport type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport Select from '@semcore/select';\nimport React from 'react';\n\nimport type { RootAddFilterType } from '../AddFilter';\nimport type { NSAddFilter } from '../AddFilter.types';\n\nclass AddFilterSelectRoot extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<NSAddFilter.Select.Component, RootAddFilterType, 'Select'>,\n [],\n NSAddFilter.Select.Handlers,\n WithI18nEnhanceProps,\n {},\n NSAddFilter.Select.DefaultProps\n> {\n static displayName = 'AddFilterSelect';\n\n static defaultProps = {\n defaultVisible: false,\n } as const;\n\n componentDidMount() {\n if (this.props.visible === undefined) {\n setTimeout(() => {\n this.handlers.visible(true);\n }, 0);\n }\n }\n\n componentWillUnmount() {\n this.asProps.onUnmount?.();\n }\n\n uncontrolledProps() {\n return {\n visible: null,\n };\n }\n\n isValueEmpty() {\n const { value, multiselect } = this.asProps;\n return multiselect && Array.isArray(value) ? !value?.length : !value;\n }\n\n getTriggerProps() {\n const { onClear, setFocusRef } = this.asProps;\n\n return {\n tag: FilterTrigger,\n triggerRef: setFocusRef,\n onKeyDown: (e: React.KeyboardEvent<HTMLImageElement>) => {\n if (this.isValueEmpty() && e.key === 'Escape') {\n onClear();\n }\n },\n empty: this.isValueEmpty(),\n onClear,\n autoFocus: true,\n };\n }\n\n getPopperProps() {\n return {\n onApply: () => {\n this.handlers.visible(false);\n },\n };\n }\n\n render() {\n return <Root render={Select} />;\n }\n}\n\nconst AddFilterSelect = createComponent<\n NSAddFilter.Select.Component,\n typeof AddFilterSelectRoot\n>(AddFilterSelectRoot, {\n Trigger: Select.Trigger,\n Menu: Select.Menu,\n Option: [\n Select.Option,\n {\n Checkbox: Select.Option.Checkbox,\n },\n ],\n List: Select.List,\n Popper: Select.Popper,\n InputSearch: Select.InputSearch,\n});\n\nexport default AddFilterSelect;\n"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,uBAAuB;AAErD,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,QAAQ,eAAe;AAEhE,OAAOC,MAAM,MAAM,iBAAiB;AACpC,OAAOC,KAAK,MAAM,OAAO;AAKzB,MAAMC,mBAAmB,SAASJ,SAAS,CAOzC;EAOAK,iBAAiBA,CAAA,EAAG;IAClB,IAAI,IAAI,CAACC,KAAK,CAACC,OAAO,KAAKC,SAAS,EAAE;MACpCC,UAAU,CAAC,MAAM;QACf,IAAI,CAACC,QAAQ,CAACH,OAAO,CAAC,IAAI,CAAC;MAC7B,CAAC,EAAE,CAAC,CAAC;IACP;EACF;EAEAI,oBAAoBA,CAAA,EAAG;IACrB,IAAI,CAACC,OAAO,CAACC,SAAS,GAAG,CAAC;EAC5B;EAEAC,iBAAiBA,CAAA,EAAG;IAClB,OAAO;MACLP,OAAO,EAAE;IACX,CAAC;EACH;EAEAQ,YAAYA,CAAA,EAAG;IACb,MAAM;MAAEC,KAAK;MAAEC;IAAY,CAAC,GAAG,IAAI,CAACL,OAAO;IAC3C,OAAOK,WAAW,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,GAAG,CAACA,KAAK,EAAEI,MAAM,GAAG,CAACJ,KAAK;EACtE;EAEAK,eA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AEF,eAAeP,eAAe","ignoreList":[]}
|
package/lib/es6/index.js
CHANGED
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.ts"],"sourcesContent":["export { default } from './AddFilter';\nexport * from './AddFilter
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.ts"],"sourcesContent":["export { default } from './AddFilter';\nexport * from './AddFilter.types';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,aAAa;AACrC,cAAc,mBAAmB","ignoreList":[]}
|
package/lib/esm/AddFilter.mjs
CHANGED
|
@@ -185,16 +185,24 @@ class RootAddFilter extends Component {
|
|
|
185
185
|
render() {
|
|
186
186
|
var _ref = this.asProps;
|
|
187
187
|
const {
|
|
188
|
-
Children
|
|
188
|
+
Children,
|
|
189
|
+
filterData,
|
|
190
|
+
getI18nText
|
|
189
191
|
} = this.asProps;
|
|
190
192
|
const [filters, persistentFilters] = RootAddFilter.getFilterPatternItems(Children);
|
|
191
193
|
const VisibleFilteredChildren = this.getVisibleFilters(filters);
|
|
192
194
|
const filtersSelectionDropdown = this.getFilterSelectionMenuProps();
|
|
193
|
-
const
|
|
195
|
+
const hasFilterData = Object.values(filterData).filter((value) => Array.isArray(value) ? value?.length : value).length > 0;
|
|
194
196
|
return /* @__PURE__ */ React.createElement(Flex, assignProps({
|
|
195
197
|
"gap": 2,
|
|
196
198
|
"flexWrap": true
|
|
197
|
-
}, _ref), persistentFilters, VisibleFilteredChildren, /* @__PURE__ */ React.createElement(AddFilterDropdownMenu, filtersSelectionDropdown),
|
|
199
|
+
}, _ref), persistentFilters, VisibleFilteredChildren, /* @__PURE__ */ React.createElement(AddFilterDropdownMenu, filtersSelectionDropdown), hasFilterData && /* @__PURE__ */ React.createElement(Button, {
|
|
200
|
+
use: "tertiary",
|
|
201
|
+
theme: "muted",
|
|
202
|
+
addonLeft: CloseM,
|
|
203
|
+
ml: "auto",
|
|
204
|
+
onClick: () => this.clearAll()
|
|
205
|
+
}, getI18nText("AddFilter.Button.Text")), /* @__PURE__ */ React.createElement(ScreenReaderOnly, {
|
|
198
206
|
"aria-live": "polite",
|
|
199
207
|
role: "status"
|
|
200
208
|
}, this.state.clearFiltersMessage));
|
|
@@ -262,19 +270,6 @@ const AddFilterDropdownMenu = /* @__PURE__ */ React.forwardRef(function(props, r
|
|
|
262
270
|
}
|
|
263
271
|
}, label))));
|
|
264
272
|
});
|
|
265
|
-
function ClearAllFilters({
|
|
266
|
-
hasFilterData,
|
|
267
|
-
clearAll,
|
|
268
|
-
getI18nText
|
|
269
|
-
}) {
|
|
270
|
-
return hasFilterData ? /* @__PURE__ */ React.createElement(Button, {
|
|
271
|
-
use: "tertiary",
|
|
272
|
-
theme: "muted",
|
|
273
|
-
addonLeft: CloseM,
|
|
274
|
-
ml: "auto",
|
|
275
|
-
onClick: clearAll
|
|
276
|
-
}, getI18nText("AddFilter.Button.Text")) : null;
|
|
277
|
-
}
|
|
278
273
|
const AddFilter = createComponent(RootAddFilter, {
|
|
279
274
|
Select: AddFilterSelect,
|
|
280
275
|
Input: AddFilterInput,
|
package/lib/types/AddFilter.d.ts
CHANGED
|
@@ -1,8 +1,96 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Intergalactic } from '@semcore/core';
|
|
2
|
+
import { Component } from '@semcore/core';
|
|
3
|
+
import type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type { NSAddFilter } from './AddFilter.types';
|
|
6
|
+
type AddFilterDropdownOption = {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
declare class RootAddFilter extends Component<Intergalactic.InternalTypings.InferComponentProps<NSAddFilter.Component>, typeof RootAddFilter.enhance, NSAddFilter.Handlers, WithI18nEnhanceProps, NSAddFilter.State, NSAddFilter.DefaultProps> {
|
|
11
|
+
addFilterTrigger: React.RefObject<HTMLButtonElement>;
|
|
12
|
+
filtersFocusMap: Map<string | undefined, HTMLElement>;
|
|
13
|
+
clearMessageTimer: ReturnType<typeof setTimeout> | undefined;
|
|
14
|
+
addDropdownItems: AddFilterDropdownOption[];
|
|
15
|
+
static displayName: string;
|
|
16
|
+
static enhance: readonly [(props: any) => {
|
|
17
|
+
getI18nText: ReturnType<(dictionary: import("@semcore/core/lib/utils/enhances/WithI18n").Dictionary, locale?: import("@semcore/core/lib/utils/enhances/WithI18n").LocaleKeys, fallbackDictionary?: import("@semcore/core/lib/utils/enhances/WithI18n").Dictionary) => (messageId: string, variables?: {
|
|
18
|
+
[key: string]: string | number | undefined;
|
|
19
|
+
}) => string>;
|
|
20
|
+
}];
|
|
21
|
+
static defaultProps: NSAddFilter.DefaultProps;
|
|
22
|
+
static componentsNames: string[];
|
|
23
|
+
static getFilterPatternItems: (children: React.ReactNode) => (React.ReactElement<any, string | React.JSXElementConstructor<any>> & {
|
|
24
|
+
ref?: React.MutableRefObject<HTMLElement>;
|
|
25
|
+
})[][];
|
|
26
|
+
static getDefaultAddDropdownOptions: (children: React.ReactNode) => {
|
|
27
|
+
label: string;
|
|
28
|
+
value: string;
|
|
29
|
+
}[];
|
|
30
|
+
constructor(props: NSAddFilter.Props);
|
|
31
|
+
uncontrolledProps(): {
|
|
32
|
+
visibleFilters: null;
|
|
33
|
+
};
|
|
34
|
+
componentWillUnmount(): void;
|
|
35
|
+
focusFilterAfterItemCleared(name?: string): void;
|
|
36
|
+
getVisibleFilters(allFilters: React.ReactElement<NSAddFilter.ItemProps>[]): (React.ReactElement<NSAddFilter.ItemProps, string | React.JSXElementConstructor<any>> | undefined)[];
|
|
37
|
+
getItemCommonProps(props: NSAddFilter.ItemProps): {
|
|
38
|
+
name: string;
|
|
39
|
+
value: any;
|
|
40
|
+
setFocusRef: (ref: HTMLElement) => void;
|
|
41
|
+
onClear: () => void;
|
|
42
|
+
};
|
|
43
|
+
getInputProps(props: NSAddFilter.ItemProps): {
|
|
44
|
+
name: string;
|
|
45
|
+
value: any;
|
|
46
|
+
setFocusRef: (ref: HTMLElement) => void;
|
|
47
|
+
onClear: () => void;
|
|
48
|
+
};
|
|
49
|
+
getDropdownAndSelectProps(props: NSAddFilter.ItemProps, isEmpty: () => boolean): {
|
|
50
|
+
value: any;
|
|
51
|
+
onClear: () => void;
|
|
52
|
+
setFocusRef: (ref: HTMLElement) => void;
|
|
53
|
+
onVisibleChange: (visible: boolean) => void;
|
|
54
|
+
};
|
|
55
|
+
getSelectProps(props: NSAddFilter.Select.Props): {
|
|
56
|
+
value: any;
|
|
57
|
+
onClear: () => void;
|
|
58
|
+
setFocusRef: (ref: HTMLElement) => void;
|
|
59
|
+
onVisibleChange: (visible: boolean) => void;
|
|
60
|
+
};
|
|
61
|
+
getDropdownProps(props: NSAddFilter.ItemProps): {
|
|
62
|
+
value: any;
|
|
63
|
+
onClear: () => void;
|
|
64
|
+
setFocusRef: (ref: HTMLElement) => void;
|
|
65
|
+
onVisibleChange: (visible: boolean) => void;
|
|
66
|
+
};
|
|
67
|
+
clearAll(): void;
|
|
68
|
+
announceClearMessageToSR(): void;
|
|
69
|
+
toggleFieldVisibility(name: string, status: boolean): void;
|
|
70
|
+
hideFilter(name: string): void;
|
|
71
|
+
getFilterSelectionMenuProps(): {
|
|
72
|
+
ref: React.RefObject<HTMLButtonElement>;
|
|
73
|
+
options: AddFilterDropdownOption[];
|
|
74
|
+
toggleFieldVisibility: (name: string, status: boolean) => void;
|
|
75
|
+
visibleFilters: string[];
|
|
76
|
+
getI18nText: ((messageId: string, variables?: {
|
|
77
|
+
[key: string]: string | number | undefined;
|
|
78
|
+
}) => string) & ((key?: string, variables?: {}) => any);
|
|
79
|
+
};
|
|
80
|
+
getClearAllFiltersProps(): {
|
|
81
|
+
hasFilterData: boolean;
|
|
82
|
+
clearAll: () => void;
|
|
83
|
+
getI18nText: ((messageId: string, variables?: {
|
|
84
|
+
[key: string]: string | number | undefined;
|
|
85
|
+
}) => string) & ((key?: string, variables?: {}) => any);
|
|
86
|
+
};
|
|
87
|
+
render(): React.JSX.Element;
|
|
88
|
+
}
|
|
89
|
+
export type RootAddFilterType = typeof RootAddFilter;
|
|
2
90
|
/**
|
|
3
91
|
* AddFilter
|
|
4
92
|
*
|
|
5
93
|
* {@link https://developer.semrush.com/intergalactic/filter-group/add-filter/add-filter-code|Examples}
|
|
6
94
|
*/
|
|
7
|
-
declare const AddFilter:
|
|
95
|
+
declare const AddFilter: NSAddFilter.Component;
|
|
8
96
|
export default AddFilter;
|
|
@@ -6,76 +6,156 @@ import type Dropdown from '@semcore/dropdown';
|
|
|
6
6
|
import type { DropdownTriggerProps } from '@semcore/dropdown';
|
|
7
7
|
import type Input from '@semcore/input';
|
|
8
8
|
import type Select from '@semcore/select';
|
|
9
|
+
import type { SelectProps } from '@semcore/select';
|
|
9
10
|
import type { LocalizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
11
|
+
declare namespace NSAddFilter {
|
|
12
|
+
type Key = string;
|
|
13
|
+
type Data = Record<string, any>;
|
|
14
|
+
type Props = FlexProps & {
|
|
15
|
+
/**
|
|
16
|
+
* Action to perform on `Clear filters` button click.
|
|
17
|
+
*/
|
|
18
|
+
onClearAll: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* `FilterData` object.
|
|
21
|
+
*/
|
|
22
|
+
filterData: NSAddFilter.Data;
|
|
23
|
+
/**
|
|
24
|
+
* List of visible filters keys. Relative to the `name` in AddFilterItemProps.
|
|
25
|
+
*/
|
|
26
|
+
visibleFilters?: NSAddFilter.Key[];
|
|
27
|
+
/**
|
|
28
|
+
* Callback for handle changes in visible filters.
|
|
29
|
+
*/
|
|
30
|
+
onVisibleFiltersChange?: (visibleFilters: NSAddFilter.Key[]) => void;
|
|
31
|
+
};
|
|
32
|
+
type DefaultProps = {
|
|
33
|
+
i18n: LocalizedMessages;
|
|
34
|
+
locale: 'en';
|
|
35
|
+
defaultVisibleFilters: Props['visibleFilters'];
|
|
36
|
+
};
|
|
37
|
+
type State = {
|
|
38
|
+
clearFiltersMessage: string;
|
|
39
|
+
};
|
|
40
|
+
type Handlers = {
|
|
41
|
+
visibleFilters: null;
|
|
42
|
+
};
|
|
43
|
+
type ItemProps = {
|
|
44
|
+
/**
|
|
45
|
+
* Non-persistent filter item unique `name`. Should be the same as related `key` in `FilterData` item related to Filter Control.
|
|
46
|
+
*/
|
|
47
|
+
name: NSAddFilter.Key;
|
|
48
|
+
/**
|
|
49
|
+
* Optional `displayName` to be displayed inside `Add filter` dropdown menu. If not specified, `name` will be used instead.
|
|
50
|
+
*/
|
|
51
|
+
displayName?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Action to perform on filter item unmount.
|
|
54
|
+
*/
|
|
55
|
+
onUnmount?: () => void;
|
|
56
|
+
/**
|
|
57
|
+
* @inner
|
|
58
|
+
*/
|
|
59
|
+
visible?: boolean;
|
|
60
|
+
};
|
|
61
|
+
namespace Select {
|
|
62
|
+
type Props = SelectProps & ItemProps;
|
|
63
|
+
type DefaultProps = {
|
|
64
|
+
defaultVisible: false;
|
|
65
|
+
};
|
|
66
|
+
type Handlers = {
|
|
67
|
+
visible: null;
|
|
68
|
+
};
|
|
69
|
+
namespace Trigger {
|
|
70
|
+
type Component = typeof FilterTrigger;
|
|
71
|
+
}
|
|
72
|
+
namespace Popper {
|
|
73
|
+
type Component = Intergalactic.Component<typeof Select.Popper, {}, {
|
|
74
|
+
onApply: () => void;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
namespace Option {
|
|
78
|
+
type Component = typeof Select.Option;
|
|
79
|
+
}
|
|
80
|
+
namespace Menu {
|
|
81
|
+
type Component = typeof Select.Menu;
|
|
82
|
+
}
|
|
83
|
+
namespace List {
|
|
84
|
+
type Component = typeof Select.List;
|
|
85
|
+
}
|
|
86
|
+
namespace InputSearch {
|
|
87
|
+
type Component = typeof Select.InputSearch;
|
|
88
|
+
}
|
|
89
|
+
type Component = Intergalactic.Component<typeof Select, Props> & {
|
|
90
|
+
Trigger: Trigger.Component;
|
|
91
|
+
Popper: Popper.Component;
|
|
92
|
+
Option: Option.Component;
|
|
93
|
+
Menu: Menu.Component;
|
|
94
|
+
List: List.Component;
|
|
95
|
+
InputSearch: InputSearch.Component;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
namespace Input {
|
|
99
|
+
namespace Addon {
|
|
100
|
+
type Component = typeof Input.Addon;
|
|
101
|
+
}
|
|
102
|
+
namespace Value {
|
|
103
|
+
type Component = typeof Input.Value;
|
|
104
|
+
}
|
|
105
|
+
namespace Clear {
|
|
106
|
+
type Component = typeof ButtonLink;
|
|
107
|
+
}
|
|
108
|
+
type Component = Intergalactic.Component<typeof Input, NSAddFilter.ItemProps> & {
|
|
109
|
+
Addon: Addon.Component;
|
|
110
|
+
Value: Value.Component;
|
|
111
|
+
Clear: Clear.Component;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
namespace Dropdown {
|
|
115
|
+
type DefaultProps = {
|
|
116
|
+
defaultVisible: false;
|
|
117
|
+
};
|
|
118
|
+
type Handlers = {
|
|
119
|
+
visible: null;
|
|
120
|
+
};
|
|
121
|
+
namespace Trigger {
|
|
122
|
+
type Component = Intergalactic.Component<typeof Dropdown.Trigger, DropdownTriggerProps & {
|
|
123
|
+
onClear: () => void;
|
|
124
|
+
}>;
|
|
125
|
+
}
|
|
126
|
+
namespace Popper {
|
|
127
|
+
type Component = Intergalactic.Component<typeof Dropdown.Popper, {}, {
|
|
128
|
+
onApply: () => void;
|
|
129
|
+
}>;
|
|
130
|
+
}
|
|
131
|
+
type Component = Intergalactic.Component<typeof Dropdown, NSAddFilter.ItemProps> & {
|
|
132
|
+
Trigger: Trigger.Component;
|
|
133
|
+
Popper: Popper.Component;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
type Component = Intergalactic.Component<'div', Props> & {
|
|
137
|
+
Dropdown: Dropdown.Component;
|
|
138
|
+
Input: Input.Component;
|
|
139
|
+
Select: Select.Component;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/** @deprecated It will be removed in v18. */
|
|
143
|
+
export type AddFilterKey = NSAddFilter.Key;
|
|
144
|
+
/** @deprecated It will be removed in v18. */
|
|
145
|
+
export type AddFilterItemProps = NSAddFilter.ItemProps;
|
|
146
|
+
/** @deprecated It will be removed in v18. */
|
|
147
|
+
declare const AddFilterSelectType: NSAddFilter.Select.Component;
|
|
148
|
+
/** @deprecated It will be removed in v18. */
|
|
149
|
+
declare const AddFilterInputType: NSAddFilter.Input.Component;
|
|
150
|
+
/** @deprecated It will be removed in v18. */
|
|
151
|
+
declare const AddFilterDropdownType: NSAddFilter.Dropdown.Component;
|
|
152
|
+
/** @deprecated It will be removed in v18. */
|
|
153
|
+
export type FilterData = NSAddFilter.Data;
|
|
154
|
+
/** @deprecated It will be removed in v18. */
|
|
155
|
+
export type AddFilterProps = NSAddFilter.Props;
|
|
156
|
+
/** @deprecated It will be removed in v18. */
|
|
157
|
+
export type AddFilterDefaultProps = NSAddFilter.DefaultProps;
|
|
158
|
+
/** @deprecated It will be removed in v18. */
|
|
159
|
+
export type AddFilterType = NSAddFilter.Component;
|
|
81
160
|
export { AddFilterInputType, AddFilterSelectType, AddFilterDropdownType };
|
|
161
|
+
export type { NSAddFilter };
|
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
declare const AddFilterDropdown: (<Tag extends import("@semcore/core").Intergalactic.InternalTypings.ComponentTag | [import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = (<Tag_1 extends import("@semcore/core").Intergalactic.InternalTypings.ComponentTag | [import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = "div", Props_1 extends import("@semcore/dropdown").DropdownProps = import("@semcore/dropdown").DropdownProps>(props: import("@semcore/core").Intergalactic.InternalTypings.ComponentProps<Tag_1, "div", Props_1, import("@semcore/dropdown").DropdownContext, [handlers: import("@semcore/base-components").PopperHandlers]>) => import("@semcore/core").Intergalactic.InternalTypings.ComponentRenderingResults) & import("@semcore/core").Intergalactic.InternalTypings.ComponentAdditive<"div", import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, import("@semcore/dropdown").DropdownProps, import("@semcore/dropdown").DropdownContext, [handlers: import("@semcore/base-components").PopperHandlers]> & {
|
|
4
|
-
Trigger: import("@semcore/core").Intergalactic.Component<"div", import("@semcore/base-components").PopperTriggerProps, import("@semcore/base-components").PopperContext, [handlers: import("@semcore/base-components").PopperHandlers]>;
|
|
5
|
-
Popper: import("@semcore/core").Intergalactic.Component<"div", import("@semcore/dropdown").DropdownPopperProps, import("@semcore/base-components").PopperContext, [handlers: import("@semcore/base-components").PopperHandlers]>;
|
|
6
|
-
Item: import("@semcore/core").Intergalactic.Component<(<Tag_1 extends import("@semcore/core").Intergalactic.InternalTypings.ComponentTag | [import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = "div", Props_1 extends import("@semcore/base-components").BoxProps = import("@semcore/base-components").BoxProps>(props: import("@semcore/core").Intergalactic.InternalTypings.ComponentProps<Tag_1, "div", Props_1, {}, never[]>) => import("@semcore/core").Intergalactic.InternalTypings.ComponentRenderingResults) & import("@semcore/core").Intergalactic.InternalTypings.ComponentAdditive<"div", import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, import("@semcore/base-components").BoxProps, {}, never[]>>;
|
|
7
|
-
Group: import("@semcore/core").Intergalactic.Component<"div", import("@semcore/dropdown").DropdownGroupProps>;
|
|
8
|
-
StatusItem: import("@semcore/dropdown").StatusItemComponent;
|
|
9
|
-
}, Props extends AddFilterItemProps = AddFilterItemProps>(props: import("@semcore/core").Intergalactic.InternalTypings.ComponentProps<Tag, (<Tag_1 extends import("@semcore/core").Intergalactic.InternalTypings.ComponentTag | [import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = "div", Props_1 extends import("@semcore/dropdown").DropdownProps = import("@semcore/dropdown").DropdownProps>(props: import("@semcore/core").Intergalactic.InternalTypings.ComponentProps<Tag_1, "div", Props_1, import("@semcore/dropdown").DropdownContext, [handlers: import("@semcore/base-components").PopperHandlers]>) => import("@semcore/core").Intergalactic.InternalTypings.ComponentRenderingResults) & import("@semcore/core").Intergalactic.InternalTypings.ComponentAdditive<"div", import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, import("@semcore/dropdown").DropdownProps, import("@semcore/dropdown").DropdownContext, [handlers: import("@semcore/base-components").PopperHandlers]> & {
|
|
10
|
-
Trigger: import("@semcore/core").Intergalactic.Component<"div", import("@semcore/base-components").PopperTriggerProps, import("@semcore/base-components").PopperContext, [handlers: import("@semcore/base-components").PopperHandlers]>;
|
|
11
|
-
Popper: import("@semcore/core").Intergalactic.Component<"div", import("@semcore/dropdown").DropdownPopperProps, import("@semcore/base-components").PopperContext, [handlers: import("@semcore/base-components").PopperHandlers]>;
|
|
12
|
-
Item: import("@semcore/core").Intergalactic.Component<(<Tag_1 extends import("@semcore/core").Intergalactic.InternalTypings.ComponentTag | [import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = "div", Props_1 extends import("@semcore/base-components").BoxProps = import("@semcore/base-components").BoxProps>(props: import("@semcore/core").Intergalactic.InternalTypings.ComponentProps<Tag_1, "div", Props_1, {}, never[]>) => import("@semcore/core").Intergalactic.InternalTypings.ComponentRenderingResults) & import("@semcore/core").Intergalactic.InternalTypings.ComponentAdditive<"div", import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, import("@semcore/base-components").BoxProps, {}, never[]>>;
|
|
13
|
-
Group: import("@semcore/core").Intergalactic.Component<"div", import("@semcore/dropdown").DropdownGroupProps>;
|
|
14
|
-
StatusItem: import("@semcore/dropdown").StatusItemComponent;
|
|
15
|
-
}, Props, {}, never[]>) => import("@semcore/core").Intergalactic.InternalTypings.ComponentRenderingResults) & import("@semcore/core").Intergalactic.InternalTypings.ComponentAdditive<(<Tag extends import("@semcore/core").Intergalactic.InternalTypings.ComponentTag | [import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = "div", Props extends import("@semcore/dropdown").DropdownProps = import("@semcore/dropdown").DropdownProps>(props: import("@semcore/core").Intergalactic.InternalTypings.ComponentProps<Tag, "div", Props, import("@semcore/dropdown").DropdownContext, [handlers: import("@semcore/base-components").PopperHandlers]>) => import("@semcore/core").Intergalactic.InternalTypings.ComponentRenderingResults) & import("@semcore/core").Intergalactic.InternalTypings.ComponentAdditive<"div", import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, import("@semcore/dropdown").DropdownProps, import("@semcore/dropdown").DropdownContext, [handlers: import("@semcore/base-components").PopperHandlers]> & {
|
|
16
|
-
Trigger: import("@semcore/core").Intergalactic.Component<"div", import("@semcore/base-components").PopperTriggerProps, import("@semcore/base-components").PopperContext, [handlers: import("@semcore/base-components").PopperHandlers]>;
|
|
17
|
-
Popper: import("@semcore/core").Intergalactic.Component<"div", import("@semcore/dropdown").DropdownPopperProps, import("@semcore/base-components").PopperContext, [handlers: import("@semcore/base-components").PopperHandlers]>;
|
|
18
|
-
Item: import("@semcore/core").Intergalactic.Component<(<Tag extends import("@semcore/core").Intergalactic.InternalTypings.ComponentTag | [import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = "div", Props extends import("@semcore/base-components").BoxProps = import("@semcore/base-components").BoxProps>(props: import("@semcore/core").Intergalactic.InternalTypings.ComponentProps<Tag, "div", Props, {}, never[]>) => import("@semcore/core").Intergalactic.InternalTypings.ComponentRenderingResults) & import("@semcore/core").Intergalactic.InternalTypings.ComponentAdditive<"div", import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, import("@semcore/base-components").BoxProps, {}, never[]>>;
|
|
19
|
-
Group: import("@semcore/core").Intergalactic.Component<"div", import("@semcore/dropdown").DropdownGroupProps>;
|
|
20
|
-
StatusItem: import("@semcore/dropdown").StatusItemComponent;
|
|
21
|
-
}, import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, AddFilterItemProps, {}, never[]> & {
|
|
22
|
-
Trigger: import("@semcore/core").Intergalactic.Component<typeof Dropdown.Trigger, import("@semcore/dropdown").DropdownTriggerProps & {
|
|
23
|
-
onClear: () => void;
|
|
24
|
-
}>;
|
|
25
|
-
Popper: import("@semcore/core").Intergalactic.Component<typeof Dropdown.Popper, {}, {
|
|
26
|
-
onApply: () => void;
|
|
27
|
-
}>;
|
|
28
|
-
};
|
|
1
|
+
import type { NSAddFilter } from '../AddFilter.types';
|
|
2
|
+
declare const AddFilterDropdown: NSAddFilter.Dropdown.Component;
|
|
29
3
|
export default AddFilterDropdown;
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import type { InputValueProps } from '@semcore/input';
|
|
4
|
-
import type { AddFilterItemProps } from '../AddFilter.types';
|
|
5
|
-
declare const AddFilterInput: (<Tag extends import("@semcore/core").Intergalactic.InternalTypings.ComponentTag | [import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = (<Tag_1 extends import("@semcore/core").Intergalactic.InternalTypings.ComponentTag | [import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = "div", Props_1 extends import("@semcore/input").InputProps = import("@semcore/input").InputProps>(props: import("@semcore/core").Intergalactic.InternalTypings.ComponentProps<Tag_1, "div", Props_1, import("@semcore/input").InputCtx, never[]>) => import("@semcore/core").Intergalactic.InternalTypings.ComponentRenderingResults) & import("@semcore/core").Intergalactic.InternalTypings.ComponentAdditive<"div", import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, import("@semcore/input").InputProps, import("@semcore/input").InputCtx, never[]> & {
|
|
6
|
-
Value: import("@semcore/core").Intergalactic.Component<"input", InputValueProps>;
|
|
7
|
-
Addon: import("@semcore/core").Intergalactic.Component<"div", import("@semcore/input").InputAddonProps>;
|
|
8
|
-
}, Props extends AddFilterItemProps = AddFilterItemProps>(props: import("@semcore/core").Intergalactic.InternalTypings.ComponentProps<Tag, (<Tag_1 extends import("@semcore/core").Intergalactic.InternalTypings.ComponentTag | [import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = "div", Props_1 extends import("@semcore/input").InputProps = import("@semcore/input").InputProps>(props: import("@semcore/core").Intergalactic.InternalTypings.ComponentProps<Tag_1, "div", Props_1, import("@semcore/input").InputCtx, never[]>) => import("@semcore/core").Intergalactic.InternalTypings.ComponentRenderingResults) & import("@semcore/core").Intergalactic.InternalTypings.ComponentAdditive<"div", import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, import("@semcore/input").InputProps, import("@semcore/input").InputCtx, never[]> & {
|
|
9
|
-
Value: import("@semcore/core").Intergalactic.Component<"input", InputValueProps>;
|
|
10
|
-
Addon: import("@semcore/core").Intergalactic.Component<"div", import("@semcore/input").InputAddonProps>;
|
|
11
|
-
}, Props, {}, never[]>) => import("@semcore/core").Intergalactic.InternalTypings.ComponentRenderingResults) & import("@semcore/core").Intergalactic.InternalTypings.ComponentAdditive<(<Tag extends import("@semcore/core").Intergalactic.InternalTypings.ComponentTag | [import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = "div", Props extends import("@semcore/input").InputProps = import("@semcore/input").InputProps>(props: import("@semcore/core").Intergalactic.InternalTypings.ComponentProps<Tag, "div", Props, import("@semcore/input").InputCtx, never[]>) => import("@semcore/core").Intergalactic.InternalTypings.ComponentRenderingResults) & import("@semcore/core").Intergalactic.InternalTypings.ComponentAdditive<"div", import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, import("@semcore/input").InputProps, import("@semcore/input").InputCtx, never[]> & {
|
|
12
|
-
Value: import("@semcore/core").Intergalactic.Component<"input", InputValueProps>;
|
|
13
|
-
Addon: import("@semcore/core").Intergalactic.Component<"div", import("@semcore/input").InputAddonProps>;
|
|
14
|
-
}, import("@semcore/core").Intergalactic.InternalTypings.ComponentTag, AddFilterItemProps, {}, never[]> & {
|
|
15
|
-
Addon: typeof Input.Addon;
|
|
16
|
-
Value: typeof Input.Value;
|
|
17
|
-
Clear: typeof ButtonLink;
|
|
18
|
-
};
|
|
1
|
+
import type { NSAddFilter } from '../AddFilter.types';
|
|
2
|
+
declare const AddFilterInput: NSAddFilter.Input.Component;
|
|
19
3
|
export default AddFilterInput;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const AddFilterSelect:
|
|
1
|
+
import type { NSAddFilter } from '../AddFilter.types';
|
|
2
|
+
declare const AddFilterSelect: NSAddFilter.Select.Component;
|
|
3
3
|
export default AddFilterSelect;
|
package/lib/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/add-filter",
|
|
3
3
|
"description": "Semrush Add Filter component",
|
|
4
|
-
"version": "17.2.1",
|
|
4
|
+
"version": "17.2.2-prerelease.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"require": "./lib/cjs/index.js"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/select": "^17.
|
|
17
|
+
"@semcore/select": "^17.4.0-prerelease.1",
|
|
18
18
|
"@semcore/button": "^17.2.1",
|
|
19
|
-
"@semcore/dropdown-menu": "^17.3.
|
|
19
|
+
"@semcore/dropdown-menu": "^17.3.1-prerelease.1",
|
|
20
20
|
"@semcore/dropdown": "^17.3.0",
|
|
21
|
-
"@semcore/input": "^17.2.1",
|
|
21
|
+
"@semcore/input": "^17.2.2-prerelease.1",
|
|
22
22
|
"@semcore/base-trigger": "^17.2.1"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|