@zimyo/ui 1.11.0 → 1.11.1
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/package.json +6 -1
- package/dist/chunks/Calender-0d04996d.js +0 -1
- package/dist/chunks/Calender-1b3e5e03.esm.js +0 -1
- package/dist/chunks/Heading-177b03ef.esm.js +0 -1
- package/dist/chunks/Heading-ff5c771d.js +0 -1
- package/dist/chunks/Muted-7d9a3dca.esm.js +0 -1
- package/dist/chunks/Muted-d2dbaba3.js +0 -1
- package/dist/chunks/Text-18106168.esm.js +0 -1
- package/dist/chunks/Text-e9636dd7.js +0 -1
- package/dist/chunks/_commonjsHelpers-02d3be64.esm.js +0 -1
- package/dist/chunks/_commonjsHelpers-3d4c1909.js +0 -1
- package/dist/chunks/assertThisInitialized-406be690.esm.js +0 -1
- package/dist/chunks/assertThisInitialized-d31798d4.js +0 -1
- package/dist/chunks/index-32c3a4e2.esm.js +0 -1
- package/dist/chunks/index-5b35e7d9.esm.js +0 -1
- package/dist/chunks/index-76f24a60.js +0 -1
- package/dist/chunks/index-90b71f01.js +0 -1
- package/dist/chunks/index-a7c3d9a4.esm.js +0 -1
- package/dist/chunks/index-ca2c3710.js +0 -1
- package/dist/chunks/lucide-493ccaad.js +0 -26
- package/dist/chunks/lucide-8c9441ea.esm.js +0 -26
- package/dist/chunks/tslib.es6-6cad17f3.esm.js +0 -1
- package/dist/chunks/tslib.es6-a3dc1f53.js +0 -1
- package/dist/chunks/typeof-b30b964a.js +0 -1
- package/dist/chunks/typeof-cc63ab7d.esm.js +0 -1
- package/dist/components/Accordion/index.d.ts +0 -34
- package/dist/components/Accordion/index.esm.js +0 -1
- package/dist/components/Accordion/index.js +0 -1
- package/dist/components/AppList/index.d.ts +0 -27
- package/dist/components/AppList/index.esm.js +0 -1
- package/dist/components/AppList/index.js +0 -1
- package/dist/components/Badge/index.d.ts +0 -29
- package/dist/components/Badge/index.esm.js +0 -1
- package/dist/components/Badge/index.js +0 -1
- package/dist/components/BulkActionsBar/index.d.ts +0 -23
- package/dist/components/BulkActionsBar/index.esm.js +0 -1
- package/dist/components/BulkActionsBar/index.js +0 -1
- package/dist/components/Button/index.d.ts +0 -15
- package/dist/components/Button/index.esm.js +0 -1
- package/dist/components/Button/index.js +0 -1
- package/dist/components/Card/index.d.ts +0 -73
- package/dist/components/Card/index.esm.js +0 -1
- package/dist/components/Card/index.js +0 -1
- package/dist/components/Charts/index.d.ts +0 -58
- package/dist/components/Charts/index.esm.js +0 -10
- package/dist/components/Charts/index.js +0 -10
- package/dist/components/Checkbox/index.d.ts +0 -14
- package/dist/components/Checkbox/index.esm.js +0 -1
- package/dist/components/Checkbox/index.js +0 -1
- package/dist/components/CheckboxGroup/index.d.ts +0 -31
- package/dist/components/CheckboxGroup/index.esm.js +0 -1
- package/dist/components/CheckboxGroup/index.js +0 -1
- package/dist/components/DataTable/index.d.ts +0 -70
- package/dist/components/DataTable/index.esm.js +0 -23
- package/dist/components/DataTable/index.js +0 -22
- package/dist/components/DatePicker/index.d.ts +0 -40
- package/dist/components/DatePicker/index.esm.js +0 -1
- package/dist/components/DatePicker/index.js +0 -1
- package/dist/components/DateRangePicker/index.d.ts +0 -29
- package/dist/components/DateRangePicker/index.esm.js +0 -1
- package/dist/components/DateRangePicker/index.js +0 -1
- package/dist/components/Form/index.d.ts +0 -35
- package/dist/components/Form/index.esm.js +0 -1
- package/dist/components/Form/index.js +0 -1
- package/dist/components/GlobalMenuSearch/index.d.ts +0 -16
- package/dist/components/GlobalMenuSearch/index.esm.js +0 -1
- package/dist/components/GlobalMenuSearch/index.js +0 -1
- package/dist/components/Input/index.d.ts +0 -25
- package/dist/components/Input/index.esm.js +0 -1
- package/dist/components/Input/index.js +0 -1
- package/dist/components/Modal/index.d.ts +0 -20
- package/dist/components/Modal/index.esm.js +0 -1
- package/dist/components/Modal/index.js +0 -1
- package/dist/components/Notice/index.d.ts +0 -19
- package/dist/components/Notice/index.esm.js +0 -1
- package/dist/components/Notice/index.js +0 -1
- package/dist/components/Popover/index.d.ts +0 -19
- package/dist/components/Popover/index.esm.js +0 -1
- package/dist/components/Popover/index.js +0 -1
- package/dist/components/PopupConfirm/index.d.ts +0 -36
- package/dist/components/PopupConfirm/index.esm.js +0 -1
- package/dist/components/PopupConfirm/index.js +0 -1
- package/dist/components/Radio/index.d.ts +0 -24
- package/dist/components/Radio/index.esm.js +0 -1
- package/dist/components/Radio/index.js +0 -1
- package/dist/components/RadioGroup/index.d.ts +0 -31
- package/dist/components/RadioGroup/index.esm.js +0 -1
- package/dist/components/RadioGroup/index.js +0 -1
- package/dist/components/Select/index.d.ts +0 -36
- package/dist/components/Select/index.esm.js +0 -1
- package/dist/components/Select/index.js +0 -1
- package/dist/components/Switch/index.d.ts +0 -15
- package/dist/components/Switch/index.esm.js +0 -1
- package/dist/components/Switch/index.js +0 -1
- package/dist/components/Tab/index.d.ts +0 -40
- package/dist/components/Tab/index.esm.js +0 -1
- package/dist/components/Tab/index.js +0 -1
- package/dist/components/Table/index.d.ts +0 -80
- package/dist/components/Table/index.esm.js +0 -1
- package/dist/components/Table/index.js +0 -1
- package/dist/components/TimePicker/index.d.ts +0 -40
- package/dist/components/TimePicker/index.esm.js +0 -1
- package/dist/components/TimePicker/index.js +0 -1
- package/dist/components/Timeline/index.d.ts +0 -26
- package/dist/components/Timeline/index.esm.js +0 -1
- package/dist/components/Timeline/index.js +0 -1
- package/dist/components/Typography/index.d.ts +0 -30
- package/dist/components/Typography/index.esm.js +0 -1
- package/dist/components/Typography/index.js +0 -1
- package/dist/index.d.ts +0 -842
- package/dist/index.esm.js +0 -1
- package/dist/index.js +0 -1
- package/dist/theme/index.d.ts +0 -96
- package/dist/theme/index.esm.js +0 -1
- package/dist/theme/index.js +0 -1
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
type InputSize = "xs" | "sm" | "md" | "lg";
|
|
4
|
-
type DatePickerVariant = "outlined" | "contained";
|
|
5
|
-
interface DateRangePickerProps {
|
|
6
|
-
label?: string;
|
|
7
|
-
value?: {
|
|
8
|
-
from: Date;
|
|
9
|
-
to: Date;
|
|
10
|
-
};
|
|
11
|
-
onChange?: (range: {
|
|
12
|
-
from: Date;
|
|
13
|
-
to: Date;
|
|
14
|
-
} | undefined) => void;
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
required?: boolean;
|
|
17
|
-
description?: string;
|
|
18
|
-
error?: string;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
variant?: DatePickerVariant;
|
|
21
|
-
size?: InputSize;
|
|
22
|
-
className?: string;
|
|
23
|
-
floatingLabel?: boolean;
|
|
24
|
-
isClearable?: boolean;
|
|
25
|
-
}
|
|
26
|
-
declare const DateRangePicker: React.FC<DateRangePickerProps>;
|
|
27
|
-
|
|
28
|
-
export { DateRangePicker, DateRangePicker as default };
|
|
29
|
-
export type { DateRangePickerProps };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as i,jsx as e,Fragment as o}from"react/jsx-runtime";import*as t from"react";import{f as u,C as r,i as n}from"../../chunks/Calender-1b3e5e03.esm.js";import{u as l,a}from"../../chunks/index-32c3a4e2.esm.js";import{Popover as d}from"../Popover/index.esm.js";import{h as s}from"../../chunks/lucide-8c9441ea.esm.js";import"../../chunks/typeof-cc63ab7d.esm.js";import"../../chunks/tslib.es6-6cad17f3.esm.js";import"../Button/index.esm.js";import"@mui/material";var m={xs:"zui:h-9 zui:px-3 zui:text-xs",sm:"zui:h-9 zui:px-3 zui:text-sm",md:"zui:h-10 zui:px-3 zui:text-sm",lg:"zui:h-11 zui:px-3 zui:text-base"},c=function(i){return!!i&&n(i)},z=function(z){var f=z.label,v=z.value,p=z.onChange,h=z.placeholder,x=void 0===h?"Pick a date":h,b=z.required,g=z.description,y=z.error,N=z.disabled,k=z.variant,L=void 0===k?"outlined":k,j=z.size,w=void 0===j?"md":j,C=z.className,F=z.floatingLabel,O=void 0!==F&&F,P=z.isClearable,S=void 0!==P&&P,B=function(i){return{container:i?"zui:opacity-80":"",label:i?"zui:text-gray-500":"zui:text-gray-700",input:i?" zui:cursor-not-allowed zui:opacity-60 zui:text-gray-500 zui:bg-gray-50 zui:border zui:border-gray-300":""}}(N||!1),E=l("date-range"),M=t.useState({from:c(null==v?void 0:v.from)?null==v?void 0:v.from:void 0,to:c(null==v?void 0:v.to)?null==v?void 0:v.to:void 0}),q=M[0],T=M[1];t.useEffect(function(){T({from:c(null==v?void 0:v.from)?null==v?void 0:v.from:void 0,to:c(null==v?void 0:v.to)?null==v?void 0:v.to:void 0})},[v]);var A=t.useState(null),D=A[0],G=A[1];return i("div",{className:a("zui:w-full zui:space-y-1",B.container,C),children:[!O&&f&&i("label",{htmlFor:E,className:a("zui:block zui:mb-2 zui:text-sm zui:font-medium zui:leading-none",B.label),children:[f,b&&e("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]}),i("div",{className:a("zui:relative zui:flex zui:items-center zui:justify-between zui:rounded-md zui:border zui:text-sm zui:ring-offset-background zui:transition-colors","focus-within:zui:ring-1 focus-within:zui:ring-ring focus-within:zui:ring-offset-1","outlined"===L&&"zui:bg-background zui:border-input","contained"===L&&"zui:bg-muted zui:border-transparent",y&&"zui:border-destructive focus-within:zui:ring-destructive",m[w],B.input,C),onClick:function(i){return!N&&void G(i.currentTarget)},children:[e("div",{className:"zui:truncate",children:c(null==q?void 0:q.from)?c(null==q?void 0:q.to)?i(o,{children:[u(q.from,"LLL dd, y")," -"," ",u(q.to,"LLL dd, y")]}):u(q.from,"LLL dd, y"):x}),i("div",{className:"zui:flex zui:items-center zui:ml-2",children:[(c(null==q?void 0:q.from)||c(null==q?void 0:q.to))&&S&&e("button",{type:"button",className:"zui:p-1 zui:rounded-full hover:zui:bg-gray-200 zui:text-gray-500",onClick:function(i){i.stopPropagation(),T({from:void 0,to:void 0}),null==p||p(void 0)},children:"✕"}),e(s,{className:"zui:ml-2 zui:h-4 zui:w-4 zui:opacity-50"})]}),O&&f&&i("label",{htmlFor:E,className:a("zui:pointer-events-none zui:absolute zui:left-3 zui:-top-[9px] zui:z-10 zui:bg-background zui:px-1 zui:text-xs zui:text-muted-foreground zui:transition-all",B.label),children:[f,b&&e("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]})]}),e(d,{open:Boolean(D),onClose:function(){G(null)},anchorEl:D,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:e(r,{id:E,autoFocus:!0,mode:"range",defaultMonth:null==q?void 0:q.from,selected:q,onSelect:function(i){var e;(null==i?void 0:i.from)&&n(i.from)?(T(i),i.to&&n(i.to)?null==p||p({from:i.from,to:i.to}):null==p||p({from:i.from,to:null!==(e=i.to)&&void 0!==e?e:i.from})):(T(void 0),null==p||p(void 0))},numberOfMonths:2})}),g&&!y&&e("p",{className:"zui:text-xs zui:text-muted-foreground",children:g}),y&&e("p",{className:"zui:text-xs zui:text-destructive",children:y})]})};export{z as DateRangePicker,z as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),t=require("../../chunks/Calender-0d04996d.js"),u=require("../../chunks/index-90b71f01.js"),r=require("../Popover/index.js"),o=require("../../chunks/lucide-493ccaad.js");function n(e){var i=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var u=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,u.get?u:{enumerable:!0,get:function(){return e[t]}})}}),i.default=e,Object.freeze(i)}require("../../chunks/typeof-b30b964a.js"),require("../../chunks/tslib.es6-a3dc1f53.js"),require("../Button/index.js"),require("@mui/material");var l=n(i),a={xs:"zui:h-9 zui:px-3 zui:text-xs",sm:"zui:h-9 zui:px-3 zui:text-sm",md:"zui:h-10 zui:px-3 zui:text-sm",lg:"zui:h-11 zui:px-3 zui:text-base"},s=function(e){return!!e&&t.isValid(e)},d=function(i){var n=i.label,d=i.value,c=i.onChange,z=i.placeholder,f=void 0===z?"Pick a date":z,m=i.required,v=i.description,x=i.error,b=i.disabled,h=i.variant,g=void 0===h?"outlined":h,p=i.size,j=void 0===p?"md":p,y=i.className,k=i.floatingLabel,N=void 0!==k&&k,q=i.isClearable,L=void 0!==q&&q,O=function(e){return{container:e?"zui:opacity-80":"",label:e?"zui:text-gray-500":"zui:text-gray-700",input:e?" zui:cursor-not-allowed zui:opacity-60 zui:text-gray-500 zui:bg-gray-50 zui:border zui:border-gray-300":""}}(b||!1),w=u.useStableId("date-range"),C=l.useState({from:s(null==d?void 0:d.from)?null==d?void 0:d.from:void 0,to:s(null==d?void 0:d.to)?null==d?void 0:d.to:void 0}),P=C[0],F=C[1];l.useEffect(function(){F({from:s(null==d?void 0:d.from)?null==d?void 0:d.from:void 0,to:s(null==d?void 0:d.to)?null==d?void 0:d.to:void 0})},[d]);var S=l.useState(null),E=S[0],M=S[1];return e.jsxs("div",{className:u.cn("zui:w-full zui:space-y-1",O.container,y),children:[!N&&n&&e.jsxs("label",{htmlFor:w,className:u.cn("zui:block zui:mb-2 zui:text-sm zui:font-medium zui:leading-none",O.label),children:[n,m&&e.jsx("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]}),e.jsxs("div",{className:u.cn("zui:relative zui:flex zui:items-center zui:justify-between zui:rounded-md zui:border zui:text-sm zui:ring-offset-background zui:transition-colors","focus-within:zui:ring-1 focus-within:zui:ring-ring focus-within:zui:ring-offset-1","outlined"===g&&"zui:bg-background zui:border-input","contained"===g&&"zui:bg-muted zui:border-transparent",x&&"zui:border-destructive focus-within:zui:ring-destructive",a[j],O.input,y),onClick:function(e){return!b&&void M(e.currentTarget)},children:[e.jsx("div",{className:"zui:truncate",children:s(null==P?void 0:P.from)?s(null==P?void 0:P.to)?e.jsxs(e.Fragment,{children:[t.format(P.from,"LLL dd, y")," -"," ",t.format(P.to,"LLL dd, y")]}):t.format(P.from,"LLL dd, y"):f}),e.jsxs("div",{className:"zui:flex zui:items-center zui:ml-2",children:[(s(null==P?void 0:P.from)||s(null==P?void 0:P.to))&&L&&e.jsx("button",{type:"button",className:"zui:p-1 zui:rounded-full hover:zui:bg-gray-200 zui:text-gray-500",onClick:function(e){e.stopPropagation(),F({from:void 0,to:void 0}),null==c||c(void 0)},children:"✕"}),e.jsx(o.Calendar,{className:"zui:ml-2 zui:h-4 zui:w-4 zui:opacity-50"})]}),N&&n&&e.jsxs("label",{htmlFor:w,className:u.cn("zui:pointer-events-none zui:absolute zui:left-3 zui:-top-[9px] zui:z-10 zui:bg-background zui:px-1 zui:text-xs zui:text-muted-foreground zui:transition-all",O.label),children:[n,m&&e.jsx("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]})]}),e.jsx(r.Popover,{open:Boolean(E),onClose:function(){M(null)},anchorEl:E,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:e.jsx(t.Calendar,{id:w,autoFocus:!0,mode:"range",defaultMonth:null==P?void 0:P.from,selected:P,onSelect:function(e){var i;(null==e?void 0:e.from)&&t.isValid(e.from)?(F(e),e.to&&t.isValid(e.to)?null==c||c({from:e.from,to:e.to}):null==c||c({from:e.from,to:null!==(i=e.to)&&void 0!==i?i:e.from})):(F(void 0),null==c||c(void 0))},numberOfMonths:2})}),v&&!x&&e.jsx("p",{className:"zui:text-xs zui:text-muted-foreground",children:v}),x&&e.jsx("p",{className:"zui:text-xs zui:text-destructive",children:x})]})};exports.DateRangePicker=d,exports.default=d;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { UseFormReturn, Controller } from 'react-hook-form';
|
|
3
|
-
|
|
4
|
-
type FieldType = "text" | "number" | "textarea" | "select" | "multiselect" | "multi-select" | "timepicker" | "time" | "radio" | "switch" | "checkbox" | "date" | "daterange" | "file" | "custom";
|
|
5
|
-
type FormField = {
|
|
6
|
-
name: string;
|
|
7
|
-
label: string;
|
|
8
|
-
type: FieldType;
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
required?: boolean;
|
|
11
|
-
defaultValue?: any;
|
|
12
|
-
options?: {
|
|
13
|
-
label: string;
|
|
14
|
-
value: any;
|
|
15
|
-
}[];
|
|
16
|
-
validation?: any;
|
|
17
|
-
visibleIf?: (values: any) => boolean;
|
|
18
|
-
component?: React__default.ReactNode;
|
|
19
|
-
colSpan?: number;
|
|
20
|
-
inputProps?: Record<string, any>;
|
|
21
|
-
controllerProps?: Partial<React__default.ComponentProps<typeof Controller>>;
|
|
22
|
-
};
|
|
23
|
-
type FormProps = {
|
|
24
|
-
schema: FormField[];
|
|
25
|
-
form: UseFormReturn;
|
|
26
|
-
layout?: "vertical" | "grid";
|
|
27
|
-
columns?: number;
|
|
28
|
-
className?: string;
|
|
29
|
-
showSubmitButton?: boolean;
|
|
30
|
-
onSubmit?: (data: any) => void;
|
|
31
|
-
};
|
|
32
|
-
declare const Form: React__default.FC<FormProps>;
|
|
33
|
-
|
|
34
|
-
export { Form, Form as default };
|
|
35
|
-
export type { FormProps };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"../../chunks/tslib.es6-6cad17f3.esm.js";import{jsxs as r,jsx as t}from"react/jsx-runtime";import*as n from"react";import a from"react";import{a as s}from"../../chunks/index-32c3a4e2.esm.js";import{Input as i}from"../Input/index.esm.js";import{Select as o}from"../Select/index.esm.js";import{DatePicker as l}from"../DatePicker/index.esm.js";import{DateRangePicker as u}from"../DateRangePicker/index.esm.js";import c from"../Switch/index.esm.js";import{RadioGroup as d}from"../RadioGroup/index.esm.js";import{Button as m}from"../Button/index.esm.js";import{TimePicker as f}from"../TimePicker/index.esm.js";import{Checkbox as p}from"../Checkbox/index.esm.js";import"../../chunks/lucide-8c9441ea.esm.js";import"../../chunks/typeof-cc63ab7d.esm.js";import"../../chunks/assertThisInitialized-406be690.esm.js";import"@emotion/react";import"react-dom";import"../../chunks/Calender-1b3e5e03.esm.js";import"../Popover/index.esm.js";import"@mui/material";import"@mui/material/Popover";import"../../chunks/_commonjsHelpers-02d3be64.esm.js";var v=e=>null==e;var b=e=>!v(e)&&!Array.isArray(e)&&(e=>"object"==typeof e)(e)&&!(e=>e instanceof Date)(e),h=e=>b(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e,y="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function g(e){let r;const t=Array.isArray(e),n="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)r=new Date(e);else{if(y&&(e instanceof Blob||n)||!t&&!b(e))return e;if(r=t?[]:{},t||(e=>{const r=e.constructor&&e.constructor.prototype;return b(r)&&r.hasOwnProperty("isPrototypeOf")})(e))for(const t in e)e.hasOwnProperty(t)&&(r[t]=g(e[t]));else r=e}return r}var x=e=>/^\w*$/.test(e),_=e=>void 0===e,z=e=>{return r=e.replace(/["|']|\]/g,"").split(/\.|\[/),Array.isArray(r)?r.filter(Boolean):[];var r},V=(e,r,t)=>{if(!r||!b(e))return t;const n=(x(r)?[r]:z(r)).reduce((e,r)=>v(e)?e:e[r],e);return _(n)||n===e?_(e[r])?t:e[r]:n},j=e=>"boolean"==typeof e,k=(e,r,t)=>{let n=-1;const a=x(r)?[r]:z(r),s=a.length,i=s-1;for(;++n<s;){const r=a[n];let s=t;if(n!==i){const t=e[r];s=b(t)||Array.isArray(t)?t:isNaN(+a[n+1])?{}:[]}if("__proto__"===r||"constructor"===r||"prototype"===r)return;e[r]=s,e=e[r]}};const N="blur",S="change",w="all",C=a.createContext(null);C.displayName="HookFormContext";const F=()=>a.useContext(C);const P="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function A(e){const r=F(),{control:t=r.control,disabled:n,name:s,exact:i}=e||{},[o,l]=a.useState(t._formState),u=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return P(()=>t._subscribe({name:s,formState:u.current,exact:i,callback:e=>{!n&&l({...t._formState,...e})}}),[s,n,i]),a.useEffect(()=>{u.current.isValid&&t._setValid(!0)},[t]),a.useMemo(()=>((e,r,t,n=!0)=>{const a={defaultValues:r._defaultValues};for(const s in e)Object.defineProperty(a,s,{get:()=>{const a=s;return r._proxyFormState[a]!==w&&(r._proxyFormState[a]=!n||w),t&&(t[a]=!0),e[a]}});return a})(o,t,u.current,!1),[o,t])}function D(e){const r=F(),{control:t=r.control,name:n,defaultValue:s,disabled:i,exact:o}=e||{},l=a.useRef(s),[u,c]=a.useState(t._getWatch(n,l.current));return P(()=>t._subscribe({name:n,formState:{values:!0},exact:o,callback:e=>!i&&c(((e,r,t,n,a)=>"string"==typeof e?(n&&r.watch.add(e),V(t,e,a)):Array.isArray(e)?e.map(e=>(n&&r.watch.add(e),V(t,e))):(n&&(r.watchAll=!0),t))(n,t._names,e.values||t._formValues,!1,l.current))}),[n,t,i,o]),a.useEffect(()=>t._removeUnmounted()),u}const E=e=>e.render(function(e){const r=F(),{name:t,disabled:n,control:s=r.control,shouldUnregister:i}=e,o=((e,r)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(r)))(s._names.array,t),l=D({control:s,name:t,defaultValue:V(s._formValues,t,V(s._defaultValues,t,e.defaultValue)),exact:!0}),u=A({control:s,name:t,exact:!0}),c=a.useRef(e),d=a.useRef(s.register(t,{...e.rules,value:l,...j(e.disabled)?{disabled:e.disabled}:{}})),m=a.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!V(u.errors,t)},isDirty:{enumerable:!0,get:()=>!!V(u.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!V(u.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!V(u.validatingFields,t)},error:{enumerable:!0,get:()=>V(u.errors,t)}}),[u,t]),f=a.useCallback(e=>d.current.onChange({target:{value:h(e),name:t},type:S}),[t]),p=a.useCallback(()=>d.current.onBlur({target:{value:V(s._formValues,t),name:t},type:N}),[t,s._formValues]),v=a.useCallback(e=>{const r=V(s._fields,t);r&&e&&(r._f.ref={focus:()=>e.focus&&e.focus(),select:()=>e.select&&e.select(),setCustomValidity:r=>e.setCustomValidity(r),reportValidity:()=>e.reportValidity()})},[s._fields,t]),b=a.useMemo(()=>({name:t,value:l,...j(n)||u.disabled?{disabled:u.disabled||n}:{},onChange:f,onBlur:p,ref:v}),[t,n,u.disabled,f,p,v,l]);return a.useEffect(()=>{const e=s._options.shouldUnregister||i;s.register(t,{...c.current.rules,...j(c.current.disabled)?{disabled:c.current.disabled}:{}});const r=(e,r)=>{const t=V(s._fields,e);t&&t._f&&(t._f.mount=r)};if(r(t,!0),e){const e=g(V(s._options.defaultValues,t));k(s._defaultValues,t,e),_(V(s._formValues,t))&&k(s._formValues,t,e)}return!o&&s.register(t),()=>{(o?e&&!s._state.action:e)?s.unregister(t):r(t,!1)}},[t,s,o,i]),a.useEffect(()=>{s._setDisabledField({disabled:n,name:t})},[n,t,s]),a.useMemo(()=>({field:b,formState:u,fieldState:m}),[b,u,m])}(e));var M=function(n){var a=n.schema,v=n.form,b=n.layout,h=void 0===b?"vertical":b,y=n.columns,g=void 0===y?2:y,x=n.className,_=n.showSubmitButton,z=void 0!==_&&_,V=n.onSubmit,j=v.control,k=v.handleSubmit,N=v.watch,S=v.formState.errors,w=N(),C="grid"===h?"zui:grid zui:grid-cols-12 zui:gap-3 zui:items-baseline":"zui:flex zui:flex-col zui:gap-3";return r("form",{onSubmit:V?k(V):void 0,className:s(C,x),children:[a.map(function(n){var a,m=n.name,v=n.label,b=n.type,y=n.placeholder,x=n.required,_=n.options,z=n.component,V=n.colSpan,k=n.inputProps,N=n.controllerProps;if(!(!n.visibleIf||n.visibleIf(w)))return null;var C=null!=V?V:Math.floor(12/g),F="grid"===h?{1:"zui:col-span-1",2:"zui:col-span-2",3:"zui:col-span-3",4:"zui:col-span-4",5:"zui:col-span-5",6:"zui:col-span-6",7:"zui:col-span-7",8:"zui:col-span-8",9:"zui:col-span-9",10:"zui:col-span-10",11:"zui:col-span-11",12:"zui:col-span-12"}[C]:void 0,P={label:v,placeholder:y,required:x,options:_},A=e({required:null!=x?x:null===(a=n.validation)||void 0===a?void 0:a.required},n.validation),D=null!=k?k:{},M=null!=N?N:{},B=function(){var e;return(null==S?void 0:S[m])?t("p",{className:"zui:text-red-600 zui:text-xs",children:null===(e=S[m])||void 0===e?void 0:e.message}):null};switch(b){case"text":case"number":return r("div",{className:s(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(i,e({},n,{type:"number"===b?"number":"text"},P,D))}})),B()]},m);case"textarea":return r("div",{className:s(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(i,e({},n,P,D,{type:"textarea"}))}})),B()]},m);case"select":return r("div",{className:s(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(o,e({},n,P,D))}})),B()]},m);case"multiselect":case"multi-select":return r("div",{className:s(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(o,e({},n,P,D,{isMulti:!0}))}})),B()]},m);case"radio":return r("div",{className:s(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(d,e({},n,P,D))}})),B()]},m);case"switch":return r("div",{className:s(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(c,e({},n,P,D))}})),B()]},m);case"checkbox":return r("div",{className:s(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(p,e({},n,P,D))}})),B()]},m);case"timepicker":case"time":return r("div",{className:s(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(f,e({},n,P,D))}})),B()]},m);case"file":return r("div",{className:s(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(i,e({},n,P,D,{type:"file"}))}})),B()]},m);case"date":return r("div",{className:s(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(l,e({},n,P,D))}})),B()]},m);case"daterange":return r("div",{className:s(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(u,e({},n,P,D))}})),B()]},m);case"custom":return t("div",{className:s(F),children:z||null},m);default:return null}}),z&&t("div",{className:"zui:col-span-12",children:t(m,{type:"submit",children:"Submit"})})]})};export{M as Form,M as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),r=require("react/jsx-runtime"),s=require("react"),t=require("../../chunks/index-90b71f01.js"),n=require("../Input/index.js"),i=require("../Select/index.js"),a=require("../DatePicker/index.js"),l=require("../DateRangePicker/index.js"),u=require("../Switch/index.js"),o=require("../RadioGroup/index.js"),c=require("../Button/index.js"),d=require("../TimePicker/index.js"),f=require("../Checkbox/index.js");function m(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(s){if("default"!==s){var t=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,t.get?t:{enumerable:!0,get:function(){return e[s]}})}}),r.default=e,Object.freeze(r)}require("../../chunks/lucide-493ccaad.js"),require("../../chunks/typeof-b30b964a.js"),require("../../chunks/assertThisInitialized-d31798d4.js"),require("@emotion/react"),require("react-dom"),require("../../chunks/Calender-0d04996d.js"),require("../Popover/index.js"),require("@mui/material"),require("@mui/material/Popover"),require("../../chunks/_commonjsHelpers-3d4c1909.js");var _=m(s),p=e=>null==e;var x=e=>!p(e)&&!Array.isArray(e)&&(e=>"object"==typeof e)(e)&&!(e=>e instanceof Date)(e),g=e=>x(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e,v="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function j(e){let r;const s=Array.isArray(e),t="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)r=new Date(e);else{if(v&&(e instanceof Blob||t)||!s&&!x(e))return e;if(r=s?[]:{},s||(e=>{const r=e.constructor&&e.constructor.prototype;return x(r)&&r.hasOwnProperty("isPrototypeOf")})(e))for(const s in e)e.hasOwnProperty(s)&&(r[s]=j(e[s]));else r=e}return r}var b=e=>/^\w*$/.test(e),h=e=>void 0===e,y=e=>{return r=e.replace(/["|']|\]/g,"").split(/\.|\[/),Array.isArray(r)?r.filter(Boolean):[];var r},q=(e,r,s)=>{if(!r||!x(e))return s;const t=(b(r)?[r]:y(r)).reduce((e,r)=>p(e)?e:e[r],e);return h(t)||t===e?h(e[r])?s:e[r]:t},k=e=>"boolean"==typeof e,z=(e,r,s)=>{let t=-1;const n=b(r)?[r]:y(r),i=n.length,a=i-1;for(;++t<i;){const r=n[t];let i=s;if(t!==a){const s=e[r];i=x(s)||Array.isArray(s)?s:isNaN(+n[t+1])?{}:[]}if("__proto__"===r||"constructor"===r||"prototype"===r)return;e[r]=i,e=e[r]}};const V="blur",S="change",w="all",N=s.createContext(null);N.displayName="HookFormContext";const P=()=>s.useContext(N);const C="undefined"!=typeof window?_.useLayoutEffect:_.useEffect;function F(e){const r=P(),{control:t=r.control,disabled:n,name:i,exact:a}=e||{},[l,u]=s.useState(t._formState),o=s.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return C(()=>t._subscribe({name:i,formState:o.current,exact:a,callback:e=>{!n&&u({...t._formState,...e})}}),[i,n,a]),s.useEffect(()=>{o.current.isValid&&t._setValid(!0)},[t]),s.useMemo(()=>((e,r,s,t=!0)=>{const n={defaultValues:r._defaultValues};for(const i in e)Object.defineProperty(n,i,{get:()=>{const n=i;return r._proxyFormState[n]!==w&&(r._proxyFormState[n]=!t||w),s&&(s[n]=!0),e[n]}});return n})(l,t,o.current,!1),[l,t])}function O(e){const r=P(),{control:t=r.control,name:n,defaultValue:i,disabled:a,exact:l}=e||{},u=s.useRef(i),[o,c]=s.useState(t._getWatch(n,u.current));return C(()=>t._subscribe({name:n,formState:{values:!0},exact:l,callback:e=>!a&&c(((e,r,s,t,n)=>"string"==typeof e?(t&&r.watch.add(e),q(s,e,n)):Array.isArray(e)?e.map(e=>(t&&r.watch.add(e),q(s,e))):(t&&(r.watchAll=!0),s))(n,t._names,e.values||t._formValues,!1,u.current))}),[n,t,a,l]),s.useEffect(()=>t._removeUnmounted()),o}const A=e=>e.render(function(e){const r=P(),{name:t,disabled:n,control:i=r.control,shouldUnregister:a}=e,l=((e,r)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(r)))(i._names.array,t),u=O({control:i,name:t,defaultValue:q(i._formValues,t,q(i._defaultValues,t,e.defaultValue)),exact:!0}),o=F({control:i,name:t,exact:!0}),c=s.useRef(e),d=s.useRef(i.register(t,{...e.rules,value:u,...k(e.disabled)?{disabled:e.disabled}:{}})),f=s.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!q(o.errors,t)},isDirty:{enumerable:!0,get:()=>!!q(o.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!q(o.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!q(o.validatingFields,t)},error:{enumerable:!0,get:()=>q(o.errors,t)}}),[o,t]),m=s.useCallback(e=>d.current.onChange({target:{value:g(e),name:t},type:S}),[t]),_=s.useCallback(()=>d.current.onBlur({target:{value:q(i._formValues,t),name:t},type:V}),[t,i._formValues]),p=s.useCallback(e=>{const r=q(i._fields,t);r&&e&&(r._f.ref={focus:()=>e.focus&&e.focus(),select:()=>e.select&&e.select(),setCustomValidity:r=>e.setCustomValidity(r),reportValidity:()=>e.reportValidity()})},[i._fields,t]),x=s.useMemo(()=>({name:t,value:u,...k(n)||o.disabled?{disabled:o.disabled||n}:{},onChange:m,onBlur:_,ref:p}),[t,n,o.disabled,m,_,p,u]);return s.useEffect(()=>{const e=i._options.shouldUnregister||a;i.register(t,{...c.current.rules,...k(c.current.disabled)?{disabled:c.current.disabled}:{}});const r=(e,r)=>{const s=q(i._fields,e);s&&s._f&&(s._f.mount=r)};if(r(t,!0),e){const e=j(q(i._options.defaultValues,t));z(i._defaultValues,t,e),h(q(i._formValues,t))&&z(i._formValues,t,e)}return!l&&i.register(t),()=>{(l?e&&!i._state.action:e)?i.unregister(t):r(t,!1)}},[t,i,l,a]),s.useEffect(()=>{i._setDisabledField({disabled:n,name:t})},[n,t,i]),s.useMemo(()=>({field:x,formState:o,fieldState:f}),[x,o,f])}(e));var D=function(s){var m=s.schema,_=s.form,p=s.layout,x=void 0===p?"vertical":p,g=s.columns,v=void 0===g?2:g,j=s.className,b=s.showSubmitButton,h=void 0!==b&&b,y=s.onSubmit,q=_.control,k=_.handleSubmit,z=_.watch,V=_.formState.errors,S=z(),w="grid"===x?"zui:grid zui:grid-cols-12 zui:gap-3 zui:items-baseline":"zui:flex zui:flex-col zui:gap-3";return r.jsxs("form",{onSubmit:y?k(y):void 0,className:t.cn(w,j),children:[m.map(function(s){var c,m=s.name,_=s.label,p=s.type,g=s.placeholder,j=s.required,b=s.options,h=s.component,y=s.colSpan,k=s.inputProps,z=s.controllerProps;if(!(!s.visibleIf||s.visibleIf(S)))return null;var w=null!=y?y:Math.floor(12/v),N="grid"===x?{1:"zui:col-span-1",2:"zui:col-span-2",3:"zui:col-span-3",4:"zui:col-span-4",5:"zui:col-span-5",6:"zui:col-span-6",7:"zui:col-span-7",8:"zui:col-span-8",9:"zui:col-span-9",10:"zui:col-span-10",11:"zui:col-span-11",12:"zui:col-span-12"}[w]:void 0,P={label:_,placeholder:g,required:j,options:b},C=e.__assign({required:null!=j?j:null===(c=s.validation)||void 0===c?void 0:c.required},s.validation),F=null!=k?k:{},O=null!=z?z:{},D=function(){var e;return(null==V?void 0:V[m])?r.jsx("p",{className:"zui:text-red-600 zui:text-xs",children:null===(e=V[m])||void 0===e?void 0:e.message}):null};switch(p){case"text":case"number":return r.jsxs("div",{className:t.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(s){var t=s.field;return r.jsx(n.Input,e.__assign({},t,{type:"number"===p?"number":"text"},P,F))}})),D()]},m);case"textarea":return r.jsxs("div",{className:t.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(s){var t=s.field;return r.jsx(n.Input,e.__assign({},t,P,F,{type:"textarea"}))}})),D()]},m);case"select":return r.jsxs("div",{className:t.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(s){var t=s.field;return r.jsx(i.Select,e.__assign({},t,P,F))}})),D()]},m);case"multiselect":case"multi-select":return r.jsxs("div",{className:t.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(s){var t=s.field;return r.jsx(i.Select,e.__assign({},t,P,F,{isMulti:!0}))}})),D()]},m);case"radio":return r.jsxs("div",{className:t.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(s){var t=s.field;return r.jsx(o.RadioGroup,e.__assign({},t,P,F))}})),D()]},m);case"switch":return r.jsxs("div",{className:t.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(s){var t=s.field;return r.jsx(u.default,e.__assign({},t,P,F))}})),D()]},m);case"checkbox":return r.jsxs("div",{className:t.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(s){var t=s.field;return r.jsx(f.Checkbox,e.__assign({},t,P,F))}})),D()]},m);case"timepicker":case"time":return r.jsxs("div",{className:t.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(s){var t=s.field;return r.jsx(d.TimePicker,e.__assign({},t,P,F))}})),D()]},m);case"file":return r.jsxs("div",{className:t.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(s){var t=s.field;return r.jsx(n.Input,e.__assign({},t,P,F,{type:"file"}))}})),D()]},m);case"date":return r.jsxs("div",{className:t.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(s){var t=s.field;return r.jsx(a.DatePicker,e.__assign({},t,P,F))}})),D()]},m);case"daterange":return r.jsxs("div",{className:t.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(s){var t=s.field;return r.jsx(l.DateRangePicker,e.__assign({},t,P,F))}})),D()]},m);case"custom":return r.jsx("div",{className:t.cn(N),children:h||null},m);default:return null}}),h&&r.jsx("div",{className:"zui:col-span-12",children:r.jsx(c.Button,{type:"submit",children:"Submit"})})]})};exports.Form=D,exports.default=D;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
|
|
3
|
-
type List = {
|
|
4
|
-
list: Record<string, any>[];
|
|
5
|
-
};
|
|
6
|
-
interface GlobalMenuSearchComponentProps extends List {
|
|
7
|
-
list: Record<string, any>[];
|
|
8
|
-
delay?: number;
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
popInputPlaceholder?: string;
|
|
11
|
-
history: any;
|
|
12
|
-
}
|
|
13
|
-
declare const GlobalMenuSearch: React__default.FC<GlobalMenuSearchComponentProps>;
|
|
14
|
-
|
|
15
|
-
export { GlobalMenuSearch, GlobalMenuSearch as default };
|
|
16
|
-
export type { GlobalMenuSearchComponentProps };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as r,a as t,_ as e}from"../../chunks/tslib.es6-6cad17f3.esm.js";import{jsx as n,jsxs as o,Fragment as i}from"react/jsx-runtime";import*as a from"react";import u,{Fragment as c,useState as l,useMemo as s,useRef as f,useEffect as h,createContext as d,useContext as p}from"react";import{Box as v,List as y,ListItemButton as m,ListItemIcon as g,ListItemText as b,CircularProgress as w,Slide as x,Dialog as E,DialogTitle as k,Divider as z,DialogContent as j,DialogActions as P}from"@mui/material";import{b as A,S as O}from"../../chunks/lucide-8c9441ea.esm.js";import{T as _}from"../../chunks/Text-18106168.esm.js";import{Input as C}from"../Input/index.esm.js";import"../../chunks/index-32c3a4e2.esm.js";var T="open",N="exit",S=function(r){var t=tr(),e=r.list,i=void 0===e?[]:e,a=r.history,u=null==t?void 0:t.handleClose;return n(v,{p:1,children:n(y,{disablePadding:!0,component:"nav","aria-label":"menu list box",children:i.map(function(r){return o(m,{onClick:function(){return t=r.url,null==a||a.push(t),void("function"==typeof u&&u());var t},sx:{fontFamily:"sans-serif",fontSize:14,background:"rgba(246, 247, 248, 0.4)",mt:1,minHeight:48,border:"1px solid rgba(232, 234, 238, 0.5)",borderRadius:1,":hover":{background:"#ebf5ff",borderColor:"#66b2ff",color:"#66b2ff"}},children:[n(g,{sx:{minWidth:"auto",color:"inherit"},children:n(A,{size:24})}),n(b,{primaryTypographyProps:{sx:{textTransform:"capitalize"},component:"div",variant:"body1",fontSize:14,fontWeight:500,lineHeight:.85},secondaryTypographyProps:{component:"div",variant:"body1",fontSize:12},sx:{ml:1},primary:r.name||"-",secondary:r.custom_path})]})})})})},F=function(r){return"function"==typeof r.children?u.createElement(c,null,r.children()):u.createElement(c,null,r.children||null)},I=function(r){return F(r)},G=function(r){return F(r)};function R(r,t,e,n,o,i,a){try{var u=r[i](a),c=u.value}catch(r){return void e(r)}u.done?t(c):Promise.resolve(c).then(n,o)}function D(r){return function(){var t=this,e=arguments;return new Promise(function(n,o){var i=r.apply(t,e);function a(r){R(i,n,o,a,u,"next",r)}function u(r){R(i,n,o,a,u,"throw",r)}a(void 0)})}}function L(){return L=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)({}).hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},L.apply(null,arguments)}function W(){W=function(){return t};var r,t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(r,t,e,n){return Object.defineProperty(r,t,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(r){c=function(r,t,e){return r[t]=e}}function l(t,e,n,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype);return c(a,"_invoke",function(t,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=x(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(t,e,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(t,n,new z(o||[])),!0),a}function s(r,t,e){try{return{type:"normal",arg:r.call(t,e)}}catch(r){return{type:"throw",arg:r}}}t.wrap=l;var f={};function h(){}function d(){}function p(){}var v={};c(v,i,function(){return this});var y=Object.getPrototypeOf,m=y&&y(y(j([])));m&&m!==e&&n.call(m,i)&&(v=m);var g=p.prototype=h.prototype=Object.create(v);function b(r){["next","throw","return"].forEach(function(t){c(r,t,function(r){return this._invoke(t,r)})})}function w(r,t){function e(o,i,a,u){var c=s(r[o],r,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then(function(r){e("next",r,a,u)},function(r){e("throw",r,a,u)}):t.resolve(f).then(function(r){l.value=r,a(l)},function(r){return e("throw",r,a,u)})}u(c.arg)}var o;c(this,"_invoke",function(r,n){function i(){return new t(function(t,o){e(r,n,t,o)})}return o=o?o.then(i,i):i()},!0)}function x(t,e){var n=e.method,o=t.i[n];if(o===r)return e.delegate=null,"throw"===n&&t.i.return&&(e.method="return",e.arg=r,x(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=s(o,t.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var a=i.arg;return a?a.done?(e[t.r]=a.value,e.next=t.n,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,f):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function E(r){this.tryEntries.push(r)}function k(t){var e=t[4]||{};e.type="normal",e.arg=r,t[4]=e}function z(r){this.tryEntries=[[-1]],r.forEach(E,this),this.reset(!0)}function j(t){if(null!=t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}throw new TypeError(typeof t+" is not iterable")}return d.prototype=p,c(g,"constructor",p),c(p,"constructor",d),d.displayName=c(p,u,"GeneratorFunction"),t.isGeneratorFunction=function(r){var t="function"==typeof r&&r.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,p):(r.__proto__=p,c(r,u,"GeneratorFunction")),r.prototype=Object.create(g),r},t.awrap=function(r){return{__await:r}},b(w.prototype),c(w.prototype,a,function(){return this}),t.AsyncIterator=w,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new w(l(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then(function(r){return r.done?r.value:a.next()})},b(g),c(g,u,"Generator"),c(g,i,function(){return this}),c(g,"toString",function(){return"[object Generator]"}),t.keys=function(r){var t=Object(r),e=[];for(var n in t)e.unshift(n);return function r(){for(;e.length;)if((n=e.pop())in t)return r.value=n,r.done=!1,r;return r.done=!0,r}},t.values=j,z.prototype={constructor:z,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var r=this.tryEntries[0][4];if("throw"===r.type)throw r.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r){a.type="throw",a.arg=t,e.next=r}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],l=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=r,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(r,t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===r||"continue"===r)&&o[0]<=t&&t<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=r,i.arg=t,o?(this.method="next",this.next=o[2],f):this.complete(i)},complete:function(r,t){if("throw"===r.type)throw r.arg;return"break"===r.type||"continue"===r.type?this.next=r.arg:"return"===r.type?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):"normal"===r.type&&t&&(this.next=t),f},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e[2]===r)return this.complete(e[4],e[3]),k(e),f}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e[0]===r){var n=e[4];if("throw"===n.type){var o=n.arg;k(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={i:j(t),r:e,n:n},"next"===this.method&&(this.arg=r),f}},t}var H=function(r){return F(r)};function K(r){return"function"==typeof r}function q(r){return"object"==typeof r&&null!==r&&(r instanceof Promise||r!==Promise.prototype&&function(r){return Reflect.has(r,"then")&&K(r.then)}(r)&&function(r){return Reflect.has(r,"catch")&&K(r.catch)}(r))}var B=function(r,t){void 0===t&&(t=[]);var e=f(!1),n=f([]);if("function"!=typeof r)throw new Error("Incorrect callback parameter for useSingleton hook; expected a function, but got: '"+typeof r+"'.");if(!Array.isArray(t))throw new Error("Incorrect dependencies parameter for useSingleton; expected an array, but got: '"+typeof t+"'.");if(Array.isArray(t)&&t.length>0){if(!function(r,t){if(!Array.isArray(r)||!Array.isArray(t))throw new Error("shallowArraysEqual only accepts arrays as parameters");if(r.length!==t.length)return!1;for(var e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}(n.current,t))n.current=t;else if(e.current)return}else if(e.current)return;r(),e.current=!0};function M(r){var t=r.promise,e=r.keepAlive,n=void 0!==e&&e,o=r.children,i=l(null),u=i[0],d=i[1],p=l(null),v=p[0],y=p[1],m=s(function(){return function(r){if(!q(r))throw new Error("Argument of createCancellablePromise should be a Promise");var t={value:!1},e=new Promise(function(){var e=D(W().mark(function e(n,o){var i;return W().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r;case 3:i=e.sent,t.value||n(i),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),t.value||o(e.t0);case 10:case"end":return e.stop()}},e,null,[[0,7]])}));return function(r,t){return e.apply(this,arguments)}}());return Object.keys(r).forEach(function(t){e[t]=r[t]}),{promise:e,cancel:function(){t.value=!0}}}(t)},[t]),g=f([]);if(h(function(){return function(){n||m.cancel()}},[m,m.promise,n]),B(D(W().mark(function r(){var t;return W().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return d(null),y(null),r.prev=2,r.next=5,m.promise;case 5:t=r.sent,y(t),d(!0),g.current.push(m),r.next=16;break;case 11:r.prev=11,r.t0=r.catch(2),y(r.t0),d(!1),g.current.push(m);case 16:case"end":return r.stop()}},r,null,[[2,11]])})),[m.promise]),!o||!q(t))return null;if(null===u){var b=a.Children.toArray(o).find(function(r){return r.type===G});return a.createElement(c,null,b||null)}if(!u){var w=a.Children.toArray(o).find(function(r){return r.type===I});if(!w)return a.createElement(c,null,null);var x=w,E=w.props;return"function"==typeof E.children&&(x=L({},w,{props:L({},E,{children:function(){return E.children(v,g.current,m.promise)}})})),a.createElement(c,null,x)}var k=a.Children.toArray(o).find(function(r){return r.type===H});if(!k)return a.createElement(c,null,null);var z=k,j=k.props;return"function"==typeof j.children&&(z=L({},k,{props:L({},j,{children:function(){return j.children(v,g.current,m.promise)}})})),a.createElement(c,null,z)}var V=function(r){var t=r.condition,e=r.keepAlive,n=void 0!==e&&e,o=r.children;if(!o)return null;if(function(r,t){if("production"!==process.env.NODE_ENV&&r){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(r){}}}(!Array.isArray(o)&&!(o.type===I||o.type===H)||!u.Children.toArray(o).every(function(r){return r.type===I||r.type===H||r.type===G}),"The <If> component should contain <Then /> <Else /> or <Fallback /> components as its children"),q(t))return u.createElement(M,{promise:t,keepAlive:n},o);var i=function(r){return Boolean("function"==typeof r?r():r)}(t);return u.createElement(c,null,u.Children.toArray(o).find(function(r){return r.type!==I!=!i})||null)};function Y(e,n){return void 0===n&&(n=[]),e.flatMap(function(e){var o=r(r([],n,!0),[e.name],!1);if(e.children&&e.children.length>0)return Y(e.children,o);var i=t(t({},e),{custom_path:o.join(" / ")});return delete i.children,[i]})}var J=function(r){return(null==r?void 0:r.trim().toLowerCase())||""},Q=function(r){var e=r.sx;return o(v,{sx:t({display:"flex",flexDirection:"column",height:"100%",justifyContent:"center",alignItems:"center",background:"#f4f4f4",color:"gray"},e),children:[n(O,{size:40}),n(_,{size:"sm",children:"No results found based on search"})]})};function U(r){var e=r.children,o=r.loading,a=r.list,u={display:"flex",flexDirection:"column",height:"100%",justifyContent:"center",alignItems:"center"};return o?n(v,{sx:u,children:n(w,{thickness:2})}):0===(null==a?void 0:a.length)?n(Q,{sx:t(t({},u),{background:"#f4f4f4",color:"gray"})}):n(i,{children:e})}var X=function(r){var t=r.list,e=void 0===t?[]:t,i=r.delay,a=void 0===i?1e3:i,c=r.popInputPlaceholder,f=void 0===c?"Search...":c,d=r.history,p=l(""),v=p[0],y=p[1],m=l([]),g=m[0],b=m[1],w=l(!1),x=w[0],E=w[1],A=function(r){var t=[],n=J(r);t=n?e.filter(function(r){return J(r.name).includes(n)}):e,b(t),E(!1)},O=s(function(){return function(r,t){var e;return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];clearTimeout(e),e=setTimeout(function(){r.apply(void 0,n)},t)}}(A,a)},[]);h(function(){E(!0),O(v)},[v,O]);return o(u.Fragment,{children:[n(k,{classes:{root:"zui:!p-1"},component:"div",color:"primary",className:"font-semibold flex items-center",children:n(Z,{kbdType:"exit",variant:"outlined",inputProps:{className:"zui:!mb-0 zui:!text-sm",placeholder:f,value:v,onChange:function(r){var t=r.target.value;y(t)}}})}),n(z,{}),n(j,{classes:{root:"zui:!p-0"},children:n(U,{loading:x,list:g,children:n(S,{list:g,history:d})})}),n(z,{}),n(P,{children:o("div",{className:"zui:flex zui:flex-row zui:gap-0.5 zui:items-center",children:[n(_,{size:"sm",children:"Search by :"}),n("img",{loading:"lazy",className:"org_logo",src:"https://files.zimyo.work/staticlogo/global/zimyo.svg",width:85})]})})]})},Z=function(r){var e=r.variant,i=void 0===e?"contained":e,a=r.inputProps,u=r.kbdType,c=void 0===u?T:u;return n(C,t({leftIcon:n(O,{size:16}),rightIcon:o(V,{condition:c===N,children:[n(H,{children:n("kbd",{className:"zui:px-2 zui:py-1 zui:border zui:border-gray-200 zui:rounded zui:bg-gray-200",children:"Esc"})}),n(I,{children:o("kbd",{className:"zui:px-2 zui:py-1 zui:border zui:border-gray-200 zui:rounded zui:bg-gray-200",children:[n("span",{children:"⌘"}),n("span",{children:"+"}),n("span",{children:"K"})]})})]})},a,{focusOutline:!1,autoFocus:c===N,variant:i}))},$=u.forwardRef(function(r,e){return n(x,t({direction:"up",ref:e},r))}),rr=d(null),tr=function(){return p(rr)},er=function(r){var i=r.list,a=void 0===i?[]:i,c=e(r,["list"]),f=s(function(){return Y(a)},[a]),d=l(!1),p=d[0],v=d[1];h(function(){var r=function(r){r.ctrlKey&&"k"===r.key.toLowerCase()&&(r.preventDefault(),v(!0))};return window.addEventListener("keydown",r),function(){return window.removeEventListener("keydown",r)}},[]);var y=function(){v(!1)};return n(u.Fragment,{children:o(rr.Provider,{value:{handleClose:y},children:[n("div",{className:"global-search-container",onClick:function(){return v(!0)},children:n(Z,{kbdType:"open",inputProps:{placeholder:c.placeholder||"Search...",readOnly:!0,className:"zui:rounded-full"},variant:"contained"})}),n(E,{open:p,TransitionComponent:$,onClose:y,maxWidth:"md",slotProps:{backdrop:{style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}},PaperProps:{sx:{width:620,height:550,borderRadius:2}},"aria-describedby":"alert-dialog-slide-description",children:n(X,t({list:f},c))})]})})};export{er as GlobalMenuSearch,er as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),r=require("react/jsx-runtime"),t=require("react"),n=require("@mui/material"),i=require("../../chunks/lucide-493ccaad.js"),o=require("../../chunks/Text-e9636dd7.js"),a=require("../Input/index.js");function u(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),r.default=e,Object.freeze(r)}require("../../chunks/index-90b71f01.js");var c=u(t),s="open",l="exit",f=function(e){var t=F(),o=e.list,a=void 0===o?[]:o,u=e.history,c=null==t?void 0:t.handleClose;return r.jsx(n.Box,{p:1,children:r.jsx(n.List,{disablePadding:!0,component:"nav","aria-label":"menu list box",children:a.map(function(e){return r.jsxs(n.ListItemButton,{onClick:function(){return r=e.url,null==u||u.push(r),void("function"==typeof c&&c());var r},sx:{fontFamily:"sans-serif",fontSize:14,background:"rgba(246, 247, 248, 0.4)",mt:1,minHeight:48,border:"1px solid rgba(232, 234, 238, 0.5)",borderRadius:1,":hover":{background:"#ebf5ff",borderColor:"#66b2ff",color:"#66b2ff"}},children:[r.jsx(n.ListItemIcon,{sx:{minWidth:"auto",color:"inherit"},children:r.jsx(i.Globe,{size:24})}),r.jsx(n.ListItemText,{primaryTypographyProps:{sx:{textTransform:"capitalize"},component:"div",variant:"body1",fontSize:14,fontWeight:500,lineHeight:.85},secondaryTypographyProps:{component:"div",variant:"body1",fontSize:12},sx:{ml:1},primary:e.name||"-",secondary:e.custom_path})]})})})})},h=function(e){return"function"==typeof e.children?t.createElement(t.Fragment,null,e.children()):t.createElement(t.Fragment,null,e.children||null)},d=function(e){return h(e)},p=function(e){return h(e)};function v(e,r,t,n,i,o,a){try{var u=e[o](a),c=u.value}catch(e){return void t(e)}u.done?r(c):Promise.resolve(c).then(n,i)}function y(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var o=e.apply(r,t);function a(e){v(o,n,i,a,u,"next",e)}function u(e){v(o,n,i,a,u,"throw",e)}a(void 0)})}}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},g.apply(null,arguments)}function m(){m=function(){return r};var e,r={},t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(e,r,t,n){return Object.defineProperty(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(e){c=function(e,r,t){return e[r]=t}}function s(r,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype);return c(a,"_invoke",function(r,t,n){var i=1;return function(o,a){if(3===i)throw Error("Generator is already running");if(4===i){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var u=n.delegate;if(u){var c=j(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===i)throw i=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=3;var s=l(r,t,n);if("normal"===s.type){if(i=n.done?4:2,s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i=4,n.method="throw",n.arg=s.arg)}}}(r,n,new _(i||[])),!0),a}function l(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}r.wrap=s;var f={};function h(){}function d(){}function p(){}var v={};c(v,o,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(z([])));g&&g!==t&&n.call(g,o)&&(v=g);var x=p.prototype=h.prototype=Object.create(v);function b(e){["next","throw","return"].forEach(function(r){c(e,r,function(e){return this._invoke(r,e)})})}function w(e,r){function t(i,o,a,u){var c=l(e[i],e,o);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?r.resolve(f.__await).then(function(e){t("next",e,a,u)},function(e){t("throw",e,a,u)}):r.resolve(f).then(function(e){s.value=e,a(s)},function(e){return t("throw",e,a,u)})}u(c.arg)}var i;c(this,"_invoke",function(e,n){function o(){return new r(function(r,i){t(e,n,r,i)})}return i=i?i.then(o,o):o()},!0)}function j(r,t){var n=t.method,i=r.i[n];if(i===e)return t.delegate=null,"throw"===n&&r.i.return&&(t.method="return",t.arg=e,j(r,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var o=l(i,r.i,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var a=o.arg;return a?a.done?(t[r.r]=a.value,t.next=r.n,"return"!==t.method&&(t.method="next",t.arg=e),t.delegate=null,f):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function E(e){this.tryEntries.push(e)}function k(r){var t=r[4]||{};t.type="normal",t.arg=e,r[4]=t}function _(e){this.tryEntries=[[-1]],e.forEach(E,this),this.reset(!0)}function z(r){if(null!=r){var t=r[o];if(t)return t.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var i=-1,a=function t(){for(;++i<r.length;)if(n.call(r,i))return t.value=r[i],t.done=!1,t;return t.value=e,t.done=!0,t};return a.next=a}}throw new TypeError(typeof r+" is not iterable")}return d.prototype=p,c(x,"constructor",p),c(p,"constructor",d),d.displayName=c(p,u,"GeneratorFunction"),r.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===d||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,c(e,u,"GeneratorFunction")),e.prototype=Object.create(x),e},r.awrap=function(e){return{__await:e}},b(w.prototype),c(w.prototype,a,function(){return this}),r.AsyncIterator=w,r.async=function(e,t,n,i,o){void 0===o&&(o=Promise);var a=new w(s(e,t,n,i),o);return r.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},b(x),c(x,u,"Generator"),c(x,o,function(){return this}),c(x,"toString",function(){return"[object Generator]"}),r.keys=function(e){var r=Object(e),t=[];for(var n in r)t.unshift(n);return function e(){for(;t.length;)if((n=t.pop())in r)return e.value=n,e.done=!1,e;return e.done=!0,e}},r.values=z,_.prototype={constructor:_,reset:function(r){if(this.prev=this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(k),!r)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0][4];if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var t=this;function n(e){a.type="throw",a.arg=r,t.next=e}for(var i=t.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o[4],u=this.prev,c=o[1],s=o[2];if(-1===o[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=o[0]&&o[0]<=u){if(u<c)return this.method="next",this.arg=e,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(e,r){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var i=n;break}}i&&("break"===e||"continue"===e)&&i[0]<=r&&r<=i[2]&&(i=null);var o=i?i[4]:{};return o.type=e,o.arg=r,i?(this.method="next",this.next=i[2],f):this.complete(o)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),f},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t[2]===e)return this.complete(t[4],t[3]),k(t),f}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t[0]===e){var n=t[4];if("throw"===n.type){var i=n.arg;k(t)}return i}}throw Error("illegal catch attempt")},delegateYield:function(r,t,n){return this.delegate={i:z(r),r:t,n:n},"next"===this.method&&(this.arg=e),f}},r}var x=function(e){return h(e)};function b(e){return"function"==typeof e}function w(e){return"object"==typeof e&&null!==e&&(e instanceof Promise||e!==Promise.prototype&&function(e){return Reflect.has(e,"then")&&b(e.then)}(e)&&function(e){return Reflect.has(e,"catch")&&b(e.catch)}(e))}var j=function(e,r){void 0===r&&(r=[]);var n=t.useRef(!1),i=t.useRef([]);if("function"!=typeof e)throw new Error("Incorrect callback parameter for useSingleton hook; expected a function, but got: '"+typeof e+"'.");if(!Array.isArray(r))throw new Error("Incorrect dependencies parameter for useSingleton; expected an array, but got: '"+typeof r+"'.");if(Array.isArray(r)&&r.length>0){if(!function(e,r){if(!Array.isArray(e)||!Array.isArray(r))throw new Error("shallowArraysEqual only accepts arrays as parameters");if(e.length!==r.length)return!1;for(var t=0;t<e.length;++t)if(e[t]!==r[t])return!1;return!0}(i.current,r))i.current=r;else if(n.current)return}else if(n.current)return;e(),n.current=!0};function E(e){var r=e.promise,n=e.keepAlive,i=void 0!==n&&n,o=e.children,a=t.useState(null),u=a[0],s=a[1],l=t.useState(null),f=l[0],h=l[1],v=t.useMemo(function(){return function(e){if(!w(e))throw new Error("Argument of createCancellablePromise should be a Promise");var r={value:!1},t=new Promise(function(){var t=y(m().mark(function t(n,i){var o;return m().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e;case 3:o=t.sent,r.value||n(o),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),r.value||i(t.t0);case 10:case"end":return t.stop()}},t,null,[[0,7]])}));return function(e,r){return t.apply(this,arguments)}}());return Object.keys(e).forEach(function(r){t[r]=e[r]}),{promise:t,cancel:function(){r.value=!0}}}(r)},[r]),b=t.useRef([]);if(t.useEffect(function(){return function(){i||v.cancel()}},[v,v.promise,i]),j(y(m().mark(function e(){var r;return m().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s(null),h(null),e.prev=2,e.next=5,v.promise;case 5:r=e.sent,h(r),s(!0),b.current.push(v),e.next=16;break;case 11:e.prev=11,e.t0=e.catch(2),h(e.t0),s(!1),b.current.push(v);case 16:case"end":return e.stop()}},e,null,[[2,11]])})),[v.promise]),!o||!w(r))return null;if(null===u){var E=c.Children.toArray(o).find(function(e){return e.type===p});return c.createElement(t.Fragment,null,E||null)}if(!u){var k=c.Children.toArray(o).find(function(e){return e.type===d});if(!k)return c.createElement(t.Fragment,null,null);var _=k,z=k.props;return"function"==typeof z.children&&(_=g({},k,{props:g({},z,{children:function(){return z.children(f,b.current,v.promise)}})})),c.createElement(t.Fragment,null,_)}var P=c.Children.toArray(o).find(function(e){return e.type===x});if(!P)return c.createElement(t.Fragment,null,null);var O=P,A=P.props;return"function"==typeof A.children&&(O=g({},P,{props:g({},A,{children:function(){return A.children(f,b.current,v.promise)}})})),c.createElement(t.Fragment,null,O)}var k=function(e){var r=e.condition,n=e.keepAlive,i=void 0!==n&&n,o=e.children;if(!o)return null;if(function(e,r){if("production"!==process.env.NODE_ENV&&e){"undefined"!=typeof console&&console.warn(r);try{throw new Error(r)}catch(e){}}}(!Array.isArray(o)&&!(o.type===d||o.type===x)||!t.Children.toArray(o).every(function(e){return e.type===d||e.type===x||e.type===p}),"The <If> component should contain <Then /> <Else /> or <Fallback /> components as its children"),w(r))return t.createElement(E,{promise:r,keepAlive:i},o);var a=function(e){return Boolean("function"==typeof e?e():e)}(r);return t.createElement(t.Fragment,null,t.Children.toArray(o).find(function(e){return e.type!==d!=!a})||null)};function _(r,t){return void 0===t&&(t=[]),r.flatMap(function(r){var n=e.__spreadArray(e.__spreadArray([],t,!0),[r.name],!1);if(r.children&&r.children.length>0)return _(r.children,n);var i=e.__assign(e.__assign({},r),{custom_path:n.join(" / ")});return delete i.children,[i]})}var z=function(e){return(null==e?void 0:e.trim().toLowerCase())||""},P=function(t){var a=t.sx;return r.jsxs(n.Box,{sx:e.__assign({display:"flex",flexDirection:"column",height:"100%",justifyContent:"center",alignItems:"center",background:"#f4f4f4",color:"gray"},a),children:[r.jsx(i.Search,{size:40}),r.jsx(o.Text,{size:"sm",children:"No results found based on search"})]})};function O(t){var i=t.children,o=t.loading,a=t.list,u={display:"flex",flexDirection:"column",height:"100%",justifyContent:"center",alignItems:"center"};return o?r.jsx(n.Box,{sx:u,children:r.jsx(n.CircularProgress,{thickness:2})}):0===(null==a?void 0:a.length)?r.jsx(P,{sx:e.__assign(e.__assign({},u),{background:"#f4f4f4",color:"gray"})}):r.jsx(r.Fragment,{children:i})}var A=function(e){var i=e.list,a=void 0===i?[]:i,u=e.delay,c=void 0===u?1e3:u,s=e.popInputPlaceholder,l=void 0===s?"Search...":s,h=e.history,d=t.useState(""),p=d[0],v=d[1],y=t.useState([]),g=y[0],m=y[1],x=t.useState(!1),b=x[0],w=x[1],j=function(e){var r=[],t=z(e);r=t?a.filter(function(e){return z(e.name).includes(t)}):a,m(r),w(!1)},E=t.useMemo(function(){return function(e,r){var t;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];clearTimeout(t),t=setTimeout(function(){e.apply(void 0,n)},r)}}(j,c)},[]);t.useEffect(function(){w(!0),E(p)},[p,E]);return r.jsxs(t.Fragment,{children:[r.jsx(n.DialogTitle,{classes:{root:"zui:!p-1"},component:"div",color:"primary",className:"font-semibold flex items-center",children:r.jsx(C,{kbdType:"exit",variant:"outlined",inputProps:{className:"zui:!mb-0 zui:!text-sm",placeholder:l,value:p,onChange:function(e){var r=e.target.value;v(r)}}})}),r.jsx(n.Divider,{}),r.jsx(n.DialogContent,{classes:{root:"zui:!p-0"},children:r.jsx(O,{loading:b,list:g,children:r.jsx(f,{list:g,history:h})})}),r.jsx(n.Divider,{}),r.jsx(n.DialogActions,{children:r.jsxs("div",{className:"zui:flex zui:flex-row zui:gap-0.5 zui:items-center",children:[r.jsx(o.Text,{size:"sm",children:"Search by :"}),r.jsx("img",{loading:"lazy",className:"org_logo",src:"https://files.zimyo.work/staticlogo/global/zimyo.svg",width:85})]})})]})},C=function(t){var n=t.variant,o=void 0===n?"contained":n,u=t.inputProps,c=t.kbdType,f=void 0===c?s:c;return r.jsx(a.Input,e.__assign({leftIcon:r.jsx(i.Search,{size:16}),rightIcon:r.jsxs(k,{condition:f===l,children:[r.jsx(x,{children:r.jsx("kbd",{className:"zui:px-2 zui:py-1 zui:border zui:border-gray-200 zui:rounded zui:bg-gray-200",children:"Esc"})}),r.jsx(d,{children:r.jsxs("kbd",{className:"zui:px-2 zui:py-1 zui:border zui:border-gray-200 zui:rounded zui:bg-gray-200",children:[r.jsx("span",{children:"⌘"}),r.jsx("span",{children:"+"}),r.jsx("span",{children:"K"})]})})]})},u,{focusOutline:!1,autoFocus:f===l,variant:o}))},S=t.forwardRef(function(t,i){return r.jsx(n.Slide,e.__assign({direction:"up",ref:i},t))}),T=t.createContext(null),F=function(){return t.useContext(T)},I=function(i){var o=i.list,a=void 0===o?[]:o,u=e.__rest(i,["list"]),c=t.useMemo(function(){return _(a)},[a]),s=t.useState(!1),l=s[0],f=s[1];t.useEffect(function(){var e=function(e){e.ctrlKey&&"k"===e.key.toLowerCase()&&(e.preventDefault(),f(!0))};return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}},[]);var h=function(){f(!1)};return r.jsx(t.Fragment,{children:r.jsxs(T.Provider,{value:{handleClose:h},children:[r.jsx("div",{className:"global-search-container",onClick:function(){return f(!0)},children:r.jsx(C,{kbdType:"open",inputProps:{placeholder:u.placeholder||"Search...",readOnly:!0,className:"zui:rounded-full"},variant:"contained"})}),r.jsx(n.Dialog,{open:l,TransitionComponent:S,onClose:h,maxWidth:"md",slotProps:{backdrop:{style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}},PaperProps:{sx:{width:620,height:550,borderRadius:2}},"aria-describedby":"alert-dialog-slide-description",children:r.jsx(A,e.__assign({list:c},u))})]})})};exports.GlobalMenuSearch=I,exports.default=I;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
type InputSize = "xs" | "sm" | "md" | "lg";
|
|
4
|
-
type InputVariant = "outlined" | "contained";
|
|
5
|
-
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
6
|
-
label?: string;
|
|
7
|
-
floatingLabel?: boolean;
|
|
8
|
-
description?: string;
|
|
9
|
-
error?: string;
|
|
10
|
-
leftIcon?: React.ReactNode;
|
|
11
|
-
rightIcon?: React.ReactNode;
|
|
12
|
-
size?: InputSize;
|
|
13
|
-
variant?: InputVariant;
|
|
14
|
-
allowedPattern?: "number" | "alpha" | RegExp;
|
|
15
|
-
onLeftIconClick?: () => void;
|
|
16
|
-
onRightIconClick?: () => void;
|
|
17
|
-
debounceDelay?: number;
|
|
18
|
-
onDebouncedChange?: (value: string) => void;
|
|
19
|
-
wordLimit?: number;
|
|
20
|
-
focusOutline?: boolean;
|
|
21
|
-
}
|
|
22
|
-
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
|
|
23
|
-
|
|
24
|
-
export { Input, Input as default };
|
|
25
|
-
export type { InputProps };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,a as i}from"../../chunks/tslib.es6-6cad17f3.esm.js";import{jsxs as t,jsx as u}from"react/jsx-runtime";import*as n from"react";import{u as r,a as o}from"../../chunks/index-32c3a4e2.esm.js";import{E as l,e as a}from"../../chunks/lucide-8c9441ea.esm.js";var s={xs:"zui:h-8 zui:text-xs",sm:"zui:h-9 zui:text-sm",md:"zui:h-10 zui:text-sm",lg:"zui:h-11 zui:text-base"},z={xs:"zui:py-1.5",sm:"zui:py-2",md:"zui:py-2",lg:"zui:py-2.5"},c={xs:"zui:px-2",sm:"zui:px-2.5",md:"zui:px-3",lg:"zui:px-3.5"},d={xs:"zui:pl-8",sm:"zui:pl-9",md:"zui:pl-10",lg:"zui:pl-11"},m={xs:"zui:pr-8",sm:"zui:pr-9",md:"zui:pr-10",lg:"zui:pr-11"},f=n.forwardRef(function(f,p){var b,x,g=f.label,h=f.floatingLabel,v=void 0!==h&&h,y=f.description,w=f.error,N=f.leftIcon,k=f.rightIcon,I=f.size,C=void 0===I?"md":I,j=f.variant,B=void 0===j?"outlined":j,L=f.className,D=f.allowedPattern,R=f.onBeforeInput,S=f.onChange,E=f.onDebouncedChange,T=f.debounceDelay,q=f.type,F=void 0===q?"text":q,O=f.onLeftIconClick,P=f.onRightIconClick,$=f.wordLimit,A=f.focusOutline,H=void 0===A||A,Z=e(f,["label","floatingLabel","description","error","leftIcon","rightIcon","size","variant","className","allowedPattern","onBeforeInput","onChange","onDebouncedChange","debounceDelay","type","onLeftIconClick","onRightIconClick","wordLimit","focusOutline"]),_={container:(x=Z.disabled||!1)?"zui:opacity-80":"",label:x?"zui:text-gray-500":"zui:text-gray-700",input:x?" zui:cursor-not-allowed zui:opacity-90 zui:text-gray-900 zui:bg-gray-50 zui:border zui:border-gray-300":""},G=r("input"),J=n.useState(!1),K=J[0],M=J[1],Q=n.useState(null!==(b=Z.value)&&void 0!==b?b:""),U=Q[0],V=Q[1],W=n.useRef(null),X="textarea"===F,Y="password"===F,ee=Y&&K?"text":F,ie=X?String(U||"").trim().split(/\s+/).filter(Boolean).length:0;n.useEffect(function(){void 0!==Z.value&&V(Z.value)},[Z.value]),n.useEffect(function(){if(void 0!==T&&E)return W.current&&clearTimeout(W.current),W.current=setTimeout(function(){E(String(U))},T),function(){W.current&&clearTimeout(W.current)}},[U,T,E]);var te=function(e){var i="number"===D?/^[0-9]*$/:"alpha"===D?/^[a-zA-Z]*$/:D instanceof RegExp?D:null;if(i){var t=e.data,u=e.currentTarget.value+t;i.test(u)||e.preventDefault(),null==R||R(e)}},ue=function(e){var i=e.target.value;if($&&X&&i.trim().split(/\s+/).filter(Boolean).length>$)return;V(i),null==S||S(e)},ne=N?d[C]:"",re=k||Y?m[C]:"";return t("div",{className:o("zui:w-full",_.container,L),children:[!v&&g&&t("label",{htmlFor:G,className:o("zui:block zui:mb-2 zui:text-sm zui:font-medium zui:leading-none",_.label),children:[g,Z.required&&u("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]}),t("div",{className:o("zui:relative zui:w-full zui:rounded-md zui:border zui:bg-background zui:text-sm zui:transition-colors",H&&"zui:focus-within:ring-1 zui:focus-within:ring-ring zui:focus-within:ring-offset-1","outlined"===B&&"zui:border-input","contained"===B&&"zui:bg-muted zui:border-transparent",w&&"zui:border-destructive",w&&H&&"zui:focus-within:ring-destructive",_.input),children:[v&&g&&t("label",{htmlFor:G,className:o("zui:absolute zui:left-3 zui:top-0 zui:-translate-y-1/2 zui:bg-background zui:px-1 zui:text-xs zui:pointer-events-none zui:transition-colors zui:z-10",_.label),children:[g,Z.required&&u("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]}),N&&u("span",{className:o("zui:absolute zui:inset-y-0 zui:left-0 zui:flex zui:items-center zui:text-muted-foreground",c[C]),children:O?u("button",{type:"button",onClick:O,className:"zui:cursor-pointer zui:focus:outline-none",tabIndex:-1,children:N}):N}),X?u("textarea",i({id:G,ref:p,onBeforeInput:te,onChange:ue,value:U,placeholder:Z.placeholder,disabled:Z.disabled,className:o("zui:peer zui:block zui:w-full zui:bg-transparent zui:outline-none zui:px-3 zui:disabled:cursor-not-allowed zui:disabled:opacity-50 zui:resize-none",z[C],ne,re)},Z)):u("input",i({id:G,ref:p,type:ee,onBeforeInput:te,onChange:ue,value:U,placeholder:Z.placeholder,disabled:Z.disabled,className:o("zui:peer zui:block zui:w-full zui:bg-transparent zui:outline-none zui:px-3 zui:disabled:cursor-not-allowed zui:disabled:opacity-50",s[C],z[C],ne,re)},Z)),(k||Y)&&u("span",{className:o("zui:absolute zui:inset-y-0 zui:right-0 zui:flex zui:items-center zui:text-muted-foreground",c[C]),children:Y?u("button",{type:"button",onClick:function(){return M(function(e){return!e})},className:"zui:focus:outline-none",tabIndex:-1,"aria-label":K?"Hide password":"Show password",children:u(K?l:a,{size:16})}):P?u("button",{type:"button",onClick:P,className:"zui:cursor-pointer zui:focus:outline-none",tabIndex:-1,children:k}):k})]}),t("div",{className:"zui:flex zui:flex-row zui:justify-between",children:[y&&!w&&u("p",{className:"zui:text-xs zui:text-muted-foreground",children:y}),w&&u("p",{className:"zui:text-xs zui:text-destructive",children:w}),X&&void 0!==$&&t("div",{className:"zui:mt-1 zui:text-xs zui:text-muted-foreground zui:text-right zui:flex zui:justify-end zui:flex-1",children:[ie,"/",$," words"]})]})]})});export{f as Input,f as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),i=require("react/jsx-runtime"),t=require("react"),u=require("../../chunks/index-90b71f01.js"),n=require("../../chunks/lucide-493ccaad.js");function r(e){var i=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var u=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,u.get?u:{enumerable:!0,get:function(){return e[t]}})}}),i.default=e,Object.freeze(i)}var s=r(t),l={xs:"zui:h-8 zui:text-xs",sm:"zui:h-9 zui:text-sm",md:"zui:h-10 zui:text-sm",lg:"zui:h-11 zui:text-base"},o={xs:"zui:py-1.5",sm:"zui:py-2",md:"zui:py-2",lg:"zui:py-2.5"},a={xs:"zui:px-2",sm:"zui:px-2.5",md:"zui:px-3",lg:"zui:px-3.5"},c={xs:"zui:pl-8",sm:"zui:pl-9",md:"zui:pl-10",lg:"zui:pl-11"},d={xs:"zui:pr-8",sm:"zui:pr-9",md:"zui:pr-10",lg:"zui:pr-11"},z=s.forwardRef(function(t,r){var z,f,x=t.label,p=t.floatingLabel,b=void 0!==p&&p,m=t.description,g=t.error,h=t.leftIcon,v=t.rightIcon,y=t.size,j=void 0===y?"md":y,w=t.variant,N=void 0===w?"outlined":w,I=t.className,k=t.allowedPattern,C=t.onBeforeInput,O=t.onChange,_=t.onDebouncedChange,q=t.debounceDelay,B=t.type,D=void 0===B?"text":B,E=t.onLeftIconClick,L=t.onRightIconClick,S=t.wordLimit,P=t.focusOutline,R=void 0===P||P,T=e.__rest(t,["label","floatingLabel","description","error","leftIcon","rightIcon","size","variant","className","allowedPattern","onBeforeInput","onChange","onDebouncedChange","debounceDelay","type","onLeftIconClick","onRightIconClick","wordLimit","focusOutline"]),F={container:(f=T.disabled||!1)?"zui:opacity-80":"",label:f?"zui:text-gray-500":"zui:text-gray-700",input:f?" zui:cursor-not-allowed zui:opacity-90 zui:text-gray-900 zui:bg-gray-50 zui:border zui:border-gray-300":""},$=u.useStableId("input"),A=s.useState(!1),H=A[0],M=A[1],Z=s.useState(null!==(z=T.value)&&void 0!==z?z:""),G=Z[0],J=Z[1],K=s.useRef(null),Q="textarea"===D,U="password"===D,V=U&&H?"text":D,W=Q?String(G||"").trim().split(/\s+/).filter(Boolean).length:0;s.useEffect(function(){void 0!==T.value&&J(T.value)},[T.value]),s.useEffect(function(){if(void 0!==q&&_)return K.current&&clearTimeout(K.current),K.current=setTimeout(function(){_(String(G))},q),function(){K.current&&clearTimeout(K.current)}},[G,q,_]);var X=function(e){var i="number"===k?/^[0-9]*$/:"alpha"===k?/^[a-zA-Z]*$/:k instanceof RegExp?k:null;if(i){var t=e.data,u=e.currentTarget.value+t;i.test(u)||e.preventDefault(),null==C||C(e)}},Y=function(e){var i=e.target.value;if(S&&Q&&i.trim().split(/\s+/).filter(Boolean).length>S)return;J(i),null==O||O(e)},ee=h?c[j]:"",ie=v||U?d[j]:"";return i.jsxs("div",{className:u.cn("zui:w-full",F.container,I),children:[!b&&x&&i.jsxs("label",{htmlFor:$,className:u.cn("zui:block zui:mb-2 zui:text-sm zui:font-medium zui:leading-none",F.label),children:[x,T.required&&i.jsx("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]}),i.jsxs("div",{className:u.cn("zui:relative zui:w-full zui:rounded-md zui:border zui:bg-background zui:text-sm zui:transition-colors",R&&"zui:focus-within:ring-1 zui:focus-within:ring-ring zui:focus-within:ring-offset-1","outlined"===N&&"zui:border-input","contained"===N&&"zui:bg-muted zui:border-transparent",g&&"zui:border-destructive",g&&R&&"zui:focus-within:ring-destructive",F.input),children:[b&&x&&i.jsxs("label",{htmlFor:$,className:u.cn("zui:absolute zui:left-3 zui:top-0 zui:-translate-y-1/2 zui:bg-background zui:px-1 zui:text-xs zui:pointer-events-none zui:transition-colors zui:z-10",F.label),children:[x,T.required&&i.jsx("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]}),h&&i.jsx("span",{className:u.cn("zui:absolute zui:inset-y-0 zui:left-0 zui:flex zui:items-center zui:text-muted-foreground",a[j]),children:E?i.jsx("button",{type:"button",onClick:E,className:"zui:cursor-pointer zui:focus:outline-none",tabIndex:-1,children:h}):h}),Q?i.jsx("textarea",e.__assign({id:$,ref:r,onBeforeInput:X,onChange:Y,value:G,placeholder:T.placeholder,disabled:T.disabled,className:u.cn("zui:peer zui:block zui:w-full zui:bg-transparent zui:outline-none zui:px-3 zui:disabled:cursor-not-allowed zui:disabled:opacity-50 zui:resize-none",o[j],ee,ie)},T)):i.jsx("input",e.__assign({id:$,ref:r,type:V,onBeforeInput:X,onChange:Y,value:G,placeholder:T.placeholder,disabled:T.disabled,className:u.cn("zui:peer zui:block zui:w-full zui:bg-transparent zui:outline-none zui:px-3 zui:disabled:cursor-not-allowed zui:disabled:opacity-50",l[j],o[j],ee,ie)},T)),(v||U)&&i.jsx("span",{className:u.cn("zui:absolute zui:inset-y-0 zui:right-0 zui:flex zui:items-center zui:text-muted-foreground",a[j]),children:U?i.jsx("button",{type:"button",onClick:function(){return M(function(e){return!e})},className:"zui:focus:outline-none",tabIndex:-1,"aria-label":H?"Hide password":"Show password",children:H?i.jsx(n.Eye,{size:16}):i.jsx(n.EyeOff,{size:16})}):L?i.jsx("button",{type:"button",onClick:L,className:"zui:cursor-pointer zui:focus:outline-none",tabIndex:-1,children:v}):v})]}),i.jsxs("div",{className:"zui:flex zui:flex-row zui:justify-between",children:[m&&!g&&i.jsx("p",{className:"zui:text-xs zui:text-muted-foreground",children:m}),g&&i.jsx("p",{className:"zui:text-xs zui:text-destructive",children:g}),Q&&void 0!==S&&i.jsxs("div",{className:"zui:mt-1 zui:text-xs zui:text-muted-foreground zui:text-right zui:flex zui:justify-end zui:flex-1",children:[W,"/",S," words"]})]})]})});exports.Input=z,exports.default=z;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
interface ModalProps {
|
|
4
|
-
open: boolean;
|
|
5
|
-
onClose: () => void;
|
|
6
|
-
title?: string | any;
|
|
7
|
-
description?: string;
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
-
actions?: React.ReactNode;
|
|
10
|
-
showCloseIcon?: boolean;
|
|
11
|
-
maxWidth?: false | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
-
fullWidth?: boolean;
|
|
13
|
-
fullScreen?: boolean;
|
|
14
|
-
className?: string;
|
|
15
|
-
allowActionBorder?: boolean;
|
|
16
|
-
}
|
|
17
|
-
declare const Modal: React.FC<ModalProps>;
|
|
18
|
-
|
|
19
|
-
export { Modal, Modal as default };
|
|
20
|
-
export type { ModalProps };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as i}from"../../chunks/tslib.es6-6cad17f3.esm.js";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as o from"react";import{Slide as u,useMediaQuery as s,Dialog as t,IconButton as d,DialogContent as a,DialogActions as l}from"@mui/material";import{a as n}from"../../chunks/index-32c3a4e2.esm.js";import{M as m}from"../../chunks/Muted-7d9a3dca.esm.js";import{X as c}from"../../chunks/lucide-8c9441ea.esm.js";var z=o.forwardRef(function(r,o){return e(u,i({direction:"up",ref:o},r))}),f=function(i){var o=i.open,u=i.onClose,f=i.title,p=i.description,h=i.children,b=i.actions,x=i.showCloseIcon,v=void 0===x||x,N=i.maxWidth,w=void 0===N?"sm":N,j=i.fullWidth,k=void 0===j||j,y=i.fullScreen,g=void 0!==y&&y,C=i.allowActionBorder,W=void 0===C||C,M=i.className,P=s("(max-width:600px)");return r(t,{open:o,onClose:u,TransitionComponent:z,maxWidth:w,fullWidth:k,fullScreen:P||g,scroll:"body",PaperProps:{className:n("zui:bg-background zui:rounded-md zui:shadow-lg zui:border zui:border-border",M)},children:[(f||v)&&r("div",{className:"zui:flex zui:items-center zui:justify-between zui:px-4 zui:py-3 zui:border-b zui:border-border",children:[f&&r("div",{className:"zui:p-0 zui:m-0 zui:!text-base zui:font-bold",children:[f,p&&e(m,{component:"div",className:"zui:mt-1.5",children:p})]}),v&&e(d,{onClick:u,size:"small",className:"zui:ml-auto zui:flex zui:text-muted-foreground hover:zui:text-foreground",children:e(c,{className:"zui:w-5 zui:h-5"})})]}),e(a,{className:n("zui:px-5 zui:py-4 zui:overflow-y-auto zui:max-h-[70vh]"),children:h}),b&&e(l,{className:n("zui:px-5 zui:py-3 zui:border-border",W&&"zui:border-t"),children:b})]})};export{f as Modal,f as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),r=require("react/jsx-runtime"),i=require("react"),u=require("@mui/material"),o=require("../../chunks/index-90b71f01.js"),t=require("../../chunks/Muted-d2dbaba3.js"),s=require("../../chunks/lucide-493ccaad.js");function n(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(i){if("default"!==i){var u=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(r,i,u.get?u:{enumerable:!0,get:function(){return e[i]}})}}),r.default=e,Object.freeze(r)}var l=n(i).forwardRef(function(i,o){return r.jsx(u.Slide,e.__assign({direction:"up",ref:o},i))}),d=function(e){var i=e.open,n=e.onClose,d=e.title,c=e.description,a=e.children,z=e.actions,f=e.showCloseIcon,m=void 0===f||f,x=e.maxWidth,b=void 0===x?"sm":x,h=e.fullWidth,p=void 0===h||h,j=e.fullScreen,v=void 0!==j&&j,g=e.allowActionBorder,y=void 0===g||g,w=e.className,N=u.useMediaQuery("(max-width:600px)");return r.jsxs(u.Dialog,{open:i,onClose:n,TransitionComponent:l,maxWidth:b,fullWidth:p,fullScreen:N||v,scroll:"body",PaperProps:{className:o.cn("zui:bg-background zui:rounded-md zui:shadow-lg zui:border zui:border-border",w)},children:[(d||m)&&r.jsxs("div",{className:"zui:flex zui:items-center zui:justify-between zui:px-4 zui:py-3 zui:border-b zui:border-border",children:[d&&r.jsxs("div",{className:"zui:p-0 zui:m-0 zui:!text-base zui:font-bold",children:[d,c&&r.jsx(t.Muted,{component:"div",className:"zui:mt-1.5",children:c})]}),m&&r.jsx(u.IconButton,{onClick:n,size:"small",className:"zui:ml-auto zui:flex zui:text-muted-foreground hover:zui:text-foreground",children:r.jsx(s.X,{className:"zui:w-5 zui:h-5"})})]}),r.jsx(u.DialogContent,{className:o.cn("zui:px-5 zui:py-4 zui:overflow-y-auto zui:max-h-[70vh]"),children:a}),z&&r.jsx(u.DialogActions,{className:o.cn("zui:px-5 zui:py-3 zui:border-border",y&&"zui:border-t"),children:z})]})};exports.Modal=d,exports.default=d;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
type NoticeVariant = 'success' | 'error' | 'warning' | 'info';
|
|
4
|
-
type NoticeSize = 'sm' | 'md' | 'lg';
|
|
5
|
-
type NoticeStyleType = 'contained' | 'outlined';
|
|
6
|
-
interface NoticeProps {
|
|
7
|
-
title?: string;
|
|
8
|
-
message: string;
|
|
9
|
-
variant?: NoticeVariant;
|
|
10
|
-
size?: NoticeSize;
|
|
11
|
-
styleType?: NoticeStyleType;
|
|
12
|
-
onClose?: () => void;
|
|
13
|
-
className?: string;
|
|
14
|
-
showCloseIcon?: boolean;
|
|
15
|
-
}
|
|
16
|
-
declare const Notice: React.FC<NoticeProps>;
|
|
17
|
-
|
|
18
|
-
export { Notice, Notice as default };
|
|
19
|
-
export type { NoticeProps };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{a as u}from"../../chunks/index-32c3a4e2.esm.js";import{f as r,g as t,T as z,I as s,X as a}from"../../chunks/lucide-8c9441ea.esm.js";import"react";var o={contained:{success:"zui:bg-green-50 zui:text-green-900 zui:border-green-100",error:"zui:bg-red-50 zui:text-red-900 zui:border-red-100",warning:"zui:bg-yellow-50 zui:text-yellow-900 zui:border-yellow-100",info:"zui:bg-blue-50 zui:text-blue-900 zui:border-blue-100"},outlined:{success:"zui:bg-transparent zui:text-green-700 zui:border zui:border-green-700",error:"zui:bg-transparent zui:text-red-700 zui:border zui:border-red-700",warning:"zui:bg-transparent zui:text-yellow-700 zui:border zui:border-yellow-700",info:"zui:bg-transparent zui:text-blue-700 zui:border zui:border-blue-700"}},l={sm:"zui:text-sm zui:px-3 zui:py-2",md:"zui:text-sm zui:px-4 zui:py-3",lg:"zui:text-base zui:px-5 zui:py-4"},n={success:e(r,{className:"zui:h-5 zui:w-5 zui:text-green-600"}),error:e(t,{className:"zui:h-5 zui:w-5 zui:text-red-600"}),warning:e(z,{className:"zui:h-5 zui:w-5 zui:text-yellow-600"}),info:e(s,{className:"zui:h-5 zui:w-5 zui:text-blue-600"})},d=function(r){var t=r.title,z=r.message,s=r.variant,d=void 0===s?"info":s,m=r.size,c=void 0===m?"md":m,b=r.styleType,x=void 0===b?"contained":b,g=r.onClose,p=r.showCloseIcon,f=void 0===p||p,w=r.className;return i("div",{role:"alert",className:u("zui:relative zui:w-full zui:rounded-md zui:flex zui:items-center zui:gap-3",t&&"zui:items-start",o[x][d],l[c],w),children:[e("div",{className:"zui:pt-0.5",children:n[d]}),i("div",{className:"zui:flex-1",children:[t&&e("p",{className:"zui:font-semibold",children:t}),e("p",{className:"zui:text-sm zui:leading-snug",children:z})]}),f&&e("button",{onClick:g,className:"zui:ml-auto zui:mt-0.5 zui:text-muted-foreground hover:zui:text-foreground",children:e(a,{className:"zui:w-4 zui:h-4"})})]})};export{d as Notice,d as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("../../chunks/index-90b71f01.js"),r=require("../../chunks/lucide-493ccaad.js");require("react");var u={contained:{success:"zui:bg-green-50 zui:text-green-900 zui:border-green-100",error:"zui:bg-red-50 zui:text-red-900 zui:border-red-100",warning:"zui:bg-yellow-50 zui:text-yellow-900 zui:border-yellow-100",info:"zui:bg-blue-50 zui:text-blue-900 zui:border-blue-100"},outlined:{success:"zui:bg-transparent zui:text-green-700 zui:border zui:border-green-700",error:"zui:bg-transparent zui:text-red-700 zui:border zui:border-red-700",warning:"zui:bg-transparent zui:text-yellow-700 zui:border zui:border-yellow-700",info:"zui:bg-transparent zui:text-blue-700 zui:border zui:border-blue-700"}},t={sm:"zui:text-sm zui:px-3 zui:py-2",md:"zui:text-sm zui:px-4 zui:py-3",lg:"zui:text-base zui:px-5 zui:py-4"},s={success:e.jsx(r.CircleCheck,{className:"zui:h-5 zui:w-5 zui:text-green-600"}),error:e.jsx(r.CircleAlert,{className:"zui:h-5 zui:w-5 zui:text-red-600"}),warning:e.jsx(r.TriangleAlert,{className:"zui:h-5 zui:w-5 zui:text-yellow-600"}),info:e.jsx(r.Info,{className:"zui:h-5 zui:w-5 zui:text-blue-600"})},z=function(z){var l=z.title,n=z.message,o=z.variant,a=void 0===o?"info":o,d=z.size,c=void 0===d?"md":d,x=z.styleType,b=void 0===x?"contained":x,m=z.onClose,g=z.showCloseIcon,p=void 0===g||g,h=z.className;return e.jsxs("div",{role:"alert",className:i.cn("zui:relative zui:w-full zui:rounded-md zui:flex zui:items-center zui:gap-3",l&&"zui:items-start",u[b][a],t[c],h),children:[e.jsx("div",{className:"zui:pt-0.5",children:s[a]}),e.jsxs("div",{className:"zui:flex-1",children:[l&&e.jsx("p",{className:"zui:font-semibold",children:l}),e.jsx("p",{className:"zui:text-sm zui:leading-snug",children:n})]}),p&&e.jsx("button",{onClick:m,className:"zui:ml-auto zui:mt-0.5 zui:text-muted-foreground hover:zui:text-foreground",children:e.jsx(r.X,{className:"zui:w-4 zui:h-4"})})]})};exports.Notice=z,exports.default=z;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import React__default from 'react';
|
|
3
|
-
import { PopoverProps as PopoverProps$1 } from '@mui/material';
|
|
4
|
-
|
|
5
|
-
interface PopoverProps extends Partial<PopoverProps$1> {
|
|
6
|
-
open: boolean;
|
|
7
|
-
onClose: () => void;
|
|
8
|
-
anchorEl: HTMLElement | null;
|
|
9
|
-
children: React__default.ReactNode;
|
|
10
|
-
width?: number | string;
|
|
11
|
-
maxWidth?: number | string;
|
|
12
|
-
minWidth?: number | string;
|
|
13
|
-
padding?: number;
|
|
14
|
-
border?: boolean;
|
|
15
|
-
}
|
|
16
|
-
declare const Popover: ({ open, onClose, anchorEl, children, width, maxWidth, minWidth, padding, border, anchorOrigin, transformOrigin, ...rest }: PopoverProps) => react_jsx_runtime.JSX.Element;
|
|
17
|
-
|
|
18
|
-
export { Popover, Popover as default };
|
|
19
|
-
export type { PopoverProps };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as r,a as i}from"../../chunks/tslib.es6-6cad17f3.esm.js";import{jsx as o}from"react/jsx-runtime";import{Popover as n,Fade as a}from"@mui/material";var t=function(t){var e=t.open,d=t.onClose,s=t.anchorEl,m=t.children,p=t.width,c=t.maxWidth,h=void 0===c?"100%":c,l=t.minWidth,b=t.padding,f=void 0===b?2:b,x=t.border,g=void 0===x||x,u=t.anchorOrigin,v=void 0===u?{vertical:"bottom",horizontal:"left"}:u,O=t.transformOrigin,W=void 0===O?{vertical:"top",horizontal:"left"}:O,w=r(t,["open","onClose","anchorEl","children","width","maxWidth","minWidth","padding","border","anchorOrigin","transformOrigin"]);return o(n,i({open:e,onClose:d,anchorEl:s,anchorOrigin:v,transformOrigin:W,TransitionComponent:a,transitionDuration:180,slotProps:{paper:{sx:{boxShadow:"0px 4px 32px rgba(0,0,0,0.08), 0px 1.5px 6px rgba(0,0,0,0.06)",border:g?"1px solid #e5e7eb":"none",borderRadius:1,background:"#fff",width:p,minWidth:l,maxWidth:h,p:f,transition:"opacity 180ms cubic-bezier(0.4,0,0.2,1), transform 180ms cubic-bezier(0.4,0,0.2,1)",opacity:e?1:0,transform:e?"scale(1)":"scale(0.95)"}}}},w,{children:m}))};export{t as Popover,t as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("../../chunks/tslib.es6-a3dc1f53.js"),i=require("react/jsx-runtime"),o=require("@mui/material"),e=function(e){var n=e.open,t=e.onClose,a=e.anchorEl,s=e.children,d=e.width,p=e.maxWidth,c=void 0===p?"100%":p,l=e.minWidth,h=e.padding,m=void 0===h?2:h,u=e.border,x=void 0===u||u,b=e.anchorOrigin,f=void 0===b?{vertical:"bottom",horizontal:"left"}:b,g=e.transformOrigin,v=void 0===g?{vertical:"top",horizontal:"left"}:g,O=r.__rest(e,["open","onClose","anchorEl","children","width","maxWidth","minWidth","padding","border","anchorOrigin","transformOrigin"]);return i.jsx(o.Popover,r.__assign({open:n,onClose:t,anchorEl:a,anchorOrigin:f,transformOrigin:v,TransitionComponent:o.Fade,transitionDuration:180,slotProps:{paper:{sx:{boxShadow:"0px 4px 32px rgba(0,0,0,0.08), 0px 1.5px 6px rgba(0,0,0,0.06)",border:x?"1px solid #e5e7eb":"none",borderRadius:1,background:"#fff",width:d,minWidth:l,maxWidth:c,p:m,transition:"opacity 180ms cubic-bezier(0.4,0,0.2,1), transform 180ms cubic-bezier(0.4,0,0.2,1)",opacity:n?1:0,transform:n?"scale(1)":"scale(0.95)"}}}},O,{children:s}))};exports.Popover=e,exports.default=e;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
|
|
3
|
-
interface PopupConfirmProps {
|
|
4
|
-
open: boolean;
|
|
5
|
-
onClose: () => void;
|
|
6
|
-
title?: string | React__default.ReactNode;
|
|
7
|
-
message: string | React__default.ReactNode;
|
|
8
|
-
description?: string;
|
|
9
|
-
confirmText?: string;
|
|
10
|
-
cancelText?: string;
|
|
11
|
-
confirmVariant?: 'text' | 'outlined' | 'contained';
|
|
12
|
-
cancelVariant?: 'text' | 'outlined' | 'contained';
|
|
13
|
-
confirmColor?: 'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success';
|
|
14
|
-
cancelColor?: 'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success';
|
|
15
|
-
loading?: boolean;
|
|
16
|
-
loadingText?: string;
|
|
17
|
-
icon?: React__default.ReactNode;
|
|
18
|
-
maxWidth?: false | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
19
|
-
fullWidth?: boolean;
|
|
20
|
-
showCloseIcon?: boolean;
|
|
21
|
-
confirmSize?: 'small' | 'medium' | 'large';
|
|
22
|
-
cancelSize?: 'small' | 'medium' | 'large';
|
|
23
|
-
onConfirm: () => void | Promise<void>;
|
|
24
|
-
onCancel?: () => void;
|
|
25
|
-
children?: React__default.ReactNode;
|
|
26
|
-
className?: string;
|
|
27
|
-
actionsClassName?: string;
|
|
28
|
-
messageClassName?: string;
|
|
29
|
-
reverseActions?: boolean;
|
|
30
|
-
singleAction?: boolean;
|
|
31
|
-
variant?: 'default' | 'delete' | 'save' | 'warning' | 'info' | 'success' | 'error';
|
|
32
|
-
}
|
|
33
|
-
declare const PopupConfirm: React__default.FC<PopupConfirmProps>;
|
|
34
|
-
|
|
35
|
-
export { PopupConfirm, PopupConfirm as default };
|
|
36
|
-
export type { PopupConfirmProps };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as e,e as i}from"../../chunks/tslib.es6-6cad17f3.esm.js";import{jsxs as r,jsx as o}from"react/jsx-runtime";import{useCallback as n}from"react";import{Modal as t}from"../Modal/index.esm.js";import{Button as u}from"../Button/index.esm.js";import{a as c}from"../../chunks/index-32c3a4e2.esm.js";import{H as l}from"../../chunks/Heading-177b03ef.esm.js";import{T as a}from"../../chunks/Text-18106168.esm.js";import"@mui/material";import"../../chunks/Muted-7d9a3dca.esm.js";import"../../chunks/lucide-8c9441ea.esm.js";var s={default:{iconBg:"zui:bg-blue-50",iconColor:"zui:text-blue-600",confirmBg:"zui:bg-blue-500 hover:zui:bg-blue-600",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-white",cancelText:"zui:text-gray-700"},delete:{iconBg:"zui:bg-red-50",iconColor:"zui:text-red-600",confirmBg:"zui:bg-red-100 hover:zui:bg-red-200",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-red-700",cancelText:"zui:text-gray-700"},save:{iconBg:"zui:bg-green-50",iconColor:"zui:text-green-600",confirmBg:"zui:bg-green-500 hover:zui:bg-green-600",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-white",cancelText:"zui:text-gray-700"},warning:{iconBg:"zui:bg-amber-50",iconColor:"zui:text-amber-600",confirmBg:"zui:bg-amber-500 hover:zui:bg-amber-600",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-white",cancelText:"zui:text-gray-700"},info:{iconBg:"zui:bg-blue-50",iconColor:"zui:text-blue-600",confirmBg:"zui:bg-blue-500 hover:zui:bg-blue-600",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-white",cancelText:"zui:text-gray-700"},success:{iconBg:"zui:bg-green-50",iconColor:"zui:text-green-600",confirmBg:"zui:bg-green-500 hover:zui:bg-green-600",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-white",cancelText:"zui:text-gray-700"},error:{iconBg:"zui:bg-red-50",iconColor:"zui:text-red-600",confirmBg:"zui:bg-red-500 hover:zui:bg-red-600",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-white",cancelText:"zui:text-gray-700"}},z=function(z){var d=z.open,g=z.onClose,m=z.title,h=void 0===m?"Are you sure?":m,v=z.message,x=z.description,f=z.confirmText,b=void 0===f?"Yes, Delete":f,p=z.cancelText,C=void 0===p?"No, Cancel":p,k=z.confirmVariant,y=z.loading,B=void 0!==y&&y,w=z.icon,N=z.maxWidth,j=void 0===N?"sm":N,T=z.fullWidth,L=void 0!==T&&T,M=z.showCloseIcon,W=void 0===M||M,A=z.onConfirm,H=z.onCancel,V=z.children,I=z.className,R=z.actionsClassName,D=z.messageClassName,Y=z.reverseActions,q=void 0!==Y&&Y,E=z.singleAction,F=void 0!==E&&E,G=z.variant,J=void 0===G?"delete":G,K=n(function(){return e(void 0,void 0,void 0,function(){var e;return i(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,A()];case 1:return i.sent(),[3,3];case 2:return e=i.sent(),console.error("Confirm action failed:",e),[3,3];case 3:return[2]}})})},[A]),O=n(function(){null==H||H(),null==g||g()},[H,g]),P=n(function(){B||g()},[B,g]),Q=s[J],S=r("div",{className:c("zui:flex zui:gap-4 zui:justify-center zui:w-full zui:mt-8 zui:px-6",q&&"zui:flex-row-reverse",R),children:[!F&&o(u,{size:"small",onClick:O,disabled:B,className:c(Q.cancelBg,Q.cancelText),children:C}),o(u,{onClick:K,disabled:B,loading:B,className:c("outlined"===k?"zui:border-2 zui:border-current zui:bg-transparent":Q.confirmBg,"text"===k?"zui:bg-transparent":"",Q.confirmText),children:b})]});return r(t,{open:d,onClose:P,maxWidth:j,fullWidth:L,showCloseIcon:!1,className:c("zui:p-0 zui:m-0 zui:relative",I),children:[W&&o("button",{onClick:P,disabled:B,className:"zui:absolute zui:top-2 zui:right-2 zui:w-8 zui:h-8 zui:bg-gray-100 zui:rounded-full zui:flex zui:items-center zui:justify-center zui:text-gray-500 hover:zui:text-gray-700 hover:zui:bg-gray-200 zui:transition-all zui:duration-200 zui:border-0 zui:cursor-pointer zui:z-10",children:o("svg",{className:"zui:w-4 zui:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),r("div",{className:"zui:text-center zui:p-1",children:[o("div",w?{className:"zui:flex zui:justify-center zui:mb-6",children:w}:{className:"zui:flex zui:justify-center zui:mb-6",children:r("div",{className:c("zui:w-12 zui:h-12 zui:rounded-full zui:flex zui:items-center zui:justify-center",Q.iconBg),children:["delete"===J&&o("svg",{className:c("zui:w-8 zui:h-8",Q.iconColor),fill:"currentColor",viewBox:"0 0 24 24",children:o("path",{fillRule:"evenodd",d:"M16.5 4.478v.227a48.816 48.816 0 013.878.512.75.75 0 11-.256 1.478l-.209-.035-1.005 13.07a3 3 0 01-2.991 2.77H8.084a3 3 0 01-2.991-2.77L4.087 6.66l-.209.035a.75.75 0 01-.256-1.478A48.567 48.567 0 017.5 4.705v-.227c0-1.564 1.213-2.9 2.816-2.951a52.662 52.662 0 013.369 0c1.603.051 2.815 1.387 2.815 2.951zm-6.136-1.452a51.196 51.196 0 013.273 0C14.39 3.05 15 3.684 15 4.478v.113a49.488 49.488 0 00-6 0v-.113c0-.794.609-1.428 1.364-1.452zm-.355 5.945a.75.75 0 10-1.5.058l.347 9a.75.75 0 101.499-.058l-.346-9zm5.48.058a.75.75 0 00-1.498-.058l-.347 9a.75.75 0 001.5.058l.345-9z",clipRule:"evenodd"})}),"save"===J&&o("svg",{className:c("zui:w-8 zui:h-8",Q.iconColor),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4"})}),"warning"===J&&o("svg",{className:c("zui:w-8 zui:h-8",Q.iconColor),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})}),("info"===J||"default"===J)&&o("svg",{className:c("zui:w-8 zui:h-8",Q.iconColor),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"success"===J&&o("svg",{className:c("zui:w-8 zui:h-8",Q.iconColor),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),"error"===J&&o("svg",{className:c("zui:w-8 zui:h-8",Q.iconColor),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})})]})}),o(l,{level:5,children:h}),o(a,{size:"sm",className:D,children:v}),x&&o(a,{className:"zui:text-sm zui:text-gray-500 zui:mt-1",children:x}),V&&o("div",{className:"zui:mt-6",children:V}),S]})]})};export{z as PopupConfirm,z as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),i=require("react/jsx-runtime"),r=require("react"),n=require("../Modal/index.js"),o=require("../Button/index.js"),u=require("../../chunks/index-90b71f01.js"),t=require("../../chunks/Heading-ff5c771d.js"),c=require("../../chunks/Text-e9636dd7.js");require("@mui/material"),require("../../chunks/Muted-d2dbaba3.js"),require("../../chunks/lucide-493ccaad.js");var l={default:{iconBg:"zui:bg-blue-50",iconColor:"zui:text-blue-600",confirmBg:"zui:bg-blue-500 hover:zui:bg-blue-600",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-white",cancelText:"zui:text-gray-700"},delete:{iconBg:"zui:bg-red-50",iconColor:"zui:text-red-600",confirmBg:"zui:bg-red-100 hover:zui:bg-red-200",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-red-700",cancelText:"zui:text-gray-700"},save:{iconBg:"zui:bg-green-50",iconColor:"zui:text-green-600",confirmBg:"zui:bg-green-500 hover:zui:bg-green-600",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-white",cancelText:"zui:text-gray-700"},warning:{iconBg:"zui:bg-amber-50",iconColor:"zui:text-amber-600",confirmBg:"zui:bg-amber-500 hover:zui:bg-amber-600",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-white",cancelText:"zui:text-gray-700"},info:{iconBg:"zui:bg-blue-50",iconColor:"zui:text-blue-600",confirmBg:"zui:bg-blue-500 hover:zui:bg-blue-600",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-white",cancelText:"zui:text-gray-700"},success:{iconBg:"zui:bg-green-50",iconColor:"zui:text-green-600",confirmBg:"zui:bg-green-500 hover:zui:bg-green-600",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-white",cancelText:"zui:text-gray-700"},error:{iconBg:"zui:bg-red-50",iconColor:"zui:text-red-600",confirmBg:"zui:bg-red-500 hover:zui:bg-red-600",cancelBg:"zui:bg-gray-100 hover:zui:bg-gray-200",confirmText:"zui:text-white",cancelText:"zui:text-gray-700"}},s=function(s){var a=s.open,z=s.onClose,d=s.title,g=void 0===d?"Are you sure?":d,x=s.message,h=s.description,m=s.confirmText,v=void 0===m?"Yes, Delete":m,b=s.cancelText,f=void 0===b?"No, Cancel":b,j=s.confirmVariant,C=s.loading,k=void 0!==C&&C,y=s.icon,B=s.maxWidth,p=void 0===B?"sm":B,w=s.fullWidth,N=void 0!==w&&w,T=s.showCloseIcon,L=void 0===T||T,M=s.onConfirm,q=s.onCancel,W=s.children,_=s.className,A=s.actionsClassName,H=s.messageClassName,V=s.reverseActions,I=void 0!==V&&V,P=s.singleAction,R=void 0!==P&&P,D=s.variant,O=void 0===D?"delete":D,Y=r.useCallback(function(){return e.__awaiter(void 0,void 0,void 0,function(){var i;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,M()];case 1:return e.sent(),[3,3];case 2:return i=e.sent(),console.error("Confirm action failed:",i),[3,3];case 3:return[2]}})})},[M]),E=r.useCallback(function(){null==q||q(),null==z||z()},[q,z]),F=r.useCallback(function(){k||z()},[k,z]),G=l[O],J=i.jsxs("div",{className:u.cn("zui:flex zui:gap-4 zui:justify-center zui:w-full zui:mt-8 zui:px-6",I&&"zui:flex-row-reverse",A),children:[!R&&i.jsx(o.Button,{size:"small",onClick:E,disabled:k,className:u.cn(G.cancelBg,G.cancelText),children:f}),i.jsx(o.Button,{onClick:Y,disabled:k,loading:k,className:u.cn("outlined"===j?"zui:border-2 zui:border-current zui:bg-transparent":G.confirmBg,"text"===j?"zui:bg-transparent":"",G.confirmText),children:v})]});return i.jsxs(n.Modal,{open:a,onClose:F,maxWidth:p,fullWidth:N,showCloseIcon:!1,className:u.cn("zui:p-0 zui:m-0 zui:relative",_),children:[L&&i.jsx("button",{onClick:F,disabled:k,className:"zui:absolute zui:top-2 zui:right-2 zui:w-8 zui:h-8 zui:bg-gray-100 zui:rounded-full zui:flex zui:items-center zui:justify-center zui:text-gray-500 hover:zui:text-gray-700 hover:zui:bg-gray-200 zui:transition-all zui:duration-200 zui:border-0 zui:cursor-pointer zui:z-10",children:i.jsx("svg",{className:"zui:w-4 zui:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),i.jsxs("div",{className:"zui:text-center zui:p-1",children:[y?i.jsx("div",{className:"zui:flex zui:justify-center zui:mb-6",children:y}):i.jsx("div",{className:"zui:flex zui:justify-center zui:mb-6",children:i.jsxs("div",{className:u.cn("zui:w-12 zui:h-12 zui:rounded-full zui:flex zui:items-center zui:justify-center",G.iconBg),children:["delete"===O&&i.jsx("svg",{className:u.cn("zui:w-8 zui:h-8",G.iconColor),fill:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{fillRule:"evenodd",d:"M16.5 4.478v.227a48.816 48.816 0 013.878.512.75.75 0 11-.256 1.478l-.209-.035-1.005 13.07a3 3 0 01-2.991 2.77H8.084a3 3 0 01-2.991-2.77L4.087 6.66l-.209.035a.75.75 0 01-.256-1.478A48.567 48.567 0 017.5 4.705v-.227c0-1.564 1.213-2.9 2.816-2.951a52.662 52.662 0 013.369 0c1.603.051 2.815 1.387 2.815 2.951zm-6.136-1.452a51.196 51.196 0 013.273 0C14.39 3.05 15 3.684 15 4.478v.113a49.488 49.488 0 00-6 0v-.113c0-.794.609-1.428 1.364-1.452zm-.355 5.945a.75.75 0 10-1.5.058l.347 9a.75.75 0 101.499-.058l-.346-9zm5.48.058a.75.75 0 00-1.498-.058l-.347 9a.75.75 0 001.5.058l.345-9z",clipRule:"evenodd"})}),"save"===O&&i.jsx("svg",{className:u.cn("zui:w-8 zui:h-8",G.iconColor),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4"})}),"warning"===O&&i.jsx("svg",{className:u.cn("zui:w-8 zui:h-8",G.iconColor),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})}),("info"===O||"default"===O)&&i.jsx("svg",{className:u.cn("zui:w-8 zui:h-8",G.iconColor),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"success"===O&&i.jsx("svg",{className:u.cn("zui:w-8 zui:h-8",G.iconColor),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),"error"===O&&i.jsx("svg",{className:u.cn("zui:w-8 zui:h-8",G.iconColor),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})})]})}),i.jsx(t.Heading,{level:5,children:g}),i.jsx(c.Text,{size:"sm",className:H,children:x}),h&&i.jsx(c.Text,{className:"zui:text-sm zui:text-gray-500 zui:mt-1",children:h}),W&&i.jsx("div",{className:"zui:mt-6",children:W}),J]})]})};exports.PopupConfirm=s,exports.default=s;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { SxProps } from '@mui/system';
|
|
3
|
-
|
|
4
|
-
interface RadioProps {
|
|
5
|
-
label?: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
name?: string;
|
|
8
|
-
checked?: boolean;
|
|
9
|
-
defaultChecked?: boolean;
|
|
10
|
-
onChange?: (event: React__default.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
required?: boolean;
|
|
13
|
-
error?: boolean;
|
|
14
|
-
helperText?: string;
|
|
15
|
-
size?: 'small' | 'medium';
|
|
16
|
-
color?: 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
|
|
17
|
-
sx?: SxProps;
|
|
18
|
-
radioSx?: SxProps;
|
|
19
|
-
labelSx?: SxProps;
|
|
20
|
-
}
|
|
21
|
-
declare const Radio: React__default.ForwardRefExoticComponent<RadioProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
22
|
-
|
|
23
|
-
export { Radio, Radio as default };
|
|
24
|
-
export type { RadioProps };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,a as r}from"../../chunks/tslib.es6-6cad17f3.esm.js";import{jsxs as t,jsx as l}from"react/jsx-runtime";import o from"react";import{useTheme as i,FormControl as a,FormLabel as d,Typography as n,FormControlLabel as s,Radio as m,Box as c,FormHelperText as p}from"@mui/material";var x=o.forwardRef(function(o,x){var h=o.label,f=o.description,b=o.name,u=o.checked,v=void 0!==u&&u,g=o.defaultChecked,y=void 0!==g&&g,k=o.onChange,C=o.disabled,S=void 0!==C&&C,z=o.required,M=void 0!==z&&z,R=o.error,j=void 0!==R&&R,q=o.helperText,B=o.size,H=void 0===B?"medium":B,T=o.color,W=void 0===T?"primary":T,w=o.sx,D=void 0===w?{}:w,F=o.radioSx,I=void 0===F?{}:F,L=o.labelSx,_=void 0===L?{}:L,A=e(o,["label","description","name","checked","defaultChecked","onChange","disabled","required","error","helperText","size","color","sx","radioSx","labelSx"]),E=i();return t(a,r({ref:x,component:"fieldset",error:j,disabled:S,sx:r({borderRadius:"8px"},D)},A,{children:[h&&t(d,{sx:r({fontWeight:500,fontSize:"small"===H?"0.875rem":"1rem",color:S?E.palette.text.disabled:j?E.palette.error.main:E.palette.text.primary,mb:1},_),children:[h,M&&l(n,{component:"span",sx:{color:E.palette.error.main,ml:.5,fontSize:"inherit"},children:"*"})]}),l(s,{control:l(m,{name:b,checked:v,defaultChecked:y,onChange:k,size:H,color:W,sx:r({"&.Mui-checked":{color:j?E.palette.error.main:E.palette[W].main},mt:f?.25:0},I)}),label:t(c,{sx:{display:"flex",flexDirection:"column"},children:[l(n,{variant:"small"===H?"body2":"body1",sx:{fontWeight:400,color:S?E.palette.text.disabled:E.palette.text.primary,lineHeight:1.5},children:h}),f&&l(n,{variant:"caption",sx:{color:S?E.palette.text.disabled:E.palette.text.secondary,mt:.25,lineHeight:1.4},children:f})]}),sx:{alignItems:f?"flex-start":"center",margin:0,display:"flex","& .MuiFormControlLabel-label":{ml:1,flex:1},"& .MuiButtonBase-root":{p:"small"===H?.5:1}}}),q&&l(p,{sx:{mt:1,fontSize:"small"===H?"0.75rem":"0.875rem",color:j?E.palette.error.main:E.palette.text.secondary},children:q})]}))});export{x as Radio,x as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),r=require("react/jsx-runtime"),t=require("react"),o=require("@mui/material"),l=t.forwardRef(function(t,l){var i=t.label,a=t.description,s=t.name,d=t.checked,n=void 0!==d&&d,x=t.defaultChecked,c=void 0!==x&&x,m=t.onChange,p=t.disabled,h=void 0!==p&&p,u=t.required,b=void 0!==u&&u,f=t.error,g=void 0!==f&&f,y=t.helperText,v=t.size,j=void 0===v?"medium":v,_=t.color,C=void 0===_?"primary":_,k=t.sx,S=void 0===k?{}:k,T=t.radioSx,q=void 0===T?{}:T,z=t.labelSx,F=void 0===z?{}:z,M=e.__rest(t,["label","description","name","checked","defaultChecked","onChange","disabled","required","error","helperText","size","color","sx","radioSx","labelSx"]),R=o.useTheme();return r.jsxs(o.FormControl,e.__assign({ref:l,component:"fieldset",error:g,disabled:h,sx:e.__assign({borderRadius:"8px"},S)},M,{children:[i&&r.jsxs(o.FormLabel,{sx:e.__assign({fontWeight:500,fontSize:"small"===j?"0.875rem":"1rem",color:h?R.palette.text.disabled:g?R.palette.error.main:R.palette.text.primary,mb:1},F),children:[i,b&&r.jsx(o.Typography,{component:"span",sx:{color:R.palette.error.main,ml:.5,fontSize:"inherit"},children:"*"})]}),r.jsx(o.FormControlLabel,{control:r.jsx(o.Radio,{name:s,checked:n,defaultChecked:c,onChange:m,size:j,color:C,sx:e.__assign({"&.Mui-checked":{color:g?R.palette.error.main:R.palette[C].main},mt:a?.25:0},q)}),label:r.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column"},children:[r.jsx(o.Typography,{variant:"small"===j?"body2":"body1",sx:{fontWeight:400,color:h?R.palette.text.disabled:R.palette.text.primary,lineHeight:1.5},children:i}),a&&r.jsx(o.Typography,{variant:"caption",sx:{color:h?R.palette.text.disabled:R.palette.text.secondary,mt:.25,lineHeight:1.4},children:a})]}),sx:{alignItems:a?"flex-start":"center",margin:0,display:"flex","& .MuiFormControlLabel-label":{ml:1,flex:1},"& .MuiButtonBase-root":{p:"small"===j?.5:1}}}),y&&r.jsx(o.FormHelperText,{sx:{mt:1,fontSize:"small"===j?"0.75rem":"0.875rem",color:g?R.palette.error.main:R.palette.text.secondary},children:y})]}))});exports.Radio=l,exports.default=l;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { SxProps } from '@mui/system';
|
|
3
|
-
|
|
4
|
-
interface RadioOption {
|
|
5
|
-
value: string;
|
|
6
|
-
label: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
description?: string;
|
|
9
|
-
}
|
|
10
|
-
interface RadioGroupProps {
|
|
11
|
-
label?: string;
|
|
12
|
-
options: RadioOption[];
|
|
13
|
-
value?: string;
|
|
14
|
-
defaultValue?: string;
|
|
15
|
-
onChange?: (value: string) => void;
|
|
16
|
-
name?: string;
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
required?: boolean;
|
|
19
|
-
error?: boolean;
|
|
20
|
-
helperText?: string;
|
|
21
|
-
row?: boolean;
|
|
22
|
-
size?: 'small' | 'medium';
|
|
23
|
-
color?: 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
|
|
24
|
-
sx?: SxProps;
|
|
25
|
-
radioSx?: SxProps;
|
|
26
|
-
labelSx?: SxProps;
|
|
27
|
-
}
|
|
28
|
-
declare const RadioGroup: React__default.ForwardRefExoticComponent<RadioGroupProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
29
|
-
|
|
30
|
-
export { RadioGroup, RadioGroup as default };
|
|
31
|
-
export type { RadioGroupProps, RadioOption };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,a as r}from"../../chunks/tslib.es6-6cad17f3.esm.js";import{jsxs as t,jsx as a}from"react/jsx-runtime";import o from"react";import{useTheme as l,FormControl as i,FormLabel as n,Typography as d,RadioGroup as s,Box as m,FormControlLabel as c,Radio as p,FormHelperText as u}from"@mui/material";var x=o.forwardRef(function(x,f){var v=x.label,b=x.options,h=void 0===b?[]:b,g=x.value,y=x.defaultValue,S=x.onChange,z=x.name,C=x.disabled,M=void 0!==C&&C,w=x.required,R=void 0!==w&&w,L=x.error,j=void 0!==L&&L,k=x.helperText,q=x.row,B=void 0!==q&&q,F=x.size,H=void 0===F?"medium":F,T=x.color,V=void 0===T?"primary":T,W=x.sx,D=void 0===W?{}:W,E=x.radioSx,G=void 0===E?{}:E,I=x.labelSx,_=void 0===I?{}:I,A=e(x,["label","options","value","defaultValue","onChange","name","disabled","required","error","helperText","row","size","color","sx","radioSx","labelSx"]),J=l(),K=o.useState(g||y||""),N=K[0],O=K[1];o.useEffect(function(){void 0!==g&&O(g)},[g]);var P=void 0!==g?g:N;return t(i,r({ref:f,component:"fieldset",variant:"standard",disabled:M,error:j,sx:r({borderRadius:"8px"},D)},A,{children:[v&&t(n,{component:"legend",sx:r({fontWeight:500,fontSize:"small"===H?"0.875rem":"1rem",color:M?J.palette.text.disabled:j?J.palette.error.main:J.palette.text.primary,"&.Mui-focused":{color:j?J.palette.error.main:"".concat(J.palette[V].main)},mb:1},_),children:[v,R&&a(d,{component:"span",sx:{color:J.palette.error.main,ml:.5,fontSize:"inherit"},children:"*"})]}),a(s,{name:z,value:P,onChange:function(e){var r=e.target.value;void 0===g&&O(r),null==S||S(r)},row:B,sx:{gap:"small"===H?1:1.5,"& .MuiFormControlLabel-root":{marginLeft:0,marginRight:B?2:0}},children:h.map(function(e){return a(m,{children:a(c,{value:e.value,disabled:M||e.disabled,control:a(p,{size:H,color:V,sx:r({"&.Mui-checked":{color:j?J.palette.error.main:"".concat(J.palette[V].main)},alignSelf:e.description?"flex-start":"center",mt:e.description?.25:0},G)}),label:t(m,{sx:{display:"flex",flexDirection:"column"},children:[a(d,{variant:"small"===H?"body2":"body1",sx:{fontWeight:400,color:M||e.disabled?J.palette.text.disabled:J.palette.text.primary,lineHeight:1.5},children:e.label}),e.description&&a(d,{variant:"caption",sx:{color:M||e.disabled?J.palette.text.disabled:J.palette.text.secondary,mt:.25,lineHeight:1.4},children:e.description})]}),sx:{alignItems:e.description?"flex-start":"center",margin:0,display:"flex","& .MuiFormControlLabel-label":{ml:1,flex:1},"& .MuiButtonBase-root":{p:"small"===H?.5:1}}})},e.value)})}),k&&a(u,{sx:{mt:1,fontSize:"small"===H?"0.75rem":"0.875rem",color:j?J.palette.error.main:J.palette.text.secondary},children:k})]}))});export{x as RadioGroup,x as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),r=require("react/jsx-runtime"),t=require("react"),o=require("@mui/material"),a=t.forwardRef(function(a,i){var l=a.label,n=a.options,s=void 0===n?[]:n,d=a.value,c=a.defaultValue,p=a.onChange,x=a.name,m=a.disabled,u=void 0!==m&&m,f=a.required,v=void 0!==f&&f,b=a.error,h=void 0!==b&&b,g=a.helperText,y=a.row,j=void 0!==y&&y,_=a.size,S=void 0===_?"medium":_,C=a.color,T=void 0===C?"primary":C,q=a.sx,z=void 0===q?{}:q,F=a.radioSx,M=void 0===F?{}:F,R=a.labelSx,L=void 0===R?{}:R,w=e.__rest(a,["label","options","value","defaultValue","onChange","name","disabled","required","error","helperText","row","size","color","sx","radioSx","labelSx"]),B=o.useTheme(),H=t.useState(d||c||""),k=H[0],G=H[1];t.useEffect(function(){void 0!==d&&G(d)},[d]);var V=void 0!==d?d:k;return r.jsxs(o.FormControl,e.__assign({ref:i,component:"fieldset",variant:"standard",disabled:u,error:h,sx:e.__assign({borderRadius:"8px"},z)},w,{children:[l&&r.jsxs(o.FormLabel,{component:"legend",sx:e.__assign({fontWeight:500,fontSize:"small"===S?"0.875rem":"1rem",color:u?B.palette.text.disabled:h?B.palette.error.main:B.palette.text.primary,"&.Mui-focused":{color:h?B.palette.error.main:"".concat(B.palette[T].main)},mb:1},L),children:[l,v&&r.jsx(o.Typography,{component:"span",sx:{color:B.palette.error.main,ml:.5,fontSize:"inherit"},children:"*"})]}),r.jsx(o.RadioGroup,{name:x,value:V,onChange:function(e){var r=e.target.value;void 0===d&&G(r),null==p||p(r)},row:j,sx:{gap:"small"===S?1:1.5,"& .MuiFormControlLabel-root":{marginLeft:0,marginRight:j?2:0}},children:s.map(function(t){return r.jsx(o.Box,{children:r.jsx(o.FormControlLabel,{value:t.value,disabled:u||t.disabled,control:r.jsx(o.Radio,{size:S,color:T,sx:e.__assign({"&.Mui-checked":{color:h?B.palette.error.main:"".concat(B.palette[T].main)},alignSelf:t.description?"flex-start":"center",mt:t.description?.25:0},M)}),label:r.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column"},children:[r.jsx(o.Typography,{variant:"small"===S?"body2":"body1",sx:{fontWeight:400,color:u||t.disabled?B.palette.text.disabled:B.palette.text.primary,lineHeight:1.5},children:t.label}),t.description&&r.jsx(o.Typography,{variant:"caption",sx:{color:u||t.disabled?B.palette.text.disabled:B.palette.text.secondary,mt:.25,lineHeight:1.4},children:t.description})]}),sx:{alignItems:t.description?"flex-start":"center",margin:0,display:"flex","& .MuiFormControlLabel-label":{ml:1,flex:1},"& .MuiButtonBase-root":{p:"small"===S?.5:1}}})},t.value)})}),g&&r.jsx(o.FormHelperText,{sx:{mt:1,fontSize:"small"===S?"0.75rem":"0.875rem",color:h?B.palette.error.main:B.palette.text.secondary},children:g})]}))});exports.RadioGroup=a,exports.default=a;
|