@chayns-components/core 5.2.8-alpha.0 → 5.2.8
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/lib/cjs/components/combobox/ComboBox.constants.js +15 -0
- package/lib/cjs/components/combobox/ComboBox.constants.js.map +1 -0
- package/lib/cjs/components/combobox/ComboBox.js +27 -76
- package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.styles.js +16 -11
- package/lib/cjs/components/combobox/ComboBox.styles.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.types.js +24 -0
- package/lib/cjs/components/combobox/ComboBox.types.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.utils.js +88 -0
- package/lib/cjs/components/combobox/ComboBox.utils.js.map +1 -0
- package/lib/cjs/components/filter/filter-content/FilterContent.constants.js +8 -0
- package/lib/cjs/components/filter/filter-content/FilterContent.constants.js.map +1 -0
- package/lib/cjs/components/filter/filter-content/FilterContent.js +6 -27
- package/lib/cjs/components/filter/filter-content/FilterContent.js.map +1 -1
- package/lib/cjs/components/filter/filter-content/FilterContent.styles.js +10 -24
- package/lib/cjs/components/filter/filter-content/FilterContent.styles.js.map +1 -1
- package/lib/cjs/components/filter/filter-content/FilterContent.types.js +6 -0
- package/lib/cjs/components/filter/filter-content/FilterContent.types.js.map +1 -0
- package/lib/cjs/components/filter/filter-content/FilterContent.utils.js +17 -0
- package/lib/cjs/components/filter/filter-content/FilterContent.utils.js.map +1 -0
- package/lib/cjs/components/skeleton/base-skeleton/BaseSkeleton.styles.js +0 -2
- package/lib/cjs/components/skeleton/base-skeleton/BaseSkeleton.styles.js.map +1 -1
- package/lib/cjs/types/filter.js +24 -0
- package/lib/cjs/types/filter.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.constants.js +9 -0
- package/lib/esm/components/combobox/ComboBox.constants.js.map +1 -0
- package/lib/esm/components/combobox/ComboBox.js +27 -75
- package/lib/esm/components/combobox/ComboBox.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.styles.js +16 -11
- package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.types.js +29 -0
- package/lib/esm/components/combobox/ComboBox.types.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.utils.js +81 -0
- package/lib/esm/components/combobox/ComboBox.utils.js.map +1 -0
- package/lib/esm/components/filter/filter-content/FilterContent.constants.js +2 -0
- package/lib/esm/components/filter/filter-content/FilterContent.constants.js.map +1 -0
- package/lib/esm/components/filter/filter-content/FilterContent.js +8 -29
- package/lib/esm/components/filter/filter-content/FilterContent.js.map +1 -1
- package/lib/esm/components/filter/filter-content/FilterContent.styles.js +9 -23
- package/lib/esm/components/filter/filter-content/FilterContent.styles.js.map +1 -1
- package/lib/esm/components/filter/filter-content/FilterContent.types.js +2 -0
- package/lib/esm/components/filter/filter-content/FilterContent.types.js.map +1 -0
- package/lib/esm/components/filter/filter-content/FilterContent.utils.js +10 -0
- package/lib/esm/components/filter/filter-content/FilterContent.utils.js.map +1 -0
- package/lib/esm/components/skeleton/base-skeleton/BaseSkeleton.styles.js +0 -2
- package/lib/esm/components/skeleton/base-skeleton/BaseSkeleton.styles.js.map +1 -1
- package/lib/esm/types/filter.js +31 -0
- package/lib/esm/types/filter.js.map +1 -1
- package/lib/types/components/combobox/ComboBox.constants.d.ts +8 -0
- package/lib/types/components/combobox/ComboBox.styles.d.ts +4 -8
- package/lib/types/components/combobox/ComboBox.types.d.ts +102 -0
- package/lib/types/components/combobox/ComboBox.utils.d.ts +23 -0
- package/lib/types/components/filter/filter-content/FilterContent.constants.d.ts +1 -0
- package/lib/types/components/filter/filter-content/FilterContent.d.ts +1 -9
- package/lib/types/components/filter/filter-content/FilterContent.styles.d.ts +3 -14
- package/lib/types/components/filter/filter-content/FilterContent.types.d.ts +30 -0
- package/lib/types/components/filter/filter-content/FilterContent.utils.d.ts +3 -0
- package/lib/types/types/filter.d.ts +51 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterContent.js","names":["React","useCallback","useEffect","useMemo","useRef","useState","StyledFilterComboboxInline","StyledFilterComboboxInlineComboboxWrapper","StyledFilterComboboxInlineLabel","StyledFilterComboboxWrapper","StyledFilterContent","StyledFilterSort","StyledFilterSortText","Input","Icon","FilterButtons","ComboBox","Checkbox","Textstring","TextstringProvider","ttsToITextString","textStrings","FilterContent","searchConfig","sortConfig","filterButtonConfig","checkboxConfig","comboboxConfig","shouldAutoFocus","sortTextRef","searchRef","sortTextWidth","setSortTextWidth","ts","components","filter","filterContent","handleSelectSortItem","item","text","value","onSortChange","id","current","clientWidth","focus","createElement","libraryName","ref","onChange","ev","onSearchChange","target","placeholder","textstring","input","searchValue","shouldShowClearIcon","length","leftElement","icons","sort","$textWidth","lists","list","items","map","selectedItem","onSelect","label","_extends","shouldUseCurrentItemWidth","displayName"],"sources":["../../../../../src/components/filter/filter-content/FilterContent.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n StyledFilterComboboxInline,\n StyledFilterComboboxInlineComboboxWrapper,\n StyledFilterComboboxInlineLabel,\n StyledFilterComboboxWrapper,\n StyledFilterContent,\n StyledFilterSort,\n StyledFilterSortText,\n} from './FilterContent.styles';\nimport Input, { InputRef } from '../../input/Input';\nimport Icon from '../../icon/Icon';\nimport FilterButtons from '../../filter-buttons/FilterButtons';\nimport {\n CheckboxConfig,\n ComboboxConfig,\n FilterButtonConfig,\n SearchConfig,\n SortConfig,\n} from '../../../types/filter';\nimport ComboBox from '../../combobox/ComboBox';\nimport Checkbox from '../../checkbox/Checkbox';\nimport { IComboBoxItem } from '../../combobox/ComboBox.types';\nimport { Textstring, TextstringProvider, ttsToITextString } from '@chayns-components/textstring';\nimport textStrings from '../../../constants/textStrings';\n\nexport type FilterContentProps = {\n searchConfig?: SearchConfig;\n filterButtonConfig?: FilterButtonConfig;\n sortConfig?: SortConfig;\n checkboxConfig?: CheckboxConfig;\n comboboxConfig?: ComboboxConfig;\n shouldAutoFocus: boolean;\n};\n\nconst FilterContent: FC<FilterContentProps> = ({\n searchConfig,\n sortConfig,\n filterButtonConfig,\n checkboxConfig,\n comboboxConfig,\n shouldAutoFocus,\n}) => {\n const sortTextRef = useRef<HTMLDivElement>(null);\n const searchRef = useRef<InputRef>(null);\n\n const [sortTextWidth, setSortTextWidth] = useState(0);\n\n const ts = textStrings.components.filter.filterContent;\n\n const handleSelectSortItem = useCallback(\n (item: IComboBoxItem | undefined) => {\n if (!item) {\n return;\n }\n\n const { text, value } = item;\n\n if (sortConfig) {\n sortConfig.onSortChange({ text, id: value });\n }\n },\n [sortConfig],\n );\n\n useEffect(() => {\n if (sortTextRef.current) {\n setSortTextWidth(sortTextRef.current.clientWidth + 20);\n }\n }, []);\n\n useEffect(() => {\n if (shouldAutoFocus) {\n searchRef.current?.focus();\n }\n }, [shouldAutoFocus]);\n\n return useMemo(\n () => (\n <TextstringProvider libraryName=\"@chayns-components-core\">\n <StyledFilterContent>\n {searchConfig && (\n <Input\n ref={searchRef}\n onChange={(ev) => searchConfig.onSearchChange(ev.target.value)}\n placeholder={\n <Textstring textstring={ttsToITextString(ts.input.placeholder)} />\n }\n value={searchConfig.searchValue}\n shouldShowClearIcon={searchConfig.searchValue.length > 0}\n leftElement={<Icon icons={['fa fa-search']} />}\n />\n )}\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n {filterButtonConfig && <FilterButtons {...filterButtonConfig} />}\n {sortConfig && (\n <StyledFilterSort>\n <StyledFilterSortText ref={sortTextRef}>\n <Textstring textstring={ttsToITextString(ts.sort)} />\n </StyledFilterSortText>\n <StyledFilterComboboxWrapper $textWidth={sortTextWidth}>\n <ComboBox\n lists={[\n {\n list: sortConfig.items.map(({ text, id }) => ({\n text,\n value: id,\n })),\n },\n ]}\n placeholder=\"\"\n selectedItem={{\n text: sortConfig.selectedItem.text,\n value: sortConfig.selectedItem.id,\n }}\n onSelect={handleSelectSortItem}\n />\n </StyledFilterComboboxWrapper>\n </StyledFilterSort>\n )}\n {comboboxConfig && (\n <StyledFilterComboboxInline>\n <StyledFilterComboboxInlineLabel>\n {comboboxConfig.label}\n </StyledFilterComboboxInlineLabel>\n <StyledFilterComboboxInlineComboboxWrapper>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <ComboBox shouldUseCurrentItemWidth {...comboboxConfig} />\n </StyledFilterComboboxInlineComboboxWrapper>\n </StyledFilterComboboxInline>\n )}\n {checkboxConfig && (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <Checkbox {...checkboxConfig} />\n )}\n </StyledFilterContent>\n </TextstringProvider>\n ),\n [\n checkboxConfig,\n comboboxConfig,\n filterButtonConfig,\n handleSelectSortItem,\n searchConfig,\n sortConfig,\n sortTextWidth,\n ts.input.placeholder,\n ts.sort,\n ],\n );\n};\n\nFilterContent.displayName = 'FilterContent';\n\nexport default FilterContent;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAQC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACpF,SACIC,0BAA0B,EAC1BC,yCAAyC,EACzCC,+BAA+B,EAC/BC,2BAA2B,EAC3BC,mBAAmB,EACnBC,gBAAgB,EAChBC,oBAAoB,QACjB,wBAAwB;AAC/B,OAAOC,KAAK,MAAoB,mBAAmB;AACnD,OAAOC,IAAI,MAAM,iBAAiB;AAClC,OAAOC,aAAa,MAAM,oCAAoC;AAQ9D,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,OAAOC,QAAQ,MAAM,yBAAyB;AAE9C,SAASC,UAAU,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ,+BAA+B;AAChG,OAAOC,WAAW,MAAM,gCAAgC;AAWxD,MAAMC,aAAqC,GAAGA,CAAC;EAC3CC,YAAY;EACZC,UAAU;EACVC,kBAAkB;EAClBC,cAAc;EACdC,cAAc;EACdC;AACJ,CAAC,KA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3B,KAAA,CAAA8C,aAAA,CAACxC,0BAA0B,qBACvBN,KAAA,CAAA8C,aAAA,CAACtC,+BAA+B,QAC3BmB,cAAc,CAAC0C,KACa,CAAC,eAClCrE,KAAA,CAAA8C,aAAA,CAACvC,yCAAyC,qBAEtCP,KAAA,CAAA8C,aAAA,CAAC9B,QAAQ,EAAAsD,QAAA;IAACC,yBAAyB;EAAA,GAAK5C,cAAc,CAAG,CAClB,CACnB,CAC/B,EACAD,cAAc;EAAA;EACX;EACA1B,KAAA,CAAA8C,aAAA,CAAC7B,QAAQ,EAAKS,cAAiB,CAElB,CACL,CACvB,EACD,CACIA,cAAc,EACdC,cAAc,EACdF,kBAAkB,EAClBY,oBAAoB,EACpBd,YAAY,EACZC,UAAU,EACVO,aAAa,EACbE,EAAE,CAACsB,KAAK,CAACF,WAAW,EACpBpB,EAAE,CAAC4B,IAAI,CAEf,CAAC;AACL,CAAC;AAEDvC,aAAa,CAACkD,WAAW,GAAG,eAAe;AAE3C,eAAelD,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FilterContent.js","names":["React","useCallback","useEffect","useMemo","useRef","StyledFilterContentControlWrapper","StyledFilterContentLabel","StyledFilterContentLabeledRow","StyledFilterContent","Input","Icon","FilterButtons","ComboBox","Checkbox","Textstring","TextstringProvider","ttsToITextString","textStrings","getSortComboBoxLists","FilterContent","searchConfig","sortConfig","filterButtonConfig","checkboxConfig","comboboxConfig","shouldAutoFocus","searchRef","ts","components","filter","filterContent","handleSelectSortItem","item","text","value","onSortChange","id","current","focus","createElement","libraryName","ref","onChange","ev","onSearchChange","target","placeholder","textstring","input","searchValue","shouldShowClearIcon","length","leftElement","icons","sort","lists","selectedItem","onSelect","label","displayName"],"sources":["../../../../../src/components/filter/filter-content/FilterContent.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useMemo, useRef } from 'react';\nimport {\n StyledFilterContentControlWrapper,\n StyledFilterContentLabel,\n StyledFilterContentLabeledRow,\n StyledFilterContent,\n} from './FilterContent.styles';\nimport Input, { InputRef } from '../../input/Input';\nimport Icon from '../../icon/Icon';\nimport FilterButtons from '../../filter-buttons/FilterButtons';\nimport ComboBox from '../../combobox/ComboBox';\nimport Checkbox from '../../checkbox/Checkbox';\nimport { Textstring, TextstringProvider, ttsToITextString } from '@chayns-components/textstring';\nimport textStrings from '../../../constants/textStrings';\nimport type { IComboBoxItem } from '../../combobox/ComboBox.types';\nimport type { FilterContentProps } from './FilterContent.types';\nimport { getSortComboBoxLists } from './FilterContent.utils';\n\nconst FilterContent: FC<FilterContentProps> = ({\n searchConfig,\n sortConfig,\n filterButtonConfig,\n checkboxConfig,\n comboboxConfig,\n shouldAutoFocus,\n}) => {\n const searchRef = useRef<InputRef>(null);\n\n const ts = textStrings.components.filter.filterContent;\n\n const handleSelectSortItem = useCallback(\n (item: IComboBoxItem | undefined) => {\n if (!item) {\n return;\n }\n\n const { text, value } = item;\n\n if (sortConfig) {\n sortConfig.onSortChange({ text, id: value });\n }\n },\n [sortConfig],\n );\n\n useEffect(() => {\n if (shouldAutoFocus) {\n searchRef.current?.focus();\n }\n }, [shouldAutoFocus]);\n\n return useMemo(\n () => (\n <TextstringProvider libraryName=\"@chayns-components-core\">\n <StyledFilterContent>\n {searchConfig && (\n <Input\n ref={searchRef}\n onChange={(ev) => searchConfig.onSearchChange(ev.target.value)}\n placeholder={\n <Textstring textstring={ttsToITextString(ts.input.placeholder)} />\n }\n value={searchConfig.searchValue}\n shouldShowClearIcon={searchConfig.searchValue.length > 0}\n leftElement={<Icon icons={['fa fa-search']} />}\n />\n )}\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n {filterButtonConfig && <FilterButtons {...filterButtonConfig} />}\n {sortConfig && (\n <StyledFilterContentLabeledRow>\n <StyledFilterContentLabel>\n <Textstring textstring={ttsToITextString(ts.sort)} />\n </StyledFilterContentLabel>\n <StyledFilterContentControlWrapper>\n <ComboBox\n lists={getSortComboBoxLists(sortConfig)}\n placeholder=\"\"\n selectedItem={{\n text: sortConfig.selectedItem.text,\n value: sortConfig.selectedItem.id,\n }}\n onSelect={handleSelectSortItem}\n />\n </StyledFilterContentControlWrapper>\n </StyledFilterContentLabeledRow>\n )}\n {comboboxConfig && (\n <StyledFilterContentLabeledRow>\n <StyledFilterContentLabel>\n {comboboxConfig.label}\n </StyledFilterContentLabel>\n <StyledFilterContentControlWrapper>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <ComboBox {...comboboxConfig} />\n </StyledFilterContentControlWrapper>\n </StyledFilterContentLabeledRow>\n )}\n {checkboxConfig && (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <Checkbox {...checkboxConfig} />\n )}\n </StyledFilterContent>\n </TextstringProvider>\n ),\n [\n checkboxConfig,\n comboboxConfig,\n filterButtonConfig,\n handleSelectSortItem,\n searchConfig,\n sortConfig,\n ts.input.placeholder,\n ts.sort,\n ],\n );\n};\n\nFilterContent.displayName = 'FilterContent';\n\nexport default FilterContent;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAC1E,SACIC,iCAAiC,EACjCC,wBAAwB,EACxBC,6BAA6B,EAC7BC,mBAAmB,QAChB,wBAAwB;AAC/B,OAAOC,KAAK,MAAoB,mBAAmB;AACnD,OAAOC,IAAI,MAAM,iBAAiB;AAClC,OAAOC,aAAa,MAAM,oCAAoC;AAC9D,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,UAAU,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ,+BAA+B;AAChG,OAAOC,WAAW,MAAM,gCAAgC;AAGxD,SAASC,oBAAoB,QAAQ,uBAAuB;AAE5D,MAAMC,aAAqC,GAAGA,CAAC;EAC3CC,YAAY;EACZC,UAAU;EACVC,kBAAkB;EAClBC,cAAc;EACdC,cAAc;EACdC;AACJ,CAAC,KAAK;EACF,MAAMC,S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CAACwC,WAAW,GAAG,eAAe;AAE3C,eAAexC,aAAa","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
+
import { FILTER_CONTENT_ROW_GAP_PX } from './FilterContent.constants';
|
|
2
3
|
export const StyledFilterContent = styled.div`
|
|
3
4
|
background-color: ${({
|
|
4
5
|
theme
|
|
@@ -10,36 +11,21 @@ export const StyledFilterContent = styled.div`
|
|
|
10
11
|
flex-direction: column;
|
|
11
12
|
gap: 10px;
|
|
12
13
|
`;
|
|
13
|
-
export const
|
|
14
|
+
export const StyledFilterContentLabeledRow = styled.div`
|
|
14
15
|
display: flex;
|
|
15
16
|
align-items: center;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export const StyledFilterSortText = styled.div`
|
|
20
|
-
flex: 0 0 auto;
|
|
21
|
-
`;
|
|
22
|
-
export const StyledFilterComboboxWrapper = styled.div`
|
|
23
|
-
display: flex;
|
|
24
|
-
justify-content: end;
|
|
25
|
-
|
|
26
|
-
width: ${({
|
|
27
|
-
$textWidth
|
|
28
|
-
}) => `calc(100% - ${$textWidth}px)`}}
|
|
29
|
-
`;
|
|
30
|
-
export const StyledFilterComboboxInline = styled.div`
|
|
31
|
-
display: flex;
|
|
32
|
-
justify-content: space-between;
|
|
33
|
-
align-items: center;
|
|
34
|
-
gap: 10px;
|
|
17
|
+
gap: ${FILTER_CONTENT_ROW_GAP_PX}px;
|
|
18
|
+
width: 100%;
|
|
19
|
+
min-width: 0;
|
|
35
20
|
`;
|
|
36
|
-
export const
|
|
21
|
+
export const StyledFilterContentLabel = styled.div`
|
|
37
22
|
flex: 0 0 auto;
|
|
23
|
+
white-space: nowrap;
|
|
38
24
|
`;
|
|
39
|
-
export const
|
|
25
|
+
export const StyledFilterContentControlWrapper = styled.div`
|
|
40
26
|
display: flex;
|
|
41
|
-
justify-content: end;
|
|
42
27
|
flex: 1 1 auto;
|
|
43
28
|
min-width: 0;
|
|
29
|
+
justify-content: flex-end;
|
|
44
30
|
`;
|
|
45
31
|
//# sourceMappingURL=FilterContent.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterContent.styles.js","names":["styled","StyledFilterContent","div","theme","
|
|
1
|
+
{"version":3,"file":"FilterContent.styles.js","names":["styled","FILTER_CONTENT_ROW_GAP_PX","StyledFilterContent","div","theme","StyledFilterContentLabeledRow","StyledFilterContentLabel","StyledFilterContentControlWrapper"],"sources":["../../../../../src/components/filter/filter-content/FilterContent.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { FILTER_CONTENT_ROW_GAP_PX } from './FilterContent.constants';\n\ntype StyledFilterContentProps = WithTheme<unknown>;\n\nexport const StyledFilterContent = styled.div<StyledFilterContentProps>`\n background-color: ${({ theme }) => theme['100']};\n\n padding: 12px;\n\n display: flex;\n flex-direction: column;\n gap: 10px;\n`;\n\nexport const StyledFilterContentLabeledRow = styled.div`\n display: flex;\n align-items: center;\n gap: ${FILTER_CONTENT_ROW_GAP_PX}px;\n width: 100%;\n min-width: 0;\n`;\n\nexport const StyledFilterContentLabel = styled.div`\n flex: 0 0 auto;\n white-space: nowrap;\n`;\n\nexport const StyledFilterContentControlWrapper = styled.div`\n display: flex;\n flex: 1 1 auto;\n min-width: 0;\n justify-content: flex-end;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,SAASC,yBAAyB,QAAQ,2BAA2B;AAIrE,OAAO,MAAMC,mBAAmB,GAAGF,MAAM,CAACG,GAA6B;AACvE,wBAAwB,CAAC;EAAEC;AAAM,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,6BAA6B,GAAGL,MAAM,CAACG,GAAG;AACvD;AACA;AACA,WAAWF,yBAAyB;AACpC;AACA;AACA,CAAC;AAED,OAAO,MAAMK,wBAAwB,GAAGN,MAAM,CAACG,GAAG;AAClD;AACA;AACA,CAAC;AAED,OAAO,MAAMI,iCAAiC,GAAGP,MAAM,CAACG,GAAG;AAC3D;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterContent.types.js","names":[],"sources":["../../../../../src/components/filter/filter-content/FilterContent.types.ts"],"sourcesContent":["import type {\n CheckboxConfig,\n ComboboxConfig,\n FilterButtonConfig,\n SearchConfig,\n SortConfig,\n} from '../../../types/filter';\n\n/**\n * Props for the `FilterContent` component.\n */\nexport type FilterContentProps = {\n /**\n * Search configuration for the optional search input.\n */\n searchConfig?: SearchConfig;\n /**\n * Configuration for the optional filter button group.\n */\n filterButtonConfig?: FilterButtonConfig;\n /**\n * Configuration for the optional sort combobox.\n */\n sortConfig?: SortConfig;\n /**\n * Configuration for the optional checkbox.\n */\n checkboxConfig?: CheckboxConfig;\n /**\n * Configuration for the optional labeled combobox.\n */\n comboboxConfig?: ComboboxConfig;\n /**\n * Whether the search input should receive focus when the filter opens.\n */\n shouldAutoFocus: boolean;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterContent.utils.js","names":["getSortComboBoxLists","sortConfig","list","items","map","text","id","value"],"sources":["../../../../../src/components/filter/filter-content/FilterContent.utils.ts"],"sourcesContent":["import type { IComboBoxItems } from '../../combobox/ComboBox.types';\nimport type { SortConfig } from '../../../types/filter';\n\nexport const getSortComboBoxLists = (sortConfig: SortConfig): IComboBoxItems[] => [\n {\n list: sortConfig.items.map(({ text, id }) => ({\n text,\n value: id,\n })),\n },\n];\n"],"mappings":"AAGA,OAAO,MAAMA,oBAAoB,GAAIC,UAAsB,IAAuB,CAC9E;EACIC,IAAI,EAAED,UAAU,CAACE,KAAK,CAACC,GAAG,CAAC,CAAC;IAAEC,IAAI;IAAEC;EAAG,CAAC,MAAM;IAC1CD,IAAI;IACJE,KAAK,EAAED;EACX,CAAC,CAAC;AACN,CAAC,CACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseSkeleton.styles.js","names":["styled","css","motion","StyledBaseSkeleton","div","$borderRadius","$backgroundColor","$width","$shouldUseNativeTag","$height","StyledMotionBaseSkeletonShimmer","$color","StyledMotionBaseSkeletonPulse"],"sources":["../../../../../src/components/skeleton/base-skeleton/BaseSkeleton.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { motion } from 'motion/react';\n\ntype StyledBaseSkeletonProps = {\n $borderRadius: number | string;\n $backgroundColor: string;\n $width: number | string;\n $height: number | string;\n $shouldUseNativeTag: boolean;\n};\n\nexport const StyledBaseSkeleton = styled.div<StyledBaseSkeletonProps>`\n position: relative;\n overflow: hidden;\n border-radius: ${({ $borderRadius }) =>\n `${$borderRadius}${typeof $borderRadius === 'number' ? 'px' : ''}`};\n\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n\n width: ${({ $width }) => `${$width}${typeof $width === 'number' ? 'px' : ''}`};\n\n user-select: none;\n\n
|
|
1
|
+
{"version":3,"file":"BaseSkeleton.styles.js","names":["styled","css","motion","StyledBaseSkeleton","div","$borderRadius","$backgroundColor","$width","$shouldUseNativeTag","$height","StyledMotionBaseSkeletonShimmer","$color","StyledMotionBaseSkeletonPulse"],"sources":["../../../../../src/components/skeleton/base-skeleton/BaseSkeleton.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { motion } from 'motion/react';\n\ntype StyledBaseSkeletonProps = {\n $borderRadius: number | string;\n $backgroundColor: string;\n $width: number | string;\n $height: number | string;\n $shouldUseNativeTag: boolean;\n};\n\nexport const StyledBaseSkeleton = styled.div<StyledBaseSkeletonProps>`\n position: relative;\n overflow: hidden;\n border-radius: ${({ $borderRadius }) =>\n `${$borderRadius}${typeof $borderRadius === 'number' ? 'px' : ''}`};\n\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n\n width: ${({ $width }) => `${$width}${typeof $width === 'number' ? 'px' : ''}`};\n\n user-select: none;\n\n ${({ $shouldUseNativeTag, $height }) =>\n $shouldUseNativeTag\n ? css`\n color: transparent;\n `\n : css`\n height: ${$height}${typeof $height === 'number' ? 'px' : ''};\n `}\n`;\n\ntype StyledMotionBaseSkeletonShimmerProps = {\n $color: string;\n};\n\nexport const StyledMotionBaseSkeletonShimmer = styled(\n motion.div,\n)<StyledMotionBaseSkeletonShimmerProps>`\n background: ${({ $color }) =>\n `linear-gradient(\n 90deg,\n transparent 0%,\n ${$color} 50%,\n transparent 100%\n )`};\n\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n\n width: 100%;\n height: 100%;\n\n pointer-events: none;\n border-radius: 0;\n\n will-change: transform;\n\n opacity: 0.06;\n`;\n\ntype StyledMotionBaseSkeletonPulseProps = {\n $color: string;\n};\n\nexport const StyledMotionBaseSkeletonPulse = styled(motion.div)<StyledMotionBaseSkeletonPulseProps>`\n width: 100%;\n height: 100%;\n\n position: absolute;\n\n opacity: 0.06;\n\n background-color: ${({ $color }) => $color};\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAC/C,SAASC,MAAM,QAAQ,cAAc;AAUrC,OAAO,MAAMC,kBAAkB,GAAGH,MAAM,CAACI,GAA4B;AACrE;AACA;AACA,qBAAqB,CAAC;EAAEC;AAAc,CAAC,KAC/B,GAAGA,aAAa,GAAG,OAAOA,aAAa,KAAK,QAAQ,GAAG,IAAI,GAAG,EAAE,EAAE;AAC1E;AACA,wBAAwB,CAAC;EAAEC;AAAiB,CAAC,KAAKA,gBAAgB;AAClE;AACA,aAAa,CAAC;EAAEC;AAAO,CAAC,KAAK,GAAGA,MAAM,GAAG,OAAOA,MAAM,KAAK,QAAQ,GAAG,IAAI,GAAG,EAAE,EAAE;AACjF;AACA;AACA;AACA,MAAM,CAAC;EAAEC,mBAAmB;EAAEC;AAAQ,CAAC,KAC/BD,mBAAmB,GACbP,GAAG;AACjB;AACA,eAAe,GACDA,GAAG;AACjB,4BAA4BQ,OAAO,GAAG,OAAOA,OAAO,KAAK,QAAQ,GAAG,IAAI,GAAG,EAAE;AAC7E,eAAe;AACf,CAAC;AAMD,OAAO,MAAMC,+BAA+B,GAAGV,MAAM,CACjDE,MAAM,CAACE,GACX,CAAuC;AACvC,kBAAkB,CAAC;EAAEO;AAAO,CAAC,KACrB;AACR;AACA;AACA,cAAcA,MAAM;AACpB;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAMD,OAAO,MAAMC,6BAA6B,GAAGZ,MAAM,CAACE,MAAM,CAACE,GAAG,CAAqC;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,CAAC;EAAEO;AAAO,CAAC,KAAKA,MAAM;AAC9C,CAAC","ignoreList":[]}
|
package/lib/esm/types/filter.js
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search configuration for the `Filter` component.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Item configuration used by the sort dropdown.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Sort configuration for the `Filter` component.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Checkbox configuration for the `Filter` component.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Filter button group configuration for the `Filter` component.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Combobox configuration used by `FilterContent`.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Ref interface for the `Filter` component.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Different layout modes supported by the `Filter` component.
|
|
31
|
+
*/
|
|
1
32
|
export let FilterType = /*#__PURE__*/function (FilterType) {
|
|
2
33
|
FilterType[FilterType["ONLY_SEARCH"] = 0] = "ONLY_SEARCH";
|
|
3
34
|
FilterType[FilterType["ONLY_FILTER"] = 1] = "ONLY_FILTER";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","names":["FilterType"],"sources":["../../../src/types/filter.ts"],"sourcesContent":["import { FilterButtonsProps } from '../components/filter-buttons/FilterButtons';\nimport { CheckboxProps } from '../components/checkbox/Checkbox';\nimport { ComboBoxProps } from '../components/combobox/ComboBox.types';\n\nexport interface SearchConfig {\n onSearchChange: (search: string) => void;\n searchValue: string;\n}\n\nexport interface SortItem {\n text: string;\n id: string | number;\n}\n\nexport interface SortConfig {\n onSortChange: (item: SortItem) => void;\n selectedItem: SortItem;\n items: SortItem[];\n}\n\nexport type CheckboxConfig = CheckboxProps;\n\nexport type FilterButtonConfig = FilterButtonsProps;\n\nexport type ComboboxConfig = ComboBoxProps & { label: string };\n\nexport type FilterRef = {\n hide: VoidFunction;\n show: VoidFunction;\n};\n\nexport enum FilterType {\n ONLY_SEARCH,\n ONLY_FILTER,\n ONLY_SORT,\n ONLY_CHECKBOX,\n ONLY_COMBOBOX,\n MULTIPLE,\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"filter.js","names":["FilterType"],"sources":["../../../src/types/filter.ts"],"sourcesContent":["import { FilterButtonsProps } from '../components/filter-buttons/FilterButtons';\nimport { CheckboxProps } from '../components/checkbox/Checkbox';\nimport { ComboBoxProps } from '../components/combobox/ComboBox.types';\n\n/**\n * Search configuration for the `Filter` component.\n */\nexport interface SearchConfig {\n /**\n * Callback invoked whenever the search input changes.\n */\n onSearchChange: (search: string) => void;\n /**\n * Current search value.\n */\n searchValue: string;\n}\n\n/**\n * Item configuration used by the sort dropdown.\n */\nexport interface SortItem {\n /**\n * Display text of the item.\n */\n text: string;\n /**\n * Stable value or identifier of the item.\n */\n id: string | number;\n}\n\n/**\n * Sort configuration for the `Filter` component.\n */\nexport interface SortConfig {\n /**\n * Callback invoked when a sort item is selected.\n */\n onSortChange: (item: SortItem) => void;\n /**\n * Currently selected sort item.\n */\n selectedItem: SortItem;\n /**\n * Available sort items.\n */\n items: SortItem[];\n}\n\n/**\n * Checkbox configuration for the `Filter` component.\n */\nexport type CheckboxConfig = CheckboxProps;\n\n/**\n * Filter button group configuration for the `Filter` component.\n */\nexport type FilterButtonConfig = FilterButtonsProps;\n\n/**\n * Combobox configuration used by `FilterContent`.\n */\nexport type ComboboxConfig = ComboBoxProps & { label: string };\n\n/**\n * Ref interface for the `Filter` component.\n */\nexport type FilterRef = {\n /**\n * Hides the filter popup.\n */\n hide: VoidFunction;\n /**\n * Shows the filter popup.\n */\n show: VoidFunction;\n};\n\n/**\n * Different layout modes supported by the `Filter` component.\n */\nexport enum FilterType {\n ONLY_SEARCH,\n ONLY_FILTER,\n ONLY_SORT,\n ONLY_CHECKBOX,\n ONLY_COMBOBOX,\n MULTIPLE,\n}\n"],"mappings":"AAIA;AACA;AACA;;AAYA;AACA;AACA;;AAYA;AACA;AACA;;AAgBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;AACA,WAAYA,UAAU,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const COMBO_BOX_HEADER_HORIZONTAL_PADDING_PX = 20;
|
|
2
|
+
export declare const COMBO_BOX_HEADER_BORDER_WIDTH_PX = 2;
|
|
3
|
+
export declare const COMBO_BOX_ACTION_ICON_WIDTH_PX = 40;
|
|
4
|
+
export declare const COMBO_BOX_CLEAR_ICON_WIDTH_PX = 40;
|
|
5
|
+
export declare const COMBO_BOX_ROUNDING_BUFFER_PX = 1;
|
|
6
|
+
export declare const COMBO_BOX_PREFIX_GAP_PX = 5;
|
|
7
|
+
export declare const COMBO_BOX_PREFIX_MIN_WIDTH_PX = 32;
|
|
8
|
+
export declare const COMBO_BOX_DROPDOWN_HORIZONTAL_PADDING_PX: number;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import type { Theme } from '../color-scheme-provider/ColorSchemeProvider';
|
|
2
2
|
import { DropdownDirection } from '../../types/dropdown';
|
|
3
3
|
import { ComboBoxProps, ComboBoxSize } from './ComboBox.types';
|
|
4
|
-
export declare const StyledComboBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "theme" | "$shouldUseFullWidth" | "$minWidth"
|
|
4
|
+
export declare const StyledComboBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "theme" | "$shouldUseFullWidth" | "$minWidth"> & {
|
|
5
5
|
$minWidth?: number;
|
|
6
6
|
$shouldUseFullWidth: ComboBoxProps["shouldUseFullWidth"];
|
|
7
|
-
$shouldUseCurrentItemWidth: ComboBoxProps["shouldUseCurrentItemWidth"];
|
|
8
7
|
} & {
|
|
9
8
|
theme: Theme;
|
|
10
|
-
}, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "theme" | "$shouldUseFullWidth" | "$minWidth"
|
|
9
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "theme" | "$shouldUseFullWidth" | "$minWidth"> & {
|
|
11
10
|
$minWidth?: number;
|
|
12
11
|
$shouldUseFullWidth: ComboBoxProps["shouldUseFullWidth"];
|
|
13
|
-
$shouldUseCurrentItemWidth: ComboBoxProps["shouldUseCurrentItemWidth"];
|
|
14
12
|
} & {
|
|
15
13
|
theme: Theme;
|
|
16
14
|
}, never>>> & string;
|
|
@@ -74,14 +72,12 @@ type StyledComboBoxIconWrapperProps = {
|
|
|
74
72
|
$size: ComboBoxSize;
|
|
75
73
|
};
|
|
76
74
|
export declare const StyledComboBoxIconWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof StyledComboBoxIconWrapperProps> & StyledComboBoxIconWrapperProps, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof StyledComboBoxIconWrapperProps> & StyledComboBoxIconWrapperProps, never>>> & string;
|
|
77
|
-
export declare const StyledComboBoxBody: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "theme" | "$maxHeight" | "$minWidth"
|
|
78
|
-
$shouldUseCurrentItemWidth: boolean;
|
|
75
|
+
export declare const StyledComboBoxBody: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "theme" | "$maxHeight" | "$minWidth"> & {
|
|
79
76
|
$maxHeight: number;
|
|
80
77
|
$minWidth: number;
|
|
81
78
|
} & {
|
|
82
79
|
theme: Theme;
|
|
83
|
-
}, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "theme" | "$maxHeight" | "$minWidth"
|
|
84
|
-
$shouldUseCurrentItemWidth: boolean;
|
|
80
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "theme" | "$maxHeight" | "$minWidth"> & {
|
|
85
81
|
$maxHeight: number;
|
|
86
82
|
$minWidth: number;
|
|
87
83
|
} & {
|
|
@@ -1,55 +1,138 @@
|
|
|
1
1
|
import { ChangeEventHandler, CSSProperties, FocusEventHandler, ReactHTML, ReactNode } from 'react';
|
|
2
2
|
import { CSSPropertiesWithVars } from 'styled-components/dist/types';
|
|
3
3
|
import { DropdownDirection } from '../../types/dropdown';
|
|
4
|
+
/**
|
|
5
|
+
* Ref interface for the `ComboBox` component.
|
|
6
|
+
*/
|
|
4
7
|
export interface ComboBoxRef {
|
|
8
|
+
/**
|
|
9
|
+
* Hides the dropdown content.
|
|
10
|
+
*/
|
|
5
11
|
hide: VoidFunction;
|
|
12
|
+
/**
|
|
13
|
+
* Shows the dropdown content.
|
|
14
|
+
*/
|
|
6
15
|
show: VoidFunction;
|
|
7
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* A grouped list definition used by the `ComboBox` component.
|
|
19
|
+
*/
|
|
8
20
|
export interface IComboBoxItems {
|
|
21
|
+
/**
|
|
22
|
+
* Optional group label shown above the list.
|
|
23
|
+
*/
|
|
9
24
|
groupName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The items that should be rendered inside the group.
|
|
27
|
+
*/
|
|
10
28
|
list: Array<IComboBoxItem>;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the items in this group should use round images.
|
|
31
|
+
*/
|
|
11
32
|
shouldShowRoundImage?: boolean;
|
|
12
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Optional text styling configuration for a combobox item.
|
|
36
|
+
*/
|
|
13
37
|
export interface ComboBoxTextStyles {
|
|
38
|
+
/**
|
|
39
|
+
* The HTML tag that should be used for the text wrapper.
|
|
40
|
+
*/
|
|
14
41
|
tagName?: keyof ReactHTML;
|
|
42
|
+
/**
|
|
43
|
+
* Additional inline styles applied to the text wrapper.
|
|
44
|
+
*/
|
|
15
45
|
styles?: CSSPropertiesWithVars;
|
|
46
|
+
/**
|
|
47
|
+
* Additional class name applied to the text wrapper.
|
|
48
|
+
*/
|
|
16
49
|
className?: string;
|
|
17
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Single selectable item configuration for the `ComboBox` component.
|
|
53
|
+
*/
|
|
18
54
|
export interface IComboBoxItem {
|
|
55
|
+
/**
|
|
56
|
+
* Optional icon classes rendered before the text.
|
|
57
|
+
*/
|
|
19
58
|
icons?: string[];
|
|
59
|
+
/**
|
|
60
|
+
* Optional background style used for the image placeholder.
|
|
61
|
+
*/
|
|
20
62
|
imageBackground?: CSSProperties['background'];
|
|
63
|
+
/**
|
|
64
|
+
* Optional image URL rendered for the item.
|
|
65
|
+
*/
|
|
21
66
|
imageUrl?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the item should be disabled.
|
|
69
|
+
*/
|
|
22
70
|
isDisabled?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Optional element rendered on the right side of the item.
|
|
73
|
+
*/
|
|
23
74
|
rightElement?: ReactNode;
|
|
75
|
+
/**
|
|
76
|
+
* Optional secondary text rendered below the main text.
|
|
77
|
+
*/
|
|
24
78
|
subtext?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Optional suffix element rendered after the text.
|
|
81
|
+
*/
|
|
25
82
|
suffixElement?: ReactNode;
|
|
83
|
+
/**
|
|
84
|
+
* Main label of the item.
|
|
85
|
+
*/
|
|
26
86
|
text: string;
|
|
87
|
+
/**
|
|
88
|
+
* Stable item value used for selection and matching.
|
|
89
|
+
*/
|
|
27
90
|
value: string | number;
|
|
91
|
+
/**
|
|
92
|
+
* Optional text styling overrides for the item label.
|
|
93
|
+
*/
|
|
28
94
|
textStyles?: ComboBoxTextStyles;
|
|
29
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Available size variants for the `ComboBox` header.
|
|
98
|
+
*/
|
|
30
99
|
export declare enum ComboBoxSize {
|
|
100
|
+
/**
|
|
101
|
+
* Standard height and spacing.
|
|
102
|
+
*/
|
|
31
103
|
NORMAL = "normal",
|
|
104
|
+
/**
|
|
105
|
+
* Compact height and spacing.
|
|
106
|
+
*/
|
|
32
107
|
SMALL = "small"
|
|
33
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Props for the `ComboBox` component.
|
|
111
|
+
*/
|
|
34
112
|
export type ComboBoxProps = {
|
|
35
113
|
/**
|
|
36
114
|
* The width of the body.
|
|
115
|
+
* @default undefined
|
|
37
116
|
*/
|
|
38
117
|
bodyWidth?: number;
|
|
39
118
|
/**
|
|
40
119
|
* The element where the content of the `ComboBox` should be rendered via React Portal.
|
|
120
|
+
* @default undefined
|
|
41
121
|
*/
|
|
42
122
|
container?: Element;
|
|
43
123
|
/**
|
|
44
124
|
* The direction in which the combobox should open.
|
|
125
|
+
* @default DropdownDirection.RIGHT
|
|
45
126
|
*/
|
|
46
127
|
direction?: DropdownDirection;
|
|
47
128
|
/**
|
|
48
129
|
* The value of the optional input.
|
|
130
|
+
* @default undefined
|
|
49
131
|
*/
|
|
50
132
|
inputValue?: string;
|
|
51
133
|
/**
|
|
52
134
|
* Whether the combobox should be disabled.
|
|
135
|
+
* @default false
|
|
53
136
|
*/
|
|
54
137
|
isDisabled?: boolean;
|
|
55
138
|
/**
|
|
@@ -58,30 +141,37 @@ export type ComboBoxProps = {
|
|
|
58
141
|
lists: IComboBoxItems[];
|
|
59
142
|
/**
|
|
60
143
|
* The maximum height of the combobox content.
|
|
144
|
+
* @default 280
|
|
61
145
|
*/
|
|
62
146
|
maxHeight?: number;
|
|
63
147
|
/**
|
|
64
148
|
* Function to be executed when the value of the optional input is changed.
|
|
149
|
+
* @default undefined
|
|
65
150
|
*/
|
|
66
151
|
onInputChange?: ChangeEventHandler<HTMLInputElement>;
|
|
67
152
|
/**
|
|
68
153
|
* Function to be executed when the optional input lost its focus.
|
|
154
|
+
* @default undefined
|
|
69
155
|
*/
|
|
70
156
|
onInputBlur?: FocusEventHandler<HTMLInputElement>;
|
|
71
157
|
/**
|
|
72
158
|
* Function to be executed when the optional input gets its focus.
|
|
159
|
+
* @default undefined
|
|
73
160
|
*/
|
|
74
161
|
onInputFocus?: FocusEventHandler<HTMLInputElement>;
|
|
75
162
|
/**
|
|
76
163
|
* Function that should be executed when an item is selected. If the function returns false, the item will not be selected.
|
|
164
|
+
* @default undefined
|
|
77
165
|
*/
|
|
78
166
|
onSelect?: (comboboxItem?: IComboBoxItem) => Promise<boolean> | boolean | void;
|
|
79
167
|
/**
|
|
80
168
|
* Function to be executed when the content of the `ComboBox` is shown.
|
|
169
|
+
* @default undefined
|
|
81
170
|
*/
|
|
82
171
|
onShow?: () => void;
|
|
83
172
|
/**
|
|
84
173
|
* Function to be executed when the content of the `ComboBox` is hidden.
|
|
174
|
+
* @default undefined
|
|
85
175
|
*/
|
|
86
176
|
onHide?: () => void;
|
|
87
177
|
/**
|
|
@@ -90,50 +180,62 @@ export type ComboBoxProps = {
|
|
|
90
180
|
placeholder: string;
|
|
91
181
|
/**
|
|
92
182
|
* A prefix that should be displayed before the placeholder.
|
|
183
|
+
* @default undefined
|
|
93
184
|
*/
|
|
94
185
|
prefix?: string;
|
|
95
186
|
/**
|
|
96
187
|
* An item that should be preselected.
|
|
188
|
+
* @default undefined
|
|
97
189
|
*/
|
|
98
190
|
selectedItem?: IComboBoxItem;
|
|
99
191
|
/**
|
|
100
192
|
* If true, the images of the items are displayed in a bigger shape. This prop will automatically be set to true if the subtext of an item is given.
|
|
193
|
+
* @default false
|
|
101
194
|
*/
|
|
102
195
|
shouldShowBigImage?: boolean;
|
|
103
196
|
/**
|
|
104
197
|
* If true, a clear icon is displayed at the end of the combo box if an item is selected.
|
|
198
|
+
* @default false
|
|
105
199
|
*/
|
|
106
200
|
shouldShowClearIcon?: boolean;
|
|
107
201
|
/**
|
|
108
202
|
* Whether the background should be transparent.
|
|
203
|
+
* @default false
|
|
109
204
|
*/
|
|
110
205
|
shouldShowTransparentBackground?: boolean;
|
|
111
206
|
/**
|
|
112
207
|
* If true, the images of the items are displayed in a round shape.
|
|
208
|
+
* @default false
|
|
113
209
|
*/
|
|
114
210
|
shouldShowRoundImage?: boolean;
|
|
115
211
|
/**
|
|
116
212
|
* Whether the width of the ComboBox should be the width of the current item.
|
|
213
|
+
* @default false
|
|
117
214
|
*/
|
|
118
215
|
shouldUseCurrentItemWidth?: boolean;
|
|
119
216
|
/**
|
|
120
217
|
* Whether the width of the 'ComboBox' should be the width of the parent or of the widest item.
|
|
218
|
+
* @default false
|
|
121
219
|
*/
|
|
122
220
|
shouldUseFullWidth?: boolean;
|
|
123
221
|
/**
|
|
124
222
|
* If true, the dropdown will use the maximum width of the items.
|
|
223
|
+
* @default false
|
|
125
224
|
*/
|
|
126
225
|
shouldDropDownUseMaxItemWidth?: boolean;
|
|
127
226
|
/**
|
|
128
227
|
* Whether the outside events should be captured.
|
|
228
|
+
* @default undefined
|
|
129
229
|
*/
|
|
130
230
|
shouldCaptureEvents?: boolean;
|
|
131
231
|
/**
|
|
132
232
|
* The size of the ComboBox.
|
|
233
|
+
* @default ComboBoxSize.NORMAL
|
|
133
234
|
*/
|
|
134
235
|
size?: ComboBoxSize;
|
|
135
236
|
/**
|
|
136
237
|
* Optional min width for the prefix element.
|
|
238
|
+
* @default undefined
|
|
137
239
|
*/
|
|
138
240
|
prefixMinWidth?: number;
|
|
139
241
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ChaynsReactFunctions, ChaynsReactValues } from 'chayns-api';
|
|
2
|
+
import type { IComboBoxItem, IComboBoxItems } from './ComboBox.types';
|
|
3
|
+
export type ComboBoxWidthOptions = {
|
|
4
|
+
functions: ChaynsReactFunctions;
|
|
5
|
+
internalSelectedItem?: IComboBoxItem;
|
|
6
|
+
lists: IComboBoxItems[];
|
|
7
|
+
parentWidth: number;
|
|
8
|
+
placeholder: string;
|
|
9
|
+
prefix?: string;
|
|
10
|
+
prefixMinWidth?: number;
|
|
11
|
+
selectedItem?: IComboBoxItem;
|
|
12
|
+
shouldDropDownUseMaxItemWidth?: boolean;
|
|
13
|
+
shouldShowBigImage?: boolean;
|
|
14
|
+
shouldShowClearIcon?: boolean;
|
|
15
|
+
shouldUseCurrentItemWidth?: boolean;
|
|
16
|
+
shouldUseFullWidth?: boolean;
|
|
17
|
+
values: ChaynsReactValues;
|
|
18
|
+
};
|
|
19
|
+
export type ComboBoxWidthResult = {
|
|
20
|
+
minWidth?: number;
|
|
21
|
+
bodyMinWidth: number;
|
|
22
|
+
};
|
|
23
|
+
export declare const getComboBoxWidthResult: ({ functions, internalSelectedItem, lists, parentWidth, placeholder, prefix, prefixMinWidth, selectedItem, shouldDropDownUseMaxItemWidth, shouldShowBigImage, shouldShowClearIcon, shouldUseCurrentItemWidth, shouldUseFullWidth, values, }: ComboBoxWidthOptions) => ComboBoxWidthResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FILTER_CONTENT_ROW_GAP_PX = 10;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export type FilterContentProps = {
|
|
4
|
-
searchConfig?: SearchConfig;
|
|
5
|
-
filterButtonConfig?: FilterButtonConfig;
|
|
6
|
-
sortConfig?: SortConfig;
|
|
7
|
-
checkboxConfig?: CheckboxConfig;
|
|
8
|
-
comboboxConfig?: ComboboxConfig;
|
|
9
|
-
shouldAutoFocus: boolean;
|
|
10
|
-
};
|
|
2
|
+
import type { FilterContentProps } from './FilterContent.types';
|
|
11
3
|
declare const FilterContent: FC<FilterContentProps>;
|
|
12
4
|
export default FilterContent;
|
|
@@ -3,17 +3,6 @@ export declare const StyledFilterContent: import("styled-components/dist/types")
|
|
|
3
3
|
}, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "theme"> & {
|
|
4
4
|
theme: import("../../color-scheme-provider/ColorSchemeProvider").Theme;
|
|
5
5
|
}, never>>> & string;
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
$textWidth: number;
|
|
10
|
-
} & {
|
|
11
|
-
theme: import("../../color-scheme-provider/ColorSchemeProvider").Theme;
|
|
12
|
-
}, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "theme" | "$textWidth"> & {
|
|
13
|
-
$textWidth: number;
|
|
14
|
-
} & {
|
|
15
|
-
theme: import("../../color-scheme-provider/ColorSchemeProvider").Theme;
|
|
16
|
-
}, never>>> & string;
|
|
17
|
-
export declare const StyledFilterComboboxInline: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
18
|
-
export declare const StyledFilterComboboxInlineLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
19
|
-
export declare const StyledFilterComboboxInlineComboboxWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
6
|
+
export declare const StyledFilterContentLabeledRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
7
|
+
export declare const StyledFilterContentLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
8
|
+
export declare const StyledFilterContentControlWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CheckboxConfig, ComboboxConfig, FilterButtonConfig, SearchConfig, SortConfig } from '../../../types/filter';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the `FilterContent` component.
|
|
4
|
+
*/
|
|
5
|
+
export type FilterContentProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Search configuration for the optional search input.
|
|
8
|
+
*/
|
|
9
|
+
searchConfig?: SearchConfig;
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for the optional filter button group.
|
|
12
|
+
*/
|
|
13
|
+
filterButtonConfig?: FilterButtonConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Configuration for the optional sort combobox.
|
|
16
|
+
*/
|
|
17
|
+
sortConfig?: SortConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Configuration for the optional checkbox.
|
|
20
|
+
*/
|
|
21
|
+
checkboxConfig?: CheckboxConfig;
|
|
22
|
+
/**
|
|
23
|
+
* Configuration for the optional labeled combobox.
|
|
24
|
+
*/
|
|
25
|
+
comboboxConfig?: ComboboxConfig;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the search input should receive focus when the filter opens.
|
|
28
|
+
*/
|
|
29
|
+
shouldAutoFocus: boolean;
|
|
30
|
+
};
|