@freightos/freightwind 1.0.0 → 1.1.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/LICENSE +21 -0
- package/README.md +28 -0
- package/dist/cjs/components/alert.js +33 -16
- package/dist/cjs/components/avatar.js +53 -58
- package/dist/cjs/components/badge.js +42 -18
- package/dist/cjs/components/button.js +35 -24
- package/dist/cjs/components/checkbox.js +21 -3
- package/dist/cjs/components/chip.js +67 -9
- package/dist/cjs/components/message.js +38 -0
- package/dist/cjs/components/pop-confirm.js +86 -0
- package/dist/cjs/components/radio-button-group.js +31 -35
- package/dist/cjs/components/radio-group.js +2 -1
- package/dist/cjs/components/slider.js +14 -6
- package/dist/cjs/components/switch.js +29 -10
- package/dist/cjs/components/tooltip.js +40 -11
- package/dist/cjs/index.js +38 -84
- package/dist/cjs/lib/icon-utils.js +5 -0
- package/dist/cjs/{components/aspect-ratio.js → lib/use-stable-id.js} +7 -4
- package/dist/cjs/lib/utils.js +18 -1
- package/dist/esm/components/alert.js +34 -17
- package/dist/esm/components/avatar.js +53 -22
- package/dist/esm/components/badge.js +45 -19
- package/dist/esm/components/button.js +36 -25
- package/dist/esm/components/checkbox.js +22 -4
- package/dist/esm/components/chip.js +34 -9
- package/dist/esm/components/message.js +34 -0
- package/dist/esm/components/pop-confirm.js +51 -0
- package/dist/esm/components/radio-button-group.js +31 -33
- package/dist/esm/components/radio-group.js +2 -1
- package/dist/esm/components/slider.js +14 -6
- package/dist/esm/components/switch.js +30 -11
- package/dist/esm/components/tooltip.js +40 -7
- package/dist/esm/index.js +18 -66
- package/dist/esm/lib/icon-utils.js +1 -0
- package/dist/esm/lib/use-stable-id.js +6 -0
- package/dist/esm/lib/utils.js +18 -1
- package/dist/types/components/alert.d.ts +5 -5
- package/dist/types/components/avatar.d.ts +14 -19
- package/dist/types/components/badge.d.ts +22 -8
- package/dist/types/components/button.d.ts +15 -9
- package/dist/types/components/checkbox.d.ts +8 -2
- package/dist/types/components/chip.d.ts +14 -8
- package/dist/types/components/message.d.ts +14 -0
- package/dist/types/components/pop-confirm.d.ts +28 -0
- package/dist/types/components/radio-button-group.d.ts +19 -14
- package/dist/types/components/slider.d.ts +10 -2
- package/dist/types/components/switch.d.ts +7 -6
- package/dist/types/components/tooltip.d.ts +9 -6
- package/dist/types/index.d.ts +25 -61
- package/dist/types/lib/icon-utils.d.ts +1 -0
- package/dist/types/lib/use-stable-id.d.ts +1 -0
- package/guidelines/Guidelines.md +54 -0
- package/guidelines/design-tokens/colors.md +81 -0
- package/guidelines/design-tokens/spacing.md +45 -0
- package/guidelines/design-tokens/typography.md +50 -0
- package/guidelines/overview-components.md +252 -0
- package/guidelines/overview-icons.md +52 -0
- package/package.json +63 -54
- package/tokens.css +409 -0
- package/dist/cjs/components/accordion.js +0 -57
- package/dist/cjs/components/breadcrumb.js +0 -65
- package/dist/cjs/components/calendar.js +0 -106
- package/dist/cjs/components/card.js +0 -59
- package/dist/cjs/components/chart.js +0 -176
- package/dist/cjs/components/collapsible.js +0 -43
- package/dist/cjs/components/command.js +0 -73
- package/dist/cjs/components/context-menu.js +0 -83
- package/dist/cjs/components/country-select.js +0 -155
- package/dist/cjs/components/date-picker.js +0 -59
- package/dist/cjs/components/date-range-picker.js +0 -59
- package/dist/cjs/components/date-time-picker.js +0 -106
- package/dist/cjs/components/dialog.js +0 -70
- package/dist/cjs/components/drawer.js +0 -68
- package/dist/cjs/components/dropdown-menu.js +0 -85
- package/dist/cjs/components/empty.js +0 -42
- package/dist/cjs/components/file-preview.js +0 -73
- package/dist/cjs/components/form.js +0 -106
- package/dist/cjs/components/inline-edit.js +0 -83
- package/dist/cjs/components/input-group.js +0 -70
- package/dist/cjs/components/input-otp.js +0 -58
- package/dist/cjs/components/input.js +0 -57
- package/dist/cjs/components/label.js +0 -45
- package/dist/cjs/components/menubar.js +0 -96
- package/dist/cjs/components/navigation-menu.js +0 -68
- package/dist/cjs/components/pagination.js +0 -65
- package/dist/cjs/components/phone-input.js +0 -218
- package/dist/cjs/components/popover.js +0 -49
- package/dist/cjs/components/progress.js +0 -43
- package/dist/cjs/components/resizable.js +0 -47
- package/dist/cjs/components/rich-text-editor.js +0 -152
- package/dist/cjs/components/route.js +0 -47
- package/dist/cjs/components/scroll-area.js +0 -48
- package/dist/cjs/components/select.js +0 -71
- package/dist/cjs/components/separator.js +0 -43
- package/dist/cjs/components/sheet.js +0 -245
- package/dist/cjs/components/skeleton.js +0 -8
- package/dist/cjs/components/sonner.js +0 -25
- package/dist/cjs/components/spinner.js +0 -25
- package/dist/cjs/components/stepper.js +0 -99
- package/dist/cjs/components/steps.js +0 -127
- package/dist/cjs/components/table.js +0 -66
- package/dist/cjs/components/tabs.js +0 -51
- package/dist/cjs/components/textarea.js +0 -44
- package/dist/cjs/components/time-picker.js +0 -110
- package/dist/cjs/components/toast.js +0 -75
- package/dist/cjs/components/toaster.js +0 -12
- package/dist/cjs/components/toggle-group.js +0 -58
- package/dist/cjs/components/toggle.js +0 -62
- package/dist/cjs/hooks/use-toast.js +0 -166
- package/dist/cjs/lib/countryUtils.js +0 -93
- package/dist/esm/components/accordion.js +0 -18
- package/dist/esm/components/aspect-ratio.js +0 -3
- package/dist/esm/components/breadcrumb.js +0 -23
- package/dist/esm/components/calendar.js +0 -70
- package/dist/esm/components/card.js +0 -18
- package/dist/esm/components/chart.js +0 -135
- package/dist/esm/components/collapsible.js +0 -5
- package/dist/esm/components/command.js +0 -29
- package/dist/esm/components/context-menu.js +0 -33
- package/dist/esm/components/country-select.js +0 -118
- package/dist/esm/components/date-picker.js +0 -23
- package/dist/esm/components/date-range-picker.js +0 -23
- package/dist/esm/components/date-time-picker.js +0 -70
- package/dist/esm/components/dialog.js +0 -24
- package/dist/esm/components/drawer.js +0 -23
- package/dist/esm/components/dropdown-menu.js +0 -35
- package/dist/esm/components/empty.js +0 -6
- package/dist/esm/components/file-preview.js +0 -69
- package/dist/esm/components/form.js +0 -63
- package/dist/esm/components/inline-edit.js +0 -47
- package/dist/esm/components/input-group.js +0 -63
- package/dist/esm/components/input-otp.js +0 -19
- package/dist/esm/components/input.js +0 -21
- package/dist/esm/components/label.js +0 -9
- package/dist/esm/components/menubar.js +0 -45
- package/dist/esm/components/navigation-menu.js +0 -24
- package/dist/esm/components/pagination.js +0 -23
- package/dist/esm/components/phone-input.js +0 -181
- package/dist/esm/components/popover.js +0 -10
- package/dist/esm/components/progress.js +0 -7
- package/dist/esm/components/resizable.js +0 -9
- package/dist/esm/components/rich-text-editor.js +0 -145
- package/dist/esm/components/route.js +0 -11
- package/dist/esm/components/scroll-area.js +0 -11
- package/dist/esm/components/select.js +0 -26
- package/dist/esm/components/separator.js +0 -7
- package/dist/esm/components/sheet.js +0 -197
- package/dist/esm/components/skeleton.js +0 -6
- package/dist/esm/components/sonner.js +0 -22
- package/dist/esm/components/spinner.js +0 -21
- package/dist/esm/components/stepper.js +0 -57
- package/dist/esm/components/steps.js +0 -80
- package/dist/esm/components/table.js +0 -22
- package/dist/esm/components/tabs.js +0 -12
- package/dist/esm/components/textarea.js +0 -8
- package/dist/esm/components/time-picker.js +0 -74
- package/dist/esm/components/toast.js +0 -33
- package/dist/esm/components/toaster.js +0 -9
- package/dist/esm/components/toggle-group.js +0 -21
- package/dist/esm/components/toggle.js +0 -25
- package/dist/esm/hooks/use-toast.js +0 -128
- package/dist/esm/lib/countryUtils.js +0 -87
- package/dist/styles.css +0 -152
- package/dist/types/components/accordion.d.ts +0 -11
- package/dist/types/components/aspect-ratio.d.ts +0 -3
- package/dist/types/components/breadcrumb.d.ts +0 -19
- package/dist/types/components/calendar.d.ts +0 -7
- package/dist/types/components/card.d.ts +0 -11
- package/dist/types/components/chart.d.ts +0 -66
- package/dist/types/components/collapsible.d.ts +0 -5
- package/dist/types/components/command.d.ts +0 -80
- package/dist/types/components/context-menu.d.ts +0 -27
- package/dist/types/components/country-select.d.ts +0 -17
- package/dist/types/components/date-picker.d.ts +0 -9
- package/dist/types/components/date-range-picker.d.ts +0 -10
- package/dist/types/components/date-time-picker.d.ts +0 -10
- package/dist/types/components/dialog.d.ts +0 -23
- package/dist/types/components/drawer.d.ts +0 -22
- package/dist/types/components/dropdown-menu.d.ts +0 -27
- package/dist/types/components/empty.d.ts +0 -6
- package/dist/types/components/file-preview.d.ts +0 -9
- package/dist/types/components/form.d.ts +0 -23
- package/dist/types/components/inline-edit.d.ts +0 -10
- package/dist/types/components/input-group.d.ts +0 -16
- package/dist/types/components/input-otp.d.ts +0 -34
- package/dist/types/components/input.d.ts +0 -9
- package/dist/types/components/label.d.ts +0 -5
- package/dist/types/components/menubar.d.ts +0 -28
- package/dist/types/components/navigation-menu.d.ts +0 -12
- package/dist/types/components/pagination.d.ts +0 -29
- package/dist/types/components/phone-input.d.ts +0 -20
- package/dist/types/components/popover.d.ts +0 -9
- package/dist/types/components/progress.d.ts +0 -4
- package/dist/types/components/resizable.d.ts +0 -23
- package/dist/types/components/rich-text-editor.d.ts +0 -8
- package/dist/types/components/route.d.ts +0 -10
- package/dist/types/components/scroll-area.d.ts +0 -5
- package/dist/types/components/select.d.ts +0 -13
- package/dist/types/components/separator.d.ts +0 -4
- package/dist/types/components/sheet.d.ts +0 -49
- package/dist/types/components/skeleton.d.ts +0 -2
- package/dist/types/components/sonner.d.ts +0 -4
- package/dist/types/components/spinner.d.ts +0 -8
- package/dist/types/components/stepper.d.ts +0 -17
- package/dist/types/components/steps.d.ts +0 -64
- package/dist/types/components/table.d.ts +0 -14
- package/dist/types/components/tabs.d.ts +0 -7
- package/dist/types/components/textarea.d.ts +0 -3
- package/dist/types/components/time-picker.d.ts +0 -10
- package/dist/types/components/toast.d.ts +0 -15
- package/dist/types/components/toaster.d.ts +0 -1
- package/dist/types/components/toggle-group.d.ts +0 -12
- package/dist/types/components/toggle.d.ts +0 -12
- package/dist/types/hooks/use-toast.d.ts +0 -44
- package/dist/types/lib/countryUtils.d.ts +0 -20
- package/tailwind-preset.js +0 -70
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
5
|
-
import { cva } from 'class-variance-authority';
|
|
6
|
-
import { X } from 'lucide-react';
|
|
7
|
-
import { cn } from '../lib/utils';
|
|
8
|
-
const SheetContext = React.createContext({
|
|
9
|
-
level: 0,
|
|
10
|
-
parentSheetWidth: undefined,
|
|
11
|
-
registerNestedSheet: () => { },
|
|
12
|
-
unregisterNestedSheet: () => { },
|
|
13
|
-
hasNestedSheetOpen: false,
|
|
14
|
-
nestedSheetWidth: undefined,
|
|
15
|
-
});
|
|
16
|
-
export const useSheetContext = () => React.useContext(SheetContext);
|
|
17
|
-
// Sheet wrapper that provides context
|
|
18
|
-
const SheetProvider = ({ children, width }) => {
|
|
19
|
-
const parentContext = useSheetContext();
|
|
20
|
-
const [nestedSheetCount, setNestedSheetCount] = React.useState(0);
|
|
21
|
-
const registerNestedSheet = React.useCallback(() => {
|
|
22
|
-
setNestedSheetCount((count) => count + 1);
|
|
23
|
-
}, []);
|
|
24
|
-
const unregisterNestedSheet = React.useCallback(() => {
|
|
25
|
-
setNestedSheetCount((count) => Math.max(0, count - 1));
|
|
26
|
-
}, []);
|
|
27
|
-
const contextValue = React.useMemo(() => ({
|
|
28
|
-
level: parentContext.level + 1,
|
|
29
|
-
parentSheetWidth: width,
|
|
30
|
-
registerNestedSheet,
|
|
31
|
-
unregisterNestedSheet,
|
|
32
|
-
hasNestedSheetOpen: nestedSheetCount > 0,
|
|
33
|
-
}), [
|
|
34
|
-
parentContext.level,
|
|
35
|
-
width,
|
|
36
|
-
registerNestedSheet,
|
|
37
|
-
unregisterNestedSheet,
|
|
38
|
-
nestedSheetCount,
|
|
39
|
-
]);
|
|
40
|
-
return (_jsx(SheetContext.Provider, { value: contextValue, children: children }));
|
|
41
|
-
};
|
|
42
|
-
const SheetRoot = ({ open, width, ...props }) => {
|
|
43
|
-
const parentContext = useSheetContext();
|
|
44
|
-
// Register/unregister when open state changes
|
|
45
|
-
React.useEffect(() => {
|
|
46
|
-
if (open && parentContext.level > 0) {
|
|
47
|
-
parentContext.registerNestedSheet(width);
|
|
48
|
-
return () => {
|
|
49
|
-
parentContext.unregisterNestedSheet();
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return undefined;
|
|
53
|
-
}, [open, parentContext, width]);
|
|
54
|
-
return _jsx(SheetPrimitive.Root, { open: open, ...props });
|
|
55
|
-
};
|
|
56
|
-
const Sheet = SheetRoot;
|
|
57
|
-
const SheetTrigger = SheetPrimitive.Trigger;
|
|
58
|
-
const SheetClose = SheetPrimitive.Close;
|
|
59
|
-
const SheetPortal = SheetPrimitive.Portal;
|
|
60
|
-
const SheetOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Overlay, { className: cn('fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0', className), ...props, ref: ref })));
|
|
61
|
-
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
62
|
-
const sheetVariants = cva('fixed bg-background shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out bg-card flex flex-col', {
|
|
63
|
-
variants: {
|
|
64
|
-
side: {
|
|
65
|
-
top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
|
|
66
|
-
bottom: 'inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom',
|
|
67
|
-
left: 'inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm',
|
|
68
|
-
right: 'inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm',
|
|
69
|
-
},
|
|
70
|
-
zIndex: {
|
|
71
|
-
default: 'z-50',
|
|
72
|
-
high: 'z-[1100]',
|
|
73
|
-
pushed: 'z-[1150]', // Between high (1100) and nested overlay (1199)
|
|
74
|
-
nested: 'z-[1200]',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
defaultVariants: {
|
|
78
|
-
side: 'right',
|
|
79
|
-
zIndex: 'default',
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
const SheetContent = React.forwardRef(({ side = 'right', zIndex = 'default', className, overlayClassName, hideCloseButton = false, sheetWidth, children, ...props }, ref) => {
|
|
83
|
-
// Read the parent context BEFORE potentially wrapping with SheetProvider
|
|
84
|
-
const parentContext = useSheetContext();
|
|
85
|
-
// Track nested sheets for THIS sheet using local state
|
|
86
|
-
const [localNestedSheetCount, setLocalNestedSheetCount] = React.useState(0);
|
|
87
|
-
const [localNestedSheetWidth, setLocalNestedSheetWidth] = React.useState();
|
|
88
|
-
const closeTimeoutRef = React.useRef(null);
|
|
89
|
-
const registerLocalNestedSheet = React.useCallback((width) => {
|
|
90
|
-
// Clear any pending close timeout when opening a new nested sheet
|
|
91
|
-
if (closeTimeoutRef.current) {
|
|
92
|
-
clearTimeout(closeTimeoutRef.current);
|
|
93
|
-
closeTimeoutRef.current = null;
|
|
94
|
-
}
|
|
95
|
-
setLocalNestedSheetCount((count) => count + 1);
|
|
96
|
-
if (width) {
|
|
97
|
-
setLocalNestedSheetWidth(width);
|
|
98
|
-
}
|
|
99
|
-
}, []);
|
|
100
|
-
const unregisterLocalNestedSheet = React.useCallback(() => {
|
|
101
|
-
setLocalNestedSheetCount((count) => Math.max(0, count - 1));
|
|
102
|
-
setLocalNestedSheetWidth(undefined);
|
|
103
|
-
// Clear any existing timeout
|
|
104
|
-
if (closeTimeoutRef.current) {
|
|
105
|
-
clearTimeout(closeTimeoutRef.current);
|
|
106
|
-
closeTimeoutRef.current = null;
|
|
107
|
-
}
|
|
108
|
-
}, []);
|
|
109
|
-
// Cleanup timeout on unmount
|
|
110
|
-
React.useEffect(() => {
|
|
111
|
-
return () => {
|
|
112
|
-
if (closeTimeoutRef.current) {
|
|
113
|
-
clearTimeout(closeTimeoutRef.current);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
}, []);
|
|
117
|
-
// This sheet should be pushed if IT has nested sheets open
|
|
118
|
-
const shouldBePushed = localNestedSheetCount > 0 && sheetWidth;
|
|
119
|
-
// Create a custom context value that uses THIS sheet's local nested sheet tracking
|
|
120
|
-
const customContextValue = React.useMemo(() => ({
|
|
121
|
-
level: parentContext.level + 1,
|
|
122
|
-
parentSheetWidth: sheetWidth,
|
|
123
|
-
registerNestedSheet: registerLocalNestedSheet,
|
|
124
|
-
unregisterNestedSheet: unregisterLocalNestedSheet,
|
|
125
|
-
hasNestedSheetOpen: localNestedSheetCount > 0,
|
|
126
|
-
nestedSheetWidth: localNestedSheetWidth,
|
|
127
|
-
}), [
|
|
128
|
-
parentContext.level,
|
|
129
|
-
sheetWidth,
|
|
130
|
-
registerLocalNestedSheet,
|
|
131
|
-
unregisterLocalNestedSheet,
|
|
132
|
-
localNestedSheetCount,
|
|
133
|
-
localNestedSheetWidth,
|
|
134
|
-
]);
|
|
135
|
-
// Wrap children with context provider if sheetWidth is provided
|
|
136
|
-
const wrappedChildren = sheetWidth ? (_jsx(SheetContext.Provider, { value: customContextValue, children: children })) : (children);
|
|
137
|
-
// Determine z-index based on nesting level AND pushed state
|
|
138
|
-
// A sheet is nested if its parent level >= 1 (meaning it's inside another sheet)
|
|
139
|
-
let effectiveZIndex = parentContext.level >= 1 ? 'nested' : zIndex;
|
|
140
|
-
const isNestedSheet = parentContext.level >= 1;
|
|
141
|
-
// When pushed, keep the same z-index (it will be under nested sheet's overlay anyway)
|
|
142
|
-
// Don't change z-index when pushed - the nested overlay (z-1199) will be above this (z-1100)
|
|
143
|
-
// Calculate overlay z-index
|
|
144
|
-
const overlayZIndex = effectiveZIndex === 'nested'
|
|
145
|
-
? 1199
|
|
146
|
-
: effectiveZIndex === 'high'
|
|
147
|
-
? 1099
|
|
148
|
-
: 50;
|
|
149
|
-
// Animation timing classes
|
|
150
|
-
const animationClasses = 'data-[state=closed]:duration-300 data-[state=open]:duration-500';
|
|
151
|
-
// Calculate transform for pushed state
|
|
152
|
-
// Strategy: During close, parent slides back at same speed as nested slides out
|
|
153
|
-
// Both travel in the positive direction (to the right) so they stick together
|
|
154
|
-
const transformStyle = shouldBePushed && localNestedSheetWidth
|
|
155
|
-
? {
|
|
156
|
-
// Opening: animate to pushed position (move left)
|
|
157
|
-
transform: `translate3d(-${localNestedSheetWidth}, 0, 0)`,
|
|
158
|
-
transition: 'transform 500ms linear',
|
|
159
|
-
}
|
|
160
|
-
: {
|
|
161
|
-
// Closing: animate back to center (move right)
|
|
162
|
-
transform: 'translate3d(0, 0, 0)',
|
|
163
|
-
transition: 'transform 300ms linear',
|
|
164
|
-
};
|
|
165
|
-
const inlineStyle = {
|
|
166
|
-
...transformStyle,
|
|
167
|
-
// Force GPU acceleration for both sheets to ensure smooth, synchronized animations
|
|
168
|
-
willChange: 'transform',
|
|
169
|
-
// For nested sheets, override animation timing to linear
|
|
170
|
-
...(isNestedSheet && {
|
|
171
|
-
animationTimingFunction: 'linear',
|
|
172
|
-
}),
|
|
173
|
-
};
|
|
174
|
-
// Debug logging
|
|
175
|
-
// console.log('📊 Sheet render:', {
|
|
176
|
-
// level: parentContext.level,
|
|
177
|
-
// hasNestedSheetOpen: parentContext.hasNestedSheetOpen,
|
|
178
|
-
// parentSheetWidth: parentContext.parentSheetWidth,
|
|
179
|
-
// shouldBePushed,
|
|
180
|
-
// effectiveZIndex,
|
|
181
|
-
// overlayZIndex,
|
|
182
|
-
// sheetWidth,
|
|
183
|
-
// });
|
|
184
|
-
return (_jsxs(SheetPortal, { children: [!shouldBePushed && !localNestedSheetWidth && (_jsx(SheetOverlay, { className: overlayClassName, style: { zIndex: overlayZIndex } })), _jsxs(SheetPrimitive.Content, { ref: ref, className: cn(sheetVariants({ side, zIndex: effectiveZIndex }), animationClasses, shouldBePushed && 'pointer-events-none', className), style: inlineStyle, ...props, children: [wrappedChildren, !hideCloseButton && (_jsxs(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [_jsx(X, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
|
185
|
-
});
|
|
186
|
-
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
187
|
-
const SheetHeader = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-shrink-0 flex-col space-y-2 px-fds-xl py-fds-xl', className), ...props }));
|
|
188
|
-
SheetHeader.displayName = 'SheetHeader';
|
|
189
|
-
const SheetBody = ({ className, ...props }) => (_jsx("div", { className: cn('flex-1 overflow-y-auto px-fds-xl', className), ...props }));
|
|
190
|
-
SheetBody.displayName = 'SheetBody';
|
|
191
|
-
const SheetFooter = ({ className, ...props }) => (_jsx("div", { className: cn('flex-shrink-0 border-t border-fds-gray-20 px-fds-xl py-fds-xl', className), ...props }));
|
|
192
|
-
SheetFooter.displayName = 'SheetFooter';
|
|
193
|
-
const SheetTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Title, { ref: ref, className: cn('text-fds-h3 font-fds-bold', className), ...props })));
|
|
194
|
-
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
195
|
-
const SheetDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Description, { ref: ref, className: cn('text-sm text-muted-foreground', className), ...props })));
|
|
196
|
-
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
197
|
-
export { Sheet, SheetProvider, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetBody, SheetFooter, SheetTitle, SheetDescription, };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { CircleCheck, Info, LoaderCircle, OctagonX, TriangleAlert, } from "lucide-react";
|
|
3
|
-
import { useTheme } from "next-themes";
|
|
4
|
-
import { Toaster as Sonner } from "sonner";
|
|
5
|
-
const Toaster = ({ ...props }) => {
|
|
6
|
-
const { theme = "system" } = useTheme();
|
|
7
|
-
return (_jsx(Sonner, { theme: theme, className: "toaster group", icons: {
|
|
8
|
-
success: _jsx(CircleCheck, { className: "h-4 w-4" }),
|
|
9
|
-
info: _jsx(Info, { className: "h-4 w-4" }),
|
|
10
|
-
warning: _jsx(TriangleAlert, { className: "h-4 w-4" }),
|
|
11
|
-
error: _jsx(OctagonX, { className: "h-4 w-4" }),
|
|
12
|
-
loading: _jsx(LoaderCircle, { className: "h-4 w-4 animate-spin" }),
|
|
13
|
-
}, toastOptions: {
|
|
14
|
-
classNames: {
|
|
15
|
-
toast: "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
|
|
16
|
-
description: "group-[.toast]:text-muted-foreground",
|
|
17
|
-
actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
|
|
18
|
-
cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
|
|
19
|
-
},
|
|
20
|
-
}, ...props }));
|
|
21
|
-
};
|
|
22
|
-
export { Toaster };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { IconLoading } from '@freightos/icons';
|
|
3
|
-
import { cn } from '../lib/utils';
|
|
4
|
-
import { cva } from 'class-variance-authority';
|
|
5
|
-
const spinnerVariants = cva('text-[var(--fds-color-primary-blue)] animate-spin inline-flex items-center justify-center align-middle', {
|
|
6
|
-
variants: {
|
|
7
|
-
size: {
|
|
8
|
-
tiny: 'size-3', // 12px
|
|
9
|
-
small: 'size-4', // 16px
|
|
10
|
-
medium: 'size-6', // 24px
|
|
11
|
-
large: 'size-8', // 32px
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
defaultVariants: {
|
|
15
|
-
size: 'medium',
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
function Spinner({ className, size, ...props }) {
|
|
19
|
-
return (_jsx("span", { role: "status", "aria-label": "Loading", className: cn(spinnerVariants({ size, className })), ...props, children: _jsx(IconLoading, { className: "w-full h-full" }) }));
|
|
20
|
-
}
|
|
21
|
-
export { Spinner, spinnerVariants };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { cn } from "../lib/utils";
|
|
5
|
-
const StepperContext = React.createContext(null);
|
|
6
|
-
const useStepper = () => {
|
|
7
|
-
const context = React.useContext(StepperContext);
|
|
8
|
-
if (!context) {
|
|
9
|
-
throw new Error("Stepper components must be used within a Stepper");
|
|
10
|
-
}
|
|
11
|
-
return context;
|
|
12
|
-
};
|
|
13
|
-
const Stepper = React.forwardRef(({ className, defaultValue = 1, value, orientation = "horizontal", children, ...props }, ref) => {
|
|
14
|
-
const currentValue = value ?? defaultValue;
|
|
15
|
-
return (_jsx(StepperContext.Provider, { value: { value: currentValue, orientation }, children: _jsx("div", { ref: ref, "data-orientation": orientation, className: cn("group/stepper flex w-full", orientation === "horizontal" ? "flex-row items-start" : "flex-col", className), ...props, children: children }) }));
|
|
16
|
-
});
|
|
17
|
-
Stepper.displayName = "Stepper";
|
|
18
|
-
const StepperItemContext = React.createContext(null);
|
|
19
|
-
const useStepperItem = () => {
|
|
20
|
-
const context = React.useContext(StepperItemContext);
|
|
21
|
-
if (!context) {
|
|
22
|
-
throw new Error("StepperItem components must be used within a StepperItem");
|
|
23
|
-
}
|
|
24
|
-
return context;
|
|
25
|
-
};
|
|
26
|
-
const StepperItem = React.forwardRef(({ className, step, children, ...props }, ref) => {
|
|
27
|
-
const { value } = useStepper();
|
|
28
|
-
const isActive = step === value;
|
|
29
|
-
const isCompleted = step < value;
|
|
30
|
-
return (_jsx(StepperItemContext.Provider, { value: { step, isActive, isCompleted }, children: _jsx("div", { ref: ref, "data-state": isActive ? "active" : isCompleted ? "completed" : "inactive", className: cn("relative flex items-center", className), ...props, children: children }) }));
|
|
31
|
-
});
|
|
32
|
-
StepperItem.displayName = "StepperItem";
|
|
33
|
-
const StepperTrigger = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
34
|
-
return (_jsx("div", { ref: ref, className: cn("flex items-center gap-2", className), ...props, children: children }));
|
|
35
|
-
});
|
|
36
|
-
StepperTrigger.displayName = "StepperTrigger";
|
|
37
|
-
const StepperIndicator = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
38
|
-
const { isActive, isCompleted, step } = useStepperItem();
|
|
39
|
-
return (_jsx("div", { ref: ref, className: cn("flex shrink-0 items-center justify-center rounded-full text-fds-xs transition-colors relative z-10", "h-[18px] w-[18px] font-fds-extrabold", isCompleted && "bg-fds-blue-20 text-white", isActive && "bg-fds-blue-20 text-white border-[0.5px] border-white shadow-[0_0_0_2px] shadow-fds-blue-20", !isActive && !isCompleted && "bg-fds-gray-10 text-fds-gray-60", className), ...props, children: (isActive || isCompleted) && (children || step) }));
|
|
40
|
-
});
|
|
41
|
-
StepperIndicator.displayName = "StepperIndicator";
|
|
42
|
-
const StepperTitle = React.forwardRef(({ className, ...props }, ref) => {
|
|
43
|
-
const { isActive, isCompleted } = useStepperItem();
|
|
44
|
-
return (_jsx("p", { ref: ref, className: cn("!text-fds-xs transition-colors", isActive && "font-fds-semibold text-foreground", isCompleted && "font-fds-regular text-foreground", !isActive && !isCompleted && "text-fds-gray-50", className), ...props }));
|
|
45
|
-
});
|
|
46
|
-
StepperTitle.displayName = "StepperTitle";
|
|
47
|
-
const StepperDescription = React.forwardRef(({ className, ...props }, ref) => {
|
|
48
|
-
return (_jsx("p", { ref: ref, className: cn("text-muted-foreground text-sm", className), ...props }));
|
|
49
|
-
});
|
|
50
|
-
StepperDescription.displayName = "StepperDescription";
|
|
51
|
-
const StepperSeparator = React.forwardRef(({ className, ...props }, ref) => {
|
|
52
|
-
const { orientation } = useStepper();
|
|
53
|
-
const { isCompleted } = useStepperItem();
|
|
54
|
-
return (_jsx("div", { ref: ref, className: cn("shrink-0 transition-colors", isCompleted ? "bg-fds-blue-20" : "bg-fds-gray-10", orientation === "horizontal" ? "h-[2px] w-full" : "h-full w-[2px]", className), ...props }));
|
|
55
|
-
});
|
|
56
|
-
StepperSeparator.displayName = "StepperSeparator";
|
|
57
|
-
export { Stepper, StepperItem, StepperTrigger, StepperIndicator, StepperTitle, StepperDescription, StepperSeparator, };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '../lib/utils';
|
|
4
|
-
import { IconCaretDown, IconCheck } from '@freightos/icons';
|
|
5
|
-
import { cva } from 'class-variance-authority';
|
|
6
|
-
import * as React from 'react';
|
|
7
|
-
const StepGroupContext = React.createContext({
|
|
8
|
-
isInsideGroup: false,
|
|
9
|
-
});
|
|
10
|
-
const StepsContainer = ({ children, className, }) => {
|
|
11
|
-
return _jsx("div", { className: cn('flex flex-col', className), children: children });
|
|
12
|
-
};
|
|
13
|
-
StepsContainer.displayName = 'StepsContainer';
|
|
14
|
-
const StepGroup = ({ icon, title, children, className, showLineAbove = false, showLineBelow = false, lineAboveCompleted = false, lineBelowCompleted = false, defaultOpen = true, }) => {
|
|
15
|
-
const [isOpen, setIsOpen] = React.useState(defaultOpen);
|
|
16
|
-
const hasChildren = React.Children.count(children) > 0;
|
|
17
|
-
return (_jsx(StepGroupContext.Provider, { value: { isInsideGroup: true }, children: _jsxs("div", { className: cn('flex flex-col', className), children: [showLineAbove && (_jsx("div", { className: "relative flex h-4 gap-fds-md overflow-hidden", children: _jsx("div", { className: "relative flex w-4 flex-shrink-0 justify-center", children: _jsx("div", { className: cn('absolute bottom-0 left-[7px] top-0 w-0 border-l-2', lineAboveCompleted
|
|
18
|
-
? 'border-fds-blue-20'
|
|
19
|
-
: 'border-fds-gray-10') }) }) })), _jsxs("div", { className: "relative flex items-center gap-fds-md", children: [_jsxs("div", { className: "relative flex w-4 flex-shrink-0 flex-col items-center", children: [_jsx("div", { className: "relative z-10 flex h-6 w-6 items-center justify-center rounded-full bg-fds-blue-10 text-fds-gray-50 ring-4 ring-white dark:ring-transparent", children: icon }), hasChildren && isOpen && (_jsx("div", { className: cn('absolute bottom-[-8px] left-[7px] top-6 w-0 border-l-2', lineBelowCompleted
|
|
20
|
-
? 'border-fds-blue-20'
|
|
21
|
-
: 'border-fds-gray-10') })), !isOpen && showLineBelow && (_jsx("div", { className: cn('absolute bottom-[-24px] left-[7px] top-6 w-0 border-l-2', lineBelowCompleted
|
|
22
|
-
? 'border-fds-blue-20'
|
|
23
|
-
: 'border-fds-gray-10') }))] }), _jsxs("button", { type: "button", onClick: () => setIsOpen(!isOpen), className: "flex flex-1 items-center justify-between py-fds-xs", children: [_jsx("span", { className: "text-fds-h6 font-fds-bold", children: title }), hasChildren && (_jsx(IconCaretDown, { size: 18, className: cn('text-fds-gray-50 transition-transform duration-200', isOpen && 'rotate-180') }))] })] }), _jsx("div", { className: cn('grid transition-[grid-template-rows] duration-300 ease-in-out', isOpen ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]'), children: _jsx("div", { className: "overflow-hidden", children: children }) })] }) }));
|
|
24
|
-
};
|
|
25
|
-
StepGroup.displayName = 'StepGroup';
|
|
26
|
-
const StepSubGroup = ({ children, label, className, lineColor = 'gray', }) => {
|
|
27
|
-
const borderClass = lineColor === 'blue' ? 'border-fds-blue-20' : 'border-fds-gray-10';
|
|
28
|
-
return (_jsxs("div", { className: cn('relative', className), children: [_jsxs("div", { className: "relative flex gap-fds-md", children: [_jsx("div", { className: "relative w-4 flex-shrink-0", children: _jsx("div", { className: cn('absolute bottom-0 left-[7px] top-0 w-0 border-l-2', borderClass) }) }), _jsx("div", { className: "flex-1 border-t border-dashed border-border" })] }), children, _jsxs("div", { className: "relative flex gap-fds-md", children: [_jsx("div", { className: "relative w-4 flex-shrink-0", children: _jsx("div", { className: cn('absolute bottom-0 left-[7px] top-0 w-0 border-l-2', borderClass) }) }), _jsx("div", { className: "flex-1 border-t border-dashed border-border" })] }), label && (_jsx("div", { className: "absolute right-0 top-1/2 -translate-y-1/2", children: label }))] }));
|
|
29
|
-
};
|
|
30
|
-
StepSubGroup.displayName = 'StepSubGroup';
|
|
31
|
-
/* -----------------------------------------------------------------------------
|
|
32
|
-
* Step - Individual step item
|
|
33
|
-
* -------------------------------------------------------------------------- */
|
|
34
|
-
const stepIndicatorVariants = cva('flex items-center justify-center rounded-full', {
|
|
35
|
-
variants: {
|
|
36
|
-
status: {
|
|
37
|
-
completed: 'h-[16px] w-[16px] bg-fds-blue text-white',
|
|
38
|
-
active: 'h-[16px] w-[16px] border-2 border-fds-blue bg-white dark:bg-transparent',
|
|
39
|
-
pending: 'h-[16px] w-[16px] border-2 border-dashed border-fds-gray-30 bg-white dark:bg-transparent',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
defaultVariants: {
|
|
43
|
-
status: 'pending',
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
const Step = ({ status = 'pending', showLine = true, progressReached = false, nextStepCompleted = false, children, className, meta, }) => {
|
|
47
|
-
const isCompleted = status === 'completed';
|
|
48
|
-
const { isInsideGroup } = React.useContext(StepGroupContext);
|
|
49
|
-
// Visual status: show as completed if progress has reached this step
|
|
50
|
-
const visuallyCompleted = isCompleted || progressReached;
|
|
51
|
-
const visualStatus = visuallyCompleted ? 'completed' : status;
|
|
52
|
-
// Line colors: blue if progress has reached this step or beyond
|
|
53
|
-
const lineAboveColor = visuallyCompleted
|
|
54
|
-
? 'border-fds-blue-20'
|
|
55
|
-
: 'border-fds-gray-10';
|
|
56
|
-
const lineBelowColor = nextStepCompleted
|
|
57
|
-
? 'border-fds-blue-20'
|
|
58
|
-
: 'border-fds-gray-10';
|
|
59
|
-
return (_jsxs("div", { className: cn('flex flex-col', className), children: [isInsideGroup && (_jsxs("div", { className: "relative flex h-3 gap-fds-md", children: [_jsx("div", { className: cn('absolute bottom-0 left-[7px] top-0 w-0 border-l-2', lineAboveColor) }), _jsx("div", { className: "w-4 flex-shrink-0" }), _jsx("div", { className: "flex-1" })] })), _jsxs("div", { className: "relative flex items-center gap-fds-md", children: [isInsideGroup && (_jsx("div", { className: cn('absolute bottom-1/2 left-[7px] top-0 w-0 border-l-2', lineAboveColor) })), showLine && (_jsx("div", { className: cn('absolute bottom-0 left-[7px] top-1/2 w-0 border-l-2', lineBelowColor) })), _jsx("div", { className: "relative z-10 flex w-4 flex-shrink-0 justify-center bg-white py-2 dark:bg-transparent", children: visualStatus === 'pending' ? (_jsx("div", { className: "h-[11px] w-[11px] rounded-full border-[1.5px] border-dashed border-fds-gray-30 bg-card" })) : (_jsx("div", { className: stepIndicatorVariants({ status: visualStatus }), children: visuallyCompleted && _jsx(IconCheck, { size: 10 }) })) }), _jsxs("div", { className: "flex flex-1 justify-between", children: [_jsx("div", { className: "flex-1", children: children }), meta && _jsx("div", { className: "ml-fds-sm", children: meta })] })] }), showLine && (_jsxs("div", { className: "relative flex gap-fds-md pb-1", children: [_jsx("div", { className: cn('absolute bottom-0 left-[7px] top-0 w-0 border-l-2', lineBelowColor) }), _jsx("div", { className: "w-4 flex-shrink-0" }), _jsx("div", { className: "flex-1" })] }))] }));
|
|
60
|
-
};
|
|
61
|
-
Step.displayName = 'Step';
|
|
62
|
-
const StepTitle = ({ children, className }) => (_jsx("div", { className: cn('font-fds-semibold', className), children: children }));
|
|
63
|
-
StepTitle.displayName = 'StepTitle';
|
|
64
|
-
const StepDescription = ({ location, estimatedDate, actualDate, children, className, }) => {
|
|
65
|
-
if (children) {
|
|
66
|
-
return _jsx("div", { className: cn('', className), children: children });
|
|
67
|
-
}
|
|
68
|
-
return (_jsxs("div", { className: cn('flex items-center gap-fds-xs', className), children: [location && (_jsxs(_Fragment, { children: [_jsx("span", { className: "font-fds-semibold", children: location }), _jsx("span", { className: "h-[4px] w-[4px] rounded-full bg-fds-gray-20" })] })), actualDate ? (_jsxs(_Fragment, { children: [estimatedDate && (_jsx("span", { className: "line-through", children: estimatedDate })), _jsx("span", { className: "text-fds-red", children: actualDate })] })) : estimatedDate ? (_jsx("span", { children: estimatedDate })) : (_jsx("span", { children: "TBD" }))] }));
|
|
69
|
-
};
|
|
70
|
-
StepDescription.displayName = 'StepDescription';
|
|
71
|
-
const StepMeta = ({ children, className }) => (_jsx("div", { className: cn('flex items-center gap-fds-xs font-fds-semibold text-fds-gray-60', className), children: children }));
|
|
72
|
-
StepMeta.displayName = 'StepMeta';
|
|
73
|
-
/* -----------------------------------------------------------------------------
|
|
74
|
-
* Legacy exports for compatibility
|
|
75
|
-
* -------------------------------------------------------------------------- */
|
|
76
|
-
const Steps = StepsContainer;
|
|
77
|
-
const StepsAccordion = StepsContainer;
|
|
78
|
-
const StepIndicator = () => null; // No longer needed - indicator is built into Step
|
|
79
|
-
const StepContent = ({ children, className }) => _jsx("div", { className: className, children: children });
|
|
80
|
-
export { Step, StepContent, StepDescription, StepGroup, StepIndicator, stepIndicatorVariants, StepMeta, Steps, StepsAccordion, StepsContainer, StepSubGroup, StepTitle, };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { cn } from '../lib/utils';
|
|
4
|
-
const Table = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { className: "relative w-full overflow-auto", children: _jsx("table", { ref: ref, className: cn('w-full caption-bottom text-sm', className), ...props }) })));
|
|
5
|
-
Table.displayName = 'Table';
|
|
6
|
-
const TableHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("thead", { ref: ref, className: cn('[&_tr]:border-b [&_tr]:border-fds-gray-20', className), ...props })));
|
|
7
|
-
TableHeader.displayName = 'TableHeader';
|
|
8
|
-
const TableBody = React.forwardRef(({ className, ...props }, ref) => (_jsx("tbody", { ref: ref, className: cn('[&_tr:last-child]:border-0', className), ...props })));
|
|
9
|
-
TableBody.displayName = 'TableBody';
|
|
10
|
-
const TableFooter = React.forwardRef(({ className, ...props }, ref) => (_jsx("tfoot", { ref: ref, className: cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className), ...props })));
|
|
11
|
-
TableFooter.displayName = 'TableFooter';
|
|
12
|
-
const TableRow = React.forwardRef(({ className, ...props }, ref) => (_jsx("tr", { ref: ref, className: cn('border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted', className), ...props })));
|
|
13
|
-
TableRow.displayName = 'TableRow';
|
|
14
|
-
const TableHead = React.forwardRef(({ className, ...props }, ref) => (_jsx("th", { ref: ref, className: cn('px-fds-md text-left align-middle font-fds-semibold text-foreground [&:has([role=checkbox])]:pr-0', className), ...props })));
|
|
15
|
-
TableHead.displayName = 'TableHead';
|
|
16
|
-
const TableCell = React.forwardRef(({ className, ...props }, ref) => (_jsx("td", { ref: ref, className: cn('px-4 align-middle [&:has([role=checkbox])]:pr-0', className), ...props })));
|
|
17
|
-
TableCell.displayName = 'TableCell';
|
|
18
|
-
const TableCaption = React.forwardRef(({ className, ...props }, ref) => (_jsx("caption", { ref: ref, className: cn('mt-4 text-sm text-muted-foreground', className), ...props })));
|
|
19
|
-
TableCaption.displayName = 'TableCaption';
|
|
20
|
-
const TableEmpty = React.forwardRef(({ className, colSpan, message = 'No data', ...props }, ref) => (_jsx("tr", { ref: ref, className: className, ...props, children: _jsx("td", { colSpan: colSpan, className: "text-center", children: _jsxs("div", { className: "flex flex-col items-center justify-center py-fds-xxl", children: [_jsx("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: _jsxs("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [_jsx("ellipse", { className: "fill-fds-gray-10 dark:fill-fds-gray-80", cx: "32", cy: "33", rx: "32", ry: "7" }), _jsxs("g", { fillRule: "nonzero", className: "stroke-fds-gray-30 dark:stroke-fds-gray-60", children: [_jsx("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }), _jsx("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", className: "fill-fds-gray-5 dark:fill-fds-gray-90" })] })] }) }), _jsx("span", { className: "mt-fds-sm text-fds-sm text-fds-gray-50", children: message })] }) }) })));
|
|
21
|
-
TableEmpty.displayName = 'TableEmpty';
|
|
22
|
-
export { Table, TableBody, TableCaption, TableCell, TableEmpty, TableFooter, TableHead, TableHeader, TableRow, };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
4
|
-
import { cn } from '../lib/utils';
|
|
5
|
-
const Tabs = TabsPrimitive.Root;
|
|
6
|
-
const TabsList = React.forwardRef(({ className, ...props }, ref) => (_jsx(TabsPrimitive.List, { ref: ref, className: cn('inline-flex h-auto w-full items-center justify-start overflow-x-auto border-b border-fds-gray-20 dark:border-fds-gray-80', className), ...props })));
|
|
7
|
-
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
8
|
-
const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => (_jsx(TabsPrimitive.Trigger, { ref: ref, className: cn('inline-flex items-center justify-center whitespace-nowrap border-b-2 border-transparent px-fds-lg py-fds-xs text-[16px] text-foreground transition-all focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50', 'hover:text-fds-gray-80 dark:hover:text-fds-gray-20', 'data-[state=active]:border-fds-blue data-[state=active]:text-fds-blue', 'dark:data-[state=active]:border-fds-blue-20 dark:data-[state=active]:text-fds-blue-20', className), ...props })));
|
|
9
|
-
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
10
|
-
const TabsContent = React.forwardRef(({ className, ...props }, ref) => (_jsx(TabsPrimitive.Content, { ref: ref, className: cn('mt-fds-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fds-blue focus-visible:ring-offset-2', className), ...props })));
|
|
11
|
-
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
12
|
-
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { cn } from "../lib/utils";
|
|
4
|
-
const Textarea = React.forwardRef(({ className, ...props }, ref) => {
|
|
5
|
-
return (_jsx("textarea", { className: cn("flex min-h-[80px] w-full rounded-md border border-input-border bg-input px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", className), ref: ref, ...props }));
|
|
6
|
-
});
|
|
7
|
-
Textarea.displayName = "Textarea";
|
|
8
|
-
export { Textarea };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { IconClearCircledSolid, IconClock } from '@freightos/icons';
|
|
5
|
-
import { cn } from '../lib/utils';
|
|
6
|
-
import { Button } from './button';
|
|
7
|
-
import { Popover, PopoverContent, PopoverTrigger, } from './popover';
|
|
8
|
-
import { ScrollArea, ScrollBar, } from './scroll-area';
|
|
9
|
-
export function TimePicker({ value, onChange, placeholder = 'Select time', disabled = false, className, use24Hour = true, }) {
|
|
10
|
-
const [open, setOpen] = React.useState(false);
|
|
11
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
12
|
-
const hours = use24Hour
|
|
13
|
-
? Array.from({ length: 24 }, (_, i) => i)
|
|
14
|
-
: Array.from({ length: 12 }, (_, i) => i + 1);
|
|
15
|
-
// Parse value to get hour and minute
|
|
16
|
-
const parsedHour = value ? parseInt(value.split(':')[0], 10) : undefined;
|
|
17
|
-
const parsedMinute = value ? parseInt(value.split(':')[1], 10) : undefined;
|
|
18
|
-
const handleTimeChange = (type, val) => {
|
|
19
|
-
const currentHour = parsedHour ?? 0;
|
|
20
|
-
const currentMinute = parsedMinute ?? 0;
|
|
21
|
-
let newHour = currentHour;
|
|
22
|
-
let newMinute = currentMinute;
|
|
23
|
-
if (type === 'hour') {
|
|
24
|
-
if (use24Hour) {
|
|
25
|
-
newHour = parseInt(val);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
const isPM = currentHour >= 12;
|
|
29
|
-
newHour = (parseInt(val) % 12) + (isPM ? 12 : 0);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
else if (type === 'minute') {
|
|
33
|
-
newMinute = parseInt(val);
|
|
34
|
-
}
|
|
35
|
-
else if (type === 'ampm') {
|
|
36
|
-
if (val === 'PM' && currentHour < 12) {
|
|
37
|
-
newHour = currentHour + 12;
|
|
38
|
-
}
|
|
39
|
-
else if (val === 'AM' && currentHour >= 12) {
|
|
40
|
-
newHour = currentHour - 12;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const timeString = `${newHour.toString().padStart(2, '0')}:${newMinute.toString().padStart(2, '0')}`;
|
|
44
|
-
onChange?.(timeString);
|
|
45
|
-
};
|
|
46
|
-
const handleClear = (e) => {
|
|
47
|
-
e.stopPropagation();
|
|
48
|
-
onChange?.(undefined);
|
|
49
|
-
};
|
|
50
|
-
const formatDisplayTime = (timeValue) => {
|
|
51
|
-
if (!timeValue)
|
|
52
|
-
return undefined;
|
|
53
|
-
const [h, m] = timeValue.split(':').map(Number);
|
|
54
|
-
if (use24Hour) {
|
|
55
|
-
return `${h.toString().padStart(2, '0')}:${m.toString().padStart(2, '0')}`;
|
|
56
|
-
}
|
|
57
|
-
const hour12 = h % 12 || 12;
|
|
58
|
-
const ampm = h >= 12 ? 'PM' : 'AM';
|
|
59
|
-
return `${hour12}:${m.toString().padStart(2, '0')} ${ampm}`;
|
|
60
|
-
};
|
|
61
|
-
const showClearIcon = isHovered && value;
|
|
62
|
-
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", disabled: disabled, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), className: cn('flex h-[32px] w-full items-center justify-between gap-2 rounded-fds-md border border-input-border bg-input py-2 pl-3 pr-2 text-sm transition-[color,box-shadow]', 'focus:outline-none focus:border-[#2075bd] focus:shadow-[0_0_0_2px_var(--fds-color-primary-blue-20)]', 'disabled:cursor-not-allowed disabled:opacity-50', open && 'border-[#2075bd] shadow-[0_0_0_2px_var(--fds-color-primary-blue-20)]', !value && 'text-muted-foreground', className), children: [_jsx("span", { className: "truncate", children: value ? formatDisplayTime(value) : placeholder }), showClearIcon ? (_jsx(IconClearCircledSolid, { size: 16, className: "shrink-0 cursor-pointer text-muted-foreground hover:text-foreground", onClick: handleClear })) : (_jsx(IconClock, { size: 16, className: "shrink-0 text-muted-foreground" }))] }) }), _jsx(PopoverContent, { className: "w-auto p-0", children: _jsxs("div", { className: "flex divide-x sm:h-[300px]", children: [_jsxs(ScrollArea, { className: "w-auto", children: [_jsx("div", { className: "flex flex-col p-2", children: hours.map((hour) => (_jsx(Button, { size: "small", htmlType: "button", type: parsedHour !== undefined &&
|
|
63
|
-
(use24Hour
|
|
64
|
-
? parsedHour === hour
|
|
65
|
-
: parsedHour % 12 === hour % 12)
|
|
66
|
-
? 'default'
|
|
67
|
-
: 'text', className: "aspect-square shrink-0 sm:w-full", onClick: () => handleTimeChange('hour', hour.toString()), children: use24Hour ? hour.toString().padStart(2, '0') : hour }, hour))) }), _jsx(ScrollBar, { orientation: "horizontal", className: "sm:hidden" })] }), _jsxs(ScrollArea, { className: "w-auto", children: [_jsx("div", { className: "flex flex-col p-2", children: Array.from({ length: 12 }, (_, i) => i * 5).map((minute) => (_jsx(Button, { size: "small", htmlType: "button", type: parsedMinute !== undefined && parsedMinute === minute
|
|
68
|
-
? 'default'
|
|
69
|
-
: 'text', className: "aspect-square shrink-0 sm:w-full", onClick: () => handleTimeChange('minute', minute.toString()), children: minute.toString().padStart(2, '0') }, minute))) }), _jsx(ScrollBar, { orientation: "horizontal", className: "sm:hidden" })] }), !use24Hour && (_jsx(ScrollArea, { className: "", children: _jsx("div", { className: "flex flex-col p-2", children: ['AM', 'PM'].map((ampm) => (_jsx(Button, { size: "small", htmlType: "button", type: parsedHour !== undefined &&
|
|
70
|
-
((ampm === 'AM' && parsedHour < 12) ||
|
|
71
|
-
(ampm === 'PM' && parsedHour >= 12))
|
|
72
|
-
? 'default'
|
|
73
|
-
: 'text', className: "aspect-square shrink-0 sm:w-full", onClick: () => handleTimeChange('ampm', ampm), children: ampm }, ampm))) }) }))] }) })] }));
|
|
74
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
4
|
-
import { cva } from "class-variance-authority";
|
|
5
|
-
import { X } from "lucide-react";
|
|
6
|
-
import { cn } from "../lib/utils";
|
|
7
|
-
const ToastProvider = ToastPrimitives.Provider;
|
|
8
|
-
const ToastViewport = React.forwardRef(({ className, ...props }, ref) => (_jsx(ToastPrimitives.Viewport, { ref: ref, className: cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]", className), ...props })));
|
|
9
|
-
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
|
|
10
|
-
const toastVariants = cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full", {
|
|
11
|
-
variants: {
|
|
12
|
-
variant: {
|
|
13
|
-
default: "border bg-background text-foreground",
|
|
14
|
-
destructive: "destructive group border-destructive bg-destructive text-destructive-foreground",
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
defaultVariants: {
|
|
18
|
-
variant: "default",
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
const Toast = React.forwardRef(({ className, variant, ...props }, ref) => {
|
|
22
|
-
return (_jsx(ToastPrimitives.Root, { ref: ref, className: cn(toastVariants({ variant }), className), ...props }));
|
|
23
|
-
});
|
|
24
|
-
Toast.displayName = ToastPrimitives.Root.displayName;
|
|
25
|
-
const ToastAction = React.forwardRef(({ className, ...props }, ref) => (_jsx(ToastPrimitives.Action, { ref: ref, className: cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive", className), ...props })));
|
|
26
|
-
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
|
27
|
-
const ToastClose = React.forwardRef(({ className, ...props }, ref) => (_jsx(ToastPrimitives.Close, { ref: ref, className: cn("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600", className), "toast-close": "", ...props, children: _jsx(X, { className: "h-4 w-4" }) })));
|
|
28
|
-
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
29
|
-
const ToastTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(ToastPrimitives.Title, { ref: ref, className: cn("text-sm font-semibold", className), ...props })));
|
|
30
|
-
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
31
|
-
const ToastDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx(ToastPrimitives.Description, { ref: ref, className: cn("text-sm opacity-90", className), ...props })));
|
|
32
|
-
ToastDescription.displayName = ToastPrimitives.Description.displayName;
|
|
33
|
-
export { ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useToast } from "../hooks/use-toast";
|
|
3
|
-
import { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, } from "./toast";
|
|
4
|
-
export function Toaster() {
|
|
5
|
-
const { toasts } = useToast();
|
|
6
|
-
return (_jsxs(ToastProvider, { children: [toasts.map(function ({ id, title, description, action, ...props }) {
|
|
7
|
-
return (_jsxs(Toast, { ...props, children: [_jsxs("div", { className: "grid gap-1", children: [title && _jsx(ToastTitle, { children: title }), description && (_jsx(ToastDescription, { children: description }))] }), action, _jsx(ToastClose, {})] }, id));
|
|
8
|
-
}), _jsx(ToastViewport, {})] }));
|
|
9
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
5
|
-
import { cn } from "../lib/utils";
|
|
6
|
-
import { toggleVariants } from "./toggle";
|
|
7
|
-
const ToggleGroupContext = React.createContext({
|
|
8
|
-
size: "default",
|
|
9
|
-
variant: "default",
|
|
10
|
-
});
|
|
11
|
-
const ToggleGroup = React.forwardRef(({ className, variant, size, children, ...props }, ref) => (_jsx(ToggleGroupPrimitive.Root, { ref: ref, className: cn("flex items-center justify-center gap-1", className), ...props, children: _jsx(ToggleGroupContext.Provider, { value: { variant, size }, children: children }) })));
|
|
12
|
-
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
13
|
-
const ToggleGroupItem = React.forwardRef(({ className, children, variant, size, ...props }, ref) => {
|
|
14
|
-
const context = React.useContext(ToggleGroupContext);
|
|
15
|
-
return (_jsx(ToggleGroupPrimitive.Item, { ref: ref, className: cn(toggleVariants({
|
|
16
|
-
variant: context.variant || variant,
|
|
17
|
-
size: context.size || size,
|
|
18
|
-
}), className), ...props, children: children }));
|
|
19
|
-
});
|
|
20
|
-
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
21
|
-
export { ToggleGroup, ToggleGroupItem };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
4
|
-
import { cva } from "class-variance-authority";
|
|
5
|
-
import { cn } from "../lib/utils";
|
|
6
|
-
const toggleVariants = cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 gap-2", {
|
|
7
|
-
variants: {
|
|
8
|
-
variant: {
|
|
9
|
-
default: "bg-transparent",
|
|
10
|
-
outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
|
|
11
|
-
},
|
|
12
|
-
size: {
|
|
13
|
-
default: "h-10 px-3 min-w-10",
|
|
14
|
-
sm: "h-9 px-2.5 min-w-9",
|
|
15
|
-
lg: "h-11 px-5 min-w-11",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
defaultVariants: {
|
|
19
|
-
variant: "default",
|
|
20
|
-
size: "default",
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
const Toggle = React.forwardRef(({ className, variant, size, ...props }, ref) => (_jsx(TogglePrimitive.Root, { ref: ref, className: cn(toggleVariants({ variant, size, className })), ...props })));
|
|
24
|
-
Toggle.displayName = TogglePrimitive.Root.displayName;
|
|
25
|
-
export { Toggle, toggleVariants };
|