@lgsm/modules 1.0.2 → 1.1.0

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/README.md CHANGED
@@ -39,3 +39,36 @@ Link download : https://www.npmjs.com/package/@lgsm/modules
39
39
  | `build-storybook` | Build the Storybook `dist`. |
40
40
  | `test` | Run the tests with **Vitest** using `jsdom` and starts a **Vitest UI** dev server. |
41
41
  | `coverage` | Generate a coverage report, with **v8**. |
42
+
43
+ ## How to setup API Service
44
+ 1. Create your environment files (eg: '.env.dev' or '.env.prod') and define your base URL
45
+ ```
46
+ VITE_BASE_URL=https://your-api-domain.com
47
+ ```
48
+ 2. Update your package.json to include appropriate Vite modes for each environment
49
+ ```"scripts": {
50
+ "dev": "vite --mode dev [your settings]",
51
+ "prod": "vite --mode prod [your settings]"
52
+ }
53
+ ```
54
+ 3. In your main.tsx, (or wherever your app initializes), import and set up the base URL using setupBaseURL.
55
+ ```
56
+ import { setupBaseURL } from "@lgsm/modules";
57
+
58
+ setupBaseURL(import.meta.env.VITE_BASE_URL);
59
+ ```
60
+ 4. The API client automatically handles certain error codes and displays notifications (popups). To enable this behavior, make sure the NotificationContainer component is rendered at the root level of your app, for example in App.tsx:
61
+ ```
62
+ <ErrorBoundary fallback={}>
63
+ <Suspense fallback={<ThreeDotsLoader />}>
64
+ <NotificationContainer />
65
+ </Suspense>
66
+ </ErrorBoundary>
67
+ ```
68
+
69
+ ## Usage Example
70
+ Please refer to:
71
+ ### For API Service
72
+ src > usage-example > example-apiService.tsx
73
+ ### For Components
74
+ src > usage-example > example-components.tsx
@@ -0,0 +1,11 @@
1
+ interface Config {
2
+ headers?: Record<string, string>;
3
+ [key: string]: any;
4
+ }
5
+ declare const apiService: {
6
+ get: (url: string, config?: Config) => Promise<import('axios').AxiosResponse<any, any, {}>>;
7
+ post: (url: string, config?: Config) => Promise<import('axios').AxiosResponse<any, any, {}>>;
8
+ patch: (url: string, config?: Config) => Promise<import('axios').AxiosResponse<any, any, {}>>;
9
+ delete: (url: string, config?: Config) => Promise<import('axios').AxiosResponse<any, any, {}>>;
10
+ };
11
+ export default apiService;
@@ -0,0 +1,4 @@
1
+ import { AxiosInstance } from 'axios';
2
+ declare let axiosInstance: AxiosInstance;
3
+ export declare function setupBaseURL(baseUrl: string): void;
4
+ export { axiosInstance };
@@ -0,0 +1 @@
1
+ /*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){::-ms-backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-duration:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-duration:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-500:oklch(63.7% .237 25.331);--color-yellow-400:oklch(85.2% .199 91.936);--color-green-600:oklch(62.7% .194 149.214);--color-gray-700:oklch(37.3% .034 259.733);--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--leading-relaxed:1.625;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{::-ms-backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::-webkit-file-upload-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::-webkit-file-upload-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::-webkit-file-upload-button{margin-inline-end:4px}::file-selector-button{margin-inline-end:4px}::-moz-placeholder{opacity:1}::-ms-input-placeholder{opacity:1}::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){::-moz-placeholder{color:currentColor}::-ms-input-placeholder{color:currentColor}::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::-moz-placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}::-ms-input-placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-file-upload-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){*{outline-color:color-mix(in oklab,var(--ring)50%,transparent)}}body{background-color:var(--background);color:var(--foreground)}}@layer components;@layer utilities{.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.top-4{top:calc(var(--spacing)*4)}.left-1\/2{left:50%}.z-50{z-index:50}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.fast-center{justify-content:center;align-items:center;display:flex}.flex{display:flex}.inline-flex{display:inline-flex}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.w-9{width:calc(var(--spacing)*9)}.w-\[90\%\]{width:90%}.w-full{width:100%}.max-w-sm{max-width:var(--container-sm)}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing)*2)}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-destructive\/50{border-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.border-destructive\/50{border-color:color-mix(in oklab,var(--destructive)50%,transparent)}}.border-input{border-color:var(--input)}.bg-background{background-color:var(--background)}.bg-destructive{background-color:var(--destructive)}.bg-primary{background-color:var(--primary)}.bg-red-lgsm{background-color:#a50034}.bg-secondary{background-color:var(--secondary)}.bg-white{background-color:var(--color-white)}.p-4{padding:calc(var(--spacing)*4)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.font-lg-smart{font-family:LG Smart,sans-serif}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.whitespace-nowrap{white-space:nowrap}.text-base-gray{color:#a8a196}.text-destructive{color:var(--destructive)}.text-foreground{color:var(--foreground)}.text-gray-700{color:var(--color-gray-700)}.text-green-600{color:var(--color-green-600)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-red-500{color:var(--color-red-500)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-yellow-400{color:var(--color-yellow-400)}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.accent-foreground{accent-color:var(--foreground)}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-500{--tw-duration:.5s;transition-duration:.5s;animation-duration:.5s}@media (hover:hover){.hover\:bg-accent:hover{background-color:var(--accent)}.hover\:bg-base-light-gray\/50:hover{background-color:#bdbdbd80}.hover\:bg-destructive\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--destructive)90%,transparent)}}.hover\:bg-red-lgsm-hover\/90:hover{background-color:#d2809ae6}.hover\:bg-secondary\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--secondary)80%,transparent)}}.hover\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\:underline:hover{text-decoration-line:underline}}.focus-visible\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:var(--ring)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:opacity-50:disabled{opacity:.5}.dark\:border-destructive:is(.dark *){border-color:var(--destructive)}.\[\&_p\]\:leading-relaxed p{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:top-4>svg{top:calc(var(--spacing)*4)}.\[\&\>svg\]\:left-4>svg{left:calc(var(--spacing)*4)}.\[\&\>svg\]\:text-destructive>svg{color:var(--destructive)}.\[\&\>svg\]\:text-foreground>svg{color:var(--foreground)}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y:-3px;translate:var(--tw-translate-x)var(--tw-translate-y)}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:calc(var(--spacing)*7)}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}@font-face{font-family:LG Smart;src:url(/fonts/LG_Smart/LGSmart-Regular.ttf)format("truetype");font-weight:400;font-style:normal}:root{--radius:.625rem;--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(55.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--destructive:oklch(57.7% .245 27.325);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--chart-1:oklch(64.6% .222 41.116);--chart-2:oklch(60% .118 184.704);--chart-3:oklch(39.8% .07 227.392);--chart-4:oklch(82.8% .189 84.429);--chart-5:oklch(76.9% .188 70.08);--sidebar:oklch(98.5% 0 0);--sidebar-foreground:oklch(14.5% 0 0);--sidebar-primary:oklch(20.5% 0 0);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(97% 0 0);--sidebar-accent-foreground:oklch(20.5% 0 0);--sidebar-border:oklch(92.2% 0 0);--sidebar-ring:oklch(70.8% 0 0)}.dark{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20.5% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(70.4% .191 22.216);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--chart-1:oklch(48.8% .243 264.376);--chart-2:oklch(69.6% .17 162.48);--chart-3:oklch(76.9% .188 70.08);--chart-4:oklch(62.7% .265 303.9);--chart-5:oklch(64.5% .246 16.439);--sidebar:oklch(20.5% 0 0);--sidebar-foreground:oklch(98.5% 0 0);--sidebar-primary:oklch(48.8% .243 264.376);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(26.9% 0 0);--sidebar-accent-foreground:oklch(98.5% 0 0);--sidebar-border:oklch(100% 0 0/.1);--sidebar-ring:oklch(55.6% 0 0)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0)scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1))rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0)scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1))rotate(var(--tw-exit-rotate,0))}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}
@@ -0,0 +1,9 @@
1
+ import { JSX } from 'react';
2
+ interface ComponentProps extends React.ComponentProps<'button'> {
3
+ primary: boolean;
4
+ size?: 'small' | 'medium' | 'large';
5
+ label: string;
6
+ icon?: JSX.Element;
7
+ }
8
+ export declare function Button({ primary, size, label, icon, ...props }: ComponentProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,129 @@
1
+ import { jsx as c, Fragment as m, jsxs as h } from "react/jsx-runtime";
2
+ import { c as b, a as v } from "../../utils-DGFEERe-.js";
3
+ import * as s from "react";
4
+ function g(e, t) {
5
+ if (typeof e == "function")
6
+ return e(t);
7
+ e != null && (e.current = t);
8
+ }
9
+ function x(...e) {
10
+ return (t) => {
11
+ let o = !1;
12
+ const r = e.map((n) => {
13
+ const i = g(n, t);
14
+ return !o && typeof i == "function" && (o = !0), i;
15
+ });
16
+ if (o)
17
+ return () => {
18
+ for (let n = 0; n < r.length; n++) {
19
+ const i = r[n];
20
+ typeof i == "function" ? i() : g(e[n], null);
21
+ }
22
+ };
23
+ };
24
+ }
25
+ // @__NO_SIDE_EFFECTS__
26
+ function C(e) {
27
+ const t = /* @__PURE__ */ E(e), o = s.forwardRef((r, n) => {
28
+ const { children: i, ...a } = r, l = s.Children.toArray(i), u = l.find(w);
29
+ if (u) {
30
+ const f = u.props.children, y = l.map((p) => p === u ? s.Children.count(f) > 1 ? s.Children.only(null) : s.isValidElement(f) ? f.props.children : null : p);
31
+ return /* @__PURE__ */ c(t, { ...a, ref: n, children: s.isValidElement(f) ? s.cloneElement(f, void 0, y) : null });
32
+ }
33
+ return /* @__PURE__ */ c(t, { ...a, ref: n, children: i });
34
+ });
35
+ return o.displayName = `${e}.Slot`, o;
36
+ }
37
+ var S = /* @__PURE__ */ C("Slot");
38
+ // @__NO_SIDE_EFFECTS__
39
+ function E(e) {
40
+ const t = s.forwardRef((o, r) => {
41
+ const { children: n, ...i } = o;
42
+ if (s.isValidElement(n)) {
43
+ const a = V(n), l = N(i, n.props);
44
+ return n.type !== s.Fragment && (l.ref = r ? x(r, a) : a), s.cloneElement(n, l);
45
+ }
46
+ return s.Children.count(n) > 1 ? s.Children.only(null) : null;
47
+ });
48
+ return t.displayName = `${e}.SlotClone`, t;
49
+ }
50
+ var R = Symbol("radix.slottable");
51
+ function w(e) {
52
+ return s.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === R;
53
+ }
54
+ function N(e, t) {
55
+ const o = { ...t };
56
+ for (const r in t) {
57
+ const n = e[r], i = t[r];
58
+ /^on[A-Z]/.test(r) ? n && i ? o[r] = (...l) => {
59
+ const u = i(...l);
60
+ return n(...l), u;
61
+ } : n && (o[r] = n) : r === "style" ? o[r] = { ...n, ...i } : r === "className" && (o[r] = [n, i].filter(Boolean).join(" "));
62
+ }
63
+ return { ...e, ...o };
64
+ }
65
+ function V(e) {
66
+ var r, n;
67
+ let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, o = t && "isReactWarning" in t && t.isReactWarning;
68
+ return o ? e.ref : (t = (n = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : n.get, o = t && "isReactWarning" in t && t.isReactWarning, o ? e.props.ref : e.props.ref || e.ref);
69
+ }
70
+ const _ = v(
71
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
72
+ {
73
+ variants: {
74
+ variant: {
75
+ default: "bg-primary text-primary-foreground text-base font-lg-smart font-semibold rounded-xl shadow hover:bg-red-lgsm-hover/90",
76
+ // destructive:
77
+ // "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
78
+ // outline:
79
+ // "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
80
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
81
+ ghost: "hover:bg-accent hover:text-accent-foreground",
82
+ link: "text-primary underline-offset-4 hover:underline"
83
+ },
84
+ size: {
85
+ default: "h-9 px-4 py-2",
86
+ sm: "h-8 rounded-md px-3 text-xs",
87
+ lg: "h-10 rounded-md px-8",
88
+ icon: "h-9 w-9"
89
+ }
90
+ },
91
+ defaultVariants: {
92
+ variant: "default",
93
+ size: "default"
94
+ }
95
+ }
96
+ ), d = s.forwardRef(
97
+ ({ className: e, variant: t, size: o, asChild: r = !1, ...n }, i) => /* @__PURE__ */ c(
98
+ r ? S : "button",
99
+ {
100
+ className: b(_({ variant: t, size: o, className: e })),
101
+ ref: i,
102
+ ...n
103
+ }
104
+ )
105
+ );
106
+ d.displayName = "Button";
107
+ function I({ primary: e = !1, size: t = "medium", label: o, icon: r, ...n }) {
108
+ return /* @__PURE__ */ c(m, { children: e ? /* @__PURE__ */ h(
109
+ d,
110
+ {
111
+ className: "bg-red-lgsm",
112
+ ...n,
113
+ children: [
114
+ r !== null ? r : /* @__PURE__ */ c(m, {}),
115
+ o
116
+ ]
117
+ }
118
+ ) : /* @__PURE__ */ c(
119
+ d,
120
+ {
121
+ className: "bg-white text-base-gray hover:bg-base-light-gray/50",
122
+ ...n,
123
+ children: o
124
+ }
125
+ ) });
126
+ }
127
+ export {
128
+ I as Button
129
+ };
@@ -1,50 +1,52 @@
1
- import { jsxs as a, jsx as o } from "react/jsx-runtime";
2
- import { useState as f } from "react";
3
- import { MyButton as r } from "../MyButton/index.js";
4
- import '../../assets/index2.css';const y = "_container_rjlrw_1", C = "_text_rjlrw_11", m = {
5
- container: y,
6
- text: C
1
+ import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
+ import { useState as p } from "react";
3
+ import { Button as o } from "../Button/index.js";
4
+ import '../../assets/index2.css';const x = "_container_rjlrw_1", y = "_text_rjlrw_11", m = {
5
+ container: x,
6
+ text: y
7
7
  };
8
8
  function h({
9
9
  initialValue: c = 0,
10
10
  step: s = 1,
11
11
  min: i = -1 / 0,
12
- max: l = 1 / 0
12
+ max: a = 1 / 0
13
13
  }) {
14
- const [t, e] = f(c), u = () => {
15
- e((n) => Math.min(n + s, l));
14
+ const [t, e] = p(c), u = () => {
15
+ e((n) => Math.min(n + s, a));
16
16
  }, d = () => {
17
17
  e((n) => Math.max(n - s, i));
18
- }, x = () => {
18
+ }, f = () => {
19
19
  e(c);
20
20
  };
21
- return /* @__PURE__ */ a("section", { className: m.container, children: [
22
- /* @__PURE__ */ a("p", { className: m.text, children: [
21
+ return /* @__PURE__ */ l("section", { className: m.container, children: [
22
+ /* @__PURE__ */ l("p", { className: m.text, children: [
23
23
  "Count: ",
24
24
  t
25
25
  ] }),
26
- /* @__PURE__ */ o(
27
- r,
26
+ /* @__PURE__ */ r(
27
+ o,
28
28
  {
29
+ primary: !0,
29
30
  label: "Increment",
30
31
  onClick: u,
31
- disabled: t >= l
32
+ disabled: t >= a
32
33
  }
33
34
  ),
34
- /* @__PURE__ */ o(
35
- r,
35
+ /* @__PURE__ */ r(
36
+ o,
36
37
  {
38
+ primary: !0,
37
39
  label: "Decrement",
38
40
  onClick: d,
39
41
  disabled: t <= i
40
42
  }
41
43
  ),
42
- /* @__PURE__ */ o(
43
- r,
44
+ /* @__PURE__ */ r(
45
+ o,
44
46
  {
45
47
  label: "Reset",
46
- onClick: x,
47
- primary: !0
48
+ onClick: f,
49
+ primary: !1
48
50
  }
49
51
  )
50
52
  ] });
@@ -0,0 +1 @@
1
+ export declare function NotificationContainer(): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,9 @@
1
+ interface ComponentProps {
2
+ type?: string;
3
+ title: string;
4
+ message: string;
5
+ onClose: () => void;
6
+ duration?: number;
7
+ }
8
+ export declare function Notification({ type, title, message, onClose, duration }: ComponentProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,190 @@
1
+ import { jsx as o, jsxs as p } from "react/jsx-runtime";
2
+ import { c as m, a as N } from "../../utils-DGFEERe-.js";
3
+ import * as u from "react";
4
+ import { forwardRef as x, createElement as d, useState as C, useEffect as A } from "react";
5
+ /**
6
+ * @license lucide-react v0.544.0 - ISC
7
+ *
8
+ * This source code is licensed under the ISC license.
9
+ * See the LICENSE file in the root directory of this source tree.
10
+ */
11
+ const _ = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), $ = (t) => t.replace(
12
+ /^([A-Z])|[\s-_]+(\w)/g,
13
+ (e, r, a) => a ? a.toUpperCase() : r.toLowerCase()
14
+ ), g = (t) => {
15
+ const e = $(t);
16
+ return e.charAt(0).toUpperCase() + e.slice(1);
17
+ }, y = (...t) => t.filter((e, r, a) => !!e && e.trim() !== "" && a.indexOf(e) === r).join(" ").trim(), z = (t) => {
18
+ for (const e in t)
19
+ if (e.startsWith("aria-") || e === "role" || e === "title")
20
+ return !0;
21
+ };
22
+ /**
23
+ * @license lucide-react v0.544.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */
28
+ var T = {
29
+ xmlns: "http://www.w3.org/2000/svg",
30
+ width: 24,
31
+ height: 24,
32
+ viewBox: "0 0 24 24",
33
+ fill: "none",
34
+ stroke: "currentColor",
35
+ strokeWidth: 2,
36
+ strokeLinecap: "round",
37
+ strokeLinejoin: "round"
38
+ };
39
+ /**
40
+ * @license lucide-react v0.544.0 - ISC
41
+ *
42
+ * This source code is licensed under the ISC license.
43
+ * See the LICENSE file in the root directory of this source tree.
44
+ */
45
+ const L = x(
46
+ ({
47
+ color: t = "currentColor",
48
+ size: e = 24,
49
+ strokeWidth: r = 2,
50
+ absoluteStrokeWidth: a,
51
+ className: i = "",
52
+ children: s,
53
+ iconNode: l,
54
+ ...c
55
+ }, n) => d(
56
+ "svg",
57
+ {
58
+ ref: n,
59
+ ...T,
60
+ width: e,
61
+ height: e,
62
+ stroke: t,
63
+ strokeWidth: a ? Number(r) * 24 / Number(e) : r,
64
+ className: y("lucide", i),
65
+ ...!s && !z(c) && { "aria-hidden": "true" },
66
+ ...c
67
+ },
68
+ [
69
+ ...l.map(([k, b]) => d(k, b)),
70
+ ...Array.isArray(s) ? s : [s]
71
+ ]
72
+ )
73
+ );
74
+ /**
75
+ * @license lucide-react v0.544.0 - ISC
76
+ *
77
+ * This source code is licensed under the ISC license.
78
+ * See the LICENSE file in the root directory of this source tree.
79
+ */
80
+ const f = (t, e) => {
81
+ const r = x(
82
+ ({ className: a, ...i }, s) => d(L, {
83
+ ref: s,
84
+ iconNode: e,
85
+ className: y(
86
+ `lucide-${_(g(t))}`,
87
+ `lucide-${t}`,
88
+ a
89
+ ),
90
+ ...i
91
+ })
92
+ );
93
+ return r.displayName = g(t), r;
94
+ };
95
+ /**
96
+ * @license lucide-react v0.544.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */
101
+ const R = [
102
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
103
+ ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
104
+ ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
105
+ ], j = f("circle-alert", R);
106
+ /**
107
+ * @license lucide-react v0.544.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */
112
+ const V = [
113
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
114
+ ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
115
+ ], q = f("circle-check", V);
116
+ /**
117
+ * @license lucide-react v0.544.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */
122
+ const B = [
123
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
124
+ ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
125
+ ["path", { d: "m9 9 6 6", key: "z0biqf" }]
126
+ ], D = f("circle-x", B), E = N(
127
+ "relative w-full rounded-lg px-4 py-3 font-lg-smart text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
128
+ {
129
+ variants: {
130
+ variant: {
131
+ default: "bg-background text-foreground",
132
+ destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
133
+ }
134
+ },
135
+ defaultVariants: {
136
+ variant: "default"
137
+ }
138
+ }
139
+ ), v = u.forwardRef(({ className: t, variant: e, ...r }, a) => /* @__PURE__ */ o(
140
+ "div",
141
+ {
142
+ ref: a,
143
+ role: "alert",
144
+ className: m(E({ variant: e }), t),
145
+ ...r
146
+ }
147
+ ));
148
+ v.displayName = "Alert";
149
+ const h = u.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ o(
150
+ "h5",
151
+ {
152
+ ref: r,
153
+ className: m("mb-1 font-semibold text-lg leading-none tracking-tight", t),
154
+ ...e
155
+ }
156
+ ));
157
+ h.displayName = "AlertTitle";
158
+ const w = u.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ o(
159
+ "div",
160
+ {
161
+ ref: r,
162
+ className: m("text-sm [&_p]:leading-relaxed", t),
163
+ ...e
164
+ }
165
+ ));
166
+ w.displayName = "AlertDescription";
167
+ function U({ type: t, title: e, message: r, onClose: a, duration: i = 3e3 }) {
168
+ const [s, l] = C(!0);
169
+ return A(() => {
170
+ const c = setTimeout(() => l(!1), i - 500), n = setTimeout(a, 3e3);
171
+ return () => {
172
+ clearTimeout(c), clearTimeout(n);
173
+ };
174
+ }, [i, a]), /* @__PURE__ */ p(
175
+ v,
176
+ {
177
+ className: `fixed top-4 left-1/2 -translate-x-1/2 z-50 bg-white shadow-2xl max-w-sm w-[90%] p-4 animate-slide-in transition-opacity duration-500 ${s ? "opacity-100" : "opacity-0"}`,
178
+ children: [
179
+ /* @__PURE__ */ p("div", { className: "flex mb-4 gap-2", children: [
180
+ t === "success" ? /* @__PURE__ */ o(q, { className: "text-green-600", size: 18 }) : t === "error" ? /* @__PURE__ */ o(D, { className: "text-red-500", size: 18 }) : /* @__PURE__ */ o(j, { className: "text-yellow-400", size: 18 }),
181
+ /* @__PURE__ */ o(h, { children: e })
182
+ ] }),
183
+ /* @__PURE__ */ o(w, { className: "text-gray-700 leading-relaxed", children: r })
184
+ ]
185
+ }
186
+ );
187
+ }
188
+ export {
189
+ U as Notification
190
+ };
@@ -0,0 +1,8 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as React from "react";
3
+ declare const Alert: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
4
+ variant?: "default" | "destructive" | null | undefined;
5
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
6
+ declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
7
+ declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
8
+ export { Alert, AlertTitle, AlertDescription };
@@ -0,0 +1,11 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as React from "react";
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "default" | "secondary" | "ghost" | "link" | null | undefined;
5
+ size?: "default" | "sm" | "lg" | "icon" | null | undefined;
6
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
+ asChild?: boolean;
9
+ }
10
+ declare const ButtonLib: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
+ export { ButtonLib, buttonVariants };
@@ -0,0 +1,2 @@
1
+ import { ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
package/dist/main.d.ts CHANGED
@@ -1,3 +1,8 @@
1
- export { MyButton } from './components/MyButton';
1
+ export { Button } from './components/Button';
2
2
  export { MyCounter } from './components/MyCounter';
3
3
  export { MyTitle } from './components/MyTitle';
4
+ export { Notification } from './components/Notification';
5
+ export { NotificationContainer } from './components/Notification/NotificationContainer';
6
+ export { useNotificationStore } from './store/notificationStore';
7
+ export { default as apiService } from './api/apiService';
8
+ export { setupBaseURL } from './api/axiosInstance';