@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,10 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../lib/utils';
|
|
3
3
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
function resolvePlacement(placement) {
|
|
6
|
+
const [sideRaw, alignRaw] = placement.split('-');
|
|
7
|
+
const align = alignRaw ?? 'center';
|
|
8
|
+
const isRtl = typeof document !== 'undefined' && document.documentElement.dir === 'rtl';
|
|
9
|
+
// Map logical start/end to physical left/right
|
|
10
|
+
const resolveLogical = (value) => (value === 'start') !== isRtl ? 'left' : 'right';
|
|
11
|
+
const side = sideRaw === 'top' || sideRaw === 'bottom'
|
|
12
|
+
? sideRaw
|
|
13
|
+
: resolveLogical(sideRaw);
|
|
14
|
+
// Radix align also needs RTL flip for start/end
|
|
15
|
+
const radixAlign = align === 'center'
|
|
16
|
+
? 'center'
|
|
17
|
+
: isRtl
|
|
18
|
+
? align === 'start' ? 'end' : 'start'
|
|
19
|
+
: align;
|
|
20
|
+
return { side, align: radixAlign };
|
|
21
|
+
}
|
|
22
|
+
// Arrow is 12px wide. Place its center at border-radius (4px) + half arrow (6px) = 10px from edge.
|
|
23
|
+
const ARROW_EDGE_INSET = 10;
|
|
24
|
+
function Tooltip({ message, placement = 'top', children }) {
|
|
25
|
+
const { side, align } = resolvePlacement(placement);
|
|
26
|
+
const triggerRef = React.useRef(null);
|
|
27
|
+
const [alignOffset, setAlignOffset] = React.useState(0);
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
if (align === 'center' || !triggerRef.current) {
|
|
30
|
+
setAlignOffset(0);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const isHorizontal = side === 'top' || side === 'bottom';
|
|
34
|
+
const triggerSize = isHorizontal
|
|
35
|
+
? triggerRef.current.offsetWidth
|
|
36
|
+
: triggerRef.current.offsetHeight;
|
|
37
|
+
// Negative offset shifts tooltip away from alignment edge,
|
|
38
|
+
// pulling the arrow (anchored at trigger center) toward that edge.
|
|
39
|
+
setAlignOffset(ARROW_EDGE_INSET - triggerSize / 2);
|
|
40
|
+
}, [align, side]);
|
|
41
|
+
return (_jsx(TooltipPrimitive.Provider, { delayDuration: 0, children: _jsxs(TooltipPrimitive.Root, { children: [_jsx(TooltipPrimitive.Trigger, { asChild: true, ref: triggerRef, children: children }), _jsxs(TooltipPrimitive.Content, { side: side, align: align, alignOffset: alignOffset, sideOffset: 4, className: "z-[9999] origin-[--radix-tooltip-content-transform-origin] overflow-hidden rounded-fds-md bg-fds-gray-100 p-fds-sm !text-fds-base !leading-none !font-fds-regular text-fds-white shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:bg-white dark:text-[rgba(83,87,95,1)]", children: [message, _jsx(TooltipPrimitive.Arrow, { className: "fill-fds-gray-100 dark:fill-white", width: 12, height: 6 })] })] }) }));
|
|
42
|
+
}
|
|
43
|
+
export { Tooltip };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,67 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
// @freightos/freightwind
|
|
3
|
-
// Utility
|
|
4
|
-
export { cn } from './lib/utils';
|
|
5
|
-
// Hooks
|
|
6
|
-
export { useToast, toast } from './hooks/use-toast';
|
|
1
|
+
'use client';
|
|
7
2
|
// Components
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export * from './components/date-range-picker';
|
|
26
|
-
export * from './components/date-time-picker';
|
|
27
|
-
export * from './components/dialog';
|
|
28
|
-
export * from './components/drawer';
|
|
29
|
-
export * from './components/dropdown-menu';
|
|
30
|
-
export * from './components/empty';
|
|
31
|
-
export * from './components/file-preview';
|
|
32
|
-
export * from './components/form';
|
|
33
|
-
export * from './components/inline-edit';
|
|
34
|
-
export * from './components/input';
|
|
35
|
-
export * from './components/input-group';
|
|
36
|
-
export * from './components/input-otp';
|
|
37
|
-
export * from './components/label';
|
|
38
|
-
export * from './components/menubar';
|
|
39
|
-
export * from './components/navigation-menu';
|
|
40
|
-
export * from './components/pagination';
|
|
41
|
-
export * from './components/phone-input';
|
|
42
|
-
export * from './components/popover';
|
|
43
|
-
export * from './components/progress';
|
|
44
|
-
export * from './components/radio-button-group';
|
|
45
|
-
export * from './components/radio-group';
|
|
46
|
-
export * from './components/resizable';
|
|
47
|
-
export * from './components/rich-text-editor';
|
|
48
|
-
export * from './components/scroll-area';
|
|
49
|
-
export * from './components/select';
|
|
50
|
-
export * from './components/separator';
|
|
51
|
-
export * from './components/sheet';
|
|
52
|
-
export * from './components/skeleton';
|
|
53
|
-
export * from './components/slider';
|
|
54
|
-
export { Toaster as SonnerToaster } from './components/sonner';
|
|
55
|
-
export * from './components/spinner';
|
|
56
|
-
export * from './components/stepper';
|
|
57
|
-
export * from './components/steps';
|
|
58
|
-
export * from './components/switch';
|
|
59
|
-
export * from './components/table';
|
|
60
|
-
export * from './components/tabs';
|
|
61
|
-
export * from './components/textarea';
|
|
62
|
-
export * from './components/time-picker';
|
|
63
|
-
export * from './components/toast';
|
|
64
|
-
export * from './components/toaster';
|
|
65
|
-
export * from './components/toggle';
|
|
66
|
-
export * from './components/toggle-group';
|
|
67
|
-
export * from './components/tooltip';
|
|
3
|
+
export { Alert } from './components/alert';
|
|
4
|
+
export { Avatar } from './components/avatar';
|
|
5
|
+
export { Badge } from './components/badge';
|
|
6
|
+
export { Button, buttonVariants } from './components/button';
|
|
7
|
+
export { Checkbox } from './components/checkbox';
|
|
8
|
+
export { Chip, chipVariants } from './components/chip';
|
|
9
|
+
export { MessageProvider, message } from './components/message';
|
|
10
|
+
export { PopConfirm } from './components/pop-confirm';
|
|
11
|
+
export { RadioButtonGroup } from './components/radio-button-group';
|
|
12
|
+
export { RadioGroup, RadioGroupItem } from './components/radio-group';
|
|
13
|
+
export { Slider } from './components/slider';
|
|
14
|
+
export { Switch } from './components/switch';
|
|
15
|
+
export { Tooltip } from './components/tooltip';
|
|
16
|
+
// Utilities
|
|
17
|
+
export { cn } from './lib/utils';
|
|
18
|
+
export { useStableId } from './lib/use-stable-id';
|
|
19
|
+
export { iconMap } from './lib/icon-utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { iconMap } from '@freightos/icons';
|
package/dist/esm/lib/utils.js
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { clsx } from "clsx";
|
|
2
|
-
import {
|
|
2
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
3
|
+
const twMerge = extendTailwindMerge({
|
|
4
|
+
extend: {
|
|
5
|
+
classGroups: {
|
|
6
|
+
"font-size": [
|
|
7
|
+
"text-fds-xs",
|
|
8
|
+
"text-fds-sm",
|
|
9
|
+
"text-fds-base",
|
|
10
|
+
"text-fds-h6",
|
|
11
|
+
"text-fds-h5",
|
|
12
|
+
"text-fds-h4",
|
|
13
|
+
"text-fds-h3",
|
|
14
|
+
"text-fds-h2",
|
|
15
|
+
"text-fds-h1",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
3
20
|
export function cn(...inputs) {
|
|
4
21
|
return twMerge(clsx(inputs));
|
|
5
22
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
type
|
|
2
|
+
type AlertVariant = 'info' | 'success' | 'warning' | 'error' | 'special';
|
|
3
3
|
interface AlertProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
variant?: AlertVariant;
|
|
5
|
+
title?: string;
|
|
6
|
+
message?: string;
|
|
7
7
|
closable?: boolean;
|
|
8
8
|
onClose?: () => void;
|
|
9
|
-
|
|
9
|
+
callToAction?: React.ReactNode;
|
|
10
10
|
}
|
|
11
11
|
export declare const Alert: React.FC<AlertProps>;
|
|
12
12
|
export {};
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
size?:
|
|
6
|
-
bordered?: boolean
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
|
|
17
|
-
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
18
|
-
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
19
|
-
export { Avatar, AvatarFallback, AvatarImage };
|
|
1
|
+
import { type IconName } from '../lib/icon-utils';
|
|
2
|
+
export type { IconName };
|
|
3
|
+
export interface AvatarProps {
|
|
4
|
+
variant?: 'default' | 'info' | 'secondary' | 'warning' | 'neutral' | 'positive' | 'filled' | 'ghost';
|
|
5
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
6
|
+
bordered?: boolean;
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
title?: string;
|
|
9
|
+
flag?: string;
|
|
10
|
+
src?: string;
|
|
11
|
+
alt?: string;
|
|
12
|
+
}
|
|
13
|
+
declare function Avatar({ variant, size, bordered, icon, title, flag, src, alt, }: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export { Avatar };
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export interface BadgeProps
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type BadgeStatus = 'success' | 'error' | 'default' | 'processing' | 'warning';
|
|
3
|
+
export type BadgeSize = 'default' | 'large';
|
|
4
|
+
export type BadgeVariant = 'default' | 'info' | 'neutral';
|
|
5
|
+
export type BadgePosition = 'top-end' | 'bottom-end';
|
|
6
|
+
export interface BadgeProps {
|
|
7
|
+
/** Value displayed in the badge. Numbers cap at 99+. Strings render as-is. */
|
|
8
|
+
value?: number | string;
|
|
9
|
+
/** Size of the badge. */
|
|
10
|
+
size?: BadgeSize;
|
|
11
|
+
/** Visual variant for the badge. */
|
|
12
|
+
variant?: BadgeVariant;
|
|
13
|
+
/** Status variant with a colored dot and text label. */
|
|
14
|
+
status?: BadgeStatus;
|
|
15
|
+
/** Text label shown next to the status dot. */
|
|
16
|
+
text?: string;
|
|
17
|
+
/** Position of the badge when wrapping children. */
|
|
18
|
+
position?: BadgePosition;
|
|
19
|
+
/** When children are provided, the badge is positioned relative to the child. */
|
|
20
|
+
children?: React.ReactNode;
|
|
7
21
|
}
|
|
8
|
-
declare function Badge({
|
|
9
|
-
export { Badge
|
|
22
|
+
declare function Badge({ value, size, variant, position, status, text, children }: BadgeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
+
export { Badge };
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { type VariantProps } from 'class-variance-authority';
|
|
2
1
|
import * as React from 'react';
|
|
2
|
+
import { type IconName } from '../lib/icon-utils';
|
|
3
|
+
export type { IconName };
|
|
3
4
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
|
|
5
|
-
size?: "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
variant?: "link" | "default" | "toggle" | "secondary" | "tertiary" | "danger" | "danger-ghost" | null | undefined;
|
|
6
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
|
+
export type ButtonVariant = 'default' | 'secondary' | 'tertiary' | 'link' | 'danger' | 'danger-ghost' | 'toggle';
|
|
9
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
10
|
+
export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'className'> {
|
|
11
|
+
variant?: ButtonVariant;
|
|
12
|
+
size?: ButtonSize;
|
|
13
|
+
icon?: IconName;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
active?: boolean;
|
|
16
|
+
tooltip?: string;
|
|
17
|
+
fullWidth?: boolean;
|
|
12
18
|
}
|
|
13
19
|
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
20
|
export { Button, buttonVariants };
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
2
|
+
export interface CheckboxProps {
|
|
3
|
+
checked?: boolean | 'indeterminate';
|
|
4
|
+
onCheckedChange?: (checked: boolean | 'indeterminate') => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
error?: boolean;
|
|
7
|
+
children?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
|
|
4
10
|
export { Checkbox };
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { type IconName } from '../lib/icon-utils';
|
|
2
|
+
export type { IconName };
|
|
3
|
+
export type ChipVariant = 'default' | 'neutral' | 'info' | 'highlight' | 'warning' | 'success' | 'notice' | 'error';
|
|
4
|
+
export interface ChipProps {
|
|
5
|
+
variant?: ChipVariant;
|
|
6
|
+
icon?: IconName;
|
|
7
|
+
closable?: boolean;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
badge?: number | string;
|
|
10
|
+
children?: string;
|
|
8
11
|
}
|
|
9
|
-
declare
|
|
12
|
+
declare const chipVariants: (props?: ({
|
|
13
|
+
variant?: "info" | "success" | "warning" | "error" | "default" | "neutral" | "highlight" | "notice" | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
15
|
+
declare function Chip({ variant, icon, closable, onClose, badge, children, }: ChipProps): import("react/jsx-runtime").JSX.Element | null;
|
|
10
16
|
export { Chip, chipVariants };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Toaster as Sonner } from "sonner";
|
|
2
|
+
type MessageOptions = {
|
|
3
|
+
onClick?: () => void;
|
|
4
|
+
duration?: number;
|
|
5
|
+
};
|
|
6
|
+
declare const message: {
|
|
7
|
+
success: (title: string, options?: MessageOptions) => string | number;
|
|
8
|
+
info: (title: string, options?: MessageOptions) => string | number;
|
|
9
|
+
warning: (title: string, options?: MessageOptions) => string | number;
|
|
10
|
+
error: (title: string, options?: MessageOptions) => string | number;
|
|
11
|
+
};
|
|
12
|
+
type MessageProviderProps = React.ComponentProps<typeof Sonner>;
|
|
13
|
+
declare const MessageProvider: ({ duration, ...props }: MessageProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export { MessageProvider, message };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FreightosColor } from '@freightos/icons';
|
|
3
|
+
import { type ButtonVariant } from './button';
|
|
4
|
+
import { type IconName } from '../lib/icon-utils';
|
|
5
|
+
import type { TooltipPlacement } from './tooltip';
|
|
6
|
+
export interface PopConfirmProps {
|
|
7
|
+
title: string;
|
|
8
|
+
onConfirm: () => void;
|
|
9
|
+
onCancel?: () => void;
|
|
10
|
+
placement?: TooltipPlacement;
|
|
11
|
+
children: React.ReactElement;
|
|
12
|
+
slotProps?: {
|
|
13
|
+
icon?: {
|
|
14
|
+
name?: IconName;
|
|
15
|
+
color?: FreightosColor | (string & {});
|
|
16
|
+
};
|
|
17
|
+
confirmButton?: {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
variant?: ButtonVariant;
|
|
20
|
+
};
|
|
21
|
+
cancelButton?: {
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
variant?: ButtonVariant;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
declare function PopConfirm({ title, onConfirm, onCancel, placement, children, slotProps, }: PopConfirmProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export { PopConfirm };
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { type VariantProps } from 'class-variance-authority';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
declare const radioButtonGroupItemVariants: (props?: ({
|
|
5
|
-
size?: "small" | "medium" | "large" | null | undefined;
|
|
6
|
-
variant?: "default" | "custom" | null | undefined;
|
|
7
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
-
interface RadioButtonGroupProps extends React.ComponentPropsWithoutRef<typeof RadioGroup>, VariantProps<typeof radioButtonGroupItemVariants> {
|
|
9
|
-
borderRadius?: 'lg' | 'full';
|
|
10
|
-
}
|
|
11
|
-
declare const RadioButtonGroup: React.ForwardRefExoticComponent<RadioButtonGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
-
interface RadioButtonGroupItemProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof radioButtonGroupItemVariants> {
|
|
2
|
+
interface RadioButtonGroupOption {
|
|
13
3
|
value: string;
|
|
14
|
-
|
|
4
|
+
label: string;
|
|
5
|
+
render?: () => React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
interface RadioButtonGroupProps {
|
|
8
|
+
options: RadioButtonGroupOption[];
|
|
9
|
+
value?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
onValueChange?: (value: string) => void;
|
|
12
|
+
size?: 'sm' | 'md' | 'lg';
|
|
13
|
+
orientation?: 'horizontal' | 'vertical';
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
error?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare function RadioButtonGroup({ options, value, defaultValue, onValueChange, size, orientation, disabled, error, }: RadioButtonGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare namespace RadioButtonGroup {
|
|
19
|
+
var displayName: string;
|
|
15
20
|
}
|
|
16
|
-
|
|
17
|
-
export {
|
|
21
|
+
export { RadioButtonGroup };
|
|
22
|
+
export type { RadioButtonGroupOption, RadioButtonGroupProps };
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
2
|
+
export interface SliderProps {
|
|
3
|
+
value?: number[];
|
|
4
|
+
defaultValue?: number[];
|
|
5
|
+
onValueChange?: (value: number[]) => void;
|
|
6
|
+
min?: number;
|
|
7
|
+
max?: number;
|
|
8
|
+
step?: number;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLSpanElement>>;
|
|
4
12
|
export { Slider };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
export interface SwitchProps {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
error?: boolean;
|
|
7
|
+
size?: 'lg' | 'sm';
|
|
8
|
+
children?: string;
|
|
8
9
|
}
|
|
9
10
|
declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
11
|
export { Switch };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
type Side = 'top' | 'bottom' | 'start' | 'end';
|
|
3
|
+
export type TooltipPlacement = Side | `${Side}-${'start' | 'end'}`;
|
|
4
|
+
export interface TooltipProps {
|
|
5
|
+
message: React.ReactNode;
|
|
6
|
+
placement?: TooltipPlacement;
|
|
7
|
+
children: React.ReactElement;
|
|
8
|
+
}
|
|
9
|
+
declare function Tooltip({ message, placement, children }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { Tooltip };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,62 +1,26 @@
|
|
|
1
|
+
export { Alert } from './components/alert';
|
|
2
|
+
export { Avatar } from './components/avatar';
|
|
3
|
+
export { Badge } from './components/badge';
|
|
4
|
+
export { Button, buttonVariants } from './components/button';
|
|
5
|
+
export { Checkbox } from './components/checkbox';
|
|
6
|
+
export { Chip, chipVariants } from './components/chip';
|
|
7
|
+
export { MessageProvider, message } from './components/message';
|
|
8
|
+
export { PopConfirm } from './components/pop-confirm';
|
|
9
|
+
export { RadioButtonGroup } from './components/radio-button-group';
|
|
10
|
+
export { RadioGroup, RadioGroupItem } from './components/radio-group';
|
|
11
|
+
export { Slider } from './components/slider';
|
|
12
|
+
export { Switch } from './components/switch';
|
|
13
|
+
export { Tooltip } from './components/tooltip';
|
|
14
|
+
export type { IconName } from './lib/icon-utils';
|
|
15
|
+
export type { ButtonVariant, ButtonSize, ButtonProps } from './components/button';
|
|
16
|
+
export type { BadgeStatus, BadgeSize, BadgeVariant, BadgePosition, BadgeProps } from './components/badge';
|
|
17
|
+
export type { CheckboxProps } from './components/checkbox';
|
|
18
|
+
export type { ChipVariant, ChipProps } from './components/chip';
|
|
19
|
+
export type { PopConfirmProps } from './components/pop-confirm';
|
|
20
|
+
export type { RadioButtonGroupOption, RadioButtonGroupProps } from './components/radio-button-group';
|
|
21
|
+
export type { SliderProps } from './components/slider';
|
|
22
|
+
export type { SwitchProps } from './components/switch';
|
|
23
|
+
export type { TooltipPlacement, TooltipProps } from './components/tooltip';
|
|
1
24
|
export { cn } from './lib/utils';
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
4
|
-
export * from './components/alert';
|
|
5
|
-
export * from './components/aspect-ratio';
|
|
6
|
-
export * from './components/avatar';
|
|
7
|
-
export * from './components/badge';
|
|
8
|
-
export * from './components/breadcrumb';
|
|
9
|
-
export * from './components/button';
|
|
10
|
-
export * from './components/calendar';
|
|
11
|
-
export * from './components/card';
|
|
12
|
-
export * from './components/chart';
|
|
13
|
-
export * from './components/checkbox';
|
|
14
|
-
export * from './components/chip';
|
|
15
|
-
export * from './components/collapsible';
|
|
16
|
-
export * from './components/command';
|
|
17
|
-
export * from './components/context-menu';
|
|
18
|
-
export * from './components/country-select';
|
|
19
|
-
export * from './components/date-picker';
|
|
20
|
-
export * from './components/date-range-picker';
|
|
21
|
-
export * from './components/date-time-picker';
|
|
22
|
-
export * from './components/dialog';
|
|
23
|
-
export * from './components/drawer';
|
|
24
|
-
export * from './components/dropdown-menu';
|
|
25
|
-
export * from './components/empty';
|
|
26
|
-
export * from './components/file-preview';
|
|
27
|
-
export * from './components/form';
|
|
28
|
-
export * from './components/inline-edit';
|
|
29
|
-
export * from './components/input';
|
|
30
|
-
export * from './components/input-group';
|
|
31
|
-
export * from './components/input-otp';
|
|
32
|
-
export * from './components/label';
|
|
33
|
-
export * from './components/menubar';
|
|
34
|
-
export * from './components/navigation-menu';
|
|
35
|
-
export * from './components/pagination';
|
|
36
|
-
export * from './components/phone-input';
|
|
37
|
-
export * from './components/popover';
|
|
38
|
-
export * from './components/progress';
|
|
39
|
-
export * from './components/radio-button-group';
|
|
40
|
-
export * from './components/radio-group';
|
|
41
|
-
export * from './components/resizable';
|
|
42
|
-
export * from './components/rich-text-editor';
|
|
43
|
-
export * from './components/scroll-area';
|
|
44
|
-
export * from './components/select';
|
|
45
|
-
export * from './components/separator';
|
|
46
|
-
export * from './components/sheet';
|
|
47
|
-
export * from './components/skeleton';
|
|
48
|
-
export * from './components/slider';
|
|
49
|
-
export { Toaster as SonnerToaster } from './components/sonner';
|
|
50
|
-
export * from './components/spinner';
|
|
51
|
-
export * from './components/stepper';
|
|
52
|
-
export * from './components/steps';
|
|
53
|
-
export * from './components/switch';
|
|
54
|
-
export * from './components/table';
|
|
55
|
-
export * from './components/tabs';
|
|
56
|
-
export * from './components/textarea';
|
|
57
|
-
export * from './components/time-picker';
|
|
58
|
-
export * from './components/toast';
|
|
59
|
-
export * from './components/toaster';
|
|
60
|
-
export * from './components/toggle';
|
|
61
|
-
export * from './components/toggle-group';
|
|
62
|
-
export * from './components/tooltip';
|
|
25
|
+
export { useStableId } from './lib/use-stable-id';
|
|
26
|
+
export { iconMap } from './lib/icon-utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type IconName, iconMap } from '@freightos/icons';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useStableId(prefix?: string): string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# FreightWind Design System
|
|
2
|
+
|
|
3
|
+
FreightWind is the Freightos Design System — a React component library styled with Tailwind CSS v4 and FDS (Freightos Design System) tokens.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
FreightWind requires two imports:
|
|
8
|
+
|
|
9
|
+
1. **CSS tokens** — import the token stylesheet in your root layout or global CSS:
|
|
10
|
+
|
|
11
|
+
```css
|
|
12
|
+
@import "@freightos/freightwind/tokens.css";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. **Components** — import components from the package:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Button, Alert, Checkbox } from '@freightos/freightwind';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
3. **Icons** — icons come from the `@freightos/icons` peer dependency:
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { IconSearch, IconClose, IconUser } from '@freightos/icons';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Components that accept an `icon` prop use kebab-case icon names (e.g. `icon="search"`, `icon="close"`), not direct icon imports.
|
|
28
|
+
|
|
29
|
+
## Tailwind CSS requirement
|
|
30
|
+
|
|
31
|
+
FreightWind components use Tailwind CSS v4 utility classes. Your project must have Tailwind CSS configured. The `tokens.css` file provides all necessary theme tokens and custom utilities.
|
|
32
|
+
|
|
33
|
+
## Available components
|
|
34
|
+
|
|
35
|
+
See `overview-components.md` for a full list of components with their props and usage.
|
|
36
|
+
|
|
37
|
+
## Available icons
|
|
38
|
+
|
|
39
|
+
See `overview-icons.md` for details on the icon system.
|
|
40
|
+
|
|
41
|
+
## Design tokens
|
|
42
|
+
|
|
43
|
+
FreightWind uses a custom token system instead of Tailwind defaults:
|
|
44
|
+
|
|
45
|
+
- **Colors**: `overview-design-tokens/colors.md` — semantic color palette (blue, red, green, yellow, gray, purple)
|
|
46
|
+
- **Typography**: `overview-design-tokens/typography.md` — font sizes, weights, and line heights
|
|
47
|
+
- **Spacing**: `overview-design-tokens/spacing.md` — consistent spacing scale
|
|
48
|
+
|
|
49
|
+
## Key conventions
|
|
50
|
+
|
|
51
|
+
- Always use FDS tokens (`text-fds-*`, `p-fds-*`, `rounded-fds-*`, `bg-fds-*`) instead of Tailwind defaults
|
|
52
|
+
- All components support both controlled and uncontrolled usage patterns
|
|
53
|
+
- Components with `icon` props accept kebab-case icon names: `"search"`, `"close"`, `"user"`, `"risk"`, etc.
|
|
54
|
+
- Use `cn()` utility (exported from the package) for className merging
|