@refraktor/dates 0.0.3 → 0.0.5
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/build/components/date-range-picker/date-range-picker.d.ts +4 -0
- package/build/components/date-range-picker/date-range-picker.d.ts.map +1 -0
- package/build/components/date-range-picker/date-range-picker.js +379 -0
- package/build/components/date-range-picker/date-range-picker.types.d.ts +100 -0
- package/build/components/date-range-picker/date-range-picker.types.d.ts.map +1 -0
- package/build/components/date-range-picker/date-range-picker.types.js +1 -0
- package/build/components/date-range-picker/index.d.ts +3 -0
- package/build/components/date-range-picker/index.d.ts.map +1 -0
- package/build/components/date-range-picker/index.js +1 -0
- package/build/components/time-input/index.d.ts +1 -1
- package/build/components/time-input/index.d.ts.map +1 -1
- package/build/components/time-input/time-input.d.ts.map +1 -1
- package/build/components/time-input/time-input.js +7 -196
- package/build/components/time-input/time-input.types.d.ts +5 -83
- package/build/components/time-input/time-input.types.d.ts.map +1 -1
- package/build/components/time-picker/index.d.ts +1 -1
- package/build/components/time-picker/index.d.ts.map +1 -1
- package/build/components/time-picker/time-picker.d.ts.map +1 -1
- package/build/components/time-picker/time-picker.js +498 -350
- package/build/components/time-picker/time-picker.types.d.ts +96 -61
- package/build/components/time-picker/time-picker.types.d.ts.map +1 -1
- package/build/style.css +2 -2
- package/package.json +33 -4
- package/.turbo/turbo-build.log +0 -4
- package/refraktor-dates-0.0.1-alpha.0.tgz +0 -0
- package/src/components/date-input/date-input.tsx +0 -379
- package/src/components/date-input/date-input.types.ts +0 -161
- package/src/components/date-input/index.ts +0 -13
- package/src/components/date-picker/date-picker.tsx +0 -649
- package/src/components/date-picker/date-picker.types.ts +0 -145
- package/src/components/date-picker/index.ts +0 -15
- package/src/components/dates-provider/context.ts +0 -18
- package/src/components/dates-provider/dates-provider.tsx +0 -136
- package/src/components/dates-provider/index.ts +0 -10
- package/src/components/dates-provider/types.ts +0 -33
- package/src/components/dates-provider/use-dates.ts +0 -5
- package/src/components/index.ts +0 -9
- package/src/components/month-input/index.ts +0 -13
- package/src/components/month-input/month-input.tsx +0 -366
- package/src/components/month-input/month-input.types.ts +0 -139
- package/src/components/month-picker/index.ts +0 -14
- package/src/components/month-picker/month-picker.tsx +0 -458
- package/src/components/month-picker/month-picker.types.ts +0 -117
- package/src/components/picker-shared/index.ts +0 -7
- package/src/components/picker-shared/picker-header.tsx +0 -178
- package/src/components/picker-shared/picker-header.types.ts +0 -49
- package/src/components/picker-shared/picker.styles.ts +0 -69
- package/src/components/picker-shared/picker.types.ts +0 -4
- package/src/components/time-input/index.ts +0 -23
- package/src/components/time-input/time-input.tsx +0 -453
- package/src/components/time-input/time-input.types.ts +0 -163
- package/src/components/time-picker/index.ts +0 -19
- package/src/components/time-picker/time-picker.tsx +0 -737
- package/src/components/time-picker/time-picker.types.ts +0 -135
- package/src/components/year-input/index.ts +0 -13
- package/src/components/year-input/year-input.tsx +0 -350
- package/src/components/year-input/year-input.types.ts +0 -118
- package/src/components/year-picker/index.ts +0 -15
- package/src/components/year-picker/year-picker.tsx +0 -504
- package/src/components/year-picker/year-picker.types.ts +0 -108
- package/src/index.ts +0 -3
- package/src/style.css +0 -1
- package/tsconfig.json +0 -13
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createClassNamesConfig,
|
|
3
|
-
createComponentConfig,
|
|
4
|
-
factory,
|
|
5
|
-
useTheme,
|
|
6
|
-
useClassNames,
|
|
7
|
-
useProps
|
|
8
|
-
} from "@refraktor/core";
|
|
9
|
-
import { getPickerSizeStyles } from "./picker.styles";
|
|
10
|
-
import {
|
|
11
|
-
PickerHeaderClassNames,
|
|
12
|
-
PickerHeaderFactoryPayload,
|
|
13
|
-
PickerHeaderProps
|
|
14
|
-
} from "./picker-header.types";
|
|
15
|
-
|
|
16
|
-
const defaultProps = {
|
|
17
|
-
previousDisabled: false,
|
|
18
|
-
nextDisabled: false,
|
|
19
|
-
previousLabel: "Show previous period",
|
|
20
|
-
nextLabel: "Show next period",
|
|
21
|
-
size: "md",
|
|
22
|
-
radius: "default"
|
|
23
|
-
} satisfies Partial<PickerHeaderProps>;
|
|
24
|
-
|
|
25
|
-
const ChevronIcon = ({
|
|
26
|
-
direction,
|
|
27
|
-
size
|
|
28
|
-
}: {
|
|
29
|
-
direction: "left" | "right";
|
|
30
|
-
size: number;
|
|
31
|
-
}) => (
|
|
32
|
-
<svg
|
|
33
|
-
aria-hidden="true"
|
|
34
|
-
viewBox="0 0 16 16"
|
|
35
|
-
fill="none"
|
|
36
|
-
width={size}
|
|
37
|
-
height={size}
|
|
38
|
-
className={direction === "right" ? "rotate-180" : undefined}
|
|
39
|
-
>
|
|
40
|
-
<path
|
|
41
|
-
d="M9.5 3.5L5 8l4.5 4.5"
|
|
42
|
-
stroke="currentColor"
|
|
43
|
-
strokeWidth="1.6"
|
|
44
|
-
strokeLinecap="round"
|
|
45
|
-
strokeLinejoin="round"
|
|
46
|
-
/>
|
|
47
|
-
</svg>
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const PickerHeader = factory<PickerHeaderFactoryPayload>((_props, ref) => {
|
|
51
|
-
const { cx, getRadius } = useTheme();
|
|
52
|
-
const {
|
|
53
|
-
label,
|
|
54
|
-
onPrevious,
|
|
55
|
-
onNext,
|
|
56
|
-
onLabelClick,
|
|
57
|
-
previousDisabled,
|
|
58
|
-
nextDisabled,
|
|
59
|
-
previousLabel,
|
|
60
|
-
nextLabel,
|
|
61
|
-
size,
|
|
62
|
-
radius,
|
|
63
|
-
className,
|
|
64
|
-
classNames,
|
|
65
|
-
...props
|
|
66
|
-
} = useProps("PickerHeader", defaultProps, _props);
|
|
67
|
-
const classes = useClassNames("PickerHeader", classNames);
|
|
68
|
-
const sizeStyles = getPickerSizeStyles(size);
|
|
69
|
-
const radiusStyles = getRadius(radius);
|
|
70
|
-
|
|
71
|
-
const isPreviousDisabled = previousDisabled || !onPrevious;
|
|
72
|
-
const isNextDisabled = nextDisabled || !onNext;
|
|
73
|
-
|
|
74
|
-
const getStyles = (part: keyof PickerHeaderClassNames) => classes[part];
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<div
|
|
78
|
-
ref={ref}
|
|
79
|
-
className={cx(
|
|
80
|
-
"flex items-center justify-between gap-2",
|
|
81
|
-
getStyles("root"),
|
|
82
|
-
className
|
|
83
|
-
)}
|
|
84
|
-
{...props}
|
|
85
|
-
>
|
|
86
|
-
<div
|
|
87
|
-
className={cx(
|
|
88
|
-
"inline-flex shrink-0 items-center gap-1",
|
|
89
|
-
getStyles("controls")
|
|
90
|
-
)}
|
|
91
|
-
>
|
|
92
|
-
<button
|
|
93
|
-
type="button"
|
|
94
|
-
aria-label={previousLabel}
|
|
95
|
-
aria-disabled={isPreviousDisabled}
|
|
96
|
-
data-disabled={isPreviousDisabled}
|
|
97
|
-
disabled={isPreviousDisabled}
|
|
98
|
-
onClick={onPrevious}
|
|
99
|
-
className={cx(
|
|
100
|
-
"inline-flex items-center justify-center cursor-pointer",
|
|
101
|
-
"text-[var(--refraktor-text)] transition-colors hover:bg-[var(--refraktor-bg-hover)]",
|
|
102
|
-
"data-[disabled=true]:pointer-events-none data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50",
|
|
103
|
-
sizeStyles.control,
|
|
104
|
-
radiusStyles,
|
|
105
|
-
getStyles("control"),
|
|
106
|
-
getStyles("previousControl")
|
|
107
|
-
)}
|
|
108
|
-
>
|
|
109
|
-
<ChevronIcon direction="left" size={sizeStyles.iconSize} />
|
|
110
|
-
</button>
|
|
111
|
-
</div>
|
|
112
|
-
|
|
113
|
-
<div
|
|
114
|
-
className={cx(
|
|
115
|
-
"min-w-0 flex-1 truncate text-center font-medium text-[var(--refraktor-text)]",
|
|
116
|
-
sizeStyles.label,
|
|
117
|
-
getStyles("label")
|
|
118
|
-
)}
|
|
119
|
-
>
|
|
120
|
-
{onLabelClick ? (
|
|
121
|
-
<button
|
|
122
|
-
type="button"
|
|
123
|
-
onClick={onLabelClick}
|
|
124
|
-
className={cx(
|
|
125
|
-
"inline-flex w-full cursor-pointer items-center justify-center text-center transition-colors hover:bg-[var(--refraktor-bg-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--refraktor-primary)]",
|
|
126
|
-
sizeStyles.labelButton,
|
|
127
|
-
radiusStyles,
|
|
128
|
-
getStyles("labelButton")
|
|
129
|
-
)}
|
|
130
|
-
>
|
|
131
|
-
<span
|
|
132
|
-
className={cx("truncate", getStyles("labelText"))}
|
|
133
|
-
>
|
|
134
|
-
{label}
|
|
135
|
-
</span>
|
|
136
|
-
</button>
|
|
137
|
-
) : (
|
|
138
|
-
<span className={cx("truncate", getStyles("labelText"))}>
|
|
139
|
-
{label}
|
|
140
|
-
</span>
|
|
141
|
-
)}
|
|
142
|
-
</div>
|
|
143
|
-
|
|
144
|
-
<div
|
|
145
|
-
className={cx(
|
|
146
|
-
"inline-flex shrink-0 items-center gap-1",
|
|
147
|
-
getStyles("controls")
|
|
148
|
-
)}
|
|
149
|
-
>
|
|
150
|
-
<button
|
|
151
|
-
type="button"
|
|
152
|
-
aria-label={nextLabel}
|
|
153
|
-
aria-disabled={isNextDisabled}
|
|
154
|
-
data-disabled={isNextDisabled}
|
|
155
|
-
disabled={isNextDisabled}
|
|
156
|
-
onClick={onNext}
|
|
157
|
-
className={cx(
|
|
158
|
-
"inline-flex items-center justify-center cursor-pointer",
|
|
159
|
-
"text-[var(--refraktor-text)] transition-colors hover:bg-[var(--refraktor-bg-hover)]",
|
|
160
|
-
"data-[disabled=true]:pointer-events-none data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50",
|
|
161
|
-
sizeStyles.control,
|
|
162
|
-
radiusStyles,
|
|
163
|
-
getStyles("control"),
|
|
164
|
-
getStyles("nextControl")
|
|
165
|
-
)}
|
|
166
|
-
>
|
|
167
|
-
<ChevronIcon direction="right" size={sizeStyles.iconSize} />
|
|
168
|
-
</button>
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
PickerHeader.displayName = "@refraktor/dates/PickerHeader";
|
|
175
|
-
PickerHeader.configure = createComponentConfig<PickerHeaderProps>();
|
|
176
|
-
PickerHeader.classNames = createClassNamesConfig<PickerHeaderClassNames>();
|
|
177
|
-
|
|
178
|
-
export default PickerHeader;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ComponentPropsWithoutRef,
|
|
3
|
-
MouseEventHandler,
|
|
4
|
-
ReactNode
|
|
5
|
-
} from "react";
|
|
6
|
-
import {
|
|
7
|
-
createClassNamesConfig,
|
|
8
|
-
createComponentConfig,
|
|
9
|
-
FactoryPayload
|
|
10
|
-
} from "@refraktor/core";
|
|
11
|
-
import { PickerRadius, PickerSize } from "./picker.types";
|
|
12
|
-
|
|
13
|
-
export type PickerHeaderClassNames = {
|
|
14
|
-
root?: string;
|
|
15
|
-
controls?: string;
|
|
16
|
-
control?: string;
|
|
17
|
-
previousControl?: string;
|
|
18
|
-
nextControl?: string;
|
|
19
|
-
label?: string;
|
|
20
|
-
labelButton?: string;
|
|
21
|
-
labelText?: string;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export interface PickerHeaderProps
|
|
25
|
-
extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
|
|
26
|
-
label: ReactNode;
|
|
27
|
-
onPrevious?: () => void;
|
|
28
|
-
onNext?: () => void;
|
|
29
|
-
onLabelClick?: MouseEventHandler<HTMLButtonElement>;
|
|
30
|
-
previousDisabled?: boolean;
|
|
31
|
-
nextDisabled?: boolean;
|
|
32
|
-
previousLabel?: string;
|
|
33
|
-
nextLabel?: string;
|
|
34
|
-
size?: PickerSize;
|
|
35
|
-
radius?: PickerRadius;
|
|
36
|
-
className?: string;
|
|
37
|
-
classNames?: PickerHeaderClassNames;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface PickerHeaderFactoryPayload extends FactoryPayload {
|
|
41
|
-
props: PickerHeaderProps;
|
|
42
|
-
ref: HTMLDivElement;
|
|
43
|
-
compound: {
|
|
44
|
-
configure: ReturnType<typeof createComponentConfig<PickerHeaderProps>>;
|
|
45
|
-
classNames: ReturnType<
|
|
46
|
-
typeof createClassNamesConfig<PickerHeaderClassNames>
|
|
47
|
-
>;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { PickerSize } from "./picker.types";
|
|
2
|
-
|
|
3
|
-
export type PickerSizeStyles = {
|
|
4
|
-
control: string;
|
|
5
|
-
label: string;
|
|
6
|
-
labelButton: string;
|
|
7
|
-
cell: string;
|
|
8
|
-
gridGap: string;
|
|
9
|
-
iconSize: number;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const pickerSizes: Record<PickerSize, PickerSizeStyles> = {
|
|
13
|
-
xs: {
|
|
14
|
-
control: "size-6 text-xs",
|
|
15
|
-
label: "text-xs",
|
|
16
|
-
labelButton: "py-0.5 px-1",
|
|
17
|
-
cell: "h-7 px-1 text-xs",
|
|
18
|
-
gridGap: "gap-1",
|
|
19
|
-
iconSize: 12
|
|
20
|
-
},
|
|
21
|
-
sm: {
|
|
22
|
-
control: "size-7 text-xs",
|
|
23
|
-
label: "text-xs",
|
|
24
|
-
labelButton: "py-0.5 px-1",
|
|
25
|
-
cell: "h-8 px-1.5 text-xs",
|
|
26
|
-
gridGap: "gap-1",
|
|
27
|
-
iconSize: 14
|
|
28
|
-
},
|
|
29
|
-
md: {
|
|
30
|
-
control: "size-8 text-sm",
|
|
31
|
-
label: "text-sm",
|
|
32
|
-
labelButton: "py-1 px-1.5",
|
|
33
|
-
cell: "h-9 px-2 text-sm",
|
|
34
|
-
gridGap: "gap-1.5",
|
|
35
|
-
iconSize: 16
|
|
36
|
-
},
|
|
37
|
-
lg: {
|
|
38
|
-
control: "size-9 text-base",
|
|
39
|
-
label: "text-base",
|
|
40
|
-
labelButton: "py-1 px-2",
|
|
41
|
-
cell: "h-10 px-2.5 text-base",
|
|
42
|
-
gridGap: "gap-2",
|
|
43
|
-
iconSize: 18
|
|
44
|
-
},
|
|
45
|
-
xl: {
|
|
46
|
-
control: "size-10 text-lg",
|
|
47
|
-
label: "text-lg",
|
|
48
|
-
labelButton: "py-1.5 px-2.5",
|
|
49
|
-
cell: "h-11 px-3 text-lg",
|
|
50
|
-
gridGap: "gap-2",
|
|
51
|
-
iconSize: 20
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const gridColumns: Record<number, string> = {
|
|
56
|
-
1: "grid-cols-1",
|
|
57
|
-
2: "grid-cols-2",
|
|
58
|
-
3: "grid-cols-3",
|
|
59
|
-
4: "grid-cols-4",
|
|
60
|
-
5: "grid-cols-5",
|
|
61
|
-
6: "grid-cols-6",
|
|
62
|
-
7: "grid-cols-7"
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const getPickerSizeStyles = (size: PickerSize = "md") =>
|
|
66
|
-
pickerSizes[size] ?? pickerSizes.md;
|
|
67
|
-
|
|
68
|
-
export const getGridColumns = (columns: number) =>
|
|
69
|
-
gridColumns[columns] ?? gridColumns[4];
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export { default as TimeInput } from "./time-input";
|
|
2
|
-
export type {
|
|
3
|
-
TimeInputClassNames,
|
|
4
|
-
TimeInputFactoryPayload,
|
|
5
|
-
TimeInputGetHourAriaLabel,
|
|
6
|
-
TimeInputGetHourLabel,
|
|
7
|
-
TimeInputGetMinuteAriaLabel,
|
|
8
|
-
TimeInputGetMinuteLabel,
|
|
9
|
-
TimeInputGetPeriodAriaLabel,
|
|
10
|
-
TimeInputGetPeriodLabel,
|
|
11
|
-
TimeInputGetSecondAriaLabel,
|
|
12
|
-
TimeInputGetSecondLabel,
|
|
13
|
-
TimeInputMiddlewares,
|
|
14
|
-
TimeInputMode,
|
|
15
|
-
TimeInputOnChange,
|
|
16
|
-
TimeInputPeriod,
|
|
17
|
-
TimeInputPositioning,
|
|
18
|
-
TimeInputProps,
|
|
19
|
-
TimeInputRadius,
|
|
20
|
-
TimeInputSize,
|
|
21
|
-
TimeInputValue,
|
|
22
|
-
TimeInputValueFormat
|
|
23
|
-
} from "./time-input.types";
|