pentatrion-design 1.1.1 → 1.1.2
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/bin/change-version-and-publish.sh +0 -0
- package/dist/{Button-iONvwpov.mjs → Button-Pt94K1aQ.mjs} +3 -3
- package/dist/Button-Pt94K1aQ.mjs.map +1 -0
- package/dist/{Button--gdtM4dX.d.mts → Button-jLcascU9.d.mts} +7 -7
- package/dist/Button-jLcascU9.d.mts.map +1 -0
- package/dist/Dialog-Dd6B65pk.mjs.map +1 -1
- package/dist/{Snack-ByG8qOQn.mjs → Snack-Cn-e_L-F.mjs} +2 -2
- package/dist/{Snack-ByG8qOQn.mjs.map → Snack-Cn-e_L-F.mjs.map} +1 -1
- package/dist/{TooltipTrigger-Bg5_0YMn.mjs → TooltipTrigger-DYEGAnbT.mjs} +3 -3
- package/dist/TooltipTrigger-DYEGAnbT.mjs.map +1 -0
- package/dist/{badge-DuUzRhGB.mjs → badge-SWMvOR2A.mjs} +2 -2
- package/dist/badge-SWMvOR2A.mjs.map +1 -0
- package/dist/{button-D7Ub3fyM.mjs → button-D9dSyBrn.mjs} +4 -4
- package/dist/button-D9dSyBrn.mjs.map +1 -0
- package/dist/components/accordion/index.d.mts +4 -4
- package/dist/components/accordion/index.d.mts.map +1 -1
- package/dist/components/autocomplete/index.d.mts +9 -9
- package/dist/components/autocomplete/index.d.mts.map +1 -1
- package/dist/components/autocomplete/index.mjs +2 -2
- package/dist/components/autocomplete/index.mjs.map +1 -1
- package/dist/components/badge/index.d.mts +4 -4
- package/dist/components/badge/index.d.mts.map +1 -1
- package/dist/components/badge/index.mjs +2 -2
- package/dist/components/button/index.d.mts +2 -2
- package/dist/components/button/index.mjs +2 -2
- package/dist/components/code/index.d.mts +2 -2
- package/dist/components/context-menu/index.d.mts +3 -3
- package/dist/components/context-menu/index.d.mts.map +1 -1
- package/dist/components/dialog/index.d.mts +4 -4
- package/dist/components/dropdown-menu/index.d.mts +8 -8
- package/dist/components/dropdown-menu/index.d.mts.map +1 -1
- package/dist/components/dropdown-menu/index.mjs.map +1 -1
- package/dist/components/dropdown-menu-nested/index.d.mts +5 -5
- package/dist/components/dropdown-menu-nested/index.mjs +1 -1
- package/dist/components/flash/index.d.mts +3 -3
- package/dist/components/form/index.d.mts +4 -4
- package/dist/components/form/index.mjs +4 -4
- package/dist/components/highlight/index.d.mts +2 -2
- package/dist/components/input/index.d.mts +18 -18
- package/dist/components/input/index.d.mts.map +1 -1
- package/dist/components/input/index.mjs +2 -2
- package/dist/components/input/index.mjs.map +1 -1
- package/dist/components/loader/index.d.mts +3 -3
- package/dist/components/media-preview/index.d.mts +3 -3
- package/dist/components/modal/index.d.mts +13 -13
- package/dist/components/modal/index.d.mts.map +1 -1
- package/dist/components/modal/index.mjs +1 -1
- package/dist/components/modal/index.mjs.map +1 -1
- package/dist/components/notification/index.d.mts +4 -4
- package/dist/components/notification/index.mjs +3 -3
- package/dist/components/popover/index.d.mts +12 -12
- package/dist/components/popover/index.d.mts.map +1 -1
- package/dist/components/popover/index.mjs +2 -2
- package/dist/components/popover/index.mjs.map +1 -1
- package/dist/components/resizable/index.d.mts +4 -4
- package/dist/components/resizable/index.d.mts.map +1 -1
- package/dist/components/resize-area/index.d.mts +2 -2
- package/dist/components/scroll/index.d.mts +2 -2
- package/dist/components/select/index.d.mts +1 -1
- package/dist/components/select/index.mjs +4 -4
- package/dist/components/snack/index.d.mts +3 -3
- package/dist/components/snack/index.d.mts.map +1 -1
- package/dist/components/snack/index.mjs +3 -3
- package/dist/components/steps/index.d.mts +3 -3
- package/dist/components/steps/index.d.mts.map +1 -1
- package/dist/components/table/index.d.mts +8 -8
- package/dist/components/table/index.d.mts.map +1 -1
- package/dist/components/tabs/index.d.mts +2 -2
- package/dist/components/textarea/index.d.mts +3 -3
- package/dist/components/textarea/index.d.mts.map +1 -1
- package/dist/components/toast/index.d.mts +4 -3
- package/dist/components/toast/index.d.mts.map +1 -1
- package/dist/components/toast/index.mjs +3 -3
- package/dist/components/tooltip/index.d.mts +12 -10
- package/dist/components/tooltip/index.d.mts.map +1 -1
- package/dist/components/tooltip/index.mjs +1 -1
- package/dist/hooks/index.d.mts.map +1 -1
- package/dist/hooks-CBNvxDkV.mjs.map +1 -1
- package/dist/{index-DjHv9LMK.d.mts → index-BjFHH6YC.d.mts} +8 -8
- package/dist/{index-DjHv9LMK.d.mts.map → index-BjFHH6YC.d.mts.map} +1 -1
- package/dist/{index-B7kF14_r.d.mts → index-Cq0SyjLB.d.mts} +2 -2
- package/dist/{index-B7kF14_r.d.mts.map → index-Cq0SyjLB.d.mts.map} +1 -1
- package/dist/{index-B3Cjg9iL.d.mts → index-nYRuqVhj.d.mts} +5 -5
- package/dist/{index-B3Cjg9iL.d.mts.map → index-nYRuqVhj.d.mts.map} +1 -1
- package/dist/lib/index.d.mts +1 -1
- package/dist/{select-uCLQRzNB.mjs → select-Cj4-Qawh.mjs} +3 -3
- package/dist/{select-uCLQRzNB.mjs.map → select-Cj4-Qawh.mjs.map} +1 -1
- package/dist/{types-DNVJZN6J.d.mts → types-NxD0D2V5.d.mts} +5 -4
- package/dist/types-NxD0D2V5.d.mts.map +1 -0
- package/dist/types.d.mts +2 -2
- package/package.json +20 -20
- package/playground/package.json +18 -17
- package/playground/pnpm-lock.yaml +868 -1423
- package/playground/src/App.tsx +34 -2
- package/playground/src/index.css +18 -0
- package/playground/src/main.tsx +1 -1
- package/src/components/autocomplete/SimpleAutocomplete.tsx +4 -5
- package/src/components/badge/Badge.tsx +1 -1
- package/src/components/button/Button.stories.tsx +83 -62
- package/src/components/button/Button.tsx +4 -4
- package/src/components/button/ButtonGroup.stories.tsx +33 -7
- package/src/components/button/ButtonGroup.tsx +2 -2
- package/src/components/dialog/Dialog.tsx +2 -2
- package/src/components/dropdown-menu/interface.ts +2 -2
- package/src/components/dropdown-menu/useDropdownMenu.ts +2 -2
- package/src/components/input/AudioRange.tsx +4 -2
- package/src/components/input/MappedStars.tsx +4 -2
- package/src/components/input/Range.tsx +4 -2
- package/src/components/input/Stars.tsx +4 -5
- package/src/components/modal/interface.ts +2 -2
- package/src/components/modal/useModal.ts +2 -2
- package/src/components/popover/Components.tsx +4 -20
- package/src/components/popover/interface.ts +2 -2
- package/src/components/popover/usePopover.ts +2 -2
- package/src/components/toast/types.ts +3 -1
- package/src/components/tooltip/Tooltip.stories.tsx +35 -0
- package/src/components/tooltip/TooltipContent.tsx +11 -2
- package/src/components/tooltip/interface.ts +2 -2
- package/src/components/tooltip/useTooltip.ts +2 -2
- package/src/env.d.ts +1 -1
- package/src/hooks/useEffectEvent.ts +1 -3
- package/src/tailwind/base.css +23 -9
- package/src/tailwind/theme.css +11 -8
- package/src/types.ts +12 -2
- package/dist/Button--gdtM4dX.d.mts.map +0 -1
- package/dist/Button-iONvwpov.mjs.map +0 -1
- package/dist/TooltipTrigger-Bg5_0YMn.mjs.map +0 -1
- package/dist/badge-DuUzRhGB.mjs.map +0 -1
- package/dist/button-D7Ub3fyM.mjs.map +0 -1
- package/dist/types-DNVJZN6J.d.mts.map +0 -1
- package/playground/eslint.config.js +0 -28
- package/playground/src/tailwind.css +0 -7
- package/playground/tailwind.config.js +0 -12
|
File without changes
|
|
@@ -17,7 +17,7 @@ function loaderColor(color) {
|
|
|
17
17
|
const buttonVariants = cva("relative box-border inline-flex items-center leading-5 no-underline focus-visible-has:outline-2", {
|
|
18
18
|
variants: {
|
|
19
19
|
clickable: {
|
|
20
|
-
true: "cursor-pointer active:translate-y-
|
|
20
|
+
true: "cursor-pointer active:translate-y-px focus-visible-has:z-10",
|
|
21
21
|
false: "pointer-events-none"
|
|
22
22
|
},
|
|
23
23
|
size: {
|
|
@@ -41,7 +41,7 @@ const buttonVariants = cva("relative box-border inline-flex items-center leading
|
|
|
41
41
|
variant: {
|
|
42
42
|
contained: "shadow-sm hover:shadow-md active:shadow-md-active outline-offset-0 text-custom-text bg-custom-3 hover:bg-custom-4 current:bg-custom-4 focus-visible-has:outline-custom-5",
|
|
43
43
|
light: "shadow-sm hover:shadow-md has-checked:shadow-md focus:shadow-md active:shadow-md-active outline-offset-0 bg-custom-1 text-gray-text hover:text-custom-text hover:bg-custom-3 current:bg-custom-3 focus-visible-has:outline-custom-4",
|
|
44
|
-
outlined: "bg-custom-0 hover:shadow-xs active:shadow-xs-active text-gray-7 outline-offset-0 border-1 hover:bg-custom-1 border-custom-
|
|
44
|
+
outlined: "bg-custom-0 hover:shadow-xs active:shadow-xs-active text-gray-7 outline-offset-0 border-1 hover:bg-custom-1 border-custom-border focus-visible-has:outline-custom-5 current:bg-custom-3 focus-visible-has:border-transparent",
|
|
45
45
|
text: "bg-transparent hover:shadow-xs active:shadow-xs-active outline-offset-0 hover:bg-custom-1 dark:hover:bg-custom-1/50 text-gray-7 hover:text-gray-8 current:bg-custom-3 focus-visible-has:outline-custom-5",
|
|
46
46
|
ghost: "outline-offset-0 current:bg-custom-1 focus-visible-has:outline-custom-5"
|
|
47
47
|
}
|
|
@@ -90,4 +90,4 @@ function Button({ withRipple = true, variant = "contained", loading = false, col
|
|
|
90
90
|
|
|
91
91
|
//#endregion
|
|
92
92
|
export { buttonVariants as n, Button as t };
|
|
93
|
-
//# sourceMappingURL=Button-
|
|
93
|
+
//# sourceMappingURL=Button-Pt94K1aQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button-Pt94K1aQ.mjs","names":[],"sources":["../src/components/button/Button.tsx"],"sourcesContent":["import { ComponentProps, RefObject, useImperativeHandle, useRef } from \"react\";\nimport clsx from \"clsx\";\nimport { Loader } from \"../loader\";\nimport { useRipple } from \"../../hooks\";\nimport { Slot } from \"../slot\";\nimport { cva } from \"class-variance-authority\";\nimport { ThemeColor } from \"../../types\";\n\nfunction loaderColor(color: ThemeColor): ThemeColor {\n switch (color) {\n case \"yellow-alpha\":\n return \"yellow\";\n case \"gray-alpha\":\n return \"gray\";\n default:\n return color;\n }\n}\n\nexport interface ButtonProps extends Omit<ComponentProps<\"button\">, \"color\"> {\n withRipple?: boolean;\n\n variant?: \"contained\" | \"light\" | \"outlined\" | \"text\" | \"ghost\";\n\n size?: \"small\" | \"medium\" | \"large\" | \"custom\" | \"input\" | \"scalable\";\n\n color?: ThemeColor;\n\n width?: \"fit\" | \"full\" | \"custom\";\n\n loading?: boolean;\n\n disabled?: boolean;\n\n focusable?: boolean;\n /**\n * For a selected item inside a group.\n */\n selected?: boolean;\n\n icon?: boolean;\n\n asChild?: boolean;\n\n ref?: RefObject<HTMLButtonElement>;\n}\n\nexport const buttonVariants = cva(\n \"relative box-border inline-flex items-center leading-5 no-underline focus-visible-has:outline-2\",\n {\n variants: {\n clickable: {\n true: \"cursor-pointer active:translate-y-px focus-visible-has:z-10\",\n false: \"pointer-events-none\",\n },\n size: {\n small: \"[--h-button:1.5rem] h-(--h-button) truncate\",\n medium: \"[--h-button:2rem] h-(--h-button) truncate\",\n large: \"[--h-button:3rem] h-(--h-button) truncate\",\n input: \"[--h-button:calc(var(--h-input)-2px)] h-(--h-button) truncate\",\n custom: \"truncate\",\n scalable: \"\",\n },\n icon: {\n true: \"rounded-[calc(var(--h-button)/2)] min-w-(--h-button) [&_i,&_img,&_svg]:w-(--h-button) justify-center [&_:last-child:not(i,img,svg,strong)]:pr-4\",\n false: \"rounded-2xl px-4\",\n custom: \"\",\n },\n width: {\n fit: \"w-full max-w-fit\",\n full: \"w-full justify-center\",\n custom: \"\",\n },\n variant: {\n /**\n * src/tailwind/plugin.ts\n * addVariant(\"current\", [\n * `&[aria-checked=\"true\"]`,\n * `&[aria-current=\"page\"]`,\n * `&:has(:checked)`\n * ])\n */\n contained:\n \"shadow-sm hover:shadow-md active:shadow-md-active outline-offset-0 text-custom-text bg-custom-3 hover:bg-custom-4 current:bg-custom-4 focus-visible-has:outline-custom-5\",\n light:\n \"shadow-sm hover:shadow-md has-checked:shadow-md focus:shadow-md active:shadow-md-active outline-offset-0 bg-custom-1 text-gray-text hover:text-custom-text hover:bg-custom-3 current:bg-custom-3 focus-visible-has:outline-custom-4\",\n outlined:\n \"bg-custom-0 hover:shadow-xs active:shadow-xs-active text-gray-7 outline-offset-0 border-1 hover:bg-custom-1 border-custom-border focus-visible-has:outline-custom-5 current:bg-custom-3 focus-visible-has:border-transparent\",\n text: \"bg-transparent hover:shadow-xs active:shadow-xs-active outline-offset-0 hover:bg-custom-1 dark:hover:bg-custom-1/50 text-gray-7 hover:text-gray-8 current:bg-custom-3 focus-visible-has:outline-custom-5\",\n ghost: \"outline-offset-0 current:bg-custom-1 focus-visible-has:outline-custom-5\",\n },\n },\n defaultVariants: {\n size: \"medium\",\n icon: false,\n variant: \"contained\",\n clickable: true,\n width: \"fit\",\n },\n },\n);\n\nexport function Button({\n withRipple = true,\n variant = \"contained\",\n loading = false,\n color = \"yellow\",\n size = \"medium\",\n focusable = true,\n className,\n disabled = false,\n children,\n selected = false,\n icon = false,\n asChild = false,\n width = \"fit\",\n ref,\n ...props\n}: ButtonProps) {\n const inputRef = useRef<HTMLButtonElement>(null!);\n\n useImperativeHandle<HTMLButtonElement | null, HTMLButtonElement | null>(\n ref,\n () => inputRef.current,\n );\n\n const rippleEnabled = !loading && !disabled && withRipple;\n\n useRipple(\n inputRef,\n [\"text\", \"outlined\", \"ghost\"].includes(variant) ? true : false,\n rippleEnabled,\n );\n\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n tabIndex={focusable ? 0 : -1}\n role=\"button\"\n ref={inputRef}\n className={clsx(\n buttonVariants({\n variant,\n size,\n width,\n icon: width === \"custom\" && !icon ? \"custom\" : icon,\n }),\n className,\n loading && !icon && \"text-transparent\",\n )}\n data-color={color}\n data-variant={variant}\n aria-checked={selected}\n suppressHydrationWarning\n aria-busy={loading}\n {...(disabled ? { disabled } : {})}\n {...props}\n >\n {asChild ? (\n children\n ) : (\n <>\n {/* {!notClickable && withRipple && ripples} */}\n {children}\n {loading && (\n <Loader\n color={loaderColor(color)}\n className={clsx(\"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2\")}\n position=\"absolute\"\n />\n )}\n </>\n )}\n </Comp>\n );\n}\n"],"mappings":";;;;;;;;;AAQA,SAAS,YAAY,OAA+B;AAClD,SAAQ,OAAR;EACE,KAAK,eACH,QAAO;EACT,KAAK,aACH,QAAO;EACT,QACE,QAAO;;;AAgCb,MAAa,iBAAiB,IAC5B,mGACA;CACE,UAAU;EACR,WAAW;GACT,MAAM;GACN,OAAO;GACR;EACD,MAAM;GACJ,OAAO;GACP,QAAQ;GACR,OAAO;GACP,OAAO;GACP,QAAQ;GACR,UAAU;GACX;EACD,MAAM;GACJ,MAAM;GACN,OAAO;GACP,QAAQ;GACT;EACD,OAAO;GACL,KAAK;GACL,MAAM;GACN,QAAQ;GACT;EACD,SAAS;GASP,WACE;GACF,OACE;GACF,UACE;GACF,MAAM;GACN,OAAO;GACR;EACF;CACD,iBAAiB;EACf,MAAM;EACN,MAAM;EACN,SAAS;EACT,WAAW;EACX,OAAO;EACR;CACF,CACF;AAED,SAAgB,OAAO,EACrB,aAAa,MACb,UAAU,aACV,UAAU,OACV,QAAQ,UACR,OAAO,UACP,YAAY,MACZ,WACA,WAAW,OACX,UACA,WAAW,OACX,OAAO,OACP,UAAU,OACV,QAAQ,OACR,KACA,GAAG,SACW;CACd,MAAM,WAAW,OAA0B,KAAM;AAEjD,qBACE,WACM,SAAS,QAChB;CAED,MAAM,gBAAgB,CAAC,WAAW,CAAC,YAAY;AAE/C,WACE,UACA;EAAC;EAAQ;EAAY;EAAQ,CAAC,SAAS,QAAQ,GAAG,OAAO,OACzD,cACD;AAID,QACE,oBAHW,UAAU,OAAO;EAI1B,UAAU,YAAY,IAAI;EAC1B,MAAK;EACL,KAAK;EACL,WAAW,KACT,eAAe;GACb;GACA;GACA;GACA,MAAM,UAAU,YAAY,CAAC,OAAO,WAAW;GAChD,CAAC,EACF,WACA,WAAW,CAAC,QAAQ,mBACrB;EACD,cAAY;EACZ,gBAAc;EACd,gBAAc;EACd;EACA,aAAW;EACX,GAAK,WAAW,EAAE,UAAU,GAAG,EAAE;EACjC,GAAI;YAEH,UACC,WAEA,8CAEG,UACA,WACC,oBAAC;GACC,OAAO,YAAY,MAAM;GACzB,WAAW,KAAK,qDAAqD;GACrE,UAAS;IACT,IAEH;GAEA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as ThemeColor } from "./types-NxD0D2V5.mjs";
|
|
2
2
|
import { ComponentProps, RefObject } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime68 from "react/jsx-runtime";
|
|
4
4
|
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
5
5
|
|
|
6
6
|
//#region src/components/button/Button.d.ts
|
|
@@ -8,7 +8,7 @@ interface ButtonProps extends Omit<ComponentProps<"button">, "color"> {
|
|
|
8
8
|
withRipple?: boolean;
|
|
9
9
|
variant?: "contained" | "light" | "outlined" | "text" | "ghost";
|
|
10
10
|
size?: "small" | "medium" | "large" | "custom" | "input" | "scalable";
|
|
11
|
-
color?: ThemeColor
|
|
11
|
+
color?: ThemeColor;
|
|
12
12
|
width?: "fit" | "full" | "custom";
|
|
13
13
|
loading?: boolean;
|
|
14
14
|
disabled?: boolean;
|
|
@@ -23,9 +23,9 @@ interface ButtonProps extends Omit<ComponentProps<"button">, "color"> {
|
|
|
23
23
|
}
|
|
24
24
|
declare const buttonVariants: (props?: ({
|
|
25
25
|
clickable?: boolean | null | undefined;
|
|
26
|
-
size?: "input" | "small" | "large" | "
|
|
26
|
+
size?: "input" | "small" | "large" | "custom" | "medium" | "scalable" | null | undefined;
|
|
27
27
|
icon?: boolean | "custom" | null | undefined;
|
|
28
|
-
width?: "
|
|
28
|
+
width?: "fit" | "full" | "custom" | null | undefined;
|
|
29
29
|
variant?: "text" | "contained" | "light" | "outlined" | "ghost" | null | undefined;
|
|
30
30
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
31
31
|
declare function Button({
|
|
@@ -44,7 +44,7 @@ declare function Button({
|
|
|
44
44
|
width,
|
|
45
45
|
ref,
|
|
46
46
|
...props
|
|
47
|
-
}: ButtonProps):
|
|
47
|
+
}: ButtonProps): react_jsx_runtime68.JSX.Element;
|
|
48
48
|
//#endregion
|
|
49
49
|
export { ButtonProps as n, buttonVariants as r, Button as t };
|
|
50
|
-
//# sourceMappingURL=Button
|
|
50
|
+
//# sourceMappingURL=Button-jLcascU9.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button-jLcascU9.d.mts","names":[],"sources":["../src/components/button/Button.tsx"],"sourcesContent":[],"mappings":";;;;;;UAmBiB,WAAA,SAAoB,KAAK;;;;EAAzB,KAAA,CAAA,EAOP,UAPmB;EAAa,KAAA,CAAA,EAAA,KAAA,GAAA,MAAA,GAAA,QAAA;EAOhC,OAAA,CAAA,EAAA,OAAA;EAkBQ,QAAA,CAAA,EAAA,OAAA;EAAV,SAAA,CAAA,EAAA,OAAA;EAzB6B;;AA4BrC;EAuDgB,QAAA,CAAM,EAAA,OAAA;EACpB,IAAA,CAAA,EAAA,OAAA;EACA,OAAA,CAAA,EAAA,OAAA;EACA,GAAA,CAAA,EA7DM,SA6DN,CA7DgB,iBA6DhB,CAAA;;AAEA,cA5DW,cA4DX,EAAA,CAAA,KAMA,CANA,EAAA,CAAA;EACA,SAAA,CAAA,EAAA,OAAA,GAAA,IAAA,GAAA,SAAA;EACA,IAAA,CAAA,EAAA,OAAA,GAAA,OAAA,GAAA,OAAA,GAAA,QAAA,GAAA,QAAA,GAAA,UAAA,GAAA,IAAA,GAAA,SAAA;EACA,IAAA,CAAA,EAAA,OAAA,GAAA,QAAA,GAAA,IAAA,GAAA,SAAA;EACA,KAAA,CAAA,EAAA,KAAA,GAAA,MAAA,GAAA,QAAA,GAAA,IAAA,GAAA,SAAA;EACA,OAAA,CAAA,EAAA,MAAA,GAAA,WAAA,GAAA,OAAA,GAAA,UAAA,GAAA,OAAA,GAAA,IAAA,GAAA,SAAA;CACA,GAbD,+BAAA,CAAA,SAaC,CAAA,GAAA,SAAA,EAAA,GAAA,MAAA;AACA,iBAZc,MAAA,CAYd;EAAA,UAAA;EAAA,OAAA;EAAA,OAAA;EAAA,KAAA;EAAA,IAAA;EAAA,SAAA;EAAA,SAAA;EAAA,QAAA;EAAA,QAAA;EAAA,QAAA;EAAA,IAAA;EAAA,OAAA;EAAA,KAAA;EAAA,GAAA;EAAA,GAAA;AAAA,CAAA,EAIC,WAJD,CAAA,EAIY,mBAAA,CAAA,GAAA,CAAA,OAJZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog-Dd6B65pk.mjs","names":[],"sources":["../src/components/dialog/Dialog.tsx"],"sourcesContent":["import { Placement } from \"@floating-ui/react\";\nimport clsx from \"clsx\";\nimport { ComponentProps, ReactNode } from \"react\";\nimport type {
|
|
1
|
+
{"version":3,"file":"Dialog-Dd6B65pk.mjs","names":[],"sources":["../src/components/dialog/Dialog.tsx"],"sourcesContent":["import { Placement } from \"@floating-ui/react\";\nimport clsx from \"clsx\";\nimport { ComponentProps, ReactNode } from \"react\";\nimport type { ThemeBaseColor } from \"../../types\";\nimport { cva } from \"class-variance-authority\";\n\ninterface Props extends ComponentProps<\"div\"> {\n color?: ThemeBaseColor;\n shadow?: boolean;\n rounded?: boolean;\n placement?: Placement;\n children: ReactNode;\n}\n\nexport const dialogVariants = cva(\"relative\", {\n variants: {\n color: {\n yellow: \"border-t-4 border-t-yellow-3 bg-gray-0\",\n gray: \"border-t-4 border-t-gray-3 bg-gray-0\",\n red: \"border-t-4 border-t-red-3 bg-red-1\",\n blue: \"border-t-4 border-t-blue-3 bg-blue-1\",\n green: \"border-t-4 border-t-green-3 bg-green-1\",\n orange: \"border-t-4 border-t-orange-3 bg-orange-1\",\n default: \"bg-gray-0\",\n },\n shadow: {\n true: \"shadow-sm dark:shadow-dark\",\n false: \"border border-gray-2\",\n },\n rounded: {\n true: \"rounded-2xl\",\n false: \"\",\n },\n },\n defaultVariants: {\n color: \"default\",\n shadow: true,\n rounded: true,\n },\n});\n\nexport function Dialog({\n placement,\n color,\n rounded,\n shadow,\n children,\n className,\n role = \"dialog\",\n ...rest\n}: Props) {\n return (\n <div\n role={role}\n className={clsx(dialogVariants({ color, rounded, shadow }), className)}\n data-placement={placement}\n data-color={color ?? \"gray\"}\n {...rest}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;AAcA,MAAa,iBAAiB,IAAI,YAAY;CAC5C,UAAU;EACR,OAAO;GACL,QAAQ;GACR,MAAM;GACN,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,SAAS;GACV;EACD,QAAQ;GACN,MAAM;GACN,OAAO;GACR;EACD,SAAS;GACP,MAAM;GACN,OAAO;GACR;EACF;CACD,iBAAiB;EACf,OAAO;EACP,QAAQ;EACR,SAAS;EACV;CACF,CAAC;AAEF,SAAgB,OAAO,EACrB,WACA,OACA,SACA,QACA,UACA,WACA,OAAO,UACP,GAAG,QACK;AACR,QACE,oBAAC;EACO;EACN,WAAW,KAAK,eAAe;GAAE;GAAO;GAAS;GAAQ,CAAC,EAAE,UAAU;EACtE,kBAAgB;EAChB,cAAY,SAAS;EACrB,GAAI;EAEH;GACG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as useEffectEvent } from "./hooks-CBNvxDkV.mjs";
|
|
2
2
|
import { t as Loader } from "./loader-BSQqGDHk.mjs";
|
|
3
|
-
import { t as Button } from "./Button-
|
|
3
|
+
import { t as Button } from "./Button-Pt94K1aQ.mjs";
|
|
4
4
|
import { t as Dialog } from "./Dialog-Dd6B65pk.mjs";
|
|
5
5
|
import { useEffect } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -44,4 +44,4 @@ function Snack({ expiration = 5e3, content = "", color = "yellow", withLoader =
|
|
|
44
44
|
|
|
45
45
|
//#endregion
|
|
46
46
|
export { Snack as t };
|
|
47
|
-
//# sourceMappingURL=Snack-
|
|
47
|
+
//# sourceMappingURL=Snack-Cn-e_L-F.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snack-
|
|
1
|
+
{"version":3,"file":"Snack-Cn-e_L-F.mjs","names":[],"sources":["../src/components/snack/Snack.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useEffect } from \"react\";\n\nimport { Button } from \"../button\";\nimport { useEffectEvent } from \"../../hooks\";\nimport { Dialog } from \"../dialog\";\nimport { Loader } from \"../loader\";\nimport { Message } from \"../../types\";\n\nexport type SnackProps = Partial<Message> & {\n onRemove?: () => void;\n};\n\nexport function Snack({\n expiration = 5000,\n content = \"\",\n color = \"yellow\",\n withLoader = false,\n canClose = false,\n onRemove = () => {},\n}: SnackProps) {\n const onRemoveStable = useEffectEvent(onRemove);\n\n useEffect(() => {\n if (expiration === -1) {\n return;\n }\n\n const timeoutId = setTimeout(() => onRemoveStable(), expiration);\n return () => void clearTimeout(timeoutId);\n }, [onRemoveStable, expiration]);\n\n return (\n <Dialog\n className={clsx(\"motion-safe:animate-fade-in pointer-events-auto\", \"ll-snack\")}\n placement=\"top\"\n color={color}\n role={color !== \"red\" ? \"status\" : \"alertdialog\"}\n >\n <div className=\"flex w-fit min-w-60 items-center px-2 py-1\">\n <span className=\"flex-1 pr-4\">{content}</span>\n {withLoader && <Loader size=\"small\" color=\"gray\" />}\n\n {canClose && (\n <Button icon variant=\"text\" color=\"gray\" onClick={onRemove}>\n <i className=\"fe-cancel\"></i>\n </Button>\n )}\n </div>\n </Dialog>\n );\n}\n"],"mappings":";;;;;;;;;AAaA,SAAgB,MAAM,EACpB,aAAa,KACb,UAAU,IACV,QAAQ,UACR,aAAa,OACb,WAAW,OACX,iBAAiB,MACJ;CACb,MAAM,iBAAiB,eAAe,SAAS;AAE/C,iBAAgB;AACd,MAAI,eAAe,GACjB;EAGF,MAAM,YAAY,iBAAiB,gBAAgB,EAAE,WAAW;AAChE,eAAa,KAAK,aAAa,UAAU;IACxC,CAAC,gBAAgB,WAAW,CAAC;AAEhC,QACE,oBAAC;EACC,WAAW,KAAK,mDAAmD,WAAW;EAC9E,WAAU;EACH;EACP,MAAM,UAAU,QAAQ,WAAW;YAEnC,qBAAC;GAAI,WAAU;;IACb,oBAAC;KAAK,WAAU;eAAe;MAAe;IAC7C,cAAc,oBAAC;KAAO,MAAK;KAAQ,OAAM;MAAS;IAElD,YACC,oBAAC;KAAO;KAAK,SAAQ;KAAO,OAAM;KAAO,SAAS;eAChD,oBAAC,OAAE,WAAU,cAAgB;MACtB;;IAEP;GACC"}
|
|
@@ -80,13 +80,13 @@ function Tooltip({ children, ...options }) {
|
|
|
80
80
|
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/components/tooltip/TooltipContent.tsx
|
|
83
|
-
function TooltipContent({ style, children, className, ref, ...props }) {
|
|
83
|
+
function TooltipContent({ style, children, className, ref, pointerEvents = "none", ...props }) {
|
|
84
84
|
const context = useTooltipContext();
|
|
85
85
|
const mergedRef = useMergeRefs([context.refs.setFloating, ref]);
|
|
86
86
|
if (!context.open) return null;
|
|
87
87
|
return /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx("div", {
|
|
88
88
|
ref: mergedRef,
|
|
89
|
-
className: clsx("z-tooltip pointer-events-none
|
|
89
|
+
className: clsx("z-tooltip outline-hidden", pointerEvents === "none" && "pointer-events-none", context.middlewareData.hide?.referenceHidden && "invisible"),
|
|
90
90
|
style: {
|
|
91
91
|
...context.floatingStyles,
|
|
92
92
|
...style
|
|
@@ -131,4 +131,4 @@ function TooltipTrigger({ children, asChild = false, ref, ...props }) {
|
|
|
131
131
|
|
|
132
132
|
//#endregion
|
|
133
133
|
export { useTooltipContext as a, TooltipContext as i, TooltipContent as n, useTooltip as o, Tooltip as r, TooltipTrigger as t };
|
|
134
|
-
//# sourceMappingURL=TooltipTrigger-
|
|
134
|
+
//# sourceMappingURL=TooltipTrigger-DYEGAnbT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TooltipTrigger-DYEGAnbT.mjs","names":[],"sources":["../src/components/tooltip/useTooltip.ts","../src/components/tooltip/useTooltipContext.ts","../src/components/tooltip/Tooltip.tsx","../src/components/tooltip/TooltipContent.tsx","../src/components/tooltip/TooltipTrigger.tsx"],"sourcesContent":["import { RefObject, useMemo, useRef, useState } from \"react\";\nimport { TooltipOptions } from \"./interface\";\nimport {\n arrow,\n autoUpdate,\n flip,\n hide,\n offset,\n shift,\n useDismiss,\n useFloating,\n UseFloatingReturn,\n useFocus,\n useHover,\n useInteractions,\n UseInteractionsReturn,\n useRole,\n} from \"@floating-ui/react\";\nimport { ThemeBaseColor } from \"../../types\";\n\nconst arrowWidth = 16;\n\nexport type UseTooltipReturn = {\n open: boolean;\n setOpen?: (open: boolean) => void;\n color?: ThemeBaseColor;\n arrowRef: RefObject<HTMLDivElement | null>;\n} & UseInteractionsReturn &\n UseFloatingReturn;\n\nexport function useTooltip({\n initialOpen = false,\n placement = \"top\",\n open: controlledOpen,\n onOpen: setControlledOpen,\n openDelay = 500,\n closeDelay = 500,\n color = \"yellow\",\n}: TooltipOptions = {}): UseTooltipReturn {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(initialOpen);\n\n const isUncontrolled = controlledOpen === null || controlledOpen === undefined;\n\n const open = isUncontrolled ? uncontrolledOpen : controlledOpen;\n const setOpen = isUncontrolled ? setUncontrolledOpen : setControlledOpen;\n\n const arrowRef = useRef<HTMLDivElement>(null);\n\n const offsetVal = arrowWidth / 2;\n\n const data = useFloating({\n placement,\n open,\n onOpenChange: setOpen,\n whileElementsMounted: autoUpdate,\n middleware: [\n offset(offsetVal),\n flip(),\n shift({ padding: 5 }),\n arrow({\n element: arrowRef,\n padding: 12,\n }),\n hide({\n padding: 20,\n }),\n ],\n });\n const { context } = data;\n\n const hover = useHover(context, {\n move: false,\n enabled: isUncontrolled,\n delay: {\n open: openDelay || 1,\n close: closeDelay,\n },\n });\n const focus = useFocus(context, {\n enabled: isUncontrolled,\n });\n const dismiss = useDismiss(context);\n const role = useRole(context, { role: \"tooltip\" });\n\n const interactions = useInteractions([hover, focus, dismiss, role]);\n\n return useMemo(\n () => ({\n open,\n setOpen,\n ...interactions,\n ...data,\n arrowRef,\n color,\n }),\n [open, setOpen, color, interactions, data],\n );\n}\n","import { createContext, useContext } from \"react\";\nimport { useTooltip } from \"./useTooltip\";\n\ntype ContextType = ReturnType<typeof useTooltip> | null;\n\nexport const TooltipContext = createContext<ContextType>(null);\n\nexport function useTooltipContext() {\n const context = useContext(TooltipContext);\n\n if (context === null) {\n throw new Error(\"Tooltip components must be wrapped in <Tooltip />\");\n }\n\n return context;\n}\n","import { ReactNode } from \"react\";\nimport { TooltipOptions } from \"./interface\";\nimport { useTooltip } from \"./useTooltip\";\nimport { TooltipContext } from \"./useTooltipContext\";\n\ninterface Props extends TooltipOptions {\n children: ReactNode;\n}\n\nexport function Tooltip({ children, ...options }: Props) {\n const tooltip = useTooltip(options);\n return <TooltipContext.Provider value={tooltip}>{children}</TooltipContext.Provider>;\n}\n","import { ComponentProps, RefObject } from \"react\";\nimport { useTooltipContext } from \"./useTooltipContext\";\nimport { FloatingPortal, useMergeRefs } from \"@floating-ui/react\";\nimport clsx from \"clsx\";\nimport { computeArrowStyle } from \"../dialog/util\";\nimport { Dialog } from \"../dialog/Dialog\";\n\ninterface Props extends ComponentProps<\"div\"> {\n ref?: RefObject<HTMLDivElement>;\n pointerEvents?: \"none\" | \"auto\";\n}\n\nexport function TooltipContent({\n style,\n children,\n className,\n ref,\n pointerEvents = \"none\",\n ...props\n}: Props) {\n const context = useTooltipContext();\n const mergedRef = useMergeRefs([context.refs.setFloating, ref]);\n if (!context.open) {\n return null;\n }\n return (\n <FloatingPortal>\n <div\n ref={mergedRef}\n className={clsx(\n \"z-tooltip outline-hidden\",\n pointerEvents === \"none\" && \"pointer-events-none\",\n context.middlewareData.hide?.referenceHidden && \"invisible\",\n )}\n style={{ ...context.floatingStyles, ...style }}\n {...context.getFloatingProps(props)}\n >\n <Dialog\n placement={context.placement}\n className={clsx(\"text-body-sm motion-safe:animate-fade-in max-w-80 px-2 py-1\", className)}\n color={context.color}\n role=\"tooltip\"\n >\n {children}\n <div\n ref={context.arrowRef}\n style={computeArrowStyle(context)}\n className=\"p8n-arrow\"\n ></div>\n </Dialog>\n </div>\n </FloatingPortal>\n );\n}\n","import { HTMLProps, RefObject, cloneElement, isValidElement } from \"react\";\nimport { useTooltipContext } from \"./useTooltipContext\";\nimport { useMergeRefs } from \"@floating-ui/react\";\n\ninterface Props extends HTMLProps<HTMLElement> {\n /* allows the user to pass any element as the anchor instead of <button> */\n asChild?: boolean;\n ref?: RefObject<HTMLElement>;\n}\n\nexport function TooltipTrigger({ children, asChild = false, ref, ...props }: Props) {\n const context = useTooltipContext();\n const childrenRef = (children as any).ref;\n const mergedRef = useMergeRefs([context.refs.setReference, ref, childrenRef]);\n\n if (asChild && isValidElement(children)) {\n return cloneElement(\n children,\n context.getReferenceProps({\n ref: mergedRef,\n ...props,\n ...(children.props ?? {}),\n // @ts-ignore\n \"data-state\": context.open ? \"open\" : \"closed\",\n }),\n );\n }\n\n return (\n <abbr ref={mergedRef} {...context.getReferenceProps(props)}>\n {children}\n </abbr>\n );\n}\n"],"mappings":";;;;;;;;AAoBA,MAAM,aAAa;AAUnB,SAAgB,WAAW,EACzB,cAAc,OACd,YAAY,OACZ,MAAM,gBACN,QAAQ,mBACR,YAAY,KACZ,aAAa,KACb,QAAQ,aACU,EAAE,EAAoB;CACxC,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,YAAY;CAErE,MAAM,iBAAiB,mBAAmB,QAAQ,mBAAmB;CAErE,MAAM,OAAO,iBAAiB,mBAAmB;CACjD,MAAM,UAAU,iBAAiB,sBAAsB;CAEvD,MAAM,WAAW,OAAuB,KAAK;CAI7C,MAAM,OAAO,YAAY;EACvB;EACA;EACA,cAAc;EACd,sBAAsB;EACtB,YAAY;GACV,OARc,aAAa,EAQV;GACjB,MAAM;GACN,MAAM,EAAE,SAAS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AA+D,UAAU;GACzF,OAAO,QAAQ;GACf,MAAK;cAEJ,UACD,oBAAC;IACC,KAAK,QAAQ;IACb,OAAO,kBAAkB,QAAQ;IACjC,WAAU;KACL;IACA;GACL,GACS;;;;;ACzCrB,SAAgB,eAAe,EAAE,UAAU,UAAU,OAAO,KAAK,GAAG,SAAgB;CAClF,MAAM,UAAU,mBAAmB;CACnC,MAAM,cAAe,SAAiB;CACtC,MAAM,YAAY,aAAa;EAAC,QAAQ,KAAK;EAAc;EAAK;EAAY,CAAC;AAE7E,KAAI,WAAW,eAAe,SAAS,CACrC,QAAO,aACL,UACA,QAAQ,kBAAkB;EACxB,KAAK;EACL,GAAG;EACH,GAAI,SAAS,SAAS,EAAE;EAExB,cAAc,QAAQ,OAAO,SAAS;EACvC,CAAC,CACH;AAGH,QACE,oBAAC;EAAK,KAAK;EAAW,GAAI,QAAQ,kBAAkB,MAAM;EACvD;GACI"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as TooltipContent, r as Tooltip, t as TooltipTrigger } from "./TooltipTrigger-
|
|
1
|
+
import { n as TooltipContent, r as Tooltip, t as TooltipTrigger } from "./TooltipTrigger-DYEGAnbT.mjs";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
|
|
@@ -34,4 +34,4 @@ function Badge({ children, className, onRemove, onClick, tooltip, url, color = "
|
|
|
34
34
|
|
|
35
35
|
//#endregion
|
|
36
36
|
export { Badge as t };
|
|
37
|
-
//# sourceMappingURL=badge-
|
|
37
|
+
//# sourceMappingURL=badge-SWMvOR2A.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge-SWMvOR2A.mjs","names":[],"sources":["../src/components/badge/Badge.tsx"],"sourcesContent":["import { ReactNode } from \"react\";\nimport { ThemeColor } from \"../../types\";\nimport clsx from \"clsx\";\nimport { Tooltip } from \"../tooltip/Tooltip\";\nimport { TooltipContent } from \"../tooltip/TooltipContent\";\nimport { TooltipTrigger } from \"../tooltip/TooltipTrigger\";\n\ninterface Props {\n children: ReactNode;\n className?: string;\n tooltip?: string;\n url?: string;\n color?: ThemeColor;\n onClick?: () => void;\n onRemove?: () => void;\n}\n\nexport function Badge({\n children,\n className,\n onRemove,\n onClick,\n tooltip,\n url,\n color = \"yellow\",\n}: Props) {\n const clickable = onClick !== undefined || url !== undefined;\n const badge = (\n <span\n data-color={color}\n className={clsx(\n \"bg-custom-2/50 text-gray-text relative box-border inline-flex h-(--h-button) items-center truncate leading-5 no-underline [--h-button:1.5rem]\",\n clickable && \"cursor-pointer active:translate-y-[1px]\",\n \"text-body-xs w-fit rounded-full\",\n className,\n )}\n >\n {onClick ? (\n <button className=\"cursor-pointer px-2\" onClick={onClick}>\n {children}\n </button>\n ) : (\n <span className=\"px-2\">{children}</span>\n )}\n {onRemove && (\n <button\n className=\"remove cursor-pointer rounded-r-full pr-1 pl-0.5 active:translate-y-[1px]\"\n onClick={onRemove}\n >\n <i className=\"fe-cancel\"></i>\n </button>\n )}\n </span>\n );\n const wrappedBadge = url ? <a href={url}>{badge}</a> : badge;\n\n if (!tooltip) {\n return wrappedBadge;\n }\n\n return (\n <Tooltip>\n <TooltipContent>{tooltip}</TooltipContent>\n <TooltipTrigger asChild={true}>{wrappedBadge}</TooltipTrigger>\n </Tooltip>\n );\n}\n"],"mappings":";;;;;AAiBA,SAAgB,MAAM,EACpB,UACA,WACA,UACA,SACA,SACA,KACA,QAAQ,YACA;CACR,MAAM,YAAY,YAAY,UAAa,QAAQ;CACnD,MAAM,QACJ,qBAAC;EACC,cAAY;EACZ,WAAW,KACT,iJACA,aAAa,2CACb,mCACA,UACD;aAEA,UACC,oBAAC;GAAO,WAAU;GAA+B;GAC9C;IACM,GAET,oBAAC;GAAK,WAAU;GAAQ;IAAgB,EAEzC,YACC,oBAAC;GACC,WAAU;GACV,SAAS;aAET,oBAAC,OAAE,WAAU,cAAgB;IACtB;GAEN;CAET,MAAM,eAAe,MAAM,oBAAC;EAAE,MAAM;YAAM;GAAU,GAAG;AAEvD,KAAI,CAAC,QACH,QAAO;AAGT,QACE,qBAAC,sBACC,oBAAC,4BAAgB,UAAyB,EAC1C,oBAAC;EAAe,SAAS;YAAO;GAA8B,IACtD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h as useRipple } from "./hooks-CBNvxDkV.mjs";
|
|
2
|
-
import { n as buttonVariants } from "./Button-
|
|
2
|
+
import { n as buttonVariants } from "./Button-Pt94K1aQ.mjs";
|
|
3
3
|
import { useImperativeHandle, useRef } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import clsx from "clsx";
|
|
@@ -8,8 +8,8 @@ import { cva } from "class-variance-authority";
|
|
|
8
8
|
//#region src/components/button/ButtonGroup.tsx
|
|
9
9
|
const buttonGroupVariants = cva("[&_:not(:first-child)]:rounded-tl-none [&_:not(:last-child)]:rounded-br-none", {
|
|
10
10
|
variants: { direction: {
|
|
11
|
-
horizontal: "[&_:not(:first-child)]:rounded-bl-none [&_:not(:last-child)]:rounded-tr-none
|
|
12
|
-
vertical: "flex flex-col [&_:not(:first-child)]:rounded-tr-none [&_:not(:last-child)]:rounded-bl-none
|
|
11
|
+
horizontal: "[&_:not(:first-child)]:rounded-bl-none [&_:not(:last-child)]:rounded-tr-none *:data-[variant='outlined']:-mx-[.5px] *:shadow-none",
|
|
12
|
+
vertical: "flex flex-col [&_:not(:first-child)]:rounded-tr-none [&_:not(:last-child)]:rounded-bl-none *:data-[variant='outlined']:-my-[.5px] *:shadow-none"
|
|
13
13
|
} },
|
|
14
14
|
defaultVariants: { direction: "horizontal" }
|
|
15
15
|
});
|
|
@@ -47,4 +47,4 @@ function HrefButton({ withRipple = true, variant = "contained", color = "yellow"
|
|
|
47
47
|
|
|
48
48
|
//#endregion
|
|
49
49
|
export { ButtonGroup as n, buttonGroupVariants as r, HrefButton as t };
|
|
50
|
-
//# sourceMappingURL=button-
|
|
50
|
+
//# sourceMappingURL=button-D9dSyBrn.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-D9dSyBrn.mjs","names":[],"sources":["../src/components/button/ButtonGroup.tsx","../src/components/button/HrefButton.tsx"],"sourcesContent":["import { ComponentProps, ReactNode } from \"react\";\nimport clsx from \"clsx\";\nimport { cva } from \"class-variance-authority\";\n\ninterface Props extends ComponentProps<\"div\"> {\n children: ReactNode;\n direction?: \"horizontal\" | \"vertical\";\n}\n\nexport const buttonGroupVariants = cva(\n \"[&_:not(:first-child)]:rounded-tl-none [&_:not(:last-child)]:rounded-br-none\",\n {\n variants: {\n direction: {\n horizontal:\n \"[&_:not(:first-child)]:rounded-bl-none [&_:not(:last-child)]:rounded-tr-none *:data-[variant='outlined']:-mx-[.5px] *:shadow-none\",\n vertical:\n \"flex flex-col [&_:not(:first-child)]:rounded-tr-none [&_:not(:last-child)]:rounded-bl-none *:data-[variant='outlined']:-my-[.5px] *:shadow-none\",\n },\n },\n defaultVariants: {\n direction: \"horizontal\",\n },\n },\n);\n\nexport function ButtonGroup({ children, className, direction = \"horizontal\" }: Props) {\n return <div className={clsx(buttonGroupVariants({ direction }), className)}>{children}</div>;\n}\n","import { ComponentProps, RefObject, useImperativeHandle, useRef } from \"react\";\nimport clsx from \"clsx\";\nimport { useRipple } from \"../../hooks/useRipple\";\nimport { ButtonProps, buttonVariants } from \"./Button\";\n\nexport type HrefButtonProps = ComponentProps<\"a\"> &\n Pick<\n ButtonProps,\n \"withRipple\" | \"variant\" | \"size\" | \"color\" | \"selected\" | \"icon\" | \"disabled\" | \"width\"\n > & { ref?: RefObject<HTMLAnchorElement> };\n\nexport function HrefButton({\n withRipple = true,\n variant = \"contained\",\n color = \"yellow\",\n size = \"medium\",\n width = \"fit\",\n className,\n disabled,\n children,\n selected = false,\n icon = false,\n href,\n ref,\n ...props\n}: HrefButtonProps) {\n const anchorRef = useRef<HTMLAnchorElement>(null!);\n\n useImperativeHandle<HTMLAnchorElement | null, HTMLAnchorElement | null>(\n ref,\n () => anchorRef.current,\n );\n\n const ripples = useRipple(anchorRef);\n\n return (\n <a\n role=\"button\"\n href={href}\n ref={anchorRef}\n className={clsx(\n buttonVariants({ variant, size, width, icon: size === \"custom\" ? \"custom\" : icon }),\n className,\n selected && \"active\",\n )}\n data-color={color}\n data-variant={variant}\n aria-checked={selected}\n aria-disabled={disabled}\n {...props}\n >\n {!disabled && withRipple && ripples}\n {children}\n </a>\n );\n}\n"],"mappings":";;;;;;;;AASA,MAAa,sBAAsB,IACjC,gFACA;CACE,UAAU,EACR,WAAW;EACT,YACE;EACF,UACE;EACH,EACF;CACD,iBAAiB,EACf,WAAW,cACZ;CACF,CACF;AAED,SAAgB,YAAY,EAAE,UAAU,WAAW,YAAY,gBAAuB;AACpF,QAAO,oBAAC;EAAI,WAAW,KAAK,oBAAoB,EAAE,WAAW,CAAC,EAAE,UAAU;EAAG;GAAe;;;;;AChB9F,SAAgB,WAAW,EACzB,aAAa,MACb,UAAU,aACV,QAAQ,UACR,OAAO,UACP,QAAQ,OACR,WACA,UACA,UACA,WAAW,OACX,OAAO,OACP,MACA,KACA,GAAG,SACe;CAClB,MAAM,YAAY,OAA0B,KAAM;AAElD,qBACE,WACM,UAAU,QACjB;CAED,MAAM,UAAU,UAAU,UAAU;AAEpC,QACE,qBAAC;EACC,MAAK;EACC;EACN,KAAK;EACL,WAAW,KACT,eAAe;GAAE;GAAS;GAAM;GAAO,MAAM,SAAS,WAAW,WAAW;GAAM,CAAC,EACnF,WACA,YAAY,SACb;EACD,cAAY;EACZ,gBAAc;EACd,gBAAc;EACd,iBAAe;EACf,GAAI;aAEH,CAAC,YAAY,cAAc,SAC3B;GACC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime75 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/accordion/Accordion.d.ts
|
|
5
5
|
interface Props$2 {
|
|
@@ -13,7 +13,7 @@ declare function Accordion({
|
|
|
13
13
|
defaultValue,
|
|
14
14
|
onChange,
|
|
15
15
|
children
|
|
16
|
-
}: Props$2):
|
|
16
|
+
}: Props$2): react_jsx_runtime75.JSX.Element;
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/components/accordion/AccordionTrigger.d.ts
|
|
19
19
|
interface Props$1 extends ComponentProps<"button"> {
|
|
@@ -23,7 +23,7 @@ declare function AccordionTrigger({
|
|
|
23
23
|
name,
|
|
24
24
|
children,
|
|
25
25
|
...rest
|
|
26
|
-
}: Props$1):
|
|
26
|
+
}: Props$1): react_jsx_runtime75.JSX.Element;
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region src/components/accordion/AccordionContent.d.ts
|
|
29
29
|
interface Props extends ComponentProps<"div"> {
|
|
@@ -33,7 +33,7 @@ declare function AccordionContent({
|
|
|
33
33
|
name,
|
|
34
34
|
children,
|
|
35
35
|
...rest
|
|
36
|
-
}: Props):
|
|
36
|
+
}: Props): react_jsx_runtime75.JSX.Element;
|
|
37
37
|
//#endregion
|
|
38
38
|
export { Accordion, AccordionContent, AccordionTrigger };
|
|
39
39
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/components/accordion/Accordion.tsx","../../../src/components/accordion/AccordionTrigger.tsx","../../../src/components/accordion/AccordionContent.tsx"],"sourcesContent":[],"mappings":";;;;UAIU,OAAA;;;EAAA,QAAA,CAAA,EAAK,CAAA,KAAA,EAAA,MAIH,GAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/components/accordion/Accordion.tsx","../../../src/components/accordion/AccordionTrigger.tsx","../../../src/components/accordion/AccordionContent.tsx"],"sourcesContent":[],"mappings":";;;;UAIU,OAAA;;;EAAA,QAAA,CAAA,EAAK,CAAA,KAAA,EAAA,MAIH,GAAA,IAAA,EAAS,GAAA,IAAA;EAKL,QAAA,EALJ,SAKa;;AAEvB,iBAFc,SAAA,CAEd;EAAA,KAAA,EADO,eACP;EAAA,YAAA;EAAA,QAAA;EAAA;AAAA,CAAA,EAGC,OAHD,CAAA,EAGM,mBAAA,CAAA,GAAA,CAAA,OAHN;;;UCXQ,OAAA,SAAc;;;ADAd,iBCIM,gBAAA,CDAK;EAAA,IAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,ECAyC,ODAzC,CAAA,ECA8C,mBAAA,CAAA,GAAA,CAAA,ODA9C;;;UEJX,KAAA,SAAc;;;AFAd,iBEIM,gBAAA,CFAK;EAAA,IAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EEAyC,KFAzC,CAAA,EEA8C,mBAAA,CAAA,GAAA,CAAA,OFA9C"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { l as Option, u as OptionLike } from "../../index-
|
|
2
|
-
import {
|
|
3
|
-
import * as
|
|
1
|
+
import { l as Option, u as OptionLike } from "../../index-BjFHH6YC.mjs";
|
|
2
|
+
import { i as ThemeColor } from "../../types-NxD0D2V5.mjs";
|
|
3
|
+
import * as react6 from "react";
|
|
4
4
|
import { ComponentProps, ReactNode, RefObject } from "react";
|
|
5
|
-
import * as
|
|
5
|
+
import * as react_jsx_runtime72 from "react/jsx-runtime";
|
|
6
6
|
import { Placement, useInteractions } from "@floating-ui/react";
|
|
7
7
|
|
|
8
8
|
//#region src/components/autocomplete/AutocompleteOption.d.ts
|
|
9
9
|
type AutocompleteOptionProps<O extends OptionLike> = O;
|
|
10
|
-
declare const AutocompleteOption:
|
|
10
|
+
declare const AutocompleteOption: react6.MemoExoticComponent<(<O extends OptionLike>(props: AutocompleteOptionProps<O>) => react_jsx_runtime72.JSX.Element)>;
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/components/autocomplete/Autocomplete.d.ts
|
|
13
13
|
interface AutocompleteProps<O extends OptionLike = Option> extends ComponentProps<"input"> {
|
|
@@ -63,7 +63,7 @@ declare function Autocomplete<O extends OptionLike = Option>({
|
|
|
63
63
|
readOnly,
|
|
64
64
|
ref,
|
|
65
65
|
...rest
|
|
66
|
-
}: AutocompleteProps<O>):
|
|
66
|
+
}: AutocompleteProps<O>): react_jsx_runtime72.JSX.Element;
|
|
67
67
|
//#endregion
|
|
68
68
|
//#region src/components/autocomplete/SimpleAutocomplete.d.ts
|
|
69
69
|
interface Props$1<O extends OptionLike = Option> extends Omit<AutocompleteProps<O>, "searchValue" | "onChangeSearchValue" | "loading" | "clearSearchButton" | "selectOnFocus"> {}
|
|
@@ -72,7 +72,7 @@ declare function SimpleAutocomplete<O extends OptionLike = Option>({
|
|
|
72
72
|
selection,
|
|
73
73
|
onChangeSelection,
|
|
74
74
|
...rest
|
|
75
|
-
}: Props$1<O>):
|
|
75
|
+
}: Props$1<O>): react_jsx_runtime72.JSX.Element;
|
|
76
76
|
//#endregion
|
|
77
77
|
//#region src/components/autocomplete/LazyAutocomplete.d.ts
|
|
78
78
|
interface Props<O extends OptionLike = Option> extends Omit<AutocompleteProps<O>, "searchValue" | "onChangeSearchValue" | "options" | "selectOnFocus"> {
|
|
@@ -85,7 +85,7 @@ declare function LazyAutocomplete<O extends OptionLike = Option>({
|
|
|
85
85
|
selection,
|
|
86
86
|
onChangeSelection,
|
|
87
87
|
...rest
|
|
88
|
-
}: Props<O>):
|
|
88
|
+
}: Props<O>): react_jsx_runtime72.JSX.Element;
|
|
89
89
|
//#endregion
|
|
90
90
|
//#region src/components/autocomplete/useAutocompleteContext.d.ts
|
|
91
91
|
interface AutocompleteContext {
|
|
@@ -94,7 +94,7 @@ interface AutocompleteContext {
|
|
|
94
94
|
getItemProps: ReturnType<typeof useInteractions>["getItemProps"];
|
|
95
95
|
handleSelect: (index: number | null) => void;
|
|
96
96
|
}
|
|
97
|
-
declare const AutocompleteContext:
|
|
97
|
+
declare const AutocompleteContext: react6.Context<AutocompleteContext | null>;
|
|
98
98
|
declare function useAutocomplete(): AutocompleteContext;
|
|
99
99
|
//#endregion
|
|
100
100
|
//#region src/components/autocomplete/util.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/components/autocomplete/AutocompleteOption.tsx","../../../src/components/autocomplete/Autocomplete.tsx","../../../src/components/autocomplete/SimpleAutocomplete.tsx","../../../src/components/autocomplete/LazyAutocomplete.tsx","../../../src/components/autocomplete/useAutocompleteContext.ts","../../../src/components/autocomplete/util.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAOY,kCAAkC,cAAc;cAE/C,oBACsB,MAAA,CADJ,gCAA8C,mBACpE,wBAAwB,OAAE,mBAAA,CAAA,GAAA,CAAA;;;UC8BlB,4BAA4B,aAAa,gBAAgB;mBACvD;UAET;EDpCE;AAEZ;;EACiC,cAAA,CAAA,ECsCd,SDtCc;EAAxB,MAAA,CAAA,ECwCE,SDxCF;EAA0B,SAAA,CAAA,EC0CrB,SD1CqB;EAAA;;;;;AC8BnC;;;EACmB,mBAAA,EAAA,CAAA,KAAA,EAAA,MAAA,EAAA,cAAA,EAAA,OAAA,EAAA,GAAA,IAAA;EAET,SAAA,CAAA,EAoBI,CApBJ,GAAA,IAAA;EAKS;;;;;EAsBR,iBAAA,EAAA,CAAA,MAAA,EADmB,CACnB,GAAA,IAAA,EAAA,GAAA,IAAA;EAEqD,OAAA,EAFrD,CAEqD,EAAA;EAAxB,2BAAA,CAAA,EAAA,CAAA,KAAA,EAAA,uBAAA,CAAwB,CAAxB,CAAA,EAAA,GAA+B,SAA/B;EAA+B,OAAA,CAAA,EAAA,OAAA;EAQrD,iBAAA,CAAA,EAAA,OAAA;EAAV,aAAA,CAAA,EAAA,OAAA;EAxCkE,GAAA,CAAA,EAwClE,SAxCkE,CAwCxD,gBAxCwD,CAAA;;AA2C1D,iBAAA,YAAY,CAAA,UAAW,UAAX,GAAwB,MAAxB,CAAA,CAAA;EAAA,SAAA;EAAA,SAAA;EAAA,IAAA;EAAA,KAAA;EAAA,cAAA;EAAA,MAAA;EAAA,SAAA;EAAA,WAAA;EAAA,SAAA;EAAA,iBAAA;EAAA,2BAAA;EAAA,OAAA;EAAA,iBAAA;EAAA,WAAA;EAAA,mBAAA;EAAA,OAAA;EAAA,aAAA;EAAA,QAAA;EAAA,GAAA;EAAA,GAAA;AAAA,CAAA,EAqBzB,iBArByB,CAqBP,CArBO,CAAA,CAAA,EAqBL,mBAAA,CAAA,GAAA,CAAA,OArBK;;;UC5ElB,kBAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/components/autocomplete/AutocompleteOption.tsx","../../../src/components/autocomplete/Autocomplete.tsx","../../../src/components/autocomplete/SimpleAutocomplete.tsx","../../../src/components/autocomplete/LazyAutocomplete.tsx","../../../src/components/autocomplete/useAutocompleteContext.ts","../../../src/components/autocomplete/util.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAOY,kCAAkC,cAAc;cAE/C,oBACsB,MAAA,CADJ,gCAA8C,mBACpE,wBAAwB,OAAE,mBAAA,CAAA,GAAA,CAAA;;;UC8BlB,4BAA4B,aAAa,gBAAgB;mBACvD;UAET;EDpCE;AAEZ;;EACiC,cAAA,CAAA,ECsCd,SDtCc;EAAxB,MAAA,CAAA,ECwCE,SDxCF;EAA0B,SAAA,CAAA,EC0CrB,SD1CqB;EAAA;;;;;AC8BnC;;;EACmB,mBAAA,EAAA,CAAA,KAAA,EAAA,MAAA,EAAA,cAAA,EAAA,OAAA,EAAA,GAAA,IAAA;EAET,SAAA,CAAA,EAoBI,CApBJ,GAAA,IAAA;EAKS;;;;;EAsBR,iBAAA,EAAA,CAAA,MAAA,EADmB,CACnB,GAAA,IAAA,EAAA,GAAA,IAAA;EAEqD,OAAA,EAFrD,CAEqD,EAAA;EAAxB,2BAAA,CAAA,EAAA,CAAA,KAAA,EAAA,uBAAA,CAAwB,CAAxB,CAAA,EAAA,GAA+B,SAA/B;EAA+B,OAAA,CAAA,EAAA,OAAA;EAQrD,iBAAA,CAAA,EAAA,OAAA;EAAV,aAAA,CAAA,EAAA,OAAA;EAxCkE,GAAA,CAAA,EAwClE,SAxCkE,CAwCxD,gBAxCwD,CAAA;;AA2C1D,iBAAA,YAAY,CAAA,UAAW,UAAX,GAAwB,MAAxB,CAAA,CAAA;EAAA,SAAA;EAAA,SAAA;EAAA,IAAA;EAAA,KAAA;EAAA,cAAA;EAAA,MAAA;EAAA,SAAA;EAAA,WAAA;EAAA,SAAA;EAAA,iBAAA;EAAA,2BAAA;EAAA,OAAA;EAAA,iBAAA;EAAA,WAAA;EAAA,mBAAA;EAAA,OAAA;EAAA,aAAA;EAAA,QAAA;EAAA,GAAA;EAAA,GAAA;AAAA,CAAA,EAqBzB,iBArByB,CAqBP,CArBO,CAAA,CAAA,EAqBL,mBAAA,CAAA,GAAA,CAAA,OArBK;;;UC5ElB,kBAAgB,aAAa,gBAAgB,KACrD,kBAAkB;iBAIJ,6BAA6B,aAAa;;;;;GAKvD,QAAM,KAAE,mBAAA,CAAA,GAAA,CAAA;;;UCXD,gBAAgB,aAAa,gBAE7B,KACN,kBAAkB;wDAGkC,QAAQ;;;iBAIhD,2BAA2B,aAAa;;;;;;GAMrD,MAAM,KAAE,mBAAA,CAAA,GAAA,CAAA;;;UClBD,mBAAA;;aAEG;gBACG,kBAAkB;;;AJAtB,cIIC,mBJJsB,EIIH,MAAA,CAAA,OJJ6B,CII7B,mBJJ6B,GAAA,IAAA,CAAA;AAEhD,iBIIG,eAAA,CAAA,CJsBd,EItB6B,mBJsB7B;;;iBKjCc,cAAA,SAAuB;iBASvB,cAAA,SAAuB"}
|
|
@@ -2,8 +2,8 @@ import { d as useEffectEvent, o as useIsomorphicLayoutEffect, u as useStateDebou
|
|
|
2
2
|
import { t as Loader } from "../../loader-BSQqGDHk.mjs";
|
|
3
3
|
import "../../lib-BYj5usAj.mjs";
|
|
4
4
|
import "../../slot-CcgC3dMT.mjs";
|
|
5
|
-
import { t as Button } from "../../Button-
|
|
6
|
-
import "../../button-
|
|
5
|
+
import { t as Button } from "../../Button-Pt94K1aQ.mjs";
|
|
6
|
+
import "../../button-D9dSyBrn.mjs";
|
|
7
7
|
import { t as Dialog } from "../../Dialog-Dd6B65pk.mjs";
|
|
8
8
|
import "../../dialog-C5ScTy65.mjs";
|
|
9
9
|
import { n as inputConfig, r as sizeVariant } from "../../Input-BhfAzRbK.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["AutocompleteOption","isOpen","selection"],"sources":["../../../src/components/autocomplete/useAutocompleteContext.ts","../../../src/components/autocomplete/util.ts","../../../src/components/autocomplete/AutocompleteOption.tsx","../../../src/components/autocomplete/Autocomplete.tsx","../../../src/components/autocomplete/SimpleAutocomplete.tsx","../../../src/components/autocomplete/LazyAutocomplete.tsx"],"sourcesContent":["import { useInteractions } from \"@floating-ui/react\";\nimport { createContext, useContext } from \"react\";\nimport { OptionLike } from \"../select\";\n\ninterface AutocompleteContext {\n activeIndex: number | null;\n selection: OptionLike | null;\n getItemProps: ReturnType<typeof useInteractions>[\"getItemProps\"];\n handleSelect: (index: number | null) => void;\n}\n\nexport const AutocompleteContext = createContext<AutocompleteContext | null>(null);\n\nexport function useAutocomplete() {\n const context = useContext(AutocompleteContext);\n if (context === null) {\n throw new Error(\"Autocomplete components must be wrapped in <Autocomplete>\");\n }\n return context;\n}\n","import { OptionLike } from \"../select\";\n\nexport function getOptionLabel(option: OptionLike) {\n switch (option.type) {\n case \"Feature\":\n return option.properties.label;\n default:\n return option.label;\n }\n}\n\nexport function getOptionValue(option: OptionLike) {\n switch (option.type) {\n case \"Feature\":\n return option.properties.id;\n default:\n return option.value;\n }\n}\n","import { memo, useId } from \"react\";\nimport { OptionLike } from \"../select\";\nimport { useListItem } from \"@floating-ui/react\";\nimport { useAutocomplete } from \"./useAutocompleteContext\";\nimport clsx from \"clsx\";\nimport { getOptionLabel, getOptionValue } from \"./util\";\n\nexport type AutocompleteOptionProps<O extends OptionLike> = O;\n\nexport const AutocompleteOption = memo(function AutocompleteOption<O extends OptionLike>(\n props: AutocompleteOptionProps<O>,\n) {\n const label = getOptionLabel(props);\n\n const id = useId();\n const { activeIndex, selection, getItemProps, handleSelect } = useAutocomplete();\n const { ref, index } = useListItem({ label });\n const isActive = activeIndex === index;\n const isSelected = selection ? getOptionValue(selection) === getOptionValue(props) : false;\n\n return (\n <div\n className={clsx(\"option\", isSelected ? \"bg-gray-2\" : isActive && \"bg-gray-1\")}\n ref={ref}\n role=\"option\"\n id={id}\n data-presentation=\"compact\"\n aria-selected={isActive}\n {...getItemProps({\n onClick: () => handleSelect(index),\n })}\n >\n {label}\n </div>\n );\n});\n","import {\n ChangeEvent,\n KeyboardEvent,\n useCallback,\n useMemo,\n useRef,\n useState,\n ReactNode,\n ComponentProps,\n CSSProperties,\n RefObject,\n} from \"react\";\nimport type { OptionLike, Option } from \"../select\";\nimport { AutocompleteOption, AutocompleteOptionProps } from \"./AutocompleteOption\";\nimport {\n FloatingFocusManager,\n FloatingList,\n FloatingPortal,\n Placement,\n autoUpdate,\n flip,\n offset,\n size,\n useDismiss,\n useFloating,\n useInteractions,\n useListNavigation,\n useRole,\n} from \"@floating-ui/react\";\nimport { AutocompleteContext } from \"./useAutocompleteContext\";\nimport clsx from \"clsx\";\nimport { useEffectEvent } from \"../../hooks\";\n\nimport { getOptionLabel, getOptionValue } from \"./util\";\nimport { Button } from \"../button\";\nimport { Dialog } from \"../dialog\";\nimport { Loader } from \"../loader\";\nimport { inputConfig, sizeVariant } from \"../input/Input\";\nimport { ThemeColor } from \"../../types\";\n\nexport interface AutocompleteProps<O extends OptionLike = Option> extends ComponentProps<\"input\"> {\n icon?: boolean | ReactNode;\n\n color?: ThemeColor;\n\n /**\n * render suffix only if selection and searchValue is empty\n */\n noSearchSuffix?: ReactNode;\n\n suffix?: ReactNode;\n\n placement?: Placement;\n /**\n * search string used as value for <input>\n */\n searchValue: string;\n /**\n * change handler when typing in the input\n * or when clicking on an option (the label value is passed)\n */\n onChangeSearchValue: (value: string, selectionLabel: boolean) => void;\n\n selection?: O | null;\n /**\n * select handler for a selection from the autocomplete's dropdown\n * the option object is passed when clicking on an option\n * null value is passed when typing a new character in the input search.\n */\n onChangeSelection: (option: O | null) => void;\n options: O[];\n\n autocompleteOptionComponent?: (props: AutocompleteOptionProps<O>) => ReactNode;\n\n loading?: boolean;\n\n clearSearchButton?: boolean;\n\n selectOnFocus?: boolean;\n\n ref?: RefObject<HTMLInputElement>;\n}\n\nexport function Autocomplete<O extends OptionLike = Option>({\n className,\n autoFocus = false,\n icon = true,\n color = \"yellow\",\n noSearchSuffix,\n suffix,\n placement = \"bottom\",\n placeholder = \"Search...\",\n selection = null,\n onChangeSelection,\n autocompleteOptionComponent,\n loading = false,\n clearSearchButton = false,\n searchValue,\n onChangeSearchValue,\n options,\n selectOnFocus = true,\n readOnly = false,\n ref,\n ...rest\n}: AutocompleteProps<O>) {\n const [isOpen, setIsOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState<number | null>(null);\n\n const onChangeSearchValueStable = useEffectEvent(onChangeSearchValue);\n const onChangeSelectionStable = useEffectEvent(onChangeSelection);\n\n const OptionComponent = autocompleteOptionComponent ?? AutocompleteOption;\n\n const listRef = useRef<Array<HTMLElement | null>>([]);\n\n const { refs, floatingStyles, context } = useFloating({\n placement,\n open: isOpen,\n onOpenChange: setIsOpen,\n whileElementsMounted: autoUpdate,\n middleware: [\n offset(5),\n flip({ padding: 10 }),\n size({\n apply({ rects, elements, availableHeight }) {\n Object.assign(elements.floating.style, {\n width: `${Math.max(130, rects.reference.width)}px`,\n });\n const firstChild = elements.floating.firstElementChild as HTMLElement;\n if (firstChild) {\n firstChild.style.maxHeight = `${Math.min(availableHeight, 288)}px`;\n }\n },\n padding: 10,\n }),\n ],\n });\n\n const role = useRole(context, { role: \"listbox\" });\n const dismiss = useDismiss(context);\n const listNav = useListNavigation(context, {\n listRef,\n activeIndex,\n onNavigate: setActiveIndex,\n /* we want the real focus to stay on the input, so focus associated to active items is simulated */\n virtual: true,\n loop: true,\n });\n\n const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([\n role,\n dismiss,\n listNav,\n ]);\n\n function handleChangeSearchValue(e: ChangeEvent<HTMLInputElement>) {\n const value = e.target.value;\n\n onChangeSearchValueStable(value, false);\n\n if (value !== searchValue && selection !== null) {\n onChangeSelectionStable(null);\n setActiveIndex(null);\n return;\n }\n\n if (value) {\n setIsOpen(true);\n /**\n * bug whith LazyAutocomplete activeIndex is set to 0 but the options array has immediately 0 elements\n * so focus can't be set to the first Dom element.\n */\n setActiveIndex(listRef.current[0] ? 0 : null);\n } else {\n setIsOpen(false);\n setActiveIndex(null);\n }\n }\n\n const handleSelect = useCallback(\n (index: number | null) => {\n if (index === null) {\n onChangeSelectionStable(null);\n } else if (options[index]) {\n const newSelection = options[index];\n onChangeSelectionStable(newSelection);\n\n onChangeSearchValueStable(getOptionLabel(newSelection), true);\n }\n setActiveIndex(null);\n setIsOpen(false);\n },\n\n [options, onChangeSelectionStable, onChangeSearchValueStable],\n );\n\n const autocompleteContext = useMemo(\n () => ({\n activeIndex,\n selection,\n getItemProps,\n handleSelect,\n }),\n [activeIndex, selection, getItemProps, handleSelect],\n );\n\n const showClearSearchButton =\n clearSearchButton && (searchValue.trim() !== \"\" || selection !== null);\n\n return (\n <div className={className} role=\"combobox\">\n <div\n className={clsx(inputConfig.container, sizeVariant.medium, readOnly && \"readonly\")}\n ref={refs.setReference}\n data-color={color}\n >\n {icon !== false && (\n <div className=\"flex-center relative\">\n <Loader loading={loading} size=\"input\" color=\"gray\" className=\"mr-2\">\n {icon === true ? <i className=\"fe-search text-body-md\"></i> : icon}\n </Loader>\n </div>\n )}\n <input\n autoComplete=\"off\"\n autoFocus={autoFocus}\n spellCheck=\"false\"\n className={clsx(inputConfig.input, icon === false && \"pl-4\")}\n ref={ref}\n type=\"search\"\n readOnly={readOnly}\n value={searchValue}\n placeholder={placeholder}\n aria-autocomplete=\"list\"\n {...getReferenceProps({\n onClick() {\n if (selectOnFocus) {\n // it's better to listen onClick instead of onFocus. the event is triggered later and there\n // was an issue if we listen on onFocus and user click on the text of the textarea with Firefox\n (document.activeElement as HTMLInputElement)?.select();\n }\n },\n onChange: handleChangeSearchValue,\n onMouseDown() {\n if (options.length === 0) {\n return;\n }\n /**\n * There is a already selection\n * and the only element available is the selection,\n * no need to display the dropdown.\n */\n // if (options.length === 1 && options[0].value === selection?.value) {\n // return;\n // }\n setIsOpen((isOpen) => !isOpen);\n },\n onKeyDown(e: KeyboardEvent<HTMLInputElement>) {\n if (e.key === \"Enter\" && activeIndex != null) {\n handleSelect(activeIndex);\n }\n },\n })}\n {...rest}\n />\n <div className=\"flex-center relative\">\n {suffix}\n {showClearSearchButton && (\n <Button\n size=\"input\"\n type=\"button\"\n withRipple={false}\n icon\n color=\"gray\"\n variant=\"text\"\n onClick={() => {\n setIsOpen(false);\n onChangeSelectionStable(null);\n setActiveIndex(null);\n onChangeSearchValueStable(\"\", true);\n }}\n >\n <i className=\"fe-cancel\"></i>\n </Button>\n )}\n {icon === false && loading && <Loader size=\"medium\" color=\"gray\" />}\n {!selection && searchValue === \"\" && noSearchSuffix}\n </div>\n </div>\n <FloatingPortal>\n <AutocompleteContext.Provider value={autocompleteContext}>\n {isOpen && (\n <FloatingFocusManager\n disabled={selectOnFocus}\n context={context}\n initialFocus={-1}\n visuallyHiddenDismiss\n >\n <div\n className=\"z-dialog outline-hidden\"\n ref={refs.setFloating}\n style={floatingStyles as CSSProperties}\n {...getFloatingProps()}\n >\n <Dialog\n placement={context.placement}\n className=\"motion-safe:animate-fade-in-list overflow-auto\"\n >\n <FloatingList elementsRef={listRef}>\n {options.map((option) => {\n return <OptionComponent {...option} key={getOptionValue(option)} />;\n })}\n </FloatingList>\n </Dialog>\n </div>\n </FloatingFocusManager>\n )}\n </AutocompleteContext.Provider>\n </FloatingPortal>\n </div>\n );\n}\n","import { useRef, useState } from \"react\";\nimport { Autocomplete, AutocompleteProps } from \"./Autocomplete\";\nimport { Option, OptionLike } from \"../select\";\nimport { useEffectEvent, useIsomorphicLayoutEffect } from \"../../hooks\";\nimport { getOptionLabel } from \"./util\";\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ninterface Props<O extends OptionLike = Option>\n extends Omit<\n AutocompleteProps<O>,\n \"searchValue\" | \"onChangeSearchValue\" | \"loading\" | \"clearSearchButton\" | \"selectOnFocus\"\n > {}\n\nexport function SimpleAutocomplete<O extends OptionLike = Option>({\n options,\n selection = null,\n onChangeSelection,\n ...rest\n}: Props<O>) {\n const onChangeSelectionStable = useEffectEvent(onChangeSelection);\n\n const [searchValue, setSearchValue] = useState(selection ? getOptionLabel(selection) : \"\");\n\n const searchValueRef = useRef(searchValue);\n searchValueRef.current = searchValue;\n\n const inputRef = useRef<HTMLInputElement>(null!);\n\n // side effect, update the searchValue <input /> value when\n // selection come from outside\n useIsomorphicLayoutEffect(() => {\n if (selection === null) {\n if (document.activeElement !== inputRef.current) {\n setSearchValue(\"\");\n }\n return;\n }\n\n // we need the fresh value of searchValue but we don't\n // want searchValue as useEffect dependency\n const selectionLabel = getOptionLabel(selection);\n if (searchValueRef.current !== getOptionLabel(selection)) {\n setSearchValue(selectionLabel);\n }\n }, [selection, setSearchValue]);\n\n const filteredOptions =\n selection !== null\n ? []\n : options.filter((option) => {\n const optionLabel = getOptionLabel(option);\n return optionLabel.toLowerCase().startsWith(searchValue.toLowerCase());\n });\n\n return (\n <Autocomplete\n ref={inputRef}\n searchValue={searchValue}\n onChangeSearchValue={setSearchValue}\n selection={selection}\n onChangeSelection={onChangeSelectionStable}\n options={filteredOptions}\n {...rest}\n />\n );\n}\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { Autocomplete, AutocompleteProps } from \"./Autocomplete\";\nimport { OptionLike, Option } from \"../select\";\nimport { getOptionLabel } from \"./util\";\nimport { useStateDebounce, useEffectEvent, useIsomorphicLayoutEffect } from \"../../hooks\";\n\ninterface Props<O extends OptionLike = Option>\n // Omit \"searchValue\" | \"onChangeSearchValue\" | \"options\"\n extends Omit<\n AutocompleteProps<O>,\n \"searchValue\" | \"onChangeSearchValue\" | \"options\" | \"selectOnFocus\"\n > {\n onChangeSearchValueCallback: (searchValue: string) => Promise<O[]>;\n debounce?: number;\n}\n\nexport function LazyAutocomplete<O extends OptionLike = Option>({\n onChangeSearchValueCallback,\n debounce = 5000,\n selection = null,\n onChangeSelection,\n ...rest\n}: Props<O>) {\n const onChangeSelectionStable = useEffectEvent(onChangeSelection);\n const onChangeSearchValueCallbackStable = useEffectEvent(onChangeSearchValueCallback);\n\n const [searchValue, searchValueDebounced, setSearchValue] = useStateDebounce(\n selection ? getOptionLabel(selection) : \"\",\n debounce,\n );\n\n const searchValueRef = useRef(searchValue);\n searchValueRef.current = searchValue;\n\n const inputRef = useRef<HTMLInputElement>(null!);\n\n const [loading, setLoading] = useState(false);\n\n const [options, setOptions] = useState<O[]>([]);\n\n const handleChangeSelection = useCallback(\n (selection: O | null) => {\n onChangeSelectionStable(selection);\n if (selection) {\n setOptions([]);\n }\n },\n [onChangeSelectionStable],\n );\n\n // side effect, update the searchValue <input /> value when\n // selection come from outside\n useIsomorphicLayoutEffect(() => {\n if (selection === null) {\n if (document.activeElement !== inputRef.current) {\n setSearchValue(\"\", true);\n }\n return;\n }\n\n // we need the fresh value of searchValue but we don't\n // want searchValue as useEffect dependency\n const selectionLabel = getOptionLabel(selection);\n if (searchValueRef.current !== selectionLabel) {\n setSearchValue(selectionLabel, true);\n }\n }, [selection, setSearchValue]);\n\n /**\n * set new options when searchValueDebounced change\n */\n useEffect(() => {\n let abort = false;\n\n // when we're selecting option we change searchValue to be the complete label\n // value but we don't want to fetch new research\n if (selection) {\n return;\n }\n\n if (searchValueDebounced.trim() === \"\") {\n setOptions([]);\n return;\n }\n\n setLoading(true);\n\n onChangeSearchValueCallbackStable(searchValueDebounced)\n ?.then((newOptions) => {\n setLoading(false);\n\n if (!abort) {\n setOptions(newOptions);\n }\n })\n .catch(() => {\n setLoading(false);\n });\n\n return () => {\n setLoading(false);\n abort = true;\n };\n }, [selection, searchValueDebounced, onChangeSearchValueCallbackStable]);\n\n return (\n <Autocomplete\n ref={inputRef}\n searchValue={searchValue}\n onChangeSearchValue={(newValue, immediate) => {\n setSearchValue(newValue, immediate || newValue === \"\" ? true : false);\n }}\n selection={selection}\n onChangeSelection={handleChangeSelection}\n options={options}\n loading={loading}\n {...rest}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAWA,MAAa,sBAAsB,cAA0C,KAAK;AAElF,SAAgB,kBAAkB;CAChC,MAAM,UAAU,WAAW,oBAAoB;AAC/C,KAAI,YAAY,KACd,OAAM,IAAI,MAAM,4DAA4D;AAE9E,QAAO;;;;;AChBT,SAAgB,eAAe,QAAoB;AACjD,SAAQ,OAAO,MAAf;EACE,KAAK,UACH,QAAO,OAAO,WAAW;EAC3B,QACE,QAAO,OAAO;;;AAIpB,SAAgB,eAAe,QAAoB;AACjD,SAAQ,OAAO,MAAf;EACE,KAAK,UACH,QAAO,OAAO,WAAW;EAC3B,QACE,QAAO,OAAO;;;;;;ACPpB,MAAa,qBAAqB,KAAK,SAASA,qBAC9C,OACA;CACA,MAAM,QAAQ,eAAe,MAAM;CAEnC,MAAM,KAAK,OAAO;CAClB,MAAM,EAAE,aAAa,WAAW,cAAc,iBAAiB,iBAAiB;CAChF,MAAM,EAAE,KAAK,UAAU,YAAY,EAAE,OAAO,CAAC;CAC7C,MAAM,WAAW,gBAAgB;AAGjC,QACE,oBAAC;EACC,WAAW,KAAK,WAJD,YAAY,eAAe,UAAU,KAAK,eAAe,MAAM,GAAG,SAI1C,cAAc,YAAY,YAAY;EACxE;EACL,MAAK;EACD;EACJ,qBAAkB;EAClB,iBAAe;EACf,GAAI,aAAa,EACf,eAAe,aAAa,MAAM,EACnC,CAAC;YAED;GACG;EAER;;;;ACgDF,SAAgB,aAA4C,EAC1D,WACA,YAAY,OACZ,OAAO,MACP,QAAQ,UACR,gBACA,QACA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IAET;EAAC;EAAW;EAAsB;EAAkC,CAAC;AAExE,QACE,oBAAC;EACC,KAAK;EACQ;EACb,sBAAsB,UAAU,cAAc;AAC5C,kBAAe,UAAU,aAAa,aAAa,KAAK,OAAO,MAAM;;EAE5D;EACX,mBAAmB;EACV;EACA;EACT,GAAI;GACJ"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["AutocompleteOption","isOpen","selection"],"sources":["../../../src/components/autocomplete/useAutocompleteContext.ts","../../../src/components/autocomplete/util.ts","../../../src/components/autocomplete/AutocompleteOption.tsx","../../../src/components/autocomplete/Autocomplete.tsx","../../../src/components/autocomplete/SimpleAutocomplete.tsx","../../../src/components/autocomplete/LazyAutocomplete.tsx"],"sourcesContent":["import { useInteractions } from \"@floating-ui/react\";\nimport { createContext, useContext } from \"react\";\nimport { OptionLike } from \"../select\";\n\ninterface AutocompleteContext {\n activeIndex: number | null;\n selection: OptionLike | null;\n getItemProps: ReturnType<typeof useInteractions>[\"getItemProps\"];\n handleSelect: (index: number | null) => void;\n}\n\nexport const AutocompleteContext = createContext<AutocompleteContext | null>(null);\n\nexport function useAutocomplete() {\n const context = useContext(AutocompleteContext);\n if (context === null) {\n throw new Error(\"Autocomplete components must be wrapped in <Autocomplete>\");\n }\n return context;\n}\n","import { OptionLike } from \"../select\";\n\nexport function getOptionLabel(option: OptionLike) {\n switch (option.type) {\n case \"Feature\":\n return option.properties.label;\n default:\n return option.label;\n }\n}\n\nexport function getOptionValue(option: OptionLike) {\n switch (option.type) {\n case \"Feature\":\n return option.properties.id;\n default:\n return option.value;\n }\n}\n","import { memo, useId } from \"react\";\nimport { OptionLike } from \"../select\";\nimport { useListItem } from \"@floating-ui/react\";\nimport { useAutocomplete } from \"./useAutocompleteContext\";\nimport clsx from \"clsx\";\nimport { getOptionLabel, getOptionValue } from \"./util\";\n\nexport type AutocompleteOptionProps<O extends OptionLike> = O;\n\nexport const AutocompleteOption = memo(function AutocompleteOption<O extends OptionLike>(\n props: AutocompleteOptionProps<O>,\n) {\n const label = getOptionLabel(props);\n\n const id = useId();\n const { activeIndex, selection, getItemProps, handleSelect } = useAutocomplete();\n const { ref, index } = useListItem({ label });\n const isActive = activeIndex === index;\n const isSelected = selection ? getOptionValue(selection) === getOptionValue(props) : false;\n\n return (\n <div\n className={clsx(\"option\", isSelected ? \"bg-gray-2\" : isActive && \"bg-gray-1\")}\n ref={ref}\n role=\"option\"\n id={id}\n data-presentation=\"compact\"\n aria-selected={isActive}\n {...getItemProps({\n onClick: () => handleSelect(index),\n })}\n >\n {label}\n </div>\n );\n});\n","import {\n ChangeEvent,\n KeyboardEvent,\n useCallback,\n useMemo,\n useRef,\n useState,\n ReactNode,\n ComponentProps,\n CSSProperties,\n RefObject,\n} from \"react\";\nimport type { OptionLike, Option } from \"../select\";\nimport { AutocompleteOption, AutocompleteOptionProps } from \"./AutocompleteOption\";\nimport {\n FloatingFocusManager,\n FloatingList,\n FloatingPortal,\n Placement,\n autoUpdate,\n flip,\n offset,\n size,\n useDismiss,\n useFloating,\n useInteractions,\n useListNavigation,\n useRole,\n} from \"@floating-ui/react\";\nimport { AutocompleteContext } from \"./useAutocompleteContext\";\nimport clsx from \"clsx\";\nimport { useEffectEvent } from \"../../hooks\";\n\nimport { getOptionLabel, getOptionValue } from \"./util\";\nimport { Button } from \"../button\";\nimport { Dialog } from \"../dialog\";\nimport { Loader } from \"../loader\";\nimport { inputConfig, sizeVariant } from \"../input/Input\";\nimport { ThemeColor } from \"../../types\";\n\nexport interface AutocompleteProps<O extends OptionLike = Option> extends ComponentProps<\"input\"> {\n icon?: boolean | ReactNode;\n\n color?: ThemeColor;\n\n /**\n * render suffix only if selection and searchValue is empty\n */\n noSearchSuffix?: ReactNode;\n\n suffix?: ReactNode;\n\n placement?: Placement;\n /**\n * search string used as value for <input>\n */\n searchValue: string;\n /**\n * change handler when typing in the input\n * or when clicking on an option (the label value is passed)\n */\n onChangeSearchValue: (value: string, selectionLabel: boolean) => void;\n\n selection?: O | null;\n /**\n * select handler for a selection from the autocomplete's dropdown\n * the option object is passed when clicking on an option\n * null value is passed when typing a new character in the input search.\n */\n onChangeSelection: (option: O | null) => void;\n options: O[];\n\n autocompleteOptionComponent?: (props: AutocompleteOptionProps<O>) => ReactNode;\n\n loading?: boolean;\n\n clearSearchButton?: boolean;\n\n selectOnFocus?: boolean;\n\n ref?: RefObject<HTMLInputElement>;\n}\n\nexport function Autocomplete<O extends OptionLike = Option>({\n className,\n autoFocus = false,\n icon = true,\n color = \"yellow\",\n noSearchSuffix,\n suffix,\n placement = \"bottom\",\n placeholder = \"Search...\",\n selection = null,\n onChangeSelection,\n autocompleteOptionComponent,\n loading = false,\n clearSearchButton = false,\n searchValue,\n onChangeSearchValue,\n options,\n selectOnFocus = true,\n readOnly = false,\n ref,\n ...rest\n}: AutocompleteProps<O>) {\n const [isOpen, setIsOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState<number | null>(null);\n\n const onChangeSearchValueStable = useEffectEvent(onChangeSearchValue);\n const onChangeSelectionStable = useEffectEvent(onChangeSelection);\n\n const OptionComponent = autocompleteOptionComponent ?? AutocompleteOption;\n\n const listRef = useRef<Array<HTMLElement | null>>([]);\n\n const { refs, floatingStyles, context } = useFloating({\n placement,\n open: isOpen,\n onOpenChange: setIsOpen,\n whileElementsMounted: autoUpdate,\n middleware: [\n offset(5),\n flip({ padding: 10 }),\n size({\n apply({ rects, elements, availableHeight }) {\n Object.assign(elements.floating.style, {\n width: `${Math.max(130, rects.reference.width)}px`,\n });\n const firstChild = elements.floating.firstElementChild as HTMLElement;\n if (firstChild) {\n firstChild.style.maxHeight = `${Math.min(availableHeight, 288)}px`;\n }\n },\n padding: 10,\n }),\n ],\n });\n\n const role = useRole(context, { role: \"listbox\" });\n const dismiss = useDismiss(context);\n const listNav = useListNavigation(context, {\n listRef,\n activeIndex,\n onNavigate: setActiveIndex,\n /* we want the real focus to stay on the input, so focus associated to active items is simulated */\n virtual: true,\n loop: true,\n });\n\n const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([\n role,\n dismiss,\n listNav,\n ]);\n\n function handleChangeSearchValue(e: ChangeEvent<HTMLInputElement>) {\n const value = e.target.value;\n\n onChangeSearchValueStable(value, false);\n\n if (value !== searchValue && selection !== null) {\n onChangeSelectionStable(null);\n setActiveIndex(null);\n return;\n }\n\n if (value) {\n setIsOpen(true);\n /**\n * bug whith LazyAutocomplete activeIndex is set to 0 but the options array has immediately 0 elements\n * so focus can't be set to the first Dom element.\n */\n setActiveIndex(listRef.current[0] ? 0 : null);\n } else {\n setIsOpen(false);\n setActiveIndex(null);\n }\n }\n\n const handleSelect = useCallback(\n (index: number | null) => {\n if (index === null) {\n onChangeSelectionStable(null);\n } else if (options[index]) {\n const newSelection = options[index];\n onChangeSelectionStable(newSelection);\n\n onChangeSearchValueStable(getOptionLabel(newSelection), true);\n }\n setActiveIndex(null);\n setIsOpen(false);\n },\n\n [options, onChangeSelectionStable, onChangeSearchValueStable],\n );\n\n const autocompleteContext = useMemo(\n () => ({\n activeIndex,\n selection,\n getItemProps,\n handleSelect,\n }),\n [activeIndex, selection, getItemProps, handleSelect],\n );\n\n const showClearSearchButton =\n clearSearchButton && (searchValue.trim() !== \"\" || selection !== null);\n\n return (\n <div className={className} role=\"combobox\">\n <div\n className={clsx(inputConfig.container, sizeVariant.medium, readOnly && \"readonly\")}\n ref={refs.setReference}\n data-color={color}\n >\n {icon !== false && (\n <div className=\"flex-center relative\">\n <Loader loading={loading} size=\"input\" color=\"gray\" className=\"mr-2\">\n {icon === true ? <i className=\"fe-search text-body-md\"></i> : icon}\n </Loader>\n </div>\n )}\n <input\n autoComplete=\"off\"\n autoFocus={autoFocus}\n spellCheck=\"false\"\n className={clsx(inputConfig.input, icon === false && \"pl-4\")}\n ref={ref}\n type=\"search\"\n readOnly={readOnly}\n value={searchValue}\n placeholder={placeholder}\n aria-autocomplete=\"list\"\n {...getReferenceProps({\n onClick() {\n if (selectOnFocus) {\n // it's better to listen onClick instead of onFocus. the event is triggered later and there\n // was an issue if we listen on onFocus and user click on the text of the textarea with Firefox\n (document.activeElement as HTMLInputElement)?.select();\n }\n },\n onChange: handleChangeSearchValue,\n onMouseDown() {\n if (options.length === 0) {\n return;\n }\n /**\n * There is a already selection\n * and the only element available is the selection,\n * no need to display the dropdown.\n */\n // if (options.length === 1 && options[0].value === selection?.value) {\n // return;\n // }\n setIsOpen((isOpen) => !isOpen);\n },\n onKeyDown(e: KeyboardEvent<HTMLInputElement>) {\n if (e.key === \"Enter\" && activeIndex != null) {\n handleSelect(activeIndex);\n }\n },\n })}\n {...rest}\n />\n <div className=\"flex-center relative\">\n {suffix}\n {showClearSearchButton && (\n <Button\n size=\"input\"\n type=\"button\"\n withRipple={false}\n icon\n color=\"gray\"\n variant=\"text\"\n onClick={() => {\n setIsOpen(false);\n onChangeSelectionStable(null);\n setActiveIndex(null);\n onChangeSearchValueStable(\"\", true);\n }}\n >\n <i className=\"fe-cancel\"></i>\n </Button>\n )}\n {icon === false && loading && <Loader size=\"medium\" color=\"gray\" />}\n {!selection && searchValue === \"\" && noSearchSuffix}\n </div>\n </div>\n <FloatingPortal>\n <AutocompleteContext.Provider value={autocompleteContext}>\n {isOpen && (\n <FloatingFocusManager\n disabled={selectOnFocus}\n context={context}\n initialFocus={-1}\n visuallyHiddenDismiss\n >\n <div\n className=\"z-dialog outline-hidden\"\n ref={refs.setFloating}\n style={floatingStyles as CSSProperties}\n {...getFloatingProps()}\n >\n <Dialog\n placement={context.placement}\n className=\"motion-safe:animate-fade-in-list overflow-auto\"\n >\n <FloatingList elementsRef={listRef}>\n {options.map((option) => {\n return <OptionComponent {...option} key={getOptionValue(option)} />;\n })}\n </FloatingList>\n </Dialog>\n </div>\n </FloatingFocusManager>\n )}\n </AutocompleteContext.Provider>\n </FloatingPortal>\n </div>\n );\n}\n","import { useRef, useState } from \"react\";\nimport { Autocomplete, AutocompleteProps } from \"./Autocomplete\";\nimport { Option, OptionLike } from \"../select\";\nimport { useEffectEvent, useIsomorphicLayoutEffect } from \"../../hooks\";\nimport { getOptionLabel } from \"./util\";\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ninterface Props<O extends OptionLike = Option> extends Omit<\n AutocompleteProps<O>,\n \"searchValue\" | \"onChangeSearchValue\" | \"loading\" | \"clearSearchButton\" | \"selectOnFocus\"\n> {}\n\nexport function SimpleAutocomplete<O extends OptionLike = Option>({\n options,\n selection = null,\n onChangeSelection,\n ...rest\n}: Props<O>) {\n const onChangeSelectionStable = useEffectEvent(onChangeSelection);\n\n const [searchValue, setSearchValue] = useState(selection ? getOptionLabel(selection) : \"\");\n\n const searchValueRef = useRef(searchValue);\n searchValueRef.current = searchValue;\n\n const inputRef = useRef<HTMLInputElement>(null!);\n\n // side effect, update the searchValue <input /> value when\n // selection come from outside\n useIsomorphicLayoutEffect(() => {\n if (selection === null) {\n if (document.activeElement !== inputRef.current) {\n setSearchValue(\"\");\n }\n return;\n }\n\n // we need the fresh value of searchValue but we don't\n // want searchValue as useEffect dependency\n const selectionLabel = getOptionLabel(selection);\n if (searchValueRef.current !== getOptionLabel(selection)) {\n setSearchValue(selectionLabel);\n }\n }, [selection, setSearchValue]);\n\n const filteredOptions =\n selection !== null\n ? []\n : options.filter((option) => {\n const optionLabel = getOptionLabel(option);\n return optionLabel.toLowerCase().startsWith(searchValue.toLowerCase());\n });\n\n return (\n <Autocomplete\n ref={inputRef}\n searchValue={searchValue}\n onChangeSearchValue={setSearchValue}\n selection={selection}\n onChangeSelection={onChangeSelectionStable}\n options={filteredOptions}\n {...rest}\n />\n );\n}\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { Autocomplete, AutocompleteProps } from \"./Autocomplete\";\nimport { OptionLike, Option } from \"../select\";\nimport { getOptionLabel } from \"./util\";\nimport { useStateDebounce, useEffectEvent, useIsomorphicLayoutEffect } from \"../../hooks\";\n\ninterface Props<O extends OptionLike = Option>\n // Omit \"searchValue\" | \"onChangeSearchValue\" | \"options\"\n extends Omit<\n AutocompleteProps<O>,\n \"searchValue\" | \"onChangeSearchValue\" | \"options\" | \"selectOnFocus\"\n > {\n onChangeSearchValueCallback: (searchValue: string) => Promise<O[]>;\n debounce?: number;\n}\n\nexport function LazyAutocomplete<O extends OptionLike = Option>({\n onChangeSearchValueCallback,\n debounce = 5000,\n selection = null,\n onChangeSelection,\n ...rest\n}: Props<O>) {\n const onChangeSelectionStable = useEffectEvent(onChangeSelection);\n const onChangeSearchValueCallbackStable = useEffectEvent(onChangeSearchValueCallback);\n\n const [searchValue, searchValueDebounced, setSearchValue] = useStateDebounce(\n selection ? getOptionLabel(selection) : \"\",\n debounce,\n );\n\n const searchValueRef = useRef(searchValue);\n searchValueRef.current = searchValue;\n\n const inputRef = useRef<HTMLInputElement>(null!);\n\n const [loading, setLoading] = useState(false);\n\n const [options, setOptions] = useState<O[]>([]);\n\n const handleChangeSelection = useCallback(\n (selection: O | null) => {\n onChangeSelectionStable(selection);\n if (selection) {\n setOptions([]);\n }\n },\n [onChangeSelectionStable],\n );\n\n // side effect, update the searchValue <input /> value when\n // selection come from outside\n useIsomorphicLayoutEffect(() => {\n if (selection === null) {\n if (document.activeElement !== inputRef.current) {\n setSearchValue(\"\", true);\n }\n return;\n }\n\n // we need the fresh value of searchValue but we don't\n // want searchValue as useEffect dependency\n const selectionLabel = getOptionLabel(selection);\n if (searchValueRef.current !== selectionLabel) {\n setSearchValue(selectionLabel, true);\n }\n }, [selection, setSearchValue]);\n\n /**\n * set new options when searchValueDebounced change\n */\n useEffect(() => {\n let abort = false;\n\n // when we're selecting option we change searchValue to be the complete label\n // value but we don't want to fetch new research\n if (selection) {\n return;\n }\n\n if (searchValueDebounced.trim() === \"\") {\n setOptions([]);\n return;\n }\n\n setLoading(true);\n\n onChangeSearchValueCallbackStable(searchValueDebounced)\n ?.then((newOptions) => {\n setLoading(false);\n\n if (!abort) {\n setOptions(newOptions);\n }\n })\n .catch(() => {\n setLoading(false);\n });\n\n return () => {\n setLoading(false);\n abort = true;\n };\n }, [selection, searchValueDebounced, onChangeSearchValueCallbackStable]);\n\n return (\n <Autocomplete\n ref={inputRef}\n searchValue={searchValue}\n onChangeSearchValue={(newValue, immediate) => {\n setSearchValue(newValue, immediate || newValue === \"\" ? true : false);\n }}\n selection={selection}\n onChangeSelection={handleChangeSelection}\n options={options}\n loading={loading}\n {...rest}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAWA,MAAa,sBAAsB,cAA0C,KAAK;AAElF,SAAgB,kBAAkB;CAChC,MAAM,UAAU,WAAW,oBAAoB;AAC/C,KAAI,YAAY,KACd,OAAM,IAAI,MAAM,4DAA4D;AAE9E,QAAO;;;;;AChBT,SAAgB,eAAe,QAAoB;AACjD,SAAQ,OAAO,MAAf;EACE,KAAK,UACH,QAAO,OAAO,WAAW;EAC3B,QACE,QAAO,OAAO;;;AAIpB,SAAgB,eAAe,QAAoB;AACjD,SAAQ,OAAO,MAAf;EACE,KAAK,UACH,QAAO,OAAO,WAAW;EAC3B,QACE,QAAO,OAAO;;;;;;ACPpB,MAAa,qBAAqB,KAAK,SAASA,qBAC9C,OACA;CACA,MAAM,QAAQ,eAAe,MAAM;CAEnC,MAAM,KAAK,OAAO;CAClB,MAAM,EAAE,aAAa,WAAW,cAAc,iBAAiB,iBAAiB;CAChF,MAAM,EAAE,KAAK,UAAU,YAAY,EAAE,OAAO,CAAC;CAC7C,MAAM,WAAW,gBAAgB;AAGjC,QACE,oBAAC;EACC,WAAW,KAAK,WAJD,YAAY,eAAe,UAAU,KAAK,eAAe,MAAM,GAAG,SAI1C,cAAc,YAAY,YAAY;EACxE;EACL,MAAK;EACD;EACJ,qBAAkB;EAClB,iBAAe;EACf,GAAI,aAAa,EACf,eAAe,aAAa,MAAM,EACnC,CAAC;YAED;GACG;EAER;;;;ACgDF,SAAgB,aAA4C,EAC1D,WACA,YAAY,OACZ,OAAO,MACP,QAAQ,UACR,gBACA,QACA,YAAY,UACZ,cAAc,aACd,YAAY,MACZ,mBACA,6BACA,UAAU,OACV,oBAAoB,OACpB,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EACb,sBAAsB,UAAU,cAAc;AAC5C,kBAAe,UAAU,aAAa,aAAa,KAAK,OAAO,MAAM;;EAE5D;EACX,mBAAmB;EACV;EACA;EACT,GAAI;GACJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as ThemeColor } from "../../types-NxD0D2V5.mjs";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime70 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/components/badge/Badge.d.ts
|
|
6
6
|
interface Props {
|
|
@@ -8,7 +8,7 @@ interface Props {
|
|
|
8
8
|
className?: string;
|
|
9
9
|
tooltip?: string;
|
|
10
10
|
url?: string;
|
|
11
|
-
color?: ThemeColor
|
|
11
|
+
color?: ThemeColor;
|
|
12
12
|
onClick?: () => void;
|
|
13
13
|
onRemove?: () => void;
|
|
14
14
|
}
|
|
@@ -20,7 +20,7 @@ declare function Badge({
|
|
|
20
20
|
tooltip,
|
|
21
21
|
url,
|
|
22
22
|
color
|
|
23
|
-
}: Props):
|
|
23
|
+
}: Props): react_jsx_runtime70.JSX.Element;
|
|
24
24
|
//#endregion
|
|
25
25
|
export { Badge };
|
|
26
26
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/components/badge/Badge.tsx"],"sourcesContent":[],"mappings":";;;;;UAOU,KAAA;YACE;;EADF,OAAA,CAAK,EAAA,MAAA;EAUC,GAAA,CAAA,EAAA,MAAK;EACnB,KAAA,CAAA,EANQ,UAMR
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/components/badge/Badge.tsx"],"sourcesContent":[],"mappings":";;;;;UAOU,KAAA;YACE;;EADF,OAAA,CAAK,EAAA,MAAA;EAUC,GAAA,CAAA,EAAA,MAAK;EACnB,KAAA,CAAA,EANQ,UAMR;EACA,OAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EACA,QAAA,CAAA,EAAA,GAAA,GAAA,IAAA;;AAEA,iBALc,KAAA,CAKd;EAAA,QAAA;EAAA,SAAA;EAAA,QAAA;EAAA,OAAA;EAAA,OAAA;EAAA,GAAA;EAAA;AAAA,CAAA,EAGC,KAHD,CAAA,EAGM,mBAAA,CAAA,GAAA,CAAA,OAHN"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as ButtonProps, r as buttonVariants, t as Button } from "../../Button
|
|
2
|
-
import { n as ButtonGroup, r as buttonGroupVariants, t as HrefButton } from "../../index-
|
|
1
|
+
import { n as ButtonProps, r as buttonVariants, t as Button } from "../../Button-jLcascU9.mjs";
|
|
2
|
+
import { n as ButtonGroup, r as buttonGroupVariants, t as HrefButton } from "../../index-nYRuqVhj.mjs";
|
|
3
3
|
export { Button, ButtonGroup, ButtonProps, HrefButton, buttonGroupVariants, buttonVariants };
|
|
@@ -2,7 +2,7 @@ import "../../hooks-CBNvxDkV.mjs";
|
|
|
2
2
|
import "../../loader-BSQqGDHk.mjs";
|
|
3
3
|
import "../../lib-BYj5usAj.mjs";
|
|
4
4
|
import "../../slot-CcgC3dMT.mjs";
|
|
5
|
-
import { n as buttonVariants, t as Button } from "../../Button-
|
|
6
|
-
import { n as ButtonGroup, r as buttonGroupVariants, t as HrefButton } from "../../button-
|
|
5
|
+
import { n as buttonVariants, t as Button } from "../../Button-Pt94K1aQ.mjs";
|
|
6
|
+
import { n as ButtonGroup, r as buttonGroupVariants, t as HrefButton } from "../../button-D9dSyBrn.mjs";
|
|
7
7
|
|
|
8
8
|
export { Button, ButtonGroup, HrefButton, buttonGroupVariants, buttonVariants };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/code/Code.d.ts
|
|
5
5
|
interface Props {
|
|
@@ -9,7 +9,7 @@ interface Props {
|
|
|
9
9
|
declare function Code({
|
|
10
10
|
children,
|
|
11
11
|
className
|
|
12
|
-
}: Props):
|
|
12
|
+
}: Props): react_jsx_runtime2.JSX.Element;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { Code };
|
|
15
15
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ComponentPropsWithRef, ReactElement, ReactNode, RefObject } from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime40 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/context-menu/ContextMenu.d.ts
|
|
5
5
|
interface Props extends ComponentPropsWithRef<"div"> {
|
|
@@ -13,7 +13,7 @@ declare function ContextMenu({
|
|
|
13
13
|
children,
|
|
14
14
|
style,
|
|
15
15
|
eventName
|
|
16
|
-
}: Props):
|
|
16
|
+
}: Props): react_jsx_runtime40.JSX.Element;
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/components/context-menu/ContextMenuItem.d.ts
|
|
19
19
|
type ContextMenuItemMouseEvent = React.MouseEvent<HTMLButtonElement> | MouseEvent | CustomEvent | null;
|
|
@@ -31,7 +31,7 @@ declare function ContextMenuItem({
|
|
|
31
31
|
className,
|
|
32
32
|
ref,
|
|
33
33
|
...props
|
|
34
|
-
}: ContextMenuItemProps):
|
|
34
|
+
}: ContextMenuItemProps): react_jsx_runtime40.JSX.Element;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { ContextMenu, ContextMenuItem, type ContextMenuItemMouseEvent };
|
|
37
37
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/components/context-menu/ContextMenu.tsx","../../../src/components/context-menu/ContextMenuItem.tsx"],"sourcesContent":[],"mappings":";;;;UAiCU,KAAA,SAAc;cACV,UAAU;YACZ,iBAAiB;EAFnB,SAAM,CAAA,EAAA,aAAA,GAAA,MAAA;EACQ,gBAAA,CAAA,EAAA,MAAA;;AACZ,iBAII,WAAA,CAJJ;EAAA,SAAA;EAAA,QAAA;EAAA,KAAA;EAAA;AAAA,CAAA,EAI2E,KAJ3E,CAAA,EAIgF,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/components/context-menu/ContextMenu.tsx","../../../src/components/context-menu/ContextMenuItem.tsx"],"sourcesContent":[],"mappings":";;;;UAiCU,KAAA,SAAc;cACV,UAAU;YACZ,iBAAiB;EAFnB,SAAM,CAAA,EAAA,aAAA,GAAA,MAAA;EACQ,gBAAA,CAAA,EAAA,MAAA;;AACZ,iBAII,WAAA,CAJJ;EAAA,SAAA;EAAA,QAAA;EAAA,KAAA;EAAA;AAAA,CAAA,EAI2E,KAJ3E,CAAA,EAIgF,mBAAA,CAAA,GAAA,CAAA,OAJhF;;;KChCA,yBAAA,GACR,KAAA,CAAM,WAAW,qBACjB,aACA;UAGa,oBAAA,SAA6B,KAAK;;EDwBzC,QAAM,CAAA,EAAA,OAAA;EACQ,IAAA,CAAA,ECtBf,SDsBe;EAAV,OAAA,CAAA,EAAA,CAAA,CAAA,ECrBE,yBDqBF,EAAA,GAAA,IAAA;EACF,GAAA,CAAA,ECrBJ,SDqBI,CCrBM,iBDqBN,CAAA;;AAFY,iBChBR,eAAA,CDgBQ;EAAA,KAAA;EAAA,QAAA;EAAA,IAAA;EAAA,SAAA;EAAA,GAAA;EAAA,GAAA;AAAA,CAAA,ECTrB,oBDSqB,CAAA,ECTD,mBAAA,CAAA,GAAA,CAAA,ODSC"}
|