intergalactic 15.44.0-prerelease-31e38034 → 15.44.0-prerelease-45bee306
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/date-picker/index.d.ts +4 -1
- package/date-picker/lib/cjs/index.d.js.map +1 -1
- package/date-picker/lib/es6/index.d.js.map +1 -1
- package/date-picker/lib/types/index.d.ts +4 -1
- package/package.json +1 -1
- package/popper/index.d.ts +5 -1
- package/popper/lib/cjs/index.d.js.map +1 -1
- package/popper/lib/es6/index.d.js.map +1 -1
- package/popper/lib/types/index.d.ts +5 -1
- package/tooltip/lib/cjs/Tooltip.js +7 -2
- package/tooltip/lib/cjs/Tooltip.js.map +1 -1
- package/tooltip/lib/es6/Tooltip.js +7 -2
- package/tooltip/lib/es6/Tooltip.js.map +1 -1
- package/wizard/lib/cjs/Wizard.js +17 -1
- package/wizard/lib/cjs/Wizard.js.map +1 -1
- package/wizard/lib/es6/Wizard.js +17 -1
- package/wizard/lib/es6/Wizard.js.map +1 -1
package/CHANGELOG.md
CHANGED
@@ -28,12 +28,22 @@
|
|
28
28
|
|
29
29
|
### @semcore/popper
|
30
30
|
|
31
|
+
- **Added** `disabled` prop to types.
|
31
32
|
- **Changed** When keyboard users are focus-triggered closing popper, trigger is highlighted with focus ring while actually focus is placed on the sibling invisible element.
|
33
|
+
- **Changed** When keyboard users are focus-triggered closing popper, trigger is highlighted with focus ring while actually focus is placed on the sibling invisible element.
|
34
|
+
|
35
|
+
### @semcore/tooltip
|
36
|
+
|
37
|
+
- **Fixed** `aria-haspopup` for `disabled` tooltips.
|
32
38
|
|
33
39
|
### @semcore/utils
|
34
40
|
|
35
41
|
- **Changed** `keyboardFocusEnhance` got context based keyboard focus enforcing.
|
36
42
|
|
43
|
+
### @semcore/wizard
|
44
|
+
|
45
|
+
- **Fixed** When focus is lost during the step change, the focus is moved to the wizard first focusable element.
|
46
|
+
|
37
47
|
## [15.43.0] - 2023-12-19
|
38
48
|
|
39
49
|
### @semcore/core
|
package/date-picker/index.d.ts
CHANGED
@@ -95,7 +95,10 @@ declare const Calendar: Intergalactic.Component<
|
|
95
95
|
|
96
96
|
/** @deprecated */
|
97
97
|
export interface IDatePickerProps extends DatePickerProps, UnknownProperties {}
|
98
|
-
export type DatePickerProps =
|
98
|
+
export type DatePickerProps = Intergalactic.InternalTypings.EfficientOmit<
|
99
|
+
DropdownProps,
|
100
|
+
'disabled'
|
101
|
+
> &
|
99
102
|
WithI18nEnhanceProps & {
|
100
103
|
/**
|
101
104
|
* The selected date, accepts everything which is accepted by `new Date()`
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React, { ChangeEvent, ComponentProps } from 'react';\nimport dayjs from 'dayjs';\nimport { Flex, Box, BoxProps } from '@semcore/flex-box';\nimport { UnknownProperties, Intergalactic, PropGetterFn } from '@semcore/core';\nimport Button, { ButtonProps } from '@semcore/button';\nimport Dropdown, { DropdownProps, DropdownTriggerProps } from '@semcore/dropdown';\nimport { WithI18nEnhanceProps } from '@semcore/utils/lib/enhances/i18nEnhance';\nimport BaseTrigger, { BaseTriggerProps } from '@semcore/base-trigger';\nimport Input, { InputProps, InputValueProps } from '@semcore/input';\nimport { InputMaskValueProps } from '@semcore/input-mask';\nimport Checkbox from '@semcore/checkbox';\n\nexport type DateConstructorParams = string | number | Date;\n\n/** @deprecated */\nexport interface ICalendarProps extends CalendarProps, UnknownProperties {}\nexport type CalendarProps = BoxProps & {\n /**\n * Locale for displaying the days of a week and months, to be transferred to `Intl`\n * @default en\n * */\n locale?: NavigatorLanguage['language'];\n /**\n * Array of dates blocked for selection\n * Accepts the date or the range of dates for specifying infinity ([Date | false, Date | false]), crontab(6,7)\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * @ignore\n * */\n highlighted?: DateConstructorParams[];\n /**\n * @ignore\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date[]) => void;\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: Date;\n\n renderOutdated?: boolean;\n};\n\n/** @deprecated */\nexport interface ICalendarDaysContext extends CalendarDaysContext, UnknownProperties {}\nexport type CalendarDaysContext = {\n days: CalendarUnitProps[];\n};\n\n/** @deprecated */\nexport interface ICalendarMonthsContext extends CalendarMonthsContext, UnknownProperties {}\nexport type CalendarMonthsContext = {\n months: CalendarUnitProps[];\n};\n\n/** @deprecated */\nexport interface ICalendarUnitProps extends CalendarUnitProps, UnknownProperties {}\nexport type CalendarUnitProps = BoxProps & {\n selected?: boolean;\n outdated?: boolean;\n disabled?: boolean;\n today?: boolean;\n startSelected?: boolean;\n endSelected?: boolean;\n highlighted?: boolean;\n startHighlighted?: boolean;\n endHighlighted?: boolean;\n date?: Date;\n children?: React.ReactNode;\n};\n\n/** @deprecated */\nexport interface ICalendarContext extends CalendarContext, UnknownProperties {}\nexport type CalendarContext = {\n getUnitProps: PropGetterFn;\n};\n\ndeclare const Calendar: Intergalactic.Component<\n 'div',\n CalendarProps,\n CalendarContext & CalendarDaysContext,\n [handlers: AbstractDatePickerHandlers]\n> & {\n Unit: Intergalactic.Component<'div', CalendarUnitProps>;\n};\n\n/** @deprecated */\nexport interface IDatePickerProps extends DatePickerProps, UnknownProperties {}\nexport type DatePickerProps = DropdownProps &\n WithI18nEnhanceProps & {\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams;\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultValue?: DateConstructorParams;\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n };\n\n/** @deprecated */\nexport interface IDateRangePickerProps extends DateRangePickerProps, UnknownProperties {}\nexport type DateRangePickerProps = DropdownProps &\n WithI18nEnhanceProps & {\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams[];\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultValue?: DateConstructorParams[];\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date[]) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l' | 'xl';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * Remove the 'Reset' button\n * */\n unclearable?: boolean;\n /**\n * To be activated upon selecting the date\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `highlighted` and `value` that user see before explicitly applying it.\n */\n preselectedValue?: DateConstructorParams[];\n /**\n * Normally called when user preselects a date range and when user applies this range.\n */\n onPreselectedValueChange?: (date: Date[]) => void;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n };\n\n/** @deprecated */\nexport interface IDateRangePickerPeriodProps\n extends DateRangePickerPeriodProps,\n UnknownProperties {}\nexport type DateRangePickerPeriodProps = BoxProps & {\n /**\n * Current selected period\n * */\n value?: DateConstructorParams[];\n /**\n * To be activated by clicking the button for switching the selected period.\n * */\n onChange?: (date: Date[]) => void;\n /**\n * To be activated by hovering a cursor over the button for changing the current displayed month.\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * To be activated by hovering a cursor over the button for selecting the dates.\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n};\n\n/** @deprecated */\nexport interface IDatePickerContext extends DatePickerContext, UnknownProperties {}\nexport type DatePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getTodayProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface IAbstractDatePickerHandlers\n extends AbstractDatePickerHandlers,\n UnknownProperties {}\nexport type AbstractDatePickerHandlers = {\n displayedPeriod: (value: DateConstructorParams) => void;\n visible: (index: boolean) => void;\n highlighted: (list: DateConstructorParams[]) => void;\n value: (index: DateConstructorParams) => void;\n};\n\n/** @deprecated */\nexport interface IDatePickerHandlers extends DatePickerHandlers, UnknownProperties {}\nexport type DatePickerHandlers = {\n visible: (index: boolean) => void;\n};\n\n/** @deprecated */\nexport interface IInputTriggerProps extends InputTriggerProps, UnknownProperties {}\nexport type BaseInputTriggerProps = InputProps & {\n /**\n * Date input placeholder characters\n * @default { year: 'Y'; month: 'M'; day: 'D' }\n */\n placeholders?: { year: string; month: string; day: string };\n locale?: string;\n onDisplayedPeriodChange?: (date: Date) => void;\n};\nexport type InputTriggerProps = BaseInputTriggerProps & {\n value?: Date;\n onChange?: (date: Date, event: ChangeEvent) => void;\n};\n\nexport type RangeInputTriggerProps = BaseInputTriggerProps & {\n value?: Date[];\n onChange?: (date: Date[], event: ChangeEvent) => void;\n};\n\n/** @deprecated */\nexport interface ISingleDateInputProps extends SingleDateInputProps, UnknownProperties {}\nexport type SingleDateInputProps = InputTriggerProps & {};\n\n/** @deprecated */\nexport interface IDateRangeProps extends DateRangeProps, UnknownProperties {}\nexport type DateRangeProps = RangeInputTriggerProps & {};\n\n/** @deprecated */\nexport interface IDatePickerMaskedInputProps\n extends DatePickerMaskedInputProps,\n UnknownProperties {}\nexport type DatePickerMaskedInputProps = {\n date?: Date;\n onDateChange?: (date: Date, event: ChangeEvent) => void;\n onDisplayedPeriodChange?: (date: Date) => void;\n locale?: string;\n parts?: { year: Boolean; month: Boolean; day: Boolean };\n disabledDates?: (Date | (Date | false)[] | string)[];\n};\n\ndeclare const InputTrigger: Intergalactic.Component<\n 'div',\n DropdownTriggerProps & InputTriggerProps\n> & {\n Addon: typeof Input.Addon;\n Value: typeof Input.Value;\n SingleDateInput: Intergalactic.Component<'div', InputProps & SingleDateInputProps> & {\n Indicator: typeof Input.Addon;\n MaskedInput: Intergalactic.Component<'input', InputMaskValueProps & DatePickerMaskedInputProps>;\n };\n};\n\ndeclare const RangeInputTrigger: Intergalactic.Component<\n 'div',\n DropdownTriggerProps & RangeInputTriggerProps\n> & {\n Addon: typeof Input.Addon;\n Value: typeof Input.Value;\n DateRange: Intergalactic.Component<'div', InputValueProps & DateRangeProps> & {\n Indicator: typeof Input.Addon;\n RangeSep: typeof Input.Addon;\n FromMaskedInput: Intergalactic.Component<\n 'input',\n InputMaskValueProps & DatePickerMaskedInputProps\n >;\n ToMaskedInput: Intergalactic.Component<\n 'input',\n InputMaskValueProps & DatePickerMaskedInputProps\n >;\n };\n};\n\ndeclare const DatePicker: Intergalactic.Component<\n 'div',\n DatePickerProps,\n DatePickerContext & CalendarDaysContext\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof InputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DatePickerProps, DatePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Today: typeof Box;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IDateRangePickerContext extends DateRangePickerContext, UnknownProperties {}\nexport type DateRangePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\ndeclare const DateRangePicker: Intergalactic.Component<\n 'div',\n DateRangePickerProps,\n DateRangePickerContext & CalendarDaysContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof RangeInputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DateRangePickerProps, DateRangePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Period: Intergalactic.Component<'div', DateRangePickerPeriodProps>;\n Apply: typeof Button;\n Reset: typeof Button;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IMonthPickerContext extends MonthPickerContext, UnknownProperties {}\nexport type MonthPickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n};\n\ndeclare const MonthPicker: Intergalactic.Component<\n 'div',\n DatePickerProps,\n MonthPickerContext & CalendarMonthsContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof InputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DatePickerProps, MonthPickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IMonthRangePickerContext extends MonthRangePickerContext, UnknownProperties {}\nexport type MonthRangePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\ndeclare const MonthRangePicker: Intergalactic.Component<\n 'div',\n DateRangePickerProps,\n MonthRangePickerContext & CalendarMonthsContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof RangeInputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DateRangePickerProps, MonthRangePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Period: Intergalactic.Component<'div', DateRangePickerPeriodProps>;\n Apply: typeof Button;\n Reset: typeof Button;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\nexport type DateRangeComparatorProps = DropdownProps &\n WithI18nEnhanceProps & {\n /**\n * Selected date ranges\n * */\n value?: { value?: DateConstructorParams[]; compare?: DateConstructorParams[] };\n /**\n * Default value for selected date ranges\n * */\n defaultValue?: { value?: DateConstructorParams[]; compare?: DateConstructorParams[] };\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n /**\n * Called with selected date when user clicks `Apply` button.\n * */\n onChange?: (ranges: {\n value?: DateConstructorParams[];\n compare?: DateConstructorParams[];\n }) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l' | 'xl';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n compareHighlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onCompareHighlightedChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `highlighted` and `value` that user see before explicitly applying it.\n */\n preselectedValue?: DateConstructorParams[];\n /**\n * Normally called when user preselects a date range and when user applies this range.\n */\n onPreselectedValueChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `compareHighlighted` and `compare` that user see before explicitly applying it.\n */\n preselectedCompare?: DateConstructorParams[];\n /**\n * Normally called when user preselects a compare range and when user applies ranges.\n */\n onPreselectedCompareChange?: (date: Date[]) => void;\n /**\n * Controls that compare range input is enabled.\n */\n compareToggle?: boolean;\n /**\n * Toggles when compare range input enables or disables.\n */\n onCompareToggleChange?: (compareToggle: boolean) => void;\n /**\n * Controls which date range is focused.\n */\n focusedRange?: 'value' | 'compare';\n /**\n * Called when user focuses or is focused on some of the date ranges.\n */\n onFocusedRangeChange?: (focusedRange: 'value' | 'compare') => void;\n /**\n * Remove the 'Reset' button\n * */\n unclearable?: boolean;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n };\n\nexport type DateRangeComparatorContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\nexport type DateRangeComparatorTriggerProps = DropdownTriggerProps &\n BaseTriggerProps & {\n /**\n * Text between the selected date range and the compared date range when both are selected.\n * @default 'vs.'\n */\n separator?: string;\n /**\n * Trigger text when no ranges are selected.\n */\n placeholder?: string;\n };\n\ndeclare const DateRangeComparator: Intergalactic.Component<\n 'div',\n DateRangeComparatorProps,\n DateRangeComparatorContext & CalendarDaysContext\n> & {\n Popper: typeof Dropdown.Popper;\n Header: typeof Flex;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Apply: typeof Button;\n Reset: typeof Button;\n\n CalendarHeader: typeof Box;\n Title: typeof Box;\n\n Trigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n ValueDateRange: Intergalactic.Component<'div', InputTriggerProps>;\n CompareToggle: typeof Checkbox;\n CompareDateRange: Intergalactic.Component<'div', InputTriggerProps>;\n Body: typeof Flex;\n RangeCalendar: typeof Flex;\n Periods: typeof Flex;\n Footer: typeof Flex;\n};\n\ndeclare const MonthDateRangeComparator: typeof DateRangeComparator;\n\nexport {\n DatePicker,\n DateRangePicker,\n MonthPicker,\n MonthRangePicker,\n DateRangeComparator,\n MonthDateRangeComparator,\n};\n"],"mappings":""}
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React, { ChangeEvent, ComponentProps } from 'react';\nimport dayjs from 'dayjs';\nimport { Flex, Box, BoxProps } from '@semcore/flex-box';\nimport { UnknownProperties, Intergalactic, PropGetterFn } from '@semcore/core';\nimport Button, { ButtonProps } from '@semcore/button';\nimport Dropdown, { DropdownProps, DropdownTriggerProps } from '@semcore/dropdown';\nimport { WithI18nEnhanceProps } from '@semcore/utils/lib/enhances/i18nEnhance';\nimport BaseTrigger, { BaseTriggerProps } from '@semcore/base-trigger';\nimport Input, { InputProps, InputValueProps } from '@semcore/input';\nimport { InputMaskValueProps } from '@semcore/input-mask';\nimport Checkbox from '@semcore/checkbox';\n\nexport type DateConstructorParams = string | number | Date;\n\n/** @deprecated */\nexport interface ICalendarProps extends CalendarProps, UnknownProperties {}\nexport type CalendarProps = BoxProps & {\n /**\n * Locale for displaying the days of a week and months, to be transferred to `Intl`\n * @default en\n * */\n locale?: NavigatorLanguage['language'];\n /**\n * Array of dates blocked for selection\n * Accepts the date or the range of dates for specifying infinity ([Date | false, Date | false]), crontab(6,7)\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * @ignore\n * */\n highlighted?: DateConstructorParams[];\n /**\n * @ignore\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date[]) => void;\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: Date;\n\n renderOutdated?: boolean;\n};\n\n/** @deprecated */\nexport interface ICalendarDaysContext extends CalendarDaysContext, UnknownProperties {}\nexport type CalendarDaysContext = {\n days: CalendarUnitProps[];\n};\n\n/** @deprecated */\nexport interface ICalendarMonthsContext extends CalendarMonthsContext, UnknownProperties {}\nexport type CalendarMonthsContext = {\n months: CalendarUnitProps[];\n};\n\n/** @deprecated */\nexport interface ICalendarUnitProps extends CalendarUnitProps, UnknownProperties {}\nexport type CalendarUnitProps = BoxProps & {\n selected?: boolean;\n outdated?: boolean;\n disabled?: boolean;\n today?: boolean;\n startSelected?: boolean;\n endSelected?: boolean;\n highlighted?: boolean;\n startHighlighted?: boolean;\n endHighlighted?: boolean;\n date?: Date;\n children?: React.ReactNode;\n};\n\n/** @deprecated */\nexport interface ICalendarContext extends CalendarContext, UnknownProperties {}\nexport type CalendarContext = {\n getUnitProps: PropGetterFn;\n};\n\ndeclare const Calendar: Intergalactic.Component<\n 'div',\n CalendarProps,\n CalendarContext & CalendarDaysContext,\n [handlers: AbstractDatePickerHandlers]\n> & {\n Unit: Intergalactic.Component<'div', CalendarUnitProps>;\n};\n\n/** @deprecated */\nexport interface IDatePickerProps extends DatePickerProps, UnknownProperties {}\nexport type DatePickerProps = Intergalactic.InternalTypings.EfficientOmit<\n DropdownProps,\n 'disabled'\n> &\n WithI18nEnhanceProps & {\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams;\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultValue?: DateConstructorParams;\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n };\n\n/** @deprecated */\nexport interface IDateRangePickerProps extends DateRangePickerProps, UnknownProperties {}\nexport type DateRangePickerProps = DropdownProps &\n WithI18nEnhanceProps & {\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams[];\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultValue?: DateConstructorParams[];\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date[]) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l' | 'xl';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * Remove the 'Reset' button\n * */\n unclearable?: boolean;\n /**\n * To be activated upon selecting the date\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `highlighted` and `value` that user see before explicitly applying it.\n */\n preselectedValue?: DateConstructorParams[];\n /**\n * Normally called when user preselects a date range and when user applies this range.\n */\n onPreselectedValueChange?: (date: Date[]) => void;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n };\n\n/** @deprecated */\nexport interface IDateRangePickerPeriodProps\n extends DateRangePickerPeriodProps,\n UnknownProperties {}\nexport type DateRangePickerPeriodProps = BoxProps & {\n /**\n * Current selected period\n * */\n value?: DateConstructorParams[];\n /**\n * To be activated by clicking the button for switching the selected period.\n * */\n onChange?: (date: Date[]) => void;\n /**\n * To be activated by hovering a cursor over the button for changing the current displayed month.\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * To be activated by hovering a cursor over the button for selecting the dates.\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n};\n\n/** @deprecated */\nexport interface IDatePickerContext extends DatePickerContext, UnknownProperties {}\nexport type DatePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getTodayProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface IAbstractDatePickerHandlers\n extends AbstractDatePickerHandlers,\n UnknownProperties {}\nexport type AbstractDatePickerHandlers = {\n displayedPeriod: (value: DateConstructorParams) => void;\n visible: (index: boolean) => void;\n highlighted: (list: DateConstructorParams[]) => void;\n value: (index: DateConstructorParams) => void;\n};\n\n/** @deprecated */\nexport interface IDatePickerHandlers extends DatePickerHandlers, UnknownProperties {}\nexport type DatePickerHandlers = {\n visible: (index: boolean) => void;\n};\n\n/** @deprecated */\nexport interface IInputTriggerProps extends InputTriggerProps, UnknownProperties {}\nexport type BaseInputTriggerProps = InputProps & {\n /**\n * Date input placeholder characters\n * @default { year: 'Y'; month: 'M'; day: 'D' }\n */\n placeholders?: { year: string; month: string; day: string };\n locale?: string;\n onDisplayedPeriodChange?: (date: Date) => void;\n};\nexport type InputTriggerProps = BaseInputTriggerProps & {\n value?: Date;\n onChange?: (date: Date, event: ChangeEvent) => void;\n};\n\nexport type RangeInputTriggerProps = BaseInputTriggerProps & {\n value?: Date[];\n onChange?: (date: Date[], event: ChangeEvent) => void;\n};\n\n/** @deprecated */\nexport interface ISingleDateInputProps extends SingleDateInputProps, UnknownProperties {}\nexport type SingleDateInputProps = InputTriggerProps & {};\n\n/** @deprecated */\nexport interface IDateRangeProps extends DateRangeProps, UnknownProperties {}\nexport type DateRangeProps = RangeInputTriggerProps & {};\n\n/** @deprecated */\nexport interface IDatePickerMaskedInputProps\n extends DatePickerMaskedInputProps,\n UnknownProperties {}\nexport type DatePickerMaskedInputProps = {\n date?: Date;\n onDateChange?: (date: Date, event: ChangeEvent) => void;\n onDisplayedPeriodChange?: (date: Date) => void;\n locale?: string;\n parts?: { year: Boolean; month: Boolean; day: Boolean };\n disabledDates?: (Date | (Date | false)[] | string)[];\n};\n\ndeclare const InputTrigger: Intergalactic.Component<\n 'div',\n DropdownTriggerProps & InputTriggerProps\n> & {\n Addon: typeof Input.Addon;\n Value: typeof Input.Value;\n SingleDateInput: Intergalactic.Component<'div', InputProps & SingleDateInputProps> & {\n Indicator: typeof Input.Addon;\n MaskedInput: Intergalactic.Component<'input', InputMaskValueProps & DatePickerMaskedInputProps>;\n };\n};\n\ndeclare const RangeInputTrigger: Intergalactic.Component<\n 'div',\n DropdownTriggerProps & RangeInputTriggerProps\n> & {\n Addon: typeof Input.Addon;\n Value: typeof Input.Value;\n DateRange: Intergalactic.Component<'div', InputValueProps & DateRangeProps> & {\n Indicator: typeof Input.Addon;\n RangeSep: typeof Input.Addon;\n FromMaskedInput: Intergalactic.Component<\n 'input',\n InputMaskValueProps & DatePickerMaskedInputProps\n >;\n ToMaskedInput: Intergalactic.Component<\n 'input',\n InputMaskValueProps & DatePickerMaskedInputProps\n >;\n };\n};\n\ndeclare const DatePicker: Intergalactic.Component<\n 'div',\n DatePickerProps,\n DatePickerContext & CalendarDaysContext\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof InputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DatePickerProps, DatePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Today: typeof Box;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IDateRangePickerContext extends DateRangePickerContext, UnknownProperties {}\nexport type DateRangePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\ndeclare const DateRangePicker: Intergalactic.Component<\n 'div',\n DateRangePickerProps,\n DateRangePickerContext & CalendarDaysContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof RangeInputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DateRangePickerProps, DateRangePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Period: Intergalactic.Component<'div', DateRangePickerPeriodProps>;\n Apply: typeof Button;\n Reset: typeof Button;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IMonthPickerContext extends MonthPickerContext, UnknownProperties {}\nexport type MonthPickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n};\n\ndeclare const MonthPicker: Intergalactic.Component<\n 'div',\n DatePickerProps,\n MonthPickerContext & CalendarMonthsContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof InputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DatePickerProps, MonthPickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IMonthRangePickerContext extends MonthRangePickerContext, UnknownProperties {}\nexport type MonthRangePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\ndeclare const MonthRangePicker: Intergalactic.Component<\n 'div',\n DateRangePickerProps,\n MonthRangePickerContext & CalendarMonthsContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof RangeInputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DateRangePickerProps, MonthRangePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Period: Intergalactic.Component<'div', DateRangePickerPeriodProps>;\n Apply: typeof Button;\n Reset: typeof Button;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\nexport type DateRangeComparatorProps = DropdownProps &\n WithI18nEnhanceProps & {\n /**\n * Selected date ranges\n * */\n value?: { value?: DateConstructorParams[]; compare?: DateConstructorParams[] };\n /**\n * Default value for selected date ranges\n * */\n defaultValue?: { value?: DateConstructorParams[]; compare?: DateConstructorParams[] };\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n /**\n * Called with selected date when user clicks `Apply` button.\n * */\n onChange?: (ranges: {\n value?: DateConstructorParams[];\n compare?: DateConstructorParams[];\n }) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l' | 'xl';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n compareHighlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onCompareHighlightedChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `highlighted` and `value` that user see before explicitly applying it.\n */\n preselectedValue?: DateConstructorParams[];\n /**\n * Normally called when user preselects a date range and when user applies this range.\n */\n onPreselectedValueChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `compareHighlighted` and `compare` that user see before explicitly applying it.\n */\n preselectedCompare?: DateConstructorParams[];\n /**\n * Normally called when user preselects a compare range and when user applies ranges.\n */\n onPreselectedCompareChange?: (date: Date[]) => void;\n /**\n * Controls that compare range input is enabled.\n */\n compareToggle?: boolean;\n /**\n * Toggles when compare range input enables or disables.\n */\n onCompareToggleChange?: (compareToggle: boolean) => void;\n /**\n * Controls which date range is focused.\n */\n focusedRange?: 'value' | 'compare';\n /**\n * Called when user focuses or is focused on some of the date ranges.\n */\n onFocusedRangeChange?: (focusedRange: 'value' | 'compare') => void;\n /**\n * Remove the 'Reset' button\n * */\n unclearable?: boolean;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n };\n\nexport type DateRangeComparatorContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\nexport type DateRangeComparatorTriggerProps = DropdownTriggerProps &\n BaseTriggerProps & {\n /**\n * Text between the selected date range and the compared date range when both are selected.\n * @default 'vs.'\n */\n separator?: string;\n /**\n * Trigger text when no ranges are selected.\n */\n placeholder?: string;\n };\n\ndeclare const DateRangeComparator: Intergalactic.Component<\n 'div',\n DateRangeComparatorProps,\n DateRangeComparatorContext & CalendarDaysContext\n> & {\n Popper: typeof Dropdown.Popper;\n Header: typeof Flex;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Apply: typeof Button;\n Reset: typeof Button;\n\n CalendarHeader: typeof Box;\n Title: typeof Box;\n\n Trigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n ValueDateRange: Intergalactic.Component<'div', InputTriggerProps>;\n CompareToggle: typeof Checkbox;\n CompareDateRange: Intergalactic.Component<'div', InputTriggerProps>;\n Body: typeof Flex;\n RangeCalendar: typeof Flex;\n Periods: typeof Flex;\n Footer: typeof Flex;\n};\n\ndeclare const MonthDateRangeComparator: typeof DateRangeComparator;\n\nexport {\n DatePicker,\n DateRangePicker,\n MonthPicker,\n MonthRangePicker,\n DateRangeComparator,\n MonthDateRangeComparator,\n};\n"],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React, { ChangeEvent, ComponentProps } from 'react';\nimport dayjs from 'dayjs';\nimport { Flex, Box, BoxProps } from '@semcore/flex-box';\nimport { UnknownProperties, Intergalactic, PropGetterFn } from '@semcore/core';\nimport Button, { ButtonProps } from '@semcore/button';\nimport Dropdown, { DropdownProps, DropdownTriggerProps } from '@semcore/dropdown';\nimport { WithI18nEnhanceProps } from '@semcore/utils/lib/enhances/i18nEnhance';\nimport BaseTrigger, { BaseTriggerProps } from '@semcore/base-trigger';\nimport Input, { InputProps, InputValueProps } from '@semcore/input';\nimport { InputMaskValueProps } from '@semcore/input-mask';\nimport Checkbox from '@semcore/checkbox';\n\nexport type DateConstructorParams = string | number | Date;\n\n/** @deprecated */\nexport interface ICalendarProps extends CalendarProps, UnknownProperties {}\nexport type CalendarProps = BoxProps & {\n /**\n * Locale for displaying the days of a week and months, to be transferred to `Intl`\n * @default en\n * */\n locale?: NavigatorLanguage['language'];\n /**\n * Array of dates blocked for selection\n * Accepts the date or the range of dates for specifying infinity ([Date | false, Date | false]), crontab(6,7)\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * @ignore\n * */\n highlighted?: DateConstructorParams[];\n /**\n * @ignore\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date[]) => void;\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: Date;\n\n renderOutdated?: boolean;\n};\n\n/** @deprecated */\nexport interface ICalendarDaysContext extends CalendarDaysContext, UnknownProperties {}\nexport type CalendarDaysContext = {\n days: CalendarUnitProps[];\n};\n\n/** @deprecated */\nexport interface ICalendarMonthsContext extends CalendarMonthsContext, UnknownProperties {}\nexport type CalendarMonthsContext = {\n months: CalendarUnitProps[];\n};\n\n/** @deprecated */\nexport interface ICalendarUnitProps extends CalendarUnitProps, UnknownProperties {}\nexport type CalendarUnitProps = BoxProps & {\n selected?: boolean;\n outdated?: boolean;\n disabled?: boolean;\n today?: boolean;\n startSelected?: boolean;\n endSelected?: boolean;\n highlighted?: boolean;\n startHighlighted?: boolean;\n endHighlighted?: boolean;\n date?: Date;\n children?: React.ReactNode;\n};\n\n/** @deprecated */\nexport interface ICalendarContext extends CalendarContext, UnknownProperties {}\nexport type CalendarContext = {\n getUnitProps: PropGetterFn;\n};\n\ndeclare const Calendar: Intergalactic.Component<\n 'div',\n CalendarProps,\n CalendarContext & CalendarDaysContext,\n [handlers: AbstractDatePickerHandlers]\n> & {\n Unit: Intergalactic.Component<'div', CalendarUnitProps>;\n};\n\n/** @deprecated */\nexport interface IDatePickerProps extends DatePickerProps, UnknownProperties {}\nexport type DatePickerProps = DropdownProps &\n WithI18nEnhanceProps & {\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams;\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultValue?: DateConstructorParams;\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n };\n\n/** @deprecated */\nexport interface IDateRangePickerProps extends DateRangePickerProps, UnknownProperties {}\nexport type DateRangePickerProps = DropdownProps &\n WithI18nEnhanceProps & {\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams[];\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultValue?: DateConstructorParams[];\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date[]) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l' | 'xl';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * Remove the 'Reset' button\n * */\n unclearable?: boolean;\n /**\n * To be activated upon selecting the date\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `highlighted` and `value` that user see before explicitly applying it.\n */\n preselectedValue?: DateConstructorParams[];\n /**\n * Normally called when user preselects a date range and when user applies this range.\n */\n onPreselectedValueChange?: (date: Date[]) => void;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n };\n\n/** @deprecated */\nexport interface IDateRangePickerPeriodProps\n extends DateRangePickerPeriodProps,\n UnknownProperties {}\nexport type DateRangePickerPeriodProps = BoxProps & {\n /**\n * Current selected period\n * */\n value?: DateConstructorParams[];\n /**\n * To be activated by clicking the button for switching the selected period.\n * */\n onChange?: (date: Date[]) => void;\n /**\n * To be activated by hovering a cursor over the button for changing the current displayed month.\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * To be activated by hovering a cursor over the button for selecting the dates.\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n};\n\n/** @deprecated */\nexport interface IDatePickerContext extends DatePickerContext, UnknownProperties {}\nexport type DatePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getTodayProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface IAbstractDatePickerHandlers\n extends AbstractDatePickerHandlers,\n UnknownProperties {}\nexport type AbstractDatePickerHandlers = {\n displayedPeriod: (value: DateConstructorParams) => void;\n visible: (index: boolean) => void;\n highlighted: (list: DateConstructorParams[]) => void;\n value: (index: DateConstructorParams) => void;\n};\n\n/** @deprecated */\nexport interface IDatePickerHandlers extends DatePickerHandlers, UnknownProperties {}\nexport type DatePickerHandlers = {\n visible: (index: boolean) => void;\n};\n\n/** @deprecated */\nexport interface IInputTriggerProps extends InputTriggerProps, UnknownProperties {}\nexport type BaseInputTriggerProps = InputProps & {\n /**\n * Date input placeholder characters\n * @default { year: 'Y'; month: 'M'; day: 'D' }\n */\n placeholders?: { year: string; month: string; day: string };\n locale?: string;\n onDisplayedPeriodChange?: (date: Date) => void;\n};\nexport type InputTriggerProps = BaseInputTriggerProps & {\n value?: Date;\n onChange?: (date: Date, event: ChangeEvent) => void;\n};\n\nexport type RangeInputTriggerProps = BaseInputTriggerProps & {\n value?: Date[];\n onChange?: (date: Date[], event: ChangeEvent) => void;\n};\n\n/** @deprecated */\nexport interface ISingleDateInputProps extends SingleDateInputProps, UnknownProperties {}\nexport type SingleDateInputProps = InputTriggerProps & {};\n\n/** @deprecated */\nexport interface IDateRangeProps extends DateRangeProps, UnknownProperties {}\nexport type DateRangeProps = RangeInputTriggerProps & {};\n\n/** @deprecated */\nexport interface IDatePickerMaskedInputProps\n extends DatePickerMaskedInputProps,\n UnknownProperties {}\nexport type DatePickerMaskedInputProps = {\n date?: Date;\n onDateChange?: (date: Date, event: ChangeEvent) => void;\n onDisplayedPeriodChange?: (date: Date) => void;\n locale?: string;\n parts?: { year: Boolean; month: Boolean; day: Boolean };\n disabledDates?: (Date | (Date | false)[] | string)[];\n};\n\ndeclare const InputTrigger: Intergalactic.Component<\n 'div',\n DropdownTriggerProps & InputTriggerProps\n> & {\n Addon: typeof Input.Addon;\n Value: typeof Input.Value;\n SingleDateInput: Intergalactic.Component<'div', InputProps & SingleDateInputProps> & {\n Indicator: typeof Input.Addon;\n MaskedInput: Intergalactic.Component<'input', InputMaskValueProps & DatePickerMaskedInputProps>;\n };\n};\n\ndeclare const RangeInputTrigger: Intergalactic.Component<\n 'div',\n DropdownTriggerProps & RangeInputTriggerProps\n> & {\n Addon: typeof Input.Addon;\n Value: typeof Input.Value;\n DateRange: Intergalactic.Component<'div', InputValueProps & DateRangeProps> & {\n Indicator: typeof Input.Addon;\n RangeSep: typeof Input.Addon;\n FromMaskedInput: Intergalactic.Component<\n 'input',\n InputMaskValueProps & DatePickerMaskedInputProps\n >;\n ToMaskedInput: Intergalactic.Component<\n 'input',\n InputMaskValueProps & DatePickerMaskedInputProps\n >;\n };\n};\n\ndeclare const DatePicker: Intergalactic.Component<\n 'div',\n DatePickerProps,\n DatePickerContext & CalendarDaysContext\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof InputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DatePickerProps, DatePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Today: typeof Box;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IDateRangePickerContext extends DateRangePickerContext, UnknownProperties {}\nexport type DateRangePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\ndeclare const DateRangePicker: Intergalactic.Component<\n 'div',\n DateRangePickerProps,\n DateRangePickerContext & CalendarDaysContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof RangeInputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DateRangePickerProps, DateRangePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Period: Intergalactic.Component<'div', DateRangePickerPeriodProps>;\n Apply: typeof Button;\n Reset: typeof Button;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IMonthPickerContext extends MonthPickerContext, UnknownProperties {}\nexport type MonthPickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n};\n\ndeclare const MonthPicker: Intergalactic.Component<\n 'div',\n DatePickerProps,\n MonthPickerContext & CalendarMonthsContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof InputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DatePickerProps, MonthPickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IMonthRangePickerContext extends MonthRangePickerContext, UnknownProperties {}\nexport type MonthRangePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\ndeclare const MonthRangePicker: Intergalactic.Component<\n 'div',\n DateRangePickerProps,\n MonthRangePickerContext & CalendarMonthsContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof RangeInputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DateRangePickerProps, MonthRangePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Period: Intergalactic.Component<'div', DateRangePickerPeriodProps>;\n Apply: typeof Button;\n Reset: typeof Button;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\nexport type DateRangeComparatorProps = DropdownProps &\n WithI18nEnhanceProps & {\n /**\n * Selected date ranges\n * */\n value?: { value?: DateConstructorParams[]; compare?: DateConstructorParams[] };\n /**\n * Default value for selected date ranges\n * */\n defaultValue?: { value?: DateConstructorParams[]; compare?: DateConstructorParams[] };\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n /**\n * Called with selected date when user clicks `Apply` button.\n * */\n onChange?: (ranges: {\n value?: DateConstructorParams[];\n compare?: DateConstructorParams[];\n }) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l' | 'xl';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n compareHighlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onCompareHighlightedChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `highlighted` and `value` that user see before explicitly applying it.\n */\n preselectedValue?: DateConstructorParams[];\n /**\n * Normally called when user preselects a date range and when user applies this range.\n */\n onPreselectedValueChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `compareHighlighted` and `compare` that user see before explicitly applying it.\n */\n preselectedCompare?: DateConstructorParams[];\n /**\n * Normally called when user preselects a compare range and when user applies ranges.\n */\n onPreselectedCompareChange?: (date: Date[]) => void;\n /**\n * Controls that compare range input is enabled.\n */\n compareToggle?: boolean;\n /**\n * Toggles when compare range input enables or disables.\n */\n onCompareToggleChange?: (compareToggle: boolean) => void;\n /**\n * Controls which date range is focused.\n */\n focusedRange?: 'value' | 'compare';\n /**\n * Called when user focuses or is focused on some of the date ranges.\n */\n onFocusedRangeChange?: (focusedRange: 'value' | 'compare') => void;\n /**\n * Remove the 'Reset' button\n * */\n unclearable?: boolean;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n };\n\nexport type DateRangeComparatorContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\nexport type DateRangeComparatorTriggerProps = DropdownTriggerProps &\n BaseTriggerProps & {\n /**\n * Text between the selected date range and the compared date range when both are selected.\n * @default 'vs.'\n */\n separator?: string;\n /**\n * Trigger text when no ranges are selected.\n */\n placeholder?: string;\n };\n\ndeclare const DateRangeComparator: Intergalactic.Component<\n 'div',\n DateRangeComparatorProps,\n DateRangeComparatorContext & CalendarDaysContext\n> & {\n Popper: typeof Dropdown.Popper;\n Header: typeof Flex;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Apply: typeof Button;\n Reset: typeof Button;\n\n CalendarHeader: typeof Box;\n Title: typeof Box;\n\n Trigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n ValueDateRange: Intergalactic.Component<'div', InputTriggerProps>;\n CompareToggle: typeof Checkbox;\n CompareDateRange: Intergalactic.Component<'div', InputTriggerProps>;\n Body: typeof Flex;\n RangeCalendar: typeof Flex;\n Periods: typeof Flex;\n Footer: typeof Flex;\n};\n\ndeclare const MonthDateRangeComparator: typeof DateRangeComparator;\n\nexport {\n DatePicker,\n DateRangePicker,\n MonthPicker,\n MonthRangePicker,\n DateRangeComparator,\n MonthDateRangeComparator,\n};\n"],"mappings":""}
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React, { ChangeEvent, ComponentProps } from 'react';\nimport dayjs from 'dayjs';\nimport { Flex, Box, BoxProps } from '@semcore/flex-box';\nimport { UnknownProperties, Intergalactic, PropGetterFn } from '@semcore/core';\nimport Button, { ButtonProps } from '@semcore/button';\nimport Dropdown, { DropdownProps, DropdownTriggerProps } from '@semcore/dropdown';\nimport { WithI18nEnhanceProps } from '@semcore/utils/lib/enhances/i18nEnhance';\nimport BaseTrigger, { BaseTriggerProps } from '@semcore/base-trigger';\nimport Input, { InputProps, InputValueProps } from '@semcore/input';\nimport { InputMaskValueProps } from '@semcore/input-mask';\nimport Checkbox from '@semcore/checkbox';\n\nexport type DateConstructorParams = string | number | Date;\n\n/** @deprecated */\nexport interface ICalendarProps extends CalendarProps, UnknownProperties {}\nexport type CalendarProps = BoxProps & {\n /**\n * Locale for displaying the days of a week and months, to be transferred to `Intl`\n * @default en\n * */\n locale?: NavigatorLanguage['language'];\n /**\n * Array of dates blocked for selection\n * Accepts the date or the range of dates for specifying infinity ([Date | false, Date | false]), crontab(6,7)\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * @ignore\n * */\n highlighted?: DateConstructorParams[];\n /**\n * @ignore\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date[]) => void;\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: Date;\n\n renderOutdated?: boolean;\n};\n\n/** @deprecated */\nexport interface ICalendarDaysContext extends CalendarDaysContext, UnknownProperties {}\nexport type CalendarDaysContext = {\n days: CalendarUnitProps[];\n};\n\n/** @deprecated */\nexport interface ICalendarMonthsContext extends CalendarMonthsContext, UnknownProperties {}\nexport type CalendarMonthsContext = {\n months: CalendarUnitProps[];\n};\n\n/** @deprecated */\nexport interface ICalendarUnitProps extends CalendarUnitProps, UnknownProperties {}\nexport type CalendarUnitProps = BoxProps & {\n selected?: boolean;\n outdated?: boolean;\n disabled?: boolean;\n today?: boolean;\n startSelected?: boolean;\n endSelected?: boolean;\n highlighted?: boolean;\n startHighlighted?: boolean;\n endHighlighted?: boolean;\n date?: Date;\n children?: React.ReactNode;\n};\n\n/** @deprecated */\nexport interface ICalendarContext extends CalendarContext, UnknownProperties {}\nexport type CalendarContext = {\n getUnitProps: PropGetterFn;\n};\n\ndeclare const Calendar: Intergalactic.Component<\n 'div',\n CalendarProps,\n CalendarContext & CalendarDaysContext,\n [handlers: AbstractDatePickerHandlers]\n> & {\n Unit: Intergalactic.Component<'div', CalendarUnitProps>;\n};\n\n/** @deprecated */\nexport interface IDatePickerProps extends DatePickerProps, UnknownProperties {}\nexport type DatePickerProps = Intergalactic.InternalTypings.EfficientOmit<\n DropdownProps,\n 'disabled'\n> &\n WithI18nEnhanceProps & {\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams;\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultValue?: DateConstructorParams;\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n };\n\n/** @deprecated */\nexport interface IDateRangePickerProps extends DateRangePickerProps, UnknownProperties {}\nexport type DateRangePickerProps = DropdownProps &\n WithI18nEnhanceProps & {\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams[];\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultValue?: DateConstructorParams[];\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date[]) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l' | 'xl';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * Remove the 'Reset' button\n * */\n unclearable?: boolean;\n /**\n * To be activated upon selecting the date\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `highlighted` and `value` that user see before explicitly applying it.\n */\n preselectedValue?: DateConstructorParams[];\n /**\n * Normally called when user preselects a date range and when user applies this range.\n */\n onPreselectedValueChange?: (date: Date[]) => void;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n };\n\n/** @deprecated */\nexport interface IDateRangePickerPeriodProps\n extends DateRangePickerPeriodProps,\n UnknownProperties {}\nexport type DateRangePickerPeriodProps = BoxProps & {\n /**\n * Current selected period\n * */\n value?: DateConstructorParams[];\n /**\n * To be activated by clicking the button for switching the selected period.\n * */\n onChange?: (date: Date[]) => void;\n /**\n * To be activated by hovering a cursor over the button for changing the current displayed month.\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * To be activated by hovering a cursor over the button for selecting the dates.\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n};\n\n/** @deprecated */\nexport interface IDatePickerContext extends DatePickerContext, UnknownProperties {}\nexport type DatePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getTodayProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface IAbstractDatePickerHandlers\n extends AbstractDatePickerHandlers,\n UnknownProperties {}\nexport type AbstractDatePickerHandlers = {\n displayedPeriod: (value: DateConstructorParams) => void;\n visible: (index: boolean) => void;\n highlighted: (list: DateConstructorParams[]) => void;\n value: (index: DateConstructorParams) => void;\n};\n\n/** @deprecated */\nexport interface IDatePickerHandlers extends DatePickerHandlers, UnknownProperties {}\nexport type DatePickerHandlers = {\n visible: (index: boolean) => void;\n};\n\n/** @deprecated */\nexport interface IInputTriggerProps extends InputTriggerProps, UnknownProperties {}\nexport type BaseInputTriggerProps = InputProps & {\n /**\n * Date input placeholder characters\n * @default { year: 'Y'; month: 'M'; day: 'D' }\n */\n placeholders?: { year: string; month: string; day: string };\n locale?: string;\n onDisplayedPeriodChange?: (date: Date) => void;\n};\nexport type InputTriggerProps = BaseInputTriggerProps & {\n value?: Date;\n onChange?: (date: Date, event: ChangeEvent) => void;\n};\n\nexport type RangeInputTriggerProps = BaseInputTriggerProps & {\n value?: Date[];\n onChange?: (date: Date[], event: ChangeEvent) => void;\n};\n\n/** @deprecated */\nexport interface ISingleDateInputProps extends SingleDateInputProps, UnknownProperties {}\nexport type SingleDateInputProps = InputTriggerProps & {};\n\n/** @deprecated */\nexport interface IDateRangeProps extends DateRangeProps, UnknownProperties {}\nexport type DateRangeProps = RangeInputTriggerProps & {};\n\n/** @deprecated */\nexport interface IDatePickerMaskedInputProps\n extends DatePickerMaskedInputProps,\n UnknownProperties {}\nexport type DatePickerMaskedInputProps = {\n date?: Date;\n onDateChange?: (date: Date, event: ChangeEvent) => void;\n onDisplayedPeriodChange?: (date: Date) => void;\n locale?: string;\n parts?: { year: Boolean; month: Boolean; day: Boolean };\n disabledDates?: (Date | (Date | false)[] | string)[];\n};\n\ndeclare const InputTrigger: Intergalactic.Component<\n 'div',\n DropdownTriggerProps & InputTriggerProps\n> & {\n Addon: typeof Input.Addon;\n Value: typeof Input.Value;\n SingleDateInput: Intergalactic.Component<'div', InputProps & SingleDateInputProps> & {\n Indicator: typeof Input.Addon;\n MaskedInput: Intergalactic.Component<'input', InputMaskValueProps & DatePickerMaskedInputProps>;\n };\n};\n\ndeclare const RangeInputTrigger: Intergalactic.Component<\n 'div',\n DropdownTriggerProps & RangeInputTriggerProps\n> & {\n Addon: typeof Input.Addon;\n Value: typeof Input.Value;\n DateRange: Intergalactic.Component<'div', InputValueProps & DateRangeProps> & {\n Indicator: typeof Input.Addon;\n RangeSep: typeof Input.Addon;\n FromMaskedInput: Intergalactic.Component<\n 'input',\n InputMaskValueProps & DatePickerMaskedInputProps\n >;\n ToMaskedInput: Intergalactic.Component<\n 'input',\n InputMaskValueProps & DatePickerMaskedInputProps\n >;\n };\n};\n\ndeclare const DatePicker: Intergalactic.Component<\n 'div',\n DatePickerProps,\n DatePickerContext & CalendarDaysContext\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof InputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DatePickerProps, DatePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Today: typeof Box;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IDateRangePickerContext extends DateRangePickerContext, UnknownProperties {}\nexport type DateRangePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\ndeclare const DateRangePicker: Intergalactic.Component<\n 'div',\n DateRangePickerProps,\n DateRangePickerContext & CalendarDaysContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof RangeInputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DateRangePickerProps, DateRangePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Period: Intergalactic.Component<'div', DateRangePickerPeriodProps>;\n Apply: typeof Button;\n Reset: typeof Button;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IMonthPickerContext extends MonthPickerContext, UnknownProperties {}\nexport type MonthPickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n};\n\ndeclare const MonthPicker: Intergalactic.Component<\n 'div',\n DatePickerProps,\n MonthPickerContext & CalendarMonthsContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof InputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DatePickerProps, MonthPickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IMonthRangePickerContext extends MonthRangePickerContext, UnknownProperties {}\nexport type MonthRangePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\ndeclare const MonthRangePicker: Intergalactic.Component<\n 'div',\n DateRangePickerProps,\n MonthRangePickerContext & CalendarMonthsContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof RangeInputTrigger;\n Popper: typeof Dropdown.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DateRangePickerProps, MonthRangePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Period: Intergalactic.Component<'div', DateRangePickerPeriodProps>;\n Apply: typeof Button;\n Reset: typeof Button;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\nexport type DateRangeComparatorProps = DropdownProps &\n WithI18nEnhanceProps & {\n /**\n * Selected date ranges\n * */\n value?: { value?: DateConstructorParams[]; compare?: DateConstructorParams[] };\n /**\n * Default value for selected date ranges\n * */\n defaultValue?: { value?: DateConstructorParams[]; compare?: DateConstructorParams[] };\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n /**\n * Called with selected date when user clicks `Apply` button.\n * */\n onChange?: (ranges: {\n value?: DateConstructorParams[];\n compare?: DateConstructorParams[];\n }) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (Date | (Date | false)[] | string)[];\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l' | 'xl';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n compareHighlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onCompareHighlightedChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `highlighted` and `value` that user see before explicitly applying it.\n */\n preselectedValue?: DateConstructorParams[];\n /**\n * Normally called when user preselects a date range and when user applies this range.\n */\n onPreselectedValueChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `compareHighlighted` and `compare` that user see before explicitly applying it.\n */\n preselectedCompare?: DateConstructorParams[];\n /**\n * Normally called when user preselects a compare range and when user applies ranges.\n */\n onPreselectedCompareChange?: (date: Date[]) => void;\n /**\n * Controls that compare range input is enabled.\n */\n compareToggle?: boolean;\n /**\n * Toggles when compare range input enables or disables.\n */\n onCompareToggleChange?: (compareToggle: boolean) => void;\n /**\n * Controls which date range is focused.\n */\n focusedRange?: 'value' | 'compare';\n /**\n * Called when user focuses or is focused on some of the date ranges.\n */\n onFocusedRangeChange?: (focusedRange: 'value' | 'compare') => void;\n /**\n * Remove the 'Reset' button\n * */\n unclearable?: boolean;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n };\n\nexport type DateRangeComparatorContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\nexport type DateRangeComparatorTriggerProps = DropdownTriggerProps &\n BaseTriggerProps & {\n /**\n * Text between the selected date range and the compared date range when both are selected.\n * @default 'vs.'\n */\n separator?: string;\n /**\n * Trigger text when no ranges are selected.\n */\n placeholder?: string;\n };\n\ndeclare const DateRangeComparator: Intergalactic.Component<\n 'div',\n DateRangeComparatorProps,\n DateRangeComparatorContext & CalendarDaysContext\n> & {\n Popper: typeof Dropdown.Popper;\n Header: typeof Flex;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Apply: typeof Button;\n Reset: typeof Button;\n\n CalendarHeader: typeof Box;\n Title: typeof Box;\n\n Trigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n ValueDateRange: Intergalactic.Component<'div', InputTriggerProps>;\n CompareToggle: typeof Checkbox;\n CompareDateRange: Intergalactic.Component<'div', InputTriggerProps>;\n Body: typeof Flex;\n RangeCalendar: typeof Flex;\n Periods: typeof Flex;\n Footer: typeof Flex;\n};\n\ndeclare const MonthDateRangeComparator: typeof DateRangeComparator;\n\nexport {\n DatePicker,\n DateRangePicker,\n MonthPicker,\n MonthRangePicker,\n DateRangeComparator,\n MonthDateRangeComparator,\n};\n"],"mappings":""}
|
@@ -95,7 +95,10 @@ declare const Calendar: Intergalactic.Component<
|
|
95
95
|
|
96
96
|
/** @deprecated */
|
97
97
|
export interface IDatePickerProps extends DatePickerProps, UnknownProperties {}
|
98
|
-
export type DatePickerProps =
|
98
|
+
export type DatePickerProps = Intergalactic.InternalTypings.EfficientOmit<
|
99
|
+
DropdownProps,
|
100
|
+
'disabled'
|
101
|
+
> &
|
99
102
|
WithI18nEnhanceProps & {
|
100
103
|
/**
|
101
104
|
* The selected date, accepts everything which is accepted by `new Date()`
|
package/package.json
CHANGED
package/popper/index.d.ts
CHANGED
@@ -73,7 +73,11 @@ export type PopperProps = OutsideClickProps &
|
|
73
73
|
eventListeners?: Partial<OptionsEventListeners>;
|
74
74
|
/** @ignore */
|
75
75
|
onFirstUpdate?: Options['onFirstUpdate'];
|
76
|
-
|
76
|
+
/**
|
77
|
+
* Flag for disable Popover (if true, it will close Popper and it will not respond to handlers)
|
78
|
+
* @default false
|
79
|
+
*/
|
80
|
+
disabled?: boolean;
|
77
81
|
/**
|
78
82
|
* Disabled focus trap, autofocus and focus return
|
79
83
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import { DOMAttributes } from 'react';\nimport { Options, Instance } from '@popperjs/core/lib/types';\nimport { Options as OptionsOffset } from '@popperjs/core/lib/modifiers/offset';\nimport { Options as OptionsPreventOverflow } from '@popperjs/core/lib/modifiers/preventOverflow';\nimport { Options as OptionsArrow } from '@popperjs/core/lib/modifiers/arrow';\nimport { Options as OptionsFlip } from '@popperjs/core/lib/modifiers/flip';\nimport { Options as OptionsComputeStyles } from '@popperjs/core/lib/modifiers/computeStyles';\nimport { Options as OptionsEventListeners } from '@popperjs/core/lib/modifiers/eventListeners';\n\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { OutsideClickProps } from '@semcore/outside-click';\nimport { PortalProps } from '@semcore/portal';\nimport { BoxProps } from '@semcore/flex-box';\nimport { ScaleProps } from '@semcore/animation';\nimport { NeighborLocationProps } from '@semcore/neighbor-location';\nimport { UniqueIDProps } from '@semcore/utils/lib/uniqueID';\n\nexport type eventInteraction = {\n trigger: [Array<keyof DOMAttributes<unknown>>, Array<keyof DOMAttributes<unknown>>];\n popper: [Array<keyof DOMAttributes<unknown>>, Array<keyof DOMAttributes<unknown>>];\n};\n\nexport type Strategy = Options['strategy'];\nexport type Modifiers = Options['modifiers'];\nexport type Placement = Options['placement'];\n\n/** @deprecated */\nexport interface IPopperProps extends PopperProps, UnknownProperties {}\nexport type PopperProps = OutsideClickProps &\n PortalProps &\n UniqueIDProps &\n Omit<ScaleProps, 'placement'> & {\n /**\n * Popper can have different positioning options\n * @default absolute\n */\n strategy?: Strategy;\n /**\n * Modifiers for popper.js\n */\n modifiers?: Modifiers;\n /**\n * The position of the popper relative to the trigger that called it.\n * 'auto-start' | 'auto' | 'auto-end' | 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-end' | 'bottom' | 'bottom-start' | 'left-end' | 'left' | 'left-start'\n * @default auto\n */\n placement?: Placement;\n /**\n * Interaction with a trigger to show and hide the popper\n * @default click\n */\n interaction?: 'click' | 'hover' | 'focus' | 'none' | eventInteraction;\n /** Timer to show and hide the popper */\n timeout?: number | [number, number];\n /** Popper visibility value */\n visible?: boolean;\n /** Default popper visibility\n * @default false */\n defaultVisible?: boolean;\n /** Function called when visibility changes */\n onVisibleChange?: (visible: boolean, e?: Event) => boolean | void;\n /** PopperJS modifier settings for popper indent */\n offset?: Partial<OptionsOffset> | number | [number, number];\n /** PopperJS modifier settings for finding borders */\n preventOverflow?: Partial<OptionsPreventOverflow>;\n /** PopperJS modifier settings responsible for the arrow */\n arrow?: Partial<OptionsArrow>;\n /** PopperJS modifier settings responsible for turning the popper when there is not enough space */\n flip?: Partial<OptionsFlip>;\n /** PopperJS modifier settings for applying styles */\n computeStyles?: Partial<OptionsComputeStyles>;\n /** PopperJS modifier settings responsible for subscribing to global events */\n eventListeners?: Partial<OptionsEventListeners>;\n /** @ignore */\n onFirstUpdate?: Options['onFirstUpdate'];\n\n /**\n * Disabled focus trap, autofocus and focus return\n */\n disableEnforceFocus?: boolean;\n };\n\n/** @deprecated */\nexport interface IPopperTriggerProps extends PopperTriggerProps, UnknownProperties {}\nexport type PopperTriggerProps = BoxProps & {\n /**\n * Disabled focus trap, autofocus and focus return\n */\n disableEnforceFocus?: boolean;\n};\n\n/** @deprecated */\nexport interface IPopperPopperProps extends PopperPopperProps, UnknownProperties {}\nexport type PopperPopperProps = BoxProps &\n NeighborLocationProps & {\n /**\n * Disabled focus trap, autofocus and focus return\n */\n disableEnforceFocus?: boolean;\n };\n\n/** @deprecated */\nexport interface IPopperContext extends PopperContext, UnknownProperties {}\nexport type PopperContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n popper: Instance;\n // Rename to setTriggerRef\n setTrigger: (ref: HTMLElement) => void;\n setPopper: (ref: HTMLElement) => void;\n};\n\n/** @deprecated */\nexport interface IPopperHandlers extends PopperHandlers, UnknownProperties {}\nexport type PopperHandlers = {\n visible: (visible: boolean) => void;\n};\n\ndeclare const Popper: Intergalactic.Component<\n 'div',\n PopperProps,\n PopperContext,\n [handlers: PopperHandlers]\n> & {\n Trigger: Intergalactic.Component<\n 'div',\n PopperTriggerProps,\n PopperContext,\n [handlers: PopperHandlers]\n >;\n Popper: Intergalactic.Component<\n 'div',\n PopperPopperProps,\n PopperContext,\n [handlers: PopperHandlers]\n >;\n};\n\nexport default Popper;\n"],"mappings":""}
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import { DOMAttributes } from 'react';\nimport { Options, Instance } from '@popperjs/core/lib/types';\nimport { Options as OptionsOffset } from '@popperjs/core/lib/modifiers/offset';\nimport { Options as OptionsPreventOverflow } from '@popperjs/core/lib/modifiers/preventOverflow';\nimport { Options as OptionsArrow } from '@popperjs/core/lib/modifiers/arrow';\nimport { Options as OptionsFlip } from '@popperjs/core/lib/modifiers/flip';\nimport { Options as OptionsComputeStyles } from '@popperjs/core/lib/modifiers/computeStyles';\nimport { Options as OptionsEventListeners } from '@popperjs/core/lib/modifiers/eventListeners';\n\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { OutsideClickProps } from '@semcore/outside-click';\nimport { PortalProps } from '@semcore/portal';\nimport { BoxProps } from '@semcore/flex-box';\nimport { ScaleProps } from '@semcore/animation';\nimport { NeighborLocationProps } from '@semcore/neighbor-location';\nimport { UniqueIDProps } from '@semcore/utils/lib/uniqueID';\n\nexport type eventInteraction = {\n trigger: [Array<keyof DOMAttributes<unknown>>, Array<keyof DOMAttributes<unknown>>];\n popper: [Array<keyof DOMAttributes<unknown>>, Array<keyof DOMAttributes<unknown>>];\n};\n\nexport type Strategy = Options['strategy'];\nexport type Modifiers = Options['modifiers'];\nexport type Placement = Options['placement'];\n\n/** @deprecated */\nexport interface IPopperProps extends PopperProps, UnknownProperties {}\nexport type PopperProps = OutsideClickProps &\n PortalProps &\n UniqueIDProps &\n Omit<ScaleProps, 'placement'> & {\n /**\n * Popper can have different positioning options\n * @default absolute\n */\n strategy?: Strategy;\n /**\n * Modifiers for popper.js\n */\n modifiers?: Modifiers;\n /**\n * The position of the popper relative to the trigger that called it.\n * 'auto-start' | 'auto' | 'auto-end' | 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-end' | 'bottom' | 'bottom-start' | 'left-end' | 'left' | 'left-start'\n * @default auto\n */\n placement?: Placement;\n /**\n * Interaction with a trigger to show and hide the popper\n * @default click\n */\n interaction?: 'click' | 'hover' | 'focus' | 'none' | eventInteraction;\n /** Timer to show and hide the popper */\n timeout?: number | [number, number];\n /** Popper visibility value */\n visible?: boolean;\n /** Default popper visibility\n * @default false */\n defaultVisible?: boolean;\n /** Function called when visibility changes */\n onVisibleChange?: (visible: boolean, e?: Event) => boolean | void;\n /** PopperJS modifier settings for popper indent */\n offset?: Partial<OptionsOffset> | number | [number, number];\n /** PopperJS modifier settings for finding borders */\n preventOverflow?: Partial<OptionsPreventOverflow>;\n /** PopperJS modifier settings responsible for the arrow */\n arrow?: Partial<OptionsArrow>;\n /** PopperJS modifier settings responsible for turning the popper when there is not enough space */\n flip?: Partial<OptionsFlip>;\n /** PopperJS modifier settings for applying styles */\n computeStyles?: Partial<OptionsComputeStyles>;\n /** PopperJS modifier settings responsible for subscribing to global events */\n eventListeners?: Partial<OptionsEventListeners>;\n /** @ignore */\n onFirstUpdate?: Options['onFirstUpdate'];\n /**\n * Flag for disable Popover (if true, it will close Popper and it will not respond to handlers)\n * @default false\n */\n disabled?: boolean;\n /**\n * Disabled focus trap, autofocus and focus return\n */\n disableEnforceFocus?: boolean;\n };\n\n/** @deprecated */\nexport interface IPopperTriggerProps extends PopperTriggerProps, UnknownProperties {}\nexport type PopperTriggerProps = BoxProps & {\n /**\n * Disabled focus trap, autofocus and focus return\n */\n disableEnforceFocus?: boolean;\n};\n\n/** @deprecated */\nexport interface IPopperPopperProps extends PopperPopperProps, UnknownProperties {}\nexport type PopperPopperProps = BoxProps &\n NeighborLocationProps & {\n /**\n * Disabled focus trap, autofocus and focus return\n */\n disableEnforceFocus?: boolean;\n };\n\n/** @deprecated */\nexport interface IPopperContext extends PopperContext, UnknownProperties {}\nexport type PopperContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n popper: Instance;\n // Rename to setTriggerRef\n setTrigger: (ref: HTMLElement) => void;\n setPopper: (ref: HTMLElement) => void;\n};\n\n/** @deprecated */\nexport interface IPopperHandlers extends PopperHandlers, UnknownProperties {}\nexport type PopperHandlers = {\n visible: (visible: boolean) => void;\n};\n\ndeclare const Popper: Intergalactic.Component<\n 'div',\n PopperProps,\n PopperContext,\n [handlers: PopperHandlers]\n> & {\n Trigger: Intergalactic.Component<\n 'div',\n PopperTriggerProps,\n PopperContext,\n [handlers: PopperHandlers]\n >;\n Popper: Intergalactic.Component<\n 'div',\n PopperPopperProps,\n PopperContext,\n [handlers: PopperHandlers]\n >;\n};\n\nexport default Popper;\n"],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import { DOMAttributes } from 'react';\nimport { Options, Instance } from '@popperjs/core/lib/types';\nimport { Options as OptionsOffset } from '@popperjs/core/lib/modifiers/offset';\nimport { Options as OptionsPreventOverflow } from '@popperjs/core/lib/modifiers/preventOverflow';\nimport { Options as OptionsArrow } from '@popperjs/core/lib/modifiers/arrow';\nimport { Options as OptionsFlip } from '@popperjs/core/lib/modifiers/flip';\nimport { Options as OptionsComputeStyles } from '@popperjs/core/lib/modifiers/computeStyles';\nimport { Options as OptionsEventListeners } from '@popperjs/core/lib/modifiers/eventListeners';\n\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { OutsideClickProps } from '@semcore/outside-click';\nimport { PortalProps } from '@semcore/portal';\nimport { BoxProps } from '@semcore/flex-box';\nimport { ScaleProps } from '@semcore/animation';\nimport { NeighborLocationProps } from '@semcore/neighbor-location';\nimport { UniqueIDProps } from '@semcore/utils/lib/uniqueID';\n\nexport type eventInteraction = {\n trigger: [Array<keyof DOMAttributes<unknown>>, Array<keyof DOMAttributes<unknown>>];\n popper: [Array<keyof DOMAttributes<unknown>>, Array<keyof DOMAttributes<unknown>>];\n};\n\nexport type Strategy = Options['strategy'];\nexport type Modifiers = Options['modifiers'];\nexport type Placement = Options['placement'];\n\n/** @deprecated */\nexport interface IPopperProps extends PopperProps, UnknownProperties {}\nexport type PopperProps = OutsideClickProps &\n PortalProps &\n UniqueIDProps &\n Omit<ScaleProps, 'placement'> & {\n /**\n * Popper can have different positioning options\n * @default absolute\n */\n strategy?: Strategy;\n /**\n * Modifiers for popper.js\n */\n modifiers?: Modifiers;\n /**\n * The position of the popper relative to the trigger that called it.\n * 'auto-start' | 'auto' | 'auto-end' | 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-end' | 'bottom' | 'bottom-start' | 'left-end' | 'left' | 'left-start'\n * @default auto\n */\n placement?: Placement;\n /**\n * Interaction with a trigger to show and hide the popper\n * @default click\n */\n interaction?: 'click' | 'hover' | 'focus' | 'none' | eventInteraction;\n /** Timer to show and hide the popper */\n timeout?: number | [number, number];\n /** Popper visibility value */\n visible?: boolean;\n /** Default popper visibility\n * @default false */\n defaultVisible?: boolean;\n /** Function called when visibility changes */\n onVisibleChange?: (visible: boolean, e?: Event) => boolean | void;\n /** PopperJS modifier settings for popper indent */\n offset?: Partial<OptionsOffset> | number | [number, number];\n /** PopperJS modifier settings for finding borders */\n preventOverflow?: Partial<OptionsPreventOverflow>;\n /** PopperJS modifier settings responsible for the arrow */\n arrow?: Partial<OptionsArrow>;\n /** PopperJS modifier settings responsible for turning the popper when there is not enough space */\n flip?: Partial<OptionsFlip>;\n /** PopperJS modifier settings for applying styles */\n computeStyles?: Partial<OptionsComputeStyles>;\n /** PopperJS modifier settings responsible for subscribing to global events */\n eventListeners?: Partial<OptionsEventListeners>;\n /** @ignore */\n onFirstUpdate?: Options['onFirstUpdate'];\n\n /**\n * Disabled focus trap, autofocus and focus return\n */\n disableEnforceFocus?: boolean;\n };\n\n/** @deprecated */\nexport interface IPopperTriggerProps extends PopperTriggerProps, UnknownProperties {}\nexport type PopperTriggerProps = BoxProps & {\n /**\n * Disabled focus trap, autofocus and focus return\n */\n disableEnforceFocus?: boolean;\n};\n\n/** @deprecated */\nexport interface IPopperPopperProps extends PopperPopperProps, UnknownProperties {}\nexport type PopperPopperProps = BoxProps &\n NeighborLocationProps & {\n /**\n * Disabled focus trap, autofocus and focus return\n */\n disableEnforceFocus?: boolean;\n };\n\n/** @deprecated */\nexport interface IPopperContext extends PopperContext, UnknownProperties {}\nexport type PopperContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n popper: Instance;\n // Rename to setTriggerRef\n setTrigger: (ref: HTMLElement) => void;\n setPopper: (ref: HTMLElement) => void;\n};\n\n/** @deprecated */\nexport interface IPopperHandlers extends PopperHandlers, UnknownProperties {}\nexport type PopperHandlers = {\n visible: (visible: boolean) => void;\n};\n\ndeclare const Popper: Intergalactic.Component<\n 'div',\n PopperProps,\n PopperContext,\n [handlers: PopperHandlers]\n> & {\n Trigger: Intergalactic.Component<\n 'div',\n PopperTriggerProps,\n PopperContext,\n [handlers: PopperHandlers]\n >;\n Popper: Intergalactic.Component<\n 'div',\n PopperPopperProps,\n PopperContext,\n [handlers: PopperHandlers]\n >;\n};\n\nexport default Popper;\n"],"mappings":""}
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import { DOMAttributes } from 'react';\nimport { Options, Instance } from '@popperjs/core/lib/types';\nimport { Options as OptionsOffset } from '@popperjs/core/lib/modifiers/offset';\nimport { Options as OptionsPreventOverflow } from '@popperjs/core/lib/modifiers/preventOverflow';\nimport { Options as OptionsArrow } from '@popperjs/core/lib/modifiers/arrow';\nimport { Options as OptionsFlip } from '@popperjs/core/lib/modifiers/flip';\nimport { Options as OptionsComputeStyles } from '@popperjs/core/lib/modifiers/computeStyles';\nimport { Options as OptionsEventListeners } from '@popperjs/core/lib/modifiers/eventListeners';\n\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { OutsideClickProps } from '@semcore/outside-click';\nimport { PortalProps } from '@semcore/portal';\nimport { BoxProps } from '@semcore/flex-box';\nimport { ScaleProps } from '@semcore/animation';\nimport { NeighborLocationProps } from '@semcore/neighbor-location';\nimport { UniqueIDProps } from '@semcore/utils/lib/uniqueID';\n\nexport type eventInteraction = {\n trigger: [Array<keyof DOMAttributes<unknown>>, Array<keyof DOMAttributes<unknown>>];\n popper: [Array<keyof DOMAttributes<unknown>>, Array<keyof DOMAttributes<unknown>>];\n};\n\nexport type Strategy = Options['strategy'];\nexport type Modifiers = Options['modifiers'];\nexport type Placement = Options['placement'];\n\n/** @deprecated */\nexport interface IPopperProps extends PopperProps, UnknownProperties {}\nexport type PopperProps = OutsideClickProps &\n PortalProps &\n UniqueIDProps &\n Omit<ScaleProps, 'placement'> & {\n /**\n * Popper can have different positioning options\n * @default absolute\n */\n strategy?: Strategy;\n /**\n * Modifiers for popper.js\n */\n modifiers?: Modifiers;\n /**\n * The position of the popper relative to the trigger that called it.\n * 'auto-start' | 'auto' | 'auto-end' | 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-end' | 'bottom' | 'bottom-start' | 'left-end' | 'left' | 'left-start'\n * @default auto\n */\n placement?: Placement;\n /**\n * Interaction with a trigger to show and hide the popper\n * @default click\n */\n interaction?: 'click' | 'hover' | 'focus' | 'none' | eventInteraction;\n /** Timer to show and hide the popper */\n timeout?: number | [number, number];\n /** Popper visibility value */\n visible?: boolean;\n /** Default popper visibility\n * @default false */\n defaultVisible?: boolean;\n /** Function called when visibility changes */\n onVisibleChange?: (visible: boolean, e?: Event) => boolean | void;\n /** PopperJS modifier settings for popper indent */\n offset?: Partial<OptionsOffset> | number | [number, number];\n /** PopperJS modifier settings for finding borders */\n preventOverflow?: Partial<OptionsPreventOverflow>;\n /** PopperJS modifier settings responsible for the arrow */\n arrow?: Partial<OptionsArrow>;\n /** PopperJS modifier settings responsible for turning the popper when there is not enough space */\n flip?: Partial<OptionsFlip>;\n /** PopperJS modifier settings for applying styles */\n computeStyles?: Partial<OptionsComputeStyles>;\n /** PopperJS modifier settings responsible for subscribing to global events */\n eventListeners?: Partial<OptionsEventListeners>;\n /** @ignore */\n onFirstUpdate?: Options['onFirstUpdate'];\n /**\n * Flag for disable Popover (if true, it will close Popper and it will not respond to handlers)\n * @default false\n */\n disabled?: boolean;\n /**\n * Disabled focus trap, autofocus and focus return\n */\n disableEnforceFocus?: boolean;\n };\n\n/** @deprecated */\nexport interface IPopperTriggerProps extends PopperTriggerProps, UnknownProperties {}\nexport type PopperTriggerProps = BoxProps & {\n /**\n * Disabled focus trap, autofocus and focus return\n */\n disableEnforceFocus?: boolean;\n};\n\n/** @deprecated */\nexport interface IPopperPopperProps extends PopperPopperProps, UnknownProperties {}\nexport type PopperPopperProps = BoxProps &\n NeighborLocationProps & {\n /**\n * Disabled focus trap, autofocus and focus return\n */\n disableEnforceFocus?: boolean;\n };\n\n/** @deprecated */\nexport interface IPopperContext extends PopperContext, UnknownProperties {}\nexport type PopperContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n popper: Instance;\n // Rename to setTriggerRef\n setTrigger: (ref: HTMLElement) => void;\n setPopper: (ref: HTMLElement) => void;\n};\n\n/** @deprecated */\nexport interface IPopperHandlers extends PopperHandlers, UnknownProperties {}\nexport type PopperHandlers = {\n visible: (visible: boolean) => void;\n};\n\ndeclare const Popper: Intergalactic.Component<\n 'div',\n PopperProps,\n PopperContext,\n [handlers: PopperHandlers]\n> & {\n Trigger: Intergalactic.Component<\n 'div',\n PopperTriggerProps,\n PopperContext,\n [handlers: PopperHandlers]\n >;\n Popper: Intergalactic.Component<\n 'div',\n PopperPopperProps,\n PopperContext,\n [handlers: PopperHandlers]\n >;\n};\n\nexport default Popper;\n"],"mappings":""}
|
@@ -73,7 +73,11 @@ export type PopperProps = OutsideClickProps &
|
|
73
73
|
eventListeners?: Partial<OptionsEventListeners>;
|
74
74
|
/** @ignore */
|
75
75
|
onFirstUpdate?: Options['onFirstUpdate'];
|
76
|
-
|
76
|
+
/**
|
77
|
+
* Flag for disable Popover (if true, it will close Popper and it will not respond to handlers)
|
78
|
+
* @default false
|
79
|
+
*/
|
80
|
+
disabled?: boolean;
|
77
81
|
/**
|
78
82
|
* Disabled focus trap, autofocus and focus return
|
79
83
|
*/
|
@@ -60,10 +60,15 @@ var TooltipRoot = /*#__PURE__*/function (_Component) {
|
|
60
60
|
var _this$asProps = this.asProps,
|
61
61
|
uid = _this$asProps.uid,
|
62
62
|
visible = _this$asProps.visible,
|
63
|
-
interaction = _this$asProps.interaction
|
63
|
+
interaction = _this$asProps.interaction,
|
64
|
+
disabled = _this$asProps.disabled;
|
65
|
+
var ariaHasPopup = 'true';
|
66
|
+
if (interaction === 'hover' || disabled) {
|
67
|
+
ariaHasPopup = 'false';
|
68
|
+
}
|
64
69
|
return {
|
65
70
|
'aria-describedby': visible ? "igc-".concat(uid, "-popper") : undefined,
|
66
|
-
'aria-haspopup':
|
71
|
+
'aria-haspopup': ariaHasPopup
|
67
72
|
};
|
68
73
|
}
|
69
74
|
}, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Tooltip.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_popper","_flexBox","_resolveColorEnhance","_findComponent","_logger","_uniqueID","_excluded","style","sstyled","insert","Popper","PopperOrigin","CREATE_COMPONENT","TooltipRoot","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","popperChildren","_createClass2","key","value","uncontrolledProps","visible","getTriggerProps","_this$asProps","asProps","uid","interaction","undefined","getPopperProps","_this$asProps2","theme","disablePortal","ignorePortalsStacking","resolveColor","id","render","_ref","_this$asProps3","Children","title","offset","forcedAdvancedMode","other","_objectWithoutProperties2","advancedMode","isAdvanceMode","Tooltip","Trigger","displayName","logger","warn","createElement","assignProps","Fragment","Component","uniqueIDEnhancement","resolveColorEnhance","placement","timeout","flip","flipVariations","flipVariationsByContent","defaultVisible","TooltipTrigger","props","_ref2","arguments[0]","_ref4","styles","STrigger","cn","_objectSpread2","TooltipPopper","_ref3","_ref5","STooltip","SArrow","Box","createComponent","parent","_default","exports"],"sources":["../../src/Tooltip.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, CREATE_COMPONENT, sstyled, Root } from '@semcore/core';\nimport PopperOrigin from '@semcore/popper';\nimport { Box } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { isAdvanceMode } from '@semcore/utils/lib/findComponent';\nimport logger from '@semcore/utils/lib/logger';\nimport uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';\n\nimport style from './style/tooltip.shadow.css';\n\nconst Popper = PopperOrigin[CREATE_COMPONENT]();\n\nclass TooltipRoot extends Component {\n static displayName = 'Tooltip';\n static style = style;\n static enhance = [uniqueIDEnhancement(), resolveColorEnhance()];\n static defaultProps = {\n theme: 'default',\n placement: 'top',\n interaction: 'hover',\n timeout: [100, 50],\n offset: [0, 10],\n flip: {\n flipVariations: true,\n flipVariationsByContent: true,\n },\n defaultVisible: false,\n };\n state = { popperChildren: null };\n\n uncontrolledProps() {\n return {\n visible: null,\n };\n }\n\n getTriggerProps() {\n const { uid, visible, interaction } = this.asProps;\n\n return {\n 'aria-describedby': visible ? `igc-${uid}-popper` : undefined,\n 'aria-haspopup': interaction !== 'hover' ? 'true' : 'false',\n };\n }\n\n getPopperProps() {\n const { theme, uid, disablePortal, ignorePortalsStacking, interaction, resolveColor } =\n this.asProps;\n return {\n id: `igc-${uid}-popper`,\n theme,\n disablePortal,\n ignorePortalsStacking,\n interaction,\n resolveColor,\n };\n }\n\n render() {\n const { Children, title, offset, forcedAdvancedMode, ...other } = this.asProps;\n\n const advancedMode =\n forcedAdvancedMode ||\n isAdvanceMode(Children, [Tooltip.Trigger.displayName, Tooltip.Popper.displayName]);\n\n logger.warn(\n title && advancedMode,\n \"You can't use 'title' and '<Tooltip.Trigger/>/<Tooltip.Popper/>' at the same time\",\n other['data-ui-name'] || Tooltip.displayName,\n );\n\n logger.warn(\n other.interaction !== 'hover',\n \"You shouldn't use prop `interaction` except with `hover` value.\",\n other['data-ui-name'] || Tooltip.displayName,\n );\n\n return (\n <Root render={Popper}>\n {advancedMode ? (\n <Children />\n ) : (\n <>\n <Tooltip.Trigger {...other}>\n <Children />\n </Tooltip.Trigger>\n <Tooltip.Popper>{title}</Tooltip.Popper>\n </>\n )}\n </Root>\n );\n }\n}\n\nfunction TooltipTrigger(props) {\n const { Children, styles } = props;\n const STrigger = Root;\n\n return sstyled(styles)(\n <STrigger render={Popper.Trigger} role={undefined}>\n <Children />\n </STrigger>,\n );\n}\n\nfunction TooltipPopper(props) {\n const { Children, styles, theme, resolveColor } = props;\n const STooltip = Root;\n const SArrow = Box;\n\n return sstyled(styles)(\n <>\n <STooltip\n render={Popper.Popper}\n role='tooltip'\n use:theme={resolveColor(theme)}\n aria-live={theme === 'warning' ? 'assertive' : 'polite'}\n >\n <Children />\n <SArrow data-popper-arrow use:theme={resolveColor(theme)} />\n </STooltip>\n </>,\n );\n}\n\nconst Tooltip = createComponent(\n TooltipRoot,\n {\n Trigger: TooltipTrigger,\n Popper: TooltipPopper,\n },\n {\n parent: Popper,\n },\n);\n\nexport default Tooltip;\n"],"mappings":";;;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,SAAA,GAAAN,sBAAA,CAAAF,OAAA;AAA8D,IAAAS,SAAA;AAAA;AAAA,IAAAC,KAAA,+BAAAZ,KAAA,CAAAa,OAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI9D,IAAMC,MAAM,GAAGC,kBAAY,CAACC,sBAAgB,CAAC,EAAE;AAAC,IAE1CC,WAAW,0BAAAC,UAAA;EAAA,IAAAC,UAAA,aAAAF,WAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,WAAA;EAAA,SAAAA,YAAA;IAAA,IAAAK,KAAA;IAAA,IAAAC,gBAAA,mBAAAN,WAAA;IAAA,SAAAO,IAAA,GAAAC,SAA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}
|
1
|
+
{"version":3,"file":"Tooltip.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_popper","_flexBox","_resolveColorEnhance","_findComponent","_logger","_uniqueID","_excluded","style","sstyled","insert","Popper","PopperOrigin","CREATE_COMPONENT","TooltipRoot","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","popperChildren","_createClass2","key","value","uncontrolledProps","visible","getTriggerProps","_this$asProps","asProps","uid","interaction","disabled","ariaHasPopup","undefined","getPopperProps","_this$asProps2","theme","disablePortal","ignorePortalsStacking","resolveColor","id","render","_ref","_this$asProps3","Children","title","offset","forcedAdvancedMode","other","_objectWithoutProperties2","advancedMode","isAdvanceMode","Tooltip","Trigger","displayName","logger","warn","createElement","assignProps","Fragment","Component","uniqueIDEnhancement","resolveColorEnhance","placement","timeout","flip","flipVariations","flipVariationsByContent","defaultVisible","TooltipTrigger","props","_ref2","arguments[0]","_ref4","styles","STrigger","cn","_objectSpread2","TooltipPopper","_ref3","_ref5","STooltip","SArrow","Box","createComponent","parent","_default","exports"],"sources":["../../src/Tooltip.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, CREATE_COMPONENT, sstyled, Root } from '@semcore/core';\nimport PopperOrigin from '@semcore/popper';\nimport { Box } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { isAdvanceMode } from '@semcore/utils/lib/findComponent';\nimport logger from '@semcore/utils/lib/logger';\nimport uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';\n\nimport style from './style/tooltip.shadow.css';\n\nconst Popper = PopperOrigin[CREATE_COMPONENT]();\n\nclass TooltipRoot extends Component {\n static displayName = 'Tooltip';\n static style = style;\n static enhance = [uniqueIDEnhancement(), resolveColorEnhance()];\n static defaultProps = {\n theme: 'default',\n placement: 'top',\n interaction: 'hover',\n timeout: [100, 50],\n offset: [0, 10],\n flip: {\n flipVariations: true,\n flipVariationsByContent: true,\n },\n defaultVisible: false,\n };\n state = { popperChildren: null };\n\n uncontrolledProps() {\n return {\n visible: null,\n };\n }\n\n getTriggerProps() {\n const { uid, visible, interaction, disabled } = this.asProps;\n\n let ariaHasPopup = 'true';\n\n if (interaction === 'hover' || disabled) {\n ariaHasPopup = 'false';\n }\n\n return {\n 'aria-describedby': visible ? `igc-${uid}-popper` : undefined,\n 'aria-haspopup': ariaHasPopup,\n };\n }\n\n getPopperProps() {\n const { theme, uid, disablePortal, ignorePortalsStacking, interaction, resolveColor } =\n this.asProps;\n return {\n id: `igc-${uid}-popper`,\n theme,\n disablePortal,\n ignorePortalsStacking,\n interaction,\n resolveColor,\n };\n }\n\n render() {\n const { Children, title, offset, forcedAdvancedMode, ...other } = this.asProps;\n\n const advancedMode =\n forcedAdvancedMode ||\n isAdvanceMode(Children, [Tooltip.Trigger.displayName, Tooltip.Popper.displayName]);\n\n logger.warn(\n title && advancedMode,\n \"You can't use 'title' and '<Tooltip.Trigger/>/<Tooltip.Popper/>' at the same time\",\n other['data-ui-name'] || Tooltip.displayName,\n );\n\n logger.warn(\n other.interaction !== 'hover',\n \"You shouldn't use prop `interaction` except with `hover` value.\",\n other['data-ui-name'] || Tooltip.displayName,\n );\n\n return (\n <Root render={Popper}>\n {advancedMode ? (\n <Children />\n ) : (\n <>\n <Tooltip.Trigger {...other}>\n <Children />\n </Tooltip.Trigger>\n <Tooltip.Popper>{title}</Tooltip.Popper>\n </>\n )}\n </Root>\n );\n }\n}\n\nfunction TooltipTrigger(props) {\n const { Children, styles } = props;\n const STrigger = Root;\n\n return sstyled(styles)(\n <STrigger render={Popper.Trigger} role={undefined}>\n <Children />\n </STrigger>,\n );\n}\n\nfunction TooltipPopper(props) {\n const { Children, styles, theme, resolveColor } = props;\n const STooltip = Root;\n const SArrow = Box;\n\n return sstyled(styles)(\n <>\n <STooltip\n render={Popper.Popper}\n role='tooltip'\n use:theme={resolveColor(theme)}\n aria-live={theme === 'warning' ? 'assertive' : 'polite'}\n >\n <Children />\n <SArrow data-popper-arrow use:theme={resolveColor(theme)} />\n </STooltip>\n </>,\n );\n}\n\nconst Tooltip = createComponent(\n TooltipRoot,\n {\n Trigger: TooltipTrigger,\n Popper: TooltipPopper,\n },\n {\n parent: Popper,\n },\n);\n\nexport default Tooltip;\n"],"mappings":";;;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,SAAA,GAAAN,sBAAA,CAAAF,OAAA;AAA8D,IAAAS,SAAA;AAAA;AAAA,IAAAC,KAAA,+BAAAZ,KAAA,CAAAa,OAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI9D,IAAMC,MAAM,GAAGC,kBAAY,CAACC,sBAAgB,CAAC,EAAE;AAAC,IAE1CC,WAAW,0BAAAC,UAAA;EAAA,IAAAC,UAAA,aAAAF,WAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,WAAA;EAAA,SAAAA,YAAA;IAAA,IAAAK,KAAA;IAAA,IAAAC,gBAAA,mBAAAN,WAAA;IAAA,SAAAO,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,GAAAF,MAAA,CAAAU,IAAA,CAAAC,KAAA,CAAAX,MAAA,SA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58
|
visible = _this$asProps.visible,
|
59
|
-
interaction = _this$asProps.interaction
|
59
|
+
interaction = _this$asProps.interaction,
|
60
|
+
disabled = _this$asProps.disabled;
|
61
|
+
var ariaHasPopup = 'true';
|
62
|
+
if (interaction === 'hover' || disabled) {
|
63
|
+
ariaHasPopup = 'false';
|
64
|
+
}
|
60
65
|
return {
|
61
66
|
'aria-describedby': visible ? "igc-".concat(uid, "-popper") : undefined,
|
62
|
-
'aria-haspopup':
|
67
|
+
'aria-haspopup': ariaHasPopup
|
63
68
|
};
|
64
69
|
}
|
65
70
|
}, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Tooltip.js","names":["React","createComponent","Component","CREATE_COMPONENT","sstyled","Root","PopperOrigin","Box","resolveColorEnhance","isAdvanceMode","logger","uniqueIDEnhancement","style","_sstyled","insert","Popper","TooltipRoot","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","popperChildren","_createClass","key","value","uncontrolledProps","visible","getTriggerProps","_this$asProps","asProps","uid","interaction","undefined","getPopperProps","_this$asProps2","theme","disablePortal","ignorePortalsStacking","resolveColor","id","render","_ref","_this$asProps3","Children","title","offset","forcedAdvancedMode","other","_objectWithoutProperties","_excluded","advancedMode","Tooltip","Trigger","displayName","warn","createElement","_assignProps","Fragment","placement","timeout","flip","flipVariations","flipVariationsByContent","defaultVisible","TooltipTrigger","props","_ref2","arguments[0]","_ref4","styles","STrigger","cn","_objectSpread","_assignProps2","TooltipPopper","_ref3","_ref5","STooltip","SArrow","_assignProps3","parent"],"sources":["../../src/Tooltip.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, CREATE_COMPONENT, sstyled, Root } from '@semcore/core';\nimport PopperOrigin from '@semcore/popper';\nimport { Box } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { isAdvanceMode } from '@semcore/utils/lib/findComponent';\nimport logger from '@semcore/utils/lib/logger';\nimport uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';\n\nimport style from './style/tooltip.shadow.css';\n\nconst Popper = PopperOrigin[CREATE_COMPONENT]();\n\nclass TooltipRoot extends Component {\n static displayName = 'Tooltip';\n static style = style;\n static enhance = [uniqueIDEnhancement(), resolveColorEnhance()];\n static defaultProps = {\n theme: 'default',\n placement: 'top',\n interaction: 'hover',\n timeout: [100, 50],\n offset: [0, 10],\n flip: {\n flipVariations: true,\n flipVariationsByContent: true,\n },\n defaultVisible: false,\n };\n state = { popperChildren: null };\n\n uncontrolledProps() {\n return {\n visible: null,\n };\n }\n\n getTriggerProps() {\n const { uid, visible, interaction } = this.asProps;\n\n return {\n 'aria-describedby': visible ? `igc-${uid}-popper` : undefined,\n 'aria-haspopup':
|
1
|
+
{"version":3,"file":"Tooltip.js","names":["React","createComponent","Component","CREATE_COMPONENT","sstyled","Root","PopperOrigin","Box","resolveColorEnhance","isAdvanceMode","logger","uniqueIDEnhancement","style","_sstyled","insert","Popper","TooltipRoot","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","popperChildren","_createClass","key","value","uncontrolledProps","visible","getTriggerProps","_this$asProps","asProps","uid","interaction","disabled","ariaHasPopup","undefined","getPopperProps","_this$asProps2","theme","disablePortal","ignorePortalsStacking","resolveColor","id","render","_ref","_this$asProps3","Children","title","offset","forcedAdvancedMode","other","_objectWithoutProperties","_excluded","advancedMode","Tooltip","Trigger","displayName","warn","createElement","_assignProps","Fragment","placement","timeout","flip","flipVariations","flipVariationsByContent","defaultVisible","TooltipTrigger","props","_ref2","arguments[0]","_ref4","styles","STrigger","cn","_objectSpread","_assignProps2","TooltipPopper","_ref3","_ref5","STooltip","SArrow","_assignProps3","parent"],"sources":["../../src/Tooltip.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, CREATE_COMPONENT, sstyled, Root } from '@semcore/core';\nimport PopperOrigin from '@semcore/popper';\nimport { Box } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { isAdvanceMode } from '@semcore/utils/lib/findComponent';\nimport logger from '@semcore/utils/lib/logger';\nimport uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';\n\nimport style from './style/tooltip.shadow.css';\n\nconst Popper = PopperOrigin[CREATE_COMPONENT]();\n\nclass TooltipRoot extends Component {\n static displayName = 'Tooltip';\n static style = style;\n static enhance = [uniqueIDEnhancement(), resolveColorEnhance()];\n static defaultProps = {\n theme: 'default',\n placement: 'top',\n interaction: 'hover',\n timeout: [100, 50],\n offset: [0, 10],\n flip: {\n flipVariations: true,\n flipVariationsByContent: true,\n },\n defaultVisible: false,\n };\n state = { popperChildren: null };\n\n uncontrolledProps() {\n return {\n visible: null,\n };\n }\n\n getTriggerProps() {\n const { uid, visible, interaction, disabled } = this.asProps;\n\n let ariaHasPopup = 'true';\n\n if (interaction === 'hover' || disabled) {\n ariaHasPopup = 'false';\n }\n\n return {\n 'aria-describedby': visible ? `igc-${uid}-popper` : undefined,\n 'aria-haspopup': ariaHasPopup,\n };\n }\n\n getPopperProps() {\n const { theme, uid, disablePortal, ignorePortalsStacking, interaction, resolveColor } =\n this.asProps;\n return {\n id: `igc-${uid}-popper`,\n theme,\n disablePortal,\n ignorePortalsStacking,\n interaction,\n resolveColor,\n };\n }\n\n render() {\n const { Children, title, offset, forcedAdvancedMode, ...other } = this.asProps;\n\n const advancedMode =\n forcedAdvancedMode ||\n isAdvanceMode(Children, [Tooltip.Trigger.displayName, Tooltip.Popper.displayName]);\n\n logger.warn(\n title && advancedMode,\n \"You can't use 'title' and '<Tooltip.Trigger/>/<Tooltip.Popper/>' at the same time\",\n other['data-ui-name'] || Tooltip.displayName,\n );\n\n logger.warn(\n other.interaction !== 'hover',\n \"You shouldn't use prop `interaction` except with `hover` value.\",\n other['data-ui-name'] || Tooltip.displayName,\n );\n\n return (\n <Root render={Popper}>\n {advancedMode ? (\n <Children />\n ) : (\n <>\n <Tooltip.Trigger {...other}>\n <Children />\n </Tooltip.Trigger>\n <Tooltip.Popper>{title}</Tooltip.Popper>\n </>\n )}\n </Root>\n );\n }\n}\n\nfunction TooltipTrigger(props) {\n const { Children, styles } = props;\n const STrigger = Root;\n\n return sstyled(styles)(\n <STrigger render={Popper.Trigger} role={undefined}>\n <Children />\n </STrigger>,\n );\n}\n\nfunction TooltipPopper(props) {\n const { Children, styles, theme, resolveColor } = props;\n const STooltip = Root;\n const SArrow = Box;\n\n return sstyled(styles)(\n <>\n <STooltip\n render={Popper.Popper}\n role='tooltip'\n use:theme={resolveColor(theme)}\n aria-live={theme === 'warning' ? 'assertive' : 'polite'}\n >\n <Children />\n <SArrow data-popper-arrow use:theme={resolveColor(theme)} />\n </STooltip>\n </>,\n );\n}\n\nconst Tooltip = createComponent(\n TooltipRoot,\n {\n Trigger: TooltipTrigger,\n Popper: TooltipPopper,\n },\n {\n parent: Popper,\n },\n);\n\nexport default Tooltip;\n"],"mappings":";;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,gBAAgB,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AAC3F,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,SAASC,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,mBAAmB,MAAM,iDAAiD;AACjF,SAASC,aAAa,QAAQ,kCAAkC;AAChE,OAAOC,MAAM,MAAM,2BAA2B;AAC9C,OAAOC,mBAAmB,MAAM,6BAA6B;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI9D,IAAMC,MAAM,GAAGT,YAAY,CAACH,gBAAgB,CAAC,EAAE;AAAC,IAE1Ca,WAAW,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,WAAA,EAAAC,UAAA;EAAA,IAAAE,MA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,CAAC,EACD;EACEM,MAAM,EAAEhF;AACV,CAAC,CACF;AAED,eAAemD,OAAO"}
|
package/wizard/lib/cjs/Wizard.js
CHANGED
@@ -22,6 +22,7 @@ var _keyboardFocusEnhance = _interopRequireDefault(require("intergalactic/utils/
|
|
22
22
|
var _i18nEnhance = _interopRequireDefault(require("intergalactic/utils/lib/enhances/i18nEnhance"));
|
23
23
|
var _intergalacticDynamicLocales = require("./translations/__intergalactic-dynamic-locales");
|
24
24
|
var _ScreenReaderOnly = require("intergalactic/utils/lib/ScreenReaderOnly");
|
25
|
+
var _useFocusLock = require("intergalactic/utils/lib/use/useFocusLock");
|
25
26
|
/*__reshadow-styles__:"./style/wizard.shadow.css"*/
|
26
27
|
var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/".___SWizard_17d9t_gg_{max-width:980px;max-height:700px;display:flex;padding:0;background:0 0}.___SSidebar_17d9t_gg_{background:var(--intergalactic-control-primary-advertising, #5925ab);color:var(--intergalactic-text-primary-invert, #ffffff);font-weight:var(--intergalactic-bold, 700);font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%);padding:var(--intergalactic-spacing-10x, 40px) var(--intergalactic-spacing-2x, 8px) calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-05x, 2px));max-width:220px;flex-shrink:0;box-sizing:border-box;border-radius:var(--intergalactic-modal-rounded, 12px)0 0 var(--intergalactic-modal-rounded, 12px)}@media (max-width:1060px){.___SSidebar_17d9t_gg_{width:44px}}.___SSidebarHeader_17d9t_gg_{font-size:var(--intergalactic-fs-300, 16px);margin:0 var(--intergalactic-spacing-5x, 20px) var(--intergalactic-spacing-4x, 16px)}@media (max-width:1060px){.___SSidebarHeader_17d9t_gg_{display:none}}.___SStepper_17d9t_gg_{display:flex;font-size:var(--intergalactic-fs-200, 14px);border-radius:var(--intergalactic-control-rounded, 6px);padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-3x, 12px);cursor:pointer;position:relative;overflow:auto;line-height:var(--intergalactic-lh-200, 142%)}@media (hover:hover){.___SStepper_17d9t_gg_:hover{background:var(--intergalactic-control-primary-advertising-hover, #421983);z-index:1}}.___SStepper_17d9t_gg_.__active_17d9t_gg_{background:var(--intergalactic-control-primary-advertising-active, #8649e1)}.___SStepper_17d9t_gg_.__disabled_17d9t_gg_,.___SStepper_17d9t_gg_:disabled{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (max-width:1060px){.___SStepper_17d9t_gg_{padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-1x, 4px)}@media (hover:hover){.___SStepper_17d9t_gg_:hover{width:-moz-fit-content;width:fit-content;max-width:220px}.___SStepper_17d9t_gg_:hover .___SStepDescription_17d9t_gg_{display:block;border-radius:var(--intergalactic-control-rounded, 6px);white-space:nowrap;overflow:auto}.___SStepper_17d9t_gg_.__active_17d9t_gg_:hover .___SStepDescription_17d9t_gg_{background:var(--intergalactic-control-primary-advertising-active, #8649e1)}}}.___SStepNumber_17d9t_gg_{display:inline-block;min-width:20px}.___SCompleted_17d9t_gg_{margin-top:1px}@media (max-width:1060px){.___SStepDescription_17d9t_gg_{display:none}}.___SContent_17d9t_gg_{padding:var(--intergalactic-spacing-10x, 40px);width:100%;border-radius:0 var(--intergalactic-modal-rounded, 12px) var(--intergalactic-modal-rounded, 12px)0;background:var(--intergalactic-bg-primary-neutral, #ffffff)}" /*__inner_css_end__*/, "17d9t_gg_") /*__reshadow_css_end__*/, {
|
27
28
|
"__SWizard": "___SWizard_17d9t_gg_",
|
@@ -46,6 +47,7 @@ var WizardRoot = /*#__PURE__*/function (_Component) {
|
|
46
47
|
}
|
47
48
|
_this = _super.call.apply(_super, [this].concat(args));
|
48
49
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_steps", new Map());
|
50
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "modalRef", /*#__PURE__*/_react["default"].createRef());
|
49
51
|
return _this;
|
50
52
|
}
|
51
53
|
(0, _createClass2["default"])(WizardRoot, [{
|
@@ -74,6 +76,19 @@ var WizardRoot = /*#__PURE__*/function (_Component) {
|
|
74
76
|
getI18nText: this.asProps.getI18nText
|
75
77
|
};
|
76
78
|
}
|
79
|
+
}, {
|
80
|
+
key: "componentDidUpdate",
|
81
|
+
value: function componentDidUpdate(prevProps) {
|
82
|
+
var _this2 = this;
|
83
|
+
if (prevProps.step === this.asProps.step) return;
|
84
|
+
setTimeout(function () {
|
85
|
+
if (prevProps.step === _this2.asProps.step) return;
|
86
|
+
if (document.activeElement !== document.body) return;
|
87
|
+
if (!_this2.asProps.visible) return;
|
88
|
+
if (!_this2.modalRef.current) return;
|
89
|
+
(0, _useFocusLock.setFocus)(_this2.modalRef.current, document.body);
|
90
|
+
}, 1);
|
91
|
+
}
|
77
92
|
}, {
|
78
93
|
key: "render",
|
79
94
|
value: function render() {
|
@@ -84,7 +99,8 @@ var WizardRoot = /*#__PURE__*/function (_Component) {
|
|
84
99
|
styles = _this$asProps.styles;
|
85
100
|
this._steps.clear();
|
86
101
|
return _ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SWizard, _ref5.cn("SWizard", {
|
87
|
-
"render": _modal["default"]
|
102
|
+
"render": _modal["default"],
|
103
|
+
"ref": this.modalRef
|
88
104
|
}), /*#__PURE__*/_react["default"].createElement(Children, _ref5.cn("Children", {})));
|
89
105
|
}
|
90
106
|
}]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Wizard.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_flexBox","_modal","_m","_keyboardFocusEnhance","_i18nEnhance","_intergalacticDynamicLocales","_ScreenReaderOnly","style","sstyled","insert","WizardRoot","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","Map","_createClass2","key","value","getStepProps","props","steps","_steps","active","step","asProps","getStepperProps","i","number","has","get","set","_objectSpread2","getI18nText","render","_ref5","SWizard","Root","_this$asProps","Children","styles","clear","createElement","cn","Modal","Component","i18nEnhance","localizedMessages","i18n","locale","Sidebar","_ref","arguments[0]","_ref6","title","SSidebar","Box","SSidebarHeader","assignProps","Step","_ref2","SStep","_ref7","Stepper","_ref3","_ref8","onActive","completed","disabled","SStepper","SStepNumber","SStepDescription","SCompleted","CheckM","handlerClick","React","useCallback","e","handlerKeyDown","ScreenReaderOnly","enhance","keyboardFocusEnhance","Content","_ref4","_ref9","SContent","Wizard","createComponent","_default","exports"],"sources":["../../src/Wizard.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport Modal from '@semcore/modal';\nimport CheckM from '@semcore/icon/Check/m';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport { ScreenReaderOnly } from '@semcore/utils/lib/ScreenReaderOnly';\n\nimport style from './style/wizard.shadow.css';\n\nclass WizardRoot extends Component {\n static displayName = 'Wizard';\n static style = style;\n static enhance = [i18nEnhance(localizedMessages)];\n static defaultProps = {\n step: null,\n i18n: localizedMessages,\n locale: 'en',\n };\n\n _steps = new Map();\n\n getStepProps(props) {\n return {\n steps: this._steps,\n active: props.step === this.asProps.step,\n };\n }\n\n getStepperProps(props, i) {\n let number = i + 1;\n if (this._steps.has(props.step)) {\n const step = this._steps.get(props.step);\n number = step.number;\n } else {\n this._steps.set(props.step, { number, ...props });\n }\n return {\n active: props.step === this.asProps.step,\n number,\n getI18nText: this.asProps.getI18nText,\n };\n }\n\n render() {\n const SWizard = this.Root;\n const { Children, styles } = this.asProps;\n\n this._steps.clear();\n\n return sstyled(styles)(\n <SWizard render={Modal}>\n <Children />\n </SWizard>,\n );\n }\n}\n\nfunction Sidebar(props) {\n const { Children, styles, title } = props;\n const SSidebar = Root;\n const SSidebarHeader = 'h2';\n return sstyled(styles)(\n <SSidebar render={Box} role='menu'>\n {title && <SSidebarHeader>{title}</SSidebarHeader>}\n <Children />\n </SSidebar>,\n );\n}\n\nfunction Step(props) {\n const SStep = Root;\n const { Children, styles, active } = props;\n if (active) {\n return sstyled(styles)(\n <SStep render={Box} tag={Box}>\n <Children />\n </SStep>,\n );\n }\n return null;\n}\n\nfunction Stepper(props) {\n const { Children, styles, step, active, onActive, completed, disabled, number, getI18nText } =\n props;\n const SStepper = Root;\n const SStepNumber = 'span';\n const SStepDescription = 'span';\n const SCompleted = CheckM;\n\n const handlerClick = React.useCallback(\n (e) => {\n if (onActive) onActive(step, e);\n },\n [step, onActive],\n );\n\n const handlerKeyDown = React.useCallback(\n (e) => {\n if (onActive && e.key === 'Enter') {\n onActive(step, e);\n }\n },\n [step, onActive],\n );\n\n return sstyled(styles)(\n <SStepper\n render={Box}\n role='menuitem'\n aria-disabled={disabled}\n aria-current={active}\n onClick={handlerClick}\n onKeyDown={handlerKeyDown}\n >\n {completed && <ScreenReaderOnly>{getI18nText('completedStep')}</ScreenReaderOnly>}\n <SStepNumber aria-hidden='true'>{completed ? <SCompleted /> : number}</SStepNumber>\n <SStepDescription>\n <Children />\n </SStepDescription>\n </SStepper>,\n );\n}\n\nStepper.enhance = [keyboardFocusEnhance()];\n\nfunction Content(props) {\n const { Children, styles } = props;\n const SContent = Root;\n return sstyled(styles)(\n <SContent render={Box}>\n <Children />\n </SContent>,\n );\n}\n\nconst Wizard = createComponent(WizardRoot, {\n Sidebar,\n Content,\n Step,\n Stepper,\n});\n\nexport default Wizard;\n"],"mappings":";;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF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,YAAG;EADvB,OAAA4B,KAAA,GAAO,IAAAzF,aAAO,EAAC6C,MAAM,CAAC,eACpBvD,MAAA,YAAAyD,aAAA,CAAC2C,QAAQ,EAAAD,KAAA,CAAAzC,EAAA,iBAAAX,cAAA,qBAAAlD,KAAA,CAAA4E,WAAA,MAAAyB,KAAA,kBACPlG,MAAA,YAAAyD,aAAA,CAACH,QAAQ,EAAA6C,KAAA,CAAAzC,EAAA,iBAAG,CACH;AAEf;AAEA,IAAM2C,MAAM,GAAG,IAAAC,gBAAe,EAAC1F,UAAU,EAAE;EACzCqD,OAAO,EAAPA,OAAO;EACPgC,OAAO,EAAPA,OAAO;EACPvB,IAAI,EAAJA,IAAI;EACJI,OAAO,EAAPA;AACF,CAAC,CAAC;AAAC,IAAAyB,QAAA,GAEYF,MAAM;AAAAG,OAAA,cAAAD,QAAA"}
|
1
|
+
{"version":3,"file":"Wizard.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_flexBox","_modal","_m","_keyboardFocusEnhance","_i18nEnhance","_intergalacticDynamicLocales","_ScreenReaderOnly","_useFocusLock","style","sstyled","insert","WizardRoot","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","Map","React","createRef","_createClass2","key","value","getStepProps","props","steps","_steps","active","step","asProps","getStepperProps","i","number","has","get","set","_objectSpread2","getI18nText","componentDidUpdate","prevProps","_this2","setTimeout","document","activeElement","body","visible","modalRef","current","setFocus","render","_ref5","SWizard","Root","_this$asProps","Children","styles","clear","createElement","cn","Modal","Component","i18nEnhance","localizedMessages","i18n","locale","Sidebar","_ref","arguments[0]","_ref6","title","SSidebar","Box","SSidebarHeader","assignProps","Step","_ref2","SStep","_ref7","Stepper","_ref3","_ref8","onActive","completed","disabled","SStepper","SStepNumber","SStepDescription","SCompleted","CheckM","handlerClick","useCallback","e","handlerKeyDown","ScreenReaderOnly","enhance","keyboardFocusEnhance","Content","_ref4","_ref9","SContent","Wizard","createComponent","_default","exports"],"sources":["../../src/Wizard.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport Modal from '@semcore/modal';\nimport CheckM from '@semcore/icon/Check/m';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport { ScreenReaderOnly } from '@semcore/utils/lib/ScreenReaderOnly';\nimport { setFocus } from '@semcore/utils/lib/use/useFocusLock';\n\nimport style from './style/wizard.shadow.css';\n\nclass WizardRoot extends Component {\n static displayName = 'Wizard';\n static style = style;\n static enhance = [i18nEnhance(localizedMessages)];\n static defaultProps = {\n step: null,\n i18n: localizedMessages,\n locale: 'en',\n };\n\n _steps = new Map();\n modalRef = React.createRef();\n\n getStepProps(props) {\n return {\n steps: this._steps,\n active: props.step === this.asProps.step,\n };\n }\n\n getStepperProps(props, i) {\n let number = i + 1;\n if (this._steps.has(props.step)) {\n const step = this._steps.get(props.step);\n number = step.number;\n } else {\n this._steps.set(props.step, { number, ...props });\n }\n return {\n active: props.step === this.asProps.step,\n number,\n getI18nText: this.asProps.getI18nText,\n };\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.step === this.asProps.step) return;\n setTimeout(() => {\n if (prevProps.step === this.asProps.step) return;\n if (document.activeElement !== document.body) return;\n if (!this.asProps.visible) return;\n if (!this.modalRef.current) return;\n setFocus(this.modalRef.current, document.body);\n }, 1);\n }\n\n render() {\n const SWizard = this.Root;\n const { Children, styles } = this.asProps;\n\n this._steps.clear();\n\n return sstyled(styles)(\n <SWizard render={Modal} ref={this.modalRef}>\n <Children />\n </SWizard>,\n );\n }\n}\n\nfunction Sidebar(props) {\n const { Children, styles, title } = props;\n const SSidebar = Root;\n const SSidebarHeader = 'h2';\n return sstyled(styles)(\n <SSidebar render={Box} role='menu'>\n {title && <SSidebarHeader>{title}</SSidebarHeader>}\n <Children />\n </SSidebar>,\n );\n}\n\nfunction Step(props) {\n const SStep = Root;\n const { Children, styles, active } = props;\n if (active) {\n return sstyled(styles)(\n <SStep render={Box} tag={Box}>\n <Children />\n </SStep>,\n );\n }\n return null;\n}\n\nfunction Stepper(props) {\n const { Children, styles, step, active, onActive, completed, disabled, number, getI18nText } =\n props;\n const SStepper = Root;\n const SStepNumber = 'span';\n const SStepDescription = 'span';\n const SCompleted = CheckM;\n\n const handlerClick = React.useCallback(\n (e) => {\n if (onActive) onActive(step, e);\n },\n [step, onActive],\n );\n\n const handlerKeyDown = React.useCallback(\n (e) => {\n if (onActive && e.key === 'Enter') {\n onActive(step, e);\n }\n },\n [step, onActive],\n );\n\n return sstyled(styles)(\n <SStepper\n render={Box}\n role='menuitem'\n aria-disabled={disabled}\n aria-current={active}\n onClick={handlerClick}\n onKeyDown={handlerKeyDown}\n >\n {completed && <ScreenReaderOnly>{getI18nText('completedStep')}</ScreenReaderOnly>}\n <SStepNumber aria-hidden='true'>{completed ? <SCompleted /> : number}</SStepNumber>\n <SStepDescription>\n <Children />\n </SStepDescription>\n </SStepper>,\n );\n}\n\nStepper.enhance = [keyboardFocusEnhance()];\n\nfunction Content(props) {\n const { Children, styles } = props;\n const SContent = Root;\n return sstyled(styles)(\n <SContent render={Box}>\n <Children />\n </SContent>,\n );\n}\n\nconst Wizard = createComponent(WizardRoot, {\n Sidebar,\n Content,\n Step,\n Stepper,\n});\n\nexport default Wizard;\n"],"mappings":";;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,EAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,qBAAA,GAAAJ,sBAAA,CAA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ergalactic/utils/lib/enhances/keyboardFocus
|
|
19
19
|
import i18nEnhance from 'intergalactic/utils/lib/enhances/i18nEnhance';
|
20
20
|
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
21
21
|
import { ScreenReaderOnly } from 'intergalactic/utils/lib/ScreenReaderOnly';
|
22
|
+
import { setFocus } from 'intergalactic/utils/lib/use/useFocusLock';
|
22
23
|
/*__reshadow-styles__:"./style/wizard.shadow.css"*/
|
23
24
|
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SWizard_17d9t_gg_{max-width:980px;max-height:700px;display:flex;padding:0;background:0 0}.___SSidebar_17d9t_gg_{background:var(--intergalactic-control-primary-advertising, #5925ab);color:var(--intergalactic-text-primary-invert, #ffffff);font-weight:var(--intergalactic-bold, 700);font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%);padding:var(--intergalactic-spacing-10x, 40px) var(--intergalactic-spacing-2x, 8px) calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-05x, 2px));max-width:220px;flex-shrink:0;box-sizing:border-box;border-radius:var(--intergalactic-modal-rounded, 12px)0 0 var(--intergalactic-modal-rounded, 12px)}@media (max-width:1060px){.___SSidebar_17d9t_gg_{width:44px}}.___SSidebarHeader_17d9t_gg_{font-size:var(--intergalactic-fs-300, 16px);margin:0 var(--intergalactic-spacing-5x, 20px) var(--intergalactic-spacing-4x, 16px)}@media (max-width:1060px){.___SSidebarHeader_17d9t_gg_{display:none}}.___SStepper_17d9t_gg_{display:flex;font-size:var(--intergalactic-fs-200, 14px);border-radius:var(--intergalactic-control-rounded, 6px);padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-3x, 12px);cursor:pointer;position:relative;overflow:auto;line-height:var(--intergalactic-lh-200, 142%)}@media (hover:hover){.___SStepper_17d9t_gg_:hover{background:var(--intergalactic-control-primary-advertising-hover, #421983);z-index:1}}.___SStepper_17d9t_gg_.__active_17d9t_gg_{background:var(--intergalactic-control-primary-advertising-active, #8649e1)}.___SStepper_17d9t_gg_.__disabled_17d9t_gg_,.___SStepper_17d9t_gg_:disabled{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (max-width:1060px){.___SStepper_17d9t_gg_{padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-1x, 4px)}@media (hover:hover){.___SStepper_17d9t_gg_:hover{width:-moz-fit-content;width:fit-content;max-width:220px}.___SStepper_17d9t_gg_:hover .___SStepDescription_17d9t_gg_{display:block;border-radius:var(--intergalactic-control-rounded, 6px);white-space:nowrap;overflow:auto}.___SStepper_17d9t_gg_.__active_17d9t_gg_:hover .___SStepDescription_17d9t_gg_{background:var(--intergalactic-control-primary-advertising-active, #8649e1)}}}.___SStepNumber_17d9t_gg_{display:inline-block;min-width:20px}.___SCompleted_17d9t_gg_{margin-top:1px}@media (max-width:1060px){.___SStepDescription_17d9t_gg_{display:none}}.___SContent_17d9t_gg_{padding:var(--intergalactic-spacing-10x, 40px);width:100%;border-radius:0 var(--intergalactic-modal-rounded, 12px) var(--intergalactic-modal-rounded, 12px)0;background:var(--intergalactic-bg-primary-neutral, #ffffff)}" /*__inner_css_end__*/, "17d9t_gg_") /*__reshadow_css_end__*/, {
|
24
25
|
"__SWizard": "___SWizard_17d9t_gg_",
|
@@ -43,6 +44,7 @@ var WizardRoot = /*#__PURE__*/function (_Component) {
|
|
43
44
|
}
|
44
45
|
_this = _super.call.apply(_super, [this].concat(args));
|
45
46
|
_defineProperty(_assertThisInitialized(_this), "_steps", new Map());
|
47
|
+
_defineProperty(_assertThisInitialized(_this), "modalRef", /*#__PURE__*/React.createRef());
|
46
48
|
return _this;
|
47
49
|
}
|
48
50
|
_createClass(WizardRoot, [{
|
@@ -71,6 +73,19 @@ var WizardRoot = /*#__PURE__*/function (_Component) {
|
|
71
73
|
getI18nText: this.asProps.getI18nText
|
72
74
|
};
|
73
75
|
}
|
76
|
+
}, {
|
77
|
+
key: "componentDidUpdate",
|
78
|
+
value: function componentDidUpdate(prevProps) {
|
79
|
+
var _this2 = this;
|
80
|
+
if (prevProps.step === this.asProps.step) return;
|
81
|
+
setTimeout(function () {
|
82
|
+
if (prevProps.step === _this2.asProps.step) return;
|
83
|
+
if (document.activeElement !== document.body) return;
|
84
|
+
if (!_this2.asProps.visible) return;
|
85
|
+
if (!_this2.modalRef.current) return;
|
86
|
+
setFocus(_this2.modalRef.current, document.body);
|
87
|
+
}, 1);
|
88
|
+
}
|
74
89
|
}, {
|
75
90
|
key: "render",
|
76
91
|
value: function render() {
|
@@ -81,7 +96,8 @@ var WizardRoot = /*#__PURE__*/function (_Component) {
|
|
81
96
|
styles = _this$asProps.styles;
|
82
97
|
this._steps.clear();
|
83
98
|
return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SWizard, _ref5.cn("SWizard", {
|
84
|
-
"render": Modal
|
99
|
+
"render": Modal,
|
100
|
+
"ref": this.modalRef
|
85
101
|
}), /*#__PURE__*/React.createElement(Children, _ref5.cn("Children", {})));
|
86
102
|
}
|
87
103
|
}]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Wizard.js","names":["React","createComponent","Component","Root","sstyled","Box","Modal","CheckM","keyboardFocusEnhance","i18nEnhance","localizedMessages","ScreenReaderOnly","style","_sstyled","insert","WizardRoot","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","Map","_createClass","key","value","getStepProps","props","steps","_steps","active","step","asProps","getStepperProps","i","number","has","get","set","_objectSpread","getI18nText","render","_ref5","SWizard","_this$asProps","Children","styles","clear","createElement","cn","i18n","locale","Sidebar","_ref","arguments[0]","_ref6","title","SSidebar","SSidebarHeader","_assignProps","Step","_ref2","SStep","_ref7","_assignProps2","Stepper","_ref3","_ref8","onActive","completed","disabled","SStepper","SStepNumber","SStepDescription","SCompleted","handlerClick","useCallback","e","handlerKeyDown","_assignProps3","enhance","Content","_ref4","_ref9","SContent","_assignProps4","Wizard"],"sources":["../../src/Wizard.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport Modal from '@semcore/modal';\nimport CheckM from '@semcore/icon/Check/m';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport { ScreenReaderOnly } from '@semcore/utils/lib/ScreenReaderOnly';\n\nimport style from './style/wizard.shadow.css';\n\nclass WizardRoot extends Component {\n static displayName = 'Wizard';\n static style = style;\n static enhance = [i18nEnhance(localizedMessages)];\n static defaultProps = {\n step: null,\n i18n: localizedMessages,\n locale: 'en',\n };\n\n _steps = new Map();\n\n getStepProps(props) {\n return {\n steps: this._steps,\n active: props.step === this.asProps.step,\n };\n }\n\n getStepperProps(props, i) {\n let number = i + 1;\n if (this._steps.has(props.step)) {\n const step = this._steps.get(props.step);\n number = step.number;\n } else {\n this._steps.set(props.step, { number, ...props });\n }\n return {\n active: props.step === this.asProps.step,\n number,\n getI18nText: this.asProps.getI18nText,\n };\n }\n\n render() {\n const SWizard = this.Root;\n const { Children, styles } = this.asProps;\n\n this._steps.clear();\n\n return sstyled(styles)(\n <SWizard render={Modal}>\n <Children />\n </SWizard>,\n );\n }\n}\n\nfunction Sidebar(props) {\n const { Children, styles, title } = props;\n const SSidebar = Root;\n const SSidebarHeader = 'h2';\n return sstyled(styles)(\n <SSidebar render={Box} role='menu'>\n {title && <SSidebarHeader>{title}</SSidebarHeader>}\n <Children />\n </SSidebar>,\n );\n}\n\nfunction Step(props) {\n const SStep = Root;\n const { Children, styles, active } = props;\n if (active) {\n return sstyled(styles)(\n <SStep render={Box} tag={Box}>\n <Children />\n </SStep>,\n );\n }\n return null;\n}\n\nfunction Stepper(props) {\n const { Children, styles, step, active, onActive, completed, disabled, number, getI18nText } =\n props;\n const SStepper = Root;\n const SStepNumber = 'span';\n const SStepDescription = 'span';\n const SCompleted = CheckM;\n\n const handlerClick = React.useCallback(\n (e) => {\n if (onActive) onActive(step, e);\n },\n [step, onActive],\n );\n\n const handlerKeyDown = React.useCallback(\n (e) => {\n if (onActive && e.key === 'Enter') {\n onActive(step, e);\n }\n },\n [step, onActive],\n );\n\n return sstyled(styles)(\n <SStepper\n render={Box}\n role='menuitem'\n aria-disabled={disabled}\n aria-current={active}\n onClick={handlerClick}\n onKeyDown={handlerKeyDown}\n >\n {completed && <ScreenReaderOnly>{getI18nText('completedStep')}</ScreenReaderOnly>}\n <SStepNumber aria-hidden='true'>{completed ? <SCompleted /> : number}</SStepNumber>\n <SStepDescription>\n <Children />\n </SStepDescription>\n </SStepper>,\n );\n}\n\nStepper.enhance = [keyboardFocusEnhance()];\n\nfunction Content(props) {\n const { Children, styles } = props;\n const SContent = Root;\n return sstyled(styles)(\n <SContent render={Box}>\n <Children />\n </SContent>,\n );\n}\n\nconst Wizard = createComponent(WizardRoot, {\n Sidebar,\n Content,\n Step,\n Stepper,\n});\n\nexport default Wizard;\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACzE,SAASC,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,KAAK,MAAM,gBAAgB;AAClC,OAAOC,MAAM,MAAM,uBAAuB;AAC1C,OAAOC,oBAAoB,MAAM,kDAAkD;AACnF,OAAOC,WAAW,MAAM,yCAAyC;AACjE,SAASC,iBAAiB,QAAQ,gDAAgD;AAClF,SAASC,gBAAgB,QAAQ,qCAAqC;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAIjEC,UAAU,0BAAAC,UAAA;EAAAC,S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WAAW,CAAC,eAAe,CAAC,CAAoB,eACjFnD,KAAA,CAAA2D,aAAA,CAACwB,WAAW,EAAAL,KAAA,CAAAlB,EAAA;IAAA,eAAa;EAAM,IAAEoB,SAAS,gBAAGhF,KAAA,CAAA2D,aAAA,CAAC0B,UAAU,EAAAP,KAAA,CAAAlB,EAAA,mBAAG,GAAGd,MAAM,CAAe,eACnF9C,KAAA,CAAA2D,aAAA,CAACyB,gBAAgB,EAAAN,KAAA,CAAAlB,EAAA,uCACf5D,KAAA,CAAA2D,aAAA,CAACH,QAAQ,EAAAsB,KAAA,CAAAlB,EAAA,iBAAG,CACK,CACV;AAEf;AAEAgB,OAAO,CAACe,OAAO,GAAG,CAACnF,oBAAoB,EAAE,CAAC;AAE1C,SAASoF,OAAOA,CAACtD,KAAK,EAAE;EAAA,IAAAuD,KAAA,GAAA5B,YAAA;IAAA6B,KAAA;EACtB,IAAQtC,QAAQ,GAAalB,KAAK,CAA1BkB,QAAQ;IAAEC,MAAM,GAAKnB,KAAK,CAAhBmB,MAAM;EACxB,IAAMsC,QAAQ,GAEM1F,GAAG;EADvB,OAAAyF,KAAA,GAAO1F,OAAO,CAACqD,MAAM,CAAC,eACpBzD,KAAA,CAAA2D,aAAA,CAACoC,QAAQ,EAAAD,KAAA,CAAAlC,EAAA,aAAAV,aAAA,KAAA8C,aAAA,KAAAH,KAAA,kBACP7F,KAAA,CAAA2D,aAAA,CAACH,QAAQ,EAAAsC,KAAA,CAAAlC,EAAA,iBAAG,CACH;AAEf;AAEA,IAAMqC,MAAM,GAAGhG,eAAe,CAACc,UAAU,EAAE;EACzCgD,OAAO,EAAPA,OAAO;EACP6B,OAAO,EAAPA,OAAO;EACPrB,IAAI,EAAJA,IAAI;EACJK,OAAO,EAAPA;AACF,CAAC,CAAC;AAEF,eAAeqB,MAAM"}
|
1
|
+
{"version":3,"file":"Wizard.js","names":["React","createComponent","Component","Root","sstyled","Box","Modal","CheckM","keyboardFocusEnhance","i18nEnhance","localizedMessages","ScreenReaderOnly","setFocus","style","_sstyled","insert","WizardRoot","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","Map","createRef","_createClass","key","value","getStepProps","props","steps","_steps","active","step","asProps","getStepperProps","i","number","has","get","set","_objectSpread","getI18nText","componentDidUpdate","prevProps","_this2","setTimeout","document","activeElement","body","visible","modalRef","current","render","_ref5","SWizard","_this$asProps","Children","styles","clear","createElement","cn","i18n","locale","Sidebar","_ref","arguments[0]","_ref6","title","SSidebar","SSidebarHeader","_assignProps","Step","_ref2","SStep","_ref7","_assignProps2","Stepper","_ref3","_ref8","onActive","completed","disabled","SStepper","SStepNumber","SStepDescription","SCompleted","handlerClick","useCallback","e","handlerKeyDown","_assignProps3","enhance","Content","_ref4","_ref9","SContent","_assignProps4","Wizard"],"sources":["../../src/Wizard.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport Modal from '@semcore/modal';\nimport CheckM from '@semcore/icon/Check/m';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport { ScreenReaderOnly } from '@semcore/utils/lib/ScreenReaderOnly';\nimport { setFocus } from '@semcore/utils/lib/use/useFocusLock';\n\nimport style from './style/wizard.shadow.css';\n\nclass WizardRoot extends Component {\n static displayName = 'Wizard';\n static style = style;\n static enhance = [i18nEnhance(localizedMessages)];\n static defaultProps = {\n step: null,\n i18n: localizedMessages,\n locale: 'en',\n };\n\n _steps = new Map();\n modalRef = React.createRef();\n\n getStepProps(props) {\n return {\n steps: this._steps,\n active: props.step === this.asProps.step,\n };\n }\n\n getStepperProps(props, i) {\n let number = i + 1;\n if (this._steps.has(props.step)) {\n const step = this._steps.get(props.step);\n number = step.number;\n } else {\n this._steps.set(props.step, { number, ...props });\n }\n return {\n active: props.step === this.asProps.step,\n number,\n getI18nText: this.asProps.getI18nText,\n };\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.step === this.asProps.step) return;\n setTimeout(() => {\n if (prevProps.step === this.asProps.step) return;\n if (document.activeElement !== document.body) return;\n if (!this.asProps.visible) return;\n if (!this.modalRef.current) return;\n setFocus(this.modalRef.current, document.body);\n }, 1);\n }\n\n render() {\n const SWizard = this.Root;\n const { Children, styles } = this.asProps;\n\n this._steps.clear();\n\n return sstyled(styles)(\n <SWizard render={Modal} ref={this.modalRef}>\n <Children />\n </SWizard>,\n );\n }\n}\n\nfunction Sidebar(props) {\n const { Children, styles, title } = props;\n const SSidebar = Root;\n const SSidebarHeader = 'h2';\n return sstyled(styles)(\n <SSidebar render={Box} role='menu'>\n {title && <SSidebarHeader>{title}</SSidebarHeader>}\n <Children />\n </SSidebar>,\n );\n}\n\nfunction Step(props) {\n const SStep = Root;\n const { Children, styles, active } = props;\n if (active) {\n return sstyled(styles)(\n <SStep render={Box} tag={Box}>\n <Children />\n </SStep>,\n );\n }\n return null;\n}\n\nfunction Stepper(props) {\n const { Children, styles, step, active, onActive, completed, disabled, number, getI18nText } =\n props;\n const SStepper = Root;\n const SStepNumber = 'span';\n const SStepDescription = 'span';\n const SCompleted = CheckM;\n\n const handlerClick = React.useCallback(\n (e) => {\n if (onActive) onActive(step, e);\n },\n [step, onActive],\n );\n\n const handlerKeyDown = React.useCallback(\n (e) => {\n if (onActive && e.key === 'Enter') {\n onActive(step, e);\n }\n },\n [step, onActive],\n );\n\n return sstyled(styles)(\n <SStepper\n render={Box}\n role='menuitem'\n aria-disabled={disabled}\n aria-current={active}\n onClick={handlerClick}\n onKeyDown={handlerKeyDown}\n >\n {completed && <ScreenReaderOnly>{getI18nText('completedStep')}</ScreenReaderOnly>}\n <SStepNumber aria-hidden='true'>{completed ? <SCompleted /> : number}</SStepNumber>\n <SStepDescription>\n <Children />\n </SStepDescription>\n </SStepper>,\n );\n}\n\nStepper.enhance = [keyboardFocusEnhance()];\n\nfunction Content(props) {\n const { Children, styles } = props;\n const SContent = Root;\n return sstyled(styles)(\n <SContent render={Box}>\n <Children />\n </SContent>,\n );\n}\n\nconst Wizard = createComponent(WizardRoot, {\n Sidebar,\n Content,\n Step,\n Stepper,\n});\n\nexport default Wizard;\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACzE,SAASC,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,KAAK,MAAM,gBAAgB;AAClC,OAAOC,MAAM,MAAM,uBAAuB;AAC1C,OAAOC,oBAAoB,MAAM,kDAAkD;AACnF,OAAOC,WAAW,MAAM,yCAAyC;AACjE,SAASC,iBAAiB,QAAQ,gDAAgD;AAClF,SAASC,gBAAgB,QAAQ,qCAAqC;AACtE,SAASC,QAAQ,QAAQ,qCAAqC;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAIzDC,UAAU,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,UAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,UAAA;EAAA,SAAAA,WAAA;IAAA,IAAAK,KAAA;IAAAC,eAAA,OAAAN,UAAA;IAAA,SAAAO,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,GAAAF,MAAA,CAAAU,IAAA,CAAAC,KAAA,CAAAX,MAAA,SAAAY,MAAA,CAAAL,IAAA;IAAAM,eAA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