@gravity-ui/date-components 3.0.1 → 3.0.3
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/dist/cjs/components/CalendarView/CalendarView.js +1 -1
- package/dist/cjs/components/CalendarView/CalendarView.js.map +1 -1
- package/dist/cjs/components/DatePicker/hooks/useDatePickerProps.js +1 -0
- package/dist/cjs/components/DatePicker/hooks/useDatePickerProps.js.map +1 -1
- package/dist/cjs/components/RelativeDateField/RelativeDateField.js +14 -4
- package/dist/cjs/components/RelativeDateField/RelativeDateField.js.map +1 -1
- package/dist/cjs/components/RelativeDatePicker/hooks/useRelativeDatePickerProps.js +1 -0
- package/dist/cjs/components/RelativeDatePicker/hooks/useRelativeDatePickerProps.js.map +1 -1
- package/dist/cjs/components/RelativeRangeDatePicker/RelativeRangeDatePicker.js +18 -31
- package/dist/cjs/components/RelativeRangeDatePicker/RelativeRangeDatePicker.js.map +1 -1
- package/dist/cjs/components/RelativeRangeDatePicker/components/Control/Control.d.ts +2 -1
- package/dist/cjs/components/RelativeRangeDatePicker/components/Control/Control.js +3 -2
- package/dist/cjs/components/RelativeRangeDatePicker/components/Control/Control.js.map +1 -1
- package/dist/cjs/components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.d.ts +5 -1
- package/dist/cjs/components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.js +5 -2
- package/dist/cjs/components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.js.map +1 -1
- package/dist/cjs/components/RelativeRangeDatePicker/types.d.ts +1 -0
- package/dist/cjs/components/RelativeRangeDatePicker/types.js.map +1 -1
- package/dist/esm/components/CalendarView/CalendarView.js +1 -1
- package/dist/esm/components/CalendarView/CalendarView.js.map +1 -1
- package/dist/esm/components/DatePicker/hooks/useDatePickerProps.js +1 -0
- package/dist/esm/components/DatePicker/hooks/useDatePickerProps.js.map +1 -1
- package/dist/esm/components/RelativeDateField/RelativeDateField.js +14 -4
- package/dist/esm/components/RelativeDateField/RelativeDateField.js.map +1 -1
- package/dist/esm/components/RelativeDatePicker/hooks/useRelativeDatePickerProps.js +1 -0
- package/dist/esm/components/RelativeDatePicker/hooks/useRelativeDatePickerProps.js.map +1 -1
- package/dist/esm/components/RelativeRangeDatePicker/RelativeRangeDatePicker.js +18 -31
- package/dist/esm/components/RelativeRangeDatePicker/RelativeRangeDatePicker.js.map +1 -1
- package/dist/esm/components/RelativeRangeDatePicker/components/Control/Control.d.ts +2 -1
- package/dist/esm/components/RelativeRangeDatePicker/components/Control/Control.js +3 -2
- package/dist/esm/components/RelativeRangeDatePicker/components/Control/Control.js.map +1 -1
- package/dist/esm/components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.d.ts +5 -1
- package/dist/esm/components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.js +5 -2
- package/dist/esm/components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.js.map +1 -1
- package/dist/esm/components/RelativeRangeDatePicker/types.d.ts +1 -0
- package/dist/esm/components/RelativeRangeDatePicker/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Control.js","sourceRoot":"../../../../../../src","sources":["components/RelativeRangeDatePicker/components/Control/Control.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,QAAQ,IAAI,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAC,KAAK,EAAC,gCAA6B;AAC3C,OAAO,EAAC,qBAAqB,EAAC,gDAA6C;AAG3E,OAAO,EAAC,eAAe,EAAC,uBAAoB;AAE5C,OAAO,EAAC,IAAI,EAAC,wBAAe;AAE5B,uBAAwB;
|
|
1
|
+
{"version":3,"file":"Control.js","sourceRoot":"../../../../../../src","sources":["components/RelativeRangeDatePicker/components/Control/Control.tsx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from 'react';\n\nimport {Calendar as CalendarIcon} from '@gravity-ui/icons';\nimport {Button, Icon, TextInput} from '@gravity-ui/uikit';\n\nimport {block} from '../../../../utils/cn';\nimport {getButtonSizeForInput} from '../../../utils/getButtonSizeForInput';\nimport type {RelativeRangeDatePickerState} from '../../hooks/useRelativeRangeDatePickerState';\nimport type {RelativeRangeDatePickerProps, RelativeRangeDatePickerTriggerProps} from '../../types';\nimport {getDefaultTitle} from '../../utils';\n\nimport {i18n} from './i18n';\n\nimport './Control.scss';\n\nexport type ControlProps = {\n props: RelativeRangeDatePickerProps;\n state: RelativeRangeDatePickerState;\n open: boolean;\n setOpen: (open: boolean) => void;\n isMobile?: boolean;\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n onFocus?: (e: React.FocusEvent<HTMLElement>) => void;\n onClickCalendar: (e: React.MouseEvent<HTMLElement>) => void;\n onUpdate: (value: string) => void;\n};\n\nconst b = block('relative-range-date-picker-control');\n\nexport const Control = React.forwardRef<HTMLInputElement, ControlProps>(\n (\n {\n props,\n state,\n open,\n setOpen,\n isMobile,\n onClick,\n onKeyDown,\n onFocus,\n onClickCalendar,\n onUpdate,\n },\n ref,\n ) => {\n const {alwaysShowAsAbsolute, presetTabs, getRangeTitle} = props;\n const format = props.format || 'L';\n\n const text = React.useMemo(\n () =>\n typeof getRangeTitle === 'function'\n ? getRangeTitle(state.value, state.timeZone)\n : getDefaultTitle({\n value: state.value,\n timeZone: state.timeZone,\n alwaysShowAsAbsolute,\n format,\n presets: presetTabs?.flatMap(({presets}) => presets),\n }),\n [alwaysShowAsAbsolute, format, getRangeTitle, presetTabs, state.timeZone, state.value],\n );\n\n const validationState = props.validationState || (state.isInvalid ? 'invalid' : undefined);\n const errorMessage = props.errorMessage ?? state.errors.join('\\n');\n\n const triggerProps: RelativeRangeDatePickerTriggerProps = {\n id: props.id,\n role: 'combobox',\n 'aria-haspopup': 'dialog',\n 'aria-expanded': open,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'],\n 'aria-describedby': props['aria-describedby'],\n 'aria-details': props['aria-details'],\n disabled: props.disabled,\n readOnly: props.readOnly,\n onClick: onClickCalendar,\n onKeyDown,\n };\n\n return props.renderControl ? (\n props.renderControl({\n ref,\n value: state.value,\n title: text,\n validationState,\n errorMessage,\n open,\n setOpen,\n triggerProps,\n })\n ) : (\n <React.Fragment>\n <TextInput\n id={props.id}\n autoFocus={props.autoFocus}\n controlRef={ref}\n value={text}\n placeholder={props.placeholder}\n onUpdate={onUpdate}\n controlProps={{\n className: b('input', {mobile: isMobile}),\n ...triggerProps,\n disabled: isMobile,\n onClick,\n }}\n onKeyDown={onKeyDown}\n onFocus={onFocus}\n validationState={validationState}\n errorMessage={errorMessage}\n errorPlacement={props.errorPlacement}\n pin={props.pin}\n size={props.size}\n label={props.label}\n hasClear={props.hasClear}\n disabled={props.disabled}\n endContent={\n <Button\n view=\"flat-secondary\"\n size={getButtonSizeForInput(props.size)}\n disabled={props.disabled}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-label={i18n('Range date picker')}\n onClick={onClickCalendar}\n tabIndex={-1}\n >\n <Icon data={CalendarIcon} />\n </Button>\n }\n />\n {isMobile ? (\n <button\n className={b('mobile-trigger', {\n 'has-clear': Boolean(props.hasClear && state.value),\n 'has-errors': state.isInvalid && props.errorPlacement === 'inside',\n size: props.size,\n })}\n onClick={onClick}\n />\n ) : null}\n </React.Fragment>\n );\n },\n);\n\nControl.displayName = 'Control';\n"]}
|
package/dist/esm/components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.d.ts
CHANGED
|
@@ -9,9 +9,13 @@ export interface PickerDialogProps extends PickerFormProps, PopupStyleProps {
|
|
|
9
9
|
open: boolean;
|
|
10
10
|
/** Handles popup close event */
|
|
11
11
|
onClose: (reason?: Parameters<NonNullable<PopupProps['onOpenChange']>>[2] | 'apply') => void;
|
|
12
|
+
/** Handles popup remove from DOM event */
|
|
13
|
+
onRemove?: () => void;
|
|
12
14
|
/** If true `Popup` act like a modal dialog */
|
|
13
15
|
modal?: boolean;
|
|
16
|
+
/** Element which focus should be returned to */
|
|
17
|
+
returnFocus?: PopupProps['returnFocus'];
|
|
14
18
|
/** If true `Sheet` is used instead of `Popup` */
|
|
15
19
|
isMobile?: boolean;
|
|
16
20
|
}
|
|
17
|
-
export declare function PickerDialog({ open, onClose, isMobile, anchor, popupClassName, popupStyle, popupPlacement, popupOffset, modal, ...props }: PickerDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function PickerDialog({ open, onClose, isMobile, anchor, popupClassName, popupStyle, popupPlacement, popupOffset, modal, returnFocus, onRemove, ...props }: PickerDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,10 +7,13 @@ import { PickerForm } from "./PickerForm.js";
|
|
|
7
7
|
import "./PickerDialog.css";
|
|
8
8
|
const b = block('relative-range-date-picker-dialog');
|
|
9
9
|
export function PickerDialog(_a) {
|
|
10
|
-
var { open, onClose, isMobile, anchor, popupClassName, popupStyle, popupPlacement, popupOffset, modal } = _a, props = __rest(_a, ["open", "onClose", "isMobile", "anchor", "popupClassName", "popupStyle", "popupPlacement", "popupOffset", "modal"]);
|
|
10
|
+
var { open, onClose, isMobile, anchor, popupClassName, popupStyle, popupPlacement, popupOffset, modal, returnFocus = false, onRemove } = _a, props = __rest(_a, ["open", "onClose", "isMobile", "anchor", "popupClassName", "popupStyle", "popupPlacement", "popupOffset", "modal", "returnFocus", "onRemove"]);
|
|
11
11
|
if (isMobile) {
|
|
12
12
|
return (_jsx(Sheet, { visible: open, onClose: () => {
|
|
13
13
|
onClose('outside-press');
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
onRemove === null || onRemove === void 0 ? void 0 : onRemove();
|
|
16
|
+
});
|
|
14
17
|
}, contentClassName: b('content', { mobile: true, size: 'xl' }, popupClassName), children: _jsx(PickerForm, Object.assign({}, props, { size: "xl", onApply: () => {
|
|
15
18
|
onClose('apply');
|
|
16
19
|
} })) }));
|
|
@@ -19,7 +22,7 @@ export function PickerDialog(_a) {
|
|
|
19
22
|
if (!isOpen) {
|
|
20
23
|
onClose(reason);
|
|
21
24
|
}
|
|
22
|
-
}, placement: popupPlacement, offset: popupOffset, role: "dialog", anchorElement: anchor, className: b('content', { size: props.size }, popupClassName), style: popupStyle, modal: modal, children: _jsx(PickerForm, Object.assign({}, props, { onApply: () => {
|
|
25
|
+
}, placement: popupPlacement, offset: popupOffset, role: "dialog", anchorElement: anchor, className: b('content', { size: props.size }, popupClassName), style: popupStyle, modal: modal, returnFocus: returnFocus, onTransitionOutComplete: onRemove, children: _jsx(PickerForm, Object.assign({}, props, { onApply: () => {
|
|
23
26
|
onClose('apply');
|
|
24
27
|
} })) }));
|
|
25
28
|
}
|
package/dist/esm/components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickerDialog.js","sourceRoot":"../../../../../../src","sources":["components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,OAAO,EAAC,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAC,KAAK,EAAC,gCAA6B;AAG3C,OAAO,EAAC,UAAU,EAAC,wBAAqB;AAGxC,4BAA6B;AAE7B,MAAM,CAAC,GAAG,KAAK,CAAC,mCAAmC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"PickerDialog.js","sourceRoot":"../../../../../../src","sources":["components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,OAAO,EAAC,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAC,KAAK,EAAC,gCAA6B;AAG3C,OAAO,EAAC,UAAU,EAAC,wBAAqB;AAGxC,4BAA6B;AAE7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D,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,uBAAuB,EAAE,QAAQ,YAEjC,KAAC,UAAU,oBACH,KAAK,IACT,OAAO,EAAE,GAAG,EAAE;gBACV,OAAO,CAAC,OAAO,CAAC,CAAC;YACrB,CAAC,IACH,GACE,CACX,CAAC;AACN,CAAC","sourcesContent":["'use client';\n\nimport {Popup, Sheet} from '@gravity-ui/uikit';\nimport type {PopupProps} from '@gravity-ui/uikit';\n\nimport {block} from '../../../../utils/cn';\nimport type {PopupStyleProps} from '../../../types';\n\nimport {PickerForm} from './PickerForm';\nimport type {PickerFormProps} from './PickerForm';\n\nimport './PickerDialog.scss';\n\nconst b = block('relative-range-date-picker-dialog');\n\nexport interface PickerDialogProps extends PickerFormProps, PopupStyleProps {\n /** Popup anchor */\n anchor: HTMLElement | null;\n /** Manages `Popup` visibility */\n open: boolean;\n /** Handles popup close event */\n onClose: (reason?: Parameters<NonNullable<PopupProps['onOpenChange']>>[2] | 'apply') => void;\n /** Handles popup remove from DOM event */\n onRemove?: () => void;\n /** If true `Popup` act like a modal dialog */\n modal?: boolean;\n /** Element which focus should be returned to */\n returnFocus?: PopupProps['returnFocus'];\n /** If true `Sheet` is used instead of `Popup` */\n isMobile?: boolean;\n}\n\nexport function PickerDialog({\n open,\n onClose,\n isMobile,\n anchor,\n popupClassName,\n popupStyle,\n popupPlacement,\n popupOffset,\n modal,\n returnFocus = false,\n onRemove,\n ...props\n}: PickerDialogProps) {\n if (isMobile) {\n return (\n <Sheet\n visible={open}\n onClose={() => {\n onClose('outside-press');\n setTimeout(() => {\n onRemove?.();\n });\n }}\n contentClassName={b('content', {mobile: true, size: 'xl'}, popupClassName)}\n >\n <PickerForm\n {...props}\n size=\"xl\"\n onApply={() => {\n onClose('apply');\n }}\n />\n </Sheet>\n );\n }\n\n return (\n <Popup\n open={open}\n onOpenChange={(isOpen, _event, reason) => {\n if (!isOpen) {\n onClose(reason);\n }\n }}\n placement={popupPlacement}\n offset={popupOffset}\n role=\"dialog\"\n anchorElement={anchor}\n className={b('content', {size: props.size}, popupClassName)}\n style={popupStyle}\n modal={modal}\n returnFocus={returnFocus}\n onTransitionOutComplete={onRemove}\n >\n <PickerForm\n {...props}\n onApply={() => {\n onClose('apply');\n }}\n />\n </Popup>\n );\n}\n"]}
|
|
@@ -12,6 +12,7 @@ export interface RelativeRangeDatePickerRenderControlProps {
|
|
|
12
12
|
errorMessage?: React.ReactNode;
|
|
13
13
|
validationState?: 'invalid';
|
|
14
14
|
open: boolean;
|
|
15
|
+
setOpen: (open: boolean) => void;
|
|
15
16
|
triggerProps: RelativeRangeDatePickerTriggerProps;
|
|
16
17
|
}
|
|
17
18
|
export interface RelativeRangeDatePickerProps extends RelativeRangeDatePickerStateOptions, DomProps, AccessibilityProps, InputBase, InputDOMProps, TextInputProps, Validation, FocusableProps, StyleProps, PopupStyleProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"../../../../src","sources":["components/RelativeRangeDatePicker/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {DateTime} from '@gravity-ui/date-utils';\n\nimport type {Value} from '../RelativeDatePicker';\nimport type {\n AccessibilityProps,\n DomProps,\n FocusableProps,\n InputBase,\n InputDOMProps,\n PopupStyleProps,\n RangeValue,\n StyleProps,\n TextInputProps,\n Validation,\n} from '../types';\n\nimport type {Preset} from './components/Presets/defaultPresets';\nimport type {PresetTab} from './components/Presets/utils';\nimport type {\n RelativeRangeDatePickerStateOptions,\n RelativeRangeDatePickerValue,\n} from './hooks/useRelativeRangeDatePickerState';\n\nexport type RelativeRangeDatePickerTriggerProps = Pick<\n React.AllHTMLAttributes<HTMLElement>,\n | 'id'\n | 'role'\n | 'aria-controls'\n | 'aria-haspopup'\n | 'aria-expanded'\n | 'aria-label'\n | 'aria-labelledby'\n | 'aria-describedby'\n | 'aria-details'\n | 'onClick'\n | 'onKeyDown'\n | 'disabled'\n | 'readOnly'\n>;\n\nexport interface RelativeRangeDatePickerRenderControlProps {\n ref: React.Ref<HTMLElement>;\n value: RelativeRangeDatePickerValue | null;\n title: string;\n errorMessage?: React.ReactNode;\n validationState?: 'invalid';\n open: boolean;\n triggerProps: RelativeRangeDatePickerTriggerProps;\n}\n\nexport interface RelativeRangeDatePickerProps\n extends RelativeRangeDatePickerStateOptions,\n DomProps,\n AccessibilityProps,\n InputBase,\n InputDOMProps,\n TextInputProps,\n Validation,\n FocusableProps,\n StyleProps,\n PopupStyleProps {\n /** Format of the date when rendered in the input. [Available formats](https://day.js.org/docs/en/display/format) */\n format?: string;\n /** A placeholder date that controls the default values of each segment when the user first interacts with them. Defaults to today's date at midnight. */\n placeholderValue?: DateTime;\n /** Apply changes with button */\n withApplyButton?: boolean;\n /** Show time zone selector */\n withZonesList?: boolean;\n /** Show relative range presets */\n withPresets?: boolean;\n /** Custom preset tabs */\n presetTabs?: PresetTab[];\n /** Custom docs for presets, if empty array docs will be hidden */\n docs?: Preset[];\n /** Show selected relative values as absolute dates */\n alwaysShowAsAbsolute?: boolean;\n /** */\n getRangeTitle?: (value: RangeValue<Value | null> | null, timeZone: string) => string;\n /** Handler that is called when the popup's open state changes. */\n onOpenChange?: (open: boolean) => void;\n /** Used to render control. */\n renderControl?: (props: RelativeRangeDatePickerRenderControlProps) => React.ReactElement;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"../../../../src","sources":["components/RelativeRangeDatePicker/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {DateTime} from '@gravity-ui/date-utils';\n\nimport type {Value} from '../RelativeDatePicker';\nimport type {\n AccessibilityProps,\n DomProps,\n FocusableProps,\n InputBase,\n InputDOMProps,\n PopupStyleProps,\n RangeValue,\n StyleProps,\n TextInputProps,\n Validation,\n} from '../types';\n\nimport type {Preset} from './components/Presets/defaultPresets';\nimport type {PresetTab} from './components/Presets/utils';\nimport type {\n RelativeRangeDatePickerStateOptions,\n RelativeRangeDatePickerValue,\n} from './hooks/useRelativeRangeDatePickerState';\n\nexport type RelativeRangeDatePickerTriggerProps = Pick<\n React.AllHTMLAttributes<HTMLElement>,\n | 'id'\n | 'role'\n | 'aria-controls'\n | 'aria-haspopup'\n | 'aria-expanded'\n | 'aria-label'\n | 'aria-labelledby'\n | 'aria-describedby'\n | 'aria-details'\n | 'onClick'\n | 'onKeyDown'\n | 'disabled'\n | 'readOnly'\n>;\n\nexport interface RelativeRangeDatePickerRenderControlProps {\n ref: React.Ref<HTMLElement>;\n value: RelativeRangeDatePickerValue | null;\n title: string;\n errorMessage?: React.ReactNode;\n validationState?: 'invalid';\n open: boolean;\n setOpen: (open: boolean) => void;\n triggerProps: RelativeRangeDatePickerTriggerProps;\n}\n\nexport interface RelativeRangeDatePickerProps\n extends RelativeRangeDatePickerStateOptions,\n DomProps,\n AccessibilityProps,\n InputBase,\n InputDOMProps,\n TextInputProps,\n Validation,\n FocusableProps,\n StyleProps,\n PopupStyleProps {\n /** Format of the date when rendered in the input. [Available formats](https://day.js.org/docs/en/display/format) */\n format?: string;\n /** A placeholder date that controls the default values of each segment when the user first interacts with them. Defaults to today's date at midnight. */\n placeholderValue?: DateTime;\n /** Apply changes with button */\n withApplyButton?: boolean;\n /** Show time zone selector */\n withZonesList?: boolean;\n /** Show relative range presets */\n withPresets?: boolean;\n /** Custom preset tabs */\n presetTabs?: PresetTab[];\n /** Custom docs for presets, if empty array docs will be hidden */\n docs?: Preset[];\n /** Show selected relative values as absolute dates */\n alwaysShowAsAbsolute?: boolean;\n /** */\n getRangeTitle?: (value: RangeValue<Value | null> | null, timeZone: string) => string;\n /** Handler that is called when the popup's open state changes. */\n onOpenChange?: (open: boolean) => void;\n /** Used to render control. */\n renderControl?: (props: RelativeRangeDatePickerRenderControlProps) => React.ReactElement;\n}\n"]}
|