@ashwa-io/ui 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/atomic/Button/buttonLook.js +18 -0
- package/dist/components/atomic/Checkbox/Checkbox.d.ts +11 -0
- package/dist/components/atomic/Checkbox/Checkbox.js +32 -0
- package/dist/components/atomic/Checkbox/index.d.ts +2 -0
- package/dist/components/atomic/ColorInput/ColorInput.d.ts +15 -0
- package/dist/components/atomic/ColorInput/ColorInput.js +44 -0
- package/dist/components/atomic/ColorInput/colorHex.js +8 -0
- package/dist/components/atomic/ColorInput/index.d.ts +2 -0
- package/dist/components/atomic/Select/Select.d.ts +18 -0
- package/dist/components/atomic/Select/Select.js +47 -0
- package/dist/components/atomic/Select/index.d.ts +2 -0
- package/dist/components/atomic/Switch/Switch.d.ts +11 -0
- package/dist/components/atomic/Switch/Switch.js +32 -0
- package/dist/components/atomic/Switch/index.d.ts +2 -0
- package/dist/components/atomic/TextArea/TextArea.d.ts +14 -0
- package/dist/components/atomic/TextArea/TextArea.js +35 -0
- package/dist/components/atomic/TextArea/index.d.ts +2 -0
- package/dist/components/atomic/TextInput/TextInput.d.ts +18 -0
- package/dist/components/atomic/TextInput/TextInput.js +42 -0
- package/dist/components/atomic/TextInput/index.d.ts +2 -0
- package/dist/components/atomic/Tooltip/Tooltip.d.ts +14 -0
- package/dist/components/atomic/Tooltip/Tooltip.js +14 -0
- package/dist/components/atomic/Tooltip/index.d.ts +2 -0
- package/dist/components/layout/FormLayout/FormLayout.d.ts +9 -0
- package/dist/components/layout/FormLayout/FormLayout.js +15 -0
- package/dist/components/layout/FormLayout/index.d.ts +2 -0
- package/dist/components/molecule/ConfirmDialog/ConfirmDialog.d.ts +17 -0
- package/dist/components/molecule/ConfirmDialog/ConfirmDialog.js +28 -0
- package/dist/components/molecule/ConfirmDialog/index.d.ts +2 -0
- package/dist/components/molecule/DropdownMenu/DropdownMenu.d.ts +28 -0
- package/dist/components/molecule/DropdownMenu/DropdownMenu.js +53 -0
- package/dist/components/molecule/DropdownMenu/index.d.ts +2 -0
- package/dist/components/molecule/FormField/FormField.d.ts +16 -0
- package/dist/components/molecule/FormField/FormField.js +47 -0
- package/dist/components/molecule/FormField/index.d.ts +2 -0
- package/dist/components/molecule/Modal/Modal.d.ts +22 -0
- package/dist/components/molecule/Modal/Modal.js +48 -0
- package/dist/components/molecule/Modal/index.d.ts +2 -0
- package/dist/components/molecule/Popover/Popover.d.ts +24 -0
- package/dist/components/molecule/Popover/Popover.js +38 -0
- package/dist/components/molecule/Popover/index.d.ts +2 -0
- package/dist/components/molecule/Toaster/Toaster.d.ts +3 -0
- package/dist/components/molecule/Toaster/Toaster.js +19 -0
- package/dist/components/molecule/Toaster/index.d.ts +3 -0
- package/dist/components/molecule/Toaster/toast.d.ts +13 -0
- package/dist/components/molecule/Toaster/toast.js +18 -0
- package/dist/components/ui/alert-dialog.js +61 -0
- package/dist/components/ui/checkbox.js +18 -0
- package/dist/components/ui/dialog.js +78 -0
- package/dist/components/ui/dropdown-menu.js +42 -0
- package/dist/components/ui/field.js +65 -0
- package/dist/components/ui/input.js +14 -0
- package/dist/components/ui/label.js +12 -0
- package/dist/components/ui/popover.js +32 -0
- package/dist/components/ui/select.js +75 -0
- package/dist/components/ui/switch.js +18 -0
- package/dist/components/ui/textarea.js +12 -0
- package/dist/components/ui/tooltip.js +39 -0
- package/dist/index.d.ts +31 -2
- package/dist/index.js +16 -1
- package/dist/lib/types.d.ts +19 -1
- package/dist/theme/brandTheme.d.ts +1 -1
- package/dist/theme/brandTheme.js +10 -8
- package/package.json +2 -1
- package/src/styles/index.css +45 -43
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { cn } from "cn";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
4
|
+
import "react";
|
|
5
|
+
import { Select } from "@base-ui/react/select";
|
|
6
|
+
// src/components/ui/select.tsx
|
|
7
|
+
const Select$1 = Select.Root;
|
|
8
|
+
const SelectValue = ({ className, ...props }) => {
|
|
9
|
+
return /* @__PURE__ */ jsx(Select.Value, {
|
|
10
|
+
"data-slot": "select-value",
|
|
11
|
+
className: cn("flex flex-1 text-left", className),
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
const SelectTrigger = ({ className, size = "default", children, ...props }) => {
|
|
16
|
+
return /* @__PURE__ */ jsxs(Select.Trigger, {
|
|
17
|
+
"data-slot": "select-trigger",
|
|
18
|
+
"data-size": size,
|
|
19
|
+
className: cn("border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 flex w-fit items-center justify-between gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
20
|
+
...props,
|
|
21
|
+
children: [children, /* @__PURE__ */ jsx(Select.Icon, { render: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4" }) })]
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const SelectContent = ({ className, children, side = "bottom", sideOffset = 4, align = "center", alignOffset = 0, alignItemWithTrigger = true, ...props }) => {
|
|
25
|
+
return /* @__PURE__ */ jsx(Select.Portal, { children: /* @__PURE__ */ jsx(Select.Positioner, {
|
|
26
|
+
side,
|
|
27
|
+
sideOffset,
|
|
28
|
+
align,
|
|
29
|
+
alignOffset,
|
|
30
|
+
alignItemWithTrigger,
|
|
31
|
+
className: "isolate z-50",
|
|
32
|
+
children: /* @__PURE__ */ jsxs(Select.Popup, {
|
|
33
|
+
"data-slot": "select-content",
|
|
34
|
+
"data-align-trigger": alignItemWithTrigger,
|
|
35
|
+
className: cn("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg shadow-md ring-1 duration-100 data-[align-trigger=true]:animate-none", className),
|
|
36
|
+
...props,
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
39
|
+
/* @__PURE__ */ jsx(Select.List, { children }),
|
|
40
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
41
|
+
]
|
|
42
|
+
})
|
|
43
|
+
}) });
|
|
44
|
+
};
|
|
45
|
+
const SelectItem = ({ className, children, ...props }) => {
|
|
46
|
+
return /* @__PURE__ */ jsxs(Select.Item, {
|
|
47
|
+
"data-slot": "select-item",
|
|
48
|
+
className: cn("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
|
|
49
|
+
...props,
|
|
50
|
+
children: [/* @__PURE__ */ jsx(Select.ItemText, {
|
|
51
|
+
className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap",
|
|
52
|
+
children
|
|
53
|
+
}), /* @__PURE__ */ jsx(Select.ItemIndicator, {
|
|
54
|
+
render: /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" }),
|
|
55
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "pointer-events-none" })
|
|
56
|
+
})]
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const SelectScrollUpButton = ({ className, ...props }) => {
|
|
60
|
+
return /* @__PURE__ */ jsx(Select.ScrollUpArrow, {
|
|
61
|
+
"data-slot": "select-scroll-up-button",
|
|
62
|
+
className: cn("bg-popover top-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
63
|
+
...props,
|
|
64
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, {})
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const SelectScrollDownButton = ({ className, ...props }) => {
|
|
68
|
+
return /* @__PURE__ */ jsx(Select.ScrollDownArrow, {
|
|
69
|
+
"data-slot": "select-scroll-down-button",
|
|
70
|
+
className: cn("bg-popover bottom-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
71
|
+
...props,
|
|
72
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
export { Select$1 as Select, SelectContent, SelectItem, SelectScrollDownButton, SelectScrollUpButton, SelectTrigger, SelectValue };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Switch } from "@base-ui/react/switch";
|
|
5
|
+
// src/components/ui/switch.tsx
|
|
6
|
+
const Switch$1 = ({ className, size = "default", ...props }) => {
|
|
7
|
+
return /* @__PURE__ */ jsx(Switch.Root, {
|
|
8
|
+
"data-slot": "switch",
|
|
9
|
+
"data-size": size,
|
|
10
|
+
className: cn("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 aria-invalid:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]", className),
|
|
11
|
+
...props,
|
|
12
|
+
children: /* @__PURE__ */ jsx(Switch.Thumb, {
|
|
13
|
+
"data-slot": "switch-thumb",
|
|
14
|
+
className: "bg-background dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0"
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export { Switch$1 as Switch };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { cn } from "cn";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
// src/components/ui/textarea.tsx
|
|
5
|
+
const Textarea = ({ className, ...props }) => {
|
|
6
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
7
|
+
"data-slot": "textarea",
|
|
8
|
+
className: cn("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 disabled:bg-input/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 flex field-sizing-content min-h-16 w-full rounded-lg border bg-transparent px-2.5 py-2 text-base transition-colors outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm", className),
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export { Textarea };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { cn } from "cn";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Tooltip } from "@base-ui/react/tooltip";
|
|
4
|
+
// src/components/ui/tooltip.tsx
|
|
5
|
+
const TooltipProvider = ({ delay = 0, ...props }) => {
|
|
6
|
+
return /* @__PURE__ */ jsx(Tooltip.Provider, {
|
|
7
|
+
"data-slot": "tooltip-provider",
|
|
8
|
+
delay,
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
const Tooltip$1 = ({ ...props }) => {
|
|
13
|
+
return /* @__PURE__ */ jsx(Tooltip.Root, {
|
|
14
|
+
"data-slot": "tooltip",
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const TooltipTrigger = ({ ...props }) => {
|
|
19
|
+
return /* @__PURE__ */ jsx(Tooltip.Trigger, {
|
|
20
|
+
"data-slot": "tooltip-trigger",
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const TooltipContent = ({ className, side = "top", sideOffset = 4, align = "center", alignOffset = 0, children, ...props }) => {
|
|
25
|
+
return /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
|
|
26
|
+
align,
|
|
27
|
+
alignOffset,
|
|
28
|
+
side,
|
|
29
|
+
sideOffset,
|
|
30
|
+
className: "isolate z-50",
|
|
31
|
+
children: /* @__PURE__ */ jsxs(Tooltip.Popup, {
|
|
32
|
+
"data-slot": "tooltip-content",
|
|
33
|
+
className: cn("bg-foreground text-background data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md px-3 py-1.5 text-xs has-data-[slot=kbd]:pr-1.5 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm", className),
|
|
34
|
+
...props,
|
|
35
|
+
children: [children, /* @__PURE__ */ jsx(Tooltip.Arrow, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" })]
|
|
36
|
+
})
|
|
37
|
+
}) });
|
|
38
|
+
};
|
|
39
|
+
export { Tooltip$1 as Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,19 +3,48 @@ import { Badge, BadgeProps } from "./components/atomic/Badge/Badge.js";
|
|
|
3
3
|
import "./components/atomic/Button/index.js";
|
|
4
4
|
import { ButtonVariant } from "./components/atomic/Button/buttonVariant.js";
|
|
5
5
|
import { Button, ButtonProps } from "./components/atomic/Button/Button.js";
|
|
6
|
+
import "./components/atomic/Checkbox/index.js";
|
|
7
|
+
import { Checkbox, CheckboxProps } from "./components/atomic/Checkbox/Checkbox.js";
|
|
8
|
+
import "./components/atomic/ColorInput/index.js";
|
|
9
|
+
import { ColorInput, ColorInputProps } from "./components/atomic/ColorInput/ColorInput.js";
|
|
6
10
|
import "./components/atomic/Divider/index.js";
|
|
7
11
|
import { Divider, DividerProps } from "./components/atomic/Divider/Divider.js";
|
|
8
12
|
import "./components/atomic/Heading/index.js";
|
|
9
13
|
import { Heading, HeadingLevel, HeadingProps } from "./components/atomic/Heading/Heading.js";
|
|
14
|
+
import "./components/atomic/Switch/index.js";
|
|
15
|
+
import { Switch, SwitchProps } from "./components/atomic/Switch/Switch.js";
|
|
10
16
|
import "./components/atomic/Text/index.js";
|
|
11
17
|
import { Text, TextProps, TextSize, TextTone, TextWeight } from "./components/atomic/Text/Text.js";
|
|
18
|
+
import "./components/atomic/TextArea/index.js";
|
|
19
|
+
import { TextArea, TextAreaProps } from "./components/atomic/TextArea/TextArea.js";
|
|
20
|
+
import "./components/atomic/TextInput/index.js";
|
|
21
|
+
import { TextInput, TextInputProps, TextInputType } from "./components/atomic/TextInput/TextInput.js";
|
|
22
|
+
import "./components/atomic/Tooltip/index.js";
|
|
23
|
+
import { Tooltip, TooltipProps } from "./components/atomic/Tooltip/Tooltip.js";
|
|
12
24
|
import "./components/atomic/IconButton/index.js";
|
|
13
25
|
import { IconButton, IconButtonProps, IconButtonVariant } from "./components/atomic/IconButton/IconButton.js";
|
|
26
|
+
import "./components/atomic/Select/index.js";
|
|
27
|
+
import { Select, SelectOption, SelectProps } from "./components/atomic/Select/Select.js";
|
|
14
28
|
import "./components/atomic/Skeleton/index.js";
|
|
15
29
|
import { Skeleton, SkeletonProps, SkeletonShape } from "./components/atomic/Skeleton/Skeleton.js";
|
|
16
30
|
import "./components/atomic/Spinner/index.js";
|
|
17
31
|
import { Spinner, SpinnerProps } from "./components/atomic/Spinner/Spinner.js";
|
|
32
|
+
import "./components/layout/FormLayout/index.js";
|
|
33
|
+
import { FormLayout, FormLayoutDirection, FormLayoutProps } from "./components/layout/FormLayout/FormLayout.js";
|
|
34
|
+
import "./components/molecule/ConfirmDialog/index.js";
|
|
35
|
+
import { ConfirmDialog, ConfirmDialogProps } from "./components/molecule/ConfirmDialog/ConfirmDialog.js";
|
|
36
|
+
import "./components/molecule/DropdownMenu/index.js";
|
|
37
|
+
import { DropdownMenu, DropdownMenuProps, MenuItem } from "./components/molecule/DropdownMenu/DropdownMenu.js";
|
|
38
|
+
import "./components/molecule/FormField/index.js";
|
|
39
|
+
import { FormField, FormFieldControlProps, FormFieldProps } from "./components/molecule/FormField/FormField.js";
|
|
40
|
+
import "./components/molecule/Modal/index.js";
|
|
41
|
+
import { Modal, ModalProps, ModalSize } from "./components/molecule/Modal/Modal.js";
|
|
42
|
+
import "./components/molecule/Popover/index.js";
|
|
43
|
+
import { Popover, PopoverProps, PopoverWidth } from "./components/molecule/Popover/Popover.js";
|
|
44
|
+
import "./components/molecule/Toaster/index.js";
|
|
45
|
+
import { ToastOptions, toast } from "./components/molecule/Toaster/toast.js";
|
|
46
|
+
import { Toaster } from "./components/molecule/Toaster/Toaster.js";
|
|
18
47
|
import "./components/layout/Stack/index.js";
|
|
19
48
|
import { HStack, HStackProps, Stack, StackAlign, StackGap, StackJustify, StackProps, VStack, VStackProps } from "./components/layout/Stack/Stack.js";
|
|
20
|
-
import { IconComponent, Size, Tone } from "./lib/types.js";
|
|
21
|
-
export { Badge, type BadgeProps, Button, type ButtonProps, type ButtonVariant, Divider, type DividerProps, HStack, type HStackProps, Heading, type HeadingLevel, type HeadingProps, IconButton, type IconButtonProps, type IconButtonVariant, type IconComponent, type Size, Skeleton, type SkeletonProps, type SkeletonShape, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackJustify, type StackProps, Text, type TextProps, type TextSize, type TextTone, type TextWeight, type Tone, VStack, type VStackProps };
|
|
49
|
+
import { FieldBaseProps, IconComponent, OverlayAlign, OverlaySide, Size, Tone } from "./lib/types.js";
|
|
50
|
+
export { Badge, type BadgeProps, Button, type ButtonProps, type ButtonVariant, Checkbox, type CheckboxProps, ColorInput, type ColorInputProps, ConfirmDialog, type ConfirmDialogProps, Divider, type DividerProps, DropdownMenu, type DropdownMenuProps, type FieldBaseProps, FormField, type FormFieldControlProps, type FormFieldProps, FormLayout, type FormLayoutDirection, type FormLayoutProps, HStack, type HStackProps, Heading, type HeadingLevel, type HeadingProps, IconButton, type IconButtonProps, type IconButtonVariant, type IconComponent, type MenuItem, Modal, type ModalProps, type ModalSize, type OverlayAlign, type OverlaySide, Popover, type PopoverProps, type PopoverWidth, Select, type SelectOption, type SelectProps, type Size, Skeleton, type SkeletonProps, type SkeletonShape, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackJustify, type StackProps, Switch, type SwitchProps, Text, TextArea, type TextAreaProps, TextInput, type TextInputProps, type TextInputType, type TextProps, type TextSize, type TextTone, type TextWeight, type ToastOptions, Toaster, type Tone, Tooltip, type TooltipProps, VStack, type VStackProps, toast };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { Badge } from "./components/atomic/Badge/Badge.js";
|
|
2
2
|
import { Button } from "./components/atomic/Button/Button.js";
|
|
3
|
+
import { Checkbox } from "./components/atomic/Checkbox/Checkbox.js";
|
|
4
|
+
import { ColorInput } from "./components/atomic/ColorInput/ColorInput.js";
|
|
3
5
|
import { Divider } from "./components/atomic/Divider/Divider.js";
|
|
4
6
|
import { Heading } from "./components/atomic/Heading/Heading.js";
|
|
7
|
+
import { Switch } from "./components/atomic/Switch/Switch.js";
|
|
5
8
|
import { Text } from "./components/atomic/Text/Text.js";
|
|
9
|
+
import { TextArea } from "./components/atomic/TextArea/TextArea.js";
|
|
10
|
+
import { TextInput } from "./components/atomic/TextInput/TextInput.js";
|
|
11
|
+
import { Tooltip } from "./components/atomic/Tooltip/Tooltip.js";
|
|
6
12
|
import { IconButton } from "./components/atomic/IconButton/IconButton.js";
|
|
13
|
+
import { Select } from "./components/atomic/Select/Select.js";
|
|
7
14
|
import { Skeleton } from "./components/atomic/Skeleton/Skeleton.js";
|
|
8
15
|
import { Spinner } from "./components/atomic/Spinner/Spinner.js";
|
|
16
|
+
import { FormLayout } from "./components/layout/FormLayout/FormLayout.js";
|
|
17
|
+
import { ConfirmDialog } from "./components/molecule/ConfirmDialog/ConfirmDialog.js";
|
|
18
|
+
import { DropdownMenu } from "./components/molecule/DropdownMenu/DropdownMenu.js";
|
|
19
|
+
import { FormField } from "./components/molecule/FormField/FormField.js";
|
|
20
|
+
import { Modal } from "./components/molecule/Modal/Modal.js";
|
|
21
|
+
import { Popover } from "./components/molecule/Popover/Popover.js";
|
|
22
|
+
import { toast } from "./components/molecule/Toaster/toast.js";
|
|
23
|
+
import { Toaster } from "./components/molecule/Toaster/Toaster.js";
|
|
9
24
|
import { HStack, Stack, VStack } from "./components/layout/Stack/Stack.js";
|
|
10
|
-
export { Badge, Button, Divider, HStack, Heading, IconButton, Skeleton, Spinner, Stack, Text, VStack };
|
|
25
|
+
export { Badge, Button, Checkbox, ColorInput, ConfirmDialog, Divider, DropdownMenu, FormField, FormLayout, HStack, Heading, IconButton, Modal, Popover, Select, Skeleton, Spinner, Stack, Switch, Text, TextArea, TextInput, Toaster, Tooltip, VStack, toast };
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -2,9 +2,27 @@ import React from "react";
|
|
|
2
2
|
/** Shared size scale for every public component. */
|
|
3
3
|
export type Size = 'sm' | 'md' | 'lg';
|
|
4
4
|
export type Tone = 'neutral' | 'brand' | 'success' | 'warning' | 'danger' | 'info';
|
|
5
|
+
/** Which side of the trigger an overlay opens on. */
|
|
6
|
+
export type OverlaySide = 'top' | 'bottom' | 'left' | 'right';
|
|
7
|
+
/** How an overlay lines up with its trigger along that side. */
|
|
8
|
+
export type OverlayAlign = 'start' | 'center' | 'end';
|
|
5
9
|
/** An icon component (lucide-react, svgr): the design system controls its size and colour. */
|
|
6
10
|
export type IconComponent = React.ComponentType<{
|
|
7
11
|
className?: string;
|
|
8
12
|
'aria-hidden'?: boolean;
|
|
9
13
|
'data-icon'?: string;
|
|
10
|
-
}>;
|
|
14
|
+
}>;
|
|
15
|
+
/** Label, help and error props every form input shares (rendered by FormField). */
|
|
16
|
+
export interface FieldBaseProps {
|
|
17
|
+
/** Accessible name; always required, even when hidden. */
|
|
18
|
+
label: string;
|
|
19
|
+
/** Hides the label visually; screen readers still announce it. */
|
|
20
|
+
hideLabel?: boolean;
|
|
21
|
+
description?: string;
|
|
22
|
+
/** Message shown under the field; also sets aria-invalid. */
|
|
23
|
+
error?: string;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
id?: string;
|
|
27
|
+
'data-testid'?: string;
|
|
28
|
+
}
|
package/dist/theme/brandTheme.js
CHANGED
|
@@ -4,7 +4,7 @@ useMode(modeRgb);
|
|
|
4
4
|
useMode(modeLrgb);
|
|
5
5
|
useMode(modeOklab);
|
|
6
6
|
useMode(modeOklch);
|
|
7
|
-
const DEFAULT_BRAND_HEX = "#
|
|
7
|
+
const DEFAULT_BRAND_HEX = "#8556ef";
|
|
8
8
|
const SURFACES = {
|
|
9
9
|
light: [{
|
|
10
10
|
mode: "oklch",
|
|
@@ -13,12 +13,14 @@ const SURFACES = {
|
|
|
13
13
|
}],
|
|
14
14
|
dark: [{
|
|
15
15
|
mode: "oklch",
|
|
16
|
-
l: .
|
|
17
|
-
c:
|
|
16
|
+
l: .141,
|
|
17
|
+
c: .005,
|
|
18
|
+
h: 285.823
|
|
18
19
|
}, {
|
|
19
20
|
mode: "oklch",
|
|
20
|
-
l: .
|
|
21
|
-
c:
|
|
21
|
+
l: .21,
|
|
22
|
+
c: .006,
|
|
23
|
+
h: 285.885
|
|
22
24
|
}]
|
|
23
25
|
};
|
|
24
26
|
const DIRECTION = {
|
|
@@ -48,7 +50,7 @@ const BLACK = {
|
|
|
48
50
|
c: 0
|
|
49
51
|
};
|
|
50
52
|
const MIN_UI_CONTRAST = 3;
|
|
51
|
-
const MIN_TEXT_CONTRAST = 4.
|
|
53
|
+
const MIN_TEXT_CONTRAST = 4.55;
|
|
52
54
|
const LIGHTNESS_STEP = .005;
|
|
53
55
|
const MAX_STEPS = 200;
|
|
54
56
|
const WHITE_LABEL_MAX_STEPS = 10;
|
|
@@ -137,10 +139,10 @@ const parseBrand = (hex) => {
|
|
|
137
139
|
};
|
|
138
140
|
/** Brand tokens for light and dark from one org hex. Never throws; bad input → default. */
|
|
139
141
|
const brandTheme = (hex) => {
|
|
140
|
-
const input = parseBrand(hex ?? "#
|
|
142
|
+
const input = parseBrand(hex ?? "#8556ef");
|
|
141
143
|
if (input) return buildTheme(input);
|
|
142
144
|
return {
|
|
143
|
-
...buildTheme(parseBrand("#
|
|
145
|
+
...buildTheme(parseBrand("#8556ef") ?? BLACK),
|
|
144
146
|
warnings: ["invalid"]
|
|
145
147
|
};
|
|
146
148
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ashwa-io/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Ashwa design system: locked React components on shadcn/ui (Base UI) and Tailwind v4, with per-org brand theming.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
"class-variance-authority": "^0.7.1",
|
|
103
103
|
"cn": "^0.5.2",
|
|
104
104
|
"culori": "^4.0.2",
|
|
105
|
+
"sonner": "^2.0.8",
|
|
105
106
|
"tw-animate-css": "^1.4.0"
|
|
106
107
|
}
|
|
107
108
|
}
|
package/src/styles/index.css
CHANGED
|
@@ -64,27 +64,27 @@
|
|
|
64
64
|
:root {
|
|
65
65
|
/* Brand group: defaults = brandTheme(DEFAULT_BRAND_HEX). Per-org values come from
|
|
66
66
|
brandThemeCss(hex) in @ashwa-io/ui/theme, injected at runtime, and outrank these. */
|
|
67
|
-
--brand: oklch(0.
|
|
67
|
+
--brand: oklch(0.586 0.218 292.5);
|
|
68
68
|
--brand-foreground: oklch(1 0 0);
|
|
69
|
-
--brand-text: oklch(0.
|
|
70
|
-
--brand-tint: oklch(0.965 0.018
|
|
71
|
-
--brand-tint-foreground: oklch(0.
|
|
72
|
-
--brand-map: #
|
|
69
|
+
--brand-text: oklch(0.586 0.218 292.5);
|
|
70
|
+
--brand-tint: oklch(0.965 0.018 292.5);
|
|
71
|
+
--brand-tint-foreground: oklch(0.561 0.218 292.5);
|
|
72
|
+
--brand-map: #8556ef;
|
|
73
73
|
|
|
74
74
|
--background: oklch(1 0 0);
|
|
75
|
-
--foreground: oklch(0.
|
|
75
|
+
--foreground: oklch(0.141 0.005 285.823);
|
|
76
76
|
--card: oklch(1 0 0);
|
|
77
|
-
--card-foreground: oklch(0.
|
|
77
|
+
--card-foreground: oklch(0.141 0.005 285.823);
|
|
78
78
|
--popover: oklch(1 0 0);
|
|
79
|
-
--popover-foreground: oklch(0.
|
|
79
|
+
--popover-foreground: oklch(0.141 0.005 285.823);
|
|
80
80
|
--primary: var(--brand);
|
|
81
81
|
--primary-foreground: var(--brand-foreground);
|
|
82
|
-
--secondary: oklch(0.
|
|
83
|
-
--secondary-foreground: oklch(0.
|
|
84
|
-
--muted: oklch(0.
|
|
85
|
-
--muted-foreground: oklch(0.
|
|
86
|
-
--accent: oklch(0.
|
|
87
|
-
--accent-foreground: oklch(0.
|
|
82
|
+
--secondary: oklch(0.967 0.001 286.375);
|
|
83
|
+
--secondary-foreground: oklch(0.21 0.006 285.885);
|
|
84
|
+
--muted: oklch(0.967 0.001 286.375);
|
|
85
|
+
--muted-foreground: oklch(0.552 0.016 285.938);
|
|
86
|
+
--accent: oklch(0.967 0.001 286.375);
|
|
87
|
+
--accent-foreground: oklch(0.21 0.006 285.885);
|
|
88
88
|
/* Tailwind red-700, darker than base-nova's red-600: destructive text on its 10% tint
|
|
89
89
|
(Button destructive) must reach WCAG AA 4.5:1; red-600 only reached 4:1. */
|
|
90
90
|
--destructive: oklch(0.505 0.213 27.518);
|
|
@@ -93,58 +93,60 @@
|
|
|
93
93
|
--success: oklch(0.448 0.119 151.328);
|
|
94
94
|
--warning: oklch(0.473 0.137 46.201);
|
|
95
95
|
--info: oklch(0.488 0.243 264.376);
|
|
96
|
-
--border: oklch(0.
|
|
97
|
-
--input: oklch(0.
|
|
96
|
+
--border: oklch(0.92 0.004 286.32);
|
|
97
|
+
--input: oklch(0.92 0.004 286.32);
|
|
98
98
|
--ring: var(--brand);
|
|
99
99
|
--chart-1: var(--brand);
|
|
100
|
-
--chart-2: oklch(0.
|
|
101
|
-
--chart-3: oklch(0.
|
|
102
|
-
--chart-4: oklch(0.
|
|
103
|
-
--chart-5: oklch(0.
|
|
100
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
101
|
+
--chart-3: oklch(0.398 0.07 227.392);
|
|
102
|
+
--chart-4: oklch(0.828 0.189 84.429);
|
|
103
|
+
--chart-5: oklch(0.769 0.188 70.08);
|
|
104
104
|
--radius: 0.5rem;
|
|
105
105
|
--sidebar: oklch(0.985 0 0);
|
|
106
|
-
--sidebar-foreground: oklch(0.
|
|
106
|
+
--sidebar-foreground: oklch(0.141 0.005 285.823);
|
|
107
107
|
--sidebar-primary: var(--brand);
|
|
108
108
|
--sidebar-primary-foreground: var(--brand-foreground);
|
|
109
|
-
--sidebar-accent: oklch(0.
|
|
110
|
-
--sidebar-accent-foreground: oklch(0.
|
|
111
|
-
--sidebar-border: oklch(0.
|
|
109
|
+
--sidebar-accent: oklch(0.967 0.001 286.375);
|
|
110
|
+
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
|
|
111
|
+
--sidebar-border: oklch(0.92 0.004 286.32);
|
|
112
112
|
--sidebar-ring: var(--brand);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
.dark {
|
|
116
|
-
--brand: oklch(0.
|
|
116
|
+
--brand: oklch(0.586 0.218 292.5);
|
|
117
117
|
--brand-foreground: oklch(1 0 0);
|
|
118
|
-
--brand-text: oklch(0.
|
|
119
|
-
--brand-tint: oklch(0.3 0.04
|
|
120
|
-
--brand-tint-foreground: oklch(0.
|
|
121
|
-
--brand-map: #
|
|
118
|
+
--brand-text: oklch(0.626 0.218 292.5);
|
|
119
|
+
--brand-tint: oklch(0.3 0.04 292.5);
|
|
120
|
+
--brand-tint-foreground: oklch(0.686 0.181 292.5);
|
|
121
|
+
--brand-map: #8556ef;
|
|
122
122
|
|
|
123
|
-
--background: oklch(0.
|
|
123
|
+
--background: oklch(0.141 0.005 285.823);
|
|
124
124
|
--foreground: oklch(0.985 0 0);
|
|
125
|
-
--card: oklch(0.
|
|
125
|
+
--card: oklch(0.21 0.006 285.885);
|
|
126
126
|
--card-foreground: oklch(0.985 0 0);
|
|
127
|
-
--popover: oklch(0.
|
|
127
|
+
--popover: oklch(0.21 0.006 285.885);
|
|
128
128
|
--popover-foreground: oklch(0.985 0 0);
|
|
129
|
-
--secondary: oklch(0.
|
|
129
|
+
--secondary: oklch(0.274 0.006 286.033);
|
|
130
130
|
--secondary-foreground: oklch(0.985 0 0);
|
|
131
|
-
--muted: oklch(0.
|
|
132
|
-
--muted-foreground: oklch(0.
|
|
133
|
-
--accent: oklch(0.
|
|
131
|
+
--muted: oklch(0.274 0.006 286.033);
|
|
132
|
+
--muted-foreground: oklch(0.705 0.015 286.067);
|
|
133
|
+
--accent: oklch(0.274 0.006 286.033);
|
|
134
134
|
--accent-foreground: oklch(0.985 0 0);
|
|
135
|
-
|
|
135
|
+
/* Lighter than nigam's red-400: destructive text on its 20% tint must reach 4.5:1 on dialog
|
|
136
|
+
footers (red-400 only reached 4.2). */
|
|
137
|
+
--destructive: oklch(0.76 0.191 22.216);
|
|
136
138
|
--success: oklch(0.792 0.209 151.711);
|
|
137
139
|
--warning: oklch(0.828 0.189 84.429);
|
|
138
140
|
--info: oklch(0.707 0.165 254.624);
|
|
139
141
|
--border: oklch(1 0 0 / 10%);
|
|
140
142
|
--input: oklch(1 0 0 / 15%);
|
|
141
|
-
--chart-2: oklch(0.
|
|
142
|
-
--chart-3: oklch(0.
|
|
143
|
-
--chart-4: oklch(0.
|
|
144
|
-
--chart-5: oklch(0.
|
|
145
|
-
--sidebar: oklch(0.
|
|
143
|
+
--chart-2: oklch(0.696 0.17 162.48);
|
|
144
|
+
--chart-3: oklch(0.769 0.188 70.08);
|
|
145
|
+
--chart-4: oklch(0.627 0.265 303.9);
|
|
146
|
+
--chart-5: oklch(0.645 0.246 16.439);
|
|
147
|
+
--sidebar: oklch(0.21 0.006 285.885);
|
|
146
148
|
--sidebar-foreground: oklch(0.985 0 0);
|
|
147
|
-
--sidebar-accent: oklch(0.
|
|
149
|
+
--sidebar-accent: oklch(0.274 0.006 286.033);
|
|
148
150
|
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
149
151
|
--sidebar-border: oklch(1 0 0 / 10%);
|
|
150
152
|
}
|