pentatrion-design 1.2.1 → 1.2.3
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/.github/workflows/ci.yml +36 -0
- package/CHANGELOG.md +12 -0
- package/dist/Button-CVudu6dV.d.mts.map +1 -1
- package/dist/{Button-CL7xvvey.mjs → Button-Cx5QDjg9.mjs} +2 -2
- package/dist/{Button-CL7xvvey.mjs.map → Button-Cx5QDjg9.mjs.map} +1 -1
- package/dist/Field-DZmC5a1D.mjs +183 -0
- package/dist/Field-DZmC5a1D.mjs.map +1 -0
- package/dist/Field-DhaPMGcl.d.mts +26 -0
- package/dist/Field-DhaPMGcl.d.mts.map +1 -0
- package/dist/Input-B9HNBGpq.mjs.map +1 -1
- package/dist/Scroll-BSL6d8Ob.mjs.map +1 -1
- package/dist/{Snack-B1Fa9Ofb.mjs → Snack-0wCsjAOm.mjs} +7 -9
- package/dist/Snack-0wCsjAOm.mjs.map +1 -0
- package/dist/TooltipTrigger-VrJxlxNx.mjs.map +1 -1
- package/dist/badge-CtcHuvQK.mjs.map +1 -1
- package/dist/{button-tAEodFUL.mjs → button-CuqQ_n9M.mjs} +3 -3
- package/dist/{button-tAEodFUL.mjs.map → button-CuqQ_n9M.mjs.map} +1 -1
- package/dist/components/accordion/index.d.mts.map +1 -1
- package/dist/components/accordion/index.mjs +3 -5
- package/dist/components/accordion/index.mjs.map +1 -1
- package/dist/components/autocomplete/index.d.mts.map +1 -1
- package/dist/components/autocomplete/index.mjs +17 -22
- package/dist/components/autocomplete/index.mjs.map +1 -1
- package/dist/components/button/index.mjs +2 -2
- package/dist/components/context-menu/index.d.mts.map +1 -1
- package/dist/components/context-menu/index.mjs +3 -7
- package/dist/components/context-menu/index.mjs.map +1 -1
- package/dist/components/dialog/index.d.mts.map +1 -1
- package/dist/components/dropdown-menu-nested/index.mjs +1 -1
- package/dist/components/dropdown-menu-nested/index.mjs.map +1 -1
- package/dist/components/fields/checkbox/index.d.mts +5 -5
- package/dist/components/fields/checkbox/index.d.mts.map +1 -1
- package/dist/components/fields/checkbox/index.mjs +69 -56
- package/dist/components/fields/checkbox/index.mjs.map +1 -1
- package/dist/components/fields/color/index.d.mts +3 -3
- package/dist/components/fields/color/index.d.mts.map +1 -1
- package/dist/components/fields/color/index.mjs +78 -76
- package/dist/components/fields/color/index.mjs.map +1 -1
- package/dist/components/fields/date/index.d.mts +3 -3
- package/dist/components/fields/date/index.d.mts.map +1 -1
- package/dist/components/fields/date/index.mjs +4 -2
- package/dist/components/fields/date/index.mjs.map +1 -1
- package/dist/components/fields/field/index.d.mts +1 -1
- package/dist/components/fields/field/index.mjs +1 -1
- package/dist/components/fields/file/index.d.mts +3 -3
- package/dist/components/fields/file/index.d.mts.map +1 -1
- package/dist/components/fields/file/index.mjs +67 -56
- package/dist/components/fields/file/index.mjs.map +1 -1
- package/dist/components/fields/input-button/index.mjs +2 -2
- package/dist/components/fields/input-button/index.mjs.map +1 -1
- package/dist/components/fields/radio/index.d.mts +7 -7
- package/dist/components/fields/radio/index.d.mts.map +1 -1
- package/dist/components/fields/radio/index.mjs +137 -116
- package/dist/components/fields/radio/index.mjs.map +1 -1
- package/dist/components/fields/range/index.d.mts +3 -3
- package/dist/components/fields/range/index.d.mts.map +1 -1
- package/dist/components/fields/range/index.mjs +40 -34
- package/dist/components/fields/range/index.mjs.map +1 -1
- package/dist/components/fields/select/index.d.mts +3 -3
- package/dist/components/fields/select/index.d.mts.map +1 -1
- package/dist/components/fields/select/index.mjs +7 -5
- package/dist/components/fields/select/index.mjs.map +1 -1
- package/dist/components/fields/stars/index.mjs +3 -3
- package/dist/components/fields/stars/index.mjs.map +1 -1
- package/dist/components/fields/text/index.d.mts +7 -7
- package/dist/components/fields/text/index.d.mts.map +1 -1
- package/dist/components/fields/text/index.mjs +1 -1
- package/dist/components/fields/textarea/index.d.mts +3 -3
- package/dist/components/fields/textarea/index.d.mts.map +1 -1
- package/dist/components/fields/textarea/index.mjs +28 -22
- package/dist/components/fields/textarea/index.mjs.map +1 -1
- package/dist/components/fields/toggle/index.mjs.map +1 -1
- package/dist/components/fields/totp/index.d.mts +3 -3
- package/dist/components/fields/totp/index.d.mts.map +1 -1
- package/dist/components/fields/totp/index.mjs +21 -51
- package/dist/components/fields/totp/index.mjs.map +1 -1
- package/dist/components/fields/wysiwyg/index.d.mts +13 -4
- package/dist/components/fields/wysiwyg/index.d.mts.map +1 -1
- package/dist/components/fields/wysiwyg/index.mjs +48 -14
- package/dist/components/fields/wysiwyg/index.mjs.map +1 -1
- package/dist/components/highlight/index.mjs.map +1 -1
- package/dist/components/modal/index.mjs +1 -1
- package/dist/components/notification/index.d.mts.map +1 -1
- package/dist/components/notification/index.mjs +1 -1
- package/dist/components/notification/index.mjs.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.mjs.map +1 -1
- package/dist/components/resize-area/index.mjs.map +1 -1
- package/dist/components/select-legacy/index.mjs +3 -5
- package/dist/components/select-legacy/index.mjs.map +1 -1
- package/dist/components/snack/index.d.mts.map +1 -1
- package/dist/components/snack/index.mjs +1 -1
- package/dist/components/steps/index.mjs.map +1 -1
- package/dist/components/table/index.mjs.map +1 -1
- package/dist/components/tabs/index.mjs.map +1 -1
- package/dist/components/toast/index.mjs +1 -1
- package/dist/components/toast/index.mjs.map +1 -1
- package/dist/components/tooltip/index.mjs.map +1 -1
- package/dist/dropdown-menu-Bk0Asqb4.mjs.map +1 -1
- package/dist/hooks/index.d.mts +1 -4
- package/dist/hooks/index.d.mts.map +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/{hooks-CBijm9RA.mjs → hooks-BQw3Dsve.mjs} +3 -12
- package/dist/hooks-BQw3Dsve.mjs.map +1 -0
- package/dist/index-BG1rgXFb.d.mts.map +1 -1
- package/dist/index-C03MgO8e.d.mts.map +1 -1
- package/dist/loader-csj5qb99.mjs.map +1 -1
- package/dist/media-preview-DzVLd1Yz.mjs.map +1 -1
- package/dist/{modal-DY7p5b0n.mjs → modal-BndYAj4O.mjs} +2 -2
- package/dist/{modal-DY7p5b0n.mjs.map → modal-BndYAj4O.mjs.map} +1 -1
- package/dist/slot-D8EJRq72.mjs.map +1 -1
- package/dist/{text-BdLXdha1.mjs → text-BE2tAIwr.mjs} +152 -133
- package/dist/text-BE2tAIwr.mjs.map +1 -0
- package/package.json +12 -22
- package/src/components/accordion/Accordion.tsx +2 -5
- package/src/components/autocomplete/Autocomplete.tsx +8 -12
- package/src/components/autocomplete/LazyAutocomplete.tsx +5 -8
- package/src/components/autocomplete/SimpleAutocomplete.tsx +2 -4
- package/src/components/context-menu/ContextMenu.tsx +3 -2
- package/src/components/fields/checkbox/CheckboxField.tsx +4 -3
- package/src/components/fields/checkbox/CheckboxesField.tsx +4 -3
- package/src/components/fields/color/ColorField.stories.tsx +1 -1
- package/src/components/fields/color/ColorField.tsx +72 -76
- package/src/components/fields/date/DateField.stories.tsx +1 -1
- package/src/components/fields/date/DateField.tsx +4 -3
- package/src/components/fields/field/Field.tsx +23 -8
- package/src/components/fields/file/FileField.stories.tsx +1 -1
- package/src/components/fields/file/FileField.tsx +5 -2
- package/src/components/fields/file/UploaderMock.tsx +3 -2
- package/src/components/fields/radio/RadioWithLegendField.tsx +4 -2
- package/src/components/fields/radio/RadiosButtonIconField.tsx +4 -3
- package/src/components/fields/radio/RadiosField.tsx +12 -3
- package/src/components/fields/range/RangeField.tsx +13 -3
- package/src/components/fields/select/Select.tsx +1 -1
- package/src/components/fields/select/SelectField.stories.tsx +1 -1
- package/src/components/fields/select/SelectField.tsx +4 -3
- package/src/components/fields/text/PasswordField.tsx +4 -3
- package/src/components/fields/text/SlugField.tsx +4 -3
- package/src/components/fields/text/TextField.tsx +4 -2
- package/src/components/fields/textarea/TextareaField.tsx +4 -3
- package/src/components/fields/totp/TotpField.tsx +16 -13
- package/src/components/fields/wysiwyg/WysiwygField.tsx +4 -2
- package/src/components/fields/wysiwyg/index.ts +9 -0
- package/src/components/resizable/util.ts +1 -0
- package/src/components/select-legacy/Select.tsx +2 -5
- package/src/components/snack/Snack.tsx +2 -5
- package/src/hooks/index.ts +0 -1
- package/tsdown.config.ts +0 -1
- package/vitest.config.ts +1 -1
- package/dist/Field-BHxm4Nr-.mjs +0 -175
- package/dist/Field-BHxm4Nr-.mjs.map +0 -1
- package/dist/Field-B_ZFAADd.d.mts +0 -19
- package/dist/Field-B_ZFAADd.d.mts.map +0 -1
- package/dist/Snack-B1Fa9Ofb.mjs.map +0 -1
- package/dist/components/fields/altcha/index.d.mts +0 -20
- package/dist/components/fields/altcha/index.d.mts.map +0 -1
- package/dist/components/fields/altcha/index.mjs +0 -128
- package/dist/components/fields/altcha/index.mjs.map +0 -1
- package/dist/hooks-CBijm9RA.mjs.map +0 -1
- package/dist/text-BdLXdha1.mjs.map +0 -1
- package/src/components/fields/altcha/Altcha.stories.tsx +0 -24
- package/src/components/fields/altcha/Altcha.tsx +0 -52
- package/src/components/fields/altcha/AltchaField.stories.tsx +0 -76
- package/src/components/fields/altcha/AltchaField.tsx +0 -24
- package/src/components/fields/altcha/env.d.ts +0 -21
- package/src/components/fields/altcha/index.ts +0 -2
- package/src/components/fields/altcha/locales.fr.ts +0 -18
- package/src/hooks/useEffectEvent.ts +0 -11
- package/src/hooks/useRipple.test.tsx +0 -52
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
check:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Setup Node
|
|
19
|
+
uses: actions/setup-node@v6
|
|
20
|
+
with:
|
|
21
|
+
node-version: 26.5.0
|
|
22
|
+
|
|
23
|
+
- name: "Install JS dependencies"
|
|
24
|
+
run: "npm ci"
|
|
25
|
+
|
|
26
|
+
- name: Format
|
|
27
|
+
run: npm run check:format
|
|
28
|
+
|
|
29
|
+
- name: Typecheck
|
|
30
|
+
run: npm run check:type
|
|
31
|
+
|
|
32
|
+
- name: Lint
|
|
33
|
+
run: npm run check:lint
|
|
34
|
+
|
|
35
|
+
- name: Test
|
|
36
|
+
run: npm run test-run
|
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button-CVudu6dV.d.mts","names":[],"sources":["../src/components/button/Button.tsx"],"mappings":";;;UAmBiB,oBAAoB,KAAK;EACxC;EAEA;EAEA;EAEA,QAAQ;EAER;EAEA;EAEA;EAEA;;;;EAIA;EAEA;EAEA;EAEA,MAAM,UAAU;;cAGL,iBAAc
|
|
1
|
+
{"version":3,"file":"Button-CVudu6dV.d.mts","names":[],"sources":["../src/components/button/Button.tsx"],"mappings":";;;UAmBiB,oBAAoB,KAAK;EACxC;EAEA;EAEA;EAEA,QAAQ;EAER;EAEA;EAEA;EAEA;;;;EAIA;EAEA;EAEA;EAEA,MAAM,UAAU;;cAGL,iBAAc;;;;;;6CAqD1B;iBAEe,SACd,YACA,SACA,SACA,OACA,MACA,WACA,WACA,UACA,UACA,UACA,MACA,SACA,OACA,QACG,SACF,8BAAW,IAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as useRipple } from "./hooks-CBijm9RA.mjs";
|
|
2
1
|
import { t as Loader } from "./loader-csj5qb99.mjs";
|
|
2
|
+
import { h as useRipple } from "./hooks-BQw3Dsve.mjs";
|
|
3
3
|
import { t as Slot } from "./slot-D8EJRq72.mjs";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import { useImperativeHandle, useRef } from "react";
|
|
@@ -208,4 +208,4 @@ function Button(t0) {
|
|
|
208
208
|
//#endregion
|
|
209
209
|
export { buttonVariants as n, Button as t };
|
|
210
210
|
|
|
211
|
-
//# sourceMappingURL=Button-
|
|
211
|
+
//# sourceMappingURL=Button-Cx5QDjg9.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button-CL7xvvey.mjs","names":["ComponentProps","RefObject","useImperativeHandle","useRef","clsx","Loader","useRipple","Slot","cva","ThemeColor","loaderColor","color","ButtonProps","Omit","withRipple","variant","size","width","loading","disabled","focusable","selected","icon","asChild","ref","HTMLButtonElement","buttonVariants","variants","clickable","true","false","small","medium","large","input","custom","scalable","fit","full","contained","light","outlined","text","ghost","defaultVariants","Button","t0","$","_c","children","className","props","t1","t10","t11","t2","t3","t4","t5","t6","t7","t8","t9","undefined","inputRef","t12","Symbol","for","current","rippleEnabled","includes","Comp","t13","t14","t15","t16","t17"],"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,SAASU,YAAYC,OAA+B;CAClD,QAAQA,OAAR;EACE,KAAK,gBACH,OAAO;EACT,KAAK,cACH,OAAO;EACT,SACE,OAAOA;CACX;AACF;AA8BA,MAAae,iBAAiBlB,IAC5B,mGACA;CACEmB,UAAU;EACRC,WAAW;GACTC,MAAM;GACNC,OAAO;EACT;EACAd,MAAM;GACJe,OAAO;GACPC,QAAQ;GACRC,OAAO;GACPC,OAAO;GACPC,QAAQ;GACRC,UAAU;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A,QAAA1B,YAAA0B,EAAA,QAAAyB,OAAAzB,EAAA,QAAA0B,OAAA1B,EAAA,QAAA2B,OAAA3B,EAAA,QAAA4B,OAAA5B,EAAA,QAAAhC,SAAA;EApCH6D,MAAA,oBAAC,MAAD;GACY,UAAAJ;GACL,MAAA;GACAR,KAAAA;GACM,WAAAS;GAUC9D,cAAAA;GACEI,gBAAAA;GACAM,gBAAAA;GACd,0BAAA;GACWH,aAAAA;GAAO,GACbwD;GAA4B,GAC7BvB;aAEHwB;EAtBE,CAAA;EAqCE5B,EAAA,MAAAwB;EAAAxB,EAAA,MAAApC;EAAAoC,EAAA,MAAA7B;EAAA6B,EAAA,MAAAI;EAAAJ,EAAA,MAAA1B;EAAA0B,EAAA,MAAAyB;EAAAzB,EAAA,MAAA0B;EAAA1B,EAAA,MAAA2B;EAAA3B,EAAA,MAAA4B;EAAA5B,EAAA,MAAAhC;EAAAgC,EAAA,MAAA6B;CAAA,OAAAA,MAAA7B,EAAA;CAAA,OArCP6B;AAqCO"}
|
|
1
|
+
{"version":3,"file":"Button-Cx5QDjg9.mjs","names":["ComponentProps","RefObject","useImperativeHandle","useRef","clsx","Loader","useRipple","Slot","cva","ThemeColor","loaderColor","color","ButtonProps","Omit","withRipple","variant","size","width","loading","disabled","focusable","selected","icon","asChild","ref","HTMLButtonElement","buttonVariants","variants","clickable","true","false","small","medium","large","input","custom","scalable","fit","full","contained","light","outlined","text","ghost","defaultVariants","Button","t0","$","_c","children","className","props","t1","t10","t11","t2","t3","t4","t5","t6","t7","t8","t9","undefined","inputRef","t12","Symbol","for","current","rippleEnabled","includes","Comp","t13","t14","t15","t16","t17"],"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,SAASU,YAAYC,OAA+B;CAClD,QAAQA,OAAR;EACE,KAAK,gBACH,OAAO;EACT,KAAK,cACH,OAAO;EACT,SACE,OAAOA;CACX;AACF;AA8BA,MAAae,iBAAiBlB,IAC5B,mGACA;CACEmB,UAAU;EACRC,WAAW;GACTC,MAAM;GACNC,OAAO;EACT;EACAd,MAAM;GACJe,OAAO;GACPC,QAAQ;GACRC,OAAO;GACPC,OAAO;GACPC,QAAQ;GACRC,UAAU;EACZ;EACAd,MAAM;GACJO,MAAM;GACNC,OAAO;GACPK,QAAQ;EACV;EACAlB,OAAO;GACLoB,KAAK;GACLC,MAAM;GACNH,QAAQ;EACV;EACApB,SAAS;;;;;;;;;GASPwB,WACE;GACFC,OACE;GACFC,UACE;GACFC,MAAM;GACNC,OAAO;EACT;CACF;CACAC,iBAAiB;EACf5B,MAAM;EACNM,MAAM;EACNP,SAAS;EACTa,WAAW;EACXX,OAAO;CACT;AACF,CACF;AAEA,SAAO4B,OAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAA3B;CAAA,IAAA4B;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAf,EAAA,OAAAD,IAAA;EAAgB,CAAA,CAAAhC,YAAAsC,IAAArC,SAAAwC,IAAArC,SAAAsC,IAAA7C,OAAA8C,IAAAzC,MAAA0C,IAAAtC,WAAAuC,IAAAT,WAAA/B,UA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t as Slot } from "./slot-D8EJRq72.mjs";
|
|
3
|
+
import { n as useTranslate } from "./i18n-B57GZqP3.mjs";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { useId } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/fields/field/Field.tsx
|
|
8
|
+
function Field(t0) {
|
|
9
|
+
const $ = c(48);
|
|
10
|
+
const { label, hint, description, footerDescription, errors: rawErrors, warning, id: providedId, children, group: t1, preventLayerShift: t2, "data-testid": dataTestId, className } = t0;
|
|
11
|
+
const group = t1 === void 0 ? false : t1;
|
|
12
|
+
const preventLayerShift = t2 === void 0 ? true : t2;
|
|
13
|
+
const translate = useTranslate();
|
|
14
|
+
let t3;
|
|
15
|
+
if ($[0] !== rawErrors || $[1] !== translate) {
|
|
16
|
+
t3 = isArrayOfString(rawErrors) && translate ? rawErrors.map((k) => translate(k)).join(", ") : rawErrors;
|
|
17
|
+
$[0] = rawErrors;
|
|
18
|
+
$[1] = translate;
|
|
19
|
+
$[2] = t3;
|
|
20
|
+
} else t3 = $[2];
|
|
21
|
+
const errors = t3;
|
|
22
|
+
const internalId = useId();
|
|
23
|
+
const id = providedId ?? internalId;
|
|
24
|
+
let t4;
|
|
25
|
+
if ($[3] !== label) {
|
|
26
|
+
t4 = label && /* @__PURE__ */ jsx("span", { children: label });
|
|
27
|
+
$[3] = label;
|
|
28
|
+
$[4] = t4;
|
|
29
|
+
} else t4 = $[4];
|
|
30
|
+
const labelElement = t4;
|
|
31
|
+
let t5;
|
|
32
|
+
if ($[5] !== hint) {
|
|
33
|
+
t5 = hint && /* @__PURE__ */ jsx("span", {
|
|
34
|
+
className: "text-body-sm text-gray-6",
|
|
35
|
+
children: hint
|
|
36
|
+
});
|
|
37
|
+
$[5] = hint;
|
|
38
|
+
$[6] = t5;
|
|
39
|
+
} else t5 = $[6];
|
|
40
|
+
const hintElement = t5;
|
|
41
|
+
let t6;
|
|
42
|
+
if ($[7] !== dataTestId || $[8] !== errors) {
|
|
43
|
+
t6 = errors && typeof errors !== "boolean" && /* @__PURE__ */ jsxs("span", {
|
|
44
|
+
className: "text-red-4 dark:text-red-2 font-medium",
|
|
45
|
+
"aria-live": "polite",
|
|
46
|
+
role: "status",
|
|
47
|
+
"data-testid": dataTestId ? `input-field/alert/${dataTestId}` : void 0,
|
|
48
|
+
children: [/* @__PURE__ */ jsx("i", { className: "fe-circle-exclamation" }), /* @__PURE__ */ jsx("span", { children: errors })]
|
|
49
|
+
});
|
|
50
|
+
$[7] = dataTestId;
|
|
51
|
+
$[8] = errors;
|
|
52
|
+
$[9] = t6;
|
|
53
|
+
} else t6 = $[9];
|
|
54
|
+
const errorsElement = t6;
|
|
55
|
+
let t7;
|
|
56
|
+
if ($[10] !== dataTestId || $[11] !== warning) {
|
|
57
|
+
t7 = warning && typeof warning !== "boolean" && /* @__PURE__ */ jsxs("span", {
|
|
58
|
+
className: "text-orange-4 dark:text-orange-2 font-medium",
|
|
59
|
+
"aria-live": "polite",
|
|
60
|
+
role: "status",
|
|
61
|
+
children: [/* @__PURE__ */ jsx("i", { className: "fe-circle-exclamation" }), /* @__PURE__ */ jsx("span", {
|
|
62
|
+
"data-testid": dataTestId ? `input-field/warning/${dataTestId}` : void 0,
|
|
63
|
+
children: warning
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
66
|
+
$[10] = dataTestId;
|
|
67
|
+
$[11] = warning;
|
|
68
|
+
$[12] = t7;
|
|
69
|
+
} else t7 = $[12];
|
|
70
|
+
const warningElement = t7;
|
|
71
|
+
const color = errors ? "red" : warning ? "orange" : "yellow";
|
|
72
|
+
const showLabel = preventLayerShift || label || hint;
|
|
73
|
+
const showFooter = preventLayerShift || errorsElement || warningElement;
|
|
74
|
+
let t8;
|
|
75
|
+
if ($[13] !== dataTestId) {
|
|
76
|
+
t8 = dataTestId ? { "data-testid": `input-field-${dataTestId}` } : {};
|
|
77
|
+
$[13] = dataTestId;
|
|
78
|
+
$[14] = t8;
|
|
79
|
+
} else t8 = $[14];
|
|
80
|
+
const testIdProp = t8;
|
|
81
|
+
let t9;
|
|
82
|
+
if ($[15] !== group || $[16] !== id || $[17] !== showLabel) {
|
|
83
|
+
t9 = group && showLabel ? { "aria-labelledby": id } : {};
|
|
84
|
+
$[15] = group;
|
|
85
|
+
$[16] = id;
|
|
86
|
+
$[17] = showLabel;
|
|
87
|
+
$[18] = t9;
|
|
88
|
+
} else t9 = $[18];
|
|
89
|
+
const groupLabelProps = t9;
|
|
90
|
+
let t10;
|
|
91
|
+
if ($[19] !== group || $[20] !== hint || $[21] !== hintElement || $[22] !== id || $[23] !== label || $[24] !== labelElement || $[25] !== showLabel) {
|
|
92
|
+
t10 = showLabel && (label || hint ? /* @__PURE__ */ jsxs("label", {
|
|
93
|
+
id: group ? id : void 0,
|
|
94
|
+
htmlFor: group ? void 0 : id,
|
|
95
|
+
className: "mb-1 flex flex-wrap items-center justify-between",
|
|
96
|
+
children: [labelElement, hintElement]
|
|
97
|
+
}) : /* @__PURE__ */ jsx("label", {
|
|
98
|
+
id: group ? id : void 0,
|
|
99
|
+
htmlFor: group ? void 0 : id,
|
|
100
|
+
className: "invisible"
|
|
101
|
+
}));
|
|
102
|
+
$[19] = group;
|
|
103
|
+
$[20] = hint;
|
|
104
|
+
$[21] = hintElement;
|
|
105
|
+
$[22] = id;
|
|
106
|
+
$[23] = label;
|
|
107
|
+
$[24] = labelElement;
|
|
108
|
+
$[25] = showLabel;
|
|
109
|
+
$[26] = t10;
|
|
110
|
+
} else t10 = $[26];
|
|
111
|
+
let t11;
|
|
112
|
+
if ($[27] !== description) {
|
|
113
|
+
t11 = description && /* @__PURE__ */ jsx("div", {
|
|
114
|
+
className: "text-body-sm text-gray-6 mb-2",
|
|
115
|
+
children: description
|
|
116
|
+
});
|
|
117
|
+
$[27] = description;
|
|
118
|
+
$[28] = t11;
|
|
119
|
+
} else t11 = $[28];
|
|
120
|
+
const t12 = group ? void 0 : id;
|
|
121
|
+
let t13;
|
|
122
|
+
if ($[29] !== children || $[30] !== color || $[31] !== t12) {
|
|
123
|
+
t13 = /* @__PURE__ */ jsx(Slot, {
|
|
124
|
+
id: t12,
|
|
125
|
+
color,
|
|
126
|
+
children
|
|
127
|
+
});
|
|
128
|
+
$[29] = children;
|
|
129
|
+
$[30] = color;
|
|
130
|
+
$[31] = t12;
|
|
131
|
+
$[32] = t13;
|
|
132
|
+
} else t13 = $[32];
|
|
133
|
+
let t14;
|
|
134
|
+
if ($[33] !== errorsElement || $[34] !== showFooter || $[35] !== warningElement) {
|
|
135
|
+
t14 = showFooter && /* @__PURE__ */ jsx("div", {
|
|
136
|
+
className: "text-body-sm text-gray-6 mt-1 min-h-5",
|
|
137
|
+
children: errorsElement || warningElement
|
|
138
|
+
});
|
|
139
|
+
$[33] = errorsElement;
|
|
140
|
+
$[34] = showFooter;
|
|
141
|
+
$[35] = warningElement;
|
|
142
|
+
$[36] = t14;
|
|
143
|
+
} else t14 = $[36];
|
|
144
|
+
let t15;
|
|
145
|
+
if ($[37] !== footerDescription) {
|
|
146
|
+
t15 = footerDescription && /* @__PURE__ */ jsx("div", {
|
|
147
|
+
className: "text-body-sm text-gray-6 mb-2",
|
|
148
|
+
children: footerDescription
|
|
149
|
+
});
|
|
150
|
+
$[37] = footerDescription;
|
|
151
|
+
$[38] = t15;
|
|
152
|
+
} else t15 = $[38];
|
|
153
|
+
let t16;
|
|
154
|
+
if ($[39] !== className || $[40] !== groupLabelProps || $[41] !== t10 || $[42] !== t11 || $[43] !== t13 || $[44] !== t14 || $[45] !== t15 || $[46] !== testIdProp) {
|
|
155
|
+
t16 = /* @__PURE__ */ jsxs("div", {
|
|
156
|
+
role: "group",
|
|
157
|
+
className,
|
|
158
|
+
...testIdProp,
|
|
159
|
+
...groupLabelProps,
|
|
160
|
+
children: [
|
|
161
|
+
t10,
|
|
162
|
+
t11,
|
|
163
|
+
t13,
|
|
164
|
+
t14,
|
|
165
|
+
t15
|
|
166
|
+
]
|
|
167
|
+
});
|
|
168
|
+
$[39] = className;
|
|
169
|
+
$[40] = groupLabelProps;
|
|
170
|
+
$[41] = t10;
|
|
171
|
+
$[42] = t11;
|
|
172
|
+
$[43] = t13;
|
|
173
|
+
$[44] = t14;
|
|
174
|
+
$[45] = t15;
|
|
175
|
+
$[46] = testIdProp;
|
|
176
|
+
$[47] = t16;
|
|
177
|
+
} else t16 = $[47];
|
|
178
|
+
return t16;
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
181
|
+
export { Field as t };
|
|
182
|
+
|
|
183
|
+
//# sourceMappingURL=Field-DZmC5a1D.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field-DZmC5a1D.mjs","names":["ReactNode","useId","ThemeColor","isArrayOfString","Slot","useTranslate","FieldProps","label","hint","description","footerDescription","errors","warning","children","id","group","preventLayerShift","className","Field","t0","$","_c","rawErrors","providedId","t1","t2","dataTestId","undefined","translate","t3","map","k","join","internalId","t4","labelElement","t5","hintElement","t6","errorsElement","t7","warningElement","color","showLabel","showFooter","t8","testIdProp","t9","groupLabelProps","t10","t11","t12","t13","t14","t15","t16"],"sources":["../src/components/fields/field/Field.tsx"],"sourcesContent":["import { ReactNode, useId } from \"react\";\nimport { type ThemeColor } from \"../../../types\";\nimport { isArrayOfString } from \"../../../lib/arrUtil\";\nimport { Slot } from \"../../slot\";\nimport { useTranslate } from \"../../i18n\";\n\nexport interface FieldProps {\n label?: ReactNode;\n hint?: ReactNode;\n description?: ReactNode;\n footerDescription?: ReactNode;\n errors?: ReactNode | boolean;\n warning?: ReactNode | boolean;\n children: ReactNode;\n id?: string;\n /**\n * Set when children renders multiple controls (checkboxes, radios, digit inputs)\n * instead of a single labelable element: the label gets its own id and the\n * group is associated via aria-labelledby instead of label[for], since a single\n * htmlFor/id pair can't target one control among several.\n */\n group?: boolean;\n preventLayerShift?: boolean;\n \"data-testid\"?: string;\n className?: string;\n}\n\nexport function Field({\n label,\n hint,\n description,\n footerDescription,\n errors: rawErrors,\n warning,\n id: providedId,\n children,\n group = false,\n preventLayerShift = true,\n \"data-testid\": dataTestId,\n className,\n}: FieldProps) {\n const translate = useTranslate();\n const errors =\n isArrayOfString(rawErrors) && translate\n ? rawErrors.map((k) => translate(k)).join(\", \")\n : rawErrors;\n const internalId = useId();\n const id = providedId ?? internalId;\n\n const labelElement = label && <span>{label}</span>;\n const hintElement = hint && <span className=\"text-body-sm text-gray-6\">{hint}</span>;\n const errorsElement = errors && typeof errors !== \"boolean\" && (\n <span\n className=\"text-red-4 dark:text-red-2 font-medium\"\n aria-live=\"polite\"\n role=\"status\"\n data-testid={dataTestId ? `input-field/alert/${dataTestId}` : undefined}\n >\n <i className=\"fe-circle-exclamation\"></i>\n <span>{errors}</span>\n </span>\n );\n const warningElement = warning && typeof warning !== \"boolean\" && (\n <span className=\"text-orange-4 dark:text-orange-2 font-medium\" aria-live=\"polite\" role=\"status\">\n <i className=\"fe-circle-exclamation\"></i>\n <span data-testid={dataTestId ? `input-field/warning/${dataTestId}` : undefined}>\n {warning}\n </span>\n </span>\n );\n\n const color: ThemeColor = errors ? \"red\" : warning ? \"orange\" : \"yellow\";\n\n const showLabel = preventLayerShift || label || hint;\n const showFooter = preventLayerShift || errorsElement || warningElement;\n\n const testIdProp = dataTestId ? { \"data-testid\": `input-field-${dataTestId}` } : {};\n const groupLabelProps = group && showLabel ? { \"aria-labelledby\": id } : {};\n\n return (\n <div role=\"group\" className={className} {...testIdProp} {...groupLabelProps}>\n {showLabel &&\n (label || hint ? (\n <label\n id={group ? id : undefined}\n htmlFor={group ? undefined : id}\n className=\"mb-1 flex flex-wrap items-center justify-between\"\n >\n {labelElement}\n {hintElement}\n </label>\n ) : (\n <label\n id={group ? id : undefined}\n htmlFor={group ? undefined : id}\n className=\"invisible\"\n ></label>\n ))}\n {description && <div className=\"text-body-sm text-gray-6 mb-2\">{description}</div>}\n <Slot id={group ? undefined : id} color={color}>\n {children}\n </Slot>\n {showFooter && (\n <div className=\"text-body-sm text-gray-6 mt-1 min-h-5\">\n {errorsElement || warningElement}\n </div>\n )}\n {footerDescription && (\n <div className=\"text-body-sm text-gray-6 mb-2\">{footerDescription}</div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AA2BA,SAAOkB,MAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAe,MAAA,EAAAd,OAAAC,MAAAC,aAAAC,mBAAAC,QAAAW,WAAAV,SAAAE,IAAAS,YAAAV,UAAAE,OAAAS,IAAAR,mBAAAS,IAAA,eAAAC,YAAAT,cAAAE;CASpB,MAAAJ,QAAAS,OAAAG,KAAAA,IAAA,QAAAH;CACA,MAAAR,oBAAAS,OAAAE,KAAAA,IAAA,OAAAF;CAIA,MAAAG,YAAkBvB,aAAa;CAAE,IAAAwB;CAAA,IAAAT,EAAA,OAAAE,aAAAF,EAAA,OAAAQ,WAAA;EAE/BC,KAAA1B,gBAAgBmB,SAAsB,KAAtCM,YACIN,UAASQ,KAAKC,MAAOH,UAAUG,CAAC,CAAC,CAAC,CAAAC,KAAM,IAChC,IAFZV;EAEaF,EAAA,KAAAE;EAAAF,EAAA,KAAAQ;EAAAR,EAAA,KAAAS;CAAA,OAAAA,KAAAT,EAAA;CAHf,MAAAT,SACEkB;CAGF,MAAAI,aAAmBhC,MAAM;CACzB,MAAAa,KAAWS,cAAAU;CAAyB,IAAAC;CAAA,IAAAd,EAAA,OAAAb,OAAA;EAEf2B,KAAA3B,SAAS,oBAAA,QAAA,EAAA,UAAOA,MAAa,CAAA;EAAAa,EAAA,KAAAb;EAAAa,EAAA,KAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAlD,MAAAe,eAAqBD;CAA8B,IAAAE;CAAA,IAAAhB,EAAA,OAAAZ,MAAA;EAC/B4B,KAAA5B,QAAQ,oBAAA,QAAA;GAAgB,WAAA;GAA4BA,UAAAA;EAAY,CAAA;EAAAY,EAAA,KAAAZ;EAAAY,EAAA,KAAAgB;CAAA,OAAAA,KAAAhB,EAAA;CAAp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AAA,MAAAmC;CAAA,OAAAA,MAAAnC,EAAA;CAAA,OA9BNmC;AA8BM"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/components/fields/field/Field.d.ts
|
|
3
|
+
interface FieldProps {
|
|
4
|
+
label?: ReactNode;
|
|
5
|
+
hint?: ReactNode;
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
footerDescription?: ReactNode;
|
|
8
|
+
errors?: ReactNode | boolean;
|
|
9
|
+
warning?: ReactNode | boolean;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
id?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Set when children renders multiple controls (checkboxes, radios, digit inputs)
|
|
14
|
+
* instead of a single labelable element: the label gets its own id and the
|
|
15
|
+
* group is associated via aria-labelledby instead of label[for], since a single
|
|
16
|
+
* htmlFor/id pair can't target one control among several.
|
|
17
|
+
*/
|
|
18
|
+
group?: boolean;
|
|
19
|
+
preventLayerShift?: boolean;
|
|
20
|
+
"data-testid"?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
declare function Field({ label, hint, description, footerDescription, errors: rawErrors, warning, id: providedId, children, group, preventLayerShift, "data-testid": dataTestId, className }: FieldProps): import("react").JSX.Element;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { FieldProps as n, Field as t };
|
|
26
|
+
//# sourceMappingURL=Field-DhaPMGcl.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field-DhaPMGcl.d.mts","names":[],"sources":["../src/components/fields/field/Field.tsx"],"mappings":";;UAMiB;EACf,QAAQ;EACR,OAAO;EACP,cAAc;EACd,oBAAoB;EACpB,SAAS;EACT,UAAU;EACV,UAAU;EACV;;;;;;;EAOA;EACA;EACA;EACA;;iBAGc,QACd,OACA,MACA,aACA,mBACA,QAAQ,WACR,SACA,IAAI,YACJ,UACA,OACA,kCACe,YACf,aACC,6BAAU,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input-B9HNBGpq.mjs","names":["ComponentPropsWithRef","ReactNode","clsx","ThemeColor","InputProps","Omit","variant","disabled","prefix","suffix","color","size","flexibleWidth","children","inputClassName","sizeVariant","small","medium","large","custom","inputConfig","container","input","icon","Input","t0","$","_c","className","readOnly","ref","rest","t1","t2","t3","t4","t5","type","undefined","t6","t7","t8","t9","t10","t11","t12","t13","e","target","HTMLInputElement","select","t14","t15","t16","t17"],"sources":["../src/components/fields/text/Input.tsx"],"sourcesContent":["import { ComponentPropsWithRef, ReactNode } from \"react\";\nimport clsx from \"clsx\";\nimport type { ThemeColor } from \"../../../types\";\n\nexport interface InputProps extends Omit<ComponentPropsWithRef<\"input\">, \"prefix\" | \"size\"> {\n variant?: \"normal\" | \"ghost\";\n disabled?: boolean;\n prefix?: ReactNode;\n suffix?: ReactNode;\n color?: ThemeColor;\n size?: \"small\" | \"medium\" | \"large\" | \"custom\";\n flexibleWidth?: boolean;\n children?: ReactNode;\n inputClassName?: string;\n}\n\nexport const sizeVariant = {\n small: \"[--h-input:24px] h-(--h-input)\",\n medium: \"[--h-input:32px] h-(--h-input)\",\n large: \"[--h-input:48px] h-(--h-input)\",\n custom: \"\",\n};\n\nexport const inputConfig = {\n container: \"p8n-input-text rounded-full flex box-border\",\n input: \"h-full flex-1 appearance-none outline-hidden filter-none min-w-0 bg-transparent\",\n icon: \"[--h-icon:calc(var(--h-input)-2px)] h-(--h-icon) w-(--h-icon) inline-flex-center\",\n};\n\nexport function Input({\n variant = \"normal\",\n color = \"yellow\",\n disabled = false,\n prefix,\n suffix,\n className,\n inputClassName,\n readOnly,\n size = \"medium\",\n flexibleWidth = true,\n type,\n children,\n ref,\n ...rest\n}: InputProps) {\n return (\n <div\n aria-disabled={disabled}\n aria-readonly={readOnly}\n data-color={color}\n data-variant={variant}\n className={clsx(inputConfig.container, sizeVariant[size], className)}\n >\n {prefix && (\n <div\n className={clsx([\n \"flex-center relative\",\n typeof prefix === \"string\" && \"text-gray-6 mx-2 select-none\",\n ])}\n >\n {prefix}\n </div>\n )}\n <input\n type={type}\n ref={ref}\n className={clsx(\n inputConfig.input,\n size !== \"custom\" && !prefix && \"pl-4\",\n size !== \"custom\" && type !== \"date\" && type !== \"datetime-local\"\n ? !suffix && \"pr-4\"\n : \"pr-1\",\n flexibleWidth && \"w-0\",\n inputClassName,\n )}\n readOnly={readOnly}\n onClick={(e) => {\n if (readOnly) {\n (e.target as HTMLInputElement)?.select();\n }\n }}\n {...(disabled ? { disabled } : {})}\n {...rest}\n />\n {suffix && (\n <div\n className={clsx([\n \"flex-center relative\",\n typeof suffix === \"string\" && \"text-gray-6 mx-2 select-none\",\n ])}\n >\n {suffix}\n </div>\n )}\n {children}\n </div>\n );\n}\n"],"mappings":";;;;AAgBA,MAAae,cAAc;CACzBC,OAAO;CACPC,QAAQ;CACRC,OAAO;CACPC,QAAQ;AACV;AAEA,MAAaC,cAAc;CACzBC,WAAW;CACXC,OAAO;CACPC,MAAM;AACR;AAEA,SAAOC,MAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAd;CAAA,IAAAe;CAAA,IAAAd;CAAA,IAAAN;CAAA,IAAAqB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAtB;CAAA,IAAAuB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAX,EAAA,OAAAD,IAAA;EAAe,CAAA,CAAAnB,SAAA0B,IAAAtB,OAAAuB,IAAA1B,UAAA2B,IAAA1B,QAAAC,QAAAmB,WAAAd,gBAAAe,UAAAlB,MAAAwB,IAAAvB,eAAAwB,IAAAC,MAAAxB,UAAAiB,QAAAC,QAAAN;EAeTC,EAAA,KAAAD;EAAAC,EAAA,KAAAb;EAAAa,EAAA,KAAAE;EAAAF,EAAA,KAAAZ;EAAAY,EAAA,KAAAlB;EAAAkB,EAAA,KAAAG;EAAAH,EAAA,KA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ix","suffix","color","size","flexibleWidth","children","inputClassName","sizeVariant","small","medium","large","custom","inputConfig","container","input","icon","Input","t0","$","_c","className","readOnly","ref","rest","t1","t2","t3","t4","t5","type","undefined","t6","t7","t8","t9","t10","t11","t12","t13","e","target","HTMLInputElement","select","t14","t15","t16","t17"],"sources":["../src/components/fields/text/Input.tsx"],"sourcesContent":["import { ComponentPropsWithRef, ReactNode } from \"react\";\nimport clsx from \"clsx\";\nimport type { ThemeColor } from \"../../../types\";\n\nexport interface InputProps extends Omit<ComponentPropsWithRef<\"input\">, \"prefix\" | \"size\"> {\n variant?: \"normal\" | \"ghost\";\n disabled?: boolean;\n prefix?: ReactNode;\n suffix?: ReactNode;\n color?: ThemeColor;\n size?: \"small\" | \"medium\" | \"large\" | \"custom\";\n flexibleWidth?: boolean;\n children?: ReactNode;\n inputClassName?: string;\n}\n\nexport const sizeVariant = {\n small: \"[--h-input:24px] h-(--h-input)\",\n medium: \"[--h-input:32px] h-(--h-input)\",\n large: \"[--h-input:48px] h-(--h-input)\",\n custom: \"\",\n};\n\nexport const inputConfig = {\n container: \"p8n-input-text rounded-full flex box-border\",\n input: \"h-full flex-1 appearance-none outline-hidden filter-none min-w-0 bg-transparent\",\n icon: \"[--h-icon:calc(var(--h-input)-2px)] h-(--h-icon) w-(--h-icon) inline-flex-center\",\n};\n\nexport function Input({\n variant = \"normal\",\n color = \"yellow\",\n disabled = false,\n prefix,\n suffix,\n className,\n inputClassName,\n readOnly,\n size = \"medium\",\n flexibleWidth = true,\n type,\n children,\n ref,\n ...rest\n}: InputProps) {\n return (\n <div\n aria-disabled={disabled}\n aria-readonly={readOnly}\n data-color={color}\n data-variant={variant}\n className={clsx(inputConfig.container, sizeVariant[size], className)}\n >\n {prefix && (\n <div\n className={clsx([\n \"flex-center relative\",\n typeof prefix === \"string\" && \"text-gray-6 mx-2 select-none\",\n ])}\n >\n {prefix}\n </div>\n )}\n <input\n type={type}\n ref={ref}\n className={clsx(\n inputConfig.input,\n size !== \"custom\" && !prefix && \"pl-4\",\n size !== \"custom\" && type !== \"date\" && type !== \"datetime-local\"\n ? !suffix && \"pr-4\"\n : \"pr-1\",\n flexibleWidth && \"w-0\",\n inputClassName,\n )}\n readOnly={readOnly}\n onClick={(e) => {\n if (readOnly) {\n (e.target as HTMLInputElement)?.select();\n }\n }}\n {...(disabled ? { disabled } : {})}\n {...rest}\n />\n {suffix && (\n <div\n className={clsx([\n \"flex-center relative\",\n typeof suffix === \"string\" && \"text-gray-6 mx-2 select-none\",\n ])}\n >\n {suffix}\n </div>\n )}\n {children}\n </div>\n );\n}\n"],"mappings":";;;;AAgBA,MAAae,cAAc;CACzBC,OAAO;CACPC,QAAQ;CACRC,OAAO;CACPC,QAAQ;AACV;AAEA,MAAaC,cAAc;CACzBC,WAAW;CACXC,OAAO;CACPC,MAAM;AACR;AAEA,SAAOC,MAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAd;CAAA,IAAAe;CAAA,IAAAd;CAAA,IAAAN;CAAA,IAAAqB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAtB;CAAA,IAAAuB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAX,EAAA,OAAAD,IAAA;EAAe,CAAA,CAAAnB,SAAA0B,IAAAtB,OAAAuB,IAAA1B,UAAA2B,IAAA1B,QAAAC,QAAAmB,WAAAd,gBAAAe,UAAAlB,MAAAwB,IAAAvB,eAAAwB,IAAAC,MAAAxB,UAAAiB,QAAAC,QAAAN;EAeTC,EAAA,KAAAD;EAAAC,EAAA,KAAAb;EAAAa,EAAA,KAAAE;EAAAF,EAAA,KAAAZ;EAAAY,EAAA,KAAAlB;EAAAkB,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAjB;EAAAiB,EAAA,KAAAM;EAAAN,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;EAAAR,EA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A,QAAAjB,QAAA;EACD4C,MAAA5C,UACC,oBAAA,OAAA;GACa,WAAAP,KAAK,CACd,wBACA,OAAOO,WAAW,YAAlB,8BAA4D,CAC7D;GAEAA,UAAAA;EACG,CAAA;EACPiB,EAAA,MAAAjB;EAAAiB,EAAA,MAAA2B;CAAA,OAAAA,MAAA3B,EAAA;CAAA,IAAA4B;CAAA,IAAA5B,EAAA,QAAAb,YAAAa,EAAA,QAAAhB,SAAAgB,EAAA,QAAAnB,YAAAmB,EAAA,QAAAG,YAAAH,EAAA,QAAA0B,OAAA1B,EAAA,QAAA2B,OAAA3B,EAAA,QAAAc,MAAAd,EAAA,QAAAe,MAAAf,EAAA,QAAApB,SAAA;EA/CHgD,MAAA,qBAAA,OAAA;GACiB/C,iBAAAA;GACAsB,iBAAAA;GACHnB,cAAAA;GACEJ,gBAAAA;GACH,WAAAkC;GALb,UAAA;IAOGC;IAUDW;IAqBCC;IAUAxC;GACG;;EAAAa,EAAA,MAAAb;EAAAa,EAAA,MAAAhB;EAAAgB,EAAA,MAAAnB;EAAAmB,EAAA,MAAAG;EAAAH,EAAA,MAAA0B;EAAA1B,EAAA,MAAA2B;EAAA3B,EAAA,MAAAc;EAAAd,EAAA,MAAAe;EAAAf,EAAA,MAAApB;EAAAoB,EAAA,MAAA4B;CAAA,OAAAA,MAAA5B,EAAA;CAAA,OAjDN4B;AAiDM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scroll-BSL6d8Ob.mjs","names":["ComponentPropsWithoutRef","useEffect","useRef","useState","clsx","TOLERANCE","Props","horizontal","scrollVariants","vertical","inner","shadow","shadowStart","shadowEnd","child","Scroll","t0","$","_c","children","className","rest","t1","undefined","showStartShadow","setShowStartShadow","showEndShadow","setShowEndShadow","scrollChildRef","scrollContainerRef","position","t2","container","containerRect","getBoundingClientRect","childRect","isOnStartEdge","left","top","isOnEndEdge","right","bottom","previousShowStartShadow","previousShowEndShadow","setShadows","t3","resizeObserver","ResizeObserver","current","observe","disconnect","t4","handleScroll","event","currentTarget","t5","t6","t7","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","t19","t20"],"sources":["../src/components/scroll/Scroll.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, useEffect, useRef, useState } from \"react\";\nimport clsx from \"clsx\";\n\nconst TOLERANCE = 5;\n\ninterface Props extends ComponentPropsWithoutRef<\"div\"> {\n horizontal?: boolean;\n}\n\nexport const scrollVariants = {\n vertical: {\n inner: \"overflow-y-auto h-full\",\n shadow: \"h-1 left-0 right-0\",\n shadowStart: \"top-0 bg-linear-to-b from-gray-8/10\",\n shadowEnd: \"bottom-0 bg-linear-to-t from-gray-8/10\",\n child: \"\",\n },\n horizontal: {\n inner: \"overflow-x-auto\",\n shadow: \"w-1 top-0 bottom-0\",\n shadowStart: \"left-0 bg-linear-to-r from-gray-8/10\",\n shadowEnd: \"right-0 bg-linear-to-l from-gray-8/10\",\n child: \"inline-block\",\n },\n};\n\nexport function Scroll({ horizontal = false, className, children, ...rest }: Props) {\n const [showStartShadow, setShowStartShadow] = useState(false);\n const [showEndShadow, setShowEndShadow] = useState(false);\n const scrollChildRef = useRef<HTMLDivElement>(null);\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n\n const position = horizontal ? \"horizontal\" : \"vertical\";\n\n const setShadows = (container: HTMLDivElement | null, child: HTMLDivElement | null) => {\n if (!container || !child) {\n return;\n }\n\n const containerRect = container.getBoundingClientRect();\n\n const childRect = child.getBoundingClientRect();\n\n const isOnStartEdge = horizontal\n ? containerRect.left - childRect.left < TOLERANCE\n : containerRect.top - childRect.top < TOLERANCE;\n\n const isOnEndEdge = horizontal\n ? childRect.right - containerRect.right < TOLERANCE\n : childRect.bottom - containerRect.bottom < TOLERANCE;\n\n setShowStartShadow((previousShowStartShadow) =>\n isOnStartEdge === previousShowStartShadow\n ? !previousShowStartShadow\n : previousShowStartShadow,\n );\n\n setShowEndShadow((previousShowEndShadow) =>\n isOnEndEdge === previousShowEndShadow ? !previousShowEndShadow : previousShowEndShadow,\n );\n };\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver(() => {\n setShadows(scrollContainerRef.current, scrollChildRef.current);\n });\n resizeObserver.observe(scrollChildRef.current!);\n resizeObserver.observe(scrollContainerRef.current!);\n\n return () => {\n resizeObserver.disconnect();\n };\n });\n\n function handleScroll(event: React.UIEvent<HTMLDivElement, UIEvent>) {\n if (!scrollChildRef?.current) {\n return;\n }\n setShadows(event.currentTarget, scrollChildRef.current);\n }\n\n return (\n <div className={clsx(\"ll-scroll-zone\", \"relative\", className)} {...rest}>\n <div\n className={clsx(\n \"scroll-shadow-sm absolute z-1 opacity-0 transition-all\",\n scrollVariants[position].shadow,\n scrollVariants[position].shadowStart,\n showStartShadow && \"opacity-100\",\n )}\n ></div>\n <div\n className={clsx(\n \"scroll-shadow-sm absolute z-1 opacity-0 transition-all\",\n scrollVariants[position].shadow,\n scrollVariants[position].shadowEnd,\n showEndShadow && \"opacity-100\",\n )}\n ></div>\n <div\n className={scrollVariants[position].inner}\n ref={scrollContainerRef}\n onScroll={handleScroll}\n >\n <div className={scrollVariants[position].child} ref={scrollChildRef}>\n {children}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AAGA,MAAMK,YAAY;AAMlB,MAAaG,iBAAiB;CAC5BC,UAAU;EACRC,OAAO;EACPC,QAAQ;EACRC,aAAa;EACbC,WAAW;EACXC,OAAO;CACT;CACAP,YAAY;EACVG,OAAO;EACPC,QAAQ;EACRC,aAAa;EACbC,WAAW;EACXC,OAAO;CACT;AACF;AAEA,SAAOC,OAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAL,EAAA,OAAAD,IAAA;EAAgB,CAAA,CAAAT,YAAAe,IAAAF,WAAAD,aAAAE,QAAAL;EAA2DC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;E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eAAesB;CACf,MAAAiC,MAAArC,iBAAA;CAA8B,IAAAsC;CAAA,IAAA/C,EAAA,QAAA4C,IAAAlD,UAAAM,EAAA,QAAA6C,IAAAjD,aAAAI,EAAA,QAAA8C,KAAA;EAJrBC,MAAA5D,KACT,0DACAyD,IAAwBlD,QACxBmD,IAAwBjD,WACxBkD,GACF;EAAC9C,EAAA,MAAA4C,IAAAlD;EAAAM,EAAA,MAAA6C,IAAAjD;EAAAI,EAAA,MAAA8C;EAAA9C,EAAA,MAAA+C;CAAA,OAAAA,MAAA/C,EAAA;CAAA,IAAAgD;CAAA,IAAAhD,EAAA,QAAA+C,KAAA;EANHC,MAAA,oBAAA,OAAA,EACa,WAAAD,IAKV,CAAA;EACI/C,EAAA,MAAA+C;EAAA/C,EAAA,MAAAgD;CAAA,OAAAA,MAAAhD,EAAA;CAEM,MAAAiD,MAAA1D,eAAesB;CAIV,MAAAqC,MAAA3D,eAAesB;CAAS,IAAAsC;CAAA,IAAAnD,EAAA,QAAAE,YAAAF,EAAA,QAAAkD,IAAArD,OAAA;EAAxCsD,MAAA,oBAAA,OAAA;GAAgB,WAAAD,IAAwBrD;GAAac,KAAAA;GAClDT;EACG,CAAA;EAAAF,EAAA,MAAAE;EAAAF,EAAA,MAAAkD,IAAArD;EAAAG,EAAA,MAAAmD;CAAA,OAAAA,MAAAnD,EAAA;CAAA,IAAAoD;CAAA,IAAApD,EAAA,QAAAmC,gBAAAnC,EAAA,QAAAiD,IAAAxD,SAAAO,EAAA,QAAAmD,KAAA;EAPRC,MAAA,oBAAA,OAAA;GACa,WAAAH,IAAwBxD;GAC9BmB,KAAAA;GACKuB,UAAAA;
|
|
1
|
+
{"version":3,"file":"Scroll-BSL6d8Ob.mjs","names":["ComponentPropsWithoutRef","useEffect","useRef","useState","clsx","TOLERANCE","Props","horizontal","scrollVariants","vertical","inner","shadow","shadowStart","shadowEnd","child","Scroll","t0","$","_c","children","className","rest","t1","undefined","showStartShadow","setShowStartShadow","showEndShadow","setShowEndShadow","scrollChildRef","scrollContainerRef","position","t2","container","containerRect","getBoundingClientRect","childRect","isOnStartEdge","left","top","isOnEndEdge","right","bottom","previousShowStartShadow","previousShowEndShadow","setShadows","t3","resizeObserver","ResizeObserver","current","observe","disconnect","t4","handleScroll","event","currentTarget","t5","t6","t7","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","t19","t20"],"sources":["../src/components/scroll/Scroll.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, useEffect, useRef, useState } from \"react\";\nimport clsx from \"clsx\";\n\nconst TOLERANCE = 5;\n\ninterface Props extends ComponentPropsWithoutRef<\"div\"> {\n horizontal?: boolean;\n}\n\nexport const scrollVariants = {\n vertical: {\n inner: \"overflow-y-auto h-full\",\n shadow: \"h-1 left-0 right-0\",\n shadowStart: \"top-0 bg-linear-to-b from-gray-8/10\",\n shadowEnd: \"bottom-0 bg-linear-to-t from-gray-8/10\",\n child: \"\",\n },\n horizontal: {\n inner: \"overflow-x-auto\",\n shadow: \"w-1 top-0 bottom-0\",\n shadowStart: \"left-0 bg-linear-to-r from-gray-8/10\",\n shadowEnd: \"right-0 bg-linear-to-l from-gray-8/10\",\n child: \"inline-block\",\n },\n};\n\nexport function Scroll({ horizontal = false, className, children, ...rest }: Props) {\n const [showStartShadow, setShowStartShadow] = useState(false);\n const [showEndShadow, setShowEndShadow] = useState(false);\n const scrollChildRef = useRef<HTMLDivElement>(null);\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n\n const position = horizontal ? \"horizontal\" : \"vertical\";\n\n const setShadows = (container: HTMLDivElement | null, child: HTMLDivElement | null) => {\n if (!container || !child) {\n return;\n }\n\n const containerRect = container.getBoundingClientRect();\n\n const childRect = child.getBoundingClientRect();\n\n const isOnStartEdge = horizontal\n ? containerRect.left - childRect.left < TOLERANCE\n : containerRect.top - childRect.top < TOLERANCE;\n\n const isOnEndEdge = horizontal\n ? childRect.right - containerRect.right < TOLERANCE\n : childRect.bottom - containerRect.bottom < TOLERANCE;\n\n setShowStartShadow((previousShowStartShadow) =>\n isOnStartEdge === previousShowStartShadow\n ? !previousShowStartShadow\n : previousShowStartShadow,\n );\n\n setShowEndShadow((previousShowEndShadow) =>\n isOnEndEdge === previousShowEndShadow ? !previousShowEndShadow : previousShowEndShadow,\n );\n };\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver(() => {\n setShadows(scrollContainerRef.current, scrollChildRef.current);\n });\n resizeObserver.observe(scrollChildRef.current!);\n resizeObserver.observe(scrollContainerRef.current!);\n\n return () => {\n resizeObserver.disconnect();\n };\n });\n\n function handleScroll(event: React.UIEvent<HTMLDivElement, UIEvent>) {\n if (!scrollChildRef?.current) {\n return;\n }\n setShadows(event.currentTarget, scrollChildRef.current);\n }\n\n return (\n <div className={clsx(\"ll-scroll-zone\", \"relative\", className)} {...rest}>\n <div\n className={clsx(\n \"scroll-shadow-sm absolute z-1 opacity-0 transition-all\",\n scrollVariants[position].shadow,\n scrollVariants[position].shadowStart,\n showStartShadow && \"opacity-100\",\n )}\n ></div>\n <div\n className={clsx(\n \"scroll-shadow-sm absolute z-1 opacity-0 transition-all\",\n scrollVariants[position].shadow,\n scrollVariants[position].shadowEnd,\n showEndShadow && \"opacity-100\",\n )}\n ></div>\n <div\n className={scrollVariants[position].inner}\n ref={scrollContainerRef}\n onScroll={handleScroll}\n >\n <div className={scrollVariants[position].child} ref={scrollChildRef}>\n {children}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AAGA,MAAMK,YAAY;AAMlB,MAAaG,iBAAiB;CAC5BC,UAAU;EACRC,OAAO;EACPC,QAAQ;EACRC,aAAa;EACbC,WAAW;EACXC,OAAO;CACT;CACAP,YAAY;EACVG,OAAO;EACPC,QAAQ;EACRC,aAAa;EACbC,WAAW;EACXC,OAAO;CACT;AACF;AAEA,SAAOC,OAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,I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,MAAAiD,IAAAxD;EAAAO,EAAA,MAAAmD;EAAAnD,EAAA,MAAAoD;CAAA,OAAAA,MAAApD,EAAA;CAAA,IAAAqD;CAAA,IAAArD,EAAA,QAAAI,QAAAJ,EAAA,QAAA2C,OAAA3C,EAAA,QAAAgD,OAAAhD,EAAA,QAAAoD,OAAApD,EAAA,QAAAsC,IAAA;EAzBRe,MAAA,qBAAA,OAAA;GAAgB,WAAAf;GAA6C,GAAMlC;GAAnE,UAAA;IACEuC;IAQAK;IAQAI;GASI;;EAAApD,EAAA,MAAAI;EAAAJ,EAAA,MAAA2C;EAAA3C,EAAA,MAAAgD;EAAAhD,EAAA,MAAAoD;EAAApD,EAAA,MAAAsC;EAAAtC,EAAA,MAAAqD;CAAA,OAAAA,MAAArD,EAAA;CAAA,OA1BNqD;AA0BM"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { f as useEffectEvent } from "./hooks-CBijm9RA.mjs";
|
|
2
1
|
import { t as Loader } from "./loader-csj5qb99.mjs";
|
|
3
|
-
import { t as Button } from "./Button-
|
|
4
|
-
import "./button-
|
|
2
|
+
import { t as Button } from "./Button-Cx5QDjg9.mjs";
|
|
3
|
+
import "./button-CuqQ_n9M.mjs";
|
|
5
4
|
import { t as Dialog } from "./Dialog-DeQv8OeS.mjs";
|
|
6
5
|
import "./components/dialog/index.mjs";
|
|
7
6
|
import { c } from "react/compiler-runtime";
|
|
@@ -18,18 +17,17 @@ function Snack(t0) {
|
|
|
18
17
|
const withLoader = t4 === void 0 ? false : t4;
|
|
19
18
|
const canClose = t5 === void 0 ? false : t5;
|
|
20
19
|
const onRemove = t6 === void 0 ? _temp : t6;
|
|
21
|
-
const onRemoveStable = useEffectEvent(onRemove);
|
|
22
20
|
let t7;
|
|
23
21
|
let t8;
|
|
24
|
-
if ($[0] !== expiration || $[1] !==
|
|
22
|
+
if ($[0] !== expiration || $[1] !== onRemove) {
|
|
25
23
|
t7 = () => {
|
|
26
24
|
if (expiration === -1) return;
|
|
27
|
-
const timeoutId = setTimeout(() =>
|
|
25
|
+
const timeoutId = setTimeout(() => onRemove(), expiration);
|
|
28
26
|
return () => void clearTimeout(timeoutId);
|
|
29
27
|
};
|
|
30
|
-
t8 = [
|
|
28
|
+
t8 = [onRemove, expiration];
|
|
31
29
|
$[0] = expiration;
|
|
32
|
-
$[1] =
|
|
30
|
+
$[1] = onRemove;
|
|
33
31
|
$[2] = t7;
|
|
34
32
|
$[3] = t8;
|
|
35
33
|
} else {
|
|
@@ -109,4 +107,4 @@ function _temp() {}
|
|
|
109
107
|
//#endregion
|
|
110
108
|
export { Snack as t };
|
|
111
109
|
|
|
112
|
-
//# sourceMappingURL=Snack-
|
|
110
|
+
//# sourceMappingURL=Snack-0wCsjAOm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Snack-0wCsjAOm.mjs","names":["clsx","useEffect","Button","Dialog","Loader","Message","SnackProps","Partial","onRemove","Snack","t0","$","_c","expiration","t1","content","t2","color","t3","withLoader","t4","canClose","t5","t6","undefined","_temp","t7","t8","timeoutId","setTimeout","clearTimeout","t9","Symbol","for","t10","t11","t12","t13","t14","t15"],"sources":["../src/components/snack/Snack.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useEffect } from \"react\";\n\nimport { Button } from \"../button\";\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 useEffect(() => {\n if (expiration === -1) {\n return;\n }\n\n const timeoutId = setTimeout(() => onRemove(), expiration);\n return () => void clearTimeout(timeoutId);\n }, [onRemove, 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":";;;;;;;;;;AAYA,SAAOS,MAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAe,MAAA,EAAAC,YAAAC,IAAAC,SAAAC,IAAAC,OAAAC,IAAAC,YAAAC,IAAAC,UAAAC,IAAAd,UAAAe,OAAAb;CACpB,MAAAG,aAAAC,OAAAU,KAAAA,IAAA,MAAAV;CACA,MAAAC,UAAAC,OAAAQ,KAAAA,IAAA,KAAAR;CACA,MAAAC,QAAAC,OAAAM,KAAAA,IAAA,WAAAN;CACA,MAAAC,aAAAC,OAAAI,KAAAA,IAAA,QAAAJ;CACA,MAAAC,WAAAC,OAAAE,KAAAA,IAAA,QAAAF;CACA,MAAAd,WAAAe,OAAAC,KAAAA,IAAAC,QAAAF;CAAmB,IAAAG;CAAA,IAAAC;CAAA,IAAAhB,EAAA,OAAAE,cAAAF,EAAA,OAAAH,UAAA;EAETkB,WAAA;GACR,IAAIb,eAAe,IAAE;GAIrB,MAAAe,YAAkBC,iBAAiBrB,SAAS,GAAGK,UAAU;GAAE,aAC9C,KAAKiB,aAAaF,SAAS;EAAC;EACxCD,KAAA,CAACnB,UAAUK,UAAU;EAACF,EAAA,KAAAE;EAAAF,EAAA,KAAAH;EAAAG,EAAA,KAAAe;EAAAf,EAAA,KAAAgB;CAAA,OAAA;EAAAD,KAAAf,EAAA;EAAAgB,KAAAhB,EAAA;CAAA;CAPzBV,UAAUyB,IAOPC,EAAsB;CAAC,IAAAI;CAAA,IAAApB,EAAA,OAAAqB,OAAAC,IAAA,2BAAA,GAAA;EAIXF,KAAA/B,KAAK,mDAAmD,UAAU;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GAENI,UAAAA;EANK,CAAA;EAgBE3B,EAAA,MAAAM;EAAAN,EAAA,MAAAuB;EAAAvB,EAAA,MAAA2B;EAAA3B,EAAA,MAAA4B;CAAA,OAAAA,MAAA5B,EAAA;CAAA,OAhBT4B;AAgBS;AAlCN,SAAAd,QAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipTrigger-VrJxlxNx.mjs","names":["RefObject","useMemo","useRef","useState","TooltipOptions","arrow","autoUpdate","flip","hide","offset","shift","useDismiss","useFloating","UseFloatingReturn","useFocus","useHover","useInteractions","UseInteractionsReturn","useRole","ThemeBaseColor","arrowWidth","UseTooltipReturn","open","setOpen","color","arrowRef","HTMLDivElement","useTooltip","initialOpen","placement","controlledOpen","onOpen","setControlledOpen","openDelay","closeDelay","uncontrolledOpen","setUncontrolledOpen","isUncontrolled","undefined","offsetVal","data","onOpenChange","whileElementsMounted","middleware","padding","element","context","hover","move","enabled","delay","close","focus","dismiss","role","interactions","createContext","useContext","useTooltip","ContextType","ReturnType","TooltipContext","useTooltipContext","context","Error","ReactNode","TooltipOptions","useTooltip","TooltipContext","Props","children","Tooltip","t0","$","_c","options","tooltip","t1","ComponentProps","RefObject","useTooltipContext","FloatingPortal","useMergeRefs","clsx","computeArrowStyle","Dialog","Props","ref","HTMLDivElement","pointerEvents","TooltipContent","style","children","className","props","context","mergedRef","refs","setFloating","open","middlewareData","hide","referenceHidden","floatingStyles","getFloatingProps","placement","color","arrowRef","HTMLProps","RefObject","cloneElement","isValidElement","useTooltipContext","useMergeRefs","Props","HTMLElement","asChild","ref","TooltipTrigger","children","props","context","childrenRef","mergedRef","refs","setReference","getReferenceProps","open"],"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,MAAMoB,aAAa;AAUnB,SAAgBO,WAAW,EACzBC,cAAc,OACdC,YAAY,OACZP,MAAMQ,gBACNC,QAAQC,mBACRC,YAAY,KACZC,aAAa,KACbV,QAAQ,aACU,CAAC,GAAqB;CACxC,MAAM,CAACW,kBAAkBC,uBAAuBjC,SAASyB,WAAW;CAEpE,MAAMS,iBAAiBP,mBAAmB,QAAQA,mBAAmBQ,KAAAA;CAErE,MAAMhB,OAAOe,iBAAiBF,mBAAmBL;CACjD,MAAMP,UAAUc,iBAAiBD,sBAAsBJ;CAEvD,MAAMP,WAAWvB,OAAuB,IAAI;CAI5C,MAAMsC,OAAO5B,YAAY;EACvBiB;EACAP;EACAmB,cAAclB;EACdmB,sBAAsBpC;EACtBqC,YAAY;GACVlC,OARcW,aAAa,CAQX;GAChBb,KAAK;GACLG,MAAM,EAAEkC,SAAS,EAAE,CAAC;GACpBvC,MAAM;IACJwC,SAASpB;IACTmB,SAAS;GACX,CAAC;GACDpC,KAAK,EACHoC,SAAS,GACX,CAAC;EAAC;CAEN,CAAC;CACD,MAAM,EAAEE,YAA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GAAGK,SACK;CACR,MAAMC,UAAUf,kBAAkB;CAClC,MAAMgB,YAAYd,aAAa,CAACa,QAAQE,KAAKC,aAAaX,GAAG,CAAC;CAC9D,IAAI,CAACQ,QAAQI,MACX,OAAO;CAET,OACE,oBAAC,gBAAD,EAAA,UACE,oBAAC,OAAD;EACE,KAAKH;EACL,WAAWb,KACT,4BACAM,kBAAkB,UAAU,uBAC5BM,QAAQK,eAAeC,MAAMC,mBAAmB,WAClD;EACA,OAAO;GAAE,GAAGP,QAAQQ;GAAgB,GAAGZ;EAAM;EAC7C,GAAII,QAAQS,iBAAiBV,KAAK;YAElC,qBAAC,QAAD;GACE,WAAWC,QAAQU;GACnB,WAAWtB,KAAK,+DAA+DU,SAAS;GACxF,OAAOE,QAAQW;GACf,MAAK;aAJP,CAMGd,UACD,oBAAC,OAAD;IACE,KAAKG,QAAQY;IACb,OAAOvB,kBAAkBW,OAAO;IAChC,WAAU;GACN,CAAA,CACA;;CACL,CAAA,EACS,CAAA;AAEpB;;;AC3CA,SAAgBuB,eAAe,EAAEC,UAAUH,UAAU,OAAOC,KAAK,GAAGG,SAAgB;CAClF,MAAMC,UAAUT,kBAAkB;CAClC,MAAMU,cAAeH,SAAiBF;CACtC,MAAMM,YAAYV,aAAa;EAACQ,QAAQG,KAAKC;EAAcR;EAAKK;CAAW,CAAC;CAE5E,IAAIN,WAAWL,eAAeQ,QAAQ,GACpC,OAAOT,aACLS,UACAE,QAAQK,kBAAkB;EACxBT,KAAKM;EACL,GAAGH;EACH,GAAID,SAASC,SAAS,CAAC;EAEvB,cAAcC,QAAQM,OAAO,SAAS;CACxC,CAAC,CACH;CAGF,OACE,oBAAC,QAAD;EAAM,KAAKJ;EAAW,GAAIF,QAAQK,kBAAkBN,KAAK;EACtDD;CACG,CAAA;AAEV"}
|
|
1
|
+
{"version":3,"file":"TooltipTrigger-VrJxlxNx.mjs","names":["RefObject","useMemo","useRef","useState","TooltipOptions","arrow","autoUpdate","flip","hide","offset","shift","useDismiss","useFloating","UseFloatingReturn","useFocus","useHover","useInteractions","UseInteractionsReturn","useRole","ThemeBaseColor","arrowWidth","UseTooltipReturn","open","setOpen","color","arrowRef","HTMLDivElement","useTooltip","initialOpen","placement","controlledOpen","onOpen","setControlledOpen","openDelay","closeDelay","uncontrolledOpen","setUncontrolledOpen","isUncontrolled","undefined","offsetVal","data","onOpenChange","whileElementsMounted","middleware","padding","element","context","hover","move","enabled","delay","close","focus","dismiss","role","interactions","createContext","useContext","useTooltip","ContextType","ReturnType","TooltipContext","useTooltipContext","context","Error","ReactNode","TooltipOptions","useTooltip","TooltipContext","Props","children","Tooltip","t0","$","_c","options","tooltip","t1","ComponentProps","RefObject","useTooltipContext","FloatingPortal","useMergeRefs","clsx","computeArrowStyle","Dialog","Props","ref","HTMLDivElement","pointerEvents","TooltipContent","style","children","className","props","context","mergedRef","refs","setFloating","open","middlewareData","hide","referenceHidden","floatingStyles","getFloatingProps","placement","color","arrowRef","HTMLProps","RefObject","cloneElement","isValidElement","useTooltipContext","useMergeRefs","Props","HTMLElement","asChild","ref","TooltipTrigger","children","props","context","childrenRef","mergedRef","refs","setReference","getReferenceProps","open"],"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,MAAMoB,aAAa;AAUnB,SAAgBO,WAAW,EACzBC,cAAc,OACdC,YAAY,OACZP,MAAMQ,gBACNC,QAAQC,mBACRC,YAAY,KACZC,aAAa,KACbV,QAAQ,aACU,CAAC,GAAqB;CACxC,MAAM,CAACW,kBAAkBC,uBAAuBjC,SAASyB,WAAW;CAEpE,MAAMS,iBAAiBP,mBAAmB,QAAQA,mBAAmBQ,KAAAA;CAErE,MAAMhB,OAAOe,iBAAiBF,mBAAmBL;CACjD,MAAMP,UAAUc,iBAAiBD,sBAAsBJ;CAEvD,MAAMP,WAAWvB,OAAuB,IAAI;CAI5C,MAAMsC,OAAO5B,YAAY;EACvBiB;EACAP;EACAmB,cAAclB;EACdmB,sBAAsBpC;EACtBqC,YAAY;GACVlC,OARcW,aAAa,CAQX;GAChBb,KAAK;GACLG,MAAM,EAAEkC,SAAS,EAAE,CAAC;GACpBvC,MAAM;IACJwC,SAASpB;IACTmB,SAAS;GACX,CAAC;GACDpC,KAAK,EACHoC,SAAS,GACX,CAAC;EAAC;CAEN,CAAC;CACD,MAAM,EAAEE,YAAYN;CAgBpB,MAAMe,eAAevC,gBAAgB;EAdvBD,SAAS+B,SAAS;GAC9BE,MAAM;GACNC,SAASZ;GACTa,OAAO;IACL5B,MAAMW,aAAa;IACnBkB,OAAOjB;GACT;EACF,CAOsCa;EANxBjC,SAASgC,SAAS,EAC9BG,SAASZ,eACX,CAI6Ce;EAH7BzC,WAAWmC,OAGyBO;EAFvCnC,QAAQ4B,SAAS,EAAEQ,MAAM,UAAU,CAEaA;CAAI,CAAC;CAElE,OAAOrD,eACE;EACLqB;EACAC;EACA,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GZ;EAAM;EAC7C,GAAII,QAAQS,iBAAiBV,KAAK;EAElC,UAAA,qBAAC,QAAD;GACE,WAAWC,QAAQU;GACnB,WAAWtB,KAAK,+DAA+DU,SAAS;GACxF,OAAOE,QAAQW;GACf,MAAK;GAJP,UAAA,CAMGd,UACD,oBAAC,OAAD;IACE,KAAKG,QAAQY;IACb,OAAOvB,kBAAkBW,OAAO;IAChC,WAAU;GACN,CAAA,CACA;;CACL,CAAA,EACS,CAAA;AAEpB;;;AC3CA,SAAgBuB,eAAe,EAAEC,UAAUH,UAAU,OAAOC,KAAK,GAAGG,SAAgB;CAClF,MAAMC,UAAUT,kBAAkB;CAClC,MAAMU,cAAeH,SAAiBF;CACtC,MAAMM,YAAYV,aAAa;EAACQ,QAAQG,KAAKC;EAAcR;EAAKK;CAAW,CAAC;CAE5E,IAAIN,WAAWL,eAAeQ,QAAQ,GACpC,OAAOT,aACLS,UACAE,QAAQK,kBAAkB;EACxBT,KAAKM;EACL,GAAGH;EACH,GAAID,SAASC,SAAS,CAAC;EAEvB,cAAcC,QAAQM,OAAO,SAAS;CACxC,CAAC,CACH;CAGF,OACE,oBAAC,QAAD;EAAM,KAAKJ;EAAW,GAAIF,QAAQK,kBAAkBN,KAAK;EACtDD;CACG,CAAA;AAEV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge-CtcHuvQK.mjs","names":["ReactNode","ThemeColor","clsx","Tooltip","TooltipContent","TooltipTrigger","Props","children","className","tooltip","url","color","onClick","onRemove","Badge","t0","$","_c","t1","undefined","clickable","t2","t3","t4","t5","t6","badge","t7","wrappedBadge","t8","t9","t10"],"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,SAAOc,MAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAe,MAAA,EAAAV,UAAAC,WAAAK,UAAAD,SAAAH,SAAAC,KAAAC,OAAAO,OAAAH;CAOpB,MAAAJ,QAAAO,OAAAC,KAAAA,IAAA,WAAAD;CAQM,MAAAG,MANYT,YAAYO,KAAAA,KAAaT,QAAQS,KAAAA,MAM7C;CAAsD,IAAAG;CAAA,IAAAN,EAAA,OAAAR,aAAAQ,EAAA,OAAAK,IAAA;EAF7CC,KAAApB,KACT,iJACAmB,IACA,mCACAb,SACF;EAACQ,EAAA,KAAAR;EAAAQ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAT,YAAAS,EAAA,OAAAJ,SAAA;EAEAW,KAAAX,UACC,oBAAA,UAAA;GAAkB,WAAA;GAA+BA;GAC9CL;EACM,CAAA,IAET,oBAAA,QAAA;GAAgB,WAAA;GAAQA;EAAgB,CAAA;EACzCS,EAAA,KAAAT;EAAAS,EAAA,KAAAJ;EAAAI,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAH,UAAA;EACAW,KAAAX,YACC,oBAAA,UAAA;GACY,WAAA;GACDA,SAAAA;
|
|
1
|
+
{"version":3,"file":"badge-CtcHuvQK.mjs","names":["ReactNode","ThemeColor","clsx","Tooltip","TooltipContent","TooltipTrigger","Props","children","className","tooltip","url","color","onClick","onRemove","Badge","t0","$","_c","t1","undefined","clickable","t2","t3","t4","t5","t6","badge","t7","wrappedBadge","t8","t9","t10"],"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,SAAOc,MAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAe,MAAA,EAAAV,UAAAC,WAAAK,UAAAD,SAAAH,SAAAC,KAAAC,OAAAO,OAAAH;CAOpB,MAAAJ,QAAAO,OAAAC,KAAAA,IAAA,WAAAD;CAQM,MAAAG,MANYT,YAAYO,KAAAA,KAAaT,QAAQS,KAAAA,MAM7C;CAAsD,IAAAG;CAAA,IAAAN,EAAA,OAAAR,aAAAQ,EAAA,OAAAK,IAAA;EAF7CC,KAAApB,KACT,iJACAmB,IACA,mCACAb,SACF;EAACQ,EAAA,KAAAR;EAAAQ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAT,YAAAS,EAAA,OAAAJ,SAAA;EAEAW,KAAAX,UACC,oBAAA,UAAA;GAAkB,WAAA;GAA+BA;GAC9CL;EACM,CAAA,IAET,oBAAA,QAAA;GAAgB,WAAA;GAAQA;EAAgB,CAAA;EACzCS,EAAA,KAAAT;EAAAS,EAAA,KAAAJ;EAAAI,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAH,UAAA;EACAW,KAAAX,YACC,oBAAA,UAAA;GACY,WAAA;GACDA,SAAAA;GAET,UAAA,oBAAA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AAA,CAAA;EAGEd,EAAA,MAAAa;EAAAb,EAAA,MAAAc;EAAAd,EAAA,MAAAe;CAAA,OAAAA,MAAAf,EAAA;CAAA,OAHVe;AAGU"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as buttonVariants } from "./Button-
|
|
1
|
+
import { h as useRipple } from "./hooks-BQw3Dsve.mjs";
|
|
2
|
+
import { n as buttonVariants } from "./Button-Cx5QDjg9.mjs";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import { useImperativeHandle, useRef } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -146,4 +146,4 @@ function HrefButton(t0) {
|
|
|
146
146
|
//#endregion
|
|
147
147
|
export { ButtonGroup as n, buttonGroupVariants as r, HrefButton as t };
|
|
148
148
|
|
|
149
|
-
//# sourceMappingURL=button-
|
|
149
|
+
//# sourceMappingURL=button-CuqQ_n9M.mjs.map
|