@me1a/ui 2.2.1 → 2.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/dist/accordion/index.d.mts +94 -0
- package/dist/accordion/index.mjs +2 -0
- package/dist/accordion/index.mjs.map +1 -0
- package/dist/avatar/index.d.mts +34 -0
- package/dist/avatar/index.mjs +2 -0
- package/dist/avatar/index.mjs.map +1 -0
- package/dist/badge/index.d.mts +41 -0
- package/dist/badge/index.mjs +2 -0
- package/dist/badge/index.mjs.map +1 -0
- package/dist/box/index.d.mts +50 -0
- package/dist/box/index.mjs +2 -0
- package/dist/box/index.mjs.map +1 -0
- package/dist/breadcrumb/index.d.mts +35 -0
- package/dist/breadcrumb/index.mjs +2 -0
- package/dist/breadcrumb/index.mjs.map +1 -0
- package/dist/{tooltip-B4jzaurK.d.mts → button/index.d.mts} +3 -25
- package/dist/button/index.mjs +2 -0
- package/dist/button/index.mjs.map +1 -0
- package/dist/card/index.d.mts +127 -0
- package/dist/card/index.mjs +2 -0
- package/dist/card/index.mjs.map +1 -0
- package/dist/checkbox/index.d.mts +21 -0
- package/dist/checkbox/index.mjs +2 -0
- package/dist/checkbox/index.mjs.map +1 -0
- package/dist/collapsible/index.d.mts +26 -0
- package/dist/collapsible/index.mjs +2 -0
- package/dist/collapsible/index.mjs.map +1 -0
- package/dist/command/index.d.mts +122 -0
- package/dist/command/index.mjs +2 -0
- package/dist/command/index.mjs.map +1 -0
- package/dist/container/index.d.mts +33 -0
- package/dist/container/index.mjs +2 -0
- package/dist/container/index.mjs.map +1 -0
- package/dist/dialog/index.d.mts +35 -0
- package/dist/dialog/index.mjs +2 -0
- package/dist/dialog/index.mjs.map +1 -0
- package/dist/drawer/index.d.mts +63 -0
- package/dist/drawer/index.mjs +2 -0
- package/dist/drawer/index.mjs.map +1 -0
- package/dist/dropdown-menu/index.d.mts +335 -0
- package/dist/dropdown-menu/index.mjs +2 -0
- package/dist/dropdown-menu/index.mjs.map +1 -0
- package/dist/form/index.d.mts +96 -0
- package/dist/form/index.mjs +2 -0
- package/dist/form/index.mjs.map +1 -0
- package/dist/{hooks.d.mts → hooks/index.d.mts} +10 -4
- package/dist/hooks/index.mjs +2 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +2739 -30
- package/dist/index.mjs +47 -0
- package/dist/{index.esm.js.map → index.mjs.map} +1 -1
- package/dist/input/index.d.mts +12 -0
- package/dist/input/index.mjs +2 -0
- package/dist/input/index.mjs.map +1 -0
- package/dist/label/index.d.mts +18 -0
- package/dist/label/index.mjs +2 -0
- package/dist/label/index.mjs.map +1 -0
- package/dist/navigation-menu/index.d.mts +104 -0
- package/dist/navigation-menu/index.mjs +2 -0
- package/dist/navigation-menu/index.mjs.map +1 -0
- package/dist/page-loader/index.d.mts +29 -0
- package/dist/page-loader/index.mjs +2 -0
- package/dist/page-loader/index.mjs.map +1 -0
- package/dist/pagination/index.d.mts +105 -0
- package/dist/pagination/index.mjs +2 -0
- package/dist/pagination/index.mjs.map +1 -0
- package/dist/popover/index.d.mts +30 -0
- package/dist/popover/index.mjs +2 -0
- package/dist/popover/index.mjs.map +1 -0
- package/dist/{checkbox-DxgDKaHx.d.mts → radio-group/index.d.mts} +5 -51
- package/dist/radio-group/index.mjs +2 -0
- package/dist/radio-group/index.mjs.map +1 -0
- package/dist/resizable/index.d.mts +53 -0
- package/dist/resizable/index.mjs +2 -0
- package/dist/resizable/index.mjs.map +1 -0
- package/dist/rhf-checkbox/index.d.mts +57 -0
- package/dist/rhf-checkbox/index.mjs +2 -0
- package/dist/rhf-checkbox/index.mjs.map +1 -0
- package/dist/rhf-multi-select/index.d.mts +84 -0
- package/dist/rhf-multi-select/index.mjs +2 -0
- package/dist/rhf-multi-select/index.mjs.map +1 -0
- package/dist/rhf-radio-button-group/index.d.mts +73 -0
- package/dist/rhf-radio-button-group/index.mjs +2 -0
- package/dist/rhf-radio-button-group/index.mjs.map +1 -0
- package/dist/rhf-radio-group/index.d.mts +103 -0
- package/dist/rhf-radio-group/index.mjs +2 -0
- package/dist/rhf-radio-group/index.mjs.map +1 -0
- package/dist/rhf-select/index.d.mts +80 -0
- package/dist/rhf-select/index.mjs +2 -0
- package/dist/rhf-select/index.mjs.map +1 -0
- package/dist/rhf-switch/index.d.mts +57 -0
- package/dist/rhf-switch/index.mjs +2 -0
- package/dist/rhf-switch/index.mjs.map +1 -0
- package/dist/rhf-textarea/index.d.mts +66 -0
- package/dist/rhf-textarea/index.mjs +2 -0
- package/dist/rhf-textarea/index.mjs.map +1 -0
- package/dist/separator/index.d.mts +13 -0
- package/dist/separator/index.mjs +2 -0
- package/dist/separator/index.mjs.map +1 -0
- package/dist/sheet/index.d.mts +42 -0
- package/dist/sheet/index.mjs +2 -0
- package/dist/sheet/index.mjs.map +1 -0
- package/dist/sidebar/index.d.mts +328 -0
- package/dist/sidebar/index.mjs +2 -0
- package/dist/sidebar/index.mjs.map +1 -0
- package/dist/skeleton/index.d.mts +17 -0
- package/dist/skeleton/index.mjs +2 -0
- package/dist/skeleton/index.mjs.map +1 -0
- package/dist/stack/index.d.mts +121 -0
- package/dist/stack/index.mjs +2 -0
- package/dist/stack/index.mjs.map +1 -0
- package/dist/switch/index.d.mts +21 -0
- package/dist/switch/index.mjs +2 -0
- package/dist/switch/index.mjs.map +1 -0
- package/dist/table/index.d.mts +53 -0
- package/dist/table/index.mjs +2 -0
- package/dist/table/index.mjs.map +1 -0
- package/dist/tabs/index.d.mts +97 -0
- package/dist/tabs/index.mjs +2 -0
- package/dist/tabs/index.mjs.map +1 -0
- package/dist/text-field/index.d.mts +65 -0
- package/dist/text-field/index.mjs +2 -0
- package/dist/text-field/index.mjs.map +1 -0
- package/dist/textarea/index.d.mts +24 -0
- package/dist/textarea/index.mjs +2 -0
- package/dist/textarea/index.mjs.map +1 -0
- package/dist/{toast-2xT7L1tJ.d.mts → toast/index.d.mts} +3 -3
- package/dist/toast/index.mjs +2 -0
- package/dist/toast/index.mjs.map +1 -0
- package/dist/toaster/index.d.mts +26 -0
- package/dist/toaster/index.mjs +2 -0
- package/dist/toaster/index.mjs.map +1 -0
- package/dist/tooltip/index.d.mts +25 -0
- package/dist/tooltip/index.mjs +2 -0
- package/dist/tooltip/index.mjs.map +1 -0
- package/dist/types/index.mjs +2 -0
- package/dist/{index.cjs.js.map → types/index.mjs.map} +1 -1
- package/dist/typography/index.d.mts +24 -0
- package/dist/typography/index.mjs +2 -0
- package/dist/typography/index.mjs.map +1 -0
- package/dist/utils/index.mjs +2 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +199 -34
- package/dist/atoms.cjs.js +0 -2
- package/dist/atoms.cjs.js.map +0 -1
- package/dist/atoms.d.mts +0 -1051
- package/dist/atoms.d.ts +0 -1051
- package/dist/atoms.esm.js +0 -2
- package/dist/atoms.esm.js.map +0 -1
- package/dist/checkbox-DxgDKaHx.d.ts +0 -108
- package/dist/chunk-23T2PH5G.esm.js +0 -2
- package/dist/chunk-23T2PH5G.esm.js.map +0 -1
- package/dist/chunk-2QG3QTSW.cjs.js +0 -2
- package/dist/chunk-2QG3QTSW.cjs.js.map +0 -1
- package/dist/chunk-C26U3FL4.esm.js +0 -2
- package/dist/chunk-C26U3FL4.esm.js.map +0 -1
- package/dist/chunk-DTM5LZHM.cjs.js +0 -2
- package/dist/chunk-DTM5LZHM.cjs.js.map +0 -1
- package/dist/chunk-HW32JE75.cjs.js +0 -2
- package/dist/chunk-HW32JE75.cjs.js.map +0 -1
- package/dist/chunk-JIRS6MWF.cjs.js +0 -2
- package/dist/chunk-JIRS6MWF.cjs.js.map +0 -1
- package/dist/chunk-JKTYFZ5M.esm.js +0 -2
- package/dist/chunk-JKTYFZ5M.esm.js.map +0 -1
- package/dist/chunk-JUZG25DH.esm.js +0 -2
- package/dist/chunk-JUZG25DH.esm.js.map +0 -1
- package/dist/chunk-KOYJODOP.cjs.js +0 -2
- package/dist/chunk-KOYJODOP.cjs.js.map +0 -1
- package/dist/chunk-M4S5YZ56.esm.js +0 -2
- package/dist/chunk-M4S5YZ56.esm.js.map +0 -1
- package/dist/chunk-MOYOCJW6.esm.js +0 -2
- package/dist/chunk-MOYOCJW6.esm.js.map +0 -1
- package/dist/chunk-MVWMLXLL.cjs.js +0 -2
- package/dist/chunk-MVWMLXLL.cjs.js.map +0 -1
- package/dist/chunk-SL2ZUI4G.cjs.js +0 -2
- package/dist/chunk-SL2ZUI4G.cjs.js.map +0 -1
- package/dist/chunk-STRDPP3B.esm.js +0 -2
- package/dist/chunk-STRDPP3B.esm.js.map +0 -1
- package/dist/chunk-U4NMIMU7.esm.js +0 -2
- package/dist/chunk-U4NMIMU7.esm.js.map +0 -1
- package/dist/chunk-UK47BFA3.cjs.js +0 -2
- package/dist/chunk-UK47BFA3.cjs.js.map +0 -1
- package/dist/chunk-UTVXFZLD.esm.js +0 -2
- package/dist/chunk-UTVXFZLD.esm.js.map +0 -1
- package/dist/chunk-WJNYKJP6.cjs.js +0 -2
- package/dist/chunk-WJNYKJP6.cjs.js.map +0 -1
- package/dist/chunk-YEZB7AOJ.esm.js +0 -2
- package/dist/chunk-YEZB7AOJ.esm.js.map +0 -1
- package/dist/chunk-YGLYFSF6.cjs.js +0 -2
- package/dist/chunk-YGLYFSF6.cjs.js.map +0 -1
- package/dist/hooks.cjs.js +0 -2
- package/dist/hooks.cjs.js.map +0 -1
- package/dist/hooks.d.ts +0 -51
- package/dist/hooks.esm.js +0 -2
- package/dist/hooks.esm.js.map +0 -1
- package/dist/index.cjs.js +0 -2
- package/dist/index.d.ts +0 -30
- package/dist/index.esm.js +0 -2
- package/dist/molecules.cjs.js +0 -2
- package/dist/molecules.cjs.js.map +0 -1
- package/dist/molecules.d.mts +0 -201
- package/dist/molecules.d.ts +0 -201
- package/dist/molecules.esm.js +0 -2
- package/dist/molecules.esm.js.map +0 -1
- package/dist/organisms.cjs.js +0 -2
- package/dist/organisms.cjs.js.map +0 -1
- package/dist/organisms.d.mts +0 -673
- package/dist/organisms.d.ts +0 -673
- package/dist/organisms.esm.js +0 -2
- package/dist/organisms.esm.js.map +0 -1
- package/dist/rhf.cjs.js +0 -2
- package/dist/rhf.cjs.js.map +0 -1
- package/dist/rhf.d.mts +0 -408
- package/dist/rhf.d.ts +0 -408
- package/dist/rhf.esm.js +0 -2
- package/dist/rhf.esm.js.map +0 -1
- package/dist/toast-2xT7L1tJ.d.ts +0 -18
- package/dist/tooltip-B4jzaurK.d.ts +0 -104
- package/dist/types.cjs.js +0 -2
- package/dist/types.cjs.js.map +0 -1
- package/dist/types.d.ts +0 -2
- package/dist/types.esm.js +0 -2
- package/dist/types.esm.js.map +0 -1
- package/dist/utils.cjs.js +0 -2
- package/dist/utils.cjs.js.map +0 -1
- package/dist/utils.d.ts +0 -5
- package/dist/utils.esm.js +0 -2
- package/dist/utils.esm.js.map +0 -1
- /package/dist/{types.d.mts → types/index.d.mts} +0 -0
- /package/dist/{utils.d.mts → utils/index.d.mts} +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Props interface for the TextField component.
|
|
7
|
+
* Extends the native input HTML attributes and adds support for variants and icons.
|
|
8
|
+
*
|
|
9
|
+
* @interface TextFieldProps
|
|
10
|
+
* @extends {React.InputHTMLAttributes<HTMLInputElement>}
|
|
11
|
+
* @extends {VariantProps<typeof textFieldVariants>}
|
|
12
|
+
*
|
|
13
|
+
* @property {string} [variant] - The visual style variant of the text field.
|
|
14
|
+
* @property {string} [size] - The size variant of the text field.
|
|
15
|
+
* @property {string} [className] - Additional CSS classes to apply to the text field.
|
|
16
|
+
* @property {React.ReactNode} [startIcon] - Icon to display before the input.
|
|
17
|
+
* @property {React.ReactNode} [endIcon] - Icon to display after the input.
|
|
18
|
+
* @property {boolean} [loading] - Whether the text field is in a loading state.
|
|
19
|
+
* @property {string} [error] - Error message to display below the text field.
|
|
20
|
+
* @property {string} [label] - Label text for the text field.
|
|
21
|
+
* @property {string} [helperText] - Helper text to display below the text field.
|
|
22
|
+
*/
|
|
23
|
+
interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">, VariantProps<typeof textFieldVariants> {
|
|
24
|
+
startIcon?: React.ReactNode;
|
|
25
|
+
endIcon?: React.ReactNode;
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
error?: string;
|
|
28
|
+
label?: string;
|
|
29
|
+
helperText?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Text field variant styles using class-variance-authority.
|
|
34
|
+
* Defines the visual styles for different text field variants and sizes.
|
|
35
|
+
*/
|
|
36
|
+
declare const textFieldVariants: (props?: ({
|
|
37
|
+
variant?: "default" | "error" | null | undefined;
|
|
38
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
39
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
40
|
+
/**
|
|
41
|
+
* A versatile text field component that supports multiple variants, sizes, and icons.
|
|
42
|
+
* Built on top of shadcn/ui's Input component.
|
|
43
|
+
*
|
|
44
|
+
* @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-text-field--docs
|
|
45
|
+
*
|
|
46
|
+
* @component
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* // Default text field
|
|
50
|
+
* <TextField placeholder="Enter text" />
|
|
51
|
+
*
|
|
52
|
+
* // With icons
|
|
53
|
+
* <TextField startIcon={<SearchIcon />} placeholder="Search..." />
|
|
54
|
+
* <TextField endIcon={<CalendarIcon />} placeholder="Select date" />
|
|
55
|
+
*
|
|
56
|
+
* // With loading state
|
|
57
|
+
* <TextField loading placeholder="Loading..." />
|
|
58
|
+
*
|
|
59
|
+
* // With error
|
|
60
|
+
* <TextField error="Invalid input" placeholder="Enter text" />
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>>;
|
|
64
|
+
|
|
65
|
+
export { TextField, type TextFieldProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as m from'react';import {cva}from'class-variance-authority';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {Loader2}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';import*as n from'@radix-ui/react-label';function e(...t){return twMerge(clsx(t))}var f=m.forwardRef(({className:t,type:o,...a},i)=>jsx("input",{type:o,className:e("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:i,...a}));f.displayName="Input";var V=cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),p=m.forwardRef(({className:t,...o},a)=>jsx(n.Root,{ref:a,className:e(V(),t),...o}));p.displayName=n.Root.displayName;var M=cva("w-full",{variants:{variant:{default:"",error:"border-destructive focus-visible:ring-destructive"},size:{default:"h-10",sm:"h-8 text-xs",lg:"h-12 text-base"}},defaultVariants:{variant:"default",size:"default"}}),R=m.forwardRef(({className:t,variant:o,size:a,startIcon:i,endIcon:d,loading:s=false,error:l,label:u,helperText:c,disabled:L,...P},N)=>{let b=m.useId();return jsxs("div",{className:"w-full space-y-2",children:[u&&jsx(p,{htmlFor:b,children:u}),jsxs("div",{className:"relative",children:[i&&jsx("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:i}),jsx(f,{id:b,className:e(M({variant:l?"error":o,size:a,className:t}),i&&"pl-9",(d||s)&&"pr-9"),ref:N,disabled:L||s,...P}),(d||s)&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:s?jsx(Loader2,{className:"h-4 w-4 animate-spin"}):d})]}),(l||c)&&jsx("p",{className:e("text-sm",l?"text-destructive":"text-muted-foreground"),children:l||c})]})});R.displayName="TextField";export{R as TextField};//# sourceMappingURL=index.mjs.map
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/input/input.tsx","../../src/components/atoms/label/label.tsx","../../src/components/atoms/text-field/text-field.tsx"],"names":["cn","inputs","twMerge","clsx","Input","x","className","type","props","ref","jsx","labelVariants","cva","Label","v","textFieldVariants","TextField","variant","size","startIcon","endIcon","loading","error","label","helperText","disabled","id","jsxs","Loader2"],"mappings":"oPAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,OAAQC,CAAAA,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CCMA,IAAMG,CAAAA,CAAcC,CAClB,CAAA,UAAA,CAAA,CAAC,CAAE,SAAAC,CAAAA,CAAAA,CAAW,IAAAC,CAAAA,CAAAA,CAAM,GAAGC,CAAM,CAAGC,CAAAA,CAAAA,GAE5BC,IAAC,OACC,CAAA,CAAA,IAAA,CAAMH,CACN,CAAA,SAAA,CAAWP,CACT,CAAA,yWAAA,CACAM,CACF,CAAA,CACA,IAAKG,CACJ,CAAA,GAAGD,CACN,CAAA,CAGN,CACAJ,CAAAA,CAAAA,CAAM,WAAc,CAAA,OAAA,CCpBpB,IAAMO,CAAgBC,CAAAA,GAAAA,CACpB,4FACF,CAAA,CAaMC,EAAcC,CAClB,CAAA,UAAA,CAAA,CAAC,CAAE,SAAA,CAAAR,CAAW,CAAA,GAAGE,CAAM,CAAA,CAAGC,IACxBC,GAAgB,CAAA,CAAA,CAAA,IAAA,CAAf,CAAoB,GAAA,CAAKD,CAAK,CAAA,SAAA,CAAWT,CAAGW,CAAAA,CAAAA,GAAiBL,CAAS,CAAA,CAAI,GAAGE,CAAAA,CAAO,CAEzF,CAAA,CACAK,CAAM,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,CAAAC,EAAM,SAAAZ,CAAAA,CAAU,CAAC,CAAA,CACzEa,CAAa,EAAA,MAAA,CAAA,CACZC,CAAWC,EAAAA,CAAAA,GAAY,MAC1B,CACA,CAAA,GAAA,CAAKZ,CACL,CAAA,QAAA,CAAUgB,CAAYJ,EAAAA,CAAAA,CACrB,GAAGb,CAAAA,CACN,GACEY,CAAWC,EAAAA,CAAAA,GACXX,GAAC,CAAA,KAAA,CAAA,CAAI,SAAU,CAAA,iEAAA,CACZ,QAAAW,CAAAA,CAAAA,CAAUX,IAACkB,OAAA,CAAA,CAAQ,SAAU,CAAA,sBAAA,CAAuB,CAAKR,CAAAA,CAAAA,CAC5D,CAEJ,CAAA,CAAA,CAAA,CAAA,CACEE,GAASE,CACTd,GAAAA,GAAAA,CAAC,GAAE,CAAA,CAAA,SAAA,CAAWV,CAAG,CAAA,SAAA,CAAWsB,CAAQ,CAAA,kBAAA,CAAqB,uBAAuB,CAC7E,CAAA,QAAA,CAAAA,CAASE,EAAAA,CAAAA,CACZ,CAEJ,CAAA,CAAA,CAEJ,CACF,EAEAR,EAAU,WAAc,CAAA,WAAA","file":"index.mjs","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import * as React from \"react\"\n\nimport { cn } from \"@/utils/cn\"\n\n/**\n * Input component for creating accessible input fields.\n * Built on top of shadcn/ui's Input component.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-input--docs\n *\n */\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<\"input\">>(\n ({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n className\n )}\n ref={ref}\n {...props}\n />\n )\n }\n)\nInput.displayName = \"Input\"\n\nexport { Input }\n","import * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/utils/index\"\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,\n VariantProps<typeof labelVariants> {}\n\n/**\n * Label component for creating accessible labels.\n * Built on top of Radix UI's Label primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-label--docs\n *\n */\nconst Label = React.forwardRef<React.ElementRef<typeof LabelPrimitive.Root>, LabelProps>(\n ({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n )\n)\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n","import * as React from \"react\"\nimport { cva } from \"class-variance-authority\"\nimport { cn } from \"@/utils/cn\"\nimport { TextFieldProps } from \"./text-field.types\"\nimport { Loader2 } from \"lucide-react\"\nimport { Input } from \"../input\"\nimport { Label } from \"../label\"\n\n/**\n * Text field variant styles using class-variance-authority.\n * Defines the visual styles for different text field variants and sizes.\n */\nconst textFieldVariants = cva(\"w-full\", {\n variants: {\n variant: {\n default: \"\",\n error: \"border-destructive focus-visible:ring-destructive\"\n },\n size: {\n default: \"h-10\",\n sm: \"h-8 text-xs\",\n lg: \"h-12 text-base\"\n }\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\"\n }\n})\n\n/**\n * A versatile text field component that supports multiple variants, sizes, and icons.\n * Built on top of shadcn/ui's Input component.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-text-field--docs\n *\n * @component\n * @example\n * ```tsx\n * // Default text field\n * <TextField placeholder=\"Enter text\" />\n *\n * // With icons\n * <TextField startIcon={<SearchIcon />} placeholder=\"Search...\" />\n * <TextField endIcon={<CalendarIcon />} placeholder=\"Select date\" />\n *\n * // With loading state\n * <TextField loading placeholder=\"Loading...\" />\n *\n * // With error\n * <TextField error=\"Invalid input\" placeholder=\"Enter text\" />\n * ```\n */\nconst TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n className,\n variant,\n size,\n startIcon,\n endIcon,\n loading = false,\n error,\n label,\n helperText,\n disabled,\n ...props\n },\n ref\n ) => {\n const id = React.useId()\n\n return (\n <div className=\"w-full space-y-2\">\n {label && <Label htmlFor={id}>{label}</Label>}\n <div className=\"relative\">\n {startIcon && (\n <div className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\">\n {startIcon}\n </div>\n )}\n <Input\n id={id}\n className={cn(\n textFieldVariants({ variant: error ? \"error\" : variant, size, className }),\n startIcon && \"pl-9\",\n (endIcon || loading) && \"pr-9\"\n )}\n ref={ref}\n disabled={disabled || loading}\n {...props}\n />\n {(endIcon || loading) && (\n <div className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground\">\n {loading ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : endIcon}\n </div>\n )}\n </div>\n {(error || helperText) && (\n <p className={cn(\"text-sm\", error ? \"text-destructive\" : \"text-muted-foreground\")}>\n {error || helperText}\n </p>\n )}\n </div>\n )\n }\n)\n\nTextField.displayName = \"TextField\"\n\nexport { TextField, textFieldVariants }\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TextareaHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the textarea should automatically resize
|
|
7
|
+
*/
|
|
8
|
+
autoResize?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Textarea component for creating accessible text areas.
|
|
13
|
+
* Built on top of shadcn/ui's Textarea component.
|
|
14
|
+
*
|
|
15
|
+
* @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-textarea--docs
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <Textarea placeholder="Enter text" />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
23
|
+
|
|
24
|
+
export { Textarea, type TextareaProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as e from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsx}from'react/jsx-runtime';function o(...r){return twMerge(clsx(r))}var c=e.forwardRef(({className:r,autoResize:n=false,...i},l)=>{let s=e.useRef(null);return e.useEffect(()=>{if(!n||!s.current)return;let t=s.current,a=()=>{t.style.height="auto",t.style.height=`${t.scrollHeight}px`;};return t.addEventListener("input",a),a(),()=>t.removeEventListener("input",a)},[n]),jsx("textarea",{className:o("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),ref:l,...i})});c.displayName="Textarea";export{c as Textarea};//# sourceMappingURL=index.mjs.map
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/textarea/textarea.tsx"],"names":["cn","inputs","twMerge","clsx","Textarea","className","autoResize","props","ref","internalRef","textarea","resizeTextarea","jsx"],"mappings":"yHAGO,SAASA,CAAAA,CAAAA,GAAMC,EAAsB,CAC1C,OAAOC,OAAQC,CAAAA,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CCUMG,IAAAA,CAAAA,CAAiB,aACrB,CAAC,CAAE,SAAAC,CAAAA,CAAAA,CAAW,UAAAC,CAAAA,CAAAA,CAAa,MAAO,GAAGC,CAAM,CAAGC,CAAAA,CAAAA,GAAQ,CACpD,IAAMC,EAAoB,CAA4B,CAAA,MAAA,CAAA,IAAI,CAE1D,CAAA,OAAM,CAAU,CAAA,SAAA,CAAA,IAAM,CACpB,GAAI,CAACH,CAAc,EAAA,CAACG,CAAY,CAAA,OAAA,CAAS,OAEzC,IAAMC,CAAAA,CAAWD,CAAY,CAAA,OAAA,CACvBE,CAAiB,CAAA,IAAM,CAC3BD,CAAS,CAAA,KAAA,CAAM,MAAS,CAAA,MAAA,CACxBA,CAAS,CAAA,KAAA,CAAM,OAAS,CAAGA,EAAAA,CAAAA,CAAS,YAAY,CAAA,EAAA,EAClD,CAEA,CAAA,OAAAA,EAAS,gBAAiB,CAAA,OAAA,CAASC,CAAc,CAAA,CACjDA,CAAe,EAAA,CAER,IAAMD,CAAS,CAAA,mBAAA,CAAoB,OAASC,CAAAA,CAAc,CACnE,CAAA,CAAG,CAACL,CAAU,CAAC,CAGbM,CAAAA,GAAAA,CAAC,UACC,CAAA,CAAA,SAAA,CAAWZ,EACT,2QACAK,CAAAA,CACF,CACA,CAAA,GAAA,CAAKG,CACJ,CAAA,GAAGD,EACN,CAEJ,CACF,EAEAH,CAAAA,CAAS,WAAc,CAAA,UAAA","file":"index.mjs","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import * as React from \"react\"\nimport { cn } from \"@/utils/index\"\nimport { TextareaProps } from \"./textarea.types\"\n\n/**\n * Textarea component for creating accessible text areas.\n * Built on top of shadcn/ui's Textarea component.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-textarea--docs\n *\n * @example\n * ```tsx\n * <Textarea placeholder=\"Enter text\" />\n * ```\n */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, autoResize = false, ...props }, ref) => {\n const internalRef = React.useRef<HTMLTextAreaElement>(null)\n\n React.useEffect(() => {\n if (!autoResize || !internalRef.current) return\n\n const textarea = internalRef.current\n const resizeTextarea = () => {\n textarea.style.height = \"auto\"\n textarea.style.height = `${textarea.scrollHeight}px`\n }\n\n textarea.addEventListener(\"input\", resizeTextarea)\n resizeTextarea() // Initial resize\n\n return () => textarea.removeEventListener(\"input\", resizeTextarea)\n }, [autoResize])\n\n return (\n <textarea\n className={cn(\n \"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n className\n )}\n ref={ref}\n {...props}\n />\n )\n }\n)\n\nTextarea.displayName = \"Textarea\"\n\nexport { Textarea }\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import * as ToastPrimitives from '@radix-ui/react-toast';
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
@@ -7,7 +7,7 @@ declare const ToastProvider: React.FC<ToastPrimitives.ToastProviderProps>;
|
|
|
7
7
|
declare const ToastViewport: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastViewportProps & React.RefAttributes<HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
8
8
|
declare const Toast: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastProps & React.RefAttributes<HTMLLIElement>, "ref"> & VariantProps<(props?: ({
|
|
9
9
|
variant?: "default" | "destructive" | null | undefined;
|
|
10
|
-
} &
|
|
10
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLLIElement>>;
|
|
11
11
|
declare const ToastAction: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
12
12
|
declare const ToastClose: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
13
13
|
declare const ToastTitle: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastTitleProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -15,4 +15,4 @@ declare const ToastDescription: React.ForwardRefExoticComponent<Omit<ToastPrimit
|
|
|
15
15
|
type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
|
|
16
16
|
type ToastActionElement = React.ReactElement<typeof ToastAction>;
|
|
17
17
|
|
|
18
|
-
export {
|
|
18
|
+
export { Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as r from'react';import*as t from'@radix-ui/react-toast';import {cva}from'class-variance-authority';import {X}from'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsx}from'react/jsx-runtime';function i(...e){return twMerge(clsx(e))}var y=t.Provider,n=r.forwardRef(({className:e,...o},s)=>jsx(t.Viewport,{ref:s,className:i("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...o}));n.displayName=t.Viewport.displayName;var P=cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),p=r.forwardRef(({className:e,variant:o,...s},l)=>jsx(t.Root,{ref:l,className:i(P({variant:o}),e),...s}));p.displayName=t.Root.displayName;var m=r.forwardRef(({className:e,...o},s)=>jsx(t.Action,{ref:s,className:i("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...o}));m.displayName=t.Action.displayName;var c=r.forwardRef(({className:e,...o},s)=>jsx(t.Close,{ref:s,className:i("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"","aria-label":"Close toast",...o,children:jsx(X,{className:"h-4 w-4"})}));c.displayName=t.Close.displayName;var d=r.forwardRef(({className:e,...o},s)=>jsx(t.Title,{ref:s,className:i("text-sm font-semibold [&+div]:text-xs",e),...o}));d.displayName=t.Title.displayName;var f=r.forwardRef(({className:e,...o},s)=>jsx(t.Description,{ref:s,className:i("text-sm opacity-90",e),...o}));f.displayName=t.Description.displayName;export{p as Toast,m as ToastAction,c as ToastClose,f as ToastDescription,y as ToastProvider,d as ToastTitle,n as ToastViewport};//# sourceMappingURL=index.mjs.map
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/toast/toast.tsx"],"names":["cn","inputs","twMerge","clsx","ToastProvider","ToastViewport","className","props","ref","jsx","toastVariants","cva","Toast","variant","ToastAction","ToastClose","X","ToastTitle","ToastDescription"],"mappings":"yOAGO,SAASA,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAAA,CAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CCuBMG,IAAAA,CAAAA,CAAgC,CAEhCC,CAAAA,QAAAA,CAAAA,CAAAA,CAAsB,CAG1B,CAAA,UAAA,CAAA,CAAC,CAAE,SAAA,CAAAC,CAAW,CAAA,GAAGC,CAAM,CAAA,CAAGC,CAC1BC,GAAAA,GAAAA,CAAiB,CAAhB,CAAA,QAAA,CAAA,CACC,GAAKD,CAAAA,CAAAA,CACL,SAAWR,CAAAA,CAAAA,CACT,mIACAM,CAAAA,CACF,CACC,CAAA,GAAGC,CACN,CAAA,CACD,EACDF,CAAc,CAAA,WAAA,CAA8B,CAAS,CAAA,QAAA,CAAA,WAAA,CAE/CK,IAAAA,CAAAA,CAAgBC,GACpB,CAAA,2lBAAA,CACA,CACE,QAAA,CAAU,CACR,OAAA,CAAS,CACP,OAAA,CAAS,sCACT,CAAA,WAAA,CACE,iFACJ,CACF,CACA,CAAA,eAAA,CAAiB,CACf,OAAA,CAAS,SACX,CACF,CACF,CAAA,CAEMC,CAAc,CAAA,CAAA,CAAA,UAAA,CAGlB,CAAC,CAAE,SAAAN,CAAAA,CAAAA,CAAW,OAAAO,CAAAA,CAAAA,CAAS,GAAGN,CAAM,CAAGC,CAAAA,CAAAA,GAEjCC,GAAiB,CAAA,CAAA,CAAA,IAAA,CAAhB,CACC,GAAA,CAAKD,CACL,CAAA,SAAA,CAAWR,CAAGU,CAAAA,CAAAA,CAAc,CAAE,OAAA,CAAAG,CAAQ,CAAC,CAAGP,CAAAA,CAAS,CAClD,CAAA,GAAGC,CACN,CAAA,CAE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CAAA,IAAMC,CAAyB,CAAA,CAAA,CAAA,UAAA,CAG7B,CAAC,CAAE,SAAAZ,CAAAA,CAAAA,CAAW,GAAGC,CAAM,CAAGC,CAAAA,CAAAA,GAC1BC,GAAiB,CAAA,CAAA,CAAA,WAAA,CAAhB,CACC,GAAA,CAAKD,CACL,CAAA,SAAA,CAAWR,CAAG,CAAA,oBAAA,CAAsBM,CAAS,CAAA,CAC5C,GAAGC,CAAAA,CACN,CACD,EACDW,CAAiB,CAAA,WAAA,CAA8B,CAAY,CAAA,WAAA,CAAA,WAAA","file":"index.mjs","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","/**\n * Toast component for displaying temporary notifications.\n * Built on top of Radix UI's Toast primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-toast--docs\n *\n * @example\n * ```tsx\n * <ToastProvider>\n * <Toast>\n * <ToastTitle>Title</ToastTitle>\n * <ToastDescription>Description</ToastDescription>\n * <ToastAction>Action</ToastAction>\n * <ToastClose />\n * </Toast>\n * <ToastViewport />\n * </ToastProvider>\n * ```\n */\n\nimport * as React from \"react\"\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as ToastPrimitives from \"@radix-ui/react-toast\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { X } from \"lucide-react\"\n\nimport { cn } from \"@/utils/index\"\n\nconst ToastProvider = ToastPrimitives.Provider\n\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Viewport\n ref={ref}\n className={cn(\n \"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\",\n className\n )}\n {...props}\n />\n))\nToastViewport.displayName = ToastPrimitives.Viewport.displayName\n\nconst toastVariants = cva(\n \"group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full\",\n {\n variants: {\n variant: {\n default: \"border bg-background text-foreground\",\n destructive:\n \"destructive group border-destructive bg-destructive text-destructive-foreground\"\n }\n },\n defaultVariants: {\n variant: \"default\"\n }\n }\n)\n\nconst Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> & VariantProps<typeof toastVariants>\n>(({ className, variant, ...props }, ref) => {\n return (\n <ToastPrimitives.Root\n ref={ref}\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n )\n})\nToast.displayName = ToastPrimitives.Root.displayName\n\nconst ToastAction = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Action>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Action\n ref={ref}\n className={cn(\n \"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive\",\n className\n )}\n {...props}\n />\n))\nToastAction.displayName = ToastPrimitives.Action.displayName\n\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Close\n ref={ref}\n className={cn(\n \"absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600\",\n className\n )}\n toast-close=\"\"\n aria-label=\"Close toast\"\n {...props}\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n))\nToastClose.displayName = ToastPrimitives.Close.displayName\n\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Title\n ref={ref}\n className={cn(\"text-sm font-semibold [&+div]:text-xs\", className)}\n {...props}\n />\n))\nToastTitle.displayName = ToastPrimitives.Title.displayName\n\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Description\n ref={ref}\n className={cn(\"text-sm opacity-90\", className)}\n {...props}\n />\n))\nToastDescription.displayName = ToastPrimitives.Description.displayName\n\ntype ToastProps = React.ComponentPropsWithoutRef<typeof Toast>\n\ntype ToastActionElement = React.ReactElement<typeof ToastAction>\n\nexport {\n type ToastProps,\n type ToastActionElement,\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Toaster component for managing and displaying toast notifications.
|
|
5
|
+
* Built on top of the Toast primitive components.
|
|
6
|
+
*
|
|
7
|
+
* @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-toaster--docs
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* // Add Toaster to your app's root layout
|
|
12
|
+
* <Toaster />
|
|
13
|
+
*
|
|
14
|
+
* // Use the toast hook to show notifications
|
|
15
|
+
* const { toast } = useToast()
|
|
16
|
+
*
|
|
17
|
+
* toast({
|
|
18
|
+
* title: "Success",
|
|
19
|
+
* description: "Your changes have been saved.",
|
|
20
|
+
* action: <ToastAction altText="Undo">Undo</ToastAction>
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare function Toaster(): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
export { Toaster };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as n from'react';import*as s from'@radix-ui/react-toast';import {cva}from'class-variance-authority';import {X}from'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsx,jsxs}from'react/jsx-runtime';var w=1,D=1e6;var A=0;function _(){return A=(A+1)%Number.MAX_SAFE_INTEGER,A.toString()}var P=new Map,x=t=>{if(P.has(t))return;let e=setTimeout(()=>{P.delete(t),c({type:"REMOVE_TOAST",toastId:t});},D);P.set(t,e);},N=(t,e)=>{switch(e.type){case "ADD_TOAST":return {...t,toasts:[e.toast,...t.toasts].slice(0,w)};case "UPDATE_TOAST":return {...t,toasts:t.toasts.map(o=>o.id===e.toast.id?{...o,...e.toast}:o)};case "DISMISS_TOAST":{let{toastId:o}=e;return o?x(o):t.toasts.forEach(a=>{x(a.id);}),{...t,toasts:t.toasts.map(a=>a.id===o||o===void 0?{...a,open:false}:a)}}case "REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(o=>o.id!==e.toastId)}}},T=[],d={toasts:[]};function c(t){d=N(d,t),T.forEach(e=>{e(d);});}function b({...t}){let e=_(),o=p=>c({type:"UPDATE_TOAST",toast:{...p,id:e}}),a=()=>c({type:"DISMISS_TOAST",toastId:e});return c({type:"ADD_TOAST",toast:{...t,id:e,open:true,onOpenChange:p=>{p||a();}}}),{id:e,dismiss:a,update:o}}function E(){let[t,e]=n.useState(d);return n.useEffect(()=>(T.push(e),()=>{let o=T.indexOf(e);o>-1&&T.splice(o,1);}),[t]),{...t,toast:b,dismiss:o=>c({type:"DISMISS_TOAST",toastId:o})}}function i(...t){return twMerge(clsx(t))}var S=s.Provider,f=n.forwardRef(({className:t,...e},o)=>jsx(s.Viewport,{ref:o,className:i("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));f.displayName=s.Viewport.displayName;var W=cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),u=n.forwardRef(({className:t,variant:e,...o},a)=>jsx(s.Root,{ref:a,className:i(W({variant:e}),t),...o}));u.displayName=s.Root.displayName;var O=n.forwardRef(({className:t,...e},o)=>jsx(s.Action,{ref:o,className:i("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));O.displayName=s.Action.displayName;var l=n.forwardRef(({className:t,...e},o)=>jsx(s.Close,{ref:o,className:i("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"","aria-label":"Close toast",...e,children:jsx(X,{className:"h-4 w-4"})}));l.displayName=s.Close.displayName;var v=n.forwardRef(({className:t,...e},o)=>jsx(s.Title,{ref:o,className:i("text-sm font-semibold [&+div]:text-xs",t),...e}));v.displayName=s.Title.displayName;var y=n.forwardRef(({className:t,...e},o)=>jsx(s.Description,{ref:o,className:i("text-sm opacity-90",t),...e}));y.displayName=s.Description.displayName;function U(){let{toasts:t}=E();return jsxs(S,{children:[t.map(function({id:e,title:o,description:a,action:p,...h}){return jsxs(u,{...h,children:[jsxs("div",{className:"grid gap-1",children:[o&&jsx(v,{children:o}),a&&jsx(y,{children:a})]}),p,jsx(l,{})]},e)}),jsx(f,{})]})}export{U as Toaster};//# sourceMappingURL=index.mjs.map
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-toast.ts","../../src/utils/cn.ts","../../src/components/atoms/toast/toast.tsx","../../src/components/atoms/toaster/toaster.tsx"],"names":["TOAST_LIMIT","TOAST_REMOVE_DELAY","count","genId","toastTimeouts","addToRemoveQueue","toastId","timeout","dispatch","reducer","state","action","t","toast","listeners","memoryState","listener","props","id","update","dismiss","open","useToast","setState","m","index","cn","inputs","twMerge","clsx","ToastProvider","ToastViewport","className","ref","jsx","toastVariants","cva","Toast","variant","ToastAction","ToastClose","X","ToastTitle","ToastD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AAA,CAAAA,CAAAA,CAOZ,CAEJ,CAAC,CAAA,CACDgB,IAACH,CAAA,CAAA,EAAc,GACjB,CAEJ","file":"index.mjs","sourcesContent":["\"use client\"\n\n// Inspired by react-hot-toast library\nimport * as React from \"react\"\n\nimport type { ToastActionElement, ToastProps } from \"@/components/atoms/toast\"\n\nconst TOAST_LIMIT = 1\nconst TOAST_REMOVE_DELAY = 1000000\n\ntype ToasterToast = ToastProps & {\n id: string\n title?: React.ReactNode\n description?: React.ReactNode\n action?: ToastActionElement\n}\n\nconst actionTypes = {\n ADD_TOAST: \"ADD_TOAST\",\n UPDATE_TOAST: \"UPDATE_TOAST\",\n DISMISS_TOAST: \"DISMISS_TOAST\",\n REMOVE_TOAST: \"REMOVE_TOAST\"\n} as const\n\nlet count = 0\n\nfunction genId() {\n count = (count + 1) % Number.MAX_SAFE_INTEGER\n return count.toString()\n}\n\ntype ActionType = typeof actionTypes\n\ntype Action =\n | {\n type: ActionType[\"ADD_TOAST\"]\n toast: ToasterToast\n }\n | {\n type: ActionType[\"UPDATE_TOAST\"]\n toast: Partial<ToasterToast>\n }\n | {\n type: ActionType[\"DISMISS_TOAST\"]\n toastId?: ToasterToast[\"id\"]\n }\n | {\n type: ActionType[\"REMOVE_TOAST\"]\n toastId?: ToasterToast[\"id\"]\n }\n\ninterface State {\n toasts: ToasterToast[]\n}\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()\n\nconst addToRemoveQueue = (toastId: string) => {\n if (toastTimeouts.has(toastId)) {\n return\n }\n\n const timeout = setTimeout(() => {\n toastTimeouts.delete(toastId)\n dispatch({\n type: \"REMOVE_TOAST\",\n toastId: toastId\n })\n }, TOAST_REMOVE_DELAY)\n\n toastTimeouts.set(toastId, timeout)\n}\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case \"ADD_TOAST\":\n return {\n ...state,\n toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)\n }\n\n case \"UPDATE_TOAST\":\n return {\n ...state,\n toasts: state.toasts.map((t) => (t.id === action.toast.id ? { ...t, ...action.toast } : t))\n }\n\n case \"DISMISS_TOAST\": {\n const { toastId } = action\n\n // ! Side effects ! - This could be extracted into a dismissToast() action,\n // but I'll keep it here for simplicity\n if (toastId) {\n addToRemoveQueue(toastId)\n } else {\n state.toasts.forEach((toast) => {\n addToRemoveQueue(toast.id)\n })\n }\n\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === toastId || toastId === undefined\n ? {\n ...t,\n open: false\n }\n : t\n )\n }\n }\n case \"REMOVE_TOAST\":\n if (action.toastId === undefined) {\n return {\n ...state,\n toasts: []\n }\n }\n return {\n ...state,\n toasts: state.toasts.filter((t) => t.id !== action.toastId)\n }\n }\n}\n\nconst listeners: Array<(state: State) => void> = []\n\nlet memoryState: State = { toasts: [] }\n\nfunction dispatch(action: Action) {\n memoryState = reducer(memoryState, action)\n listeners.forEach((listener) => {\n listener(memoryState)\n })\n}\n\ntype Toast = Omit<ToasterToast, \"id\">\n\nfunction toast({ ...props }: Toast) {\n const id = genId()\n\n const update = (props: ToasterToast) =>\n dispatch({\n type: \"UPDATE_TOAST\",\n toast: { ...props, id }\n })\n const dismiss = () => dispatch({ type: \"DISMISS_TOAST\", toastId: id })\n\n dispatch({\n type: \"ADD_TOAST\",\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: (open) => {\n if (!open) dismiss()\n }\n }\n })\n\n return {\n id: id,\n dismiss,\n update\n }\n}\n\nfunction useToast() {\n const [state, setState] = React.useState<State>(memoryState)\n\n React.useEffect(() => {\n listeners.push(setState)\n return () => {\n const index = listeners.indexOf(setState)\n if (index > -1) {\n listeners.splice(index, 1)\n }\n }\n }, [state])\n\n return {\n ...state,\n toast,\n dismiss: (toastId?: string) => dispatch({ type: \"DISMISS_TOAST\", toastId })\n }\n}\n\nexport { useToast, toast }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","/**\n * Toast component for displaying temporary notifications.\n * Built on top of Radix UI's Toast primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-toast--docs\n *\n * @example\n * ```tsx\n * <ToastProvider>\n * <Toast>\n * <ToastTitle>Title</ToastTitle>\n * <ToastDescription>Description</ToastDescription>\n * <ToastAction>Action</ToastAction>\n * <ToastClose />\n * </Toast>\n * <ToastViewport />\n * </ToastProvider>\n * ```\n */\n\nimport * as React from \"react\"\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as ToastPrimitives from \"@radix-ui/react-toast\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { X } from \"lucide-react\"\n\nimport { cn } from \"@/utils/index\"\n\nconst ToastProvider = ToastPrimitives.Provider\n\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Viewport\n ref={ref}\n className={cn(\n \"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\",\n className\n )}\n {...props}\n />\n))\nToastViewport.displayName = ToastPrimitives.Viewport.displayName\n\nconst toastVariants = cva(\n \"group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full\",\n {\n variants: {\n variant: {\n default: \"border bg-background text-foreground\",\n destructive:\n \"destructive group border-destructive bg-destructive text-destructive-foreground\"\n }\n },\n defaultVariants: {\n variant: \"default\"\n }\n }\n)\n\nconst Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> & VariantProps<typeof toastVariants>\n>(({ className, variant, ...props }, ref) => {\n return (\n <ToastPrimitives.Root\n ref={ref}\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n )\n})\nToast.displayName = ToastPrimitives.Root.displayName\n\nconst ToastAction = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Action>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Action\n ref={ref}\n className={cn(\n \"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive\",\n className\n )}\n {...props}\n />\n))\nToastAction.displayName = ToastPrimitives.Action.displayName\n\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Close\n ref={ref}\n className={cn(\n \"absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600\",\n className\n )}\n toast-close=\"\"\n aria-label=\"Close toast\"\n {...props}\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n))\nToastClose.displayName = ToastPrimitives.Close.displayName\n\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Title\n ref={ref}\n className={cn(\"text-sm font-semibold [&+div]:text-xs\", className)}\n {...props}\n />\n))\nToastTitle.displayName = ToastPrimitives.Title.displayName\n\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Description\n ref={ref}\n className={cn(\"text-sm opacity-90\", className)}\n {...props}\n />\n))\nToastDescription.displayName = ToastPrimitives.Description.displayName\n\ntype ToastProps = React.ComponentPropsWithoutRef<typeof Toast>\n\ntype ToastActionElement = React.ReactElement<typeof ToastAction>\n\nexport {\n type ToastProps,\n type ToastActionElement,\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction\n}\n","/**\n * Toaster component for managing and displaying toast notifications.\n * Built on top of the Toast primitive components.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-toaster--docs\n *\n * @example\n * ```tsx\n * // Add Toaster to your app's root layout\n * <Toaster />\n *\n * // Use the toast hook to show notifications\n * const { toast } = useToast()\n *\n * toast({\n * title: \"Success\",\n * description: \"Your changes have been saved.\",\n * action: <ToastAction altText=\"Undo\">Undo</ToastAction>\n * })\n * ```\n */\n\nimport { useToast } from \"@/hooks/use-toast\"\nimport {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport\n} from \"@/components/atoms/toast\"\n\nexport function Toaster() {\n const { toasts } = useToast()\n\n return (\n <ToastProvider>\n {toasts.map(function ({ id, title, description, action, ...props }) {\n return (\n <Toast key={id} {...props}>\n <div className=\"grid gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && <ToastDescription>{description}</ToastDescription>}\n </div>\n {action}\n <ToastClose />\n </Toast>\n )\n })}\n <ToastViewport />\n </ToastProvider>\n )\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* TooltipProvider component for creating accessible tooltips.
|
|
6
|
+
* Built on top of Radix UI's Tooltip primitive.
|
|
7
|
+
*
|
|
8
|
+
* @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-tooltip--docs
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <TooltipProvider>
|
|
13
|
+
* <Tooltip>
|
|
14
|
+
* <TooltipTrigger>Hover me</TooltipTrigger>
|
|
15
|
+
* <TooltipContent>Tooltip content</TooltipContent>
|
|
16
|
+
* </Tooltip>
|
|
17
|
+
* </TooltipProvider>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
21
|
+
declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
|
|
22
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
23
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
|
|
25
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as r from'react';import*as t from'@radix-ui/react-tooltip';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsx}from'react/jsx-runtime';function i(...o){return twMerge(clsx(o))}var g=t.Provider,u=t.Root,x=t.Trigger,d=r.forwardRef(({className:o,sideOffset:a=4,...m},n)=>jsx(t.Portal,{children:jsx(t.Content,{ref:n,sideOffset:a,className:i("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",o),...m})}));d.displayName=t.Content.displayName;export{u as Tooltip,d as TooltipContent,g as TooltipProvider,x as TooltipTrigger};//# sourceMappingURL=index.mjs.map
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/tooltip/tooltip.tsx"],"names":["cn","inputs","twMerge","clsx","TooltipProvider","Tooltip","TooltipTrigger","TooltipContent","className","sideOffset","props","ref","jsx"],"mappings":"mKAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,OAAQC,CAAAA,IAAAA,CAAKF,CAAM,CAAC,CAC7B,KCgBMG,CAAmC,CAAA,CAAA,CAAA,QAAA,CAEnCC,CAA2B,CAAA,CAAA,CAAA,IAAA,CAE3BC,EAAkC,CAElCC,CAAAA,OAAAA,CAAAA,CAAAA,CAAuB,CAG3B,CAAA,UAAA,CAAA,CAAC,CAAE,SAAA,CAAAC,CAAW,CAAA,UAAA,CAAAC,EAAa,CAAG,CAAA,GAAGC,CAAM,CAAA,CAAGC,CAC1CC,GAAAA,GAAAA,CAAkB,CAAjB,CAAA,MAAA,CAAA,CACC,SAAAA,GAAkB,CAAA,CAAA,CAAA,OAAA,CAAjB,CACC,GAAA,CAAKD,CACL,CAAA,UAAA,CAAYF,CACZ,CAAA,SAAA,CAAWT,EACT,qaACAQ,CAAAA,CACF,CACC,CAAA,GAAGE,EACN,CACF,CAAA,CACD,EACDH,CAAAA,CAAe,YAA+B,CAAQ,CAAA,OAAA,CAAA,WAAA","file":"index.mjs","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import * as React from \"react\"\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\"\n\nimport { cn } from \"@/utils/index\"\n\n/**\n * TooltipProvider component for creating accessible tooltips.\n * Built on top of Radix UI's Tooltip primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-tooltip--docs\n *\n * @example\n * ```tsx\n * <TooltipProvider>\n * <Tooltip>\n * <TooltipTrigger>Hover me</TooltipTrigger>\n * <TooltipContent>Tooltip content</TooltipContent>\n * </Tooltip>\n * </TooltipProvider>\n * ```\n */\nconst TooltipProvider = TooltipPrimitive.Provider\n\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]\",\n className\n )}\n {...props}\n />\n </TooltipPrimitive.Portal>\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
declare const typographyVariants: (props?: ({
|
|
6
|
+
variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "blockquote" | "list" | "lead" | "large" | "small" | "muted" | null | undefined;
|
|
7
|
+
align?: "left" | "center" | "right" | "justify" | null | undefined;
|
|
8
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
9
|
+
interface TypographyProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof typographyVariants> {
|
|
10
|
+
as?: React.ElementType;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Typography component for creating accessible text elements.
|
|
14
|
+
* Built on top of shadcn/ui's Typography component.
|
|
15
|
+
*
|
|
16
|
+
* @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-typography--docs
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
declare const Typography: React.ForwardRefExoticComponent<TypographyProps & React.RefAttributes<HTMLElement>>;
|
|
20
|
+
|
|
21
|
+
type TypographyVariant = NonNullable<VariantProps<typeof typographyVariants>["variant"]>;
|
|
22
|
+
type TypographyAlign = NonNullable<VariantProps<typeof typographyVariants>["align"]>;
|
|
23
|
+
|
|
24
|
+
export { Typography, type TypographyAlign, type TypographyProps, type TypographyVariant, typographyVariants };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as r from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsx}from'react/jsx-runtime';function e(...t){return twMerge(clsx(t))}var c=cva("",{variants:{variant:{h1:"scroll-m-5 text-4xl font-extrabold tracking-tight lg:text-5xl",h2:"scroll-m-5 text-3xl font-semibold tracking-tight",h3:"scroll-m-5 text-2xl font-semibold tracking-tight",h4:"scroll-m-5 text-xl font-semibold tracking-tight",h5:"scroll-m-5 text-lg font-semibold tracking-tight",h6:"scroll-m-5 text-base font-semibold tracking-tight",p:"leading-7 [&:not(:first-child)]:mt-6",blockquote:"mt-6 border-l-2 border-slate-300 pl-6 italic",list:"my-6 ml-6 list-disc [&>li]:mt-2",lead:"text-xl text-muted-foreground",large:"text-lg font-semibold",small:"text-sm font-medium leading-none",muted:"text-sm text-muted-foreground"},align:{left:"text-left",center:"text-center",right:"text-right",justify:"text-justify"}},defaultVariants:{variant:"p",align:"left"}}),f=r.forwardRef(({className:t,variant:o,align:l,as:a="p",...i},n)=>jsx(a,{className:e(c({variant:o,align:l,className:t})),ref:n,...i}));f.displayName="Typography";export{f as Typography,c as typographyVariants};//# sourceMappingURL=index.mjs.map
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/cn.ts","../../src/components/atoms/typography/typography.tsx"],"names":["cn","inputs","twMerge","clsx","typographyVariants","cva","Typography","className","variant","align","Component","props","ref","jsx"],"mappings":"oKAGO,SAASA,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAAA,CAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CCDMG,IAAAA,CAAAA,CAAqBC,GAAI,CAAA,EAAA,CAAI,CACjC,QAAA,CAAU,CACR,OAAA,CAAS,CACP,EAAA,CAAI,+DACJ,CAAA,EAAA,CAAI,kDACJ,CAAA,EAAA,CAAI,kDACJ,CAAA,EAAA,CAAI,iDACJ,CAAA,EAAA,CAAI,iDACJ,CAAA,EAAA,CAAI,mDACJ,CAAA,CAAA,CAAG,sCACH,CAAA,UAAA,CAAY,8CACZ,CAAA,IAAA,CAAM,iCACN,CAAA,IAAA,CAAM,+BACN,CAAA,KAAA,CAAO,uBACP,CAAA,KAAA,CAAO,kCACP,CAAA,KAAA,CAAO,+BACT,CAAA,CACA,KAAO,CAAA,CACL,IAAM,CAAA,WAAA,CACN,MAAQ,CAAA,aAAA,CACR,KAAO,CAAA,YAAA,CACP,OAAS,CAAA,cACX,CACF,CAAA,CACA,eAAiB,CAAA,CACf,OAAS,CAAA,GAAA,CACT,KAAO,CAAA,MACT,CACF,CAAC,CAeKC,CAAAA,CAAAA,CAAmB,CACvB,CAAA,UAAA,CAAA,CAAC,CAAE,SAAA,CAAAC,CAAW,CAAA,OAAA,CAAAC,CAAS,CAAA,KAAA,CAAAC,CAAO,CAAA,EAAA,CAAIC,CAAY,CAAA,GAAA,CAAK,GAAGC,CAAM,CAAGC,CAAAA,CAAAA,GAE3DC,GAACH,CAAAA,CAAAA,CAAA,CACC,SAAA,CAAWV,CAAGI,CAAAA,CAAAA,CAAmB,CAAE,OAAA,CAAAI,CAAS,CAAA,KAAA,CAAAC,CAAO,CAAA,SAAA,CAAAF,CAAU,CAAC,CAAC,CAAA,CAC/D,GAAKK,CAAAA,CAAAA,CACJ,GAAGD,CAAAA,CACN,CAGN,EAEAL,EAAW,WAAc,CAAA,YAAA","file":"index.mjs","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import * as React from \"react\"\nimport { cn } from \"@/utils\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nconst typographyVariants = cva(\"\", {\n variants: {\n variant: {\n h1: \"scroll-m-5 text-4xl font-extrabold tracking-tight lg:text-5xl\",\n h2: \"scroll-m-5 text-3xl font-semibold tracking-tight\",\n h3: \"scroll-m-5 text-2xl font-semibold tracking-tight\",\n h4: \"scroll-m-5 text-xl font-semibold tracking-tight\",\n h5: \"scroll-m-5 text-lg font-semibold tracking-tight\",\n h6: \"scroll-m-5 text-base font-semibold tracking-tight\",\n p: \"leading-7 [&:not(:first-child)]:mt-6\",\n blockquote: \"mt-6 border-l-2 border-slate-300 pl-6 italic\",\n list: \"my-6 ml-6 list-disc [&>li]:mt-2\",\n lead: \"text-xl text-muted-foreground\",\n large: \"text-lg font-semibold\",\n small: \"text-sm font-medium leading-none\",\n muted: \"text-sm text-muted-foreground\"\n },\n align: {\n left: \"text-left\",\n center: \"text-center\",\n right: \"text-right\",\n justify: \"text-justify\"\n }\n },\n defaultVariants: {\n variant: \"p\",\n align: \"left\"\n }\n})\n\nexport interface TypographyProps\n extends React.HTMLAttributes<HTMLElement>,\n VariantProps<typeof typographyVariants> {\n as?: React.ElementType\n}\n\n/**\n * Typography component for creating accessible text elements.\n * Built on top of shadcn/ui's Typography component.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-typography--docs\n *\n */\nconst Typography = React.forwardRef<HTMLElement, TypographyProps>(\n ({ className, variant, align, as: Component = \"p\", ...props }, ref) => {\n return (\n <Component\n className={cn(typographyVariants({ variant, align, className }))}\n ref={ref}\n {...props}\n />\n )\n }\n)\n\nTypography.displayName = \"Typography\"\n\nexport { Typography, typographyVariants }\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/cn.ts"],"names":["cn","inputs","twMerge","clsx"],"mappings":"6DAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,OAAAA,CAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B","file":"index.mjs","sourcesContent":["import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"]}
|