@chayns-components/core 5.0.48 → 5.0.49
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/filter/filter-content/FIlterContent.js +4 -1
- package/lib/cjs/components/filter/filter-content/FIlterContent.js.map +1 -1
- package/lib/cjs/components/filter/filter-content/FilterContent.styles.js +11 -1
- package/lib/cjs/components/filter/filter-content/FilterContent.styles.js.map +1 -1
- package/lib/esm/components/filter/filter-content/FIlterContent.js +5 -2
- package/lib/esm/components/filter/filter-content/FIlterContent.js.map +1 -1
- package/lib/esm/components/filter/filter-content/FilterContent.styles.js +10 -0
- package/lib/esm/components/filter/filter-content/FilterContent.styles.js.map +1 -1
- package/lib/types/components/filter/filter-content/FilterContent.styles.d.ts +2 -0
- package/package.json +2 -2
|
@@ -13,6 +13,7 @@ var _ComboBox = _interopRequireDefault(require("../../combobox/ComboBox"));
|
|
|
13
13
|
var _Checkbox = _interopRequireDefault(require("../../checkbox/Checkbox"));
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16
17
|
const FilterContent = ({
|
|
17
18
|
searchConfig,
|
|
18
19
|
sortConfig,
|
|
@@ -79,7 +80,9 @@ const FilterContent = ({
|
|
|
79
80
|
value: sortConfig.selectedItem.id
|
|
80
81
|
},
|
|
81
82
|
onSelect: handleSelectSortItem
|
|
82
|
-
}))), comboboxConfig && /*#__PURE__*/_react.default.createElement(_FilterContent.StyledFilterComboboxInline, null, comboboxConfig.label, /*#__PURE__*/_react.default.createElement(
|
|
83
|
+
}))), comboboxConfig && /*#__PURE__*/_react.default.createElement(_FilterContent.StyledFilterComboboxInline, null, /*#__PURE__*/_react.default.createElement(_FilterContent.StyledFilterComboboxInlineLabel, null, comboboxConfig.label), /*#__PURE__*/_react.default.createElement(_FilterContent.StyledFilterComboboxInlineComboboxWrapper, null, /*#__PURE__*/_react.default.createElement(_ComboBox.default, _extends({
|
|
84
|
+
shouldUseCurrentItemWidth: true
|
|
85
|
+
}, comboboxConfig)))), checkboxConfig &&
|
|
83
86
|
/*#__PURE__*/
|
|
84
87
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
85
88
|
_react.default.createElement(_Checkbox.default, checkboxConfig)), [checkboxConfig, comboboxConfig, filterButtonConfig, handleSelectSortItem, searchConfig, sortConfig, sortTextWidth]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FIlterContent.js","names":["_react","_interopRequireWildcard","require","_FilterContent","_Input","_interopRequireDefault","_Icon","_FilterButtons","_ComboBox","_Checkbox","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","FilterContent","searchConfig","sortConfig","filterButtonConfig","checkboxConfig","comboboxConfig","shouldAutoFocus","sortTextRef","useRef","searchRef","sortTextWidth","setSortTextWidth","useState","handleSelectSortItem","useCallback","item","text","value","onSortChange","id","useEffect","current","clientWidth","_searchRef$current","focus","useMemo","createElement","StyledFilterContent","ref","onChange","ev","onSearchChange","target","placeholder","searchValue","shouldShowClearIcon","length","leftElement","icons","StyledFilterSort","StyledFilterSortText","StyledFilterComboboxWrapper","$textWidth","lists","list","items","map","selectedItem","onSelect","StyledFilterComboboxInline","label","displayName","_default","exports"],"sources":["../../../../../src/components/filter/filter-content/FIlterContent.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n StyledFilterComboboxInline,\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';\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 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 <StyledFilterContent>\n {searchConfig && (\n <Input\n ref={searchRef}\n onChange={(ev) => searchConfig.onSearchChange(ev.target.value)}\n placeholder=\"Suche\"\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}>Sortierung</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 {comboboxConfig.label}\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <ComboBox {...comboboxConfig} />\n </StyledFilterComboboxInline>\n )}\n {checkboxConfig && (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <Checkbox {...checkboxConfig} />\n )}\n </StyledFilterContent>\n ),\n [\n checkboxConfig,\n comboboxConfig,\n filterButtonConfig,\n handleSelectSortItem,\n searchConfig,\n sortConfig,\n sortTextWidth,\n ],\n );\n};\n\nFilterContent.displayName = 'FilterContent';\n\nexport default FilterContent;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAOA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,KAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,cAAA,GAAAF,sBAAA,CAAAH,OAAA;AAQA,IAAAM,SAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAA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AA2E,0BAA0B,QACtB5C,cAAc,CAAC6C,KAAK,eAErB/E,MAAA,CAAAY,OAAA,CAAA2C,aAAA,CAAC/C,SAAA,CAAAI,OAAQ,EAAKsB,cAAiB,CACP,CAC/B,EACAD,cAAc;EAAA;EACX;EACAjC,MAAA,CAAAY,OAAA,CAAA2C,aAAA,CAAC9C,SAAA,CAAAG,OAAQ,EAAKqB,cAAiB,CAElB,CACxB,EACD,CACIA,cAAc,EACdC,cAAc,EACdF,kBAAkB,EAClBU,oBAAoB,EACpBZ,YAAY,EACZC,UAAU,EACVQ,aAAa,CAErB,CAAC;AACL,CAAC;AAEDV,aAAa,CAACmD,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAtE,OAAA,GAE7BiB,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FIlterContent.js","names":["_react","_interopRequireWildcard","require","_FilterContent","_Input","_interopRequireDefault","_Icon","_FilterButtons","_ComboBox","_Checkbox","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","FilterContent","searchConfig","sortConfig","filterButtonConfig","checkboxConfig","comboboxConfig","shouldAutoFocus","sortTextRef","useRef","searchRef","sortTextWidth","setSortTextWidth","useState","handleSelectSortItem","useCallback","item","text","value","onSortChange","id","useEffect","current","clientWidth","_searchRef$current","focus","useMemo","createElement","StyledFilterContent","ref","onChange","ev","onSearchChange","target","placeholder","searchValue","shouldShowClearIcon","leftElement","icons","StyledFilterSort","StyledFilterSortText","StyledFilterComboboxWrapper","$textWidth","lists","list","items","map","selectedItem","onSelect","StyledFilterComboboxInline","StyledFilterComboboxInlineLabel","label","StyledFilterComboboxInlineComboboxWrapper","shouldUseCurrentItemWidth","displayName","_default","exports"],"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';\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 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 <StyledFilterContent>\n {searchConfig && (\n <Input\n ref={searchRef}\n onChange={(ev) => searchConfig.onSearchChange(ev.target.value)}\n placeholder=\"Suche\"\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}>Sortierung</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 ),\n [\n checkboxConfig,\n comboboxConfig,\n filterButtonConfig,\n handleSelectSortItem,\n searchConfig,\n sortConfig,\n sortTextWidth,\n ],\n );\n};\n\nFilterContent.displayName = 'FilterContent';\n\nexport default FilterContent;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AASA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,KAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,cAAA,GAAAF,sBAAA,CAAAH,OAAA;AAQA,IAAAM,SAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,SAAA,GAAAJ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,CAAC,CAAC;QAAE7B,IAAI;QAAEG;MAAG,CAAC,MAAM;QAC1CH,IAAI;QACJC,KAAK,EAAEE;MACX,CAAC,CAAC;IACN,CAAC,CACH;IACFc,WAAW,EAAC,EAAE;IACda,YAAY,EAAE;MACV9B,IAAI,EAAEd,UAAU,CAAC4C,YAAY,CAAC9B,IAAI;MAClCC,KAAK,EAAEf,UAAU,CAAC4C,YAAY,CAAC3B;IACnC,CAAE;IACF4B,QAAQ,EAAElC;EAAqB,CAClC,CACwB,CACf,CACrB,EACAR,cAAc,iBACXxC,MAAA,CAAAY,OAAA,CAAAiD,aAAA,CAAC1D,cAAA,CAAAgF,0BAA0B,qBACvBnF,MAAA,CAAAY,OAAA,CAAAiD,aAAA,CAAC1D,cAAA,CAAAiF,+BAA+B,QAC3B5C,cAAc,CAAC6C,KACa,CAAC,eAClCrF,MAAA,CAAAY,OAAA,CAAAiD,aAAA,CAAC1D,cAAA,CAAAmF,yCAAyC,qBAEtCtF,MAAA,CAAAY,OAAA,CAAAiD,aAAA,CAACrD,SAAA,CAAAI,OAAQ,EAAAiB,QAAA;IAAC0D,yBAAyB;EAAA,GAAK/C,cAAc,CAAG,CAClB,CACnB,CAC/B,EACAD,cAAc;EAAA;EACX;EACAvC,MAAA,CAAAY,OAAA,CAAAiD,aAAA,CAACpD,SAAA,CAAAG,OAAQ,EAAK2B,cAAiB,CAElB,CACxB,EACD,CACIA,cAAc,EACdC,cAAc,EACdF,kBAAkB,EAClBU,oBAAoB,EACpBZ,YAAY,EACZC,UAAU,EACVQ,aAAa,CAErB,CAAC;AACL,CAAC;AAEDV,aAAa,CAACqD,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA9E,OAAA,GAE7BuB,aAAa","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.StyledFilterSortText = exports.StyledFilterSort = exports.StyledFilterContent = exports.StyledFilterComboboxWrapper = exports.StyledFilterComboboxInline = void 0;
|
|
6
|
+
exports.StyledFilterSortText = exports.StyledFilterSort = exports.StyledFilterContent = exports.StyledFilterComboboxWrapper = exports.StyledFilterComboboxInlineLabel = exports.StyledFilterComboboxInlineComboboxWrapper = exports.StyledFilterComboboxInline = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const StyledFilterContent = exports.StyledFilterContent = _styledComponents.default.div`
|
|
@@ -38,5 +38,15 @@ const StyledFilterComboboxInline = exports.StyledFilterComboboxInline = _styledC
|
|
|
38
38
|
display: flex;
|
|
39
39
|
justify-content: space-between;
|
|
40
40
|
align-items: center;
|
|
41
|
+
gap: 10px;
|
|
42
|
+
`;
|
|
43
|
+
const StyledFilterComboboxInlineLabel = exports.StyledFilterComboboxInlineLabel = _styledComponents.default.div`
|
|
44
|
+
flex: 0 0 auto;
|
|
45
|
+
`;
|
|
46
|
+
const StyledFilterComboboxInlineComboboxWrapper = exports.StyledFilterComboboxInlineComboboxWrapper = _styledComponents.default.div`
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: end;
|
|
49
|
+
flex: 1 1 auto;
|
|
50
|
+
min-width: 0;
|
|
41
51
|
`;
|
|
42
52
|
//# sourceMappingURL=FilterContent.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterContent.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledFilterContent","exports","styled","div","theme","StyledFilterSort","StyledFilterSortText","StyledFilterComboboxWrapper","$textWidth","StyledFilterComboboxInline"],"sources":["../../../../../src/components/filter/filter-content/FilterContent.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\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 StyledFilterSort = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n`;\n\nexport const StyledFilterSortText = styled.div`\n flex: 0 0 auto;\n`;\n\ntype StyledFilterComboboxWrapperProps = WithTheme<{\n $textWidth: number;\n}>;\n\nexport const StyledFilterComboboxWrapper = styled.div<StyledFilterComboboxWrapperProps>`\n display: flex;\n justify-content: end;\n \n width: ${({ $textWidth }) => `calc(100% - ${$textWidth}px)`}}\n`;\n\nexport const StyledFilterComboboxInline = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKhC,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAGE,yBAAM,CAACC,GAA6B;AACvE,wBAAwB,CAAC;EAAEC;AAAM,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,gBAAgB,GAAAJ,OAAA,CAAAI,gBAAA,GAAGH,yBAAM,CAACC,GAAG;AAC1C;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMG,oBAAoB,GAAAL,OAAA,CAAAK,oBAAA,GAAGJ,yBAAM,CAACC,GAAG;AAC9C;AACA,CAAC;AAMM,MAAMI,2BAA2B,GAAAN,OAAA,CAAAM,2BAAA,GAAGL,yBAAM,CAACC,GAAqC;AACvF;AACA;AACA;AACA,aAAa,CAAC;EAAEK;AAAW,CAAC,KAAK,eAAeA,UAAU,KAAK;AAC/D,CAAC;AAEM,MAAMC,0BAA0B,GAAAR,OAAA,CAAAQ,0BAAA,GAAGP,yBAAM,CAACC,GAAG;AACpD;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FilterContent.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledFilterContent","exports","styled","div","theme","StyledFilterSort","StyledFilterSortText","StyledFilterComboboxWrapper","$textWidth","StyledFilterComboboxInline","StyledFilterComboboxInlineLabel","StyledFilterComboboxInlineComboboxWrapper"],"sources":["../../../../../src/components/filter/filter-content/FilterContent.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\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 StyledFilterSort = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n`;\n\nexport const StyledFilterSortText = styled.div`\n flex: 0 0 auto;\n`;\n\ntype StyledFilterComboboxWrapperProps = WithTheme<{\n $textWidth: number;\n}>;\n\nexport const StyledFilterComboboxWrapper = styled.div<StyledFilterComboboxWrapperProps>`\n display: flex;\n justify-content: end;\n \n width: ${({ $textWidth }) => `calc(100% - ${$textWidth}px)`}}\n`;\n\nexport const StyledFilterComboboxInline = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 10px;\n`;\n\nexport const StyledFilterComboboxInlineLabel = styled.div`\n flex: 0 0 auto;\n`;\n\nexport const StyledFilterComboboxInlineComboboxWrapper = styled.div`\n display: flex;\n justify-content: end;\n flex: 1 1 auto;\n min-width: 0;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKhC,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAGE,yBAAM,CAACC,GAA6B;AACvE,wBAAwB,CAAC;EAAEC;AAAM,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,gBAAgB,GAAAJ,OAAA,CAAAI,gBAAA,GAAGH,yBAAM,CAACC,GAAG;AAC1C;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMG,oBAAoB,GAAAL,OAAA,CAAAK,oBAAA,GAAGJ,yBAAM,CAACC,GAAG;AAC9C;AACA,CAAC;AAMM,MAAMI,2BAA2B,GAAAN,OAAA,CAAAM,2BAAA,GAAGL,yBAAM,CAACC,GAAqC;AACvF;AACA;AACA;AACA,aAAa,CAAC;EAAEK;AAAW,CAAC,KAAK,eAAeA,UAAU,KAAK;AAC/D,CAAC;AAEM,MAAMC,0BAA0B,GAAAR,OAAA,CAAAQ,0BAAA,GAAGP,yBAAM,CAACC,GAAG;AACpD;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMO,+BAA+B,GAAAT,OAAA,CAAAS,+BAAA,GAAGR,yBAAM,CAACC,GAAG;AACzD;AACA,CAAC;AAEM,MAAMQ,yCAAyC,GAAAV,OAAA,CAAAU,yCAAA,GAAGT,yBAAM,CAACC,GAAG;AACnE;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
1
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import { StyledFilterComboboxInline, StyledFilterComboboxWrapper, StyledFilterContent, StyledFilterSort, StyledFilterSortText } from './FilterContent.styles';
|
|
3
|
+
import { StyledFilterComboboxInline, StyledFilterComboboxInlineComboboxWrapper, StyledFilterComboboxInlineLabel, StyledFilterComboboxWrapper, StyledFilterContent, StyledFilterSort, StyledFilterSortText } from './FilterContent.styles';
|
|
3
4
|
import Input from '../../input/Input';
|
|
4
5
|
import Icon from '../../icon/Icon';
|
|
5
6
|
import FilterButtons from '../../filter-buttons/FilterButtons';
|
|
@@ -70,7 +71,9 @@ const FilterContent = ({
|
|
|
70
71
|
value: sortConfig.selectedItem.id
|
|
71
72
|
},
|
|
72
73
|
onSelect: handleSelectSortItem
|
|
73
|
-
}))), comboboxConfig && /*#__PURE__*/React.createElement(StyledFilterComboboxInline, null, comboboxConfig.label, /*#__PURE__*/React.createElement(
|
|
74
|
+
}))), comboboxConfig && /*#__PURE__*/React.createElement(StyledFilterComboboxInline, null, /*#__PURE__*/React.createElement(StyledFilterComboboxInlineLabel, null, comboboxConfig.label), /*#__PURE__*/React.createElement(StyledFilterComboboxInlineComboboxWrapper, null, /*#__PURE__*/React.createElement(ComboBox, _extends({
|
|
75
|
+
shouldUseCurrentItemWidth: true
|
|
76
|
+
}, comboboxConfig)))), checkboxConfig &&
|
|
74
77
|
/*#__PURE__*/
|
|
75
78
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
76
79
|
React.createElement(Checkbox, checkboxConfig)), [checkboxConfig, comboboxConfig, filterButtonConfig, handleSelectSortItem, searchConfig, sortConfig, sortTextWidth]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FIlterContent.js","names":["React","useCallback","useEffect","useMemo","useRef","useState","StyledFilterComboboxInline","StyledFilterComboboxWrapper","StyledFilterContent","StyledFilterSort","StyledFilterSortText","Input","Icon","FilterButtons","ComboBox","Checkbox","FilterContent","searchConfig","sortConfig","filterButtonConfig","checkboxConfig","comboboxConfig","shouldAutoFocus","sortTextRef","searchRef","sortTextWidth","setSortTextWidth","handleSelectSortItem","item","text","value","onSortChange","id","current","clientWidth","focus","createElement","ref","onChange","ev","onSearchChange","target","placeholder","searchValue","shouldShowClearIcon","length","leftElement","icons","$textWidth","lists","list","items","map","selectedItem","onSelect","label","displayName"],"sources":["../../../../../src/components/filter/filter-content/FIlterContent.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n StyledFilterComboboxInline,\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';\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 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 <StyledFilterContent>\n {searchConfig && (\n <Input\n ref={searchRef}\n onChange={(ev) => searchConfig.onSearchChange(ev.target.value)}\n placeholder=\"Suche\"\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}>Sortierung</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 {comboboxConfig.label}\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n
|
|
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","FilterContent","searchConfig","sortConfig","filterButtonConfig","checkboxConfig","comboboxConfig","shouldAutoFocus","sortTextRef","searchRef","sortTextWidth","setSortTextWidth","handleSelectSortItem","item","text","value","onSortChange","id","current","clientWidth","focus","createElement","ref","onChange","ev","onSearchChange","target","placeholder","searchValue","shouldShowClearIcon","length","leftElement","icons","$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';\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 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 <StyledFilterContent>\n {searchConfig && (\n <Input\n ref={searchRef}\n onChange={(ev) => searchConfig.onSearchChange(ev.target.value)}\n placeholder=\"Suche\"\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}>Sortierung</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 ),\n [\n checkboxConfig,\n comboboxConfig,\n filterButtonConfig,\n handleSelectSortItem,\n searchConfig,\n sortConfig,\n sortTextWidth,\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,MAA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AA,CAAAsC,aAAA,CAAC/B,yCAAyC,qBAEtCP,KAAA,CAAAsC,aAAA,CAACtB,QAAQ,EAAA0C,QAAA;IAACC,yBAAyB;EAAA,GAAKpC,cAAc,CAAG,CAClB,CACnB,CAC/B,EACAD,cAAc;EAAA;EACX;EACAtB,KAAA,CAAAsC,aAAA,CAACrB,QAAQ,EAAKK,cAAiB,CAElB,CACxB,EACD,CACIA,cAAc,EACdC,cAAc,EACdF,kBAAkB,EAClBQ,oBAAoB,EACpBV,YAAY,EACZC,UAAU,EACVO,aAAa,CAErB,CAAC;AACL,CAAC;AAEDT,aAAa,CAAC0C,WAAW,GAAG,eAAe;AAE3C,eAAe1C,aAAa","ignoreList":[]}
|
|
@@ -31,5 +31,15 @@ export const StyledFilterComboboxInline = styled.div`
|
|
|
31
31
|
display: flex;
|
|
32
32
|
justify-content: space-between;
|
|
33
33
|
align-items: center;
|
|
34
|
+
gap: 10px;
|
|
35
|
+
`;
|
|
36
|
+
export const StyledFilterComboboxInlineLabel = styled.div`
|
|
37
|
+
flex: 0 0 auto;
|
|
38
|
+
`;
|
|
39
|
+
export const StyledFilterComboboxInlineComboboxWrapper = styled.div`
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: end;
|
|
42
|
+
flex: 1 1 auto;
|
|
43
|
+
min-width: 0;
|
|
34
44
|
`;
|
|
35
45
|
//# sourceMappingURL=FilterContent.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterContent.styles.js","names":["styled","StyledFilterContent","div","theme","StyledFilterSort","StyledFilterSortText","StyledFilterComboboxWrapper","$textWidth","StyledFilterComboboxInline"],"sources":["../../../../../src/components/filter/filter-content/FilterContent.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\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 StyledFilterSort = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n`;\n\nexport const StyledFilterSortText = styled.div`\n flex: 0 0 auto;\n`;\n\ntype StyledFilterComboboxWrapperProps = WithTheme<{\n $textWidth: number;\n}>;\n\nexport const StyledFilterComboboxWrapper = styled.div<StyledFilterComboboxWrapperProps>`\n display: flex;\n justify-content: end;\n \n width: ${({ $textWidth }) => `calc(100% - ${$textWidth}px)`}}\n`;\n\nexport const StyledFilterComboboxInline = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAKtC,OAAO,MAAMC,mBAAmB,GAAGD,MAAM,CAACE,GAA6B;AACvE,wBAAwB,CAAC;EAAEC;AAAM,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAGJ,MAAM,CAACE,GAAG;AAC1C;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMG,oBAAoB,GAAGL,MAAM,CAACE,GAAG;AAC9C;AACA,CAAC;AAMD,OAAO,MAAMI,2BAA2B,GAAGN,MAAM,CAACE,GAAqC;AACvF;AACA;AACA;AACA,aAAa,CAAC;EAAEK;AAAW,CAAC,KAAK,eAAeA,UAAU,KAAK;AAC/D,CAAC;AAED,OAAO,MAAMC,0BAA0B,GAAGR,MAAM,CAACE,GAAG;AACpD;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FilterContent.styles.js","names":["styled","StyledFilterContent","div","theme","StyledFilterSort","StyledFilterSortText","StyledFilterComboboxWrapper","$textWidth","StyledFilterComboboxInline","StyledFilterComboboxInlineLabel","StyledFilterComboboxInlineComboboxWrapper"],"sources":["../../../../../src/components/filter/filter-content/FilterContent.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\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 StyledFilterSort = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n`;\n\nexport const StyledFilterSortText = styled.div`\n flex: 0 0 auto;\n`;\n\ntype StyledFilterComboboxWrapperProps = WithTheme<{\n $textWidth: number;\n}>;\n\nexport const StyledFilterComboboxWrapper = styled.div<StyledFilterComboboxWrapperProps>`\n display: flex;\n justify-content: end;\n \n width: ${({ $textWidth }) => `calc(100% - ${$textWidth}px)`}}\n`;\n\nexport const StyledFilterComboboxInline = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 10px;\n`;\n\nexport const StyledFilterComboboxInlineLabel = styled.div`\n flex: 0 0 auto;\n`;\n\nexport const StyledFilterComboboxInlineComboboxWrapper = styled.div`\n display: flex;\n justify-content: end;\n flex: 1 1 auto;\n min-width: 0;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAKtC,OAAO,MAAMC,mBAAmB,GAAGD,MAAM,CAACE,GAA6B;AACvE,wBAAwB,CAAC;EAAEC;AAAM,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAGJ,MAAM,CAACE,GAAG;AAC1C;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMG,oBAAoB,GAAGL,MAAM,CAACE,GAAG;AAC9C;AACA,CAAC;AAMD,OAAO,MAAMI,2BAA2B,GAAGN,MAAM,CAACE,GAAqC;AACvF;AACA;AACA;AACA,aAAa,CAAC;EAAEK;AAAW,CAAC,KAAK,eAAeA,UAAU,KAAK;AAC/D,CAAC;AAED,OAAO,MAAMC,0BAA0B,GAAGR,MAAM,CAACE,GAAG;AACpD;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMO,+BAA+B,GAAGT,MAAM,CAACE,GAAG;AACzD;AACA,CAAC;AAED,OAAO,MAAMQ,yCAAyC,GAAGV,MAAM,CAACE,GAAG;AACnE;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -9,4 +9,6 @@ type StyledFilterComboboxWrapperProps = WithTheme<{
|
|
|
9
9
|
}>;
|
|
10
10
|
export declare const StyledFilterComboboxWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledFilterComboboxWrapperProps>> & string;
|
|
11
11
|
export declare const StyledFilterComboboxInline: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
12
|
+
export declare const StyledFilterComboboxInlineLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
13
|
+
export declare const StyledFilterComboboxInlineComboboxWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
12
14
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.49",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"browserslist": [
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "15973764e3241195e661613e7e557af0671ca314"
|
|
91
91
|
}
|