@wallarm-org/design-system 0.11.0 → 0.12.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/Calendar/Calendar.d.ts +75 -0
- package/dist/components/Calendar/Calendar.figma.d.ts +1 -0
- package/dist/components/Calendar/Calendar.figma.js +324 -0
- package/dist/components/Calendar/Calendar.js +187 -0
- package/dist/components/Calendar/CalendarApplyButton.d.ts +10 -0
- package/dist/components/Calendar/CalendarApplyButton.js +20 -0
- package/dist/components/Calendar/CalendarBody.d.ts +12 -0
- package/dist/components/Calendar/CalendarBody.js +10 -0
- package/dist/components/Calendar/CalendarContent.d.ts +12 -0
- package/dist/components/Calendar/CalendarContent.js +15 -0
- package/dist/components/Calendar/CalendarContext.d.ts +27 -0
- package/dist/components/Calendar/CalendarContext.js +17 -0
- package/dist/components/Calendar/CalendarDayName.d.ts +6 -0
- package/dist/components/Calendar/CalendarDayName.js +8 -0
- package/dist/components/Calendar/CalendarFooter.d.ts +19 -0
- package/dist/components/Calendar/CalendarFooter.js +10 -0
- package/dist/components/Calendar/CalendarFooterControls.d.ts +12 -0
- package/dist/components/Calendar/CalendarFooterControls.js +10 -0
- package/dist/components/Calendar/CalendarGrid.d.ts +16 -0
- package/dist/components/Calendar/CalendarGrid.js +117 -0
- package/dist/components/Calendar/CalendarGrids.d.ts +10 -0
- package/dist/components/Calendar/CalendarGrids.js +25 -0
- package/dist/components/Calendar/CalendarHeader.d.ts +20 -0
- package/dist/components/Calendar/CalendarHeader.js +140 -0
- package/dist/components/Calendar/CalendarInputHeader.d.ts +12 -0
- package/dist/components/Calendar/CalendarInputHeader.js +117 -0
- package/dist/components/Calendar/CalendarKeyboardHints.d.ts +9 -0
- package/dist/components/Calendar/CalendarKeyboardHints.js +63 -0
- package/dist/components/Calendar/CalendarPresetItem.d.ts +18 -0
- package/dist/components/Calendar/CalendarPresetItem.js +32 -0
- package/dist/components/Calendar/CalendarPresets.d.ts +33 -0
- package/dist/components/Calendar/CalendarPresets.js +66 -0
- package/dist/components/Calendar/CalendarResetButton.d.ts +10 -0
- package/dist/components/Calendar/CalendarResetButton.js +20 -0
- package/dist/components/Calendar/CalendarTrigger.d.ts +12 -0
- package/dist/components/Calendar/CalendarTrigger.js +12 -0
- package/dist/components/Calendar/const.d.ts +2 -0
- package/dist/components/Calendar/const.js +24 -0
- package/dist/components/Calendar/index.d.ts +19 -0
- package/dist/components/Calendar/index.js +19 -0
- package/dist/components/Calendar/types.d.ts +10 -0
- package/dist/components/Calendar/types.js +0 -0
- package/dist/components/DateInput/DateInput.d.ts +22 -0
- package/dist/components/DateInput/DateInput.js +54 -0
- package/dist/components/DateInput/DateInputInternal.d.ts +7 -0
- package/dist/components/DateInput/DateInputInternal.js +100 -0
- package/dist/components/DateInput/index.d.ts +3 -0
- package/dist/components/DateInput/index.js +3 -0
- package/dist/components/DateInput/types.d.ts +22 -0
- package/dist/components/DateInput/types.js +0 -0
- package/dist/components/DateRangeInput/DateRangeClear.d.ts +2 -0
- package/dist/components/DateRangeInput/DateRangeClear.js +16 -0
- package/dist/components/DateRangeInput/DateRangeContext/DateRangeProvider.d.ts +24 -0
- package/dist/components/DateRangeInput/DateRangeContext/DateRangeProvider.js +68 -0
- package/dist/components/DateRangeInput/DateRangeContext/context.d.ts +2 -0
- package/dist/components/DateRangeInput/DateRangeContext/context.js +3 -0
- package/dist/components/DateRangeInput/DateRangeContext/index.d.ts +3 -0
- package/dist/components/DateRangeInput/DateRangeContext/index.js +3 -0
- package/dist/components/DateRangeInput/DateRangeContext/types.d.ts +24 -0
- package/dist/components/DateRangeInput/DateRangeContext/types.js +0 -0
- package/dist/components/DateRangeInput/DateRangeContext/useDateRangeContext.d.ts +23 -0
- package/dist/components/DateRangeInput/DateRangeContext/useDateRangeContext.js +4 -0
- package/dist/components/DateRangeInput/DateRangeEnd.d.ts +2 -0
- package/dist/components/DateRangeInput/DateRangeEnd.js +30 -0
- package/dist/components/DateRangeInput/DateRangeEndValue.d.ts +16 -0
- package/dist/components/DateRangeInput/DateRangeEndValue.js +14 -0
- package/dist/components/DateRangeInput/DateRangeGroup.d.ts +6 -0
- package/dist/components/DateRangeInput/DateRangeGroup.js +20 -0
- package/dist/components/DateRangeInput/DateRangeInput.d.ts +30 -0
- package/dist/components/DateRangeInput/DateRangeInput.js +14 -0
- package/dist/components/DateRangeInput/DateRangeInputInternal.d.ts +4 -0
- package/dist/components/DateRangeInput/DateRangeInputInternal.js +64 -0
- package/dist/components/DateRangeInput/DateRangeSegment.d.ts +7 -0
- package/dist/components/DateRangeInput/DateRangeSegment.js +11 -0
- package/dist/components/DateRangeInput/DateRangeSegmentGroup.d.ts +7 -0
- package/dist/components/DateRangeInput/DateRangeSegmentGroup.js +123 -0
- package/dist/components/DateRangeInput/DateRangeSeparator.d.ts +13 -0
- package/dist/components/DateRangeInput/DateRangeSeparator.js +12 -0
- package/dist/components/DateRangeInput/DateRangeStart.d.ts +2 -0
- package/dist/components/DateRangeInput/DateRangeStart.js +30 -0
- package/dist/components/DateRangeInput/DateRangeStartValue.d.ts +16 -0
- package/dist/components/DateRangeInput/DateRangeStartValue.js +14 -0
- package/dist/components/DateRangeInput/index.d.ts +6 -0
- package/dist/components/DateRangeInput/index.js +6 -0
- package/dist/components/DateRangeInput/types.d.ts +38 -0
- package/dist/components/DateRangeInput/types.js +0 -0
- package/dist/components/DropdownMenu/DropdownMenuInput.js +3 -4
- package/dist/components/Flex/Flex.d.ts +1 -1
- package/dist/components/Input/Input.js +4 -2
- package/dist/components/Input/classes.js +4 -12
- package/dist/components/InputGroup/InputGroup.js +1 -1
- package/dist/components/InputGroup/InputGroupAddon.js +1 -1
- package/dist/components/InputGroup/InputGroupInput.d.ts +1 -4
- package/dist/components/InputGroup/InputGroupInput.js +0 -15
- package/dist/components/InputGroup/index.d.ts +0 -1
- package/dist/components/InputGroup/index.js +1 -2
- package/dist/components/SegmentedControl/SegmentedControlSeparator.d.ts +1 -1
- package/dist/components/Select/SelectSearchInput.js +3 -2
- package/dist/components/Separator/Separator.d.ts +1 -1
- package/dist/components/Stack/Stack.d.ts +1 -1
- package/dist/components/TemporalCore/TemporalClear.d.ts +7 -0
- package/dist/components/TemporalCore/TemporalClear.js +12 -0
- package/dist/components/TemporalCore/TemporalPlaceholder.d.ts +10 -0
- package/dist/components/TemporalCore/TemporalPlaceholder.js +8 -0
- package/dist/components/TemporalCore/TemporalSegment.d.ts +12 -0
- package/dist/components/TemporalCore/TemporalSegment.js +55 -0
- package/dist/components/TemporalCore/TemporalSegmentGroup.d.ts +10 -0
- package/dist/components/TemporalCore/TemporalSegmentGroup.js +96 -0
- package/dist/components/TemporalCore/TimeDropdown.d.ts +24 -0
- package/dist/components/TemporalCore/TimeDropdown.js +172 -0
- package/dist/components/TemporalCore/index.d.ts +7 -0
- package/dist/components/TemporalCore/index.js +8 -0
- package/dist/components/TemporalCore/useTemporalField.d.ts +10 -0
- package/dist/components/TemporalCore/useTemporalField.js +16 -0
- package/dist/components/TemporalCore/useTimeDropdownKeyCapture.d.ts +16 -0
- package/dist/components/TemporalCore/useTimeDropdownKeyCapture.js +53 -0
- package/dist/components/TemporalCore/utils.d.ts +2 -0
- package/dist/components/TemporalCore/utils.js +11 -0
- package/dist/components/TimeInput/TimeInput.d.ts +20 -0
- package/dist/components/TimeInput/TimeInput.js +50 -0
- package/dist/components/TimeInput/index.d.ts +1 -0
- package/dist/components/TimeInput/index.js +2 -0
- package/dist/icons/Calendar.d.ts +3 -0
- package/dist/icons/Calendar.js +12 -0
- package/dist/icons/CalendarCheck.d.ts +3 -0
- package/dist/icons/CalendarCheck.js +12 -0
- package/dist/icons/CalendarCheck2.d.ts +3 -0
- package/dist/icons/CalendarCheck2.js +12 -0
- package/dist/icons/CalendarClock.d.ts +3 -0
- package/dist/icons/CalendarClock.js +12 -0
- package/dist/icons/CalendarCog.d.ts +3 -0
- package/dist/icons/CalendarCog.js +12 -0
- package/dist/icons/CalendarDays.d.ts +3 -0
- package/dist/icons/CalendarDays.js +12 -0
- package/dist/icons/CalendarFold.d.ts +3 -0
- package/dist/icons/CalendarFold.js +12 -0
- package/dist/icons/CalendarHeart.d.ts +3 -0
- package/dist/icons/CalendarHeart.js +12 -0
- package/dist/icons/CalendarMinus.d.ts +3 -0
- package/dist/icons/CalendarMinus.js +12 -0
- package/dist/icons/CalendarMinus2.d.ts +3 -0
- package/dist/icons/CalendarMinus2.js +12 -0
- package/dist/icons/CalendarOff.d.ts +3 -0
- package/dist/icons/CalendarOff.js +12 -0
- package/dist/icons/CalendarPlus.d.ts +3 -0
- package/dist/icons/CalendarPlus.js +12 -0
- package/dist/icons/CalendarPlus2.d.ts +3 -0
- package/dist/icons/CalendarPlus2.js +12 -0
- package/dist/icons/CalendarRange.d.ts +3 -0
- package/dist/icons/CalendarRange.js +12 -0
- package/dist/icons/CalendarSearch.d.ts +3 -0
- package/dist/icons/CalendarSearch.js +12 -0
- package/dist/icons/CalendarX.d.ts +3 -0
- package/dist/icons/CalendarX.js +12 -0
- package/dist/icons/CalendarX2.d.ts +3 -0
- package/dist/icons/CalendarX2.js +12 -0
- package/dist/icons/Clock.d.ts +3 -0
- package/dist/icons/Clock.js +12 -0
- package/dist/icons/Copy.js +5 -5
- package/dist/icons/CornerUpLeft.d.ts +3 -0
- package/dist/icons/CornerUpLeft.js +12 -0
- package/dist/icons/CornerUpRight.d.ts +3 -0
- package/dist/icons/CornerUpRight.js +12 -0
- package/dist/icons/GripVertical.js +18 -11
- package/dist/icons/MoveDown.js +2 -2
- package/dist/icons/MoveUp.js +2 -2
- package/dist/icons/Pin.js +1 -1
- package/dist/icons/PinOff.js +3 -3
- package/dist/icons/Settings.js +7 -5
- package/dist/icons/index.d.ts +20 -7
- package/dist/icons/index.js +21 -8
- package/dist/index.d.ts +5 -1
- package/dist/index.js +6 -2
- package/dist/metadata/components.json +1595 -227
- package/package.json +7 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { DateValue } from '@react-aria/datepicker';
|
|
3
|
+
import type { RangeValue } from '@react-types/shared';
|
|
4
|
+
import type { SvgIconProps } from '../../icons';
|
|
5
|
+
export interface DateRangeBaseProps {
|
|
6
|
+
/** Optional icon component to display at the start of the input */
|
|
7
|
+
icon?: FC<SvgIconProps>;
|
|
8
|
+
/** Whether the input has an error state. Shows error styling when true */
|
|
9
|
+
error?: boolean;
|
|
10
|
+
/** Whether the input is disabled. Prevents user interaction when true */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Whether the input is read-only. Displays value but prevents editing */
|
|
13
|
+
readOnly?: boolean;
|
|
14
|
+
/** Placeholder text to show when no value is selected */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** Show dropdown for time selection with arrow navigation */
|
|
17
|
+
showTimeDropdown?: boolean;
|
|
18
|
+
/** Time interval in minutes for dropdown options. Default: 30 */
|
|
19
|
+
timeStep?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface DateRangeInputProps extends DateRangeBaseProps {
|
|
22
|
+
/** Controlled value - range with start and end dates */
|
|
23
|
+
value?: RangeValue<DateValue> | null;
|
|
24
|
+
/** Default value for uncontrolled mode */
|
|
25
|
+
defaultValue?: RangeValue<DateValue> | null;
|
|
26
|
+
/** Callback fired when the range value changes */
|
|
27
|
+
onChange?: (value: RangeValue<DateValue> | null) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Determines the smallest unit of time that can be edited.
|
|
30
|
+
* - 'day': Date only (default)
|
|
31
|
+
* - 'hour': Date with hours
|
|
32
|
+
* - 'minute': Date with hours and minutes
|
|
33
|
+
* - 'second': Date with hours, minutes, and seconds
|
|
34
|
+
*/
|
|
35
|
+
granularity?: 'day' | 'hour' | 'minute' | 'second';
|
|
36
|
+
/** Hour cycle for time display: 12-hour or 24-hour format */
|
|
37
|
+
hourCycle?: 12 | 24;
|
|
38
|
+
}
|
|
File without changes
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Search } from "../../icons/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { InputGroupAddon } from "../InputGroup/
|
|
5
|
-
import { InputGroupInput } from "../InputGroup/InputGroupInput.js";
|
|
3
|
+
import { Input } from "../Input/index.js";
|
|
4
|
+
import { InputGroup, InputGroupAddon } from "../InputGroup/index.js";
|
|
6
5
|
const DropdownMenuInput = (props)=>/*#__PURE__*/ jsx("div", {
|
|
7
6
|
className: "mb-4",
|
|
8
7
|
children: /*#__PURE__*/ jsxs(InputGroup, {
|
|
@@ -10,7 +9,7 @@ const DropdownMenuInput = (props)=>/*#__PURE__*/ jsx("div", {
|
|
|
10
9
|
/*#__PURE__*/ jsx(InputGroupAddon, {
|
|
11
10
|
children: /*#__PURE__*/ jsx(Search, {})
|
|
12
11
|
}),
|
|
13
|
-
/*#__PURE__*/ jsx(
|
|
12
|
+
/*#__PURE__*/ jsx(Input, {
|
|
14
13
|
type: "text",
|
|
15
14
|
...props
|
|
16
15
|
})
|
|
@@ -7,7 +7,7 @@ declare const flexVariants: (props?: ({
|
|
|
7
7
|
align?: "end" | "baseline" | "start" | "center" | "stretch" | null | undefined;
|
|
8
8
|
justify?: "end" | "start" | "center" | "between" | "around" | "evenly" | null | undefined;
|
|
9
9
|
wrap?: "reverse" | "wrap" | "nowrap" | null | undefined;
|
|
10
|
-
gap?: 1 | 2 | 4 | 6 | 8 | 12 | 16 |
|
|
10
|
+
gap?: 1 | 2 | 4 | 6 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | 40 | 44 | 48 | 56 | 64 | 80 | 96 | 112 | 128 | 144 | null | undefined;
|
|
11
11
|
grow?: boolean | null | undefined;
|
|
12
12
|
shrink?: boolean | null | undefined;
|
|
13
13
|
fullWidth?: boolean | null | undefined;
|
|
@@ -3,7 +3,7 @@ import { useFieldContext } from "@ark-ui/react/field";
|
|
|
3
3
|
import { mergeProps } from "@ark-ui/react/utils";
|
|
4
4
|
import { cn } from "../../utils/cn.js";
|
|
5
5
|
import { inputVariants } from "./classes.js";
|
|
6
|
-
const Input = ({ className, error = false, disabled = false, ...props })=>{
|
|
6
|
+
const Input = ({ className, error = false, disabled = false, ref, ...props })=>{
|
|
7
7
|
const field = useFieldContext();
|
|
8
8
|
const mergedProps = mergeProps(field?.getInputProps(), props);
|
|
9
9
|
return /*#__PURE__*/ jsx("input", {
|
|
@@ -14,7 +14,9 @@ const Input = ({ className, error = false, disabled = false, ...props })=>{
|
|
|
14
14
|
}), className),
|
|
15
15
|
disabled: disabled,
|
|
16
16
|
"aria-invalid": Boolean(error),
|
|
17
|
-
"aria-disabled": disabled
|
|
17
|
+
"aria-disabled": disabled,
|
|
18
|
+
ref: ref,
|
|
19
|
+
"data-slot": "input"
|
|
18
20
|
});
|
|
19
21
|
};
|
|
20
22
|
Input.displayName = 'Input';
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
'font-sans text-sm text-text-primary placeholder:text-text-secondary',
|
|
5
|
-
'shadow-xs transition-[color,border,box-shadow]',
|
|
6
|
-
'focus-visible:outline-none focus-visible:ring-3',
|
|
7
|
-
'disabled:cursor-not-allowed disabled:opacity-50'
|
|
8
|
-
], {
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
const inputVariants = cva(cn('flex w-full px-12 rounded-8 border bg-component-input-bg', 'font-sans text-sm text-text-primary placeholder:text-text-secondary', 'shadow-xs transition-[color,border,box-shadow]', 'focus-visible:outline-none focus-visible:ring-3', 'disabled:aria-disabled:cursor-not-allowed disabled:aria-disabled:opacity-50'), {
|
|
9
4
|
variants: {
|
|
10
5
|
error: {
|
|
11
|
-
true: 'border-border-strong-danger hover:not-disabled:border-border-strong-danger hover:not-disabled:outline-none hover:not-disabled:ring-3 hover:not-disabled:ring-focus-destructive-hover focus-visible:ring-focus-destructive',
|
|
12
|
-
false:
|
|
13
|
-
'border-border-primary hover:not-disabled:border-component-border-input-hover',
|
|
14
|
-
'focus-visible:not-disabled:border-border-strong-primary focus-visible:ring-focus-primary'
|
|
15
|
-
]
|
|
6
|
+
true: cn('border-border-strong-danger', 'hover:not-disabled:border-border-strong-danger', 'hover:not-disabled:outline-none', 'hover:not-disabled:ring-3', 'hover:not-disabled:ring-focus-destructive-hover', 'focus-visible:ring-focus-destructive'),
|
|
7
|
+
false: cn('border-border-primary', 'hover:not-disabled:border-component-border-input-hover', 'focus-visible:not-disabled:border-border-strong-primary', 'focus-visible:ring-focus-primary')
|
|
16
8
|
}
|
|
17
9
|
}
|
|
18
10
|
});
|
|
@@ -7,7 +7,7 @@ const InputGroup = ({ 'data-testid': testId, ...props })=>/*#__PURE__*/ jsx(Test
|
|
|
7
7
|
"data-slot": "input-group",
|
|
8
8
|
"data-testid": testId,
|
|
9
9
|
role: "group",
|
|
10
|
-
className: cn('group/input-group', 'w-full h-36 has-[>textarea]:h-auto', 'flex items-center border rounded-8 bg-component-input-bg relative', 'border border-border-primary outline-none shadow-xs transition-[color,border,box-shadow]', 'has-[[data-slot=input
|
|
10
|
+
className: cn('group/input-group', 'w-full h-36 has-[>textarea]:h-auto', 'flex items-center border rounded-8 bg-component-input-bg relative', '**:data-[slot=input]:flex-1', '**:data-[slot=input]:rounded-none', '**:data-[slot=input]:border-0', '**:data-[slot=input]:bg-transparent', '**:data-[slot=input]:shadow-none', '**:data-[slot=input]:focus-visible:ring-0', '**:data-[slot=input]:focus-within:ring-0', 'border border-border-primary outline-none shadow-xs transition-[color,border,box-shadow]', 'has-[[data-slot=input]:not(:disabled):not([aria-disabled=true]):not(:focus-visible)]:hover:border-component-border-input-hover', 'focus-visible:ring-focus-primary', 'has-[[data-slot=input]:focus-visible]:ring-3', 'has-[[data-slot=input]:focus-visible]:ring-focus-primary', 'has-[[data-slot=input]:focus-visible]:border-border-strong-primary', 'focus-within:ring-focus-primary', 'has-[[data-slot=input]:focus-within]:ring-3', 'has-[[data-slot=input]:focus-within]:ring-focus-primary', 'has-[[data-slot=input]:focus-within]:border-border-strong-primary', 'has-[[data-slot][aria-invalid=true]]:border-border-strong-danger', 'has-[[data-slot][aria-invalid=true]]:ring-focus-destructive', 'has-[[data-slot][aria-invalid=true]:not(:disabled):not([aria-disabled=true])]:hover:border-border-strong-danger', 'has-[[data-slot][aria-invalid=true]:not(:disabled):not([aria-disabled=true])]:hover:ring-3', 'has-[[data-slot][aria-invalid=true]:not(:disabled):not([aria-disabled=true])]:hover:ring-focus-destructive-hover', 'has-[[data-slot][aria-invalid=true]:not(:disabled):not([aria-disabled=true])]:*:data-[slot=input]:hover:ring-0', 'has-[[data-slot=input]:disabled]:opacity-50', 'has-[[data-slot=input][aria-disabled=true]]:opacity-50', 'has-[[data-slot=input]:disabled]:cursor-not-allowed', 'has-[[data-slot=input][aria-disabled=true]]:cursor-not-allowed'),
|
|
11
11
|
...props
|
|
12
12
|
})
|
|
13
13
|
});
|
|
@@ -21,7 +21,7 @@ const inputGroupAddonVariants = cva(cn([
|
|
|
21
21
|
},
|
|
22
22
|
variant: {
|
|
23
23
|
outline: 'px-12 bg-states-primary-default-alt border-border-primary',
|
|
24
|
-
ghost: '[&:not(:has([data-scope=select]))+input]:px-0'
|
|
24
|
+
ghost: '[&:not(:has([data-scope=select]))+[data-slot=input]]:px-0'
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
defaultVariants: {
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from "../../utils/cn.js";
|
|
3
|
-
import { useTestId } from "../../utils/testId.js";
|
|
4
|
-
import { Input } from "../Input/index.js";
|
|
5
|
-
const InputGroupInput = (props)=>{
|
|
6
|
-
const testId = useTestId('input');
|
|
7
|
-
return /*#__PURE__*/ jsx(Input, {
|
|
8
|
-
...props,
|
|
9
|
-
className: cn('flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0'),
|
|
10
|
-
"data-slot": "input-group-control",
|
|
11
|
-
"data-testid": testId
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
InputGroupInput.displayName = 'InputGroupInput';
|
|
15
|
-
export { InputGroupInput };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InputGroup } from "./InputGroup.js";
|
|
2
2
|
import { InputGroupAddon } from "./InputGroupAddon.js";
|
|
3
|
-
import { InputGroupInput } from "./InputGroupInput.js";
|
|
4
3
|
import { InputGroupText } from "./InputGroupText.js";
|
|
5
|
-
export { InputGroup, InputGroupAddon,
|
|
4
|
+
export { InputGroup, InputGroupAddon, InputGroupText };
|
|
@@ -2,7 +2,7 @@ import type { ComponentRef, FC, Ref } from 'react';
|
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
import { Separator, type SeparatorProps } from '../Separator';
|
|
4
4
|
declare const segmentedControlSeparatorVariants: (props?: ({
|
|
5
|
-
mx?: 1 | 2 | 4 | 6 | 8 | 12 | 16 |
|
|
5
|
+
mx?: 1 | 2 | 4 | 6 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | 40 | 44 | 48 | 56 | 64 | 80 | 96 | 112 | 128 | 144 | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
type SegmentedControlSeparatorVariants = VariantProps<typeof segmentedControlSeparatorVariants>;
|
|
8
8
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Search } from "../../icons/index.js";
|
|
3
3
|
import { useTestId } from "../../utils/testId.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Input } from "../Input/index.js";
|
|
5
|
+
import { InputGroup, InputGroupAddon } from "../InputGroup/index.js";
|
|
5
6
|
const SelectSearchInput = ({ value, onChange })=>{
|
|
6
7
|
const testId = useTestId('search-input');
|
|
7
8
|
const handleChange = (event)=>{
|
|
@@ -13,7 +14,7 @@ const SelectSearchInput = ({ value, onChange })=>{
|
|
|
13
14
|
/*#__PURE__*/ jsx(InputGroupAddon, {
|
|
14
15
|
children: /*#__PURE__*/ jsx(Search, {})
|
|
15
16
|
}),
|
|
16
|
-
/*#__PURE__*/ jsx(
|
|
17
|
+
/*#__PURE__*/ jsx(Input, {
|
|
17
18
|
placeholder: "Search",
|
|
18
19
|
value: value,
|
|
19
20
|
onChange: handleChange
|
|
@@ -3,7 +3,7 @@ import { type VariantProps } from 'class-variance-authority';
|
|
|
3
3
|
import type { TestableProps } from '../../utils/testId';
|
|
4
4
|
declare const separatorVariants: (props?: ({
|
|
5
5
|
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
6
|
-
spacing?: 1 | 2 | 4 | 6 | 8 | 12 | 16 |
|
|
6
|
+
spacing?: 1 | 2 | 4 | 6 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | 40 | 44 | 48 | 56 | 64 | 80 | 96 | 112 | 128 | 144 | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
export type SeparatorProps = ComponentPropsWithoutRef<'div'> & VariantProps<typeof separatorVariants> & TestableProps & {
|
|
9
9
|
ref?: Ref<HTMLDivElement>;
|
|
@@ -10,7 +10,7 @@ declare const stackVariants: (props?: ({
|
|
|
10
10
|
fullWidth?: boolean | null | undefined;
|
|
11
11
|
flexGrow?: boolean | null | undefined;
|
|
12
12
|
flexShrink?: boolean | null | undefined;
|
|
13
|
-
gap?: 0 | 1 | 2 | 4 | 6 | 8 | 12 | 16 |
|
|
13
|
+
gap?: 0 | 1 | 2 | 4 | 6 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | 40 | 44 | 48 | 56 | 64 | 80 | 96 | 112 | 128 | 144 | null | undefined;
|
|
14
14
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
15
|
type StackNativeProps = Omit<HTMLAttributes<HTMLDivElement>, 'className'>;
|
|
16
16
|
type StackVariantProps = VariantProps<typeof stackVariants>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { X } from "../../icons/index.js";
|
|
3
|
+
import { Button } from "../Button/index.js";
|
|
4
|
+
const TemporalClear = ({ onClick, disabled = false })=>/*#__PURE__*/ jsx(Button, {
|
|
5
|
+
variant: "ghost",
|
|
6
|
+
color: "neutral",
|
|
7
|
+
size: "small",
|
|
8
|
+
onClick: onClick,
|
|
9
|
+
disabled: disabled,
|
|
10
|
+
children: /*#__PURE__*/ jsx(X, {})
|
|
11
|
+
});
|
|
12
|
+
export { TemporalClear };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
export interface TemporalPlaceholderProps {
|
|
3
|
+
text: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Placeholder component for temporal inputs (date/time) when no value is selected.
|
|
8
|
+
* Shows gray text that disappears when the input is focused.
|
|
9
|
+
*/
|
|
10
|
+
export declare const TemporalPlaceholder: FC<TemporalPlaceholderProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
const TemporalPlaceholder = ({ text, className })=>/*#__PURE__*/ jsx("span", {
|
|
4
|
+
className: cn('pointer-events-none absolute inset-0 flex items-center px-1', 'text-text-secondary font-sans text-sm', 'select-none whitespace-nowrap', className),
|
|
5
|
+
"aria-hidden": "true",
|
|
6
|
+
children: text
|
|
7
|
+
});
|
|
8
|
+
export { TemporalPlaceholder };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import type { DateFieldState, DateSegment } from '@react-stately/datepicker';
|
|
3
|
+
interface TemporalSegmentProps {
|
|
4
|
+
segment: DateSegment;
|
|
5
|
+
state: DateFieldState;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
readOnly?: boolean;
|
|
8
|
+
/** Override the displayed text (from TemporalSegmentGroup normalization). */
|
|
9
|
+
displayOverride?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const TemporalSegment: FC<TemporalSegmentProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { useDateSegment } from "@react-aria/datepicker";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { getMonthSegmentText } from "./utils.js";
|
|
7
|
+
const segmentVariants = cva(cn('relative outline-none text-left', 'font-sans text-sm transition-all', 'focus:bg-bg-fill-brand focus:text-text-primary-alt', 'focus:outline-none'), {
|
|
8
|
+
variants: {
|
|
9
|
+
isPlaceholder: {
|
|
10
|
+
true: 'text-text-secondary',
|
|
11
|
+
false: 'text-text-primary'
|
|
12
|
+
},
|
|
13
|
+
disabled: {
|
|
14
|
+
true: 'cursor-not-allowed opacity-50',
|
|
15
|
+
false: 'hover:bg-states-primary-default-alt cursor-text'
|
|
16
|
+
},
|
|
17
|
+
type: {
|
|
18
|
+
literal: 'text-text-primary select-none hover:bg-transparent focus:bg-transparent',
|
|
19
|
+
editable: 'px-1'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
type: 'editable',
|
|
24
|
+
isPlaceholder: false,
|
|
25
|
+
disabled: false
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const TemporalSegment = ({ segment, state, disabled = false, readOnly = false, displayOverride })=>{
|
|
29
|
+
const ref = useRef(null);
|
|
30
|
+
const { segmentProps } = useDateSegment(segment, state, ref);
|
|
31
|
+
const isLiteral = 'literal' === segment.type;
|
|
32
|
+
const isEditable = segment.isEditable && !readOnly;
|
|
33
|
+
if (isLiteral) return /*#__PURE__*/ jsx("span", {
|
|
34
|
+
className: segmentVariants({
|
|
35
|
+
type: 'literal',
|
|
36
|
+
disabled
|
|
37
|
+
}),
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
children: displayOverride ?? segment.text
|
|
40
|
+
});
|
|
41
|
+
const displayText = displayOverride ?? ('month' !== segment.type || null == segment.value || segment.isPlaceholder ? segment.text : getMonthSegmentText(segment.value, segment.placeholder));
|
|
42
|
+
return /*#__PURE__*/ jsx("span", {
|
|
43
|
+
...segmentProps,
|
|
44
|
+
ref: ref,
|
|
45
|
+
className: segmentVariants({
|
|
46
|
+
type: isEditable ? 'editable' : 'literal',
|
|
47
|
+
isPlaceholder: segment.isPlaceholder,
|
|
48
|
+
disabled: disabled || !isEditable
|
|
49
|
+
}),
|
|
50
|
+
"data-segment": segment.type,
|
|
51
|
+
"data-placeholder": segment.isPlaceholder || void 0,
|
|
52
|
+
children: displayText
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
export { TemporalSegment };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DateFieldState, TimeFieldState } from '@react-stately/datepicker';
|
|
2
|
+
import type { GroupDOMAttributes } from '@react-types/shared';
|
|
3
|
+
export interface TemporalSegmentGroupProps extends GroupDOMAttributes {
|
|
4
|
+
state: DateFieldState | TimeFieldState;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
readOnly?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
segmentKeyPrefix?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const TemporalSegmentGroup: import("react").ForwardRefExoticComponent<TemporalSegmentGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
import { TemporalSegment } from "./TemporalSegment.js";
|
|
6
|
+
const literalVariants = cva('relative outline-none text-left font-sans text-sm text-text-primary select-none', {
|
|
7
|
+
variants: {
|
|
8
|
+
disabled: {
|
|
9
|
+
true: 'cursor-not-allowed opacity-50',
|
|
10
|
+
false: ''
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
disabled: false
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const Literal = ({ text, disabled })=>/*#__PURE__*/ jsx("span", {
|
|
18
|
+
className: literalVariants({
|
|
19
|
+
disabled
|
|
20
|
+
}),
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
children: text
|
|
23
|
+
});
|
|
24
|
+
function buildParts(segments, state, disabled, readOnly, keyPrefix = '') {
|
|
25
|
+
const day = segments.find((s)=>'day' === s.type);
|
|
26
|
+
const month = segments.find((s)=>'month' === s.type);
|
|
27
|
+
const year = segments.find((s)=>'year' === s.type);
|
|
28
|
+
const hasDateParts = !!(day || month || year);
|
|
29
|
+
if (!hasDateParts) return segments.map((seg, i)=>/*#__PURE__*/ jsx(TemporalSegment, {
|
|
30
|
+
segment: seg,
|
|
31
|
+
state: state,
|
|
32
|
+
disabled: disabled,
|
|
33
|
+
readOnly: readOnly
|
|
34
|
+
}, `${keyPrefix}${seg.type}_${i}`));
|
|
35
|
+
const hourIdx = segments.findIndex((s)=>'hour' === s.type);
|
|
36
|
+
const timeSegments = hourIdx >= 0 ? segments.slice(hourIdx) : [];
|
|
37
|
+
const parts = [];
|
|
38
|
+
if (day) {
|
|
39
|
+
const dayOverride = day.isPlaceholder || 2 !== day.text.length || '0' !== day.text[0] ? void 0 : day.text.slice(1);
|
|
40
|
+
parts.push(/*#__PURE__*/ jsx(TemporalSegment, {
|
|
41
|
+
segment: day,
|
|
42
|
+
state: state,
|
|
43
|
+
disabled: disabled,
|
|
44
|
+
readOnly: readOnly,
|
|
45
|
+
displayOverride: dayOverride
|
|
46
|
+
}, `${keyPrefix}day`));
|
|
47
|
+
}
|
|
48
|
+
if (month) {
|
|
49
|
+
parts.push(/*#__PURE__*/ jsx(Literal, {
|
|
50
|
+
text: " ",
|
|
51
|
+
disabled: disabled
|
|
52
|
+
}, `${keyPrefix}sep-dm`));
|
|
53
|
+
parts.push(/*#__PURE__*/ jsx(TemporalSegment, {
|
|
54
|
+
segment: month,
|
|
55
|
+
state: state,
|
|
56
|
+
disabled: disabled,
|
|
57
|
+
readOnly: readOnly
|
|
58
|
+
}, `${keyPrefix}month`));
|
|
59
|
+
}
|
|
60
|
+
if (year) {
|
|
61
|
+
parts.push(/*#__PURE__*/ jsx(Literal, {
|
|
62
|
+
text: ", ",
|
|
63
|
+
disabled: disabled
|
|
64
|
+
}, `${keyPrefix}sep-my`));
|
|
65
|
+
parts.push(/*#__PURE__*/ jsx(TemporalSegment, {
|
|
66
|
+
segment: year,
|
|
67
|
+
state: state,
|
|
68
|
+
disabled: disabled,
|
|
69
|
+
readOnly: readOnly
|
|
70
|
+
}, `${keyPrefix}year`));
|
|
71
|
+
}
|
|
72
|
+
if (timeSegments.length > 0) {
|
|
73
|
+
parts.push(/*#__PURE__*/ jsx(Literal, {
|
|
74
|
+
text: " ",
|
|
75
|
+
disabled: disabled
|
|
76
|
+
}, `${keyPrefix}sep-dt`));
|
|
77
|
+
timeSegments.forEach((seg, i)=>parts.push(/*#__PURE__*/ jsx(TemporalSegment, {
|
|
78
|
+
segment: seg,
|
|
79
|
+
state: state,
|
|
80
|
+
disabled: disabled,
|
|
81
|
+
readOnly: readOnly
|
|
82
|
+
}, `${keyPrefix}time_${seg.type}_${i}`)));
|
|
83
|
+
}
|
|
84
|
+
return parts;
|
|
85
|
+
}
|
|
86
|
+
const TemporalSegmentGroup = /*#__PURE__*/ forwardRef(({ state, disabled, readOnly, className, segmentKeyPrefix = '', ...props }, ref)=>{
|
|
87
|
+
const parts = buildParts(state.segments, state, disabled, readOnly, segmentKeyPrefix);
|
|
88
|
+
return /*#__PURE__*/ jsx("div", {
|
|
89
|
+
...props,
|
|
90
|
+
ref: ref,
|
|
91
|
+
className: cn('flex items-center gap-0.5', className),
|
|
92
|
+
children: parts
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
TemporalSegmentGroup.displayName = 'TemporalSegmentGroup';
|
|
96
|
+
export { TemporalSegmentGroup };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type KeyboardEvent } from 'react';
|
|
2
|
+
import type { TimeValue } from '@react-aria/datepicker';
|
|
3
|
+
export interface TimeDropdownProps {
|
|
4
|
+
/** Whether dropdown is visible */
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
/** Time step in minutes (default: 30) */
|
|
7
|
+
timeStep?: number;
|
|
8
|
+
/** Current selected time value */
|
|
9
|
+
value?: TimeValue | null;
|
|
10
|
+
/** Hour cycle for time display: 12-hour (AM/PM) or 24-hour format */
|
|
11
|
+
hourCycle?: 12 | 24;
|
|
12
|
+
/** Callback when time is selected */
|
|
13
|
+
onSelect: (time: TimeValue) => void;
|
|
14
|
+
/** Callback when dropdown should close */
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
}
|
|
17
|
+
export interface TimeDropdownHandle {
|
|
18
|
+
handleKeyDown: (e: KeyboardEvent) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Time dropdown component with keyboard navigation.
|
|
22
|
+
* Stops event propagation to prevent interference with parent components.
|
|
23
|
+
*/
|
|
24
|
+
export declare const TimeDropdown: import("react").ForwardRefExoticComponent<TimeDropdownProps & import("react").RefAttributes<TimeDropdownHandle>>;
|