@consta/uikit 5.29.2 → 5.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FileCanary/index.d.ts +1 -0
- package/FileCanary/index.js +1 -0
- package/__internal__/src/components/AutoComplete/AutoComplete.js +1 -1
- package/__internal__/src/components/AutoComplete/AutoComplete.js.map +1 -1
- package/__internal__/src/components/AutoComplete/helpers.d.ts +1 -0
- package/__internal__/src/components/AutoComplete/types.d.ts +1 -0
- package/__internal__/src/components/AutoComplete/types.js.map +1 -1
- package/__internal__/src/components/AutoCompleteCanary/AutoCompleteTypeText/AutoCompleteTypeText.js +1 -1
- package/__internal__/src/components/AutoCompleteCanary/AutoCompleteTypeText/AutoCompleteTypeText.js.map +1 -1
- package/__internal__/src/components/AutoCompleteCanary/AutoCompleteTypeTextArray/AutoCompleteTypeTextArray.js +1 -1
- package/__internal__/src/components/AutoCompleteCanary/AutoCompleteTypeTextArray/AutoCompleteTypeTextArray.js.map +1 -1
- package/__internal__/src/components/AutoCompleteCanary/helpers.d.ts +1 -0
- package/__internal__/src/components/AutoCompleteCanary/types.d.ts +1 -0
- package/__internal__/src/components/AutoCompleteCanary/types.js.map +1 -1
- package/__internal__/src/components/Combobox/Combobox.js +1 -1
- package/__internal__/src/components/Combobox/Combobox.js.map +1 -1
- package/__internal__/src/components/Combobox/helpers.d.ts +3 -1
- package/__internal__/src/components/Combobox/helpers.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/ContextMenuLevelWrapper.js +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/ContextMenuLevelWrapper.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuWrapper/ContextMenuWrapper.js +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuWrapper/ContextMenuWrapper.js.map +1 -1
- package/__internal__/src/components/ContextMenu/helpers.d.ts +4 -2
- package/__internal__/src/components/ContextMenu/types.d.ts +3 -0
- package/__internal__/src/components/ContextMenu/types.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerDropdown/DatePickerDropdown.d.ts +1 -0
- package/__internal__/src/components/DatePicker/DatePickerDropdown/DatePickerDropdown.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerDropdown/DatePickerDropdown.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateRange/DatePickerTypeDateRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateRange/DatePickerTypeDateRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateTime/DatePickerTypeDateTime.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateTime/DatePickerTypeDateTime.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateTimeRange/DatePickerTypeDateTimeRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateTimeRange/DatePickerTypeDateTimeRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeMonth/DatePickerTypeMonth.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeMonth/DatePickerTypeMonth.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeMonthRange/DatePickerTypeMonthRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeMonthRange/DatePickerTypeMonthRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeTime/DatePickerTypeTime.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeTime/DatePickerTypeTime.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeYear/DatePickerTypeYear.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeYear/DatePickerTypeYear.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeYearRange/DatePickerTypeYearRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeYearRange/DatePickerTypeYearRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/types.d.ts +1 -0
- package/__internal__/src/components/DatePicker/types.js.map +1 -1
- package/__internal__/src/components/FileCanary/FileCanary.d.ts +1 -0
- package/__internal__/src/components/FileCanary/FileCanary.js +2 -0
- package/__internal__/src/components/FileCanary/FileCanary.js.map +1 -0
- package/__internal__/src/components/FileCanary/FileCanaryBase/FileCanaryBase.css +1 -0
- package/__internal__/src/components/FileCanary/FileCanaryBase/FileCanaryBase.d.ts +4 -0
- package/__internal__/src/components/FileCanary/FileCanaryBase/FileCanaryBase.js +2 -0
- package/__internal__/src/components/FileCanary/FileCanaryBase/FileCanaryBase.js.map +1 -0
- package/__internal__/src/components/FileCanary/config.d.ts +2 -0
- package/__internal__/src/components/FileCanary/config.js +2 -0
- package/__internal__/src/components/FileCanary/config.js.map +1 -0
- package/__internal__/src/components/FileCanary/fileCanaryGenerator.d.ts +2 -0
- package/__internal__/src/components/FileCanary/fileCanaryGenerator.js +2 -0
- package/__internal__/src/components/FileCanary/fileCanaryGenerator.js.map +1 -0
- package/__internal__/src/components/FileCanary/index.d.ts +4 -0
- package/__internal__/src/components/FileCanary/index.js +2 -0
- package/__internal__/src/components/FileCanary/index.js.map +1 -0
- package/__internal__/src/components/FileCanary/types.d.ts +25 -0
- package/__internal__/src/components/FileCanary/types.js +2 -0
- package/__internal__/src/components/FileCanary/types.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelect.js +1 -1
- package/__internal__/src/components/FlatSelect/FlatSelect.js.map +1 -1
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.js +1 -1
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.js.map +1 -1
- package/__internal__/src/components/FlatSelect/types.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/types.js.map +1 -1
- package/__internal__/src/components/Select/Select.js +1 -1
- package/__internal__/src/components/Select/Select.js.map +1 -1
- package/__internal__/src/components/Select/helpers.d.ts +3 -1
- package/__internal__/src/components/Select/helpers.js.map +1 -1
- package/__internal__/src/components/SelectCanary/SelectDropdown/SelectDropdown.d.ts +1 -0
- package/__internal__/src/components/SelectCanary/SelectDropdown/SelectDropdown.js +1 -1
- package/__internal__/src/components/SelectCanary/SelectDropdown/SelectDropdown.js.map +1 -1
- package/__internal__/src/components/SelectCanary/SelectMultiple/SelectMultiple.js +1 -1
- package/__internal__/src/components/SelectCanary/SelectMultiple/SelectMultiple.js.map +1 -1
- package/__internal__/src/components/SelectCanary/SelectMultiple/__test__/SelectMultiple.test.js +1 -1
- package/__internal__/src/components/SelectCanary/SelectMultiple/__test__/SelectMultiple.test.js.map +1 -1
- package/__internal__/src/components/SelectCanary/SelectPopover/SelectPopover.d.ts +1 -0
- package/__internal__/src/components/SelectCanary/SelectPopover/SelectPopover.js +1 -1
- package/__internal__/src/components/SelectCanary/SelectPopover/SelectPopover.js.map +1 -1
- package/__internal__/src/components/SelectCanary/SelectSingle/SelectSingle.js +1 -1
- package/__internal__/src/components/SelectCanary/SelectSingle/SelectSingle.js.map +1 -1
- package/__internal__/src/components/SelectCanary/SelectSingle/__test__/SelectSingle.test.js +1 -1
- package/__internal__/src/components/SelectCanary/SelectSingle/__test__/SelectSingle.test.js.map +1 -1
- package/__internal__/src/components/SelectCanary/helpers.d.ts +2 -1
- package/__internal__/src/components/SelectCanary/types.d.ts +1 -0
- package/__internal__/src/components/SelectCanary/types.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.d.ts +1 -0
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js.map +1 -1
- package/__internal__/src/components/Theme/_font/Silkscreen-Regular.woff +0 -0
- package/__internal__/src/components/Theme/_font/Silkscreen-Regular.woff2 +0 -0
- package/__internal__/src/components/Theme/_font/Theme_font_gpnDefault.css +1 -1
- package/__internal__/src/components/UserSelect/UserSelect.js +1 -1
- package/__internal__/src/components/UserSelect/UserSelect.js.map +1 -1
- package/__internal__/src/components/UserSelect/helpers.d.ts +3 -1
- package/__internal__/src/components/UserSelect/helpers.js.map +1 -1
- package/__internal__/src/hooks/useBodyScrollFreeze/index.d.ts +1 -0
- package/__internal__/src/hooks/useBodyScrollFreeze/index.js +2 -0
- package/__internal__/src/hooks/useBodyScrollFreeze/index.js.map +1 -0
- package/__internal__/src/hooks/useBodyScrollFreeze/useBodyScrollFreeze.css +1 -0
- package/__internal__/src/hooks/useBodyScrollFreeze/useBodyScrollFreeze.d.ts +6 -0
- package/__internal__/src/hooks/useBodyScrollFreeze/useBodyScrollFreeze.js +2 -0
- package/__internal__/src/hooks/useBodyScrollFreeze/useBodyScrollFreeze.js.map +1 -0
- package/__internal__/src/hooks/useHover/index.d.ts +1 -0
- package/__internal__/src/hooks/useHover/index.js +2 -0
- package/__internal__/src/hooks/useHover/index.js.map +1 -0
- package/__internal__/src/hooks/useHover/useHover.d.ts +9 -0
- package/__internal__/src/hooks/useHover/useHover.js +2 -0
- package/__internal__/src/hooks/useHover/useHover.js.map +1 -0
- package/package.json +2 -2
- package/useBodyScrollFreeze/index.d.ts +1 -0
- package/useBodyScrollFreeze/index.js +1 -0
- package/useHover/index.d.ts +1 -0
- package/useHover/index.js +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerTypeYearRange.js","names":["addYears","startOfDecade","React","forwardRef","useEffect","useRef","useState","useClickOutside","useForkRef","DatePickerDropdown","DatePickerFieldTypeYearRange","getDropdownZIndex","normalizeRangeValue","datePickerPropDateTimeViewDefault","useCalendarVisible","useCurrentVisibleDate","DatePickerTypeYearRange","props","ref","events","dateTimeView","locale","dropdownForm","onFocus","onBlur","dropdownClassName","dropdownRef","leftSide","rightSide","currentVisibleDateProp","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","inputRef","name","placeholder","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates","dropdownViewportRef","fieldProps","startFieldRef","endFieldRef","startFieldInputRef","endFieldInputRef","calendarRef","fieldFocused","setFieldFocused","startFocused","endFocused","startRef","endRef","calendarVisible","setCalendarVisible","maxDate","minDate","value","startOfUnit","rangeIndex","setCurrentVisibleDate","newVisibleDate","getTime","isActive","ignoreClicksInsideRefs","handler","off","startFieldOnFocusHandler","e","Array","isArray","endFieldOnFocusHandler","startFieldOnBlurHandler","endFieldOnBlurHandler","on","handleChange","newValue","onChange","style"],"sources":["../../../../../../src/components/DatePicker/DatePickerTypeYearRange/DatePickerTypeYearRange.tsx"],"sourcesContent":["import { addYears, startOfDecade } from 'date-fns';\nimport React, { forwardRef, useEffect, useRef, useState } from 'react';\n\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useForkRef } from '##/hooks/useForkRef';\n\nimport {\n DatePickerDropdown,\n DatePickerDropdownPropOnChange,\n} from '../DatePickerDropdown/DatePickerDropdown';\nimport { DatePickerFieldTypeYearRange } from '../DatePickerFieldTypeYearRange/DatePickerFieldTypeYearRange';\nimport { getDropdownZIndex, normalizeRangeValue } from '../helpers';\nimport {\n datePickerPropDateTimeViewDefault,\n DatePickerTypeComponent,\n} from '../types';\nimport { useCalendarVisible } from '../useCalendarVisible';\nimport { useCurrentVisibleDate } from '../useCurrentVisibleDate';\n\nexport const DatePickerTypeYearRange: DatePickerTypeComponent<'date-range'> =\n forwardRef((props, ref) => {\n const {\n events,\n dateTimeView = datePickerPropDateTimeViewDefault,\n locale,\n dropdownForm,\n onFocus,\n onBlur,\n dropdownClassName,\n dropdownRef,\n leftSide,\n rightSide,\n currentVisibleDate: currentVisibleDateProp,\n onChangeCurrentVisibleDate,\n renderAdditionalControls,\n inputRef,\n name,\n placeholder,\n onDropdownOpen,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n disabled,\n disableDates,\n dropdownViewportRef,\n ...fieldProps\n } = props;\n\n const startFieldRef = useRef<HTMLDivElement>(null);\n const endFieldRef = useRef<HTMLDivElement>(null);\n const startFieldInputRef = useRef<HTMLInputElement>(null);\n const endFieldInputRef = useRef<HTMLInputElement>(null);\n const calendarRef = useRef<HTMLDivElement>(null);\n\n const [fieldFocused, setFieldFocused] = useState<0 | 1 | undefined>();\n\n const startFocused = fieldFocused === 0;\n const endFocused = fieldFocused === 1;\n\n const handleChange: DatePickerDropdownPropOnChange = (value, { e }) => {\n if (startFocused) {\n const newValue = normalizeRangeValue([value, props?.value?.[1]]);\n props.onChange?.(newValue, {\n e,\n });\n }\n if (endFocused) {\n const newValue = normalizeRangeValue([props?.value?.[0], value]);\n props.onChange?.(newValue, {\n e,\n });\n }\n };\n\n const [calendarVisible, setCalendarVisible] = useCalendarVisible({\n dropdownOpen,\n onDropdownOpen,\n disabled,\n startRef: startFieldInputRef,\n endRef: endFieldInputRef,\n });\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate: props.maxDate,\n minDate: props.minDate,\n value: props.value,\n startOfUnit: startOfDecade,\n onChangeCurrentVisibleDate,\n calendarVisible,\n rangeIndex: fieldFocused,\n });\n\n const startFieldOnBlurHandler = (e: React.FocusEvent<HTMLElement>) =>\n Array.isArray(onBlur) ? onBlur[0]?.(e) : onBlur?.(e);\n\n const endFieldOnBlurHandler = (e: React.FocusEvent<HTMLElement>) =>\n Array.isArray(onBlur) ? onBlur[1]?.(e) : onBlur?.(e);\n\n const startFieldOnFocusHandler = (e: React.FocusEvent<HTMLElement>) => {\n setFieldFocused(0);\n Array.isArray(onFocus) ? onFocus[0]?.(e) : onFocus?.(e);\n };\n\n const endFieldOnFocusHandler = (e: React.FocusEvent<HTMLElement>) => {\n setFieldFocused(1);\n Array.isArray(onFocus) ? onFocus[1]?.(e) : onFocus?.(e);\n };\n\n // эффект для того чтобы календарь переключался при вводе с клавиатуры\n useEffect(() => {\n if (props.value?.[0] && dateTimeView === 'classic' && startFocused) {\n const newVisibleDate = startOfDecade(props.value[0]);\n if (newVisibleDate.getTime() !== currentVisibleDate?.getTime()) {\n setCurrentVisibleDate(newVisibleDate);\n }\n return;\n }\n if (props.value?.[0] && dateTimeView !== 'classic' && startFocused) {\n const newVisibleDate = startOfDecade(props.value[0]);\n if (\n newVisibleDate.getTime() !== currentVisibleDate?.getTime() &&\n newVisibleDate.getTime() !==\n (currentVisibleDate && addYears(currentVisibleDate, 10).getTime())\n ) {\n setCurrentVisibleDate(newVisibleDate);\n }\n }\n }, [props.value?.[0]?.getTime(), calendarVisible, startFocused]);\n\n useEffect(() => {\n if (props.value?.[1] && dateTimeView === 'classic' && endFocused) {\n const newVisibleDate = startOfDecade(props.value[1]);\n if (newVisibleDate.getTime() !== currentVisibleDate?.getTime()) {\n setCurrentVisibleDate(newVisibleDate);\n }\n return;\n }\n if (props.value?.[1] && dateTimeView !== 'classic' && endFocused) {\n const newVisibleDate = startOfDecade(props.value[1]);\n if (\n newVisibleDate.getTime() !== currentVisibleDate?.getTime() &&\n newVisibleDate.getTime() !==\n (currentVisibleDate && addYears(currentVisibleDate, 10).getTime())\n ) {\n setCurrentVisibleDate(addYears(newVisibleDate, -10));\n }\n }\n }, [props.value?.[1]?.getTime(), calendarVisible, endFocused]);\n\n useClickOutside({\n isActive: calendarVisible,\n ignoreClicksInsideRefs: [\n startFieldRef,\n endFieldRef,\n calendarRef,\n ...(ignoreOutsideClicksRefs ?? []),\n ],\n handler: () => {\n setFieldFocused(undefined);\n setCalendarVisible.off();\n },\n });\n\n return (\n <>\n <DatePickerFieldTypeYearRange\n {...fieldProps}\n ref={ref}\n startFieldRef={startFieldRef}\n endFieldRef={endFieldRef}\n startFieldInputRef={useForkRef([startFieldInputRef, inputRef?.[0]])}\n endFieldInputRef={useForkRef([endFieldInputRef, inputRef?.[1]])}\n startFieldOnFocus={startFieldOnFocusHandler}\n endFieldOnFocus={endFieldOnFocusHandler}\n startFieldLeftSide={\n Array.isArray(leftSide) ? leftSide?.[0] : leftSide\n }\n startFieldRightSide={\n Array.isArray(rightSide) ? rightSide?.[0] : undefined\n }\n endFieldLeftSide={Array.isArray(leftSide) ? leftSide?.[1] : undefined}\n endFieldRightSide={\n Array.isArray(rightSide) ? rightSide?.[1] : rightSide\n }\n startFieldOnBlur={startFieldOnBlurHandler}\n endFieldOnBlur={endFieldOnBlurHandler}\n startFocused={startFocused}\n endFocused={endFocused}\n startFieldOnClick={setCalendarVisible.on}\n endFieldOnClick={setCalendarVisible.on}\n startFieldName={Array.isArray(name) ? name[0] : `${name}_start`}\n endFieldName={Array.isArray(name) ? name[1] : `${name}_end`}\n disabled={disabled}\n startFieldPlaceholder={\n Array.isArray(placeholder) ? placeholder?.[0] : placeholder\n }\n endFieldPlaceholder={\n Array.isArray(placeholder) ? placeholder?.[1] : placeholder\n }\n />\n <DatePickerDropdown\n type=\"year\"\n ref={useForkRef([dropdownRef, calendarRef])}\n viewportRef={dropdownViewportRef}\n anchorRef={startFieldRef}\n isOpen={calendarVisible}\n onChangeCurrentVisibleDate={setCurrentVisibleDate}\n currentVisibleDate={currentVisibleDate}\n value={props.value || undefined}\n view={dateTimeView}\n events={events}\n locale={locale}\n className={dropdownClassName}\n minDate={props.minDate}\n maxDate={props.maxDate}\n form={dropdownForm}\n onChange={handleChange}\n renderAdditionalControls={renderAdditionalControls}\n zIndex={getDropdownZIndex(props.style)}\n disableDates={disableDates}\n />\n </>\n );\n });\n"],"mappings":"kkBAAA,OAASA,QAAT,CAAmBC,aAAnB,KAAwC,UAAxC,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,CAAuCC,MAAvC,CAA+CC,QAA/C,KAA+D,OAA/D,CAEA,OAASC,eAAT,sCACA,OAASC,UAAT,iCAEA,OACEC,kBADF,gDAIA,OAASC,4BAAT,oEACA,OAASC,iBAAT,CAA4BC,mBAA5B,kBACA,OACEC,iCADF,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CAQE,KAAK,CAAEb,CAAK,CAACyC,KAAN,QART,CASE,IAAI,CAAEtC,CATR,CAUE,MAAM,CAAED,CAVV,CAWE,MAAM,CAAEE,CAXV,CAYE,SAAS,CAAEI,CAZb,CAaE,OAAO,CAAER,CAAK,CAACwC,OAbjB,CAcE,OAAO,CAAExC,CAAK,CAACuC,OAdjB,CAeE,IAAI,CAAElC,CAfR,CAgBE,QAAQ,CA9JuC,QAA/CsD,aAA+C,CAAClB,CAAD,GAAkB,IAARW,EAAQ,GAARA,CAAQ,CACrE,GAAInB,CAAJ,CAAkB,SACV2B,CAAQ,CAAGjE,mBAAmB,CAAC,CAAC8C,CAAD,QAAQzC,CAAR,WAAQA,CAAR,YAAQA,CAAK,CAAEyC,KAAf,qBAAQ,EAAe,CAAf,CAAR,CAAD,CADpB,WAEhBzC,CAAK,CAAC6D,QAFU,qBAEhB,OAAA7D,CAAK,CAAY4D,CAAZ,CAAsB,CACzBR,CAAC,CAADA,CADyB,CAAtB,CAGN,CACD,GAAIlB,CAAJ,CAAgB,SACR0B,CAAQ,CAAGjE,mBAAmB,CAAC,QAACK,CAAD,WAACA,CAAD,YAACA,CAAK,CAAEyC,KAAR,qBAAC,EAAe,CAAf,CAAD,CAAoBA,CAApB,CAAD,CADtB,WAEdzC,CAAK,CAAC6D,QAFQ,qBAEd,OAAA7D,CAAK,CAAY4D,CAAZ,CAAsB,CACzBR,CAAC,CAADA,CADyB,CAAtB,CAGN,CACF,CAiIG,CAiBE,wBAAwB,CAAErC,CAjB5B,CAkBE,MAAM,CAAErB,iBAAiB,CAACM,CAAK,CAAC8D,KAAP,CAlB3B,CAmBE,YAAY,CAAEvC,CAnBhB,EApCF,CA2DH,CA3MS,CADL"}
|
|
1
|
+
{"version":3,"file":"DatePickerTypeYearRange.js","names":["addYears","startOfDecade","React","forwardRef","useEffect","useRef","useState","useClickOutside","useForkRef","DatePickerDropdown","DatePickerFieldTypeYearRange","getDropdownZIndex","normalizeRangeValue","datePickerPropDateTimeViewDefault","useCalendarVisible","useCurrentVisibleDate","DatePickerTypeYearRange","props","ref","events","dateTimeView","locale","dropdownForm","onFocus","onBlur","dropdownClassName","dropdownRef","leftSide","rightSide","currentVisibleDateProp","currentVisibleDate","onChangeCurrentVisibleDate","renderAdditionalControls","inputRef","name","placeholder","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","disableDates","dropdownViewportRef","dropdownContainer","fieldProps","startFieldRef","endFieldRef","startFieldInputRef","endFieldInputRef","calendarRef","fieldFocused","setFieldFocused","startFocused","endFocused","startRef","endRef","calendarVisible","setCalendarVisible","maxDate","minDate","value","startOfUnit","rangeIndex","setCurrentVisibleDate","newVisibleDate","getTime","isActive","ignoreClicksInsideRefs","handler","off","startFieldOnFocusHandler","e","Array","isArray","endFieldOnFocusHandler","startFieldOnBlurHandler","endFieldOnBlurHandler","on","handleChange","newValue","onChange","style"],"sources":["../../../../../../src/components/DatePicker/DatePickerTypeYearRange/DatePickerTypeYearRange.tsx"],"sourcesContent":["import { addYears, startOfDecade } from 'date-fns';\nimport React, { forwardRef, useEffect, useRef, useState } from 'react';\n\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useForkRef } from '##/hooks/useForkRef';\n\nimport {\n DatePickerDropdown,\n DatePickerDropdownPropOnChange,\n} from '../DatePickerDropdown/DatePickerDropdown';\nimport { DatePickerFieldTypeYearRange } from '../DatePickerFieldTypeYearRange/DatePickerFieldTypeYearRange';\nimport { getDropdownZIndex, normalizeRangeValue } from '../helpers';\nimport {\n datePickerPropDateTimeViewDefault,\n DatePickerTypeComponent,\n} from '../types';\nimport { useCalendarVisible } from '../useCalendarVisible';\nimport { useCurrentVisibleDate } from '../useCurrentVisibleDate';\n\nexport const DatePickerTypeYearRange: DatePickerTypeComponent<'date-range'> =\n forwardRef((props, ref) => {\n const {\n events,\n dateTimeView = datePickerPropDateTimeViewDefault,\n locale,\n dropdownForm,\n onFocus,\n onBlur,\n dropdownClassName,\n dropdownRef,\n leftSide,\n rightSide,\n currentVisibleDate: currentVisibleDateProp,\n onChangeCurrentVisibleDate,\n renderAdditionalControls,\n inputRef,\n name,\n placeholder,\n onDropdownOpen,\n dropdownOpen,\n ignoreOutsideClicksRefs,\n disabled,\n disableDates,\n dropdownViewportRef,\n dropdownContainer,\n ...fieldProps\n } = props;\n\n const startFieldRef = useRef<HTMLDivElement>(null);\n const endFieldRef = useRef<HTMLDivElement>(null);\n const startFieldInputRef = useRef<HTMLInputElement>(null);\n const endFieldInputRef = useRef<HTMLInputElement>(null);\n const calendarRef = useRef<HTMLDivElement>(null);\n\n const [fieldFocused, setFieldFocused] = useState<0 | 1 | undefined>();\n\n const startFocused = fieldFocused === 0;\n const endFocused = fieldFocused === 1;\n\n const handleChange: DatePickerDropdownPropOnChange = (value, { e }) => {\n if (startFocused) {\n const newValue = normalizeRangeValue([value, props?.value?.[1]]);\n props.onChange?.(newValue, {\n e,\n });\n }\n if (endFocused) {\n const newValue = normalizeRangeValue([props?.value?.[0], value]);\n props.onChange?.(newValue, {\n e,\n });\n }\n };\n\n const [calendarVisible, setCalendarVisible] = useCalendarVisible({\n dropdownOpen,\n onDropdownOpen,\n disabled,\n startRef: startFieldInputRef,\n endRef: endFieldInputRef,\n });\n\n const [currentVisibleDate, setCurrentVisibleDate] = useCurrentVisibleDate({\n currentVisibleDate: currentVisibleDateProp,\n maxDate: props.maxDate,\n minDate: props.minDate,\n value: props.value,\n startOfUnit: startOfDecade,\n onChangeCurrentVisibleDate,\n calendarVisible,\n rangeIndex: fieldFocused,\n });\n\n const startFieldOnBlurHandler = (e: React.FocusEvent<HTMLElement>) =>\n Array.isArray(onBlur) ? onBlur[0]?.(e) : onBlur?.(e);\n\n const endFieldOnBlurHandler = (e: React.FocusEvent<HTMLElement>) =>\n Array.isArray(onBlur) ? onBlur[1]?.(e) : onBlur?.(e);\n\n const startFieldOnFocusHandler = (e: React.FocusEvent<HTMLElement>) => {\n setFieldFocused(0);\n Array.isArray(onFocus) ? onFocus[0]?.(e) : onFocus?.(e);\n };\n\n const endFieldOnFocusHandler = (e: React.FocusEvent<HTMLElement>) => {\n setFieldFocused(1);\n Array.isArray(onFocus) ? onFocus[1]?.(e) : onFocus?.(e);\n };\n\n // эффект для того чтобы календарь переключался при вводе с клавиатуры\n useEffect(() => {\n if (props.value?.[0] && dateTimeView === 'classic' && startFocused) {\n const newVisibleDate = startOfDecade(props.value[0]);\n if (newVisibleDate.getTime() !== currentVisibleDate?.getTime()) {\n setCurrentVisibleDate(newVisibleDate);\n }\n return;\n }\n if (props.value?.[0] && dateTimeView !== 'classic' && startFocused) {\n const newVisibleDate = startOfDecade(props.value[0]);\n if (\n newVisibleDate.getTime() !== currentVisibleDate?.getTime() &&\n newVisibleDate.getTime() !==\n (currentVisibleDate && addYears(currentVisibleDate, 10).getTime())\n ) {\n setCurrentVisibleDate(newVisibleDate);\n }\n }\n }, [props.value?.[0]?.getTime(), calendarVisible, startFocused]);\n\n useEffect(() => {\n if (props.value?.[1] && dateTimeView === 'classic' && endFocused) {\n const newVisibleDate = startOfDecade(props.value[1]);\n if (newVisibleDate.getTime() !== currentVisibleDate?.getTime()) {\n setCurrentVisibleDate(newVisibleDate);\n }\n return;\n }\n if (props.value?.[1] && dateTimeView !== 'classic' && endFocused) {\n const newVisibleDate = startOfDecade(props.value[1]);\n if (\n newVisibleDate.getTime() !== currentVisibleDate?.getTime() &&\n newVisibleDate.getTime() !==\n (currentVisibleDate && addYears(currentVisibleDate, 10).getTime())\n ) {\n setCurrentVisibleDate(addYears(newVisibleDate, -10));\n }\n }\n }, [props.value?.[1]?.getTime(), calendarVisible, endFocused]);\n\n useClickOutside({\n isActive: calendarVisible,\n ignoreClicksInsideRefs: [\n startFieldRef,\n endFieldRef,\n calendarRef,\n ...(ignoreOutsideClicksRefs ?? []),\n ],\n handler: () => {\n setFieldFocused(undefined);\n setCalendarVisible.off();\n },\n });\n\n return (\n <>\n <DatePickerFieldTypeYearRange\n {...fieldProps}\n ref={ref}\n startFieldRef={startFieldRef}\n endFieldRef={endFieldRef}\n startFieldInputRef={useForkRef([startFieldInputRef, inputRef?.[0]])}\n endFieldInputRef={useForkRef([endFieldInputRef, inputRef?.[1]])}\n startFieldOnFocus={startFieldOnFocusHandler}\n endFieldOnFocus={endFieldOnFocusHandler}\n startFieldLeftSide={\n Array.isArray(leftSide) ? leftSide?.[0] : leftSide\n }\n startFieldRightSide={\n Array.isArray(rightSide) ? rightSide?.[0] : undefined\n }\n endFieldLeftSide={Array.isArray(leftSide) ? leftSide?.[1] : undefined}\n endFieldRightSide={\n Array.isArray(rightSide) ? rightSide?.[1] : rightSide\n }\n startFieldOnBlur={startFieldOnBlurHandler}\n endFieldOnBlur={endFieldOnBlurHandler}\n startFocused={startFocused}\n endFocused={endFocused}\n startFieldOnClick={setCalendarVisible.on}\n endFieldOnClick={setCalendarVisible.on}\n startFieldName={Array.isArray(name) ? name[0] : `${name}_start`}\n endFieldName={Array.isArray(name) ? name[1] : `${name}_end`}\n disabled={disabled}\n startFieldPlaceholder={\n Array.isArray(placeholder) ? placeholder?.[0] : placeholder\n }\n endFieldPlaceholder={\n Array.isArray(placeholder) ? placeholder?.[1] : placeholder\n }\n />\n <DatePickerDropdown\n type=\"year\"\n ref={useForkRef([dropdownRef, calendarRef])}\n viewportRef={dropdownViewportRef}\n anchorRef={startFieldRef}\n isOpen={calendarVisible}\n onChangeCurrentVisibleDate={setCurrentVisibleDate}\n currentVisibleDate={currentVisibleDate}\n value={props.value || undefined}\n view={dateTimeView}\n events={events}\n locale={locale}\n className={dropdownClassName}\n minDate={props.minDate}\n maxDate={props.maxDate}\n form={dropdownForm}\n onChange={handleChange}\n renderAdditionalControls={renderAdditionalControls}\n zIndex={getDropdownZIndex(props.style)}\n disableDates={disableDates}\n container={dropdownContainer}\n />\n </>\n );\n });\n"],"mappings":"slBAAA,OAASA,QAAT,CAAmBC,aAAnB,KAAwC,UAAxC,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,CAAuCC,MAAvC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CAlB3B,CAmBE,YAAY,CAAExC,CAnBhB,CAoBE,SAAS,CAAEE,CApBb,EApCF,CA4DH,CA7MS,CADL"}
|
|
@@ -96,6 +96,7 @@ export type DatePickerProps<TYPE extends DatePickerPropType = 'date'> = PropsWit
|
|
|
96
96
|
dropdownOpen?: boolean;
|
|
97
97
|
ignoreOutsideClicksRefs?: ReadonlyArray<React.RefObject<HTMLElement>>;
|
|
98
98
|
dropdownViewportRef?: React.RefObject<HTMLElement>;
|
|
99
|
+
dropdownContainer?: Element;
|
|
99
100
|
}, HTMLDivElement>;
|
|
100
101
|
export type DatePickerComponent = <TYPE extends DatePickerPropType = 'date'>(props: DatePickerProps<TYPE>) => React.ReactNode | null;
|
|
101
102
|
export type DatePickerTypeComponent<TYPE extends DatePickerPropType> = (props: Omit<DatePickerProps<TYPE>, 'type'>) => React.ReactNode | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["dateTimePropViewDefault","datePickerPropType","datePickerPropTypeDefault","datePickerPropDateTimeViewDefault","datePickerErrorTypes","datePickerPropDropdownForm","datePickerPropDropdownFormDefault"],"sources":["../../../../../src/components/DatePicker/types.ts"],"sourcesContent":["import { IconComponent, IconPropSize } from '@consta/icons/Icon';\nimport { Locale } from 'date-fns';\n\nimport { DateRange } from '../../utils/types/Date';\nimport { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\nimport {\n DateTimePropDisableDates,\n DateTimePropView,\n dateTimePropViewDefault,\n TimeOptions,\n} from '../DateTime/helpers';\nimport {\n TextFieldPropForm,\n TextFieldPropSize,\n TextFieldPropStatus,\n TextFieldPropView,\n} from '../TextField/TextField';\n\nexport const datePickerPropType = [\n 'date',\n 'date-range',\n 'date-time',\n 'date-time-range',\n 'time',\n 'year',\n 'year-range',\n 'month',\n 'month-range',\n] as const;\n\nexport type DatePickerPropType = typeof datePickerPropType[number];\nexport const datePickerPropTypeDefault = datePickerPropType[0];\n\nexport type DatePickerPropDateTimeView = DateTimePropView;\nexport const datePickerPropDateTimeViewDefault = dateTimePropViewDefault;\n\ntype Range = 'date-range' | 'date-time-range' | 'year-range' | 'month-range';\ntype Time = 'time' | 'date-time' | 'date-time-range';\n\nexport const datePickerErrorTypes = [\n 'outOfRange',\n 'invalidInputAttempt',\n 'startDateIsGreaterThanEndDate',\n 'invalidTimeByTimeOptions',\n] as const;\n\nexport type DatePickerPropValue<TYPE extends DatePickerPropType> =\n | (TYPE extends Range ? DateRange : Date)\n | null;\n\nexport type DatePickerPropPlaceholder<TYPE> = TYPE extends Range\n ? [string?, string?] | string\n : string;\n\nexport type DatePickerPropOnChange<TYPE extends DatePickerPropType> = (\n value: DatePickerPropValue<TYPE>,\n props: {\n e: React.MouseEvent<HTMLButtonElement, MouseEvent> | Event;\n },\n) => void;\n\nexport const datePickerPropDropdownForm = [\n 'default',\n 'brick',\n 'round',\n] as const;\nexport type DatePickerPropDropdownForm =\n typeof datePickerPropDropdownForm[number];\nexport const datePickerPropDropdownFormDefault = datePickerPropDropdownForm[0];\n\ntype DatePickerPropInputRef<TYPE> = TYPE extends Range\n ? [React.Ref<HTMLInputElement>?, React.Ref<HTMLInputElement>?]\n : React.Ref<HTMLInputElement>;\n\ntype DatePickerPropSide<TYPE> = TYPE extends Range\n ?\n | [(string | IconComponent)?, (string | IconComponent)?]\n | string\n | IconComponent\n : string | IconComponent;\n\ntype DatePickerPropOnFocus<TYPE> = TYPE extends Range\n ?\n | [\n React.FocusEventHandler<HTMLElement>?,\n React.FocusEventHandler<HTMLElement>?,\n ]\n | React.FocusEventHandler<HTMLElement>\n : React.FocusEventHandler<HTMLElement>;\n\ntype DatePickerPropName<TYPE> = TYPE extends Range\n ? [string?, string?] | string\n : string;\n\nexport type DatePickerAdditionalControlRenderFn = (props: {\n currentVisibleDate?: Date;\n}) => React.ReactNode | React.ReactNode[];\n\nexport type DatePickerAdditionalControlRenderProp =\n | React.ReactNode\n | DatePickerAdditionalControlRenderFn;\n\nexport type DatePickerProps<TYPE extends DatePickerPropType = 'date'> =\n PropsWithHTMLAttributesAndRef<\n {\n type?: TYPE;\n value?: DatePickerPropValue<TYPE>;\n onChange?: DatePickerPropOnChange<TYPE>;\n minDate?: Date;\n maxDate?: Date;\n renderAdditionalControls?: DatePickerAdditionalControlRenderProp;\n events?: Date[];\n dateTimeView?: DatePickerPropDateTimeView;\n locale?: Locale;\n children?: never;\n onError?: DatePickerPropOnError;\n id?: string;\n name?: DatePickerPropName<TYPE>;\n disabled?: boolean;\n disableDates?: DateTimePropDisableDates;\n dropdownClassName?: string;\n dropdownRef?: React.Ref<HTMLDivElement>;\n size?: TextFieldPropSize;\n view?: TextFieldPropView;\n form?: TextFieldPropForm;\n status?: TextFieldPropStatus;\n onFocus?: DatePickerPropOnFocus<TYPE>;\n onBlur?: DatePickerPropOnFocus<TYPE>;\n autoFocus?: boolean;\n placeholder?: DatePickerPropPlaceholder<TYPE>;\n readOnly?: boolean;\n required?: boolean;\n tabIndex?: number;\n inputRef?: DatePickerPropInputRef<TYPE>;\n ariaLabel?: string;\n iconSize?: IconPropSize;\n format?: string;\n separator?: string;\n dropdownForm?: DatePickerPropDropdownForm;\n leftSide?: DatePickerPropSide<TYPE>;\n rightSide?: DatePickerPropSide<TYPE>;\n label?: string;\n labelIcon?: IconComponent;\n caption?: string;\n labelPosition?: 'top' | 'left';\n onChangeCurrentVisibleDate?: (date: Date) => void;\n currentVisibleDate?: Date;\n timeOptions?: TYPE extends Time ? TimeOptions : never;\n /**\n * @deprecated Use timeOptions instead.\n * TODO: major - удалить при мажорном релизе все свойства multiplicity*, оставив только работу с timeOptions.\n */\n multiplicitySeconds?: TYPE extends Time ? number : never;\n /**\n * @deprecated Use timeOptions instead.\n * TODO: major - удалить при мажорном релизе все свойства multiplicity*, оставив только работу с timeOptions.\n */\n multiplicityMinutes?: TYPE extends Time ? number : never;\n /**\n * @deprecated Use timeOptions instead.\n * TODO: major - удалить при мажорном релизе все свойства multiplicity*, оставив только работу с timeOptions.\n */\n multiplicityHours?: TYPE extends Time ? number : never;\n isMobile?: number;\n withClearButton?: boolean;\n onDropdownOpen?: (isOpen: boolean) => void;\n dropdownOpen?: boolean;\n ignoreOutsideClicksRefs?: ReadonlyArray<React.RefObject<HTMLElement>>;\n dropdownViewportRef?: React.RefObject<HTMLElement>;\n },\n HTMLDivElement\n >;\n\nexport type DatePickerComponent = <TYPE extends DatePickerPropType = 'date'>(\n props: DatePickerProps<TYPE>,\n) => React.ReactNode | null;\n\nexport type DatePickerTypeComponent<TYPE extends DatePickerPropType> = (\n props: Omit<DatePickerProps<TYPE>, 'type'>,\n) => React.ReactNode | null;\n\nexport type DatePickerPropOnError = (\n props:\n | {\n type: typeof datePickerErrorTypes[0];\n stringValue: string;\n dd?: string;\n MM?: string;\n yyyy?: string;\n ss?: string;\n mm?: string;\n HH?: string;\n date: Date;\n }\n | {\n type: typeof datePickerErrorTypes[1];\n stringValue: string;\n dd?: string;\n MM?: string;\n yyyy?: string;\n ss?: string;\n mm?: string;\n HH?: string;\n }\n | {\n type: typeof datePickerErrorTypes[2];\n date: [Date, Date];\n }\n | {\n type: typeof datePickerErrorTypes[3];\n stringValue: string;\n date: Date;\n HH?: string;\n mm?: string;\n ss?: string;\n },\n) => void;\n"],"mappings":"AAKA,OAGEA,uBAHF,2BAaA,MAAO,IAAMC,mBAAkB,CAAG,CAChC,MADgC,CAEhC,YAFgC,CAGhC,WAHgC,CAIhC,iBAJgC,CAKhC,MALgC,CAMhC,MANgC,CAOhC,YAPgC,CAQhC,OARgC,CAShC,aATgC,CAA3B,CAaP,MAAO,IAAMC,0BAAyB,CAAGD,kBAAkB,CAAC,CAAD,CAApD,CAGP,MAAO,IAAME,kCAAiC,CAAGH,uBAA1C,CAKP,MAAO,IAAMI,qBAAoB,CAAG,CAClC,YADkC,CAElC,qBAFkC,CAGlC,+BAHkC,CAIlC,0BAJkC,CAA7B,CAsBP,MAAO,IAAMC,2BAA0B,CAAG,CACxC,SADwC,CAExC,OAFwC,CAGxC,OAHwC,CAAnC,CAOP,MAAO,IAAMC,kCAAiC,CAAGD,0BAA0B,CAAC,CAAD,CAApE"}
|
|
1
|
+
{"version":3,"file":"types.js","names":["dateTimePropViewDefault","datePickerPropType","datePickerPropTypeDefault","datePickerPropDateTimeViewDefault","datePickerErrorTypes","datePickerPropDropdownForm","datePickerPropDropdownFormDefault"],"sources":["../../../../../src/components/DatePicker/types.ts"],"sourcesContent":["import { IconComponent, IconPropSize } from '@consta/icons/Icon';\nimport { Locale } from 'date-fns';\n\nimport { DateRange } from '../../utils/types/Date';\nimport { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\nimport {\n DateTimePropDisableDates,\n DateTimePropView,\n dateTimePropViewDefault,\n TimeOptions,\n} from '../DateTime/helpers';\nimport {\n TextFieldPropForm,\n TextFieldPropSize,\n TextFieldPropStatus,\n TextFieldPropView,\n} from '../TextField/TextField';\n\nexport const datePickerPropType = [\n 'date',\n 'date-range',\n 'date-time',\n 'date-time-range',\n 'time',\n 'year',\n 'year-range',\n 'month',\n 'month-range',\n] as const;\n\nexport type DatePickerPropType = typeof datePickerPropType[number];\nexport const datePickerPropTypeDefault = datePickerPropType[0];\n\nexport type DatePickerPropDateTimeView = DateTimePropView;\nexport const datePickerPropDateTimeViewDefault = dateTimePropViewDefault;\n\ntype Range = 'date-range' | 'date-time-range' | 'year-range' | 'month-range';\ntype Time = 'time' | 'date-time' | 'date-time-range';\n\nexport const datePickerErrorTypes = [\n 'outOfRange',\n 'invalidInputAttempt',\n 'startDateIsGreaterThanEndDate',\n 'invalidTimeByTimeOptions',\n] as const;\n\nexport type DatePickerPropValue<TYPE extends DatePickerPropType> =\n | (TYPE extends Range ? DateRange : Date)\n | null;\n\nexport type DatePickerPropPlaceholder<TYPE> = TYPE extends Range\n ? [string?, string?] | string\n : string;\n\nexport type DatePickerPropOnChange<TYPE extends DatePickerPropType> = (\n value: DatePickerPropValue<TYPE>,\n props: {\n e: React.MouseEvent<HTMLButtonElement, MouseEvent> | Event;\n },\n) => void;\n\nexport const datePickerPropDropdownForm = [\n 'default',\n 'brick',\n 'round',\n] as const;\nexport type DatePickerPropDropdownForm =\n typeof datePickerPropDropdownForm[number];\nexport const datePickerPropDropdownFormDefault = datePickerPropDropdownForm[0];\n\ntype DatePickerPropInputRef<TYPE> = TYPE extends Range\n ? [React.Ref<HTMLInputElement>?, React.Ref<HTMLInputElement>?]\n : React.Ref<HTMLInputElement>;\n\ntype DatePickerPropSide<TYPE> = TYPE extends Range\n ?\n | [(string | IconComponent)?, (string | IconComponent)?]\n | string\n | IconComponent\n : string | IconComponent;\n\ntype DatePickerPropOnFocus<TYPE> = TYPE extends Range\n ?\n | [\n React.FocusEventHandler<HTMLElement>?,\n React.FocusEventHandler<HTMLElement>?,\n ]\n | React.FocusEventHandler<HTMLElement>\n : React.FocusEventHandler<HTMLElement>;\n\ntype DatePickerPropName<TYPE> = TYPE extends Range\n ? [string?, string?] | string\n : string;\n\nexport type DatePickerAdditionalControlRenderFn = (props: {\n currentVisibleDate?: Date;\n}) => React.ReactNode | React.ReactNode[];\n\nexport type DatePickerAdditionalControlRenderProp =\n | React.ReactNode\n | DatePickerAdditionalControlRenderFn;\n\nexport type DatePickerProps<TYPE extends DatePickerPropType = 'date'> =\n PropsWithHTMLAttributesAndRef<\n {\n type?: TYPE;\n value?: DatePickerPropValue<TYPE>;\n onChange?: DatePickerPropOnChange<TYPE>;\n minDate?: Date;\n maxDate?: Date;\n renderAdditionalControls?: DatePickerAdditionalControlRenderProp;\n events?: Date[];\n dateTimeView?: DatePickerPropDateTimeView;\n locale?: Locale;\n children?: never;\n onError?: DatePickerPropOnError;\n id?: string;\n name?: DatePickerPropName<TYPE>;\n disabled?: boolean;\n disableDates?: DateTimePropDisableDates;\n dropdownClassName?: string;\n dropdownRef?: React.Ref<HTMLDivElement>;\n size?: TextFieldPropSize;\n view?: TextFieldPropView;\n form?: TextFieldPropForm;\n status?: TextFieldPropStatus;\n onFocus?: DatePickerPropOnFocus<TYPE>;\n onBlur?: DatePickerPropOnFocus<TYPE>;\n autoFocus?: boolean;\n placeholder?: DatePickerPropPlaceholder<TYPE>;\n readOnly?: boolean;\n required?: boolean;\n tabIndex?: number;\n inputRef?: DatePickerPropInputRef<TYPE>;\n ariaLabel?: string;\n iconSize?: IconPropSize;\n format?: string;\n separator?: string;\n dropdownForm?: DatePickerPropDropdownForm;\n leftSide?: DatePickerPropSide<TYPE>;\n rightSide?: DatePickerPropSide<TYPE>;\n label?: string;\n labelIcon?: IconComponent;\n caption?: string;\n labelPosition?: 'top' | 'left';\n onChangeCurrentVisibleDate?: (date: Date) => void;\n currentVisibleDate?: Date;\n timeOptions?: TYPE extends Time ? TimeOptions : never;\n /**\n * @deprecated Use timeOptions instead.\n * TODO: major - удалить при мажорном релизе все свойства multiplicity*, оставив только работу с timeOptions.\n */\n multiplicitySeconds?: TYPE extends Time ? number : never;\n /**\n * @deprecated Use timeOptions instead.\n * TODO: major - удалить при мажорном релизе все свойства multiplicity*, оставив только работу с timeOptions.\n */\n multiplicityMinutes?: TYPE extends Time ? number : never;\n /**\n * @deprecated Use timeOptions instead.\n * TODO: major - удалить при мажорном релизе все свойства multiplicity*, оставив только работу с timeOptions.\n */\n multiplicityHours?: TYPE extends Time ? number : never;\n isMobile?: number;\n withClearButton?: boolean;\n onDropdownOpen?: (isOpen: boolean) => void;\n dropdownOpen?: boolean;\n ignoreOutsideClicksRefs?: ReadonlyArray<React.RefObject<HTMLElement>>;\n dropdownViewportRef?: React.RefObject<HTMLElement>;\n dropdownContainer?: Element;\n },\n HTMLDivElement\n >;\n\nexport type DatePickerComponent = <TYPE extends DatePickerPropType = 'date'>(\n props: DatePickerProps<TYPE>,\n) => React.ReactNode | null;\n\nexport type DatePickerTypeComponent<TYPE extends DatePickerPropType> = (\n props: Omit<DatePickerProps<TYPE>, 'type'>,\n) => React.ReactNode | null;\n\nexport type DatePickerPropOnError = (\n props:\n | {\n type: typeof datePickerErrorTypes[0];\n stringValue: string;\n dd?: string;\n MM?: string;\n yyyy?: string;\n ss?: string;\n mm?: string;\n HH?: string;\n date: Date;\n }\n | {\n type: typeof datePickerErrorTypes[1];\n stringValue: string;\n dd?: string;\n MM?: string;\n yyyy?: string;\n ss?: string;\n mm?: string;\n HH?: string;\n }\n | {\n type: typeof datePickerErrorTypes[2];\n date: [Date, Date];\n }\n | {\n type: typeof datePickerErrorTypes[3];\n stringValue: string;\n date: Date;\n HH?: string;\n mm?: string;\n ss?: string;\n },\n) => void;\n"],"mappings":"AAKA,OAGEA,uBAHF,2BAaA,MAAO,IAAMC,mBAAkB,CAAG,CAChC,MADgC,CAEhC,YAFgC,CAGhC,WAHgC,CAIhC,iBAJgC,CAKhC,MALgC,CAMhC,MANgC,CAOhC,YAPgC,CAQhC,OARgC,CAShC,aATgC,CAA3B,CAaP,MAAO,IAAMC,0BAAyB,CAAGD,kBAAkB,CAAC,CAAD,CAApD,CAGP,MAAO,IAAME,kCAAiC,CAAGH,uBAA1C,CAKP,MAAO,IAAMI,qBAAoB,CAAG,CAClC,YADkC,CAElC,qBAFkC,CAGlC,+BAHkC,CAIlC,0BAJkC,CAA7B,CAsBP,MAAO,IAAMC,2BAA0B,CAAG,CACxC,SADwC,CAExC,OAFwC,CAGxC,OAHwC,CAAnC,CAOP,MAAO,IAAMC,kCAAiC,CAAGD,0BAA0B,CAAC,CAAD,CAApE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const File: import("./types").FileComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileCanary.js","names":["defaultConfig","fileGenerator","File"],"sources":["../../../../../src/components/FileCanary/FileCanary.tsx"],"sourcesContent":["import { defaultConfig } from './config';\nimport { fileGenerator } from './fileCanaryGenerator';\n\nexport const File = fileGenerator(defaultConfig);\n"],"mappings":"AAAA,OAASA,aAAT,gBACA,OAASC,aAAT,6BAEA,MAAO,IAAMC,KAAI,CAAGD,aAAa,CAACD,aAAD,CAA1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.canary--FileBase{--file-color-unknown:var(--file-color-unknown-override,#70788b);--file-color-code:var(--file-color-code-override,#70788b);--file-color-font:var(--file-color-font-override,#70788b);--file-color-disk:var(--file-color-disk-override,#70788b);--file-color-executive:var(--file-color-executive-override,#70788b);--file-color-config:var(--file-color-config-override,#70788b);--file-color-database:var(--file-color-database-override,#70788b);--file-color-presentation:var(--file-color-presentation-override,#f56b00);--file-color-table:var(--file-color-table-override,#6fb80a);--file-color-document:var(--file-color-document-override,#016bdc);--file-color-pdf:var(--file-color-pdf-override,#c62828);--file-color-audio:var(--file-color-audio-override,#e92064);--file-color-image:var(--file-color-image-override,#7448dd);--file-color-video:var(--file-color-video-override,#2044d5);--file-color-mail:var(--file-color-mail-override,#2196f3);--file-color-scheme:var(--file-color-scheme-override,#0088a3);--file-color-archive:var(--file-color-archive-override,#9010d1);--file-extension-font-size:8px;--file-extension-bg-color:rgba(0,0,0,.5);--file-extension-letter-spacing:-0.125em;--file-border-radius:var(--control-radius);--file-typo-color:#fff;align-items:center;border:none;border-radius:var(--file-border-radius);color:var(--file-typo-color);display:flex;flex-direction:column;height:var(--file-height);outline:none;overflow:hidden;padding:0;width:var(--file-width)}.canary--FileBase_size_s{--file-icon-container-padding:4px 4px 3px 4px;--file-width:24px;--file-height:32px}.canary--FileBase_size_m{--file-icon-container-padding:3px 3px 2px 3px;--file-width:30px;--file-height:40px}.canary--FileBase-IconContainer{height:-moz-fit-content;height:fit-content;padding:var(--file-icon-container-padding)}.canary--FileBase-Extension,.canary--FileBase-IconContainer{align-items:center;display:flex;justify-content:center;width:100%}.canary--FileBase-Extension{background-color:var(--file-extension-bg-color);flex:1;font-family:Silkscreen,sans-serif;font-size:var(--file-extension-font-size);letter-spacing:var(--file-extension-letter-spacing);min-height:0;text-transform:uppercase}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","icon","extension","color","className","as"];import"./FileCanaryBase.css";import React,{forwardRef}from"react";import{cnCanary}from"../../../utils/bem";export var cnFileCanaryBase=cnCanary("FileBase");var FileBaseRender=function(a,b){var c=a.size,d=a.icon,e=a.extension,f=a.color,g=a.className,h=a.as,i=void 0===h?"div":h,j=_objectWithoutProperties(a,_excluded);return React.createElement(i,Object.assign({className:cnFileCanaryBase({size:c},[g]),style:{backgroundColor:f},ref:b},j),React.createElement("div",{className:cnFileCanaryBase("IconContainer")},React.createElement(d,{size:c,className:cnFileCanaryBase("Icon")})),React.createElement("div",{className:cnFileCanaryBase("Extension")},e))};export var FileBase=forwardRef(FileBaseRender);
|
|
2
|
+
//# sourceMappingURL=FileCanaryBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileCanaryBase.js","names":["React","forwardRef","cnCanary","cnFileCanaryBase","FileBaseRender","ref","size","Icon","icon","extension","color","className","as","Tag","otherProps","backgroundColor","FileBase"],"sources":["../../../../../../src/components/FileCanary/FileCanaryBase/FileCanaryBase.tsx"],"sourcesContent":["import './FileCanaryBase.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { cnCanary } from '##/utils/bem';\n\nimport { FileBaseComponent, FileBaseProps } from '../types';\n\nexport const cnFileCanaryBase = cnCanary('FileBase');\n\nconst FileBaseRender = (\n {\n size,\n icon: Icon,\n extension,\n color,\n className,\n as: Tag = 'div',\n ...otherProps\n }: FileBaseProps,\n ref: React.ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <Tag\n className={cnFileCanaryBase({ size }, [className])}\n style={{ backgroundColor: color }}\n ref={ref}\n {...otherProps}\n >\n <div className={cnFileCanaryBase('IconContainer')}>\n <Icon size={size} className={cnFileCanaryBase('Icon')} />\n </div>\n <div className={cnFileCanaryBase('Extension')}>{extension}</div>\n </Tag>\n );\n};\n\nexport const FileBase = forwardRef(FileBaseRender) as FileBaseComponent;\n"],"mappings":"wJAAA,6BAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,QAAT,0BAIA,MAAO,IAAMC,iBAAgB,CAAGD,QAAQ,CAAC,UAAD,CAAjC,CAEP,GAAME,eAAc,CAAG,WAUrBC,CAVqB,CAWlB,IATDC,EASC,GATDA,IASC,CARKC,CAQL,GARDC,IAQC,CAPDC,CAOC,GAPDA,SAOC,CANDC,CAMC,GANDA,KAMC,CALDC,CAKC,GALDA,SAKC,KAJDC,EAIC,CAJGC,CAIH,YAJS,KAIT,GAHEC,CAGF,uCACH,MACE,qBAAC,CAAD,gBACE,SAAS,CAAEX,gBAAgB,CAAC,CAAEG,IAAI,CAAJA,CAAF,CAAD,CAAW,CAACK,CAAD,CAAX,CAD7B,CAEE,KAAK,CAAE,CAAEI,eAAe,CAAEL,CAAnB,CAFT,CAGE,GAAG,CAAEL,CAHP,EAIMS,CAJN,EAME,2BAAK,SAAS,CAAEX,gBAAgB,CAAC,eAAD,CAAhC,EACE,oBAAC,CAAD,EAAM,IAAI,CAAEG,CAAZ,CAAkB,SAAS,CAAEH,gBAAgB,CAAC,MAAD,CAA7C,EADF,CANF,CASE,2BAAK,SAAS,CAAEA,gBAAgB,CAAC,WAAD,CAAhC,EAAgDM,CAAhD,CATF,CAYH,CAzBD,CA2BA,MAAO,IAAMO,SAAQ,CAAGf,UAAU,CAACG,cAAD,CAA3B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{IconFileAnimation}from"@consta/icons/IconFileAnimation";import{IconFileArchive}from"@consta/icons/IconFileArchive";import{IconFileAudio}from"@consta/icons/IconFileAudio";import{IconFileCode}from"@consta/icons/IconFileCode";import{IconFileConfig}from"@consta/icons/IconFileConfig";import{IconFileDatabase}from"@consta/icons/IconFileDatabase";import{IconFileDisk}from"@consta/icons/IconFileDisk";import{IconFileDocument}from"@consta/icons/IconFileDocument";import{IconFileFont}from"@consta/icons/IconFileFont";import{IconFileImage}from"@consta/icons/IconFileImage";import{IconFileMail}from"@consta/icons/IconFileMail";import{IconFilePDF}from"@consta/icons/IconFilePDF";import{IconFilePresentation}from"@consta/icons/IconFilePresentation";import{IconFileProgram}from"@consta/icons/IconFileProgram";import{IconFileScheme}from"@consta/icons/IconFileScheme";import{IconFileTable}from"@consta/icons/IconFileTable";import{IconFileTransparent}from"@consta/icons/IconFileTransparent";import{IconFileVector}from"@consta/icons/IconFileVector";import{IconFileVideo}from"@consta/icons/IconFileVideo";export var defaultConfig={asp:{color:"var(--file-color-code)",icon:IconFileCode},aspx:{color:"var(--file-color-code)",icon:IconFileCode},cer:{color:"var(--file-color-code)",icon:IconFileCode},cmf:{color:"var(--file-color-code)",icon:IconFileCode},cgi:{color:"var(--file-color-code)",icon:IconFileCode},pl:{color:"var(--file-color-code)",icon:IconFileCode},css:{color:"var(--file-color-code)",icon:IconFileCode},htm:{color:"var(--file-color-code)",icon:IconFileCode},html:{color:"var(--file-color-code)",icon:IconFileCode},js:{color:"var(--file-color-code)",icon:IconFileCode},jsp:{color:"var(--file-color-code)",icon:IconFileCode},part:{color:"var(--file-color-code)",icon:IconFileCode},php:{color:"var(--file-color-code)",icon:IconFileCode},py:{color:"var(--file-color-code)",icon:IconFileCode},rss:{color:"var(--file-color-code)",icon:IconFileCode},fnt:{color:"var(--file-color-font)",icon:IconFileFont},fon:{color:"var(--file-color-font)",icon:IconFileFont},otf:{color:"var(--file-color-font)",icon:IconFileFont},ttf:{color:"var(--file-color-font)",icon:IconFileFont},bin:{color:"var(--file-color-disk)",icon:IconFileDisk},dmg:{color:"var(--file-color-disk)",icon:IconFileDisk},iso:{color:"var(--file-color-disk)",icon:IconFileDisk},toast:{color:"var(--file-color-disk)",icon:IconFileDisk},vcd:{color:"var(--file-color-disk)",icon:IconFileDisk},bat:{color:"var(--file-color-executive)",icon:IconFileProgram},com:{color:"var(--file-color-executive)",icon:IconFileProgram},exe:{color:"var(--file-color-executive)",icon:IconFileProgram},msi:{color:"var(--file-color-executive)",icon:IconFileProgram},sh:{color:"var(--file-color-executive)",icon:IconFileProgram},wsf:{color:"var(--file-color-executive)",icon:IconFileProgram},conf:{color:"var(--file-color-config)",icon:IconFileConfig},ini:{color:"var(--file-color-config)",icon:IconFileConfig},sql:{color:"var(--file-color-database)",icon:IconFileDatabase},db:{color:"var(--file-color-database)",icon:IconFileDatabase},dbf:{color:"var(--file-color-database)",icon:IconFileDatabase},mdb:{color:"var(--file-color-database)",icon:IconFileDatabase},pptx:{color:"var(--file-color-presentation)",icon:IconFilePresentation},ppt:{color:"var(--file-color-presentation)",icon:IconFilePresentation},key:{color:"var(--file-color-presentation)",icon:IconFilePresentation},odp:{color:"var(--file-color-presentation)",icon:IconFilePresentation},pps:{color:"var(--file-color-presentation)",icon:IconFilePresentation},xlsx:{color:"var(--file-color-table)",icon:IconFileTable},xsl:{color:"var(--file-color-table)",icon:IconFileTable},csv:{color:"var(--file-color-table)",icon:IconFileTable},xml:{color:"var(--file-color-table)",icon:IconFileTable},docx:{color:"var(--file-color-document)",icon:IconFileDocument},doc:{color:"var(--file-color-document)",icon:IconFileDocument},log:{color:"var(--file-color-document)",icon:IconFileDocument},sav:{color:"var(--file-color-document)",icon:IconFileDocument},odt:{color:"var(--file-color-document)",icon:IconFileDocument},rtf:{color:"var(--file-color-document)",icon:IconFileDocument},tex:{color:"var(--file-color-document)",icon:IconFileDocument},txt:{color:"var(--file-color-document)",icon:IconFileDocument},wpd:{color:"var(--file-color-document)",icon:IconFileDocument},pdf:{color:"var(--file-color-pdf)",icon:IconFilePDF},aif:{color:"var(--file-color-audio)",icon:IconFileAudio},cda:{color:"var(--file-color-audio)",icon:IconFileAudio},midi:{color:"var(--file-color-audio)",icon:IconFileAudio},mp3:{color:"var(--file-color-audio)",icon:IconFileAudio},mpa:{color:"var(--file-color-audio)",icon:IconFileAudio},ogg:{color:"var(--file-color-audio)",icon:IconFileAudio},wav:{color:"var(--file-color-audio)",icon:IconFileAudio},wma:{color:"var(--file-color-audio)",icon:IconFileAudio},wpl:{color:"var(--file-color-audio)",icon:IconFileAudio},bmp:{color:"var(--file-color-image)",icon:IconFileImage},ico:{color:"var(--file-color-image)",icon:IconFileImage},jpg:{color:"var(--file-color-image)",icon:IconFileImage},jpeg:{color:"var(--file-color-image)",icon:IconFileImage},psd:{color:"var(--file-color-image)",icon:IconFileImage},scr:{color:"var(--file-color-image)",icon:IconFileImage},tif:{color:"var(--file-color-image)",icon:IconFileImage},tiff:{color:"var(--file-color-image)",icon:IconFileImage},webp:{color:"var(--file-color-image)",icon:IconFileImage},ai:{color:"var(--file-color-image)",icon:IconFileVector},ps:{color:"var(--file-color-image)",icon:IconFileVector},svg:{color:"var(--file-color-image)",icon:IconFileVector},png:{color:"var(--file-color-image)",icon:IconFileTransparent},gif:{color:"var(--file-color-image)",icon:IconFileAnimation},"3g2":{color:"var(--file-color-video)",icon:IconFileVideo},"3gp":{color:"var(--file-color-video)",icon:IconFileVideo},avi:{color:"var(--file-color-video)",icon:IconFileVideo},flv:{color:"var(--file-color-video)",icon:IconFileVideo},h264:{color:"var(--file-color-video)",icon:IconFileVideo},m4v:{color:"var(--file-color-video)",icon:IconFileVideo},mkv:{color:"var(--file-color-video)",icon:IconFileVideo},mov:{color:"var(--file-color-video)",icon:IconFileVideo},mp4:{color:"var(--file-color-video)",icon:IconFileVideo},mpg:{color:"var(--file-color-video)",icon:IconFileVideo},mpeg:{color:"var(--file-color-video)",icon:IconFileVideo},rm:{color:"var(--file-color-video)",icon:IconFileVideo},swf:{color:"var(--file-color-video)",icon:IconFileVideo},vob:{color:"var(--file-color-video)",icon:IconFileVideo},webm:{color:"var(--file-color-video)",icon:IconFileVideo},wmv:{color:"var(--file-color-video)",icon:IconFileVideo},email:{color:"var(--file-color-mail)",icon:IconFileMail},eml:{color:"var(--file-color-mail)",icon:IconFileMail},emlx:{color:"var(--file-color-mail)",icon:IconFileMail},msg:{color:"var(--file-color-mail)",icon:IconFileMail},oft:{color:"var(--file-color-mail)",icon:IconFileMail},ost:{color:"var(--file-color-mail)",icon:IconFileMail},pst:{color:"var(--file-color-mail)",icon:IconFileMail},vcf:{color:"var(--file-color-mail)",icon:IconFileMail},vsd:{color:"var(--file-color-scheme)",icon:IconFileScheme},"7z":{color:"var(--file-color-archive)",icon:IconFileArchive},arj:{color:"var(--file-color-archive)",icon:IconFileArchive},deb:{color:"var(--file-color-archive)",icon:IconFileArchive},pkg:{color:"var(--file-color-archive)",icon:IconFileArchive},rar:{color:"var(--file-color-archive)",icon:IconFileArchive},rpm:{color:"var(--file-color-archive)",icon:IconFileArchive},targz:{color:"var(--file-color-archive)",icon:IconFileArchive},z:{color:"var(--file-color-archive)",icon:IconFileArchive},zip:{color:"var(--file-color-archive)",icon:IconFileArchive},tar:{color:"var(--file-color-archive)",icon:IconFileArchive}};
|
|
2
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","names":["IconFileAnimation","IconFileArchive","IconFileAudio","IconFileCode","IconFileConfig","IconFileDatabase","IconFileDisk","IconFileDocument","IconFileFont","IconFileImage","IconFileMail","IconFilePDF","IconFilePresentation","IconFileProgram","IconFileScheme","IconFileTable","IconFileTransparent","IconFileVector","IconFileVideo","defaultConfig","color","icon"],"sources":["../../../../../src/components/FileCanary/config.ts"],"sourcesContent":["import { IconFileAnimation } from '@consta/icons/IconFileAnimation';\nimport { IconFileArchive } from '@consta/icons/IconFileArchive';\nimport { IconFileAudio } from '@consta/icons/IconFileAudio';\nimport { IconFileCode } from '@consta/icons/IconFileCode';\nimport { IconFileConfig } from '@consta/icons/IconFileConfig';\nimport { IconFileDatabase } from '@consta/icons/IconFileDatabase';\nimport { IconFileDisk } from '@consta/icons/IconFileDisk';\nimport { IconFileDocument } from '@consta/icons/IconFileDocument';\nimport { IconFileFont } from '@consta/icons/IconFileFont';\nimport { IconFileImage } from '@consta/icons/IconFileImage';\nimport { IconFileMail } from '@consta/icons/IconFileMail';\nimport { IconFilePDF } from '@consta/icons/IconFilePDF';\nimport { IconFilePresentation } from '@consta/icons/IconFilePresentation';\nimport { IconFileProgram } from '@consta/icons/IconFileProgram';\nimport { IconFileScheme } from '@consta/icons/IconFileScheme';\nimport { IconFileTable } from '@consta/icons/IconFileTable';\nimport { IconFileTransparent } from '@consta/icons/IconFileTransparent';\nimport { IconFileVector } from '@consta/icons/IconFileVector';\nimport { IconFileVideo } from '@consta/icons/IconFileVideo';\n\nimport { FileConfig } from './types';\n\nexport const defaultConfig: FileConfig = {\n // code\n 'asp': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'aspx': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'cer': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'cmf': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'cgi': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'pl': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'css': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'htm': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'html': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'js': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'jsp': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'part': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'php': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'py': { color: 'var(--file-color-code)', icon: IconFileCode },\n 'rss': { color: 'var(--file-color-code)', icon: IconFileCode },\n\n // font\n 'fnt': { color: 'var(--file-color-font)', icon: IconFileFont },\n 'fon': { color: 'var(--file-color-font)', icon: IconFileFont },\n 'otf': { color: 'var(--file-color-font)', icon: IconFileFont },\n 'ttf': { color: 'var(--file-color-font)', icon: IconFileFont },\n\n // disk\n 'bin': { color: 'var(--file-color-disk)', icon: IconFileDisk },\n 'dmg': { color: 'var(--file-color-disk)', icon: IconFileDisk },\n 'iso': { color: 'var(--file-color-disk)', icon: IconFileDisk },\n 'toast': { color: 'var(--file-color-disk)', icon: IconFileDisk },\n 'vcd': { color: 'var(--file-color-disk)', icon: IconFileDisk },\n\n // executive\n 'bat': { color: 'var(--file-color-executive)', icon: IconFileProgram },\n 'com': { color: 'var(--file-color-executive)', icon: IconFileProgram },\n 'exe': { color: 'var(--file-color-executive)', icon: IconFileProgram },\n 'msi': { color: 'var(--file-color-executive)', icon: IconFileProgram },\n 'sh': { color: 'var(--file-color-executive)', icon: IconFileProgram },\n 'wsf': { color: 'var(--file-color-executive)', icon: IconFileProgram },\n\n // config\n 'conf': { color: 'var(--file-color-config)', icon: IconFileConfig },\n 'ini': { color: 'var(--file-color-config)', icon: IconFileConfig },\n\n // database\n 'sql': { color: 'var(--file-color-database)', icon: IconFileDatabase },\n 'db': { color: 'var(--file-color-database)', icon: IconFileDatabase },\n 'dbf': { color: 'var(--file-color-database)', icon: IconFileDatabase },\n 'mdb': { color: 'var(--file-color-database)', icon: IconFileDatabase },\n\n // presentation\n 'pptx': {\n color: 'var(--file-color-presentation)',\n icon: IconFilePresentation,\n },\n 'ppt': {\n color: 'var(--file-color-presentation)',\n icon: IconFilePresentation,\n },\n 'key': {\n color: 'var(--file-color-presentation)',\n icon: IconFilePresentation,\n },\n 'odp': {\n color: 'var(--file-color-presentation)',\n icon: IconFilePresentation,\n },\n 'pps': {\n color: 'var(--file-color-presentation)',\n icon: IconFilePresentation,\n },\n\n // table\n 'xlsx': { color: 'var(--file-color-table)', icon: IconFileTable },\n 'xsl': { color: 'var(--file-color-table)', icon: IconFileTable },\n 'csv': { color: 'var(--file-color-table)', icon: IconFileTable },\n 'xml': { color: 'var(--file-color-table)', icon: IconFileTable },\n\n // document\n 'docx': { color: 'var(--file-color-document)', icon: IconFileDocument },\n 'doc': { color: 'var(--file-color-document)', icon: IconFileDocument },\n 'log': { color: 'var(--file-color-document)', icon: IconFileDocument },\n 'sav': { color: 'var(--file-color-document)', icon: IconFileDocument },\n 'odt': { color: 'var(--file-color-document)', icon: IconFileDocument },\n 'rtf': { color: 'var(--file-color-document)', icon: IconFileDocument },\n 'tex': { color: 'var(--file-color-document)', icon: IconFileDocument },\n 'txt': { color: 'var(--file-color-document)', icon: IconFileDocument },\n 'wpd': { color: 'var(--file-color-document)', icon: IconFileDocument },\n\n // pdf\n 'pdf': { color: 'var(--file-color-pdf)', icon: IconFilePDF },\n\n // audio\n 'aif': { color: 'var(--file-color-audio)', icon: IconFileAudio },\n 'cda': { color: 'var(--file-color-audio)', icon: IconFileAudio },\n 'midi': { color: 'var(--file-color-audio)', icon: IconFileAudio },\n 'mp3': { color: 'var(--file-color-audio)', icon: IconFileAudio },\n 'mpa': { color: 'var(--file-color-audio)', icon: IconFileAudio },\n 'ogg': { color: 'var(--file-color-audio)', icon: IconFileAudio },\n 'wav': { color: 'var(--file-color-audio)', icon: IconFileAudio },\n 'wma': { color: 'var(--file-color-audio)', icon: IconFileAudio },\n 'wpl': { color: 'var(--file-color-audio)', icon: IconFileAudio },\n\n // image\n 'bmp': { color: 'var(--file-color-image)', icon: IconFileImage },\n 'ico': { color: 'var(--file-color-image)', icon: IconFileImage },\n 'jpg': { color: 'var(--file-color-image)', icon: IconFileImage },\n 'jpeg': { color: 'var(--file-color-image)', icon: IconFileImage },\n 'psd': { color: 'var(--file-color-image)', icon: IconFileImage },\n 'scr': { color: 'var(--file-color-image)', icon: IconFileImage },\n 'tif': { color: 'var(--file-color-image)', icon: IconFileImage },\n 'tiff': { color: 'var(--file-color-image)', icon: IconFileImage },\n 'webp': { color: 'var(--file-color-image)', icon: IconFileImage },\n 'ai': { color: 'var(--file-color-image)', icon: IconFileVector },\n 'ps': { color: 'var(--file-color-image)', icon: IconFileVector },\n 'svg': { color: 'var(--file-color-image)', icon: IconFileVector },\n 'png': { color: 'var(--file-color-image)', icon: IconFileTransparent },\n 'gif': { color: 'var(--file-color-image)', icon: IconFileAnimation },\n\n // video\n '3g2': { color: 'var(--file-color-video)', icon: IconFileVideo },\n '3gp': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'avi': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'flv': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'h264': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'm4v': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'mkv': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'mov': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'mp4': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'mpg': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'mpeg': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'rm': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'swf': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'vob': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'webm': { color: 'var(--file-color-video)', icon: IconFileVideo },\n 'wmv': { color: 'var(--file-color-video)', icon: IconFileVideo },\n\n // mail\n 'email': { color: 'var(--file-color-mail)', icon: IconFileMail },\n 'eml': { color: 'var(--file-color-mail)', icon: IconFileMail },\n 'emlx': { color: 'var(--file-color-mail)', icon: IconFileMail },\n 'msg': { color: 'var(--file-color-mail)', icon: IconFileMail },\n 'oft': { color: 'var(--file-color-mail)', icon: IconFileMail },\n 'ost': { color: 'var(--file-color-mail)', icon: IconFileMail },\n 'pst': { color: 'var(--file-color-mail)', icon: IconFileMail },\n 'vcf': { color: 'var(--file-color-mail)', icon: IconFileMail },\n\n // scheme\n 'vsd': { color: 'var(--file-color-scheme)', icon: IconFileScheme },\n\n // archive\n '7z': { color: 'var(--file-color-archive)', icon: IconFileArchive },\n 'arj': { color: 'var(--file-color-archive)', icon: IconFileArchive },\n 'deb': { color: 'var(--file-color-archive)', icon: IconFileArchive },\n 'pkg': { color: 'var(--file-color-archive)', icon: IconFileArchive },\n 'rar': { color: 'var(--file-color-archive)', icon: IconFileArchive },\n 'rpm': { color: 'var(--file-color-archive)', icon: IconFileArchive },\n 'targz': { color: 'var(--file-color-archive)', icon: IconFileArchive },\n 'z': { color: 'var(--file-color-archive)', icon: IconFileArchive },\n 'zip': { color: 'var(--file-color-archive)', icon: IconFileArchive },\n 't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C,IAAO,CAAEU,KAAK,CAAE,wBAAT,CAAmCC,IAAI,CAAEX,YAAzC,CAhJgC,CAmJvC,IAAO,CAAEU,KAAK,CAAE,0BAAT,CAAqCC,IAAI,CAAEP,cAA3C,CAnJgC,CAsJvC,KAAM,CAAEM,KAAK,CAAE,2BAAT,CAAsCC,IAAI,CAAEpB,eAA5C,CAtJiC,CAuJvC,IAAO,CAAEmB,KAAK,CAAE,2BAAT,CAAsCC,IAAI,CAAEpB,eAA5C,CAvJgC,CAwJvC,IAAO,CAAEmB,KAAK,CAAE,2BAAT,CAAsCC,IAAI,CAAEpB,eAA5C,CAxJgC,CAyJvC,IAAO,CAAEmB,KAAK,CAAE,2BAAT,CAAsCC,IAAI,CAAEpB,eAA5C,CAzJgC,CA0JvC,IAAO,CAAEmB,KAAK,CAAE,2BAAT,CAAsCC,IAAI,CAAEpB,eAA5C,CA1JgC,CA2JvC,IAAO,CAAEmB,KAAK,CAAE,2BAAT,CAAsCC,IAAI,CAAEpB,eAA5C,CA3JgC,CA4JvC,MAAS,CAAEmB,KAAK,CAAE,2BAAT,CAAsCC,IAAI,CAAEpB,eAA5C,CA5J8B,CA6JvC,EAAK,CAAEmB,KAAK,CAAE,2BAAT,CAAsCC,IAAI,CAAEpB,eAA5C,CA7JkC,CA8JvC,IAAO,CAAEmB,KAAK,CAAE,2BAAT,CAAsCC,IAAI,CAAEpB,eAA5C,CA9JgC,CA+JvC,IAAO,CAAEmB,KAAK,CAAE,2BAAT,CAAsCC,IAAI,CAAEpB,eAA5C,CA/JgC,CAAlC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","extension","className","as"];import{IconFileUnknown}from"@consta/icons/IconFileUnknown";import React,{forwardRef}from"react";import{FileBase}from"./FileCanaryBase/FileCanaryBase";import{filePropSizeDefault}from"./types";var UNKNOWN_EXTENSION_CONFIG={color:"var(--file-color-unknown)",icon:IconFileUnknown};export function fileGenerator(a){return forwardRef(function FileRender(b,c){var d,e=b.size,f=void 0===e?filePropSizeDefault:e,g=b.extension,h=b.className,i=b.as,j=void 0===i?"div":i,k=_objectWithoutProperties(b,_excluded),l=null!==(d=a[g])&&void 0!==d?d:UNKNOWN_EXTENSION_CONFIG;return React.createElement(FileBase,Object.assign({},k,{size:f,icon:l.icon,extension:g,color:l.color,className:h,ref:c,as:j}))})}
|
|
2
|
+
//# sourceMappingURL=fileCanaryGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileCanaryGenerator.js","names":["IconFileUnknown","React","forwardRef","FileBase","filePropSizeDefault","UNKNOWN_EXTENSION_CONFIG","color","icon","fileGenerator","config","FileRender","ref","size","extension","className","as","Tag","otherProps","fileConfig"],"sources":["../../../../../src/components/FileCanary/fileCanaryGenerator.tsx"],"sourcesContent":["import { IconFileUnknown } from '@consta/icons/IconFileUnknown';\nimport React, { forwardRef } from 'react';\n\nimport { FileBase } from './FileCanaryBase/FileCanaryBase';\nimport {\n FileComponent,\n FileConfig,\n FileProps,\n filePropSizeDefault,\n FileTypeConfig,\n} from './types';\n\nconst UNKNOWN_EXTENSION_CONFIG: FileTypeConfig = {\n color: 'var(--file-color-unknown)',\n icon: IconFileUnknown,\n};\n\nexport function fileGenerator(config: FileConfig) {\n const FileRender = (\n {\n size = filePropSizeDefault,\n extension,\n className,\n as: Tag = 'div',\n ...otherProps\n }: FileProps,\n ref: React.ForwardedRef<HTMLDivElement>,\n ) => {\n const fileConfig = config[extension] ?? UNKNOWN_EXTENSION_CONFIG;\n\n return (\n <FileBase\n {...otherProps}\n size={size}\n icon={fileConfig.icon}\n extension={extension}\n color={fileConfig.color}\n className={className}\n ref={ref}\n as={Tag}\n />\n );\n };\n return forwardRef(FileRender) as FileComponent;\n}\n"],"mappings":"yIAAA,OAASA,eAAT,KAAgC,+BAAhC,CACA,MAAOC,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,QAAT,uCACA,OAIEC,mBAJF,eAQA,GAAMC,yBAAwC,CAAG,CAC/CC,KAAK,CAAE,2BADwC,CAE/CC,IAAI,CAAEP,eAFyC,CAAjD,CAKA,MAAO,SAASQ,cAAT,CAAuBC,CAAvB,CAA2C,CA0BhD,MAAOP,WAAU,CAzBE,QAAbQ,WAAa,GAQjBC,CARiB,CASd,WAPDC,IAOC,CAPDA,CAOC,YAPMR,mBAON,GANDS,CAMC,GANDA,SAMC,CALDC,CAKC,GALDA,SAKC,KAJDC,EAIC,CAJGC,CAIH,YAJS,KAIT,GAHEC,CAGF,uCACGC,CAAU,WAAGT,CAAM,CAACI,CAAD,CAAT,gBAAwBR,wBADrC,CAGH,MACE,qBAAC,QAAD,kBACMY,CADN,EAEE,IAAI,CAAEL,CAFR,CAGE,IAAI,CAAEM,CAAU,CAACX,IAHnB,CAIE,SAAS,CAAEM,CAJb,CAKE,KAAK,CAAEK,CAAU,CAACZ,KALpB,CAME,SAAS,CAAEQ,CANb,CAOE,GAAG,CAAEH,CAPP,CAQE,EAAE,CAAEK,CARN,GAWH,CACgB,CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["defaultConfig","fileGenerator"],"sources":["../../../../../src/components/FileCanary/index.ts"],"sourcesContent":["export * from './FileCanary';\nexport type { FileProps, FileConfig, FileTypeConfig } from './types';\nexport { defaultConfig } from './config';\nexport { fileGenerator } from './fileCanaryGenerator';\n"],"mappings":"AAAA,0BAEA,OAASA,aAAT,gBACA,OAASC,aAAT"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IconComponent } from '@consta/icons/Icon';
|
|
2
|
+
import { AsTags } from '../../utils/types/AsTags';
|
|
3
|
+
import { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';
|
|
4
|
+
export declare const filePropSize: readonly ["s", "m"];
|
|
5
|
+
export type FilePropSize = typeof filePropSize[number];
|
|
6
|
+
export declare const filePropSizeDefault: FilePropSize;
|
|
7
|
+
export type FileTypeConfig = {
|
|
8
|
+
color: string;
|
|
9
|
+
icon: IconComponent;
|
|
10
|
+
};
|
|
11
|
+
export type FileConfig = Record<string, FileTypeConfig>;
|
|
12
|
+
export type FileBaseProps<As extends AsTags = 'div'> = PropsWithAsAttributes<{
|
|
13
|
+
size: FilePropSize;
|
|
14
|
+
icon: IconComponent;
|
|
15
|
+
extension: string;
|
|
16
|
+
color: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
}, As>;
|
|
19
|
+
export type FileBaseComponent = <As extends AsTags = 'div'>(props: FileBaseProps<As>) => React.ReactElement;
|
|
20
|
+
export type FileProps<As extends AsTags = 'div'> = PropsWithAsAttributes<{
|
|
21
|
+
size?: FilePropSize;
|
|
22
|
+
extension: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
}, As>;
|
|
25
|
+
export type FileComponent = <As extends AsTags = 'div'>(props: FileProps<As>) => React.ReactElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":["filePropSize","filePropSizeDefault"],"sources":["../../../../../src/components/FileCanary/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\n\nimport { AsTags } from '##/utils/types/AsTags';\nimport { PropsWithAsAttributes } from '##/utils/types/PropsWithAsAttributes';\n\nexport const filePropSize = ['s', 'm'] as const;\nexport type FilePropSize = typeof filePropSize[number];\nexport const filePropSizeDefault: FilePropSize = filePropSize[1];\n\nexport type FileTypeConfig = {\n color: string;\n icon: IconComponent;\n};\n\nexport type FileConfig = Record<string, FileTypeConfig>;\n\nexport type FileBaseProps<As extends AsTags = 'div'> = PropsWithAsAttributes<\n {\n size: FilePropSize;\n icon: IconComponent;\n extension: string;\n color: string;\n className?: string;\n },\n As\n>;\n\nexport type FileBaseComponent = <As extends AsTags = 'div'>(\n props: FileBaseProps<As>,\n) => React.ReactElement;\n\nexport type FileProps<As extends AsTags = 'div'> = PropsWithAsAttributes<\n {\n size?: FilePropSize;\n extension: string;\n className?: string;\n },\n As\n>;\n\nexport type FileComponent = <As extends AsTags = 'div'>(\n props: FileProps<As>,\n) => React.ReactElement;\n"],"mappings":"AAKA,MAAO,IAAMA,aAAY,CAAG,CAAC,GAAD,CAAM,GAAN,CAArB,CAEP,MAAO,IAAMC,oBAAiC,CAAGD,YAAY,CAAC,CAAD,CAAtD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["form","disabled","value","isLoading","listRef","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","iconClear","input","inputValue","inputDefaultValue","inputRef","size","view","bordered","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChange","onCreate","onInput","multiple","groups","onOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel","autoFocus","footer","listClassName","anchorRef","iconLeft","direction","spareDirection","possibleDirections"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./FlatSelect.css";import React,{forwardRef}from"react";import{FieldInput}from"../FieldComponents";import{useForkRef}from"../../hooks/useForkRef";import{cnMixSpace}from"../../mixs/MixSpace";import{cn}from"../../utils/bem";import{useSendToAtom,withCtx}from"../../utils/state";import{withDefault}from"./defaultProps";import{FlatSelectControlLayout}from"./FlatSelectControlLayout";import{FlatSelectFooter}from"./FlatSelectFooter";import{FlatSelectList}from"./FlatSelectList";import{FlatSelectRoot}from"./FlatSelectRoot";import{useFlatSelect}from"./useFlatSelect";import{useRenderItem}from"./useRenderItem";export var cnFlatSelect=cn("FlatSelect");var FlatSelectRender=function(a,b){var c=withDefault(a),d=useSendToAtom(c),e=c.form,f=c.disabled,g=c.value,h=c.isLoading,i=c.listRef,j=c.renderItem,k=c.getGroupLabel,l=c.labelForCreate,m=c.labelForEmptyItems,n=c.virtualScroll,o=c.onScrollToBottom,p=c.style,q=c.className,r=c.placeholder,s=c.iconClear,t=c.input,u=c.inputValue,v=c.inputDefaultValue,w=c.inputRef,x=c.size,y=c.view,z=c.bordered,A=c.getGroupKey,B=c.getItemDisabled,C=c.getItemGroupKey,D=c.getItemKey,E=c.getItemLabel,F=c.items,G=c.onChange,H=c.onCreate,I=c.onInput,J=c.multiple,K=c.groups,L=c.onOpen,M=c.ignoreOutsideClicksRefs,N=c.clearButton,O=c.selectAll,P=c.selectAllLabel,Q=c.autoFocus,R=c.footer,S=c.listClassName,T=c.anchorRef,U=c.iconLeft,V=c.direction,W=c.spareDirection,X=c.possibleDirections,Y=_objectWithoutProperties(c,_excluded)
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["form","disabled","value","isLoading","listRef","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","iconClear","input","inputValue","inputDefaultValue","inputRef","size","view","bordered","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChange","onCreate","onInput","multiple","groups","onOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel","autoFocus","footer","listClassName","anchorRef","iconLeft","direction","spareDirection","possibleDirections","container"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./FlatSelect.css";import React,{forwardRef}from"react";import{FieldInput}from"../FieldComponents";import{useForkRef}from"../../hooks/useForkRef";import{cnMixSpace}from"../../mixs/MixSpace";import{cn}from"../../utils/bem";import{useSendToAtom,withCtx}from"../../utils/state";import{withDefault}from"./defaultProps";import{FlatSelectControlLayout}from"./FlatSelectControlLayout";import{FlatSelectFooter}from"./FlatSelectFooter";import{FlatSelectList}from"./FlatSelectList";import{FlatSelectRoot}from"./FlatSelectRoot";import{useFlatSelect}from"./useFlatSelect";import{useRenderItem}from"./useRenderItem";export var cnFlatSelect=cn("FlatSelect");var FlatSelectRender=function(a,b){var c=withDefault(a),d=useSendToAtom(c),e=c.form,f=c.disabled,g=c.value,h=c.isLoading,i=c.listRef,j=c.renderItem,k=c.getGroupLabel,l=c.labelForCreate,m=c.labelForEmptyItems,n=c.virtualScroll,o=c.onScrollToBottom,p=c.style,q=c.className,r=c.placeholder,s=c.iconClear,t=c.input,u=c.inputValue,v=c.inputDefaultValue,w=c.inputRef,x=c.size,y=c.view,z=c.bordered,A=c.getGroupKey,B=c.getItemDisabled,C=c.getItemGroupKey,D=c.getItemKey,E=c.getItemLabel,F=c.items,G=c.onChange,H=c.onCreate,I=c.onInput,J=c.multiple,K=c.groups,L=c.onOpen,M=c.ignoreOutsideClicksRefs,N=c.clearButton,O=c.selectAll,P=c.selectAllLabel,Q=c.autoFocus,R=c.footer,S=c.listClassName,T=c.anchorRef,U=c.iconLeft,V=c.direction,W=c.spareDirection,X=c.possibleDirections,Y=c.container,Z=_objectWithoutProperties(c,_excluded),$=useFlatSelect({propsAtom:d}),_=$.getOptionActions,aa=$.openAtom,ba=$.visibleItemsAtom,ca=$.inputFocusAtom,da=$.handleInputFocus,ea=$.handleInputBlur,fa=$.inputRef,ga=$.handleInputChange,ha=$.clearValue,ia=$.optionsRefs,ja=$.disabledAtom,ka=$.listRef,la=$.clearButtonAtom,ma=$.highlightedIndexAtom,na=$.getItemKeyAtom,oa=$.valueAtom,pa=$.onChangeAll,qa=$.onChange,ra=$.inputValueAtom,sa=$.hasItemsAtom,ta=$.groupsCounterAtom,ua=$.dropdownZIndexAtom,va=$.rootRef,wa=useRenderItem({getItemLabel:E,getItemDisabled:B,multiple:J,disabled:f,size:x,renderItem:j}),xa=!t||T||z?"clear":y,ya=!!T||z,za=useForkRef([fa,w]);return React.createElement(FlatSelectRoot,Object.assign({},Z,{ref:useForkRef([b,va]),className:cnFlatSelect({view:xa,bordered:"clear"===xa?ya:void 0,form:ya?e:void 0,size:x},[q]),style:_objectSpread(_objectSpread({},p),{},_defineProperty({},"--flat-select-control-height","var(--control-height-".concat(x,")"))),anchorRef:T,openAtom:aa,tabIndex:0,direction:V,spareDirection:W,possibleDirections:X,container:Y}),t&&React.createElement("div",{className:cnFlatSelect("Input",{border:"clear"===xa?ya:void 0,form:ya?e:void 0},["clear"===xa?cnMixSpace({pV:"2xs",pH:"s"}):void 0])},React.createElement(FlatSelectControlLayout,{form:e,disabled:f,separator:!0,onClear:ha,focusAtom:ca,iconClear:s,leftSide:U&&React.createElement(U,{size:"s"}),clearButtonAtom:la,size:x,view:xa,valueAtom:ra},React.createElement(FieldInput,{onFocus:da,onBlur:ea,ref:za,onChange:ga,value:u,defaultValue:v,disabled:f,placeholder:r}))),React.createElement(FlatSelectList,{className:cnFlatSelect("List",{borderTop:"clear"!==xa||t?void 0:ya,borderHorizontal:"clear"===xa?ya:void 0,borderBottom:"clear"!==xa||R?void 0:ya,formTop:ya&&!t?e:void 0,formBottom:ya&&!R?e:void 0},[S]),view:xa,size:x,form:e,valueAtom:oa,getItemKeyAtom:na,openAtom:aa,getOptionActions:_,listRef:useForkRef([ka,i]),renderItem:wa,getGroupLabel:k,visibleItemsAtom:ba,labelForCreate:l,isLoading:h,labelForEmptyItems:m,itemsRefs:ia,virtualScroll:n,onScrollToBottom:o,highlightedIndexAtom:ma,onChangeAll:pa,onChange:qa,inputValueAtom:ra,hasItemsAtom:sa,groupsCounterAtom:ta,dropdownZIndexAtom:ua,selectAllLabel:P,disabledAtom:ja}),R&&React.createElement(FlatSelectFooter,{view:xa,bordered:ya,form:e,footer:R}))};export var FlatSelect=withCtx(forwardRef(FlatSelectRender));
|
|
2
2
|
//# sourceMappingURL=FlatSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlatSelect.js","names":["React","forwardRef","FieldInput","useForkRef","cnMixSpace","cn","useSendToAtom","withCtx","withDefault","FlatSelectControlLayout","FlatSelectFooter","FlatSelectList","FlatSelectRoot","useFlatSelect","useRenderItem","cnFlatSelect","FlatSelectRender","p","ref","props","propsAtom","form","disabled","value","isLoading","listRefProp","listRef","renderItemProp","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","iconClear","input","inputValue","inputDefaultValue","inputRefProp","inputRef","size","viewProp","view","borderedProp","bordered","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChangeProp","onChange","onCreateProp","onCreate","onInput","multiple","groups","onOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel","autoFocus","footer","listClassName","anchorRef","IconLeft","iconLeft","direction","spareDirection","possibleDirections","otherProps","getOptionActions","openAtom","visibleItemsAtom","inputFocusAtom","handleInputFocus","handleInputBlur","handleInputChange","clearValue","optionsRefs","disabledAtom","clearButtonAtom","highlightedIndexAtom","getItemKeyAtom","valueAtom","onChangeAll","inputValueAtom","hasItemsAtom","groupsCounterAtom","dropdownZIndexAtom","rootRef","fieldInputRef","border","pV","pH","borderTop","borderHorizontal","borderBottom","formTop","formBottom","FlatSelect"],"sources":["../../../../../src/components/FlatSelect/FlatSelect.tsx"],"sourcesContent":["import './FlatSelect.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { FieldInput } from '##/components/FieldComponents';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { useSendToAtom, withCtx } from '##/utils/state';\n\nimport { withDefault } from './defaultProps';\nimport { FlatSelectControlLayout } from './FlatSelectControlLayout';\nimport { FlatSelectFooter } from './FlatSelectFooter';\nimport { FlatSelectList } from './FlatSelectList';\nimport { FlatSelectRoot } from './FlatSelectRoot';\nimport {\n FlatSelectComponent,\n FlatSelectGroupDefault,\n FlatSelectItemDefault,\n FlatSelectProps,\n} from './types';\nimport { useFlatSelect } from './useFlatSelect';\nimport { useRenderItem } from './useRenderItem';\n\nexport const cnFlatSelect = cn('FlatSelect');\n\nconst FlatSelectRender = (\n p: FlatSelectProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const props = withDefault(p);\n const propsAtom = useSendToAtom(props);\n\n const {\n form,\n disabled,\n value,\n isLoading,\n listRef: listRefProp,\n renderItem: renderItemProp,\n getGroupLabel,\n labelForCreate,\n labelForEmptyItems,\n virtualScroll,\n onScrollToBottom,\n style,\n className,\n placeholder,\n iconClear,\n input,\n inputValue,\n inputDefaultValue,\n inputRef: inputRefProp,\n size,\n view: viewProp,\n bordered: borderedProp,\n getGroupKey,\n getItemDisabled,\n getItemGroupKey,\n getItemKey,\n getItemLabel,\n items,\n onChange: onChangeProp,\n onCreate: onCreateProp,\n onInput,\n multiple,\n groups,\n onOpen,\n ignoreOutsideClicksRefs,\n clearButton,\n selectAll,\n selectAllLabel,\n autoFocus,\n footer,\n listClassName,\n anchorRef,\n iconLeft: IconLeft,\n direction,\n spareDirection,\n possibleDirections,\n ...otherProps\n } = props;\n\n const {\n getOptionActions,\n openAtom,\n visibleItemsAtom,\n inputFocusAtom,\n handleInputFocus,\n handleInputBlur,\n inputRef,\n handleInputChange,\n clearValue,\n optionsRefs,\n disabledAtom,\n listRef,\n clearButtonAtom,\n highlightedIndexAtom,\n getItemKeyAtom,\n valueAtom,\n onChangeAll,\n onChange,\n inputValueAtom,\n hasItemsAtom,\n groupsCounterAtom,\n dropdownZIndexAtom,\n rootRef,\n } = useFlatSelect<FlatSelectItemDefault, FlatSelectGroupDefault, false>({\n propsAtom,\n });\n\n const renderItem = useRenderItem({\n getItemLabel,\n getItemDisabled,\n multiple,\n disabled,\n size,\n renderItem: renderItemProp,\n });\n\n const view = !input || anchorRef || borderedProp ? 'clear' : viewProp;\n const bordered = anchorRef ? true : borderedProp;\n const fieldInputRef = useForkRef([inputRef, inputRefProp]);\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <FlatSelectRoot\n {...otherProps}\n ref={useForkRef([ref, rootRef])}\n className={cnFlatSelect(\n {\n view,\n bordered: view === 'clear' ? bordered : undefined,\n form: bordered ? form : undefined,\n size,\n },\n [className],\n )}\n style={{\n ...style,\n ['--flat-select-control-height' as string]: `var(--control-height-${size})`,\n }}\n anchorRef={anchorRef}\n openAtom={openAtom}\n tabIndex={0}\n direction={direction}\n spareDirection={spareDirection}\n possibleDirections={possibleDirections}\n >\n {input && (\n <div\n className={cnFlatSelect(\n 'Input',\n {\n border: view === 'clear' ? bordered : undefined,\n form: bordered ? form : undefined,\n },\n [view === 'clear' ? cnMixSpace({ pV: '2xs', pH: 's' }) : undefined],\n )}\n >\n <FlatSelectControlLayout\n form={form}\n disabled={disabled}\n separator\n onClear={clearValue}\n focusAtom={inputFocusAtom}\n iconClear={iconClear}\n leftSide={IconLeft && <IconLeft size=\"s\" />}\n clearButtonAtom={clearButtonAtom}\n size={size}\n view={view}\n valueAtom={inputValueAtom}\n >\n <FieldInput\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n ref={fieldInputRef}\n onChange={handleInputChange}\n value={inputValue}\n defaultValue={inputDefaultValue}\n disabled={disabled}\n placeholder={placeholder}\n />\n </FlatSelectControlLayout>\n </div>\n )}\n <FlatSelectList\n className={cnFlatSelect(\n 'List',\n {\n borderTop: view === 'clear' && !input ? bordered : undefined,\n borderHorizontal: view === 'clear' ? bordered : undefined,\n borderBottom: view === 'clear' && !footer ? bordered : undefined,\n formTop: bordered && !input ? form : undefined,\n formBottom: bordered && !footer ? form : undefined,\n },\n [listClassName],\n )}\n view={view}\n size={size}\n form={form}\n valueAtom={valueAtom}\n getItemKeyAtom={getItemKeyAtom}\n openAtom={openAtom}\n getOptionActions={getOptionActions}\n listRef={useForkRef([listRef, listRefProp])}\n renderItem={renderItem}\n getGroupLabel={getGroupLabel}\n visibleItemsAtom={visibleItemsAtom}\n labelForCreate={labelForCreate}\n isLoading={isLoading}\n labelForEmptyItems={labelForEmptyItems}\n itemsRefs={optionsRefs}\n virtualScroll={virtualScroll}\n onScrollToBottom={onScrollToBottom}\n highlightedIndexAtom={highlightedIndexAtom}\n onChangeAll={onChangeAll}\n onChange={onChange}\n inputValueAtom={inputValueAtom}\n hasItemsAtom={hasItemsAtom}\n groupsCounterAtom={groupsCounterAtom}\n dropdownZIndexAtom={dropdownZIndexAtom}\n selectAllLabel={selectAllLabel}\n disabledAtom={disabledAtom}\n />\n {footer && (\n <FlatSelectFooter\n view={view}\n bordered={bordered}\n form={form}\n footer={footer}\n />\n )}\n </FlatSelectRoot>\n );\n};\n\nexport const FlatSelect = withCtx(\n forwardRef(FlatSelectRender),\n) as FlatSelectComponent;\n"],"mappings":"i2CAAA,yBAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,UAAT,0BACA,OAASC,UAAT,8BACA,OAASC,UAAT,2BACA,OAASC,EAAT,uBACA,OAASC,aAAT,CAAwBC,OAAxB,yBAEA,OAASC,WAAT,sBACA,OAASC,uBAAT,iCACA,OAASC,gBAAT,0BACA,OAASC,cAAT,wBACA,OAASC,cAAT,wBAOA,OAASC,aAAT,u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AAEnC,EA/BZ,CAgCE,cAAc,CAAEoC,EAhClB,CAiCE,YAAY,CAAEC,EAjChB,CAkCE,iBAAiB,CAAEC,EAlCrB,CAmCE,kBAAkB,CAAEC,EAnCtB,CAoCE,cAAc,CAAE7B,CApClB,CAqCE,YAAY,CAAEoB,EArChB,EA5DF,CAmGGlB,CAAM,EACL,oBAAC,gBAAD,EACE,IAAI,CAAEtB,EADR,CAEE,QAAQ,CAAEE,EAFZ,CAGE,IAAI,CAAE1B,CAHR,CAIE,MAAM,CAAE8C,CAJV,EApGJ,CA6GH,CAjND,CAmNA,MAAO,IAAMsC,WAAU,CAAGlG,OAAO,CAC/BN,UAAU,CAACe,gBAAD,CADqB,CAA1B"}
|
|
1
|
+
{"version":3,"file":"FlatSelect.js","names":["React","forwardRef","FieldInput","useForkRef","cnMixSpace","cn","useSendToAtom","withCtx","withDefault","FlatSelectControlLayout","FlatSelectFooter","FlatSelectList","FlatSelectRoot","useFlatSelect","useRenderItem","cnFlatSelect","FlatSelectRender","p","ref","props","propsAtom","form","disabled","value","isLoading","listRefProp","listRef","renderItemProp","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","iconClear","input","inputValue","inputDefaultValue","inputRefProp","inputRef","size","viewProp","view","borderedProp","bordered","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChangeProp","onChange","onCreateProp","onCreate","onInput","multiple","groups","onOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel","autoFocus","footer","listClassName","anchorRef","IconLeft","iconLeft","direction","spareDirection","possibleDirections","container","otherProps","getOptionActions","openAtom","visibleItemsAtom","inputFocusAtom","handleInputFocus","handleInputBlur","handleInputChange","clearValue","optionsRefs","disabledAtom","clearButtonAtom","highlightedIndexAtom","getItemKeyAtom","valueAtom","onChangeAll","inputValueAtom","hasItemsAtom","groupsCounterAtom","dropdownZIndexAtom","rootRef","fieldInputRef","border","pV","pH","borderTop","borderHorizontal","borderBottom","formTop","formBottom","FlatSelect"],"sources":["../../../../../src/components/FlatSelect/FlatSelect.tsx"],"sourcesContent":["import './FlatSelect.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { FieldInput } from '##/components/FieldComponents';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { useSendToAtom, withCtx } from '##/utils/state';\n\nimport { withDefault } from './defaultProps';\nimport { FlatSelectControlLayout } from './FlatSelectControlLayout';\nimport { FlatSelectFooter } from './FlatSelectFooter';\nimport { FlatSelectList } from './FlatSelectList';\nimport { FlatSelectRoot } from './FlatSelectRoot';\nimport {\n FlatSelectComponent,\n FlatSelectGroupDefault,\n FlatSelectItemDefault,\n FlatSelectProps,\n} from './types';\nimport { useFlatSelect } from './useFlatSelect';\nimport { useRenderItem } from './useRenderItem';\n\nexport const cnFlatSelect = cn('FlatSelect');\n\nconst FlatSelectRender = (\n p: FlatSelectProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const props = withDefault(p);\n const propsAtom = useSendToAtom(props);\n\n const {\n form,\n disabled,\n value,\n isLoading,\n listRef: listRefProp,\n renderItem: renderItemProp,\n getGroupLabel,\n labelForCreate,\n labelForEmptyItems,\n virtualScroll,\n onScrollToBottom,\n style,\n className,\n placeholder,\n iconClear,\n input,\n inputValue,\n inputDefaultValue,\n inputRef: inputRefProp,\n size,\n view: viewProp,\n bordered: borderedProp,\n getGroupKey,\n getItemDisabled,\n getItemGroupKey,\n getItemKey,\n getItemLabel,\n items,\n onChange: onChangeProp,\n onCreate: onCreateProp,\n onInput,\n multiple,\n groups,\n onOpen,\n ignoreOutsideClicksRefs,\n clearButton,\n selectAll,\n selectAllLabel,\n autoFocus,\n footer,\n listClassName,\n anchorRef,\n iconLeft: IconLeft,\n direction,\n spareDirection,\n possibleDirections,\n container,\n ...otherProps\n } = props;\n\n const {\n getOptionActions,\n openAtom,\n visibleItemsAtom,\n inputFocusAtom,\n handleInputFocus,\n handleInputBlur,\n inputRef,\n handleInputChange,\n clearValue,\n optionsRefs,\n disabledAtom,\n listRef,\n clearButtonAtom,\n highlightedIndexAtom,\n getItemKeyAtom,\n valueAtom,\n onChangeAll,\n onChange,\n inputValueAtom,\n hasItemsAtom,\n groupsCounterAtom,\n dropdownZIndexAtom,\n rootRef,\n } = useFlatSelect<FlatSelectItemDefault, FlatSelectGroupDefault, false>({\n propsAtom,\n });\n\n const renderItem = useRenderItem({\n getItemLabel,\n getItemDisabled,\n multiple,\n disabled,\n size,\n renderItem: renderItemProp,\n });\n\n const view = !input || anchorRef || borderedProp ? 'clear' : viewProp;\n const bordered = anchorRef ? true : borderedProp;\n const fieldInputRef = useForkRef([inputRef, inputRefProp]);\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <FlatSelectRoot\n {...otherProps}\n ref={useForkRef([ref, rootRef])}\n className={cnFlatSelect(\n {\n view,\n bordered: view === 'clear' ? bordered : undefined,\n form: bordered ? form : undefined,\n size,\n },\n [className],\n )}\n style={{\n ...style,\n ['--flat-select-control-height' as string]: `var(--control-height-${size})`,\n }}\n anchorRef={anchorRef}\n openAtom={openAtom}\n tabIndex={0}\n direction={direction}\n spareDirection={spareDirection}\n possibleDirections={possibleDirections}\n container={container}\n >\n {input && (\n <div\n className={cnFlatSelect(\n 'Input',\n {\n border: view === 'clear' ? bordered : undefined,\n form: bordered ? form : undefined,\n },\n [view === 'clear' ? cnMixSpace({ pV: '2xs', pH: 's' }) : undefined],\n )}\n >\n <FlatSelectControlLayout\n form={form}\n disabled={disabled}\n separator\n onClear={clearValue}\n focusAtom={inputFocusAtom}\n iconClear={iconClear}\n leftSide={IconLeft && <IconLeft size=\"s\" />}\n clearButtonAtom={clearButtonAtom}\n size={size}\n view={view}\n valueAtom={inputValueAtom}\n >\n <FieldInput\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n ref={fieldInputRef}\n onChange={handleInputChange}\n value={inputValue}\n defaultValue={inputDefaultValue}\n disabled={disabled}\n placeholder={placeholder}\n />\n </FlatSelectControlLayout>\n </div>\n )}\n <FlatSelectList\n className={cnFlatSelect(\n 'List',\n {\n borderTop: view === 'clear' && !input ? bordered : undefined,\n borderHorizontal: view === 'clear' ? bordered : undefined,\n borderBottom: view === 'clear' && !footer ? bordered : undefined,\n formTop: bordered && !input ? form : undefined,\n formBottom: bordered && !footer ? form : undefined,\n },\n [listClassName],\n )}\n view={view}\n size={size}\n form={form}\n valueAtom={valueAtom}\n getItemKeyAtom={getItemKeyAtom}\n openAtom={openAtom}\n getOptionActions={getOptionActions}\n listRef={useForkRef([listRef, listRefProp])}\n renderItem={renderItem}\n getGroupLabel={getGroupLabel}\n visibleItemsAtom={visibleItemsAtom}\n labelForCreate={labelForCreate}\n isLoading={isLoading}\n labelForEmptyItems={labelForEmptyItems}\n itemsRefs={optionsRefs}\n virtualScroll={virtualScroll}\n onScrollToBottom={onScrollToBottom}\n highlightedIndexAtom={highlightedIndexAtom}\n onChangeAll={onChangeAll}\n onChange={onChange}\n inputValueAtom={inputValueAtom}\n hasItemsAtom={hasItemsAtom}\n groupsCounterAtom={groupsCounterAtom}\n dropdownZIndexAtom={dropdownZIndexAtom}\n selectAllLabel={selectAllLabel}\n disabledAtom={disabledAtom}\n />\n {footer && (\n <FlatSelectFooter\n view={view}\n bordered={bordered}\n form={form}\n footer={footer}\n />\n )}\n </FlatSelectRoot>\n );\n};\n\nexport const FlatSelect = withCtx(\n forwardRef(FlatSelectRender),\n) as FlatSelectComponent;\n"],"mappings":"62CAAA,yBAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,UAAT,0BACA,OAASC,UAAT,8BACA,OAASC,UAAT,2BACA,OAASC,EAAT,uBACA,OAASC,aAAT,CAAwBC,OAAxB,yBAEA,OAASC,WAAT,sBACA,OAASC,uBAAT,iCACA,OAASC,gBAAT,0BACA,OAASC,cAAT,wBACA,OAASC,cAAT,wBAOA,OAASC,aA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,CA6BE,oBAAoB,CAAEuD,EA7BxB,CA8BE,WAAW,CAAEG,EA9Bf,CA+BE,QAAQ,CAAEpC,EA/BZ,CAgCE,cAAc,CAAEqC,EAhClB,CAiCE,YAAY,CAAEC,EAjChB,CAkCE,iBAAiB,CAAEC,EAlCrB,CAmCE,kBAAkB,CAAEC,EAnCtB,CAoCE,cAAc,CAAE9B,CApClB,CAqCE,YAAY,CAAEqB,EArChB,EA7DF,CAoGGnB,CAAM,EACL,oBAAC,gBAAD,EACE,IAAI,CAAEtB,EADR,CAEE,QAAQ,CAAEE,EAFZ,CAGE,IAAI,CAAE1B,CAHR,CAIE,MAAM,CAAE8C,CAJV,EArGJ,CA8GH,CAnND,CAqNA,MAAO,IAAMuC,WAAU,CAAGnG,OAAO,CAC/BN,UAAU,CAACe,gBAAD,CADqB,CAA1B"}
|
|
@@ -10,6 +10,7 @@ export type FlatSelectRootProps = PropsWithHTMLAttributesAndRef<{
|
|
|
10
10
|
spareDirection?: Direction;
|
|
11
11
|
possibleDirections?: Direction[];
|
|
12
12
|
viewportRef?: React.RefObject<HTMLElement>;
|
|
13
|
+
container?: Element;
|
|
13
14
|
}, HTMLDivElement>;
|
|
14
15
|
export declare const cnFlatSelectRoot: import("@bem-react/classname").ClassNameFormatter;
|
|
15
16
|
export declare const FlatSelectRoot: React.FC<FlatSelectRootProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","anchorRef","openAtom","direction","spareDirection","possibleDirections","viewportRef"];import"./FlatSelectRoot.css";import{useAtom}from"@reatom/npm-react";import React,{forwardRef,useRef}from"react";import{Transition}from"react-transition-group";import{Popover}from"../../Popover";import{useForkRef}from"../../../hooks/useForkRef";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate";import{cn}from"../../../utils/bem";export var cnFlatSelectRoot=cn("FlatSelectRoot");export var FlatSelectRoot=forwardRef(function(a,b){var c=a.className,d=a.anchorRef,e=a.openAtom,f=a.direction,g=void 0===f?"downStartLeft":f,h=a.spareDirection,i=void 0===h?"downStartLeft":h,j=a.possibleDirections,k=void 0===j?["downStartLeft","downStartRight","upStartLeft","upStartRight","leftStartDown","leftStartUp"]:j,l=a.viewportRef,m=_objectWithoutProperties(a,_excluded),
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","anchorRef","openAtom","direction","spareDirection","possibleDirections","viewportRef","container"];import"./FlatSelectRoot.css";import{useAtom}from"@reatom/npm-react";import React,{forwardRef,useRef}from"react";import{Transition}from"react-transition-group";import{Popover}from"../../Popover";import{useForkRef}from"../../../hooks/useForkRef";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate";import{cn}from"../../../utils/bem";export var cnFlatSelectRoot=cn("FlatSelectRoot");export var FlatSelectRoot=forwardRef(function(a,b){var c=a.className,d=a.anchorRef,e=a.openAtom,f=a.direction,g=void 0===f?"downStartLeft":f,h=a.spareDirection,i=void 0===h?"downStartLeft":h,j=a.possibleDirections,k=void 0===j?["downStartLeft","downStartRight","upStartLeft","upStartRight","leftStartDown","leftStartUp"]:j,l=a.viewportRef,m=a.container,n=_objectWithoutProperties(a,_excluded),o=useRef(null),p=useForkRef([o,b]),q=!!d,r=useAtom(e),s=_slicedToArray(r,1),t=s[0];return q?React.createElement(Transition,{in:t,unmountOnExit:!0,timeout:animateTimeout,nodeRef:o},function(a){return React.createElement(Popover,Object.assign({},n,{className:cnFlatSelectRoot({withAnchor:q},[c,cnMixPopoverAnimate({animate:a})]),ref:p,anchorRef:d,equalAnchorWidth:!0,offset:"2xs",direction:g,spareDirection:i,possibleDirections:k,viewportRef:l,container:m,role:"listbox"}))}):React.createElement("div",Object.assign({},n,{className:cnFlatSelectRoot(null,[c]),ref:b,role:"listbox"}))});
|
|
2
2
|
//# sourceMappingURL=FlatSelectRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlatSelectRoot.js","names":["useAtom","React","forwardRef","useRef","Transition","Popover","useForkRef","animateTimeout","cnMixPopoverAnimate","cn","cnFlatSelectRoot","FlatSelectRoot","props","ref","className","anchorRef","openAtom","direction","spareDirection","possibleDirections","viewportRef","otherProps","contentRef","contentForkedRef","withAnchor","open","animate"],"sources":["../../../../../../src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.tsx"],"sourcesContent":["import './FlatSelectRoot.css';\n\nimport { AtomMut } from '@reatom/framework';\nimport { useAtom } from '@reatom/npm-react';\nimport React, { forwardRef, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport { Direction, Popover } from '##/components/Popover';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { animateTimeout, cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type FlatSelectRootProps = PropsWithHTMLAttributesAndRef<\n {\n anchorRef?: React.RefObject<HTMLElement>;\n openAtom: AtomMut<boolean>;\n direction?: Direction;\n spareDirection?: Direction;\n possibleDirections?: Direction[];\n viewportRef?: React.RefObject<HTMLElement>;\n },\n HTMLDivElement\n>;\n\nexport const cnFlatSelectRoot = cn('FlatSelectRoot');\n\nexport const FlatSelectRoot: React.FC<FlatSelectRootProps> = forwardRef(\n (props, ref) => {\n const {\n className,\n anchorRef,\n openAtom,\n direction = 'downStartLeft',\n spareDirection = 'downStartLeft',\n possibleDirections = [\n 'downStartLeft',\n 'downStartRight',\n 'upStartLeft',\n 'upStartRight',\n 'leftStartDown',\n 'leftStartUp',\n ],\n viewportRef,\n ...otherProps\n } = props;\n\n const contentRef = useRef(null);\n const contentForkedRef = useForkRef([contentRef, ref]);\n const withAnchor = !!anchorRef;\n const [open] = useAtom(openAtom);\n\n if (withAnchor) {\n return (\n <Transition\n in={open}\n unmountOnExit\n timeout={animateTimeout}\n nodeRef={contentRef}\n >\n {(animate) => (\n <Popover\n {...otherProps}\n className={cnFlatSelectRoot({ withAnchor }, [\n className,\n cnMixPopoverAnimate({ animate }),\n ])}\n ref={contentForkedRef}\n anchorRef={anchorRef}\n equalAnchorWidth\n offset=\"2xs\"\n direction={direction}\n spareDirection={spareDirection}\n possibleDirections={possibleDirections}\n viewportRef={viewportRef}\n />\n )}\n </Transition>\n );\n }\n\n return (\n <div\n {...otherProps}\n className={cnFlatSelectRoot(null, [className])}\n ref={ref}\n />\n );\n },\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FlatSelectRoot.js","names":["useAtom","React","forwardRef","useRef","Transition","Popover","useForkRef","animateTimeout","cnMixPopoverAnimate","cn","cnFlatSelectRoot","FlatSelectRoot","props","ref","className","anchorRef","openAtom","direction","spareDirection","possibleDirections","viewportRef","container","otherProps","contentRef","contentForkedRef","withAnchor","open","animate"],"sources":["../../../../../../src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.tsx"],"sourcesContent":["import './FlatSelectRoot.css';\n\nimport { AtomMut } from '@reatom/framework';\nimport { useAtom } from '@reatom/npm-react';\nimport React, { forwardRef, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport { Direction, Popover } from '##/components/Popover';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { animateTimeout, cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type FlatSelectRootProps = PropsWithHTMLAttributesAndRef<\n {\n anchorRef?: React.RefObject<HTMLElement>;\n openAtom: AtomMut<boolean>;\n direction?: Direction;\n spareDirection?: Direction;\n possibleDirections?: Direction[];\n viewportRef?: React.RefObject<HTMLElement>;\n container?: Element;\n },\n HTMLDivElement\n>;\n\nexport const cnFlatSelectRoot = cn('FlatSelectRoot');\n\nexport const FlatSelectRoot: React.FC<FlatSelectRootProps> = forwardRef(\n (props, ref) => {\n const {\n className,\n anchorRef,\n openAtom,\n direction = 'downStartLeft',\n spareDirection = 'downStartLeft',\n possibleDirections = [\n 'downStartLeft',\n 'downStartRight',\n 'upStartLeft',\n 'upStartRight',\n 'leftStartDown',\n 'leftStartUp',\n ],\n viewportRef,\n container,\n ...otherProps\n } = props;\n\n const contentRef = useRef(null);\n const contentForkedRef = useForkRef([contentRef, ref]);\n const withAnchor = !!anchorRef;\n const [open] = useAtom(openAtom);\n\n if (withAnchor) {\n return (\n <Transition\n in={open}\n unmountOnExit\n timeout={animateTimeout}\n nodeRef={contentRef}\n >\n {(animate) => (\n <Popover\n {...otherProps}\n className={cnFlatSelectRoot({ withAnchor }, [\n className,\n cnMixPopoverAnimate({ animate }),\n ])}\n ref={contentForkedRef}\n anchorRef={anchorRef}\n equalAnchorWidth\n offset=\"2xs\"\n direction={direction}\n spareDirection={spareDirection}\n possibleDirections={possibleDirections}\n viewportRef={viewportRef}\n container={container}\n role=\"listbox\"\n />\n )}\n </Transition>\n );\n }\n\n return (\n <div\n {...otherProps}\n className={cnFlatSelectRoot(null, [className])}\n ref={ref}\n role=\"listbox\"\n />\n );\n },\n);\n"],"mappings":"qRAAA,6BAGA,OAASA,OAAT,KAAwB,mBAAxB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OAAoBC,OAApB,qBACA,OAASC,UAAT,iCACA,OAASC,cAAT,CAAyBC,mBAAzB,uCACA,OAASC,EAAT,0BAgBA,MAAO,IAAMC,iBAAgB,CAAGD,EAAE,CAAC,gBAAD,CAA3B,CAEP,MAAO,IAAME,eAA6C,CAAGT,UAAU,CACrE,SAACU,CAAD,CAAQC,CAAR,CAAgB,IAEZC,EAFY,CAkBVF,CAlBU,CAEZE,SAFY,CAGZC,CAHY,CAkBVH,CAlBU,CAGZG,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Z,2CACMC,CADN,EAEE,SAAS,CAAEZ,gBAAgB,CAAC,IAAD,CAAO,CAACI,CAAD,CAAP,CAF7B,CAGE,GAAG,CAAED,CAHP,CAIE,IAAI,CAAC,SAJP,GAOH,CAjEoE,CAAhE"}
|
|
@@ -102,6 +102,7 @@ export type FlatSelectPropsInit<ITEM = FlatSelectItemDefault, GROUP = FlatSelect
|
|
|
102
102
|
spareDirection?: Direction;
|
|
103
103
|
possibleDirections?: Direction[];
|
|
104
104
|
viewportRef?: React.RefObject<HTMLElement>;
|
|
105
|
+
container?: Element;
|
|
105
106
|
}, HTMLDivElement>;
|
|
106
107
|
/**
|
|
107
108
|
* Props for the FlatSelect component.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/components/FlatSelect/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport { FieldPropSize, FieldPropView } from '##/components/FieldComponents';\nimport { Direction } from '##/components/Popover';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type RenderItemProps<ITEM> = {\n item: ITEM;\n active: boolean;\n hovered: boolean;\n onClick: (e: React.MouseEvent) => void;\n onMouseEnter: (e: React.MouseEvent) => void;\n ref: React.Ref<HTMLDivElement>;\n};\n\nexport type FlatSelectItemDefault = {\n label: string;\n id: string | number;\n groupId?: string | number;\n disabled?: boolean;\n};\n\nexport type FlatSelectGroupDefault = {\n label: string;\n id: string | number;\n};\n\nexport type FlatSelectPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type FlatSelectPropGetItemKey<ITEM> = (item: ITEM) => string | number;\nexport type FlatSelectPropGetItemGroupKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\nexport type FlatSelectPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\nexport type FlatSelectPropGetGroupKey<GROUP> = (\n group: GROUP,\n) => string | number;\nexport type FlatSelectPropGetGroupLabel<GROUP> = (group: GROUP) => string;\n\nexport type FlatSelectPropOnChange<ITEM, MULTIPLE extends boolean> = (\n value: (MULTIPLE extends true ? ITEM[] : ITEM) | null,\n props: {\n e: React.SyntheticEvent;\n },\n) => void;\nexport type FlatSelectPropValue<ITEM, MULTIPLE extends boolean> =\n | (MULTIPLE extends true ? ITEM[] : ITEM)\n | null\n | undefined;\n\nexport type FlatSelectPropRenderItem<ITEM> = (\n props: RenderItemProps<ITEM>,\n) => React.ReactNode | null;\n\nexport type FlatSelectPropRenderValue<ITEM, MULTIPLE> = MULTIPLE extends true\n ? (props: {\n value: ITEM[];\n getRemove: (\n item: ITEM,\n ) => (e: React.SyntheticEvent<Element, Event>) => void;\n }) => React.ReactNode | null\n : (props: { value: ITEM }) => React.ReactNode | null;\n\nexport type FlatSelectPropOnCreate = (\n label: string,\n props: { e: React.SyntheticEvent },\n) => void;\n\nexport type FlatSelectAllItem = {\n groupKey: string | number;\n __optionSelectAll: true;\n};\n\nexport type Group<ITEM, GROUP> = {\n items: ITEM[];\n key: string | number;\n group?: GROUP;\n};\n\nexport type CountedGroup<ITEM, GROUP> = Omit<Group<ITEM, GROUP>, 'items'> & {\n items: Array<FlatSelectAllItem | ITEM>;\n};\n\nexport type FlatSelectPropForm = 'default' | 'brick' | 'round';\n\nexport type FlatSelectPropsInit<\n ITEM = FlatSelectItemDefault,\n GROUP = FlatSelectGroupDefault,\n MULTIPLE extends boolean = false,\n> = PropsWithHTMLAttributesAndRef<\n {\n items: ITEM[];\n onChange: FlatSelectPropOnChange<ITEM, MULTIPLE>;\n disabled?: boolean;\n form?: 'default' | 'brick' | 'round';\n placeholder?: string;\n size?: FieldPropSize;\n isLoading?: boolean;\n listRef?: React.Ref<HTMLDivElement>;\n renderItem?: FlatSelectPropRenderItem<ITEM>;\n onInputFocus?: React.FocusEventHandler<HTMLInputElement>;\n onInputBlur?: React.FocusEventHandler<HTMLInputElement>;\n onCreate?: FlatSelectPropOnCreate;\n inputRef?: React.Ref<HTMLInputElement>;\n input?: boolean;\n inputValue?: string;\n inputDefaultValue?: string;\n onInput?: (value: string) => void;\n labelForCreate?:\n | ((label: string | undefined) => React.ReactNode)\n | React.ReactNode;\n labelForEmptyItems?: string;\n multiple?: MULTIPLE;\n value?: FlatSelectPropValue<ITEM, MULTIPLE>;\n groups?: GROUP[];\n getItemLabel?: FlatSelectPropGetItemLabel<ITEM>;\n getItemKey?: FlatSelectPropGetItemKey<ITEM>;\n getItemGroupKey?: FlatSelectPropGetItemGroupKey<ITEM>;\n getItemDisabled?: FlatSelectPropGetItemDisabled<ITEM>;\n getGroupLabel?: FlatSelectPropGetGroupLabel<GROUP>;\n getGroupKey?: FlatSelectPropGetGroupKey<GROUP>;\n virtualScroll?: boolean;\n onScrollToBottom?: (length: number) => void;\n onOpen?: (isOpen: boolean) => void;\n isOpen?: boolean;\n listClassName?: string;\n ignoreOutsideClicksRefs?: ReadonlyArray<React.RefObject<HTMLElement>>;\n clearButton?: boolean;\n iconClear?: IconComponent;\n iconLeft?: IconComponent;\n selectAll?: MULTIPLE extends true ? boolean : never;\n selectAllLabel?: string;\n footer?: React.ReactNode;\n view?: FieldPropView;\n bordered?: boolean;\n anchorRef?: React.RefObject<HTMLElement>;\n direction?: Direction;\n spareDirection?: Direction;\n possibleDirections?: Direction[];\n viewportRef?: React.RefObject<HTMLElement>;\n },\n HTMLDivElement\n>;\n\n/**\n * Props for the FlatSelect component.\n *\n * This type defines the props for the FlatSelect component, which is a customizable select component.\n * It allows for single or multiple selection, and supports grouping of items.\n * The component can be customized by providing custom item and group types.\n *\n * @template ITEM The type of the items in the select. Defaults to FlatSelectItemDefault.\n * @template GROUP The type of the groups in the select. Defaults to FlatSelectGroupDefault.\n * @template MULTIPLE Whether the select allows multiple selection. Defaults to false.\n */\nexport type FlatSelectProps<\n ITEM = FlatSelectItemDefault,\n GROUP = FlatSelectGroupDefault,\n MULTIPLE extends boolean = false,\n> = FlatSelectPropsInit<ITEM, GROUP, MULTIPLE> &\n (ITEM extends { label: FlatSelectItemDefault['label'] }\n ? {}\n : { getItemLabel: FlatSelectPropGetItemLabel<ITEM> }) &\n (ITEM extends { id: FlatSelectItemDefault['id'] }\n ? {}\n : { getItemKey: FlatSelectPropGetItemKey<ITEM> }) &\n (GROUP extends { label: FlatSelectGroupDefault['label'] }\n ? {}\n : { getGroupLabel: FlatSelectPropGetGroupLabel<GROUP> }) &\n (GROUP extends { id: FlatSelectGroupDefault['id'] }\n ? {}\n : { getGroupKey: FlatSelectPropGetGroupKey<GROUP> });\n\nexport type FlatSelectComponent = <\n ITEM = FlatSelectItemDefault,\n GROUP = FlatSelectGroupDefault,\n MULTIPLE extends boolean = false,\n>(\n props: FlatSelectProps<ITEM, GROUP, MULTIPLE>,\n) => React.ReactNode | null;\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/components/FlatSelect/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport { FieldPropSize, FieldPropView } from '##/components/FieldComponents';\nimport { Direction } from '##/components/Popover';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type RenderItemProps<ITEM> = {\n item: ITEM;\n active: boolean;\n hovered: boolean;\n onClick: (e: React.MouseEvent) => void;\n onMouseEnter: (e: React.MouseEvent) => void;\n ref: React.Ref<HTMLDivElement>;\n};\n\nexport type FlatSelectItemDefault = {\n label: string;\n id: string | number;\n groupId?: string | number;\n disabled?: boolean;\n};\n\nexport type FlatSelectGroupDefault = {\n label: string;\n id: string | number;\n};\n\nexport type FlatSelectPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type FlatSelectPropGetItemKey<ITEM> = (item: ITEM) => string | number;\nexport type FlatSelectPropGetItemGroupKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\nexport type FlatSelectPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\nexport type FlatSelectPropGetGroupKey<GROUP> = (\n group: GROUP,\n) => string | number;\nexport type FlatSelectPropGetGroupLabel<GROUP> = (group: GROUP) => string;\n\nexport type FlatSelectPropOnChange<ITEM, MULTIPLE extends boolean> = (\n value: (MULTIPLE extends true ? ITEM[] : ITEM) | null,\n props: {\n e: React.SyntheticEvent;\n },\n) => void;\nexport type FlatSelectPropValue<ITEM, MULTIPLE extends boolean> =\n | (MULTIPLE extends true ? ITEM[] : ITEM)\n | null\n | undefined;\n\nexport type FlatSelectPropRenderItem<ITEM> = (\n props: RenderItemProps<ITEM>,\n) => React.ReactNode | null;\n\nexport type FlatSelectPropRenderValue<ITEM, MULTIPLE> = MULTIPLE extends true\n ? (props: {\n value: ITEM[];\n getRemove: (\n item: ITEM,\n ) => (e: React.SyntheticEvent<Element, Event>) => void;\n }) => React.ReactNode | null\n : (props: { value: ITEM }) => React.ReactNode | null;\n\nexport type FlatSelectPropOnCreate = (\n label: string,\n props: { e: React.SyntheticEvent },\n) => void;\n\nexport type FlatSelectAllItem = {\n groupKey: string | number;\n __optionSelectAll: true;\n};\n\nexport type Group<ITEM, GROUP> = {\n items: ITEM[];\n key: string | number;\n group?: GROUP;\n};\n\nexport type CountedGroup<ITEM, GROUP> = Omit<Group<ITEM, GROUP>, 'items'> & {\n items: Array<FlatSelectAllItem | ITEM>;\n};\n\nexport type FlatSelectPropForm = 'default' | 'brick' | 'round';\n\nexport type FlatSelectPropsInit<\n ITEM = FlatSelectItemDefault,\n GROUP = FlatSelectGroupDefault,\n MULTIPLE extends boolean = false,\n> = PropsWithHTMLAttributesAndRef<\n {\n items: ITEM[];\n onChange: FlatSelectPropOnChange<ITEM, MULTIPLE>;\n disabled?: boolean;\n form?: 'default' | 'brick' | 'round';\n placeholder?: string;\n size?: FieldPropSize;\n isLoading?: boolean;\n listRef?: React.Ref<HTMLDivElement>;\n renderItem?: FlatSelectPropRenderItem<ITEM>;\n onInputFocus?: React.FocusEventHandler<HTMLInputElement>;\n onInputBlur?: React.FocusEventHandler<HTMLInputElement>;\n onCreate?: FlatSelectPropOnCreate;\n inputRef?: React.Ref<HTMLInputElement>;\n input?: boolean;\n inputValue?: string;\n inputDefaultValue?: string;\n onInput?: (value: string) => void;\n labelForCreate?:\n | ((label: string | undefined) => React.ReactNode)\n | React.ReactNode;\n labelForEmptyItems?: string;\n multiple?: MULTIPLE;\n value?: FlatSelectPropValue<ITEM, MULTIPLE>;\n groups?: GROUP[];\n getItemLabel?: FlatSelectPropGetItemLabel<ITEM>;\n getItemKey?: FlatSelectPropGetItemKey<ITEM>;\n getItemGroupKey?: FlatSelectPropGetItemGroupKey<ITEM>;\n getItemDisabled?: FlatSelectPropGetItemDisabled<ITEM>;\n getGroupLabel?: FlatSelectPropGetGroupLabel<GROUP>;\n getGroupKey?: FlatSelectPropGetGroupKey<GROUP>;\n virtualScroll?: boolean;\n onScrollToBottom?: (length: number) => void;\n onOpen?: (isOpen: boolean) => void;\n isOpen?: boolean;\n listClassName?: string;\n ignoreOutsideClicksRefs?: ReadonlyArray<React.RefObject<HTMLElement>>;\n clearButton?: boolean;\n iconClear?: IconComponent;\n iconLeft?: IconComponent;\n selectAll?: MULTIPLE extends true ? boolean : never;\n selectAllLabel?: string;\n footer?: React.ReactNode;\n view?: FieldPropView;\n bordered?: boolean;\n anchorRef?: React.RefObject<HTMLElement>;\n direction?: Direction;\n spareDirection?: Direction;\n possibleDirections?: Direction[];\n viewportRef?: React.RefObject<HTMLElement>;\n container?: Element;\n },\n HTMLDivElement\n>;\n\n/**\n * Props for the FlatSelect component.\n *\n * This type defines the props for the FlatSelect component, which is a customizable select component.\n * It allows for single or multiple selection, and supports grouping of items.\n * The component can be customized by providing custom item and group types.\n *\n * @template ITEM The type of the items in the select. Defaults to FlatSelectItemDefault.\n * @template GROUP The type of the groups in the select. Defaults to FlatSelectGroupDefault.\n * @template MULTIPLE Whether the select allows multiple selection. Defaults to false.\n */\nexport type FlatSelectProps<\n ITEM = FlatSelectItemDefault,\n GROUP = FlatSelectGroupDefault,\n MULTIPLE extends boolean = false,\n> = FlatSelectPropsInit<ITEM, GROUP, MULTIPLE> &\n (ITEM extends { label: FlatSelectItemDefault['label'] }\n ? {}\n : { getItemLabel: FlatSelectPropGetItemLabel<ITEM> }) &\n (ITEM extends { id: FlatSelectItemDefault['id'] }\n ? {}\n : { getItemKey: FlatSelectPropGetItemKey<ITEM> }) &\n (GROUP extends { label: FlatSelectGroupDefault['label'] }\n ? {}\n : { getGroupLabel: FlatSelectPropGetGroupLabel<GROUP> }) &\n (GROUP extends { id: FlatSelectGroupDefault['id'] }\n ? {}\n : { getGroupKey: FlatSelectPropGetGroupKey<GROUP> });\n\nexport type FlatSelectComponent = <\n ITEM = FlatSelectItemDefault,\n GROUP = FlatSelectGroupDefault,\n MULTIPLE extends boolean = false,\n>(\n props: FlatSelectProps<ITEM, GROUP, MULTIPLE>,\n) => React.ReactNode | null;\n"],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["placeholder","onBlur","onFocus","items","onChange","value","required","disabled","ariaLabel","id","dropdownRef","form","view","size","dropdownClassName","name","groups","getItemLabel","labelForEmptyItems","getItemKey","getItemGroupKey","getItemDisabled","getGroupKey","getGroupLabel","renderItem","isLoading","renderValue","inputRef","style","dropdownForm","onDropdownOpen","onScrollToBottom","virtualScroll","dropdownOpen","ignoreOutsideClicksRefs","dropdownViewportRef"];import"../SelectComponents/Select.css";import{IconSelect}from"@consta/icons/IconSelect";import React,{forwardRef,useRef}from"react";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{cnSelect,COMPONENT_NAME}from"../SelectComponents/cnSelect";import{defaultLabelForEmptyItems}from"../SelectComponents/helpers";import{SelectContainer}from"../SelectComponents/SelectContainer";import{SelectDropdown}from"../SelectComponents/SelectDropdown";import{SelectItem}from"../SelectComponents/SelectItem";import{defaultPropForm,defaultPropSize,defaultPropView}from"../SelectComponents/types";import{useSelect}from"../SelectComponents/useSelect";import{useForkRef}from"../../hooks/useForkRef";import{isNotNil}from"../../utils/type-guards";import{iconSizeMap,withDefaultGetters}from"./helpers";var SelectRender=function(a,b){var c=useRef(null),d=useRef(null),e=usePropsHandler(COMPONENT_NAME,withDefaultGetters(a),d),f=e.placeholder,g=e.onBlur,h=e.onFocus,i=e.items,j=e.onChange,k=e.value,l=e.required,m=e.disabled,n=e.ariaLabel,o=e.id,p=e.dropdownRef,q=e.form,r=void 0===q?defaultPropForm:q,s=e.view,t=void 0===s?defaultPropView:s,u=e.size,v=void 0===u?defaultPropSize:u,w=e.dropdownClassName,x=e.name,y=e.groups,z=void 0===y?[]:y,A=e.getItemLabel,B=e.labelForEmptyItems,C=void 0===B?defaultLabelForEmptyItems:B,D=e.getItemKey,E=e.getItemGroupKey,F=e.getItemDisabled,G=e.getGroupKey,H=e.getGroupLabel,I=e.renderItem,J=e.isLoading,K=e.renderValue,L=e.inputRef,M=e.style,N=e.dropdownForm,O=void 0===N?"default":N,P=e.onDropdownOpen,Q=e.onScrollToBottom,R=e.virtualScroll,S=e.dropdownOpen,T=e.ignoreOutsideClicksRefs,U=e.dropdownViewportRef,V=_objectWithoutProperties(e,_excluded),
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["placeholder","onBlur","onFocus","items","onChange","value","required","disabled","ariaLabel","id","dropdownRef","form","view","size","dropdownClassName","name","groups","getItemLabel","labelForEmptyItems","getItemKey","getItemGroupKey","getItemDisabled","getGroupKey","getGroupLabel","renderItem","isLoading","renderValue","inputRef","style","dropdownForm","onDropdownOpen","onScrollToBottom","virtualScroll","dropdownOpen","ignoreOutsideClicksRefs","dropdownViewportRef","dropdownContainer"];import"../SelectComponents/Select.css";import{IconSelect}from"@consta/icons/IconSelect";import React,{forwardRef,useRef}from"react";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";import{cnSelect,COMPONENT_NAME}from"../SelectComponents/cnSelect";import{defaultLabelForEmptyItems}from"../SelectComponents/helpers";import{SelectContainer}from"../SelectComponents/SelectContainer";import{SelectDropdown}from"../SelectComponents/SelectDropdown";import{SelectItem}from"../SelectComponents/SelectItem";import{defaultPropForm,defaultPropSize,defaultPropView}from"../SelectComponents/types";import{useSelect}from"../SelectComponents/useSelect";import{useForkRef}from"../../hooks/useForkRef";import{isNotNil}from"../../utils/type-guards";import{iconSizeMap,withDefaultGetters}from"./helpers";var SelectRender=function(a,b){var c=useRef(null),d=useRef(null),e=usePropsHandler(COMPONENT_NAME,withDefaultGetters(a),d),f=e.placeholder,g=e.onBlur,h=e.onFocus,i=e.items,j=e.onChange,k=e.value,l=e.required,m=e.disabled,n=e.ariaLabel,o=e.id,p=e.dropdownRef,q=e.form,r=void 0===q?defaultPropForm:q,s=e.view,t=void 0===s?defaultPropView:s,u=e.size,v=void 0===u?defaultPropSize:u,w=e.dropdownClassName,x=e.name,y=e.groups,z=void 0===y?[]:y,A=e.getItemLabel,B=e.labelForEmptyItems,C=void 0===B?defaultLabelForEmptyItems:B,D=e.getItemKey,E=e.getItemGroupKey,F=e.getItemDisabled,G=e.getGroupKey,H=e.getGroupLabel,I=e.renderItem,J=e.isLoading,K=e.renderValue,L=e.inputRef,M=e.style,N=e.dropdownForm,O=void 0===N?"default":N,P=e.onDropdownOpen,Q=e.onScrollToBottom,R=e.virtualScroll,S=e.dropdownOpen,T=e.ignoreOutsideClicksRefs,U=e.dropdownViewportRef,V=e.dropdownContainer,W=_objectWithoutProperties(e,_excluded),X=useSelect({items:i,groups:z,value:k,onChange:j,dropdownRef:c,controlRef:d,disabled:m,getItemLabel:A,getItemKey:D,getGroupKey:G,getItemGroupKey:E,getItemDisabled:F,multiple:!1,onBlur:g,onFocus:h,onDropdownOpen:P,dropdownOpen:S,ignoreOutsideClicksRefs:T}),Y=X.getKeyProps,Z=X.getOptionProps,$=X.isOpen,_=X.visibleItems,aa=X.isFocused,ba=X.handleInputFocus,ca=X.handleInputBlur,da=X.handleToggleDropdown,ea=X.inputRef,fa=X.handleInputClick,ga=X.notFound,ha=X.hasItems,ia=X.optionsRefs,ja=o?"".concat(o,"-input"):o;return React.createElement(React.Fragment,null,React.createElement(SelectContainer,Object.assign({focused:aa,disabled:m,size:v,view:t,form:r,required:l,ref:b,style:M,id:ja},W),React.createElement("div",{className:cnSelect("Control"),ref:d,"aria-expanded":$,"aria-haspopup":"listbox",id:o},React.createElement("div",{className:cnSelect("ControlInner")},React.createElement("div",{className:cnSelect("ControlValueContainer")},React.createElement("input",Object.assign({},Y(),{className:cnSelect("FakeField"),type:"text",name:x,id:ja,onFocus:ba,onBlur:ca,"aria-label":n,onClick:fa,ref:useForkRef([ea,L]),readOnly:!0})),isNotNil(k)&&(K||function renderValueDefault(a){var b=A(a.item);return React.createElement("span",{className:cnSelect("ControlValue"),title:b},b)})({item:k}),!isNotNil(k)&&f&&React.createElement("span",{className:cnSelect("Placeholder"),title:"placeholder"},f))),React.createElement("span",{className:cnSelect("Indicators")},React.createElement("button",{type:"button",className:cnSelect("IndicatorsDropdown"),tabIndex:-1,onClick:da},React.createElement(IconSelect,{size:iconSizeMap[v],className:cnSelect("DropdownIndicatorIcon")}))))),React.createElement(SelectDropdown,{isOpen:$,size:v,controlRef:d,getOptionProps:Z,dropdownRef:useForkRef([p,c]),form:O,className:w,renderItem:I||function renderItemDefault(a){var b=a.item,c=a.active,d=a.hovered,e=a.onClick,f=a.onMouseEnter,g=a.ref;return React.createElement(SelectItem,{label:A(b),active:c,hovered:d,multiple:!1,size:v,indent:"round"===O?"increased":"normal",onClick:e,onMouseEnter:f,disabled:F(b),ref:g})},getGroupLabel:H,visibleItems:_,notFound:ga,isLoading:J,labelForEmptyItems:C,hasItems:ha,itemsRefs:ia,virtualScroll:R,onScrollToBottom:Q,viewportRef:U,container:V,style:"number"==typeof(null===M||void 0===M?void 0:M.zIndex)?{zIndex:M.zIndex+1}:void 0}))};export var Select=forwardRef(SelectRender);export*from"./helpers";
|
|
2
2
|
//# sourceMappingURL=Select.js.map
|