@epam/ai-dial-ui-kit 0.2.0-rc.5 → 0.2.0-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dial-ui-kit.cjs.js +1 -1
- package/dist/dial-ui-kit.es.js +157 -126
- package/dist/index.css +1 -1
- package/dist/src/components/Alert/Alert.d.ts +3 -3
- package/dist/src/components/Alert/constants.d.ts +1 -1
- package/dist/src/components/Loader/Loader.d.ts +32 -0
- package/dist/src/components/Loader/constants.d.ts +2 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/dial-ui-kit.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),u=require("classnames"),y=require("@tabler/icons-react"),d=require("@floating-ui/react"),f=require("react"),N=({icon:e,className:r})=>e?s.jsx("span",{className:u("flex-shrink-0",r),children:e}):null;var T=(e=>(e.Primary="primary",e.Secondary="secondary",e.Tertiary="tertiary",e))(T||{});const K={[T.Primary]:"dial-primary-button",[T.Secondary]:"dial-secondary-button",[T.Tertiary]:"dial-tertiary-button"},L=({title:e,variant:r,cssClass:t,ref:n,onClick:a,disable:l,iconAfter:o,iconBefore:c,hideTitleOnMobile:i,ariaLabel:p})=>{const x=u("dial-small-semi",o?"mr-2":"",c?"ml-2":"",i?"hidden sm:inline":"inline"),m=u(r&&K[r],t,"focus-visible:outline outline-offset-0");return s.jsxs("button",{ref:n,type:"button",className:m,onClick:v=>a?.(v),disabled:l,"aria-label":e||p,children:[s.jsx(N,{icon:c}),e&&s.jsx("span",{className:x,children:e}),s.jsx(N,{icon:o})]})},S=({errorText:e})=>e&&s.jsx("span",{className:"text-error dial-tiny mt-1",children:e}),P=({fieldTitle:e,htmlFor:r,optional:t,optionalText:n,cssClass:a})=>e?s.jsxs("label",{className:u("dial-tiny text-secondary",a,!a?.includes("mb")&&"mb-2"),htmlFor:r,children:[s.jsx("span",{className:"min-h-4",children:e}),t&&s.jsx("span",{className:"ml-1",children:n??"(Optional)"})]}):null;var j=(e=>(e.Info="info",e.Success="success",e.Warning="warning",e.Error="error",e))(j||{});const O={info:s.jsx(y.IconInfoCircle,{size:24,stroke:2}),error:s.jsx(y.IconAlertCircle,{size:24,stroke:2}),warning:s.jsx(y.IconAlertTriangle,{size:24,stroke:2}),success:s.jsx(y.IconCircleCheck,{size:24,stroke:2})},V={[j.Info]:"bg-info border-info text-info",[j.Success]:"bg-success border-success text-success",[j.Warning]:"bg-warning border-warning text-warning",[j.Error]:"bg-error border-error text-error"},$="items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex",G=({variant:e=j.Info,message:r,cssClass:t,closable:n=!1,onClose:a})=>s.jsxs("div",{role:"alert",className:u($,V[e],t),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(N,{icon:O[e]}),s.jsx("div",{className:"text-primary",children:r})]}),n&&s.jsx(L,{cssClass:"ml-2 text-secondary hover:text-primary",ariaLabel:"Close alert",iconBefore:s.jsx(y.IconX,{size:16}),onClick:l=>a?.(l)})]}),X="flex items-center justify-center text-secondary",Y="shrink-0 grow-0 basis-auto animate-spin-steps",Z=({size:e=18,cssClass:r,iconClass:t,fullWidth:n=!0,ariaLabel:a="Loading"})=>s.jsx("div",{role:"status","aria-label":a,className:u({[X]:!0,"w-full h-full":n,[r||""]:!!r}),children:s.jsx(N,{icon:s.jsx(y.IconLoader,{width:e,height:e,className:u(Y,t)})})}),J=7,Q=2,M=f.createContext(null),W=()=>{const e=f.useContext(M);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e},ee=({initialOpen:e=!1,placement:r="bottom",isTriggerClickable:t=!1,open:n,onOpenChange:a}={})=>{const[l,o]=f.useState(e),c=f.useRef(null),i=n??l,p=a??o,x=d.useFloating({placement:r,open:i,onOpenChange:p,whileElementsMounted:d.autoUpdate,middleware:[d.offset(J+Q),d.flip({crossAxis:r.includes("-"),fallbackAxisSideDirection:"start",padding:5}),d.shift({padding:5}),d.arrow({element:c})]}),m=d.useHover(x.context,{move:!1,enabled:n==null,mouseOnly:t,delay:{open:500,close:0}}),v=d.useFocus(x.context,{enabled:n==null}),R=d.useDismiss(x.context),b=d.useRole(x.context,{role:"tooltip"}),g=d.useInteractions([m,v,R,b]);return f.useMemo(()=>({open:i,setOpen:p,arrowRef:c,...g,...x}),[i,p,g,x])},se=({children:e,...r})=>{const t=ee(r);return s.jsx(M.Provider,{value:t,children:e})},re=f.forwardRef(function({style:r,...t},n){const a=W(),l=d.useMergeRefs([a.refs.setFloating,n]);return a.open?s.jsx(d.FloatingPortal,{id:"tooltip-portal",children:s.jsxs("div",{ref:l,style:{...a.floatingStyles,...r},...a.getFloatingProps(t),className:u("z-[55] whitespace-pre-wrap rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",a.getFloatingProps(t).className),children:[t.children,s.jsx(d.FloatingArrow,{ref:a.arrowRef,context:a.context,fill:"currentColor",strokeWidth:1,className:"stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"})]})}):null}),te=f.forwardRef(function({children:r,asChild:t=!1,...n},a){const l=W(),c=r&&typeof r=="object"&&"ref"in r&&r.ref!==void 0?r.ref:void 0,i=d.useMergeRefs([l.refs.setReference,a,c]);return t&&f.isValidElement(r)?f.cloneElement(r,l.getReferenceProps({ref:i,...n,...r.props})):s.jsx("span",{ref:i,...l.getReferenceProps(n),className:n.className??"dial-tooltip-trigger text-left",children:r})}),k=({hideTooltip:e,tooltip:r,children:t,triggerClassName:n,contentClassName:a,...l})=>e||!r?s.jsx("span",{className:n,children:t}):s.jsxs(se,{...l,children:[s.jsx(te,{className:u(n,"truncate"),children:t}),s.jsx(re,{className:u("text-primary",a,"max-w-[300px]",(e||!r)&&"hidden"),children:r})]}),z=({value:e,textareaId:r,placeholder:t,cssClass:n="",disabled:a,invalid:l,readonly:o,onChange:c})=>s.jsx(k,{tooltip:e,triggerClassName:"flex",children:s.jsx("textarea",{id:r,placeholder:t,value:e||"",disabled:a,className:u("dial-textarea dial-input",l?"dial-input-error":"",a&&"dial-input-disable",o&&"dial-input-readonly",n),onChange:i=>!o&&c?.(i.currentTarget.value)})}),ne=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End"],ae=(e,r,t,n)=>{if((r==="number"||t!==void 0||n!==void 0)&&!ne.includes(e.key)&&!(e.key==="-"&&e.currentTarget.selectionStart===0&&(t===void 0||t<0))&&!(e.key==="."&&r==="number"&&!e.currentTarget.value.includes("."))){if(!/^[0-9]$/.test(e.key)){e.preventDefault();return}if(t!==void 0||n!==void 0){const l=e.currentTarget.value,o=e.currentTarget.selectionStart||0,c=l.slice(0,o)+e.key+l.slice(o),i=parseFloat(c);if(!isNaN(i)){if(t!==void 0&&i<t){e.preventDefault();return}if(n!==void 0&&i>n){e.preventDefault();return}}}}},I=({iconBeforeInput:e,iconAfterInput:r,hideBorder:t,value:n,elementId:a,placeholder:l="",cssClass:o="",containerCssClass:c,tooltipTriggerClassName:i,type:p="text",disabled:x,readonly:m,invalid:v,onChange:R,min:b,max:g,prefix:E,suffix:A,textBeforeInput:w,textAfterInput:C})=>{const B=h=>h.target.blur(),H=p==="number"||b!==void 0||g!==void 0,U=h=>{ae(h,p,b,g)},_=h=>{const D=h.currentTarget.value;if(H&&D!==""){const F=parseFloat(D);if(isNaN(F)&&D!=="-"&&D!=="."||!isNaN(F)&&(b!==void 0&&F<b||g!==void 0&&F>g))return}R?.(D)};return s.jsxs("div",{className:u("dial-input-field flex flex-row items-center justify-between",t?"dial-input-no-border":"dial-input",v&&"dial-input-error",x&&"dial-input-disable",m&&"dial-input-readonly",!w&&"pl-1",!C&&"pr-1",c),children:[w&&s.jsx(k,{tooltip:w,children:s.jsx(I,{hideBorder:!0,containerCssClass:"rounded-r-none border-r-0",cssClass:"px-2 overflow-hidden overflow-ellipsis dial-small",value:w,disabled:!0,elementId:w+"textBefore"})}),E&&s.jsxs("p",{className:"text-secondary dial-small pl-2",children:[" ",E]}),s.jsx(N,{icon:e,className:"pl-2"}),s.jsx(k,{tooltip:n,triggerClassName:i,children:s.jsx("input",{type:p,autoComplete:"off",id:a,placeholder:l,value:n??"",title:n?String(n):"",disabled:x,className:u("border-0 bg-transparent px-2",o),onChange:h=>!m&&_?.(h),onKeyDown:U,onWheel:B,min:b,max:g})}),s.jsx(N,{icon:r,className:"pr-2"}),A&&s.jsxs("p",{className:"text-secondary dial-small pr-2",children:[" ",A]}),C&&s.jsx(k,{tooltip:C,children:s.jsx(I,{hideBorder:!0,containerCssClass:"rounded-l-none border-l-0",cssClass:"px-2",value:C,disabled:!0,elementId:C+"textAfter"})})]})},le=/^0+\.(\d+)?$/,oe=/^0+/,q=({fieldTitle:e,errorText:r,optional:t,elementCssClass:n,elementContainerCssClass:a,elementId:l,containerCssClass:o,readonly:c,defaultEmptyText:i,min:p,max:x,...m})=>s.jsxs("div",{className:u("flex flex-col",o),children:[s.jsx(P,{fieldTitle:e,optional:t,htmlFor:l}),c?s.jsx("span",{children:m.value||(i??"None")}):s.jsxs(s.Fragment,{children:[s.jsx(I,{elementId:l,cssClass:n,containerCssClass:a,invalid:r!=null,min:p,max:x,...m}),s.jsx(S,{errorText:r})]})]}),ie=({onChange:e,value:r,min:t,max:n,...a})=>{const l=o=>String(o)?.match(le)?String(o)?.replace(oe,"0"):Number(o);return s.jsx(q,{type:"number",onChange:o=>e?.(l(o)),value:r,min:t,max:n,...a})},ce=({onChange:e,...r})=>s.jsx(q,{type:"text",onChange:t=>e?.(t),...r}),ue=({fieldTitle:e,optional:r,elementId:t,elementCssClass:n,errorText:a,...l})=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(P,{fieldTitle:e,optional:r,htmlFor:t}),s.jsx(z,{textareaId:t,cssClass:n,...l}),s.jsx(S,{errorText:a})]}),de=({title:e,switchId:r,isOn:t=!1,disabled:n,onChange:a})=>{const l=u("flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",t?"flex-row-reverse":"flex-row",n?"pointer-events-none":"",n?t?"bg-controls-disable":"bg-layer-4":t?"bg-accent-primary":"bg-layer-4"),o=f.useCallback(c=>{c.stopPropagation(),a?.(!t)},[a,t]);return s.jsxs("div",{className:"flex flex-row items-center",children:[s.jsx("input",{type:"checkbox",onChange:o,id:r,disabled:n,className:"invisible w-0 h-0",checked:t}),s.jsx("label",{htmlFor:r,className:l,children:s.jsx("span",{className:u("size-3 rounded-full",n?t?"bg-controls-disable":"bg-layer-4":"bg-controls-enable-primary")})}),e&&s.jsx("span",{className:"h-[14px] pl-2 small text-primary",children:e})]})};exports.AlertVariant=j;exports.ButtonVariant=T;exports.DialAlert=G;exports.DialButton=L;exports.DialErrorText=S;exports.DialFieldLabel=P;exports.DialIcon=N;exports.DialInput=I;exports.DialLoader=Z;exports.DialNumberInputField=ie;exports.DialSwitch=de;exports.DialTextAreaField=ue;exports.DialTextInputField=ce;exports.DialTextarea=z;exports.DialTooltip=k;
|
package/dist/dial-ui-kit.es.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { jsx as n, jsxs as p, Fragment as K } from "react/jsx-runtime";
|
|
2
2
|
import d from "classnames";
|
|
3
|
-
import { IconCircleCheck as
|
|
4
|
-
import { useFloating as Y, offset as Z, flip as q, shift as
|
|
5
|
-
import { createContext as
|
|
6
|
-
const
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
3
|
+
import { IconCircleCheck as B, IconAlertTriangle as G, IconAlertCircle as O, IconInfoCircle as $, IconX as V, IconLoader as X } from "@tabler/icons-react";
|
|
4
|
+
import { useFloating as Y, offset as Z, flip as q, shift as J, arrow as Q, autoUpdate as ee, useHover as re, useFocus as te, useDismiss as ne, useRole as se, useInteractions as oe, useMergeRefs as S, FloatingPortal as ae, FloatingArrow as le } from "@floating-ui/react";
|
|
5
|
+
import { createContext as ie, useState as ce, useRef as de, useMemo as ue, useContext as pe, forwardRef as E, isValidElement as me, cloneElement as fe, useCallback as ge } from "react";
|
|
6
|
+
const N = ({ icon: e, className: r }) => e ? /* @__PURE__ */ n("span", { className: d("flex-shrink-0", r), children: e }) : null;
|
|
7
|
+
var T = /* @__PURE__ */ ((e) => (e.Primary = "primary", e.Secondary = "secondary", e.Tertiary = "tertiary", e))(T || {});
|
|
8
|
+
const he = {
|
|
9
|
+
[T.Primary]: "dial-primary-button",
|
|
10
|
+
[T.Secondary]: "dial-secondary-button",
|
|
11
|
+
[T.Tertiary]: "dial-tertiary-button"
|
|
12
12
|
}, be = ({
|
|
13
13
|
title: e,
|
|
14
14
|
variant: r,
|
|
15
15
|
cssClass: t,
|
|
16
16
|
ref: s,
|
|
17
17
|
onClick: o,
|
|
18
|
-
disable:
|
|
19
|
-
iconAfter:
|
|
18
|
+
disable: a,
|
|
19
|
+
iconAfter: l,
|
|
20
20
|
iconBefore: c,
|
|
21
21
|
hideTitleOnMobile: i,
|
|
22
22
|
ariaLabel: m
|
|
23
23
|
}) => {
|
|
24
24
|
const u = d(
|
|
25
25
|
"dial-small-semi",
|
|
26
|
-
|
|
26
|
+
l ? "mr-2" : "",
|
|
27
27
|
c ? "ml-2" : "",
|
|
28
28
|
i ? "hidden sm:inline" : "inline"
|
|
29
29
|
), f = d(
|
|
30
|
-
r &&
|
|
30
|
+
r && he[r],
|
|
31
31
|
t,
|
|
32
32
|
"focus-visible:outline outline-offset-0"
|
|
33
33
|
);
|
|
@@ -38,16 +38,16 @@ const ge = {
|
|
|
38
38
|
type: "button",
|
|
39
39
|
className: f,
|
|
40
40
|
onClick: (y) => o?.(y),
|
|
41
|
-
disabled:
|
|
41
|
+
disabled: a,
|
|
42
42
|
"aria-label": e || m,
|
|
43
43
|
children: [
|
|
44
|
-
/* @__PURE__ */ n(
|
|
44
|
+
/* @__PURE__ */ n(N, { icon: c }),
|
|
45
45
|
e && /* @__PURE__ */ n("span", { className: u, children: e }),
|
|
46
|
-
/* @__PURE__ */ n(
|
|
46
|
+
/* @__PURE__ */ n(N, { icon: l })
|
|
47
47
|
]
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
|
-
},
|
|
50
|
+
}, L = ({ errorText: e }) => e && /* @__PURE__ */ n("span", { className: "text-error dial-tiny mt-1", children: e }), A = ({
|
|
51
51
|
fieldTitle: e,
|
|
52
52
|
htmlFor: r,
|
|
53
53
|
optional: t,
|
|
@@ -69,21 +69,21 @@ const ge = {
|
|
|
69
69
|
}
|
|
70
70
|
) : null;
|
|
71
71
|
var x = /* @__PURE__ */ ((e) => (e.Info = "info", e.Success = "success", e.Warning = "warning", e.Error = "error", e))(x || {});
|
|
72
|
-
const
|
|
73
|
-
info: /* @__PURE__ */ n(
|
|
74
|
-
error: /* @__PURE__ */ n(
|
|
75
|
-
warning: /* @__PURE__ */ n(
|
|
76
|
-
success: /* @__PURE__ */ n(
|
|
77
|
-
},
|
|
72
|
+
const xe = {
|
|
73
|
+
info: /* @__PURE__ */ n($, { size: 24, stroke: 2 }),
|
|
74
|
+
error: /* @__PURE__ */ n(O, { size: 24, stroke: 2 }),
|
|
75
|
+
warning: /* @__PURE__ */ n(G, { size: 24, stroke: 2 }),
|
|
76
|
+
success: /* @__PURE__ */ n(B, { size: 24, stroke: 2 })
|
|
77
|
+
}, Ne = {
|
|
78
78
|
[x.Info]: "bg-info border-info text-info",
|
|
79
79
|
[x.Success]: "bg-success border-success text-success",
|
|
80
80
|
[x.Warning]: "bg-warning border-warning text-warning",
|
|
81
81
|
[x.Error]: "bg-error border-error text-error"
|
|
82
|
-
}, ye = "
|
|
82
|
+
}, ye = "items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex", He = ({
|
|
83
83
|
variant: e = x.Info,
|
|
84
84
|
message: r,
|
|
85
85
|
cssClass: t,
|
|
86
|
-
closable: s = !
|
|
86
|
+
closable: s = !1,
|
|
87
87
|
onClose: o
|
|
88
88
|
}) => /* @__PURE__ */ p(
|
|
89
89
|
"div",
|
|
@@ -91,63 +91,93 @@ const he = {
|
|
|
91
91
|
role: "alert",
|
|
92
92
|
className: d(
|
|
93
93
|
ye,
|
|
94
|
-
|
|
94
|
+
Ne[e],
|
|
95
95
|
t
|
|
96
96
|
),
|
|
97
97
|
children: [
|
|
98
98
|
/* @__PURE__ */ p("div", { className: "flex items-center gap-2", children: [
|
|
99
|
-
/* @__PURE__ */ n(
|
|
99
|
+
/* @__PURE__ */ n(N, { icon: xe[e] }),
|
|
100
100
|
/* @__PURE__ */ n("div", { className: "text-primary", children: r })
|
|
101
101
|
] }),
|
|
102
102
|
s && /* @__PURE__ */ n(
|
|
103
103
|
be,
|
|
104
104
|
{
|
|
105
|
-
cssClass: "ml-2 text-secondary hover:text-primary
|
|
105
|
+
cssClass: "ml-2 text-secondary hover:text-primary",
|
|
106
106
|
ariaLabel: "Close alert",
|
|
107
|
-
iconBefore: /* @__PURE__ */ n(
|
|
108
|
-
onClick: (
|
|
107
|
+
iconBefore: /* @__PURE__ */ n(V, { size: 16 }),
|
|
108
|
+
onClick: (a) => o?.(a)
|
|
109
109
|
}
|
|
110
110
|
)
|
|
111
111
|
]
|
|
112
112
|
}
|
|
113
|
-
),
|
|
114
|
-
|
|
113
|
+
), ve = "flex items-center justify-center text-secondary", Ce = "shrink-0 grow-0 basis-auto animate-spin-steps", Ue = ({
|
|
114
|
+
size: e = 18,
|
|
115
|
+
cssClass: r,
|
|
116
|
+
iconClass: t,
|
|
117
|
+
fullWidth: s = !0,
|
|
118
|
+
ariaLabel: o = "Loading"
|
|
119
|
+
}) => /* @__PURE__ */ n(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
role: "status",
|
|
123
|
+
"aria-label": o,
|
|
124
|
+
className: d({
|
|
125
|
+
[ve]: !0,
|
|
126
|
+
"w-full h-full": s,
|
|
127
|
+
[r || ""]: !!r
|
|
128
|
+
}),
|
|
129
|
+
children: /* @__PURE__ */ n(
|
|
130
|
+
N,
|
|
131
|
+
{
|
|
132
|
+
icon: /* @__PURE__ */ n(
|
|
133
|
+
X,
|
|
134
|
+
{
|
|
135
|
+
width: e,
|
|
136
|
+
height: e,
|
|
137
|
+
className: d(Ce, t)
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
), we = 7, De = 2, W = ie(null), j = () => {
|
|
144
|
+
const e = pe(W);
|
|
115
145
|
if (e == null)
|
|
116
146
|
throw new Error("Tooltip components must be wrapped in <Tooltip />");
|
|
117
147
|
return e;
|
|
118
|
-
},
|
|
148
|
+
}, Te = ({
|
|
119
149
|
initialOpen: e = !1,
|
|
120
150
|
placement: r = "bottom",
|
|
121
151
|
isTriggerClickable: t = !1,
|
|
122
152
|
open: s,
|
|
123
153
|
onOpenChange: o
|
|
124
154
|
} = {}) => {
|
|
125
|
-
const [
|
|
155
|
+
const [a, l] = ce(e), c = de(null), i = s ?? a, m = o ?? l, u = Y({
|
|
126
156
|
placement: r,
|
|
127
157
|
open: i,
|
|
128
158
|
onOpenChange: m,
|
|
129
|
-
whileElementsMounted:
|
|
159
|
+
whileElementsMounted: ee,
|
|
130
160
|
middleware: [
|
|
131
|
-
Z(
|
|
161
|
+
Z(we + De),
|
|
132
162
|
q({
|
|
133
163
|
crossAxis: r.includes("-"),
|
|
134
164
|
fallbackAxisSideDirection: "start",
|
|
135
165
|
padding: 5
|
|
136
166
|
}),
|
|
137
|
-
|
|
138
|
-
|
|
167
|
+
J({ padding: 5 }),
|
|
168
|
+
Q({
|
|
139
169
|
element: c
|
|
140
170
|
})
|
|
141
171
|
]
|
|
142
|
-
}), f =
|
|
172
|
+
}), f = re(u.context, {
|
|
143
173
|
move: !1,
|
|
144
174
|
enabled: s == null,
|
|
145
175
|
mouseOnly: t,
|
|
146
176
|
delay: { open: 500, close: 0 }
|
|
147
|
-
}), y =
|
|
177
|
+
}), y = te(u.context, {
|
|
148
178
|
enabled: s == null
|
|
149
|
-
}), F =
|
|
150
|
-
return
|
|
179
|
+
}), F = ne(u.context), h = se(u.context, { role: "tooltip" }), g = oe([f, y, F, h]);
|
|
180
|
+
return ue(
|
|
151
181
|
() => ({
|
|
152
182
|
open: i,
|
|
153
183
|
setOpen: m,
|
|
@@ -157,18 +187,18 @@ const he = {
|
|
|
157
187
|
}),
|
|
158
188
|
[i, m, g, u]
|
|
159
189
|
);
|
|
160
|
-
},
|
|
190
|
+
}, ke = ({
|
|
161
191
|
children: e,
|
|
162
192
|
...r
|
|
163
193
|
}) => {
|
|
164
|
-
const t =
|
|
194
|
+
const t = Te(r);
|
|
165
195
|
return /* @__PURE__ */ n(W.Provider, { value: t, children: e });
|
|
166
|
-
},
|
|
167
|
-
const o = j(),
|
|
168
|
-
return o.open ? /* @__PURE__ */ n(
|
|
196
|
+
}, Fe = E(function({ style: r, ...t }, s) {
|
|
197
|
+
const o = j(), a = S([o.refs.setFloating, s]);
|
|
198
|
+
return o.open ? /* @__PURE__ */ n(ae, { id: "tooltip-portal", children: /* @__PURE__ */ p(
|
|
169
199
|
"div",
|
|
170
200
|
{
|
|
171
|
-
ref:
|
|
201
|
+
ref: a,
|
|
172
202
|
style: {
|
|
173
203
|
...o.floatingStyles,
|
|
174
204
|
...r
|
|
@@ -193,11 +223,11 @@ const he = {
|
|
|
193
223
|
]
|
|
194
224
|
}
|
|
195
225
|
) }) : null;
|
|
196
|
-
}),
|
|
197
|
-
const
|
|
198
|
-
return t &&
|
|
226
|
+
}), Ie = E(function({ children: r, asChild: t = !1, ...s }, o) {
|
|
227
|
+
const a = j(), c = r && typeof r == "object" && "ref" in r && r.ref !== void 0 ? r.ref : void 0, i = S([a.refs.setReference, o, c]);
|
|
228
|
+
return t && me(r) ? fe(
|
|
199
229
|
r,
|
|
200
|
-
|
|
230
|
+
a.getReferenceProps({
|
|
201
231
|
ref: i,
|
|
202
232
|
...s,
|
|
203
233
|
...r.props
|
|
@@ -206,7 +236,7 @@ const he = {
|
|
|
206
236
|
"span",
|
|
207
237
|
{
|
|
208
238
|
ref: i,
|
|
209
|
-
...
|
|
239
|
+
...a.getReferenceProps(s),
|
|
210
240
|
className: s.className ?? "dial-tooltip-trigger text-left",
|
|
211
241
|
children: r
|
|
212
242
|
}
|
|
@@ -217,11 +247,11 @@ const he = {
|
|
|
217
247
|
children: t,
|
|
218
248
|
triggerClassName: s,
|
|
219
249
|
contentClassName: o,
|
|
220
|
-
...
|
|
221
|
-
}) => e || !r ? /* @__PURE__ */ n("span", { className: s, children: t }) : /* @__PURE__ */ p(
|
|
222
|
-
/* @__PURE__ */ n(
|
|
250
|
+
...a
|
|
251
|
+
}) => e || !r ? /* @__PURE__ */ n("span", { className: s, children: t }) : /* @__PURE__ */ p(ke, { ...a, children: [
|
|
252
|
+
/* @__PURE__ */ n(Ie, { className: d(s, "truncate"), children: t }),
|
|
223
253
|
/* @__PURE__ */ n(
|
|
224
|
-
|
|
254
|
+
Fe,
|
|
225
255
|
{
|
|
226
256
|
className: d(
|
|
227
257
|
"text-primary",
|
|
@@ -232,14 +262,14 @@ const he = {
|
|
|
232
262
|
children: r
|
|
233
263
|
}
|
|
234
264
|
)
|
|
235
|
-
] }),
|
|
265
|
+
] }), Re = ({
|
|
236
266
|
value: e,
|
|
237
267
|
textareaId: r,
|
|
238
268
|
placeholder: t,
|
|
239
269
|
cssClass: s = "",
|
|
240
270
|
disabled: o,
|
|
241
|
-
invalid:
|
|
242
|
-
readonly:
|
|
271
|
+
invalid: a,
|
|
272
|
+
readonly: l,
|
|
243
273
|
onChange: c
|
|
244
274
|
}) => /* @__PURE__ */ n(k, { tooltip: e, triggerClassName: "flex", children: /* @__PURE__ */ n(
|
|
245
275
|
"textarea",
|
|
@@ -250,14 +280,14 @@ const he = {
|
|
|
250
280
|
disabled: o,
|
|
251
281
|
className: d(
|
|
252
282
|
"dial-textarea dial-input",
|
|
253
|
-
|
|
283
|
+
a ? "dial-input-error" : "",
|
|
254
284
|
o && "dial-input-disable",
|
|
255
|
-
|
|
285
|
+
l && "dial-input-readonly",
|
|
256
286
|
s
|
|
257
287
|
),
|
|
258
|
-
onChange: (i) => !
|
|
288
|
+
onChange: (i) => !l && c?.(i.currentTarget.value)
|
|
259
289
|
}
|
|
260
|
-
) }),
|
|
290
|
+
) }), Pe = [
|
|
261
291
|
"ArrowLeft",
|
|
262
292
|
"ArrowRight",
|
|
263
293
|
"ArrowUp",
|
|
@@ -269,14 +299,14 @@ const he = {
|
|
|
269
299
|
"Escape",
|
|
270
300
|
"Home",
|
|
271
301
|
"End"
|
|
272
|
-
],
|
|
273
|
-
if ((r === "number" || t !== void 0 || s !== void 0) && !
|
|
302
|
+
], Se = (e, r, t, s) => {
|
|
303
|
+
if ((r === "number" || t !== void 0 || s !== void 0) && !Pe.includes(e.key) && !(e.key === "-" && e.currentTarget.selectionStart === 0 && (t === void 0 || t < 0)) && !(e.key === "." && r === "number" && !e.currentTarget.value.includes("."))) {
|
|
274
304
|
if (!/^[0-9]$/.test(e.key)) {
|
|
275
305
|
e.preventDefault();
|
|
276
306
|
return;
|
|
277
307
|
}
|
|
278
308
|
if (t !== void 0 || s !== void 0) {
|
|
279
|
-
const
|
|
309
|
+
const a = e.currentTarget.value, l = e.currentTarget.selectionStart || 0, c = a.slice(0, l) + e.key + a.slice(l), i = parseFloat(c);
|
|
280
310
|
if (!isNaN(i)) {
|
|
281
311
|
if (t !== void 0 && i < t) {
|
|
282
312
|
e.preventDefault();
|
|
@@ -295,8 +325,8 @@ const he = {
|
|
|
295
325
|
hideBorder: t,
|
|
296
326
|
value: s,
|
|
297
327
|
elementId: o,
|
|
298
|
-
placeholder:
|
|
299
|
-
cssClass:
|
|
328
|
+
placeholder: a = "",
|
|
329
|
+
cssClass: l = "",
|
|
300
330
|
containerCssClass: c,
|
|
301
331
|
tooltipTriggerClassName: i,
|
|
302
332
|
type: m = "text",
|
|
@@ -304,23 +334,23 @@ const he = {
|
|
|
304
334
|
readonly: f,
|
|
305
335
|
invalid: y,
|
|
306
336
|
onChange: F,
|
|
307
|
-
min:
|
|
337
|
+
min: h,
|
|
308
338
|
max: g,
|
|
309
339
|
prefix: R,
|
|
310
340
|
suffix: P,
|
|
311
|
-
textBeforeInput:
|
|
312
|
-
textAfterInput:
|
|
341
|
+
textBeforeInput: v,
|
|
342
|
+
textAfterInput: C
|
|
313
343
|
}) => {
|
|
314
|
-
const M = (
|
|
315
|
-
|
|
316
|
-
}, _ = (
|
|
317
|
-
const
|
|
318
|
-
if (H &&
|
|
319
|
-
const
|
|
320
|
-
if (isNaN(
|
|
344
|
+
const M = (b) => b.target.blur(), H = m === "number" || h !== void 0 || g !== void 0, U = (b) => {
|
|
345
|
+
Se(b, m, h, g);
|
|
346
|
+
}, _ = (b) => {
|
|
347
|
+
const w = b.currentTarget.value;
|
|
348
|
+
if (H && w !== "") {
|
|
349
|
+
const D = parseFloat(w);
|
|
350
|
+
if (isNaN(D) && w !== "-" && w !== "." || !isNaN(D) && (h !== void 0 && D < h || g !== void 0 && D > g))
|
|
321
351
|
return;
|
|
322
352
|
}
|
|
323
|
-
F?.(
|
|
353
|
+
F?.(w);
|
|
324
354
|
};
|
|
325
355
|
return /* @__PURE__ */ p(
|
|
326
356
|
"div",
|
|
@@ -331,91 +361,91 @@ const he = {
|
|
|
331
361
|
y && "dial-input-error",
|
|
332
362
|
u && "dial-input-disable",
|
|
333
363
|
f && "dial-input-readonly",
|
|
334
|
-
!
|
|
335
|
-
!
|
|
364
|
+
!v && "pl-1",
|
|
365
|
+
!C && "pr-1",
|
|
336
366
|
c
|
|
337
367
|
),
|
|
338
368
|
children: [
|
|
339
|
-
|
|
369
|
+
v && /* @__PURE__ */ n(k, { tooltip: v, children: /* @__PURE__ */ n(
|
|
340
370
|
I,
|
|
341
371
|
{
|
|
342
372
|
hideBorder: !0,
|
|
343
373
|
containerCssClass: "rounded-r-none border-r-0",
|
|
344
374
|
cssClass: "px-2 overflow-hidden overflow-ellipsis dial-small",
|
|
345
|
-
value:
|
|
375
|
+
value: v,
|
|
346
376
|
disabled: !0,
|
|
347
|
-
elementId:
|
|
377
|
+
elementId: v + "textBefore"
|
|
348
378
|
}
|
|
349
379
|
) }),
|
|
350
380
|
R && /* @__PURE__ */ p("p", { className: "text-secondary dial-small pl-2", children: [
|
|
351
381
|
" ",
|
|
352
382
|
R
|
|
353
383
|
] }),
|
|
354
|
-
/* @__PURE__ */ n(
|
|
384
|
+
/* @__PURE__ */ n(N, { icon: e, className: "pl-2" }),
|
|
355
385
|
/* @__PURE__ */ n(k, { tooltip: s, triggerClassName: i, children: /* @__PURE__ */ n(
|
|
356
386
|
"input",
|
|
357
387
|
{
|
|
358
388
|
type: m,
|
|
359
389
|
autoComplete: "off",
|
|
360
390
|
id: o,
|
|
361
|
-
placeholder:
|
|
391
|
+
placeholder: a,
|
|
362
392
|
value: s ?? "",
|
|
363
393
|
title: s ? String(s) : "",
|
|
364
394
|
disabled: u,
|
|
365
|
-
className: d("border-0 bg-transparent px-2",
|
|
366
|
-
onChange: (
|
|
395
|
+
className: d("border-0 bg-transparent px-2", l),
|
|
396
|
+
onChange: (b) => !f && _?.(b),
|
|
367
397
|
onKeyDown: U,
|
|
368
398
|
onWheel: M,
|
|
369
|
-
min:
|
|
399
|
+
min: h,
|
|
370
400
|
max: g
|
|
371
401
|
}
|
|
372
402
|
) }),
|
|
373
|
-
/* @__PURE__ */ n(
|
|
403
|
+
/* @__PURE__ */ n(N, { icon: r, className: "pr-2" }),
|
|
374
404
|
P && /* @__PURE__ */ p("p", { className: "text-secondary dial-small pr-2", children: [
|
|
375
405
|
" ",
|
|
376
406
|
P
|
|
377
407
|
] }),
|
|
378
|
-
|
|
408
|
+
C && /* @__PURE__ */ n(k, { tooltip: C, children: /* @__PURE__ */ n(
|
|
379
409
|
I,
|
|
380
410
|
{
|
|
381
411
|
hideBorder: !0,
|
|
382
412
|
containerCssClass: "rounded-l-none border-l-0",
|
|
383
413
|
cssClass: "px-2",
|
|
384
|
-
value:
|
|
414
|
+
value: C,
|
|
385
415
|
disabled: !0,
|
|
386
|
-
elementId:
|
|
416
|
+
elementId: C + "textAfter"
|
|
387
417
|
}
|
|
388
418
|
) })
|
|
389
419
|
]
|
|
390
420
|
}
|
|
391
421
|
);
|
|
392
|
-
},
|
|
422
|
+
}, Ee = /^0+\.(\d+)?$/, Le = /^0+/, z = ({
|
|
393
423
|
fieldTitle: e,
|
|
394
424
|
errorText: r,
|
|
395
425
|
optional: t,
|
|
396
426
|
elementCssClass: s,
|
|
397
427
|
elementContainerCssClass: o,
|
|
398
|
-
elementId:
|
|
399
|
-
containerCssClass:
|
|
428
|
+
elementId: a,
|
|
429
|
+
containerCssClass: l,
|
|
400
430
|
readonly: c,
|
|
401
431
|
defaultEmptyText: i,
|
|
402
432
|
min: m,
|
|
403
433
|
max: u,
|
|
404
434
|
...f
|
|
405
|
-
}) => /* @__PURE__ */ p("div", { className: d("flex flex-col",
|
|
435
|
+
}) => /* @__PURE__ */ p("div", { className: d("flex flex-col", l), children: [
|
|
406
436
|
/* @__PURE__ */ n(
|
|
407
437
|
A,
|
|
408
438
|
{
|
|
409
439
|
fieldTitle: e,
|
|
410
440
|
optional: t,
|
|
411
|
-
htmlFor:
|
|
441
|
+
htmlFor: a
|
|
412
442
|
}
|
|
413
443
|
),
|
|
414
444
|
c ? /* @__PURE__ */ n("span", { children: f.value || (i ?? "None") }) : /* @__PURE__ */ p(K, { children: [
|
|
415
445
|
/* @__PURE__ */ n(
|
|
416
446
|
I,
|
|
417
447
|
{
|
|
418
|
-
elementId:
|
|
448
|
+
elementId: a,
|
|
419
449
|
cssClass: s,
|
|
420
450
|
containerCssClass: o,
|
|
421
451
|
invalid: r != null,
|
|
@@ -424,44 +454,44 @@ const he = {
|
|
|
424
454
|
...f
|
|
425
455
|
}
|
|
426
456
|
),
|
|
427
|
-
/* @__PURE__ */ n(
|
|
457
|
+
/* @__PURE__ */ n(L, { errorText: r })
|
|
428
458
|
] })
|
|
429
|
-
] }),
|
|
459
|
+
] }), _e = ({
|
|
430
460
|
onChange: e,
|
|
431
461
|
value: r,
|
|
432
462
|
min: t,
|
|
433
463
|
max: s,
|
|
434
464
|
...o
|
|
435
465
|
}) => {
|
|
436
|
-
const
|
|
466
|
+
const a = (l) => String(l)?.match(Ee) ? String(l)?.replace(Le, "0") : Number(l);
|
|
437
467
|
return /* @__PURE__ */ n(
|
|
438
|
-
|
|
468
|
+
z,
|
|
439
469
|
{
|
|
440
470
|
type: "number",
|
|
441
|
-
onChange: (
|
|
471
|
+
onChange: (l) => e?.(a(l)),
|
|
442
472
|
value: r,
|
|
443
473
|
min: t,
|
|
444
474
|
max: s,
|
|
445
475
|
...o
|
|
446
476
|
}
|
|
447
477
|
);
|
|
448
|
-
},
|
|
478
|
+
}, Ke = ({
|
|
449
479
|
onChange: e,
|
|
450
480
|
...r
|
|
451
481
|
}) => /* @__PURE__ */ n(
|
|
452
|
-
|
|
482
|
+
z,
|
|
453
483
|
{
|
|
454
484
|
type: "text",
|
|
455
485
|
onChange: (t) => e?.(t),
|
|
456
486
|
...r
|
|
457
487
|
}
|
|
458
|
-
),
|
|
488
|
+
), Be = ({
|
|
459
489
|
fieldTitle: e,
|
|
460
490
|
optional: r,
|
|
461
491
|
elementId: t,
|
|
462
492
|
elementCssClass: s,
|
|
463
493
|
errorText: o,
|
|
464
|
-
...
|
|
494
|
+
...a
|
|
465
495
|
}) => /* @__PURE__ */ p("div", { className: "flex flex-col", children: [
|
|
466
496
|
/* @__PURE__ */ n(
|
|
467
497
|
A,
|
|
@@ -472,27 +502,27 @@ const he = {
|
|
|
472
502
|
}
|
|
473
503
|
),
|
|
474
504
|
/* @__PURE__ */ n(
|
|
475
|
-
|
|
505
|
+
Re,
|
|
476
506
|
{
|
|
477
507
|
textareaId: t,
|
|
478
508
|
cssClass: s,
|
|
479
|
-
...
|
|
509
|
+
...a
|
|
480
510
|
}
|
|
481
511
|
),
|
|
482
|
-
/* @__PURE__ */ n(
|
|
483
|
-
] }),
|
|
512
|
+
/* @__PURE__ */ n(L, { errorText: o })
|
|
513
|
+
] }), Ge = ({
|
|
484
514
|
title: e,
|
|
485
515
|
switchId: r,
|
|
486
516
|
isOn: t = !1,
|
|
487
517
|
disabled: s,
|
|
488
518
|
onChange: o
|
|
489
519
|
}) => {
|
|
490
|
-
const
|
|
520
|
+
const a = d(
|
|
491
521
|
"flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",
|
|
492
522
|
t ? "flex-row-reverse" : "flex-row",
|
|
493
523
|
s ? "pointer-events-none" : "",
|
|
494
524
|
s ? t ? "bg-controls-disable" : "bg-layer-4" : t ? "bg-accent-primary" : "bg-layer-4"
|
|
495
|
-
),
|
|
525
|
+
), l = ge(
|
|
496
526
|
(c) => {
|
|
497
527
|
c.stopPropagation(), o?.(!t);
|
|
498
528
|
},
|
|
@@ -503,14 +533,14 @@ const he = {
|
|
|
503
533
|
"input",
|
|
504
534
|
{
|
|
505
535
|
type: "checkbox",
|
|
506
|
-
onChange:
|
|
536
|
+
onChange: l,
|
|
507
537
|
id: r,
|
|
508
538
|
disabled: s,
|
|
509
539
|
className: "invisible w-0 h-0",
|
|
510
540
|
checked: t
|
|
511
541
|
}
|
|
512
542
|
),
|
|
513
|
-
/* @__PURE__ */ n("label", { htmlFor: r, className:
|
|
543
|
+
/* @__PURE__ */ n("label", { htmlFor: r, className: a, children: /* @__PURE__ */ n(
|
|
514
544
|
"span",
|
|
515
545
|
{
|
|
516
546
|
className: d(
|
|
@@ -524,17 +554,18 @@ const he = {
|
|
|
524
554
|
};
|
|
525
555
|
export {
|
|
526
556
|
x as AlertVariant,
|
|
527
|
-
|
|
528
|
-
|
|
557
|
+
T as ButtonVariant,
|
|
558
|
+
He as DialAlert,
|
|
529
559
|
be as DialButton,
|
|
530
|
-
|
|
560
|
+
L as DialErrorText,
|
|
531
561
|
A as DialFieldLabel,
|
|
532
|
-
|
|
562
|
+
N as DialIcon,
|
|
533
563
|
I as DialInput,
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
564
|
+
Ue as DialLoader,
|
|
565
|
+
_e as DialNumberInputField,
|
|
566
|
+
Ge as DialSwitch,
|
|
567
|
+
Be as DialTextAreaField,
|
|
568
|
+
Ke as DialTextInputField,
|
|
569
|
+
Re as DialTextarea,
|
|
539
570
|
k as DialTooltip
|
|
540
571
|
};
|
package/dist/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
.dial-h1{font-weight:600}.dial-h1,.dial-h2{font-size:20px;line-height:24px}.dial-h2{font-weight:400}.dial-h3{font-weight:600;line-height:18px}.dial-body,.dial-h3{font-size:16px}.dial-body{font-weight:400;line-height:28px}.dial-small{font-weight:400}.dial-small,.dial-small-semi{font-size:14px;line-height:16px}.dial-small-semi{font-weight:600}.dial-small-medium{font-weight:400;font-size:14px;line-height:16px}.dial-small-150{font-weight:400;font-size:14px;line-height:21px}.dial-tiny{line-height:14px}.dial-tiny,.dial-tiny-150{font-weight:400;font-size:12px}.dial-tiny-150{line-height:18px}.dial-caption{font-weight:400;font-size:10px;line-height:12px}h1{font-weight:600}h1,h2{font-size:20px;line-height:24px}h2{font-weight:400}h3{font-weight:600;font-size:16px;line-height:18px}.dial-base-button{display:flex;flex-direction:row;align-items:center;padding:.5rem .75rem;border-radius:3px;border:1px solid transparent;font-weight:400;font-size:14px;line-height:16px;min-width:38px;min-height:38px}.dial-base-button-disable{pointer-events:none;background-color:var(--controls-bg-disable,#7f8792);color:var(--controls-disable,#333942)}.dial-primary-button{background-color:var(--controls-bg-accent,#5c8dea);color:var(--controls-primary,#fcfcfc);display:flex;flex-direction:row;align-items:center;padding:.5rem .75rem;border-radius:3px;border:1px solid transparent;font-weight:400;font-size:14px;line-height:16px;min-width:38px;min-height:38px;&:focus,&:hover{background-color:var(--controls-bg-accent-hover,#4878d2)}&:focus{border-color:var(--stroke-hover,#f3f4f6)}&:disabled{pointer-events:none;background-color:var(--controls-bg-disable,#7f8792);color:var(--controls-disable,#333942)}}.dial-secondary-button{background-color:transparent;color:var(--text-primary,#f3f4f6);display:flex;flex-direction:row;align-items:center;padding:.5rem .75rem;border-radius:3px;border:1px solid transparent;font-weight:400;font-size:14px;line-height:16px;min-width:38px;min-height:38px;border-color:var(--stroke-primary,#333942);&:focus,&:hover{background-color:var(--bg-layer-4,#333942)}&:focus{border-color:var(--stroke-hover,#f3f4f6)}&:disabled{pointer-events:none;background-color:var(--controls-bg-disable,#7f8792);color:var(--controls-disable,#333942)}}.dial-tertiary-button{background-color:transparent;color:var(--text-accent-primary,#5c8dea);display:flex;flex-direction:row;align-items:center;padding:.5rem .75rem;border-radius:3px;border:1px solid transparent;font-weight:400;font-size:14px;line-height:16px;min-width:38px;min-height:38px;&:focus,&:hover{background-color:var(--controls-bg-accent-alpha,#5c8dea2b)}&:active,&:focus{border-color:var(--stroke-accent-primary,#5c8dea)}&:disabled{pointer-events:none;background-color:var(--controls-bg-disable,#7f8792);color:var(--controls-disable,#333942)}}.dial-input{border-radius:3px;border-width:1px;border-style:solid;border-color:var(--stroke-primary,#333942);&:hover{border-color:var(--stroke-hover,#f3f4f6)}&:focus,&:focus-within{border-color:var(--stroke-accent-primary,#5c8dea)}}.dial-input,.dial-input-no-border{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background-color:transparent;font-weight:400;font-size:14px;line-height:16px;width:100%;padding:.5rem .75rem;outline-width:0;&:not(:-moz-placeholder){color:var(--text-primary,#f3f4f6)}&:not(:placeholder-shown){color:var(--text-primary,#f3f4f6)}&:disabled{background-color:var(--bg-layer-3,#222932)}&:disabled:not(:-moz-placeholder){color:var(--text-secondary,#7f8792)}&:disabled,&:disabled:not(:placeholder-shown){color:var(--text-secondary,#7f8792)}}.dial-input-disable,.dial-input-readonly{background-color:var(--bg-layer-3,#222932)}.dial-input-disable:not(:-moz-placeholder){color:var(--text-secondary,#7f8792)}.dial-input-disable,.dial-input-disable:not(:placeholder-shown){color:var(--text-secondary,#7f8792)}.dial-input-error{border-color:var(--stroke-error,#f76464)}.dial-input-field{height:38px}input{-moz-appearance:textfield;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}&:focus{outline:none}}.dial-textarea{min-height:72px;resize:both;overflow:auto;white-space:normal}@layer ui{*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }
|
|
2
|
-
/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.relative{position:relative}.z-\[55\]{z-index:55}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.inline{display:inline}.flex{display:flex}.
|
|
2
|
+
/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.relative{position:relative}.z-\[55\]{z-index:55}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.inline{display:inline}.flex{display:flex}.table{display:table}.grid{display:grid}.hidden{display:none}.size-3{width:.75rem;height:.75rem}.h-0{height:0}.h-\[14px\]{height:14px}.h-\[18px\]{height:18px}.h-\[300px\]{height:300px}.h-\[38px\]{height:38px}.h-full{height:100%}.min-h-4{min-height:1rem}.min-h-\[72px\]{min-height:72px}.w-0{width:0}.w-2{width:.5rem}.w-80{width:20rem}.w-\[250px\]{width:250px}.w-\[36px\]{width:36px}.w-\[500px\]{width:500px}.w-full{width:100%}.min-w-\[800px\]{min-width:800px}.max-w-80{max-width:20rem}.max-w-\[1000px\]{max-width:1000px}.max-w-\[1200px\]{max-width:1200px}.max-w-\[1400px\]{max-width:1400px}.max-w-\[300px\]{max-width:300px}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow-0{flex-grow:0}.basis-auto{flex-basis:auto}.border-collapse{border-collapse:collapse}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin-steps{animation:spin .75s steps(6) infinite}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-\[minmax\(0\2c 100px\)_1fr\]{grid-template-columns:minmax(0,100px) 1fr}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-\[160px\]{-moz-column-gap:160px;column-gap:160px}.gap-y-10{row-gap:2.5rem}.gap-y-\[80px\]{row-gap:80px}.overflow-hidden,.truncate{overflow:hidden}.truncate{white-space:nowrap}.overflow-ellipsis,.truncate{text-overflow:ellipsis}.whitespace-normal{white-space:normal}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:3px}.rounded-full{border-radius:9999px}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.border{border-width:1px}.border-0{border-width:0}.border-l-0{border-left-width:0}.border-r-0{border-right-width:0}.border-solid{border-style:solid}.border-dashed{border-style:dashed}.border-error{border-color:var(--stroke-error,#f76464)}.border-primary{border-color:var(--stroke-primary,#333942)}.bg-accent-primary{background-color:var(--bg-accent-primary,#5c8dea)}.bg-blackout{background-color:var(--bg-blackout,#090d13b3)}.bg-controls-accent{background-color:var(--controls-bg-accent,#5c8dea)}.bg-controls-disable{background-color:var(--controls-bg-disable,#7f8792)}.bg-controls-enable-primary{background-color:var(--controls-enable-primary,#fcfcfc)}.bg-error{background-color:var(--bg-error,#402027)}.bg-info{background-color:var(--bg-info,#1c2c47)}.bg-layer-2{background-color:var(--bg-layer-2,#141a23)}.bg-layer-3{background-color:var(--bg-layer-3,#222932)}.bg-layer-4{background-color:var(--bg-layer-4,#333942)}.bg-success{background-color:var(--bg-success,#1d3841)}.bg-transparent{background-color:transparent}.bg-warning{background-color:var(--bg-warning,#3f3d25)}.stroke-primary{stroke:var(--stroke-primary,#333942)}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-medium{font-weight:500}.font-semibold{font-weight:600}.text-\[var\(--bg-layer-0\2c _\#000000\)\]{color:var(--bg-layer-0,#000)}.text-accent-primary{color:var(--text-accent-primary,#5c8dea)}.text-controls-disable{color:var(--controls-disable,#333942)}.text-error{color:var(--text-error,#f76464)}.text-icon-accent-primary{color:var(--icon-accent-primary,#5c8dea)}.text-icon-accent-secondary{color:var(--icon-accent-secondary,#37babc)}.text-info{color:var(--text-info,#5c8dea)}.text-primary{color:var(--text-primary,#f3f4f6)}.text-secondary{color:var(--text-secondary,#7f8792)}.text-success{color:var(--text-success,#37babc)}.text-warning{color:var(--text-warning,#f4ce46)}.shadow{--tw-shadow:0 0 4px 0 var(--bg-blackout,#090d13b3);--tw-shadow-colored:0 0 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.outline-offset-0{outline-offset:0}.blur{--tw-blur:blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}}.hover\:text-primary:hover{color:var(--text-primary,#f3f4f6)}.focus-visible\:outline:focus-visible{outline-style:solid}@media (min-width:640px){.sm\:inline{display:inline}}
|
|
@@ -23,20 +23,20 @@ export interface DialAlertProps {
|
|
|
23
23
|
* <DialAlert
|
|
24
24
|
* variant={AlertVariant.Success}
|
|
25
25
|
* message="Changes saved successfully."
|
|
26
|
-
* onClose={(e) => console.log('closed', e)}
|
|
27
26
|
* />
|
|
28
27
|
*
|
|
29
28
|
* <DialAlert
|
|
30
29
|
* variant={AlertVariant.Error}
|
|
31
|
-
* closable
|
|
30
|
+
* closable
|
|
32
31
|
* message="Something went wrong."
|
|
32
|
+
* onClose={(e) => console.log('closed', e)}
|
|
33
33
|
* />
|
|
34
34
|
* ```
|
|
35
35
|
*
|
|
36
36
|
* @param [variant=AlertVariant.Info] - Defines the visual style and icon of the alert
|
|
37
37
|
* @param message - Message text to display inside the alert
|
|
38
38
|
* @param [cssClass] - Additional CSS classes applied to the alert container
|
|
39
|
-
* @param [closable=
|
|
39
|
+
* @param [closable=false] - Whether the alert has a close button
|
|
40
40
|
* @param [onClose] - Callback fired when the close button is clicked
|
|
41
41
|
*/
|
|
42
42
|
export declare const DialAlert: FC<DialAlertProps>;
|
|
@@ -2,4 +2,4 @@ import { AlertVariant } from '../../types/alert';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
export declare const variantIcons: Record<AlertVariant, ReactNode>;
|
|
4
4
|
export declare const alertVariantClassMap: Record<AlertVariant, string>;
|
|
5
|
-
export declare const alertBaseClasses = "
|
|
5
|
+
export declare const alertBaseClasses = "items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface DialLoaderProps {
|
|
3
|
+
size?: number;
|
|
4
|
+
cssClass?: string;
|
|
5
|
+
iconClass?: string;
|
|
6
|
+
fullWidth?: boolean;
|
|
7
|
+
ariaLabel?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A simple loading spinner component.
|
|
11
|
+
*
|
|
12
|
+
* Renders a spinning SVG with optional full-width container.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Full width (default)
|
|
17
|
+
* <DialLoader />
|
|
18
|
+
*
|
|
19
|
+
* // Inline (content width)
|
|
20
|
+
* <DialLoader fullWidth={false} />
|
|
21
|
+
*
|
|
22
|
+
* // Custom size and classes
|
|
23
|
+
* <DialLoader size={24} iconClass="text-accent-primary" />
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param [size=18] - Icon size in px
|
|
27
|
+
* @param [cssClass] - Additional classes for the container
|
|
28
|
+
* @param [iconClass] - Additional classes for the SVG icon
|
|
29
|
+
* @param [fullWidth=true] - Stretch to full width/height of container
|
|
30
|
+
* @param [ariaLabel='Loading'] - Accessible label for screen readers
|
|
31
|
+
*/
|
|
32
|
+
export declare const DialLoader: FC<DialLoaderProps>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { DialErrorText } from './components/ErrorText/ErrorText';
|
|
|
3
3
|
export { DialFieldLabel } from './components/Field/Field';
|
|
4
4
|
export { DialIcon } from './components/Icon/Icon';
|
|
5
5
|
export { DialAlert } from './components/Alert/Alert';
|
|
6
|
+
export { DialLoader } from './components/Loader/Loader';
|
|
6
7
|
export { DialTextarea } from './components/Textarea/Textarea';
|
|
7
8
|
export { DialTextAreaField } from './components/TextAreaField/TextAreaField';
|
|
8
9
|
export { DialTooltip } from './components/Tooltip/Tooltip';
|