torch-glare 2.4.0 → 2.4.1
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/README.md +8 -0
- package/apps/lib/components/ActionButton.tsx +7 -12
- package/apps/lib/components/ActionsGroup.tsx +4 -15
- package/apps/lib/components/AlertDialog.tsx +173 -191
- package/apps/lib/components/Avatar.tsx +13 -16
- package/apps/lib/components/Badge.tsx +1 -3
- package/apps/lib/components/BadgeField.tsx +76 -71
- package/apps/lib/components/Breadcrumb.tsx +49 -85
- package/apps/lib/components/Button.tsx +20 -19
- package/apps/lib/components/ButtonGroup.tsx +31 -41
- package/apps/lib/components/Calendar.tsx +51 -29
- package/apps/lib/components/Card.tsx +2 -13
- package/apps/lib/components/ChartBlockTool.ts +17 -52
- package/apps/lib/components/Checkbox.tsx +9 -16
- package/apps/lib/components/ContextMenu.tsx +97 -96
- package/apps/lib/components/CountBadge.tsx +4 -6
- package/apps/lib/components/DataTable.tsx +196 -216
- package/apps/lib/components/DataViews/DataViewRadio.tsx +1 -6
- package/apps/lib/components/DataViews/DataViewsConfigPanel.tsx +13 -47
- package/apps/lib/components/DataViews/DataViewsHeader.tsx +1 -3
- package/apps/lib/components/DataViews/DataViewsLayout.tsx +5 -12
- package/apps/lib/components/DataViews/FilterPanel.tsx +155 -149
- package/apps/lib/components/DataViews/HeaderSearch.tsx +1 -5
- package/apps/lib/components/DataViews/InboxView.tsx +22 -68
- package/apps/lib/components/DataViews/InboxViewCard.tsx +68 -77
- package/apps/lib/components/DataViews/KanbanView.tsx +8 -25
- package/apps/lib/components/DataViews/PanelControls.tsx +3 -13
- package/apps/lib/components/DataViews/SettingsPanel.tsx +83 -89
- package/apps/lib/components/DataViews/TableView.tsx +8 -28
- package/apps/lib/components/DataViews/TreeView.tsx +12 -40
- package/apps/lib/components/DataViews/badgeAdapter.ts +32 -28
- package/apps/lib/components/DataViews/fieldRenderers.tsx +106 -141
- package/apps/lib/components/DataViews/filters/DatePickerRangeFilter.tsx +30 -23
- package/apps/lib/components/DataViews/filters/DateRangePopover.tsx +39 -32
- package/apps/lib/components/DataViews/filters/PresetChips.tsx +15 -15
- package/apps/lib/components/DataViews/filters/RangeSliderWithInputs.tsx +69 -58
- package/apps/lib/components/DataViews/index.ts +26 -26
- package/apps/lib/components/DataViews/tree/TreeDrawer.tsx +12 -16
- package/apps/lib/components/DataViews/tree/TreeSidebar.tsx +28 -31
- package/apps/lib/components/DataViews/types.ts +104 -115
- package/apps/lib/components/DatePicker.tsx +198 -196
- package/apps/lib/components/Dialog.tsx +92 -105
- package/apps/lib/components/Divider.tsx +21 -24
- package/apps/lib/components/Drawer.tsx +79 -139
- package/apps/lib/components/DropdownMenu.tsx +131 -171
- package/apps/lib/components/FieldHint.tsx +4 -11
- package/apps/lib/components/Form.tsx +146 -155
- package/apps/lib/components/FormStepper.tsx +9 -39
- package/apps/lib/components/HeaderBar.tsx +1 -9
- package/apps/lib/components/ImageAttachment.tsx +111 -73
- package/apps/lib/components/InnerLabelField.tsx +20 -16
- package/apps/lib/components/Input.tsx +171 -172
- package/apps/lib/components/InputField.tsx +44 -45
- package/apps/lib/components/InputOTP.tsx +68 -69
- package/apps/lib/components/Label.tsx +31 -35
- package/apps/lib/components/LabelField.tsx +4 -5
- package/apps/lib/components/LabeledCheckBox.tsx +8 -12
- package/apps/lib/components/LabeledRadio.tsx +7 -5
- package/apps/lib/components/LinkButton.tsx +2 -9
- package/apps/lib/components/LoginButton.tsx +4 -9
- package/apps/lib/components/PasswordLevel.tsx +5 -5
- package/apps/lib/components/Popover.tsx +15 -33
- package/apps/lib/components/ProfileMenu.tsx +67 -72
- package/apps/lib/components/Radio.tsx +1 -5
- package/apps/lib/components/RadioCard.tsx +9 -28
- package/apps/lib/components/ScrollArea.tsx +45 -43
- package/apps/lib/components/SearchField.tsx +49 -39
- package/apps/lib/components/SearchableSelect.tsx +8 -14
- package/apps/lib/components/SearchableTable.tsx +108 -118
- package/apps/lib/components/SearchableTree.tsx +469 -0
- package/apps/lib/components/SearchableTreeDialog.tsx +493 -0
- package/apps/lib/components/SectionBlock.tsx +4 -16
- package/apps/lib/components/Select.tsx +53 -80
- package/apps/lib/components/SimpleSelect.tsx +196 -187
- package/apps/lib/components/Skeleton.tsx +9 -12
- package/apps/lib/components/SlideDatePicker.tsx +215 -166
- package/apps/lib/components/SpinLoading.tsx +33 -49
- package/apps/lib/components/Stepper.tsx +13 -56
- package/apps/lib/components/Switch.tsx +8 -10
- package/apps/lib/components/TabFormItem.tsx +3 -12
- package/apps/lib/components/TabSwitch.tsx +7 -34
- package/apps/lib/components/Table.tsx +60 -75
- package/apps/lib/components/TableDnDWrapper.ts +15 -48
- package/apps/lib/components/TextEditor.tsx +93 -104
- package/apps/lib/components/Textarea.tsx +8 -12
- package/apps/lib/components/Timeline.tsx +21 -41
- package/apps/lib/components/Toast.tsx +83 -83
- package/apps/lib/components/Toggle.tsx +112 -114
- package/apps/lib/components/ToggleButton.tsx +1 -1
- package/apps/lib/components/Tooltip.tsx +24 -19
- package/apps/lib/components/TransparentLabel.tsx +61 -62
- package/apps/lib/components/TreeDropDown.tsx +86 -52
- package/apps/lib/components/TreeFolder/TreeFolder.tsx +15 -48
- package/apps/lib/components/TreeFolder/TreeFolderBreadcrumb.tsx +16 -21
- package/apps/lib/components/TreeFolder/TreeFolderRow.tsx +9 -20
- package/apps/lib/components/TreeFolder/TreeFolderStyles.tsx +3 -3
- package/apps/lib/components/TreeFolder/icons.tsx +14 -17
- package/apps/lib/components/TreeFolder/index.ts +15 -8
- package/apps/lib/components/TreeFolder/treeFolderUtils.ts +47 -52
- package/apps/lib/components/TreeFolder/types.ts +32 -32
- package/apps/lib/components/TreeFolder/useTreeFolderDnD.ts +117 -123
- package/apps/lib/hooks/useActiveTreeItem.ts +52 -55
- package/apps/lib/hooks/useClickOutside.ts +21 -20
- package/apps/lib/hooks/useDataViewsState.ts +86 -80
- package/apps/lib/hooks/useIsMobile.ts +12 -12
- package/apps/lib/hooks/useResize.ts +54 -65
- package/apps/lib/hooks/useTagSelection.ts +201 -201
- package/apps/lib/layouts/CNLayout.tsx +181 -140
- package/apps/lib/layouts/DataViewCard.tsx +4 -18
- package/apps/lib/layouts/FieldSection.tsx +2 -6
- package/apps/lib/layouts/TreeSubLayout.tsx +24 -38
- package/apps/lib/providers/ThemeProvider.tsx +8 -23
- package/apps/lib/registry.json +1004 -0
- package/apps/lib/tsconfig.json +9 -0
- package/apps/lib/utils/cn.ts +1 -1
- package/apps/lib/utils/dataViews/columnUtils.ts +46 -44
- package/apps/lib/utils/dataViews/fieldUtils.ts +70 -71
- package/apps/lib/utils/dataViews/nestedDataUtils.tsx +129 -122
- package/apps/lib/utils/dataViews/pathUtils.ts +74 -67
- package/apps/lib/utils/dataViews/rangeUtils.ts +121 -112
- package/apps/lib/utils/dataViews/treeUtils.ts +204 -211
- package/apps/lib/utils/dateFormat.ts +64 -54
- package/apps/lib/utils/markdownParser.ts +2 -7
- package/apps/lib/utils/resize.ts +21 -25
- package/apps/lib/utils/types.ts +13 -13
- package/dist/bin/index.js +8 -2
- package/dist/bin/index.js.map +1 -1
- package/dist/src/shared/getAvailableFiles.d.ts.map +1 -1
- package/dist/src/shared/getAvailableFiles.js +6 -1
- package/dist/src/shared/getAvailableFiles.js.map +1 -1
- package/dist/src/shared/loadRegistry.d.ts +7 -0
- package/dist/src/shared/loadRegistry.d.ts.map +1 -0
- package/dist/src/shared/loadRegistry.js +31 -0
- package/dist/src/shared/loadRegistry.js.map +1 -0
- package/dist/src/shared/resolveInstallPlan.d.ts +12 -0
- package/dist/src/shared/resolveInstallPlan.d.ts.map +1 -0
- package/dist/src/shared/resolveInstallPlan.js +39 -0
- package/dist/src/shared/resolveInstallPlan.js.map +1 -0
- package/dist/src/types/main.d.ts +24 -0
- package/dist/src/types/main.d.ts.map +1 -1
- package/docs/README.md +10 -2
- package/docs/components/action-button.md +30 -24
- package/docs/components/actions-group.md +26 -20
- package/docs/components/alert-dialog.md +45 -45
- package/docs/components/avatar.md +6 -2
- package/docs/components/badge-field.md +6 -2
- package/docs/components/badge.md +7 -1
- package/docs/components/breadcrumb.md +15 -40
- package/docs/components/button-group.md +13 -10
- package/docs/components/button.md +58 -33
- package/docs/components/calendar.md +26 -19
- package/docs/components/card.md +19 -16
- package/docs/components/chart-block-tool.md +128 -0
- package/docs/components/checkbox.md +16 -8
- package/docs/components/cn-layout.md +7 -1
- package/docs/components/context-menu.md +18 -25
- package/docs/components/count-badge.md +7 -1
- package/docs/components/data-table.md +45 -33
- package/docs/components/data-views-config-panel.md +15 -11
- package/docs/components/data-views-layout.md +13 -16
- package/docs/components/date-picker.md +30 -23
- package/docs/components/dialog.md +43 -42
- package/docs/components/divider.md +10 -4
- package/docs/components/drawer.md +8 -33
- package/docs/components/dropdown-menu.md +25 -34
- package/docs/components/field-hint.md +37 -25
- package/docs/components/field-section.md +9 -3
- package/docs/components/form-stepper.md +6 -0
- package/docs/components/form.md +17 -20
- package/docs/components/header-bar.md +6 -0
- package/docs/components/image-attachment.md +33 -41
- package/docs/components/inbox-view.md +16 -5
- package/docs/components/inner-label-field.md +34 -24
- package/docs/components/input-field.md +18 -10
- package/docs/components/input-otp.md +14 -11
- package/docs/components/input.md +22 -16
- package/docs/components/kanban-view.md +15 -5
- package/docs/components/label-field.md +32 -22
- package/docs/components/label.md +43 -32
- package/docs/components/labeled-check-box.md +16 -8
- package/docs/components/labeled-radio.md +18 -11
- package/docs/components/link-button.md +7 -1
- package/docs/components/login-button.md +8 -2
- package/docs/components/password-level.md +37 -24
- package/docs/components/popover.md +26 -23
- package/docs/components/profile-menu.md +38 -27
- package/docs/components/radio-card.md +16 -9
- package/docs/components/radio.md +16 -8
- package/docs/components/scroll-area.md +6 -2
- package/docs/components/search-field.md +14 -6
- package/docs/components/searchable-select.md +19 -14
- package/docs/components/searchable-table.md +18 -13
- package/docs/components/searchable-tree-dialog.md +190 -0
- package/docs/components/searchable-tree.md +200 -0
- package/docs/components/section-block.md +12 -4
- package/docs/components/select.md +23 -18
- package/docs/components/simple-select.md +14 -10
- package/docs/components/skeleton.md +43 -33
- package/docs/components/slide-date-picker.md +37 -29
- package/docs/components/spin-loading.md +32 -23
- package/docs/components/stepper.md +6 -0
- package/docs/components/switch.md +14 -6
- package/docs/components/tab-form-item.md +7 -1
- package/docs/components/tab-switch.md +13 -6
- package/docs/components/table-dnd-wrapper.md +105 -0
- package/docs/components/table-view.md +15 -5
- package/docs/components/table.md +28 -28
- package/docs/components/text-editor.md +19 -13
- package/docs/components/textarea.md +15 -7
- package/docs/components/timeline.md +6 -0
- package/docs/components/toast.md +35 -26
- package/docs/components/toggle-button.md +24 -21
- package/docs/components/toggle.md +23 -15
- package/docs/components/tooltip.md +42 -30
- package/docs/components/transparent-label.md +29 -20
- package/docs/components/tree-drop-down.md +31 -23
- package/docs/components/tree-sub-layout.md +6 -2
- package/docs/components/tree-view.md +16 -5
- package/docs/explanation/architecture.md +54 -0
- package/docs/explanation/design-system.md +52 -0
- package/docs/how-to/data-views-from-backend-response.md +6 -4
- package/docs/how-to/guides.md +24 -18
- package/docs/migration/changelog.md +38 -0
- package/docs/reference/cli.md +87 -0
- package/docs/reference/components.md +11 -12
- package/docs/reference/hooks.md +8 -8
- package/docs/reference/providers.md +22 -22
- package/docs/reference/tailwind-plugins.md +2 -2
- package/docs/reference/theme.md +85 -0
- package/docs/reference/types.md +4 -4
- package/docs/reference/utilities.md +19 -26
- package/docs/tutorials/building-first-form.md +20 -13
- package/docs/tutorials/component-composition.md +34 -50
- package/docs/tutorials/getting-started.md +2 -2
- package/docs/tutorials/theming-basics.md +13 -10
- package/package.json +31 -3
- package/dist/src/commands/block.d.ts +0 -5
- package/dist/src/commands/block.d.ts.map +0 -1
- package/dist/src/commands/block.js +0 -255
- package/dist/src/commands/block.js.map +0 -1
- package/dist/src/shared/configureFonts.d.ts +0 -6
- package/dist/src/shared/configureFonts.d.ts.map +0 -1
- package/dist/src/shared/configureFonts.js +0 -106
- package/dist/src/shared/configureFonts.js.map +0 -1
- package/dist/src/shared/configureGlobalCss.d.ts +0 -6
- package/dist/src/shared/configureGlobalCss.d.ts.map +0 -1
- package/dist/src/shared/configureGlobalCss.js +0 -154
- package/dist/src/shared/configureGlobalCss.js.map +0 -1
- package/dist/src/shared/configureTailwind.d.ts +0 -7
- package/dist/src/shared/configureTailwind.d.ts.map +0 -1
- package/dist/src/shared/configureTailwind.js +0 -163
- package/dist/src/shared/configureTailwind.js.map +0 -1
- package/dist/src/shared/detectFramework.d.ts +0 -23
- package/dist/src/shared/detectFramework.d.ts.map +0 -1
- package/dist/src/shared/detectFramework.js +0 -119
- package/dist/src/shared/detectFramework.js.map +0 -1
- package/dist/src/shared/installBaseUtils.d.ts +0 -5
- package/dist/src/shared/installBaseUtils.d.ts.map +0 -1
- package/dist/src/shared/installBaseUtils.js +0 -79
- package/dist/src/shared/installBaseUtils.js.map +0 -1
- package/dist/src/shared/resolveAliases.d.ts +0 -24
- package/dist/src/shared/resolveAliases.d.ts.map +0 -1
- package/dist/src/shared/resolveAliases.js +0 -98
- package/dist/src/shared/resolveAliases.js.map +0 -1
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { cn } from "../utils/cn"
|
|
1
|
+
import { cn } from "../utils/cn";
|
|
2
2
|
|
|
3
|
-
function Skeleton({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
{...props}
|
|
11
|
-
/>
|
|
12
|
-
)
|
|
3
|
+
function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
className={cn("animate-pulse rounded-md bg-border-presentation-global-primary", className)}
|
|
7
|
+
{...props}
|
|
8
|
+
/>
|
|
9
|
+
);
|
|
13
10
|
}
|
|
14
11
|
|
|
15
|
-
export { Skeleton }
|
|
12
|
+
export { Skeleton };
|
|
@@ -1,193 +1,242 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import {
|
|
2
|
+
cloneElement,
|
|
3
|
+
ComponentProps,
|
|
4
|
+
forwardRef,
|
|
5
|
+
isValidElement,
|
|
6
|
+
useState,
|
|
7
|
+
useEffect,
|
|
8
|
+
useRef,
|
|
9
|
+
} from "react";
|
|
10
|
+
import { getDaysInMonth } from "date-fns";
|
|
11
|
+
import Picker from "torch-react-mobile-picker";
|
|
12
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./Popover";
|
|
13
|
+
import { InputField } from "./InputField";
|
|
14
|
+
import { ActionButton } from "./ActionButton";
|
|
15
|
+
import { formatDateValueToString } from "../utils/dateFormat";
|
|
8
16
|
|
|
9
17
|
function getDayArray(year: number, month: number): string[] {
|
|
10
18
|
const dayCount = getDaysInMonth(new Date(year, month - 1));
|
|
11
|
-
return Array.from({ length: dayCount }, (_, i) => String(i + 1).padStart(2,
|
|
19
|
+
return Array.from({ length: dayCount }, (_, i) => String(i + 1).padStart(2, "0"));
|
|
12
20
|
}
|
|
13
21
|
|
|
14
|
-
interface SlideDatePickerProps extends Omit<
|
|
15
|
-
|
|
22
|
+
interface SlideDatePickerProps extends Omit<
|
|
23
|
+
ComponentProps<typeof InputField>,
|
|
24
|
+
"onChange" | "value"
|
|
25
|
+
> {
|
|
26
|
+
onChange?: (e: { target: { value: Date } }) => void;
|
|
16
27
|
theme?: "dark" | "light" | "default";
|
|
17
28
|
dateFormat?: string;
|
|
18
|
-
value?:
|
|
29
|
+
value?: Date;
|
|
19
30
|
}
|
|
20
31
|
|
|
21
32
|
type SlideValues = {
|
|
22
|
-
year: string
|
|
23
|
-
month: string
|
|
24
|
-
day: string
|
|
25
|
-
hour?: string
|
|
26
|
-
minute?: string
|
|
27
|
-
time?: string
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const SlideDatePicker = forwardRef<HTMLInputElement, SlideDatePickerProps>(
|
|
31
|
-
|
|
32
|
-
theme = "dark",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
33
|
+
year: string;
|
|
34
|
+
month: string;
|
|
35
|
+
day: string;
|
|
36
|
+
hour?: string;
|
|
37
|
+
minute?: string;
|
|
38
|
+
time?: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const SlideDatePicker = forwardRef<HTMLInputElement, SlideDatePickerProps>(
|
|
42
|
+
(
|
|
43
|
+
{ theme = "dark", onChange, dateFormat = "yyyy/MM/dd", children, value = new Date(), ...props },
|
|
44
|
+
forwardedRef,
|
|
45
|
+
) => {
|
|
46
|
+
const today = value;
|
|
47
|
+
const defaultPickerValue = {
|
|
48
|
+
year: String(today.getFullYear()),
|
|
49
|
+
month: String(today.getMonth() + 1),
|
|
50
|
+
day: String(today.getDate()),
|
|
51
|
+
hour: String(today.getHours()),
|
|
52
|
+
minute: String(today.getMinutes()),
|
|
53
|
+
time: today.getHours() < 12 ? "AM" : "PM",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const [pickerValue, setPickerValue] = useState<SlideValues>(defaultPickerValue);
|
|
57
|
+
const [date, setDate] = useState<Date>(value);
|
|
58
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
59
|
+
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
60
|
+
|
|
61
|
+
const currentYear = new Date().getFullYear();
|
|
62
|
+
const years = Array.from({ length: 200 }, (_, i) => `${currentYear - 100 + i}`);
|
|
63
|
+
const months = Array.from({ length: 12 }, (_, i) => String(i + 1).padStart(2, ""));
|
|
64
|
+
const days = getDayArray(Number(pickerValue.year), Number(pickerValue.month));
|
|
65
|
+
const monthsNames = [
|
|
66
|
+
"January",
|
|
67
|
+
"February",
|
|
68
|
+
"March",
|
|
69
|
+
"April",
|
|
70
|
+
"May",
|
|
71
|
+
"June",
|
|
72
|
+
"July",
|
|
73
|
+
"August",
|
|
74
|
+
"September",
|
|
75
|
+
"October",
|
|
76
|
+
"November",
|
|
77
|
+
"December",
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
const handlePickerChange = (newValue: SlideValues, key: string) => {
|
|
81
|
+
const { year, month, hour, minute, time } = newValue;
|
|
82
|
+
let { day } = newValue;
|
|
83
|
+
|
|
84
|
+
if (key === "year" || key === "month") {
|
|
85
|
+
const newDayArray = getDayArray(Number(year), Number(month));
|
|
86
|
+
day = newDayArray.includes(day as string) ? day : newDayArray[newDayArray.length - 1];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const updatedValue = { year, month, day, hour, minute, time };
|
|
90
|
+
setPickerValue(updatedValue);
|
|
91
|
+
|
|
92
|
+
// Create a Date object from the updated value
|
|
93
|
+
const newDate = new Date(
|
|
94
|
+
Number(updatedValue.year),
|
|
95
|
+
Number(updatedValue.month) - 1, // Month is 0-indexed in JavaScript Date
|
|
96
|
+
Number(updatedValue.day),
|
|
97
|
+
);
|
|
98
|
+
setDate(newDate);
|
|
99
|
+
|
|
100
|
+
// Call the onChange callback with the Date object
|
|
101
|
+
if (onChange) {
|
|
102
|
+
onChange({
|
|
103
|
+
target: {
|
|
104
|
+
value: newDate,
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const formattedValue = formatDateValueToString(
|
|
111
|
+
date,
|
|
112
|
+
{
|
|
113
|
+
hour: pickerValue.hour ?? defaultPickerValue.hour,
|
|
114
|
+
minute: pickerValue.minute ?? defaultPickerValue.minute,
|
|
115
|
+
time: pickerValue.time ?? defaultPickerValue.time,
|
|
116
|
+
},
|
|
117
|
+
dateFormat,
|
|
80
118
|
);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
}, [isOpen]);
|
|
112
|
-
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
if (onChange) {
|
|
115
|
-
onChange({
|
|
116
|
-
target: {
|
|
117
|
-
value: date
|
|
118
|
-
}
|
|
119
|
-
} as any);
|
|
120
|
-
}
|
|
121
|
-
}, [formattedValue]);
|
|
122
|
-
|
|
123
|
-
return (
|
|
124
|
-
<Popover onOpenChange={setIsOpen}>
|
|
125
|
-
<PopoverTrigger ref={triggerRef} asChild data-theme={theme} className='w-full flex-1' >
|
|
126
|
-
{
|
|
127
|
-
isValidElement(children) ?
|
|
119
|
+
|
|
120
|
+
// Disable body scroll when popover is open
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (isOpen) {
|
|
123
|
+
// Save the current overflow style
|
|
124
|
+
const originalOverflow = document.body.style.overflow;
|
|
125
|
+
document.body.style.overflow = "hidden";
|
|
126
|
+
|
|
127
|
+
// Cleanup function to restore original overflow style
|
|
128
|
+
return () => {
|
|
129
|
+
document.body.style.overflow = originalOverflow;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}, [isOpen]);
|
|
133
|
+
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
if (onChange) {
|
|
136
|
+
onChange({
|
|
137
|
+
target: {
|
|
138
|
+
value: date,
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}, [formattedValue]);
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<Popover onOpenChange={setIsOpen}>
|
|
146
|
+
<PopoverTrigger ref={triggerRef} asChild data-theme={theme} className="w-full flex-1">
|
|
147
|
+
{isValidElement(children) ? (
|
|
128
148
|
cloneElement(children as React.ReactElement<HTMLInputElement>, {
|
|
129
|
-
value:
|
|
149
|
+
value:
|
|
150
|
+
(children as React.ReactElement<HTMLInputElement>).props.value ?? formattedValue,
|
|
130
151
|
type: "input",
|
|
131
|
-
readOnly: true
|
|
152
|
+
readOnly: true,
|
|
132
153
|
})
|
|
133
|
-
|
|
154
|
+
) : (
|
|
134
155
|
/* If the children is not a valid element, Show the default input */
|
|
135
156
|
<InputField
|
|
136
157
|
readOnly
|
|
137
158
|
type="input"
|
|
138
159
|
{...props}
|
|
139
160
|
childrenSide={
|
|
140
|
-
<ActionButton
|
|
141
|
-
|
|
142
|
-
|
|
161
|
+
<ActionButton
|
|
162
|
+
type="button"
|
|
163
|
+
size={"M"}
|
|
164
|
+
onClick={() => {
|
|
165
|
+
triggerRef.current?.click();
|
|
166
|
+
}}
|
|
167
|
+
>
|
|
143
168
|
<i className="ri-calendar-event-fill"></i>
|
|
144
169
|
</ActionButton>
|
|
145
170
|
}
|
|
146
171
|
value={formattedValue}
|
|
147
172
|
ref={forwardedRef}
|
|
148
173
|
/>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
<p className="text-content-system-global-secondary typography-headers-medium-regular px-[18px]">Month</p>
|
|
157
|
-
<span className="h-[13px] w-[1px] bg-border-system-global-secondary rounded-[3px]"></span>
|
|
158
|
-
</div>
|
|
159
|
-
<p className="text-content-system-global-secondary typography-headers-medium-regular">Day</p>
|
|
160
|
-
</div>
|
|
161
|
-
<Picker
|
|
162
|
-
className="flex-1"
|
|
163
|
-
selectContainerClassName="bg-background-system-body-tertiary z-[-1] rounded-[8px]"
|
|
164
|
-
value={pickerValue}
|
|
165
|
-
onChange={handlePickerChange}
|
|
166
|
-
wheelMode="natural"
|
|
174
|
+
)}
|
|
175
|
+
</PopoverTrigger>
|
|
176
|
+
<PopoverContent
|
|
177
|
+
data-theme={theme}
|
|
178
|
+
dir="ltr"
|
|
179
|
+
variant={props.variant}
|
|
180
|
+
className="overflow-hidden w-[285px] flex justify-center items-center p-[6px] pt-[30px]"
|
|
167
181
|
>
|
|
168
|
-
<
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
182
|
+
<div className="flex justify-evenly items-center w-full absolute top-0 py-[6px]">
|
|
183
|
+
<p className="text-content-system-global-secondary typography-headers-medium-regular">
|
|
184
|
+
Year
|
|
185
|
+
</p>
|
|
186
|
+
<div className="flex justify-center items-center self-center">
|
|
187
|
+
<span className="h-[13px] w-[1px] bg-border-system-global-secondary rounded-[3px]"></span>
|
|
188
|
+
<p className="text-content-system-global-secondary typography-headers-medium-regular px-[18px]">
|
|
189
|
+
Month
|
|
190
|
+
</p>
|
|
191
|
+
<span className="h-[13px] w-[1px] bg-border-system-global-secondary rounded-[3px]"></span>
|
|
192
|
+
</div>
|
|
193
|
+
<p className="text-content-system-global-secondary typography-headers-medium-regular">
|
|
194
|
+
Day
|
|
195
|
+
</p>
|
|
196
|
+
</div>
|
|
197
|
+
<Picker
|
|
198
|
+
className="flex-1"
|
|
199
|
+
selectContainerClassName="bg-background-system-body-tertiary z-[-1] rounded-[8px]"
|
|
200
|
+
value={pickerValue}
|
|
201
|
+
onChange={handlePickerChange}
|
|
202
|
+
wheelMode="natural"
|
|
203
|
+
>
|
|
204
|
+
<Picker.Column name="year">
|
|
205
|
+
{years.map((year) => (
|
|
206
|
+
<Picker.Item key={year} value={year}>
|
|
207
|
+
<div className="typography-display-small-semibold text-content-presentation-action-light-primary">
|
|
208
|
+
{year}
|
|
209
|
+
</div>
|
|
210
|
+
</Picker.Item>
|
|
211
|
+
))}
|
|
212
|
+
</Picker.Column>
|
|
213
|
+
<Picker.Column name="month">
|
|
214
|
+
{months.map((month, i) => (
|
|
215
|
+
<Picker.Item key={month} value={month}>
|
|
216
|
+
<div className="typography-display-small-semibold flex gap-1 whitespace-nowrap text-content-presentation-action-light-primary">
|
|
217
|
+
{" "}
|
|
218
|
+
<p className="text-content-presentation-action-light-secondary">
|
|
219
|
+
{monthsNames[i].substring(0, 3)} -{" "}
|
|
220
|
+
</p>
|
|
221
|
+
{month}
|
|
222
|
+
</div>
|
|
223
|
+
</Picker.Item>
|
|
224
|
+
))}
|
|
225
|
+
</Picker.Column>
|
|
226
|
+
<Picker.Column name="day">
|
|
227
|
+
{days.map((day) => (
|
|
228
|
+
<Picker.Item key={day} value={day}>
|
|
229
|
+
<div className="typography-display-small-semibold text-content-presentation-action-light-primary">
|
|
230
|
+
{day}
|
|
231
|
+
</div>
|
|
232
|
+
</Picker.Item>
|
|
233
|
+
))}
|
|
234
|
+
</Picker.Column>
|
|
235
|
+
</Picker>
|
|
236
|
+
</PopoverContent>
|
|
237
|
+
</Popover>
|
|
238
|
+
);
|
|
239
|
+
},
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
SlideDatePicker.displayName = "SlideDatePicker";
|
|
@@ -48,7 +48,7 @@ export function SpinLoading({ className, theme = "light", size = "M", ...props }
|
|
|
48
48
|
/>
|
|
49
49
|
<section
|
|
50
50
|
className={cn(
|
|
51
|
-
"absolute flex justify-center items-center top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"
|
|
51
|
+
"absolute flex justify-center items-center top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2",
|
|
52
52
|
)}
|
|
53
53
|
>
|
|
54
54
|
{props.children}
|
|
@@ -57,9 +57,6 @@ export function SpinLoading({ className, theme = "light", size = "M", ...props }
|
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
60
|
const DarkRingLoadingIcon = (props: HTMLAttributes<HTMLOrSVGElement>) => (
|
|
64
61
|
<svg
|
|
65
62
|
{...props}
|
|
@@ -71,18 +68,8 @@ const DarkRingLoadingIcon = (props: HTMLAttributes<HTMLOrSVGElement>) => (
|
|
|
71
68
|
textRendering="geometricPrecision"
|
|
72
69
|
>
|
|
73
70
|
<defs>
|
|
74
|
-
<filter
|
|
75
|
-
id="e7Ze8cPfGzd3-filter"
|
|
76
|
-
x="-150%"
|
|
77
|
-
width="400%"
|
|
78
|
-
y="-150%"
|
|
79
|
-
height="400%"
|
|
80
|
-
>
|
|
81
|
-
<feGaussianBlur
|
|
82
|
-
id="e7Ze8cPfGzd3-filter-blur-0"
|
|
83
|
-
stdDeviation="4,4"
|
|
84
|
-
result="result"
|
|
85
|
-
/>
|
|
71
|
+
<filter id="e7Ze8cPfGzd3-filter" x="-150%" width="400%" y="-150%" height="400%">
|
|
72
|
+
<feGaussianBlur id="e7Ze8cPfGzd3-filter-blur-0" stdDeviation="4,4" result="result" />
|
|
86
73
|
</filter>
|
|
87
74
|
<linearGradient
|
|
88
75
|
id="e7Ze8cPfGzd4-fill"
|
|
@@ -94,25 +81,11 @@ const DarkRingLoadingIcon = (props: HTMLAttributes<HTMLOrSVGElement>) => (
|
|
|
94
81
|
gradientUnits="userSpaceOnUse"
|
|
95
82
|
gradientTransform="translate(0 0)"
|
|
96
83
|
>
|
|
97
|
-
<stop
|
|
98
|
-
id="e7Ze8cPfGzd4-fill-0"
|
|
99
|
-
offset="0%"
|
|
100
|
-
stopColor="rgba(83,23,255,0)"
|
|
101
|
-
/>
|
|
84
|
+
<stop id="e7Ze8cPfGzd4-fill-0" offset="0%" stopColor="rgba(83,23,255,0)" />
|
|
102
85
|
<stop id="e7Ze8cPfGzd4-fill-1" offset="100%" stopColor="#b900d8" />
|
|
103
86
|
</linearGradient>
|
|
104
|
-
<filter
|
|
105
|
-
id="e7Ze8cPfGzd5-filter"
|
|
106
|
-
x="-150%"
|
|
107
|
-
width="400%"
|
|
108
|
-
y="-150%"
|
|
109
|
-
height="400%"
|
|
110
|
-
>
|
|
111
|
-
<feGaussianBlur
|
|
112
|
-
id="e7Ze8cPfGzd5-filter-blur-0"
|
|
113
|
-
stdDeviation="8,8"
|
|
114
|
-
result="result"
|
|
115
|
-
/>
|
|
87
|
+
<filter id="e7Ze8cPfGzd5-filter" x="-150%" width="400%" y="-150%" height="400%">
|
|
88
|
+
<feGaussianBlur id="e7Ze8cPfGzd5-filter-blur-0" stdDeviation="8,8" result="result" />
|
|
116
89
|
</filter>
|
|
117
90
|
<linearGradient
|
|
118
91
|
id="e7Ze8cPfGzd6-fill"
|
|
@@ -124,11 +97,7 @@ const DarkRingLoadingIcon = (props: HTMLAttributes<HTMLOrSVGElement>) => (
|
|
|
124
97
|
gradientUnits="userSpaceOnUse"
|
|
125
98
|
gradientTransform="translate(0 0)"
|
|
126
99
|
>
|
|
127
|
-
<stop
|
|
128
|
-
id="e7Ze8cPfGzd6-fill-0"
|
|
129
|
-
offset="0%"
|
|
130
|
-
stopColor="rgba(83,23,255,0)"
|
|
131
|
-
/>
|
|
100
|
+
<stop id="e7Ze8cPfGzd6-fill-0" offset="0%" stopColor="rgba(83,23,255,0)" />
|
|
132
101
|
<stop id="e7Ze8cPfGzd6-fill-1" offset="100%" stopColor="#b900d8" />
|
|
133
102
|
</linearGradient>
|
|
134
103
|
<linearGradient
|
|
@@ -141,11 +110,7 @@ const DarkRingLoadingIcon = (props: HTMLAttributes<HTMLOrSVGElement>) => (
|
|
|
141
110
|
gradientUnits="userSpaceOnUse"
|
|
142
111
|
gradientTransform="translate(0 0)"
|
|
143
112
|
>
|
|
144
|
-
<stop
|
|
145
|
-
id="e7Ze8cPfGzd7-fill-0"
|
|
146
|
-
offset="0%"
|
|
147
|
-
stopColor="rgba(83,23,255,0.3)"
|
|
148
|
-
/>
|
|
113
|
+
<stop id="e7Ze8cPfGzd7-fill-0" offset="0%" stopColor="rgba(83,23,255,0.3)" />
|
|
149
114
|
<stop id="e7Ze8cPfGzd7-fill-1" offset="100%" stopColor="#e75cff" />
|
|
150
115
|
</linearGradient>
|
|
151
116
|
</defs>
|
|
@@ -174,14 +139,33 @@ const DarkRingLoadingIcon = (props: HTMLAttributes<HTMLOrSVGElement>) => (
|
|
|
174
139
|
</svg>
|
|
175
140
|
);
|
|
176
141
|
|
|
177
|
-
|
|
178
|
-
|
|
179
142
|
const RingLoadingIcon = (props: HTMLAttributes<HTMLOrSVGElement>) => (
|
|
180
|
-
<svg
|
|
181
|
-
|
|
182
|
-
|
|
143
|
+
<svg
|
|
144
|
+
{...props}
|
|
145
|
+
width="200"
|
|
146
|
+
height="200"
|
|
147
|
+
viewBox="0 0 200 200"
|
|
148
|
+
fill="none"
|
|
149
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
150
|
+
>
|
|
151
|
+
<path
|
|
152
|
+
d="M200 100C200 155.228 155.228 200 100 200C44.7715 200 0 155.228 0 100C0 44.7715 44.7715 0 100 0C155.228 0 200 44.7715 200 100ZM5 100C5 152.467 47.5329 195 100 195C152.467 195 195 152.467 195 100C195 47.5329 152.467 5 100 5C47.5329 5 5 47.5329 5 100Z"
|
|
153
|
+
fill="black"
|
|
154
|
+
fillOpacity="0.1"
|
|
155
|
+
/>
|
|
156
|
+
<path
|
|
157
|
+
d="M197.5 100C198.881 100 200.003 98.8805 199.969 97.5002C199.662 85.22 197.094 73.0938 192.388 61.7317C187.362 49.5991 179.997 38.5752 170.711 29.2893C161.425 20.0035 150.401 12.6375 138.268 7.61205C126.906 2.90567 114.78 0.338305 102.5 0.031247C101.119 -0.00326585 100 1.11929 100 2.5C100 3.88071 101.12 4.99656 102.5 5.03289C114.123 5.33884 125.599 7.77635 136.355 12.2314C147.881 17.0056 158.354 24.0033 167.175 32.8249C175.997 41.6464 182.994 52.1191 187.769 63.6451C192.224 74.4006 194.661 85.8767 194.967 97.5002C195.003 98.8805 196.119 100 197.5 100Z"
|
|
158
|
+
fill="url(#paint0_linear_10856_138364)"
|
|
159
|
+
/>
|
|
183
160
|
<defs>
|
|
184
|
-
<linearGradient
|
|
161
|
+
<linearGradient
|
|
162
|
+
id="paint0_linear_10856_138364"
|
|
163
|
+
x1="3.4045"
|
|
164
|
+
y1="-9.09091"
|
|
165
|
+
x2="225.705"
|
|
166
|
+
y2="19.8973"
|
|
167
|
+
gradientUnits="userSpaceOnUse"
|
|
168
|
+
>
|
|
185
169
|
<stop stopColor="#D500F9" />
|
|
186
170
|
<stop offset="1" stopColor="#5317FF" />
|
|
187
171
|
</linearGradient>
|