@g4rcez/components 0.0.36 → 0.0.38
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/core/button.d.ts +2 -7
- package/dist/components/core/button.d.ts.map +1 -1
- package/dist/components/core/button.js +13 -10
- package/dist/components/core/tag.d.ts +2 -2
- package/dist/components/core/tag.d.ts.map +1 -1
- package/dist/components/core/tag.js +9 -10
- package/dist/components/display/alert.d.ts +1 -1
- package/dist/components/display/notifications.d.ts +1 -1
- package/dist/components/display/tabs.d.ts.map +1 -1
- package/dist/components/display/tabs.js +7 -25
- package/dist/components/floating/expand.js +1 -1
- package/dist/components/floating/menu.d.ts +11 -5
- package/dist/components/floating/menu.d.ts.map +1 -1
- package/dist/components/floating/menu.js +10 -8
- package/dist/components/floating/modal.js +1 -1
- package/dist/components/floating/toolbar.d.ts +6 -0
- package/dist/components/floating/toolbar.d.ts.map +1 -0
- package/dist/components/floating/toolbar.js +4 -0
- package/dist/components/floating/tooltip.d.ts +2 -1
- package/dist/components/floating/tooltip.d.ts.map +1 -1
- package/dist/components/floating/tooltip.js +4 -3
- package/dist/components/form/input-field.js +1 -1
- package/dist/components/form/input.js +1 -1
- package/dist/components/form/select.d.ts.map +1 -1
- package/dist/components/form/switch.d.ts.map +1 -1
- package/dist/components/form/switch.js +7 -8
- package/dist/components/index.d.ts +4 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -3
- package/dist/components/table/index.d.ts +7 -4
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/index.js +25 -10
- package/dist/components/table/table-lib.d.ts +4 -1
- package/dist/components/table/table-lib.d.ts.map +1 -1
- package/dist/components/table/thead.d.ts +1 -1
- package/dist/components/table/thead.d.ts.map +1 -1
- package/dist/components/table/thead.js +7 -7
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -0
- package/dist/hooks/use-form.d.ts.map +1 -1
- package/dist/hooks/use-form.js +3 -2
- package/dist/index.css +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6490 -6262
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +43 -43
- package/dist/index.umd.js.map +1 -1
- package/dist/preset/preset.tailwind.d.ts.map +1 -1
- package/dist/preset/preset.tailwind.js +3 -3
- package/dist/preset/src/styles/theme.d.ts.map +1 -1
- package/dist/preset/src/styles/theme.js +145 -21
- package/dist/preset/src/styles/theme.types.d.ts +12 -13
- package/dist/preset/src/styles/theme.types.d.ts.map +1 -1
- package/dist/styles/theme.d.ts.map +1 -1
- package/dist/styles/theme.js +145 -21
- package/dist/styles/theme.types.d.ts +12 -13
- package/dist/styles/theme.types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -3,19 +3,14 @@ import React from "react";
|
|
|
3
3
|
import { type Label } from "../../types";
|
|
4
4
|
import { PolymorphicProps } from "./polymorph";
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
size?: "big" | "small" | "default" | "icon" | null | undefined;
|
|
6
|
+
size?: "big" | "small" | "min" | "default" | "icon" | null | undefined;
|
|
7
7
|
rounded?: "circle" | "default" | "rough" | "squared" | null | undefined;
|
|
8
|
-
theme?: "main" | "
|
|
8
|
+
theme?: "main" | "disabled" | "loading" | "raw" | "danger" | "info" | "neutral" | "primary" | "secondary" | "success" | "warn" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
10
10
|
export type ButtonProps<T extends React.ElementType = "button"> = PolymorphicProps<VariantProps<typeof buttonVariants> & Partial<{
|
|
11
11
|
icon: Label;
|
|
12
12
|
loading: boolean;
|
|
13
13
|
}>, T>;
|
|
14
14
|
export declare const Button: <T extends React.ElementType = "button">(props: ButtonProps<T>) => any;
|
|
15
|
-
type Props = {
|
|
16
|
-
active: string;
|
|
17
|
-
buttons: ButtonProps[];
|
|
18
|
-
};
|
|
19
|
-
export declare const ButtonGroup: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
15
|
export {};
|
|
21
16
|
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/core/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/core/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAa,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D,QAAA,MAAM,cAAc;;;;mFAiCnB,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,IAAI,gBAAgB,CAC9E,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,EAChF,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,GAsB7E,CAAC"}
|
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import { jsxs as _jsxs
|
|
2
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { forwardRef } from "react";
|
|
5
5
|
import { css } from "../../lib/dom";
|
|
6
6
|
import { Polymorph } from "./polymorph";
|
|
7
|
-
const buttonVariants = cva("inline-flex duration-
|
|
7
|
+
const buttonVariants = cva("inline-flex duration-500 enabled:hover:bg-opacity-70 data-[loading=true]:opacity-30 data-[loading=true]:animate-pulse gap-1.5 border-2 border-transparent items-center justify-center align-middle cursor-pointer whitespace-nowrap font-medium transition-colors ease-in disabled:cursor-not-allowed disabled:bg-opacity-40 disabled:text-opacity-80 focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring ease-normal", {
|
|
8
8
|
variants: {
|
|
9
9
|
size: {
|
|
10
10
|
default: "h-10 px-4 py-2",
|
|
11
11
|
big: "h-12 px-6 py-4",
|
|
12
12
|
small: "h-8 p-2 text-sm",
|
|
13
|
+
min: "h-7 px-2 py-1 text-sm",
|
|
13
14
|
icon: "p-1",
|
|
14
15
|
},
|
|
15
16
|
rounded: {
|
|
16
17
|
rough: "rounded-sm",
|
|
17
|
-
default: "rounded-
|
|
18
|
+
default: "rounded-button",
|
|
18
19
|
squared: "rounded-none",
|
|
19
20
|
circle: "rounded-full aspect-square",
|
|
20
21
|
},
|
|
21
22
|
theme: {
|
|
22
23
|
raw: "",
|
|
23
|
-
|
|
24
|
+
danger: "bg-button-danger-bg text-button-danger-text",
|
|
25
|
+
disabled: "bg-disabled duration-700 opacity-70",
|
|
26
|
+
info: "bg-button-info-bg text-button-info-text",
|
|
27
|
+
loading: "animate-pulse bg-disabled duration-700 opacity-70",
|
|
24
28
|
main: "bg-primary text-primary-foreground",
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
secondary: "bg-secondary-
|
|
28
|
-
success: "bg-success text-success-
|
|
29
|
-
|
|
29
|
+
neutral: "bg-transparent border border-card-border",
|
|
30
|
+
primary: "bg-button-primary-bg text-button-primary-text",
|
|
31
|
+
secondary: "bg-button-secondary-bg text-button-secondary-text",
|
|
32
|
+
success: "bg-button-success-bg text-button-success-text",
|
|
33
|
+
warn: "bg-button-warn-bg text-button-warn-text",
|
|
30
34
|
},
|
|
31
35
|
},
|
|
32
36
|
defaultVariants: { theme: "main", size: "default", rounded: "default" },
|
|
@@ -37,4 +41,3 @@ export const Button = forwardRef(function Button(_a, ref) {
|
|
|
37
41
|
const disabled = loading || props.disabled;
|
|
38
42
|
return (_jsxs(Polymorph, Object.assign({}, props, { ref: ref, type: type, "data-theme": theme, "data-loading": loading, disabled: disabled, "aria-busy": disabled || loading, as: (_b = props.as) !== null && _b !== void 0 ? _b : "button", onClick: disabled ? undefined : props.onClick, className: css(buttonVariants({ size, rounded, theme }), className), children: [icon, props.children] })));
|
|
39
43
|
});
|
|
40
|
-
export const ButtonGroup = (props) => (_jsx("ul", { className: "border-main-bg text-main-foreground flex w-full flex-row rounded-md border-2", children: props.buttons.map((button) => (_jsx("li", { className: "flex flex-1", children: _jsx("button", Object.assign({}, button, { type: button.type || "button", "data-active": props.active === button.name ? "true" : "false", className: css("flex flex-1 items-center gap-1.5 rounded-sm border-r-2 px-4 py-2 last:border-r-0", "cursor-pointer justify-center whitespace-nowrap align-middle font-medium", "focus-visible:ring-ring shadow-sm focus-visible:outline-none focus-visible:ring-2 disabled:text-opacity-80", "data-[active=true]:bg-main-bg text-body data-[active=true]:text-main transition-colors ease-in disabled:cursor-not-allowed disabled:bg-opacity-50") })) }, `button-group-${button.name}`))) }));
|
|
@@ -3,11 +3,11 @@ import React from "react";
|
|
|
3
3
|
import { Label } from "../../types";
|
|
4
4
|
import { PolymorphicProps } from "./polymorph";
|
|
5
5
|
declare const indicatorVariant: (props?: ({
|
|
6
|
-
theme?: "main" | "
|
|
6
|
+
theme?: "main" | "danger" | "info" | "secondary" | "success" | "warn" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare const tagVariants: (props?: ({
|
|
9
9
|
size?: "big" | "small" | "default" | "icon" | null | undefined;
|
|
10
|
-
theme?: "
|
|
10
|
+
theme?: "disabled" | "loading" | "danger" | "info" | "neutral" | "primary" | "secondary" | "success" | "warn" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
12
12
|
export type TagProps<T extends React.ElementType = "span"> = PolymorphicProps<VariantProps<typeof tagVariants> & Partial<{
|
|
13
13
|
icon: Label;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../src/components/core/tag.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAa,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D,QAAA,MAAM,gBAAgB;;mFAWpB,CAAC;AAEH,QAAA,MAAM,WAAW;;;
|
|
1
|
+
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../src/components/core/tag.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAa,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D,QAAA,MAAM,gBAAgB;;mFAWpB,CAAC;AAEH,QAAA,MAAM,WAAW;;;mFAqBf,CAAC;AAEH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,gBAAgB,CACzE,YAAY,CAAC,OAAO,WAAW,CAAC,GAC5B,OAAO,CAAC;IACJ,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC;CAC7D,CAAC,EACN,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,GAWrE,CAAC"}
|
|
@@ -16,7 +16,7 @@ const indicatorVariant = cva("size-2.5 aspect-square rounded-full border-0", {
|
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
|
-
const tagVariants = cva("inline-flex rounded-pill gap-1.5
|
|
19
|
+
const tagVariants = cva("inline-flex rounded-pill gap-1.5 border-2 border-transparent items-center justify-center align-middle whitespace-nowrap", {
|
|
20
20
|
variants: {
|
|
21
21
|
size: {
|
|
22
22
|
icon: "p-1",
|
|
@@ -25,19 +25,18 @@ const tagVariants = cva("inline-flex rounded-pill gap-1.5 text-main-foreground b
|
|
|
25
25
|
small: "h-6 p-2 px-3 text-sm",
|
|
26
26
|
},
|
|
27
27
|
theme: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
info: "bg-info-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
primary: "bg-tag-primary-bg text-tag-primary-text",
|
|
29
|
+
danger: "bg-tag-danger-bg text-tag-danger-text",
|
|
30
|
+
info: "bg-tag-info-bg text-tag-info-text",
|
|
31
|
+
success: "bg-tag-success-bg text-tag-success-text",
|
|
32
|
+
secondary: "bg-tag-secondary-bg text-tag-secondary-text",
|
|
33
|
+
warn: "bg-tag-warn-bg text-tag-warn-text",
|
|
34
|
+
neutral: "bg-transparent border border-card-border",
|
|
34
35
|
disabled: "bg-disabled duration-700 opacity-70",
|
|
35
36
|
loading: "animate-pulse bg-disabled duration-700 opacity-70",
|
|
36
|
-
secondary: "bg-secondary-background text-secondary-foreground",
|
|
37
|
-
neutral: "bg-transparent border-card-border border text-foreground",
|
|
38
37
|
},
|
|
39
38
|
},
|
|
40
|
-
defaultVariants: { theme: "
|
|
39
|
+
defaultVariants: { theme: "primary", size: "default" },
|
|
41
40
|
});
|
|
42
41
|
export const Tag = forwardRef(function Tag(_a, ref) {
|
|
43
42
|
var _b;
|
|
@@ -7,7 +7,7 @@ type CollapseProps = {
|
|
|
7
7
|
} & HTMLMotionProps<"section">;
|
|
8
8
|
export declare const Collapse: (props: PropsWithChildren<CollapseProps>) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
declare const alertVariants: (props?: ({
|
|
10
|
-
theme?: "danger" | "
|
|
10
|
+
theme?: "danger" | "info" | "neutral" | "success" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
12
12
|
export type AlertProps<T extends React.ElementType = "div"> = PolymorphicProps<VariantProps<typeof alertVariants> & Partial<{
|
|
13
13
|
container: string;
|
|
@@ -2,7 +2,7 @@ import { type VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import { type PropsWithChildren } from "react";
|
|
3
3
|
import { Label } from "../../types";
|
|
4
4
|
declare const variants: (props?: ({
|
|
5
|
-
theme?: "default" | "
|
|
5
|
+
theme?: "default" | "danger" | "info" | "success" | "warn" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
7
|
type NotificationOptions = Partial<{
|
|
8
8
|
title: Label;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/components/display/tabs.tsx"],"names":[],"mappings":"AAEA,OAAc,EAA2B,iBAAiB,
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/components/display/tabs.tsx"],"names":[],"mappings":"AAEA,OAAc,EAA2B,iBAAiB,EAAkD,MAAM,OAAO,CAAC;AAG1H,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,MAAM,MAAM,SAAS,GAAG;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAIF,eAAO,MAAM,IAAI,UAAW,iBAAiB,CAAC,SAAS,CAAC,4CA2FvD,CAAC;AAIF,MAAM,MAAM,QAAQ,GACd;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAChD;IACI,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAER,eAAO,MAAM,GAAG,UAAW,iBAAiB,CAAC,QAAQ,CAAC,4CAGrD,CAAC"}
|
|
@@ -1,29 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx
|
|
3
|
-
import {
|
|
4
|
-
import React, { createContext, Fragment, useContext, useEffect, useLayoutEffect, useRef
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useMotionValue } from "framer-motion";
|
|
4
|
+
import React, { createContext, Fragment, useContext, useEffect, useLayoutEffect, useRef } from "react";
|
|
5
5
|
import { useReactive } from "../../hooks/use-reactive";
|
|
6
6
|
import { useStableRef } from "../../hooks/use-stable-ref";
|
|
7
|
-
import { Button } from "../core/button";
|
|
8
|
-
import { Modal } from "../floating/modal";
|
|
9
7
|
import { Card } from "./card";
|
|
10
8
|
const Context = createContext("");
|
|
11
|
-
const SelectTab = (props) => {
|
|
12
|
-
var _a;
|
|
13
|
-
const [view, setView] = useState(false);
|
|
14
|
-
const title = props.items.find((x) => {
|
|
15
|
-
const inner = x.props;
|
|
16
|
-
return inner.id === props.active;
|
|
17
|
-
});
|
|
18
|
-
return (_jsxs("div", { className: "my-4 flex min-w-full px-8 text-center lg:hidden", children: [_jsx(Button, { className: "min-w-full", onClick: () => setView(true), children: (_a = title === null || title === void 0 ? void 0 : title.props) === null || _a === void 0 ? void 0 : _a.title }), _jsx(Modal, { closable: true, onChange: setView, open: view, type: "dialog", children: _jsx("ul", { className: "mt-4 space-y-4", children: props.items.map((x) => {
|
|
19
|
-
const inner = x.props;
|
|
20
|
-
const onClick = () => {
|
|
21
|
-
props.setActive(inner.id);
|
|
22
|
-
setView(false);
|
|
23
|
-
};
|
|
24
|
-
return (_jsx("li", { className: "min-w-full", children: _jsx(Button, { className: "w-full", onClick: onClick, theme: inner.id === props.active ? "primary" : "secondary", children: inner.title }) }, inner.id));
|
|
25
|
-
}) }) })] }));
|
|
26
|
-
};
|
|
27
9
|
export const Tabs = (props) => {
|
|
28
10
|
const [active, setActive] = useReactive(props.active);
|
|
29
11
|
const left = useMotionValue(0);
|
|
@@ -73,10 +55,10 @@ export const Tabs = (props) => {
|
|
|
73
55
|
left.set(anchor.offsetLeft);
|
|
74
56
|
setActive(anchor.dataset.id || "");
|
|
75
57
|
};
|
|
76
|
-
return (_jsx(Context.Provider, { value: active, children: _jsx(Card, { container: "pt-0
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
58
|
+
return (_jsx(Context.Provider, { value: active, children: _jsx(Card, { className: props.className, container: "pt-0 max-w-full w-full min-w-0", header: _jsx("header", { ref: ref, className: "relative mb-2 overflow-x-auto border-b border-card-border", children: _jsx("nav", { className: "min-w-0", children: _jsx("ul", { className: "flex w-0 min-w-full flex-1 justify-start overflow-x-auto", children: items.map((x) => {
|
|
59
|
+
const inner = x.props;
|
|
60
|
+
return (_jsx("li", { "data-id": inner.id, "data-active": active === inner.id, className: "w-full border-b-2 border-card-border data-[active=true]:border-primary data-[active=true]:font-bold data-[active=true]:text-primary", children: _jsx(Render, { "data-id": inner.id, onClick: onClick, "aria-current": "page", href: props.useHash ? `#${inner.id}` : undefined, className: "block w-full whitespace-nowrap px-10 py-4", children: inner.title }) }, `tab-header-${inner.id}`));
|
|
61
|
+
}) }) }) }), children: props.children }) }));
|
|
80
62
|
};
|
|
81
63
|
const useTabs = () => useContext(Context);
|
|
82
64
|
export const Tab = (props) => {
|
|
@@ -2,11 +2,13 @@ import { LucideProps } from "lucide-react";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Override } from "../../types";
|
|
4
4
|
export type MenuProps = Partial<{
|
|
5
|
+
FloatingComponent: React.ElementType;
|
|
6
|
+
floatingClassName: string;
|
|
5
7
|
hover: boolean;
|
|
6
8
|
nested: boolean;
|
|
7
9
|
isParent: boolean;
|
|
8
|
-
children: React.ReactNode;
|
|
9
10
|
asChild: boolean;
|
|
11
|
+
children: React.ReactNode;
|
|
10
12
|
} & ({
|
|
11
13
|
label: string;
|
|
12
14
|
} | {
|
|
@@ -24,20 +26,24 @@ type MenuItemProps = {
|
|
|
24
26
|
Right?: React.FC<LucideProps>;
|
|
25
27
|
};
|
|
26
28
|
export declare const MenuItem: React.ForwardRefExoticComponent<Override<React.ButtonHTMLAttributes<HTMLButtonElement>, MenuItemProps> & React.RefAttributes<HTMLButtonElement>>;
|
|
27
|
-
export declare const Menu: React.ForwardRefExoticComponent<(Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "
|
|
29
|
+
export declare const Menu: React.ForwardRefExoticComponent<(Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "hover" | "FloatingComponent" | "floatingClassName" | "nested" | "isParent" | "asChild"> & Partial<{
|
|
30
|
+
FloatingComponent: React.ElementType;
|
|
31
|
+
floatingClassName: string;
|
|
28
32
|
hover: boolean;
|
|
29
33
|
nested: boolean;
|
|
30
34
|
isParent: boolean;
|
|
31
|
-
children: React.ReactNode;
|
|
32
35
|
asChild: boolean;
|
|
36
|
+
children: React.ReactNode;
|
|
33
37
|
} & {
|
|
34
38
|
label: string;
|
|
35
|
-
}>, "ref"> | Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "
|
|
39
|
+
}>, "ref"> | Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "hover" | "FloatingComponent" | "floatingClassName" | "nested" | "isParent" | "asChild"> & Partial<{
|
|
40
|
+
FloatingComponent: React.ElementType;
|
|
41
|
+
floatingClassName: string;
|
|
36
42
|
hover: boolean;
|
|
37
43
|
nested: boolean;
|
|
38
44
|
isParent: boolean;
|
|
39
|
-
children: React.ReactNode;
|
|
40
45
|
asChild: boolean;
|
|
46
|
+
children: React.ReactNode;
|
|
41
47
|
} & {
|
|
42
48
|
label: React.ReactElement;
|
|
43
49
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/components/floating/menu.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAAoB,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAA2E,MAAM,OAAO,CAAC;AAGhG,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAyBvC,MAAM,MAAM,SAAS,GAAG,OAAO,CAC3B;IACI,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/components/floating/menu.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAAoB,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAA2E,MAAM,OAAO,CAAC;AAGhG,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAyBvC,MAAM,MAAM,SAAS,GAAG,OAAO,CAC3B;IACI,iBAAiB,EAAE,KAAK,CAAC,WAAW,CAAC;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,GAAG,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CACzE,CAAC;AAkKF,KAAK,aAAa,GACZ;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,GACpE;IAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAEtG,eAAO,MAAM,QAAQ,kJAiCpB,CAAC;AAEF,eAAO,MAAM,IAAI;uBAjNU,KAAK,CAAC,WAAW;uBACjB,MAAM;WAClB,OAAO;YACN,OAAO;cACL,OAAO;aACR,OAAO;cACN,KAAK,CAAC,SAAS;;WACf,MAAM;;uBAPG,KAAK,CAAC,WAAW;uBACjB,MAAM;WAClB,OAAO;YACN,OAAO;cACL,OAAO;aACR,OAAO;cACN,KAAK,CAAC,SAAS;;WACK,KAAK,CAAC,YAAY;WAAS,MAAM;qDAmNrE,CAAC"}
|
|
@@ -5,18 +5,18 @@ import { autoUpdate, flip, FloatingFocusManager, FloatingList, FloatingNode, Flo
|
|
|
5
5
|
import { Slot } from "@radix-ui/react-slot";
|
|
6
6
|
import { ChevronRightIcon } from "lucide-react";
|
|
7
7
|
import React, { createContext, Fragment, useContext, useEffect, useRef, useState } from "react";
|
|
8
|
-
import { FLOATING_DELAY } from "../../constants";
|
|
8
|
+
import { FLOATING_DELAY, TYPEAHEAD_RESET_DELAY } from "../../constants";
|
|
9
9
|
import { css } from "../../lib/dom";
|
|
10
|
-
const menuItemClassName = (highlight = "") => css("w-full min-w-36 outline-none
|
|
10
|
+
const menuItemClassName = (highlight = "") => css("w-full min-w-36 outline-none p-2.5 items-center flex justify-between text-left", "hover:bg-primary data-[open]:bg-primary focus:bg-primary aria-expanded:opacity-80", "first-of-type:rounded-t-lg last-of-type:rounded-b-lg", "disabled:opacity-40 disabled:cursor-not-allowed", highlight);
|
|
11
11
|
const MenuContext = createContext({
|
|
12
|
-
isOpen: false,
|
|
13
12
|
activeIndex: null,
|
|
14
13
|
getItemProps: () => ({}),
|
|
14
|
+
isOpen: false,
|
|
15
15
|
setActiveIndex: () => { },
|
|
16
16
|
setHasFocusInside: () => { },
|
|
17
17
|
});
|
|
18
18
|
const MenuComponent = React.forwardRef((_a, forwardedRef) => {
|
|
19
|
-
var { children, hover = true, isParent, label } = _a, props = __rest(_a, ["children", "hover", "isParent", "label"]);
|
|
19
|
+
var { children, FloatingComponent = "div", hover = true, isParent, floatingClassName = "", label } = _a, props = __rest(_a, ["children", "FloatingComponent", "hover", "isParent", "floatingClassName", "label"]);
|
|
20
20
|
const parentId = useFloatingParentNodeId();
|
|
21
21
|
const isNested = parentId !== null;
|
|
22
22
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -34,7 +34,8 @@ const MenuComponent = React.forwardRef((_a, forwardedRef) => {
|
|
|
34
34
|
transform: true,
|
|
35
35
|
onOpenChange: setIsOpen,
|
|
36
36
|
whileElementsMounted: autoUpdate,
|
|
37
|
-
placement: isNested ? "right
|
|
37
|
+
placement: isNested ? "right" : "bottom-start",
|
|
38
|
+
strategy: "absolute",
|
|
38
39
|
middleware: [offset({ mainAxis: isNested ? 0 : 4, alignmentAxis: isNested ? -4 : 0 }), flip(), shift()],
|
|
39
40
|
});
|
|
40
41
|
const role = useRole(context, { role: "menu", enabled: true });
|
|
@@ -63,6 +64,7 @@ const MenuComponent = React.forwardRef((_a, forwardedRef) => {
|
|
|
63
64
|
const typeahead = useTypeahead(context, {
|
|
64
65
|
activeIndex,
|
|
65
66
|
listRef: labelsRef,
|
|
67
|
+
resetMs: TYPEAHEAD_RESET_DELAY,
|
|
66
68
|
onMatch: isOpen ? setActiveIndex : undefined,
|
|
67
69
|
});
|
|
68
70
|
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([hoverModule, click, role, dismiss, listNavigation, typeahead]);
|
|
@@ -86,18 +88,18 @@ const MenuComponent = React.forwardRef((_a, forwardedRef) => {
|
|
|
86
88
|
if (isOpen && tree)
|
|
87
89
|
tree.events.emit("menuopen", { parentId, nodeId });
|
|
88
90
|
}, [tree, isOpen, nodeId, parentId]);
|
|
89
|
-
const className = isParent ? props.className : menuItemClassName(props.className);
|
|
91
|
+
const className = isParent ? props.className : css(menuItemClassName(props.className));
|
|
90
92
|
return (_jsxs(FloatingNode, { id: nodeId, children: [_jsx(Fragment, { children: props.asChild ? (_jsx(Slot, Object.assign({ children: label, ref: useMergeRefs([refs.setReference, item.ref, forwardedRef]), tabIndex: !isNested ? undefined : parent.activeIndex === item.index ? 0 : -1, "data-open": isOpen ? "" : undefined, "data-nested": isNested ? "" : undefined, role: isNested ? "menuitem" : undefined, "data-focus-inside": hasFocusInside ? "" : undefined, className: className }, getReferenceProps(parent.getItemProps(Object.assign(Object.assign({}, props), { onFocus(event) {
|
|
91
93
|
var _a;
|
|
92
94
|
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
93
95
|
setHasFocusInside(false);
|
|
94
96
|
parent.setHasFocusInside(true);
|
|
95
|
-
} })))))) : (_jsxs("button", Object.assign({ ref: useMergeRefs([refs.setReference, item.ref, forwardedRef]), tabIndex: !isNested ? undefined : parent.activeIndex === item.index ? 0 : -1, "data-open": isOpen ? "" : undefined, "data-nested": isNested ? "" : undefined, role: isNested ? "menuitem" : undefined, "data-focus-inside": hasFocusInside ? "" : undefined, className: className }, getReferenceProps(parent.getItemProps(Object.assign(Object.assign({}, props), { onFocus(event) {
|
|
97
|
+
} })))))) : (_jsxs("button", Object.assign({ type: "button", ref: useMergeRefs([refs.setReference, item.ref, forwardedRef]), tabIndex: !isNested ? undefined : parent.activeIndex === item.index ? 0 : -1, "data-open": isOpen ? "" : undefined, "data-nested": isNested ? "" : undefined, role: isNested ? "menuitem" : undefined, "data-focus-inside": hasFocusInside ? "" : undefined, className: className }, getReferenceProps(parent.getItemProps(Object.assign(Object.assign({}, props), { onFocus(event) {
|
|
96
98
|
var _a;
|
|
97
99
|
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
98
100
|
setHasFocusInside(false);
|
|
99
101
|
parent.setHasFocusInside(true);
|
|
100
|
-
} }))), { children: [label, isNested && (_jsxs("span", { style: { marginLeft: 10, fontSize: 10 }, children: [_jsx("span", { className: "sr-only", children: "Next menu" }), _jsx(ChevronRightIcon, { size: 14 })] }))] }))) }), _jsx(MenuContext.Provider, { value: { activeIndex, setActiveIndex, getItemProps, setHasFocusInside, isOpen }, children: _jsx(FloatingList, { elementsRef: elementsRef, labelsRef: labelsRef, children: isOpen && (_jsx(FloatingPortal, { preserveTabOrder: true, children: _jsx(FloatingFocusManager, { context: context, modal: false, initialFocus: isNested ? -1 : 0, returnFocus: !isNested, children: _jsx(
|
|
102
|
+
} }))), { children: [label, isNested && (_jsxs("span", { style: { marginLeft: 10, fontSize: 10 }, children: [_jsx("span", { className: "sr-only", children: "Next menu" }), _jsx(ChevronRightIcon, { size: 14 })] }))] }))) }), _jsx(MenuContext.Provider, { value: { activeIndex, setActiveIndex, getItemProps, setHasFocusInside, isOpen }, children: _jsx(FloatingList, { elementsRef: elementsRef, labelsRef: labelsRef, children: isOpen && (_jsx(FloatingPortal, { preserveTabOrder: true, children: _jsx(FloatingFocusManager, { context: context, modal: false, initialFocus: isNested ? -1 : 0, returnFocus: !isNested, children: _jsx(FloatingComponent, Object.assign({}, getFloatingProps(), { ref: refs.setFloating, style: Object.assign(Object.assign({}, props.style), floatingStyles), className: css("isolate z-tooltip flex flex-col items-start rounded-lg border border-floating-border bg-floating-background text-left shadow-xl outline-none", floatingClassName), children: children })) }) })) }) })] }));
|
|
101
103
|
});
|
|
102
104
|
export const MenuItem = React.forwardRef((_a, forwardedRef) => {
|
|
103
105
|
var { label, title, Right, disabled } = _a, props = __rest(_a, ["label", "title", "Right", "disabled"]);
|
|
@@ -82,7 +82,7 @@ export const Modal = (_a) => {
|
|
|
82
82
|
var { type: _type = "dialog", resizer = true, overlayClickClose = false, forceType = false, closable = true } = _a, props = __rest(_a, ["type", "resizer", "overlayClickClose", "forceType", "closable"]);
|
|
83
83
|
const headingId = useId();
|
|
84
84
|
const descriptionId = useId();
|
|
85
|
-
const isDesktop = useMediaQuery("(min-width:
|
|
85
|
+
const isDesktop = useMediaQuery("(min-width: 64rem)");
|
|
86
86
|
const useResizer = _type !== "dialog";
|
|
87
87
|
const position = isDesktop ? (_type === "drawer" ? props.position : positions[_type]) : forceType ? positions[_type] : positions.sheet;
|
|
88
88
|
const func = isDesktop ? animations[_type] : forceType ? animations[_type] : animations.sheet;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/floating/toolbar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,MAAM,YAAY,GAAG;IACvB,IAAI,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,OAAO,UAAW,iBAAiB,CAAC,YAAY,CAAC,4CAI7D,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { motion } from "framer-motion";
|
|
4
|
+
export const Toolbar = (props) => (_jsx(motion.div, { className: "sticky bottom-4 flex items-center justify-center rounded-lg border border-card-border bg-background p-4", children: props.children }));
|
|
@@ -6,6 +6,7 @@ export type TooltipProps<T extends ComponentLike = "span"> = Override<Polymorphi
|
|
|
6
6
|
title: Label;
|
|
7
7
|
enabled?: boolean;
|
|
8
8
|
placement?: Placement;
|
|
9
|
+
followCursor?: boolean;
|
|
9
10
|
}>;
|
|
10
|
-
export declare const Tooltip: <T extends ComponentLike = "span">({ children, placement, enabled, as, title, ...props }: TooltipProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const Tooltip: <T extends ComponentLike = "span">({ children, followCursor, placement, enabled, as, title, ...props }: TooltipProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/floating/tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,EAOH,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/floating/tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,EAOH,KAAK,SAAS,EASjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAqC,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAa,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE7D,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,aAAa,GAAG,MAAM,IAAI,QAAQ,CACjE,gBAAgB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC5C;IACI,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,CACJ,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,aAAa,gFAAwF,YAAY,CAAC,CAAC,CAAC,4CAuCrJ,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { __rest } from "tslib";
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { arrow, autoUpdate, flip, FloatingArrow, FloatingPortal, offset, shift, useDismiss, useFloating, useFocus, useHover, useInteractions, useRole, } from "@floating-ui/react";
|
|
4
|
+
import { arrow, autoUpdate, flip, FloatingArrow, FloatingPortal, offset, shift, useClientPoint, useDismiss, useFloating, useFocus, useHover, useInteractions, useRole, } from "@floating-ui/react";
|
|
5
5
|
import { Fragment, useRef, useState } from "react";
|
|
6
6
|
import { Polymorph } from "../../components/core/polymorph";
|
|
7
7
|
import { FLOATING_DELAY } from "../../constants";
|
|
8
8
|
export const Tooltip = (_a) => {
|
|
9
|
-
var { children, placement, enabled, as, title } = _a, props = __rest(_a, ["children", "placement", "enabled", "as", "title"]);
|
|
9
|
+
var { children, followCursor = false, placement, enabled, as, title } = _a, props = __rest(_a, ["children", "followCursor", "placement", "enabled", "as", "title"]);
|
|
10
10
|
const [open, setOpen] = useState(false);
|
|
11
11
|
const arrowRef = useRef(null);
|
|
12
12
|
const Component = as || "span";
|
|
@@ -22,6 +22,7 @@ export const Tooltip = (_a) => {
|
|
|
22
22
|
const focus = useFocus(context, { enabled });
|
|
23
23
|
const dismiss = useDismiss(context, { enabled });
|
|
24
24
|
const role = useRole(context, { role: "tooltip", enabled });
|
|
25
|
-
const
|
|
25
|
+
const clientPoint = useClientPoint(context, { enabled: !!enabled && !!followCursor });
|
|
26
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([hover, focus, dismiss, role, clientPoint]);
|
|
26
27
|
return (_jsxs(Fragment, { children: [_jsx(Component, Object.assign({ ref: refs.setReference }, getReferenceProps(props), { children: title })), _jsx(FloatingPortal, { children: open && (_jsxs(Polymorph, Object.assign({}, getFloatingProps(), { ref: refs.setFloating, style: floatingStyles, className: "z-tooltip rounded-lg border border-tooltip-border bg-tooltip-background p-3 text-tooltip-foreground shadow-lg", children: [_jsx(FloatingArrow, { ref: arrowRef, context: context, strokeWidth: 0.1, className: "fill-tooltip-background stroke-tooltip-border" }), children] }))) })] }));
|
|
27
28
|
};
|
|
@@ -10,5 +10,5 @@ export const InputField = ({ optionalText: _optionalText, left, rightLabel, cont
|
|
|
10
10
|
const ID = id !== null && id !== void 0 ? id : name;
|
|
11
11
|
const translation = useTranslations();
|
|
12
12
|
const optionalText = _optionalText !== null && _optionalText !== void 0 ? _optionalText : translation.inputOptionalLabel;
|
|
13
|
-
return (_jsxs("fieldset", { form: form, "data-error": !!error, "data-interactive": !!interactive, className: css("group inline-flex w-full gap-
|
|
13
|
+
return (_jsxs("fieldset", { form: form, "data-error": !!error, "data-interactive": !!interactive, className: css("group inline-flex w-full gap-input-gap", container), children: [_jsxs("label", { form: form, htmlFor: ID, className: "inline-flex w-full cursor-text flex-row flex-wrap justify-between gap-1 text-sm transition-colors empty:hidden group-hover:border-primary group-error:text-danger", children: [!hideLeft && !rightLabel ? (_jsx(InputFeedback, { info: info, hideLeft: hideLeft, reportStatus: true, title: title, placeholder: placeholder, children: optionalText || rightLabel ? (_jsxs(Fragment, { children: [!required ? _jsx("span", { className: "text-opacity-70", children: optionalText }) : null, rightLabel ? _jsx(Fragment, { children: rightLabel }) : null] })) : null })) : null, _jsxs("div", { className: `group relative flex w-full flex-row flex-nowrap items-center gap-x-2 gap-y-1 rounded-md border border-input-border bg-transparent transition-colors group-focus-within:border-primary group-hover:border-primary group-error:border-danger ${labelClassName} focus:ring-2 focus:ring-inset focus:ring-primary`, children: [left ? _jsx("span", { className: "absolute left-0 flex flex-nowrap gap-1 whitespace-nowrap pl-2", children: left }) : null, children, right ? _jsx("span", { className: "absolute right-0 flex flex-nowrap gap-2 whitespace-nowrap pr-1", children: right }) : null] })] }), _jsx("p", { className: "hidden text-xs empty:hidden group-has-[input:not(:focus):invalid[data-initialized=true]]:block group-error:block group-error:text-danger", children: error }), _jsx("p", { className: "text-xs empty:mt-0 empty:hidden group-has-[input:not(:focus):valid[data-initialized=true]]:block group-assert:block group-error:hidden", children: feedback })] }));
|
|
14
14
|
};
|
|
@@ -34,5 +34,5 @@ export const Input = forwardRef((_a, ref) => {
|
|
|
34
34
|
input.removeEventListener("keydown", goNextInputImpl);
|
|
35
35
|
};
|
|
36
36
|
}, []);
|
|
37
|
-
return (_jsx(InputField, { info: info, container: css("group inline-block w-full", container), error: error, feedback: feedback, hideLeft: hideLeft, left: left, optionalText: optionalText, right: right, rightLabel: rightLabel, interactive: interactive, form: props.form, id: props.name || props.id, name: props.name, labelClassName: labelClassName, title: props.title, placeholder: props.placeholder, required: props.required, children: _jsx(MaskInput, Object.assign({}, props, { type: type, "data-next": next, ref: mergeRefs(ref, inputRef), id: id, name: id, className: css("input
|
|
37
|
+
return (_jsx(InputField, { info: info, container: css("group inline-block w-full", container), error: error, feedback: feedback, hideLeft: hideLeft, left: left, optionalText: optionalText, right: right, rightLabel: rightLabel, interactive: interactive, form: props.form, id: props.name || props.id, name: props.name, labelClassName: labelClassName, title: props.title, placeholder: props.placeholder, required: props.required, children: _jsx(MaskInput, Object.assign({}, props, { type: type, "data-next": next, ref: mergeRefs(ref, inputRef), id: id, name: id, className: css("input placeholder-input-mask h-input-height px-input-x py-input-y group w-full flex-1 rounded-md bg-transparent text-foreground outline-none transition-colors group-error:text-danger group-error:placeholder-input-mask-error", !!right ? "pe-input-inline" : "", !!left ? "ps-input-inline" : "", props.className) })) }));
|
|
38
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/components/form/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAGlF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE/G,MAAM,MAAM,WAAW,GAAG,QAAQ,CAC9B,eAAe,CAAC,QAAQ,CAAC,EACzB;IACI,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/components/form/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAGlF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE/G,MAAM,MAAM,WAAW,GAAG,QAAQ,CAC9B,eAAe,CAAC,QAAQ,CAAC,EACzB;IACI,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC,CAAC;AAEP,eAAO,MAAM,MAAM,oGA4FlB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/components/form/switch.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8E,MAAM,OAAO,CAAC;AAInG,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/components/form/switch.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8E,MAAM,OAAO,CAAC;AAInG,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,MAAM,mGAiEjB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { __rest } from "tslib";
|
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { forwardRef, useEffect, useId, useImperativeHandle, useRef, useState } from "react";
|
|
5
5
|
import { useCallbackRef } from "../../hooks/use-callback-ref";
|
|
6
|
-
import { css
|
|
6
|
+
import { css } from "../../lib/dom";
|
|
7
7
|
export const Switch = forwardRef((_a, ref) => {
|
|
8
8
|
var _b;
|
|
9
9
|
var { children, container, error } = _a, props = __rest(_a, ["children", "container", "error"]);
|
|
@@ -25,16 +25,15 @@ export const Switch = forwardRef((_a, ref) => {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}, []);
|
|
28
|
-
const onCheck = (
|
|
29
|
-
var _a;
|
|
30
|
-
const
|
|
31
|
-
const checked = !(button.dataset.checked === "true");
|
|
28
|
+
const onCheck = () => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const checked = !((_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.checked);
|
|
32
31
|
setInnerChecked(checked);
|
|
33
|
-
(
|
|
32
|
+
(_b = props === null || props === void 0 ? void 0 : props.onCheck) === null || _b === void 0 ? void 0 : _b.call(props, checked);
|
|
34
33
|
if (innerRef.current !== null) {
|
|
35
|
-
|
|
34
|
+
innerRef.current.checked = checked;
|
|
36
35
|
innerRef.current.dispatchEvent(new Event("change", { bubbles: true }));
|
|
37
36
|
}
|
|
38
37
|
};
|
|
39
|
-
return (_jsxs("fieldset", { className: css("flex flex-wrap items-center", container), children: [_jsx("input", Object.assign({}, props, {
|
|
38
|
+
return (_jsxs("fieldset", { className: css("flex flex-wrap items-center", container), children: [_jsx("input", Object.assign({}, props, { checked: checked, "data-checked": checked, "data-trigger": "change", hidden: true, id: props.id || id, onChange: (e) => setInnerChecked(e.target.checked), ref: innerRef, type: "checkbox" })), _jsx("button", { type: "button", role: "switch", onClick: onCheck, "aria-checked": checked, "data-checked": checked, "aria-labelledby": `${id}-label`, className: "relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-300 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 data-[checked=false]:bg-input-switch-bg data-[checked=true]:bg-primary", children: _jsx("span", { "aria-hidden": "true", "data-checked": checked, className: "inline-block aspect-square size-5 transform rounded-full shadow ring-0 transition duration-300 ease-in-out data-[checked=false]:translate-x-0 data-[checked=true]:translate-x-5 data-[checked=false]:bg-disabled data-[checked=true]:bg-input-switch" }) }), _jsx("label", { htmlFor: props.id || id, className: "ml-3 inline-block text-sm", id: `${id}-label`, children: _jsx("span", { className: "font-medium text-foreground", children: children }) }), _jsx("span", { className: "mt-1 flex-1 whitespace-nowrap text-xs text-danger empty:mt-0 empty:hidden", children: error })] }));
|
|
40
39
|
});
|
|
@@ -7,11 +7,13 @@ export * from "./display/card";
|
|
|
7
7
|
export * from "./display/stats";
|
|
8
8
|
export * from "./display/tabs";
|
|
9
9
|
export * from "./floating/dropdown";
|
|
10
|
+
export * from "./floating/expand";
|
|
11
|
+
export * from "./floating/menu";
|
|
10
12
|
export * from "./floating/modal";
|
|
13
|
+
export * from "./floating/toolbar";
|
|
11
14
|
export * from "./floating/tooltip";
|
|
12
15
|
export * from "./form/autocomplete";
|
|
13
16
|
export * from "./form/checkbox";
|
|
14
|
-
export * from "./form/task-list";
|
|
15
17
|
export * from "./form/date-picker";
|
|
16
18
|
export * from "./form/file-upload";
|
|
17
19
|
export * from "./form/form";
|
|
@@ -21,9 +23,8 @@ export * from "./form/radiobox";
|
|
|
21
23
|
export * from "./form/select";
|
|
22
24
|
export * from "./form/select";
|
|
23
25
|
export * from "./form/switch";
|
|
26
|
+
export * from "./form/task-list";
|
|
24
27
|
export * from "./form/transfer-list";
|
|
25
28
|
export * from "./table/index";
|
|
26
|
-
export * from "./floating/menu";
|
|
27
|
-
export * from "./floating/expand";
|
|
28
29
|
export { createColumns, createOptionCols, type ColType, useTablePreferences, type TablePagination } from "./table/table-lib";
|
|
29
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,OAAO,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -7,11 +7,13 @@ export * from "./display/card";
|
|
|
7
7
|
export * from "./display/stats";
|
|
8
8
|
export * from "./display/tabs";
|
|
9
9
|
export * from "./floating/dropdown";
|
|
10
|
+
export * from "./floating/expand";
|
|
11
|
+
export * from "./floating/menu";
|
|
10
12
|
export * from "./floating/modal";
|
|
13
|
+
export * from "./floating/toolbar";
|
|
11
14
|
export * from "./floating/tooltip";
|
|
12
15
|
export * from "./form/autocomplete";
|
|
13
16
|
export * from "./form/checkbox";
|
|
14
|
-
export * from "./form/task-list";
|
|
15
17
|
export * from "./form/date-picker";
|
|
16
18
|
export * from "./form/file-upload";
|
|
17
19
|
export * from "./form/form";
|
|
@@ -21,8 +23,7 @@ export * from "./form/radiobox";
|
|
|
21
23
|
export * from "./form/select";
|
|
22
24
|
export * from "./form/select";
|
|
23
25
|
export * from "./form/switch";
|
|
26
|
+
export * from "./form/task-list";
|
|
24
27
|
export * from "./form/transfer-list";
|
|
25
28
|
export * from "./table/index";
|
|
26
|
-
export * from "./floating/menu";
|
|
27
|
-
export * from "./floating/expand";
|
|
28
29
|
export { createColumns, createOptionCols, useTablePreferences } from "./table/table-lib";
|
|
@@ -22,13 +22,16 @@ type InnerTableProps<T extends {}> = HTMLAttributes<HTMLTableElement> & TableOpe
|
|
|
22
22
|
loadingMore?: boolean;
|
|
23
23
|
};
|
|
24
24
|
export type TableProps<T extends {}> = Pick<InnerTableProps<T>, "cols" | "rows" | "loadingMore" | "border"> & {
|
|
25
|
-
useControl?: boolean;
|
|
26
25
|
name: string;
|
|
27
|
-
operations?: boolean;
|
|
28
|
-
onScrollEnd?: () => void;
|
|
29
26
|
} & Partial<TableOperationProps<T> & {
|
|
30
|
-
|
|
27
|
+
inlineFilter: boolean;
|
|
28
|
+
inlineSorter: boolean;
|
|
31
29
|
loading: boolean;
|
|
30
|
+
onScrollEnd: () => void;
|
|
31
|
+
operations: boolean;
|
|
32
|
+
reference: keyof T;
|
|
33
|
+
sticky: number;
|
|
34
|
+
useControl: boolean;
|
|
32
35
|
}>;
|
|
33
36
|
export declare const Table: <T extends {}>(props: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
34
37
|
export {};
|