@onesaz/ui 0.4.10 → 0.4.11
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/index.d.ts +2 -2
- package/dist/index.js +33 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -191,7 +191,7 @@ declare const Caption: React.ForwardRefExoticComponent<Omit<TypographyProps, "va
|
|
|
191
191
|
|
|
192
192
|
type ButtonColor = 'default' | 'success' | 'warning' | 'error' | 'destructive';
|
|
193
193
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
194
|
-
variant?: '
|
|
194
|
+
variant?: 'contained' | 'destructive' | 'outlined' | 'secondary' | 'ghost' | 'link';
|
|
195
195
|
size?: 'default' | 'sm' | 'lg' | 'icon';
|
|
196
196
|
color?: ButtonColor;
|
|
197
197
|
/** Whether the button should take the full width of its container */
|
|
@@ -540,7 +540,7 @@ interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
540
540
|
declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLDivElement>>;
|
|
541
541
|
|
|
542
542
|
type ChipColor = 'default' | 'success' | 'warning' | 'error' | 'destructive';
|
|
543
|
-
type ChipVariant = '
|
|
543
|
+
type ChipVariant = 'contained' | 'outlined';
|
|
544
544
|
type ChipSize = 'small' | 'medium';
|
|
545
545
|
interface ChipProps extends React.HTMLAttributes<HTMLElement> {
|
|
546
546
|
/** The text content of the chip */
|
package/dist/index.js
CHANGED
|
@@ -870,28 +870,28 @@ var useButtonGroup = () => React6.useContext(ButtonGroupContext);
|
|
|
870
870
|
var colorMap = {
|
|
871
871
|
success: {
|
|
872
872
|
contained: "bg-success-500 text-white hover:bg-success-600 dark:bg-success-600 dark:hover:bg-success-700",
|
|
873
|
-
|
|
873
|
+
outlined: "border border-success-500 bg-transparent text-success-600 hover:bg-success-500/10 dark:text-success-400 dark:hover:bg-success-500/10",
|
|
874
874
|
secondary: "bg-success-500/10 text-success-700 hover:bg-success-500/15 dark:text-success-300 dark:hover:bg-success-500/15",
|
|
875
875
|
ghost: "text-success-600 hover:bg-success-500/10 dark:text-success-400 dark:hover:bg-success-500/10",
|
|
876
876
|
link: "text-success-600 dark:text-success-400"
|
|
877
877
|
},
|
|
878
878
|
warning: {
|
|
879
879
|
contained: "bg-warning-500 text-white hover:bg-warning-600 dark:bg-warning-600 dark:hover:bg-warning-700",
|
|
880
|
-
|
|
880
|
+
outlined: "border border-warning-500 bg-transparent text-warning-600 hover:bg-warning-500/10 dark:text-warning-400 dark:hover:bg-warning-500/10",
|
|
881
881
|
secondary: "bg-warning-500/10 text-warning-700 hover:bg-warning-500/15 dark:text-warning-300 dark:hover:bg-warning-500/15",
|
|
882
882
|
ghost: "text-warning-600 hover:bg-warning-500/10 dark:text-warning-400 dark:hover:bg-warning-500/10",
|
|
883
883
|
link: "text-warning-600 dark:text-warning-400"
|
|
884
884
|
},
|
|
885
885
|
error: {
|
|
886
886
|
contained: "bg-error-500 text-white hover:bg-error-600 dark:bg-error-600 dark:hover:bg-error-700",
|
|
887
|
-
|
|
887
|
+
outlined: "border border-error-500 bg-transparent text-error-600 hover:bg-error-500/10 dark:text-error-400 dark:hover:bg-error-500/10",
|
|
888
888
|
secondary: "bg-error-500/10 text-error-700 hover:bg-error-500/15 dark:text-error-300 dark:hover:bg-error-500/15",
|
|
889
889
|
ghost: "text-error-600 hover:bg-error-500/10 dark:text-error-400 dark:hover:bg-error-500/10",
|
|
890
890
|
link: "text-error-600 dark:text-error-400"
|
|
891
891
|
},
|
|
892
892
|
destructive: {
|
|
893
893
|
contained: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
894
|
-
|
|
894
|
+
outlined: "border border-destructive bg-transparent text-destructive hover:bg-destructive/10",
|
|
895
895
|
secondary: "bg-destructive/10 text-destructive hover:bg-destructive/20",
|
|
896
896
|
ghost: "text-destructive hover:bg-destructive/10",
|
|
897
897
|
link: "text-destructive"
|
|
@@ -899,8 +899,8 @@ var colorMap = {
|
|
|
899
899
|
};
|
|
900
900
|
function variantToShape(variant) {
|
|
901
901
|
switch (variant) {
|
|
902
|
-
case "
|
|
903
|
-
return "
|
|
902
|
+
case "outlined":
|
|
903
|
+
return "outlined";
|
|
904
904
|
case "secondary":
|
|
905
905
|
return "secondary";
|
|
906
906
|
case "ghost":
|
|
@@ -947,15 +947,15 @@ var Button = React6.forwardRef(
|
|
|
947
947
|
...props
|
|
948
948
|
}, ref) => {
|
|
949
949
|
const groupCtx = useButtonGroup();
|
|
950
|
-
const resolvedVariant = variant ?? groupCtx.variant ?? "
|
|
950
|
+
const resolvedVariant = variant ?? groupCtx.variant ?? "contained";
|
|
951
951
|
const resolvedSize = size ?? "default";
|
|
952
952
|
const resolvedColor = color ?? groupCtx.color ?? "default";
|
|
953
953
|
const resolvedDisabled = disabled ?? groupCtx.disabled;
|
|
954
954
|
const colorOverride = resolvedColor !== "default" ? colorMap[resolvedColor]?.[variantToShape(resolvedVariant)] ?? null : null;
|
|
955
955
|
const variantClasses3 = colorOverride ? null : {
|
|
956
|
-
"bg-accent text-accent-foreground hover:bg-accent-hover": resolvedVariant === "
|
|
956
|
+
"bg-accent text-accent-foreground hover:bg-accent-hover": resolvedVariant === "contained",
|
|
957
957
|
"bg-destructive text-destructive-foreground hover:bg-destructive/90": resolvedVariant === "destructive",
|
|
958
|
-
"border border-input bg-background hover:text-foreground dark:border-border dark:text-foreground dark:hover:bg-muted": resolvedVariant === "
|
|
958
|
+
"border border-input bg-background hover:text-foreground dark:border-border dark:text-foreground dark:hover:bg-muted": resolvedVariant === "outlined",
|
|
959
959
|
"bg-muted text-foreground hover:bg-muted/80": resolvedVariant === "secondary",
|
|
960
960
|
"hover:bg-muted hover:text-foreground": resolvedVariant === "ghost",
|
|
961
961
|
"text-accent underline-offset-4 hover:underline": resolvedVariant === "link"
|
|
@@ -1003,12 +1003,12 @@ var iconButtonSizes = {
|
|
|
1003
1003
|
lg: "h-12 w-12"
|
|
1004
1004
|
};
|
|
1005
1005
|
var IconButton = React6.forwardRef(
|
|
1006
|
-
({ className, variant = "
|
|
1006
|
+
({ className, variant = "contained", color = "default", size = "md", rounded = false, loading = false, ...props }, ref) => {
|
|
1007
1007
|
const colorOverride = color !== "default" ? colorMap[color]?.[variantToShape(variant)] ?? null : null;
|
|
1008
1008
|
const variantClasses3 = colorOverride ? null : {
|
|
1009
|
-
"bg-accent text-accent-foreground hover:bg-accent-hover": variant === "
|
|
1009
|
+
"bg-accent text-accent-foreground hover:bg-accent-hover": variant === "contained",
|
|
1010
1010
|
"bg-destructive text-destructive-foreground hover:bg-destructive/90": variant === "destructive",
|
|
1011
|
-
"border border-input bg-background hover:text-foreground dark:border-border dark:text-foreground dark:hover:bg-muted": variant === "
|
|
1011
|
+
"border border-input bg-background hover:text-foreground dark:border-border dark:text-foreground dark:hover:bg-muted": variant === "outlined",
|
|
1012
1012
|
"bg-muted text-foreground hover:bg-muted/80": variant === "secondary",
|
|
1013
1013
|
"hover:bg-muted hover:text-foreground": variant === "ghost",
|
|
1014
1014
|
"text-accent underline-offset-4 hover:underline": variant === "link"
|
|
@@ -3451,14 +3451,14 @@ Badge.displayName = "Badge";
|
|
|
3451
3451
|
// src/components/chip.tsx
|
|
3452
3452
|
import * as React21 from "react";
|
|
3453
3453
|
import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3454
|
-
var
|
|
3454
|
+
var containedClasses2 = {
|
|
3455
3455
|
default: "bg-accent text-accent-foreground",
|
|
3456
3456
|
success: "bg-success-500 text-white dark:bg-success-600",
|
|
3457
3457
|
warning: "bg-warning-500 text-white dark:bg-warning-600",
|
|
3458
3458
|
error: "bg-error-500 text-white dark:bg-error-600",
|
|
3459
3459
|
destructive: "bg-destructive text-destructive-foreground"
|
|
3460
3460
|
};
|
|
3461
|
-
var
|
|
3461
|
+
var containedHoverClasses = {
|
|
3462
3462
|
default: "hover:bg-accent-hover",
|
|
3463
3463
|
success: "hover:bg-success-600 dark:hover:bg-success-500",
|
|
3464
3464
|
warning: "hover:bg-warning-600 dark:hover:bg-warning-500",
|
|
@@ -3500,7 +3500,7 @@ var Chip = React21.forwardRef(
|
|
|
3500
3500
|
({
|
|
3501
3501
|
className,
|
|
3502
3502
|
label,
|
|
3503
|
-
variant = "
|
|
3503
|
+
variant = "contained",
|
|
3504
3504
|
color = "default",
|
|
3505
3505
|
size = "medium",
|
|
3506
3506
|
icon,
|
|
@@ -3520,9 +3520,9 @@ var Chip = React21.forwardRef(
|
|
|
3520
3520
|
const isClickable = clickable || !!onClick || !!href;
|
|
3521
3521
|
const Component = component ?? (href ? "a" : "div");
|
|
3522
3522
|
const safeSize = size in sizeClasses3 ? size : "medium";
|
|
3523
|
-
const safeVariant = variant === "
|
|
3524
|
-
const colorClass = safeVariant === "
|
|
3525
|
-
const hoverClass = isClickable && !disabled ? safeVariant === "
|
|
3523
|
+
const safeVariant = variant === "contained" || variant === "outlined" ? variant : "contained";
|
|
3524
|
+
const colorClass = safeVariant === "contained" ? containedClasses2[color] ?? containedClasses2.default : outlinedClasses2[color] ?? outlinedClasses2.default;
|
|
3525
|
+
const hoverClass = isClickable && !disabled ? safeVariant === "contained" ? containedHoverClasses[color] ?? containedHoverClasses.default : outlinedHoverClasses[color] ?? outlinedHoverClasses.default : "";
|
|
3526
3526
|
const handleKeyDown = (e) => {
|
|
3527
3527
|
if (!disabled) {
|
|
3528
3528
|
if (isClickable && (e.key === "Enter" || e.key === " ")) {
|
|
@@ -5186,7 +5186,7 @@ var PaginationLink = React35.forwardRef(
|
|
|
5186
5186
|
Button,
|
|
5187
5187
|
{
|
|
5188
5188
|
ref,
|
|
5189
|
-
variant: isActive ? "
|
|
5189
|
+
variant: isActive ? "contained" : "outlined",
|
|
5190
5190
|
size: "icon",
|
|
5191
5191
|
className: cn("h-9 w-9", className),
|
|
5192
5192
|
...props
|
|
@@ -5198,7 +5198,7 @@ var PaginationPrevious = React35.forwardRef(({ className, ...props }, ref) => /*
|
|
|
5198
5198
|
Button,
|
|
5199
5199
|
{
|
|
5200
5200
|
ref,
|
|
5201
|
-
variant: "
|
|
5201
|
+
variant: "outlined",
|
|
5202
5202
|
size: "default",
|
|
5203
5203
|
className: cn("gap-1 pl-2.5", className),
|
|
5204
5204
|
...props,
|
|
@@ -5228,7 +5228,7 @@ var PaginationNext = React35.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
5228
5228
|
Button,
|
|
5229
5229
|
{
|
|
5230
5230
|
ref,
|
|
5231
|
-
variant: "
|
|
5231
|
+
variant: "outlined",
|
|
5232
5232
|
size: "default",
|
|
5233
5233
|
className: cn("gap-1 pr-2.5", className),
|
|
5234
5234
|
...props,
|
|
@@ -6071,7 +6071,7 @@ var ColumnVisibilityDropdown = ({
|
|
|
6071
6071
|
/* @__PURE__ */ jsxs24(
|
|
6072
6072
|
Button,
|
|
6073
6073
|
{
|
|
6074
|
-
variant: "
|
|
6074
|
+
variant: "outlined",
|
|
6075
6075
|
size: "sm",
|
|
6076
6076
|
onClick: () => setOpen(!open),
|
|
6077
6077
|
className: "h-9 gap-2",
|
|
@@ -6212,7 +6212,7 @@ var DataGridPagination = ({
|
|
|
6212
6212
|
/* @__PURE__ */ jsx37(PaginationItem, { children: /* @__PURE__ */ jsx37(
|
|
6213
6213
|
Button,
|
|
6214
6214
|
{
|
|
6215
|
-
variant: "
|
|
6215
|
+
variant: "outlined",
|
|
6216
6216
|
size: "icon",
|
|
6217
6217
|
className: "h-8 w-8",
|
|
6218
6218
|
onClick: () => table.setPageIndex(0),
|
|
@@ -6223,7 +6223,7 @@ var DataGridPagination = ({
|
|
|
6223
6223
|
/* @__PURE__ */ jsx37(PaginationItem, { children: /* @__PURE__ */ jsx37(
|
|
6224
6224
|
Button,
|
|
6225
6225
|
{
|
|
6226
|
-
variant: "
|
|
6226
|
+
variant: "outlined",
|
|
6227
6227
|
size: "icon",
|
|
6228
6228
|
className: "h-8 w-8",
|
|
6229
6229
|
onClick: () => table.previousPage(),
|
|
@@ -6235,7 +6235,7 @@ var DataGridPagination = ({
|
|
|
6235
6235
|
/* @__PURE__ */ jsx37(PaginationItem, { children: /* @__PURE__ */ jsx37(
|
|
6236
6236
|
Button,
|
|
6237
6237
|
{
|
|
6238
|
-
variant: "
|
|
6238
|
+
variant: "outlined",
|
|
6239
6239
|
size: "icon",
|
|
6240
6240
|
className: "h-8 w-8",
|
|
6241
6241
|
onClick: () => table.nextPage(),
|
|
@@ -6246,7 +6246,7 @@ var DataGridPagination = ({
|
|
|
6246
6246
|
/* @__PURE__ */ jsx37(PaginationItem, { children: /* @__PURE__ */ jsx37(
|
|
6247
6247
|
Button,
|
|
6248
6248
|
{
|
|
6249
|
-
variant: "
|
|
6249
|
+
variant: "outlined",
|
|
6250
6250
|
size: "icon",
|
|
6251
6251
|
className: "h-8 w-8",
|
|
6252
6252
|
onClick: () => table.setPageIndex(pageCount - 1),
|
|
@@ -6330,7 +6330,7 @@ var ExportDropdown = ({
|
|
|
6330
6330
|
/* @__PURE__ */ jsxs24(
|
|
6331
6331
|
Button,
|
|
6332
6332
|
{
|
|
6333
|
-
variant: "
|
|
6333
|
+
variant: "outlined",
|
|
6334
6334
|
size: "sm",
|
|
6335
6335
|
onClick: () => setOpen(!open),
|
|
6336
6336
|
className: "h-9 gap-2",
|
|
@@ -6395,7 +6395,7 @@ var MoreOptionsDropdown = ({
|
|
|
6395
6395
|
/* @__PURE__ */ jsx37(
|
|
6396
6396
|
Button,
|
|
6397
6397
|
{
|
|
6398
|
-
variant: "
|
|
6398
|
+
variant: "outlined",
|
|
6399
6399
|
size: "icon",
|
|
6400
6400
|
onClick: () => setOpen(!open),
|
|
6401
6401
|
className: "h-9 w-9",
|
|
@@ -10593,9 +10593,9 @@ var PlaygroundContent = () => {
|
|
|
10593
10593
|
] }),
|
|
10594
10594
|
/* @__PURE__ */ jsxs35(Section, { title: "Button", children: [
|
|
10595
10595
|
/* @__PURE__ */ jsxs35("div", { className: "flex flex-wrap gap-4", children: [
|
|
10596
|
-
/* @__PURE__ */ jsx50(Button, { variant: "
|
|
10596
|
+
/* @__PURE__ */ jsx50(Button, { variant: "contained", children: "Default" }),
|
|
10597
10597
|
/* @__PURE__ */ jsx50(Button, { variant: "destructive", children: "Destructive" }),
|
|
10598
|
-
/* @__PURE__ */ jsx50(Button, { variant: "
|
|
10598
|
+
/* @__PURE__ */ jsx50(Button, { variant: "outlined", children: "Outline" }),
|
|
10599
10599
|
/* @__PURE__ */ jsx50(Button, { variant: "secondary", children: "Secondary" }),
|
|
10600
10600
|
/* @__PURE__ */ jsx50(Button, { variant: "ghost", children: "Ghost" }),
|
|
10601
10601
|
/* @__PURE__ */ jsx50(Button, { variant: "link", children: "Link" })
|
|
@@ -10608,7 +10608,7 @@ var PlaygroundContent = () => {
|
|
|
10608
10608
|
] }),
|
|
10609
10609
|
/* @__PURE__ */ jsxs35("div", { className: "flex flex-wrap gap-4 mt-4", children: [
|
|
10610
10610
|
/* @__PURE__ */ jsx50(Button, { disabled: true, children: "Disabled" }),
|
|
10611
|
-
/* @__PURE__ */ jsx50(Button, { variant: "
|
|
10611
|
+
/* @__PURE__ */ jsx50(Button, { variant: "outlined", disabled: true, children: "Disabled Outline" })
|
|
10612
10612
|
] })
|
|
10613
10613
|
] }),
|
|
10614
10614
|
/* @__PURE__ */ jsx50(Section, { title: "Input", children: /* @__PURE__ */ jsxs35("div", { className: "space-y-4 max-w-md", children: [
|
|
@@ -10751,7 +10751,7 @@ var PlaygroundContent = () => {
|
|
|
10751
10751
|
] }),
|
|
10752
10752
|
/* @__PURE__ */ jsx50(CardContent, { children: /* @__PURE__ */ jsx50("p", { className: "text-foreground", children: "This is the card content area." }) }),
|
|
10753
10753
|
/* @__PURE__ */ jsxs35(CardFooter, { children: [
|
|
10754
|
-
/* @__PURE__ */ jsx50(Button, { variant: "
|
|
10754
|
+
/* @__PURE__ */ jsx50(Button, { variant: "outlined", className: "mr-2", children: "Cancel" }),
|
|
10755
10755
|
/* @__PURE__ */ jsx50(Button, { children: "Submit" })
|
|
10756
10756
|
] })
|
|
10757
10757
|
] }),
|
|
@@ -10809,7 +10809,7 @@ var PlaygroundContent = () => {
|
|
|
10809
10809
|
] })
|
|
10810
10810
|
] }),
|
|
10811
10811
|
/* @__PURE__ */ jsxs35(DialogFooter, { children: [
|
|
10812
|
-
/* @__PURE__ */ jsx50(Button, { variant: "
|
|
10812
|
+
/* @__PURE__ */ jsx50(Button, { variant: "outlined", onClick: () => setDialogOpen(false), children: "CANCEL" }),
|
|
10813
10813
|
/* @__PURE__ */ jsx50(Button, { onClick: () => setDialogOpen(false), children: "Create" })
|
|
10814
10814
|
] })
|
|
10815
10815
|
] }) })
|