@flipdish/ui-library 0.61.0 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/__internal__/segmentedInput/SegmentedInputBase.cjs +44 -0
- package/dist/components/__internal__/segmentedInput/SegmentedInputBase.cjs.map +1 -0
- package/dist/components/__internal__/segmentedInput/SegmentedInputBase.d.ts +20 -0
- package/dist/components/__internal__/segmentedInput/SegmentedInputBase.d.ts.map +1 -0
- package/dist/components/__internal__/segmentedInput/SegmentedInputBase.js +42 -0
- package/dist/components/__internal__/segmentedInput/SegmentedInputBase.js.map +1 -0
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.cjs +40 -0
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.cjs.map +1 -0
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.d.ts +29 -0
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.d.ts.map +1 -0
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.js +38 -0
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.js.map +1 -0
- package/dist/components/atoms/Inputs/TimeInput/utilities/timeInput.utils.cjs +14 -0
- package/dist/components/atoms/Inputs/TimeInput/utilities/timeInput.utils.cjs.map +1 -0
- package/dist/components/atoms/Inputs/TimeInput/utilities/timeInput.utils.d.ts +13 -0
- package/dist/components/atoms/Inputs/TimeInput/utilities/timeInput.utils.d.ts.map +1 -0
- package/dist/components/atoms/Inputs/TimeInput/utilities/timeInput.utils.js +12 -0
- package/dist/components/atoms/Inputs/TimeInput/utilities/timeInput.utils.js.map +1 -0
- package/dist/components/atoms/Inputs/index.cjs +2 -0
- package/dist/components/atoms/Inputs/index.cjs.map +1 -1
- package/dist/components/atoms/Inputs/index.d.ts +4 -2
- package/dist/components/atoms/Inputs/index.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/index.js +1 -0
- package/dist/components/atoms/Inputs/index.js.map +1 -1
- package/dist/components/forms/__internal__/dateValue/utilities/dateValue.utils.cjs +43 -0
- package/dist/components/forms/__internal__/dateValue/utilities/dateValue.utils.cjs.map +1 -0
- package/dist/components/forms/__internal__/dateValue/utilities/dateValue.utils.d.ts +38 -0
- package/dist/components/forms/__internal__/dateValue/utilities/dateValue.utils.d.ts.map +1 -0
- package/dist/components/forms/__internal__/dateValue/utilities/dateValue.utils.js +39 -0
- package/dist/components/forms/__internal__/dateValue/utilities/dateValue.utils.js.map +1 -0
- package/dist/components/forms/fields/FormDatePicker/index.cjs +2 -2
- package/dist/components/forms/fields/FormDatePicker/index.cjs.map +1 -1
- package/dist/components/forms/fields/FormDatePicker/index.js +1 -1
- package/dist/components/forms/fields/FormDateRangePicker/index.cjs +35 -0
- package/dist/components/forms/fields/FormDateRangePicker/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormDateRangePicker/index.d.ts +20 -0
- package/dist/components/forms/fields/FormDateRangePicker/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormDateRangePicker/index.js +33 -0
- package/dist/components/forms/fields/FormDateRangePicker/index.js.map +1 -0
- package/dist/components/forms/fields/FormTimeInput/index.cjs +34 -0
- package/dist/components/forms/fields/FormTimeInput/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormTimeInput/index.d.ts +19 -0
- package/dist/components/forms/fields/FormTimeInput/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormTimeInput/index.js +32 -0
- package/dist/components/forms/fields/FormTimeInput/index.js.map +1 -0
- package/dist/components/forms/fields/FormTimeInput/utilities/formTimeInput.utils.cjs +33 -0
- package/dist/components/forms/fields/FormTimeInput/utilities/formTimeInput.utils.cjs.map +1 -0
- package/dist/components/forms/fields/FormTimeInput/utilities/formTimeInput.utils.d.ts +19 -0
- package/dist/components/forms/fields/FormTimeInput/utilities/formTimeInput.utils.d.ts.map +1 -0
- package/dist/components/forms/fields/FormTimeInput/utilities/formTimeInput.utils.js +30 -0
- package/dist/components/forms/fields/FormTimeInput/utilities/formTimeInput.utils.js.map +1 -0
- package/dist/components/forms/validation/index.cjs +103 -14
- package/dist/components/forms/validation/index.cjs.map +1 -1
- package/dist/components/forms/validation/index.d.ts +40 -4
- package/dist/components/forms/validation/index.d.ts.map +1 -1
- package/dist/components/forms/validation/index.js +102 -15
- package/dist/components/forms/validation/index.js.map +1 -1
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.cjs.map +1 -1
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/molecules/Selects/Select/Select.cjs +2 -2
- package/dist/components/molecules/Selects/Select/Select.cjs.map +1 -1
- package/dist/components/molecules/Selects/Select/Select.d.ts.map +1 -1
- package/dist/components/molecules/Selects/Select/Select.js +2 -2
- package/dist/components/molecules/Selects/Select/Select.js.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Combobox.cjs +1 -1
- package/dist/components/molecules/Selects/Select/components/Combobox.cjs.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Combobox.d.ts.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Combobox.js +1 -1
- package/dist/components/molecules/Selects/Select/components/Combobox.js.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/components/Calendar.cjs +2 -2
- package/dist/components/organisms/DatePickers/DatePicker/components/Calendar.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/components/Calendar.js +2 -2
- package/dist/components/organisms/DatePickers/DatePicker/components/Calendar.js.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs +2 -2
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js +2 -2
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/organisms/DatePickers/RangeCalendar/RangeCalendar.cjs +2 -2
- package/dist/components/organisms/DatePickers/RangeCalendar/RangeCalendar.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/RangeCalendar/RangeCalendar.js +2 -2
- package/dist/components/organisms/DatePickers/RangeCalendar/RangeCalendar.js.map +1 -1
- package/dist/localization/en.json.cjs +21 -0
- package/dist/localization/en.json.cjs.map +1 -1
- package/dist/localization/en.json.js +19 -1
- package/dist/localization/en.json.js.map +1 -1
- package/dist/native/components/forms/fields/FormDateRangePicker/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormTimeInput/index.d.ts +12 -0
- package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.d.ts +1 -1
- package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.d.ts.map +1 -1
- package/package.json +3 -1
- package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.cjs +0 -23
- package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.cjs.map +0 -1
- package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.d.ts +0 -9
- package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.d.ts.map +0 -1
- package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.js +0 -21
- package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.js.map +0 -1
- package/dist/components/organisms/DatePickers/components/InputDate.cjs +0 -59
- package/dist/components/organisms/DatePickers/components/InputDate.cjs.map +0 -1
- package/dist/components/organisms/DatePickers/components/InputDate.d.ts +0 -50
- package/dist/components/organisms/DatePickers/components/InputDate.d.ts.map +0 -1
- package/dist/components/organisms/DatePickers/components/InputDate.js +0 -57
- package/dist/components/organisms/DatePickers/components/InputDate.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InputDate.cjs","sources":["../../../../../src/components/organisms/DatePickers/components/InputDate.tsx"],"sourcesContent":[null],"names":["createContext","useHotkeyHint","useContext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 'react';
|
|
2
|
-
import type { DateInputProps as AriaDateInputProps } from 'react-aria-components';
|
|
3
|
-
import { type DateFieldProps as AriaDateFieldProps, type DateValue } from 'react-aria-components';
|
|
4
|
-
export interface InputDateBaseProps extends Omit<AriaDateInputProps, 'children'> {
|
|
5
|
-
/** Tooltip message on hover. */
|
|
6
|
-
tooltip?: string;
|
|
7
|
-
/**
|
|
8
|
-
* Input size.
|
|
9
|
-
* @default "sm"
|
|
10
|
-
*/
|
|
11
|
-
size?: 'sm' | 'md' | 'lg';
|
|
12
|
-
/** Placeholder text. */
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
/** Class name for the icon. */
|
|
15
|
-
iconClassName?: string;
|
|
16
|
-
/** Class name for the input wrapper. */
|
|
17
|
-
wrapperClassName?: string;
|
|
18
|
-
/** Class name for the tooltip. */
|
|
19
|
-
tooltipClassName?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Keyboard shortcut to display. `true` shows the search shortcut (⌘K on macOS, Ctrl K elsewhere). A
|
|
22
|
-
* shortcut (`⌘J`, `mod+j`, `Ctrl+J`) is drawn for the user's platform; text that is not a shortcut is shown
|
|
23
|
-
* as written.
|
|
24
|
-
*/
|
|
25
|
-
shortcut?: string | boolean;
|
|
26
|
-
/** Ref forwarded to the date input inside the group. */
|
|
27
|
-
ref?: Ref<HTMLInputElement>;
|
|
28
|
-
/** Ref attached to the wrapping group that draws the border and icons. */
|
|
29
|
-
groupRef?: Ref<HTMLDivElement>;
|
|
30
|
-
/** Icon component to display on the left side of the input. */
|
|
31
|
-
icon?: ComponentType<HTMLAttributes<HTMLOrSVGElement>>;
|
|
32
|
-
/** Draws the error ring and shows the error icon in place of the tooltip trigger. */
|
|
33
|
-
isInvalid?: boolean;
|
|
34
|
-
/** Dims the input and blocks editing. */
|
|
35
|
-
isDisabled?: boolean;
|
|
36
|
-
}
|
|
37
|
-
export declare const InputDateBase: ({ tooltip, shortcut, groupRef, size, isInvalid, isDisabled, icon: Icon, wrapperClassName, tooltipClassName, iconClassName, ...inputProps }: Omit<InputDateBaseProps, "label" | "hint">) => import("react").JSX.Element;
|
|
38
|
-
interface InputProps extends AriaDateFieldProps<DateValue>, Pick<InputDateBaseProps, 'ref' | 'size' | 'placeholder' | 'icon' | 'shortcut' | 'tooltip' | 'groupRef' | 'iconClassName' | 'wrapperClassName' | 'tooltipClassName'> {
|
|
39
|
-
/** Label text for the input */
|
|
40
|
-
label?: string;
|
|
41
|
-
/** Helper text displayed below the input */
|
|
42
|
-
hint?: ReactNode;
|
|
43
|
-
/** Whether to hide required indicator from label */
|
|
44
|
-
hideRequiredIndicator?: boolean;
|
|
45
|
-
/** Class name for the input. */
|
|
46
|
-
inputClassName?: string;
|
|
47
|
-
}
|
|
48
|
-
export declare const InputDate: ({ size, placeholder, icon: Icon, label, hint, shortcut, hideRequiredIndicator, className, ref, groupRef, tooltip, iconClassName, inputClassName, wrapperClassName, tooltipClassName, ...props }: InputProps) => import("react").JSX.Element;
|
|
49
|
-
export {};
|
|
50
|
-
//# sourceMappingURL=InputDate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InputDate.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/DatePickers/components/InputDate.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,aAAa,EAAiB,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAc,MAAM,OAAO,CAAC;AACrH,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAEL,KAAK,cAAc,IAAI,kBAAkB,EAIzC,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAW/B,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC;IAC9E,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GA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 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { HelpCircle, InfoCircle } from '@flipdish/ui-icons';
|
|
3
|
-
import '@flipdish/ui-library/components/atoms/Inputs';
|
|
4
|
-
import { Tooltip, TooltipTrigger } from '@flipdish/ui-library/components/atoms/Tooltip';
|
|
5
|
-
import { sortCx, cx } from '@flipdish/ui-library/utilities/cx';
|
|
6
|
-
import { useTestIdPrefix, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
7
|
-
import { createContext, useContext } from 'react';
|
|
8
|
-
import { Group, DateInput, DateSegment } from 'react-aria-components';
|
|
9
|
-
import { useHotkeyHint } from '../../../../hooks/__internal__/useHotkeyHint/useHotkeyHint.js';
|
|
10
|
-
|
|
11
|
-
const DateFieldContext = createContext({});
|
|
12
|
-
const InputDateBase = ({ tooltip, shortcut, groupRef, size = 'md', isInvalid, isDisabled, icon: Icon, wrapperClassName, tooltipClassName, iconClassName, ...inputProps }) => {
|
|
13
|
-
const shortcutLabel = useHotkeyHint(shortcut === true ? 'mod+k' : shortcut || null);
|
|
14
|
-
// Check if the input has a leading icon or tooltip
|
|
15
|
-
const hasTrailingIcon = tooltip || isInvalid;
|
|
16
|
-
const hasLeadingIcon = Icon;
|
|
17
|
-
// If the input is inside a `TextFieldContext`, use its context to simplify applying styles
|
|
18
|
-
const context = useContext(DateFieldContext);
|
|
19
|
-
const inputSize = context?.size || size;
|
|
20
|
-
const prefix = useTestIdPrefix();
|
|
21
|
-
const slot = typeof inputProps.slot === 'string' ? inputProps.slot : undefined;
|
|
22
|
-
const inputTestId = prefix ? joinTestId(prefix, slot ? `input-${slot}` : 'input') : undefined;
|
|
23
|
-
const sizes = sortCx({
|
|
24
|
-
sm: {
|
|
25
|
-
root: cx('px-3 py-2 text-sm', hasTrailingIcon && 'pr-9', hasLeadingIcon && 'pl-8.5'),
|
|
26
|
-
iconLeading: 'left-3 size-4 stroke-[2.25px]',
|
|
27
|
-
iconTrailing: 'right-3',
|
|
28
|
-
shortcut: 'pr-2.5',
|
|
29
|
-
},
|
|
30
|
-
md: {
|
|
31
|
-
root: cx('px-3 py-2 text-md', hasTrailingIcon && 'pr-9', hasLeadingIcon && 'pl-10'),
|
|
32
|
-
iconLeading: 'left-3 size-5',
|
|
33
|
-
iconTrailing: 'right-3',
|
|
34
|
-
shortcut: 'pr-2.5',
|
|
35
|
-
},
|
|
36
|
-
lg: {
|
|
37
|
-
root: cx('px-3.5 py-2.5 text-md', hasTrailingIcon && 'pr-9.5', hasLeadingIcon && 'pl-10.5'),
|
|
38
|
-
iconLeading: 'left-3.5 size-5',
|
|
39
|
-
iconTrailing: 'right-3.5',
|
|
40
|
-
shortcut: 'pr-3',
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
return (jsxs(Group, { isDisabled, isInvalid, ref: groupRef, "data-testid": inputTestId, className: ({ isFocusWithin, isDisabled, isInvalid }) => cx('group/input relative flex w-full flex-row place-content-center place-items-center rounded-lg bg-primary shadow-xs ring-1 ring-primary transition-shadow duration-100 ease-linear ring-inset', isFocusWithin && !isDisabled && 'ring-2 ring-brand',
|
|
44
|
-
// Disabled state styles
|
|
45
|
-
isDisabled && 'cursor-not-allowed opacity-50 in-data-input-wrapper:opacity-100', 'group-disabled:cursor-not-allowed group-disabled:opacity-50 in-data-input-wrapper:group-disabled:opacity-100',
|
|
46
|
-
// Invalid state styles
|
|
47
|
-
isInvalid && 'ring-error_subtle', 'group-invalid:ring-error_subtle',
|
|
48
|
-
// Invalid state with focus-within styles
|
|
49
|
-
isInvalid && isFocusWithin && 'ring-2 ring-error', isFocusWithin && 'group-invalid:ring-2 group-invalid:ring-error', context?.wrapperClassName, wrapperClassName), children: [Icon && (jsx(Icon, { className: cx('pointer-events-none absolute text-fg-quaternary', sizes[inputSize].iconLeading, context?.iconClassName, iconClassName) })), jsx(DateInput, { ...inputProps, className: cx('flex w-full', sizes[size].root, typeof inputProps.className === 'string' && inputProps.className), children: (segment) => (jsx(DateSegment, { segment: segment, className: cx('rounded px-0.5 text-primary tabular-nums caret-transparent focus:bg-brand-solid focus:font-medium focus:text-white focus:outline-hidden',
|
|
50
|
-
// The placeholder segment.
|
|
51
|
-
segment.isPlaceholder && 'text-placeholder uppercase',
|
|
52
|
-
// The separator "/" segment.
|
|
53
|
-
segment.type === 'literal' && 'text-fg-quaternary') })) }), tooltip && (jsx(Tooltip, { title: tooltip, placement: "top", children: jsx(TooltipTrigger, { className: cx('absolute cursor-pointer text-fg-quaternary transition duration-200 group-invalid/input:hidden hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover', sizes[inputSize].iconTrailing, context?.tooltipClassName, tooltipClassName), children: jsx(HelpCircle, { className: "size-4 stroke-[2.25px]" }) }) })), jsx(InfoCircle, { className: cx('pointer-events-none absolute hidden size-4 stroke-[2.25px] text-fg-error-secondary group-invalid/input:block', sizes[inputSize].iconTrailing, context?.tooltipClassName, tooltipClassName) }), shortcut && (jsx("div", { className: cx('pointer-events-none absolute inset-y-0.5 right-0.5 z-10 flex items-center rounded-r-[inherit] bg-linear-to-r from-transparent to-bg-primary to-40% pl-8', sizes[inputSize].shortcut), children: jsx("span", { "aria-hidden": "true", className: "pointer-events-none rounded px-1 py-px text-xs font-medium text-quaternary ring-1 ring-secondary select-none ring-inset", children: shortcutLabel }) }))] }));
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export { InputDateBase };
|
|
57
|
-
//# sourceMappingURL=InputDate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InputDate.js","sources":["../../../../../src/components/organisms/DatePickers/components/InputDate.tsx"],"sourcesContent":[null],"names":["_jsxs","AriaGroup","_jsx","AriaDateInput","AriaDateSegment"],"mappings":";;;;;;;;;;AAmBA,MAAM,gBAAgB,GAAG,aAAa,CAMnC,EAAE,CAAC;AAoCC,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,IAAI,GAAG,IAA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