@solibo/solibo-ui 1.1.6 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -0
- package/dist/assets/index20.css +0 -1
- package/dist/assets/index21.css +1 -1
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index38.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index43.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index45.css +1 -1
- package/dist/assets/index46.css +1 -1
- package/dist/assets/index47.css +1 -1
- package/dist/assets/index48.css +1 -1
- package/dist/assets/index49.css +1 -1
- package/dist/assets/index50.css +1 -1
- package/dist/assets/index51.css +1 -1
- package/dist/assets/index52.css +1 -0
- package/dist/assets/index53.css +1 -0
- package/dist/assets/index54.css +1 -0
- package/dist/assets/index9.css +1 -1
- package/dist/components/app-link/index.cjs +1 -1
- package/dist/components/app-link/index.js +1 -1
- package/dist/components/app-shell/index.cjs +2 -0
- package/dist/components/app-shell/index.cjs.map +1 -0
- package/dist/components/app-shell/index.js +18 -0
- package/dist/components/app-shell/index.js.map +1 -0
- package/dist/components/aside/index.cjs +1 -1
- package/dist/components/aside/index.js +1 -1
- package/dist/components/avatar/index.cjs +1 -1
- package/dist/components/avatar/index.cjs.map +1 -1
- package/dist/components/avatar/index.js +43 -45
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.cjs +1 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/banner/index.cjs +1 -1
- package/dist/components/banner/index.js +1 -1
- package/dist/components/branding/index.cjs +1 -1
- package/dist/components/branding/index.js +1 -1
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/card/index.cjs +1 -1
- package/dist/components/card/index.js +1 -1
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/chip/index.cjs +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/collapsible/index.cjs +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/controls/index.cjs +1 -1
- package/dist/components/controls/index.js +1 -1
- package/dist/components/croppable/index.cjs +1 -1
- package/dist/components/croppable/index.js +1 -1
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/divider/index.cjs +2 -0
- package/dist/components/divider/index.cjs.map +1 -0
- package/dist/components/divider/index.js +12 -0
- package/dist/components/divider/index.js.map +1 -0
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.js +3 -3
- package/dist/components/dropzone/index.cjs +1 -1
- package/dist/components/dropzone/index.js +1 -1
- package/dist/components/editor/index.cjs +2 -2
- package/dist/components/editor/index.cjs.map +1 -1
- package/dist/components/editor/index.js +3 -3
- package/dist/components/editor/index.js.map +1 -1
- package/dist/components/empty-state/index.cjs +1 -1
- package/dist/components/empty-state/index.js +1 -1
- package/dist/components/fieldset/index.cjs +1 -1
- package/dist/components/fieldset/index.js +1 -1
- package/dist/components/figure/index.cjs +1 -1
- package/dist/components/figure/index.js +1 -1
- package/dist/components/file/index.cjs +1 -1
- package/dist/components/file/index.js +1 -1
- package/dist/components/footer/index.cjs +1 -1
- package/dist/components/footer/index.js +1 -1
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +1 -1
- package/dist/components/graph/index.cjs +1 -1
- package/dist/components/graph/index.js +1 -1
- package/dist/components/group/index.cjs +1 -1
- package/dist/components/group/index.js +1 -1
- package/dist/components/header/index.cjs +1 -1
- package/dist/components/header/index.js +1 -1
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/iframe/index.cjs +1 -1
- package/dist/components/iframe/index.js +1 -1
- package/dist/components/image/index.cjs +1 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +1 -1
- package/dist/components/link/index.cjs +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.js +1 -1
- package/dist/components/loading/index.cjs +1 -1
- package/dist/components/loading/index.js +1 -1
- package/dist/components/message/index.cjs +1 -1
- package/dist/components/message/index.js +1 -1
- package/dist/components/messages/index.cjs +1 -1
- package/dist/components/messages/index.js +1 -1
- package/dist/components/nav/index.cjs +1 -1
- package/dist/components/nav/index.cjs.map +1 -1
- package/dist/components/nav/index.js +47 -34
- package/dist/components/nav/index.js.map +1 -1
- package/dist/components/object/index.cjs +1 -1
- package/dist/components/object/index.js +1 -1
- package/dist/components/page-layout/index.cjs +2 -0
- package/dist/components/page-layout/index.cjs.map +1 -0
- package/dist/components/page-layout/index.js +23 -0
- package/dist/components/page-layout/index.js.map +1 -0
- package/dist/components/popover/index.cjs +1 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.js +1 -1
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/toolbar/index.cjs +1 -1
- package/dist/components/toolbar/index.js +1 -1
- package/dist/components/tooltip/index.cjs +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/{index-CwIzKfBo.js → index-BLb3JiCr.js} +2 -2
- package/dist/{index-CwIzKfBo.js.map → index-BLb3JiCr.js.map} +1 -1
- package/dist/{index-CXaYq0By.cjs → index-Bt7vnwji.cjs} +2 -2
- package/dist/{index-CXaYq0By.cjs.map → index-Bt7vnwji.cjs.map} +1 -1
- package/dist/index-CQlMdqOp.cjs +2 -0
- package/dist/index-CQlMdqOp.cjs.map +1 -0
- package/dist/index-CbJ2-IPc.js +83 -0
- package/dist/index-CbJ2-IPc.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +29 -2
- package/dist/index.js +109 -102
- package/dist/index.js.map +1 -1
- package/dist/tokens.json +1 -1
- package/package.json +1 -1
- package/dist/index-5yOssOic.cjs +0 -2
- package/dist/index-5yOssOic.cjs.map +0 -1
- package/dist/index-Cv6TtBnd.js +0 -76
- package/dist/index-Cv6TtBnd.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index52.css');const m=require("react/jsx-runtime"),k=require("../../classix-5H4IWnMA.cjs"),o=require("react"),S=require("react-dom"),K=require("../button/index.cjs"),O="_popover_14bo5_1",I="_inline_14bo5_6",N="_below_14bo5_47",H="_above_14bo5_52",W="_left_14bo5_62",M="_right_14bo5_67",U="_trigger_14bo5_72",r={popover:O,inline:I,"popover-panel":"_popover-panel_14bo5_26",below:N,above:H,"inline-panel":"_inline-panel_14bo5_57",left:W,right:M,trigger:U,"inline-trigger":"_inline-trigger_14bo5_76"},X=({children:v,inline:s=!1,triggerAccessibleLabel:C,triggerAriaHasPopup:T,triggerButtonContent:z})=>{var B;const h=o.useRef(null),y=o.useRef(void 0),b=o.useRef(null),P=o.useId(),p=o.useRef(null),[t,R]=o.useState(!1),[f,D]=o.useState(!1),[d,x]=o.useState("right"),_=({initialFocus:e}={})=>{y.current=e,D(!1),x("right"),R(!0)},l=o.useCallback(({restoreFocus:e=!0}={})=>{var i;R(!1),e&&((i=p.current)==null||i.focus())},[]),L=e=>{t&&e.key==="Escape"&&l()},j=e=>{if(!t){if(e.key==="ArrowDown"){e.preventDefault(),_({initialFocus:"first"});return}e.key==="ArrowUp"&&(e.preventDefault(),_({initialFocus:"last"}))}};o.useEffect(()=>{if(!t)return;const e=i=>{var n,g;const u=i.target;(n=h.current)!=null&&n.contains(u)||(g=b.current)!=null&&g.contains(u)||l({restoreFocus:!1})};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[l,t]);const a=o.useCallback(()=>{const e=b.current,i=p.current;if(!e||!i)return;const u=e.getBoundingClientRect(),n=i.getBoundingClientRect(),g=n.top,E=window.innerHeight-n.bottom;D(u.height>E&&g>E),x(u.width>window.innerWidth-n.left&&n.right>window.innerWidth-n.left?"left":"right")},[]);o.useLayoutEffect(()=>{if(t)return a(),window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),()=>{window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0)}},[t,a]);const F=e=>{e.preventDefault(),e.stopPropagation(),t?l({restoreFocus:!1}):_()},q={"aria-controls":t?P:void 0,"aria-expanded":t,"aria-haspopup":T,"aria-label":C,className:s?r["inline-trigger"]:r.trigger,onClick:F,onKeyDown:j},c=s?(B=p.current)==null?void 0:B.getBoundingClientRect():void 0,A=[d==="left"?"translateX(-100%)":"",f?"translateY(calc(-100% - var(--shape-spacing-2xs)))":""].filter(Boolean).join(" "),w=t?m.jsx("div",{className:k.t(r["popover-panel"],r[f?"above":"below"],s&&r["inline-panel"],!s&&r[d]),"data-horizontal-placement":d,"data-placement":f?"above":"below",id:P,ref:b,style:c?{left:d==="left"?c.right:c.left,position:"fixed",top:f?c.top:c.bottom,transform:A||void 0}:void 0,children:typeof v=="function"?v({close:l,initialFocus:y.current,isOpen:t}):v}):null;return m.jsxs("div",{className:k.t(r.popover,s&&r.inline),"data-open":t,onKeyDown:L,onClick:e=>{e.preventDefault(),e.stopPropagation()},ref:h,"data-component":"popover",children:[m.jsx(K.Button,{...q,ref:p,variant:"simple",children:z}),s&&w&&typeof document<"u"?S.createPortal(w,document.body):w]})};exports.Popover=X;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -3,7 +3,7 @@ import { t as C } from "../../classix-DG18itHa.js";
|
|
|
3
3
|
import { useRef as g, useId as H, useState as b, useCallback as L, useEffect as W, useLayoutEffect as S } from "react";
|
|
4
4
|
import { createPortal as U } from "react-dom";
|
|
5
5
|
import { Button as X } from "../button/index.js";
|
|
6
|
-
import '../../assets/
|
|
6
|
+
import '../../assets/index52.css';const Y = "_popover_14bo5_1", q = "_inline_14bo5_6", G = "_below_14bo5_47", J = "_above_14bo5_52", M = "_left_14bo5_62", Q = "_right_14bo5_67", V = "_trigger_14bo5_72", n = {
|
|
7
7
|
popover: Y,
|
|
8
8
|
inline: q,
|
|
9
9
|
"popover-panel": "_popover-panel_14bo5_26",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index9.css');const a=require("react/jsx-runtime"),b=require("react"),h=require("../button/index.cjs"),I=require("../checkbox/index.cjs"),T=require("../chip/index.cjs"),H=require("../collapsible/index.cjs"),P=require("../controls/index.cjs"),z=require("../dialog/index.cjs"),A=require("../header/index.cjs"),E=require("../../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index9.css');const a=require("react/jsx-runtime"),b=require("react"),h=require("../button/index.cjs"),I=require("../checkbox/index.cjs"),T=require("../chip/index.cjs"),H=require("../collapsible/index.cjs"),P=require("../controls/index.cjs"),z=require("../dialog/index.cjs"),A=require("../header/index.cjs"),E=require("../../index-CQlMdqOp.cjs"),J="_search_1rde5_3",K="_controls_1rde5_15",Q="_chips_1rde5_35",S="_radio_1rde5_101",l={search:J,controls:K,chips:Q,"filter-dialog":"_filter-dialog_1rde5_42","filter-groups":"_filter-groups_1rde5_47","filter-group":"_filter-group_1rde5_47","filter-option":"_filter-option_1rde5_83","option-copy":"_option-copy_1rde5_89",radio:S,"collapsible-options":"_collapsible-options_1rde5_128"},U=({filterButtonLabel:x="Filters",filterDialogColumns:k=1,filterDialogTitle:q="Filters",filterGroups:d=[],onChange:M,onSelectedFiltersChange:i,removeFilterLabel:$=c=>`Remove ${c.label} filter`,resetLabel:j="Reset",searchLabel:O="Search",searchPlaceholder:w="Search",selectedFilters:t=[],showResultsLabel:B="Show results",value:D=""})=>{const c=b.useId(),[v,r]=b.useState(!1),R=b.useMemo(()=>new Map(d.flatMap(e=>{var n;return[...e.options,...((n=e.collapsible)==null?void 0:n.options)??[]]}).map(e=>[e.value,e])),[d]),p=t.flatMap(e=>{const n=R.get(e);return n?[n]:[]}),_=(e,n,s)=>{var f;if(!i)return;const m=new Set([...(s==null?void 0:s.options.map(o=>o.value))??[],...((f=s==null?void 0:s.collapsible)==null?void 0:f.options.map(o=>o.value))??[]]),N=t.filter(o=>!m.has(o));if(n&&(s==null?void 0:s.defaultValue)===e){i(N);return}i(n?(s==null?void 0:s.control)==="radio"||(s==null?void 0:s.selectionMode)==="single"?[...N,e]:[...new Set([...t,e])]:t.filter(o=>o!==e))},u=(e,n)=>{var s;return t.includes(e)||n.defaultValue===e&&![...n.options,...((s=n.collapsible)==null?void 0:s.options)??[]].some(m=>t.includes(m.value))},y=(e,n)=>a.jsx("div",{className:l["filter-option"],"data-component":"renderfilter",children:n.control==="radio"?a.jsxs("label",{className:l.radio,children:[a.jsx("input",{checked:u(e.value,n),name:`${c}-filter-${n.label??"group"}`,onChange:s=>_(e.value,s.target.checked,n),type:"radio"}),a.jsxs("span",{className:l["option-copy"],children:[e.label,e.description&&a.jsx("sub",{children:e.description})]})]}):a.jsx(I.Checkbox,{checked:u(e.value,n),label:a.jsxs("span",{className:l["option-copy"],children:[e.label,e.description&&a.jsx("sub",{children:e.description})]}),onChange:s=>_(e.value,s.target.checked,n)})},e.value);return a.jsxs("div",{className:l.search,"data-component":"search",children:[a.jsxs("div",{className:l.controls,children:[a.jsx(E.Input,{"aria-label":O,icon:"MagnifyingGlass",onChange:e=>M(e.target.value),placeholder:w,type:"search",value:D}),d.length>0&&a.jsx(h.Button,{"aria-expanded":v,"aria-haspopup":"dialog",badge:p.length,icon:"Funnel",onClick:()=>r(!0),variant:"tertiary",children:x})]}),p.length>0&&a.jsxs("div",{"aria-label":x,className:l.chips,children:[p.map(e=>a.jsx(T.Chip,{accessibleLabel:$(e),label:e.label,onDelete:()=>_(e.value,!1)},e.value)),a.jsx(h.Button,{onClick:()=>i==null?void 0:i([]),variant:"tertiary",children:j})]}),v&&a.jsx(z.Dialog,{"aria-labelledby":c,className:l["filter-dialog"],controls:a.jsxs(P.Controls,{children:[a.jsx(h.Button,{onClick:()=>{i==null||i([]),r(!1)},children:j}),a.jsx(h.Button,{onClick:()=>r(!1),variant:"primary",children:B})]}),header:a.jsx(A.Header,{children:a.jsx("h2",{id:c,children:q})}),open:!0,setOpen:r,children:a.jsx("div",{className:l["filter-groups"],"data-columns":k,children:d.map((e,n)=>a.jsxs("section",{"aria-labelledby":e.label?`${c}-${n}`:void 0,className:l["filter-group"],"data-column-span":e.columnSpan??1,role:e.control==="radio"?"radiogroup":"group",children:[e.label&&a.jsx("h3",{id:`${c}-${n}`,children:e.label}),e.options.map(s=>y(s,e)),e.collapsible&&a.jsx(H.Collapsible,{summary:e.collapsible.label,children:a.jsx("div",{className:l["collapsible-options"],children:e.collapsible.options.map(s=>y(s,e))})})]},e.label??n))})})]})};exports.Search=U;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -7,7 +7,7 @@ import { Collapsible as E } from "../collapsible/index.js";
|
|
|
7
7
|
import { Controls as J } from "../controls/index.js";
|
|
8
8
|
import { Dialog as K } from "../dialog/index.js";
|
|
9
9
|
import { Header as P } from "../header/index.js";
|
|
10
|
-
import { I as Q } from "../../index-
|
|
10
|
+
import { I as Q } from "../../index-CbJ2-IPc.js";
|
|
11
11
|
import '../../assets/index9.css';const U = "_search_1rde5_3", V = "_controls_1rde5_15", W = "_chips_1rde5_35", X = "_radio_1rde5_101", o = {
|
|
12
12
|
search: U,
|
|
13
13
|
controls: V,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("../../classix-5H4IWnMA.cjs");require("../../icons-Dv_p0bUF.cjs");const e=require("../../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("../../classix-5H4IWnMA.cjs");require("../../icons-Dv_p0bUF.cjs");const e=require("../../index-Bt7vnwji.cjs");require("../../use-touched-Bq5Gjbpz.cjs");exports.Select=e.Select;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../../classix-DG18itHa.js";
|
|
3
3
|
import "../../icons-dUP7sKyt.js";
|
|
4
|
-
import { S as e } from "../../index-
|
|
4
|
+
import { S as e } from "../../index-BLb3JiCr.js";
|
|
5
5
|
import "../../use-touched-B999bBr8.js";
|
|
6
6
|
export {
|
|
7
7
|
e as Select
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index54.css');const a=require("react/jsx-runtime"),l=require("../../classix-5H4IWnMA.cjs"),s="_toolbar_vp38k_1",n="_editor_vp38k_34",o={toolbar:s,default:"_default_vp38k_28",editor:n},i=({children:t,variant:e="default"})=>a.jsx("div",{className:l.t(o.toolbar,o[e]),onClick:r=>r.stopPropagation(),"data-component":"toolbar",children:t});exports.Toolbar=i;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { t as e } from "../../classix-DG18itHa.js";
|
|
3
|
-
import '../../assets/
|
|
3
|
+
import '../../assets/index54.css';const s = "_toolbar_vp38k_1", n = "_editor_vp38k_34", o = {
|
|
4
4
|
toolbar: s,
|
|
5
5
|
default: "_default_vp38k_28",
|
|
6
6
|
editor: n
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index15.css');const s=require("react/jsx-runtime"),c=require("../../classix-5H4IWnMA.cjs"),a=require("../icon/index.cjs"),t={static:"_static_r8l1k_1"},r={default:t.default,static:t.static},l=({variant:o="default",children:i,iconName:e,...n})=>s.jsxs("div",{className:c.t(t.tooltip,r[o]),...n,"data-component":"tooltip",children:[e&&s.jsx(a.Icon,{gap:"right",name:e}),i]});exports.Tooltip=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as r, jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { t as l } from "../../classix-DG18itHa.js";
|
|
3
3
|
import { Icon as e } from "../icon/index.js";
|
|
4
|
-
import '../../assets/
|
|
4
|
+
import '../../assets/index15.css';const t = {
|
|
5
5
|
static: "_static_r8l1k_1"
|
|
6
6
|
}, n = {
|
|
7
7
|
default: t.default,
|
|
@@ -2,7 +2,7 @@ import { jsxs as m, jsx as p } from "react/jsx-runtime";
|
|
|
2
2
|
import { t as v } from "./classix-DG18itHa.js";
|
|
3
3
|
import { i as w } from "./icons-dUP7sKyt.js";
|
|
4
4
|
import { u as C, c as S } from "./use-touched-B999bBr8.js";
|
|
5
|
-
import './assets/
|
|
5
|
+
import './assets/index53.css';const P = /* @__PURE__ */ new Set(["aria-activedescendant", "aria-autocomplete", "aria-busy", "aria-controls", "aria-describedby", "aria-details", "aria-disabled", "aria-errormessage", "aria-expanded", "aria-haspopup", "aria-hidden", "aria-invalid", "aria-keyshortcuts", "aria-label", "aria-labelledby", "aria-live", "aria-owns", "aria-required", "aria-roledescription", "autoComplete", "autoFocus", "className", "defaultValue", "dir", "disabled", "form", "id", "multiple", "name", "onBlur", "onChange", "onClick", "onFocus", "onInput", "onInvalid", "onKeyDown", "onKeyUp", "onMouseDown", "onMouseUp", "onPointerDown", "onPointerUp", "required", "role", "size", "style", "tabIndex", "title", "value"]);
|
|
6
6
|
function _(n) {
|
|
7
7
|
return Object.fromEntries(Object.entries(n).filter(([e]) => e.startsWith("data-") || e.startsWith("aria-") || P.has(e)));
|
|
8
8
|
}
|
|
@@ -71,4 +71,4 @@ export {
|
|
|
71
71
|
N as r,
|
|
72
72
|
_ as s
|
|
73
73
|
};
|
|
74
|
-
//# sourceMappingURL=index-
|
|
74
|
+
//# sourceMappingURL=index-BLb3JiCr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-BLb3JiCr.js","sources":["../src/components/select/sanitize-select-props.ts","../src/utils/color.ts","../src/components/select/index.tsx"],"sourcesContent":["const selectKeys = new Set([\n 'aria-activedescendant',\n 'aria-autocomplete',\n 'aria-busy',\n 'aria-controls',\n 'aria-describedby',\n 'aria-details',\n 'aria-disabled',\n 'aria-errormessage',\n 'aria-expanded',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-invalid',\n 'aria-keyshortcuts',\n 'aria-label',\n 'aria-labelledby',\n 'aria-live',\n 'aria-owns',\n 'aria-required',\n 'aria-roledescription',\n 'autoComplete',\n 'autoFocus',\n 'className',\n 'defaultValue',\n 'dir',\n 'disabled',\n 'form',\n 'id',\n 'multiple',\n 'name',\n 'onBlur',\n 'onChange',\n 'onClick',\n 'onFocus',\n 'onInput',\n 'onInvalid',\n 'onKeyDown',\n 'onKeyUp',\n 'onMouseDown',\n 'onMouseUp',\n 'onPointerDown',\n 'onPointerUp',\n 'required',\n 'role',\n 'size',\n 'style',\n 'tabIndex',\n 'title',\n 'value',\n]);\n\nexport function sanitizeSelectProps<T extends Record<string, unknown>>(props: T) {\n return Object.fromEntries(\n Object.entries(props).filter(\n ([key]) => key.startsWith('data-') || key.startsWith('aria-') || selectKeys.has(key)\n )\n ) as Partial<T>;\n}\n","const cssVariablePattern = /^--[\\w-]+$/;\nconst cssVariableReferencePattern = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.+))?\\)$/;\n\nconst unresolvedColorKeywords = new Set([\n 'currentcolor',\n 'inherit',\n 'initial',\n 'revert',\n 'revert-layer',\n 'unset',\n]);\n\nconst probe = typeof document !== 'undefined' ? document.createElement('span') : null;\n\nfunction normalizeColorValue(input: string): string {\n const value = input.trim();\n\n if (!value || !probe || unresolvedColorKeywords.has(value.toLowerCase())) {\n return value;\n }\n\n const mountNode = document.body ?? document.documentElement;\n\n if (!mountNode) {\n return value;\n }\n\n probe.style.color = value;\n\n if (!probe.style.color) {\n return value;\n }\n\n mountNode.appendChild(probe);\n\n const normalized = getComputedStyle(probe).color.trim();\n probe.remove();\n\n return normalized || value;\n}\n\nexport function resolveColor(input: `--${string}` | string, fallback = 'currentColor'): string {\n if (typeof document === 'undefined') {\n return fallback;\n }\n\n const styles = getComputedStyle(document.documentElement);\n const seen = new Set<string>();\n let current = input.trim();\n\n while (current) {\n const match = current.match(cssVariableReferencePattern);\n const variableName = match?.[1] ?? (cssVariablePattern.test(current) ? current : null);\n const nestedFallback = match?.[2]?.trim();\n\n if (!variableName) {\n return normalizeColorValue(current);\n }\n\n if (seen.has(variableName)) {\n current = nestedFallback ?? '';\n continue;\n }\n\n seen.add(variableName);\n\n current = styles.getPropertyValue(variableName).trim() || nestedFallback || '';\n }\n\n return normalizeColorValue(fallback);\n}\n","import cx from 'classix';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { resolveColor } from '@/utils/color';\nimport { composeEventHandlers } from '@/utils/compose-event-handlers';\nimport { useTouched } from '@/utils/use-touched';\n\nimport { sanitizeSelectProps } from './sanitize-select-props';\nimport styles from './styles.module.css';\n\nexport type SelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {\n children: React.ReactNode;\n label?: string;\n placeholder?: string;\n};\n\ntype withVars = React.CSSProperties & {\n '--icon-svg'?: string;\n};\n\nexport const Select = ({ children, label, placeholder, ...props }: SelectProps) => {\n const { touched, onBlur } = useTouched(props.value === '');\n const selectProps = sanitizeSelectProps(props);\n const { className, onBlur: onBlurProp, style, ...restSelectProps } = selectProps;\n const withVars = {\n ...style,\n '--icon-svg': iconSVG('CaretDown', resolveColor('--colors-semantic-content-secondary')),\n } satisfies withVars;\n\n const selectElement = (\n <select\n className={cx(styles.select, className, touched && styles.touched)}\n onBlur={composeEventHandlers(onBlur, onBlurProp)}\n style={withVars}\n {...restSelectProps}\n >\n {placeholder && (\n <option\n key='placeholder'\n value={''}\n hidden\n >\n {placeholder}\n </option>\n )}\n {children}\n </select>\n );\n\n if (!label) {\n return selectElement;\n }\n\n return (\n <label>\n <span\n className={styles.label}\n data-required={props.required || undefined}\n >\n {label}\n </span>\n {selectElement}\n </label>\n );\n};\n"],"names":["selectKeys","Set","sanitizeSelectProps","props","Object","fromEntries","entries","filter","key","startsWith","has","cssVariablePattern","cssVariableReferencePattern","unresolvedColorKeywords","probe","document","createElement","normalizeColorValue","input","value","trim","toLowerCase","mountNode","body","documentElement","style","color","appendChild","normalized","getComputedStyle","remove","resolveColor","fallback","styles","seen","current","match","variableName","test","nestedFallback","add","getPropertyValue","Select","children","label","placeholder","touched","onBlur","useTouched","selectProps","className","onBlurProp","restSelectProps","withVars","iconSVG","selectElement","cx","select","composeEventHandlers","jsxs","jsx","required","undefined"],"mappings":";;;;AAAA,MAAMA,IAAa,oBAAIC,IAAI,CACzB,yBACA,qBACA,aACA,iBACA,oBACA,gBACA,iBACA,qBACA,iBACA,iBACA,eACA,gBACA,qBACA,cACA,mBACA,aACA,aACA,iBACA,wBACA,gBACA,aACA,aACA,gBACA,OACA,YACA,QACA,MACA,YACA,QACA,UACA,YACA,WACA,WACA,WACA,aACA,aACA,WACA,eACA,aACA,iBACA,eACA,YACA,QACA,QACA,SACA,YACA,SACA,OAAO,CACR;AAEM,SAASC,EAAuDC,GAAU;AAC/E,SAAOC,OAAOC,YACZD,OAAOE,QAAQH,CAAK,EAAEI,OACpB,CAAC,CAACC,CAAG,MAAMA,EAAIC,WAAW,OAAO,KAAKD,EAAIC,WAAW,OAAO,KAAKT,EAAWU,IAAIF,CAAG,CACrF,CACF;AACF;ACzDA,MAAMG,IAAqB,cACrBC,IAA8B,0CAE9BC,IAA0B,oBAAIZ,IAAI,CACtC,gBACA,WACA,WACA,UACA,gBACA,OAAO,CACR,GAEKa,IAAQ,OAAOC,WAAa,MAAcA,SAASC,cAAc,MAAM,IAAI;AAEjF,SAASC,EAAoBC,GAAuB;AAClD,QAAMC,IAAQD,EAAME,KAAAA;AAEpB,MAAI,CAACD,KAAS,CAACL,KAASD,EAAwBH,IAAIS,EAAME,YAAAA,CAAa;AACrE,WAAOF;AAGT,QAAMG,IAAYP,SAASQ,QAAQR,SAASS;AAQ5C,MANI,CAACF,MAILR,EAAMW,MAAMC,QAAQP,GAEhB,CAACL,EAAMW,MAAMC;AACf,WAAOP;AAGTG,EAAAA,EAAUK,YAAYb,CAAK;AAE3B,QAAMc,IAAaC,iBAAiBf,CAAK,EAAEY,MAAMN,KAAAA;AACjDN,SAAAA,EAAMgB,OAAAA,GAECF,KAAcT;AACvB;AAEO,SAASY,EAAab,GAA+Bc,IAAW,gBAAwB;;AAC7F,MAAI,OAAOjB,WAAa;AACtB,WAAOiB;AAGT,QAAMC,IAASJ,iBAAiBd,SAAS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BACE,UAAA,EAEC,OAAO,IACP,QAAM,IAELA,eAJG,aAKN;AAAA,IAEDF;AAAAA,EAAAA,GACH;AAGF,SAAKC,IAKH,gBAAAe,EAAC,SAAA,EAAK,kBAAA,UACJ,UAAA;AAAA,IAAA,gBAAAC,EAAC,QAAA,EACC,WAAW3B,EAAOW,OAClB,iBAAezC,EAAM0D,YAAYC,QAEhClB,UAAAA,EAAAA,CACH;AAAA,IACCW;AAAAA,EAAAA,GACH,IAZOA;AAcX;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require('./assets/
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
"use strict";require('./assets/index53.css');const u=require("react/jsx-runtime"),C=require("./classix-5H4IWnMA.cjs"),S=require("./icons-Dv_p0bUF.cjs"),p=require("./use-touched-Bq5Gjbpz.cjs"),P=new Set(["aria-activedescendant","aria-autocomplete","aria-busy","aria-controls","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-required","aria-roledescription","autoComplete","autoFocus","className","defaultValue","dir","disabled","form","id","multiple","name","onBlur","onChange","onClick","onFocus","onInput","onInvalid","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onPointerDown","onPointerUp","required","role","size","style","tabIndex","title","value"]);function h(r){return Object.fromEntries(Object.entries(r).filter(([e])=>e.startsWith("data-")||e.startsWith("aria-")||P.has(e)))}const _=/^--[\w-]+$/,q=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/,x=new Set(["currentcolor","inherit","initial","revert","revert-layer","unset"]),l=typeof document<"u"?document.createElement("span"):null;function b(r){const e=r.trim();if(!e||!l||x.has(e.toLowerCase()))return e;const s=document.body??document.documentElement;if(!s||(l.style.color=e,!l.style.color))return e;s.appendChild(l);const n=getComputedStyle(l).color.trim();return l.remove(),n||e}function y(r,e="currentColor"){var i;if(typeof document>"u")return e;const s=getComputedStyle(document.documentElement),n=new Set;let t=r.trim();for(;t;){const o=t.match(q),a=(o==null?void 0:o[1])??(_.test(t)?t:null),c=(i=o==null?void 0:o[2])==null?void 0:i.trim();if(!a)return b(t);if(n.has(a)){t=c??"";continue}n.add(a),t=s.getPropertyValue(a).trim()||c||""}return b(e)}const j="_select_1bm47_3",V="_touched_1bm47_24",g="_label_1bm47_29",d={select:j,touched:V,label:g},E=({children:r,label:e,placeholder:s,...n})=>{const{touched:t,onBlur:i}=p.useTouched(n.value===""),o=h(n),{className:a,onBlur:c,style:v,...f}=o,w={...v,"--icon-svg":S.iconSVG("CaretDown",y("--colors-semantic-content-secondary"))},m=u.jsxs("select",{className:C.t(d.select,a,t&&d.touched),onBlur:p.composeEventHandlers(i,c),style:w,...f,children:[s&&u.jsx("option",{value:"",hidden:!0,children:s},"placeholder"),r]});return e?u.jsxs("label",{"data-component":"select",children:[u.jsx("span",{className:d.label,"data-required":n.required||void 0,children:e}),m]}):m};exports.Select=E;exports.resolveColor=y;exports.sanitizeSelectProps=h;
|
|
2
|
+
//# sourceMappingURL=index-Bt7vnwji.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-Bt7vnwji.cjs","sources":["../src/components/select/sanitize-select-props.ts","../src/utils/color.ts","../src/components/select/index.tsx"],"sourcesContent":["const selectKeys = new Set([\n 'aria-activedescendant',\n 'aria-autocomplete',\n 'aria-busy',\n 'aria-controls',\n 'aria-describedby',\n 'aria-details',\n 'aria-disabled',\n 'aria-errormessage',\n 'aria-expanded',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-invalid',\n 'aria-keyshortcuts',\n 'aria-label',\n 'aria-labelledby',\n 'aria-live',\n 'aria-owns',\n 'aria-required',\n 'aria-roledescription',\n 'autoComplete',\n 'autoFocus',\n 'className',\n 'defaultValue',\n 'dir',\n 'disabled',\n 'form',\n 'id',\n 'multiple',\n 'name',\n 'onBlur',\n 'onChange',\n 'onClick',\n 'onFocus',\n 'onInput',\n 'onInvalid',\n 'onKeyDown',\n 'onKeyUp',\n 'onMouseDown',\n 'onMouseUp',\n 'onPointerDown',\n 'onPointerUp',\n 'required',\n 'role',\n 'size',\n 'style',\n 'tabIndex',\n 'title',\n 'value',\n]);\n\nexport function sanitizeSelectProps<T extends Record<string, unknown>>(props: T) {\n return Object.fromEntries(\n Object.entries(props).filter(\n ([key]) => key.startsWith('data-') || key.startsWith('aria-') || selectKeys.has(key)\n )\n ) as Partial<T>;\n}\n","const cssVariablePattern = /^--[\\w-]+$/;\nconst cssVariableReferencePattern = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.+))?\\)$/;\n\nconst unresolvedColorKeywords = new Set([\n 'currentcolor',\n 'inherit',\n 'initial',\n 'revert',\n 'revert-layer',\n 'unset',\n]);\n\nconst probe = typeof document !== 'undefined' ? document.createElement('span') : null;\n\nfunction normalizeColorValue(input: string): string {\n const value = input.trim();\n\n if (!value || !probe || unresolvedColorKeywords.has(value.toLowerCase())) {\n return value;\n }\n\n const mountNode = document.body ?? document.documentElement;\n\n if (!mountNode) {\n return value;\n }\n\n probe.style.color = value;\n\n if (!probe.style.color) {\n return value;\n }\n\n mountNode.appendChild(probe);\n\n const normalized = getComputedStyle(probe).color.trim();\n probe.remove();\n\n return normalized || value;\n}\n\nexport function resolveColor(input: `--${string}` | string, fallback = 'currentColor'): string {\n if (typeof document === 'undefined') {\n return fallback;\n }\n\n const styles = getComputedStyle(document.documentElement);\n const seen = new Set<string>();\n let current = input.trim();\n\n while (current) {\n const match = current.match(cssVariableReferencePattern);\n const variableName = match?.[1] ?? (cssVariablePattern.test(current) ? current : null);\n const nestedFallback = match?.[2]?.trim();\n\n if (!variableName) {\n return normalizeColorValue(current);\n }\n\n if (seen.has(variableName)) {\n current = nestedFallback ?? '';\n continue;\n }\n\n seen.add(variableName);\n\n current = styles.getPropertyValue(variableName).trim() || nestedFallback || '';\n }\n\n return normalizeColorValue(fallback);\n}\n","import cx from 'classix';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { resolveColor } from '@/utils/color';\nimport { composeEventHandlers } from '@/utils/compose-event-handlers';\nimport { useTouched } from '@/utils/use-touched';\n\nimport { sanitizeSelectProps } from './sanitize-select-props';\nimport styles from './styles.module.css';\n\nexport type SelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {\n children: React.ReactNode;\n label?: string;\n placeholder?: string;\n};\n\ntype withVars = React.CSSProperties & {\n '--icon-svg'?: string;\n};\n\nexport const Select = ({ children, label, placeholder, ...props }: SelectProps) => {\n const { touched, onBlur } = useTouched(props.value === '');\n const selectProps = sanitizeSelectProps(props);\n const { className, onBlur: onBlurProp, style, ...restSelectProps } = selectProps;\n const withVars = {\n ...style,\n '--icon-svg': iconSVG('CaretDown', resolveColor('--colors-semantic-content-secondary')),\n } satisfies withVars;\n\n const selectElement = (\n <select\n className={cx(styles.select, className, touched && styles.touched)}\n onBlur={composeEventHandlers(onBlur, onBlurProp)}\n style={withVars}\n {...restSelectProps}\n >\n {placeholder && (\n <option\n key='placeholder'\n value={''}\n hidden\n >\n {placeholder}\n </option>\n )}\n {children}\n </select>\n );\n\n if (!label) {\n return selectElement;\n }\n\n return (\n <label>\n <span\n className={styles.label}\n data-required={props.required || undefined}\n >\n {label}\n </span>\n {selectElement}\n </label>\n );\n};\n"],"names":["selectKeys","Set","sanitizeSelectProps","props","Object","fromEntries","entries","filter","key","startsWith","has","cssVariablePattern","cssVariableReferencePattern","unresolvedColorKeywords","probe","document","createElement","normalizeColorValue","input","value","trim","toLowerCase","mountNode","body","documentElement","style","color","appendChild","normalized","getComputedStyle","remove","resolveColor","fallback","styles","seen","current","match","variableName","test","nestedFallback","add","getPropertyValue","Select","children","label","placeholder","touched","onBlur","useTouched","selectProps","className","onBlurProp","restSelectProps","withVars","iconSVG","selectElement","cx","select","composeEventHandlers","jsxs","jsx","required","undefined"],"mappings":"gKAAMA,EAAa,IAAIC,IAAI,CACzB,wBACA,o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B,SAAAA,CAAAA,CACH,EACCW,CAAAA,EACH,EAZOA,CAcX"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";require('./assets/index48.css');const e=require("react/jsx-runtime"),_=require("./classix-5H4IWnMA.cjs"),r=require("react"),U=require("./icons-Dv_p0bUF.cjs"),F=require("./use-touched-Bq5Gjbpz.cjs");function W(n){return n&&`${n[0].toLocaleUpperCase()}${n.slice(1)}`}function P(n){const o=W(n);return o&&!o.endsWith(":")?`${o}:`:o}const k="_field_yagit_3",A="_input_yagit_8",D="_touched_yagit_48",J="_label_yagit_57",K="_inline_yagit_78",O="_error_yagit_99",Q="_code_yagit_106",t={field:k,input:A,touched:D,label:J,inline:K,error:O,code:Q};function X({className:n,defaultCountryCode:o="+47",disabled:c=!1,errorMessage:b,icon:j,invalid:g=!1,label:m,onBlur:R,placeholder:I,ref:y,required:f,style:B,type:i="text",variant:p="default",...s}){const V=r.useId(),[v,L]=r.useState(""),[l,N]=r.useState(""),{name:q,onChange:u,pattern:w,value:d,...z}=s,{touched:E,onBlur:G}=F.useTouched(d===""),h=j&&i!=="radio"&&i!=="datetime-local"?j:void 0,C=m&&p==="inline"?P(m):m,x=g&&b?V:void 0,S=[s["aria-describedby"],x].filter(Boolean).join(" ")||void 0,T=h?{...B,"--icon-svg":U.iconSVG(h)}:B,$=F.composeEventHandlers(G,R);r.useEffect(()=>{if(u&&i==="tel"){const a={name:q,value:l?(v||o).split(" ").join("")+l.split(" ").join(""):void 0};u({target:a,currentTarget:a})}},[v,o,q,u,l,i]),r.useEffect(()=>{i==="tel"&&!d&&(N(""),L(""))},[i,d]);const H=e.jsxs(e.Fragment,{children:[e.jsx("input",{disabled:c,hidden:!0,onChange:u,pattern:void 0,placeholder:I,ref:y,type:i,value:d}),e.jsx("input",{type:"text",className:_.t(t.code,t.input),disabled:c,maxLength:5,onChange:a=>L(a.target.value),placeholder:o,value:v}),e.jsx("input",{...z,"aria-describedby":S,"aria-invalid":g?!0:s["aria-invalid"],type:"tel",className:_.t(t.input,n,E&&t.touched),"data-icon":h?"true":void 0,disabled:c,maxLength:14,name:void 0,onChange:a=>N(a.target.value),onBlur:$,pattern:w,required:f,style:T,value:l})]});return e.jsxs("div",{className:t.field,"data-component":"input",children:[e.jsxs("label",{className:_.t(t.label,p==="inline"&&t.inline),children:[C&&e.jsx("span",{"data-required":f&&p!=="inline"?!0:void 0,children:C}),i==="tel"?H:e.jsx("input",{...s,"aria-describedby":S,"aria-invalid":g?!0:s["aria-invalid"],ref:y,className:_.t(t.input,n,E&&t.touched),"data-icon":h?"true":void 0,disabled:c,onBlur:$,placeholder:I,required:f,style:T,type:i})]}),x&&e.jsx("span",{className:t.error,id:x,role:"alert",children:b})]})}exports.Input=X;exports.formatInlineLabel=P;
|
|
2
|
+
//# sourceMappingURL=index-CQlMdqOp.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CQlMdqOp.cjs","sources":["../src/utils/text.ts","../src/components/input/index.tsx"],"sourcesContent":["export function capitalizeFirstLetter(value: string): string {\n return value ? `${value[0].toLocaleUpperCase()}${value.slice(1)}` : value;\n}\n\nexport function formatInlineLabel(value: string): string {\n const label = capitalizeFirstLetter(value);\n return label && !label.endsWith(':') ? `${label}:` : label;\n}\n","import cx from 'classix';\nimport { useEffect, useId, useState } from 'react';\n\nimport { IconName, iconSVG } from '@/components/icon/icons.ts';\nimport { composeEventHandlers } from '@/utils/compose-event-handlers';\nimport { formatInlineLabel } from '@/utils/text';\nimport { useTouched } from '@/utils/use-touched';\n\nimport styles from './styles.module.css';\n\nexport type InputProps = React.ComponentPropsWithRef<'input'> & {\n defaultCountryCode?: string;\n disabled?: boolean;\n errorMessage?: React.ReactNode;\n icon?: IconName;\n invalid?: boolean;\n label?: string;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n placeholder?: string;\n variant?: 'default' | 'inline';\n type?:\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'number'\n | 'password'\n | 'radio'\n | 'search'\n | 'tel'\n | 'text';\n};\n\nexport function Input({\n className,\n defaultCountryCode = '+47',\n disabled = false,\n errorMessage,\n icon,\n invalid = false,\n label,\n onBlur: onBlurProp,\n placeholder,\n ref,\n required,\n style,\n type = 'text',\n variant = 'default',\n ...props\n}: InputProps) {\n const generatedErrorId = useId();\n const [countryCode, setCountryCode] = useState('');\n const [phoneNumber, setPhoneNumber] = useState('');\n const { name, onChange, pattern, value, ...restProps } = props;\n const { touched, onBlur } = useTouched(value === '');\n const inputIcon = icon && type !== 'radio' && type !== 'datetime-local' ? icon : undefined;\n const displayLabel = label && variant === 'inline' ? formatInlineLabel(label) : label;\n const errorId = invalid && errorMessage ? generatedErrorId : undefined;\n const describedBy = [props['aria-describedby'], errorId].filter(Boolean).join(' ') || undefined;\n\n type withVars =\n | (React.CSSProperties & {\n '--icon-svg'?: string;\n })\n | undefined;\n\n const withVars: withVars = inputIcon\n ? {\n ...style,\n '--icon-svg': iconSVG(inputIcon),\n }\n : style;\n const handleBlur = composeEventHandlers(onBlur, onBlurProp);\n\n useEffect(() => {\n if (onChange && type === 'tel') {\n const target = {\n name,\n value: phoneNumber\n ? (countryCode || defaultCountryCode).split(' ').join('') +\n phoneNumber.split(' ').join('')\n : undefined,\n } as unknown as HTMLInputElement;\n\n onChange({ target, currentTarget: target } as React.ChangeEvent<HTMLInputElement>);\n }\n }, [countryCode, defaultCountryCode, name, onChange, phoneNumber, type]);\n\n useEffect(() => {\n if (type === 'tel' && !value) {\n setPhoneNumber('');\n setCountryCode('');\n }\n }, [type, value]);\n\n const telephoneInput = (\n <>\n <input\n disabled={disabled}\n hidden\n onChange={onChange}\n pattern={undefined}\n placeholder={placeholder}\n ref={ref}\n type={type}\n value={value}\n />\n <input\n type='text'\n className={cx(styles.code, styles.input)}\n disabled={disabled}\n maxLength={5}\n onChange={(e) => setCountryCode(e.target.value)}\n placeholder={defaultCountryCode}\n value={countryCode}\n />\n <input\n {...restProps}\n aria-describedby={describedBy}\n aria-invalid={invalid ? true : props['aria-invalid']}\n type='tel'\n className={cx(styles.input, className, touched && styles.touched)}\n data-icon={inputIcon ? 'true' : undefined}\n disabled={disabled}\n maxLength={14}\n name={undefined}\n onChange={(e) => setPhoneNumber(e.target.value)}\n onBlur={handleBlur}\n pattern={pattern}\n required={required}\n style={withVars}\n value={phoneNumber}\n />\n </>\n );\n\n return (\n <div className={styles.field}>\n <label className={cx(styles.label, variant === 'inline' && styles.inline)}>\n {displayLabel && (\n <span data-required={required && variant !== 'inline' ? true : undefined}>\n {displayLabel}\n </span>\n )}\n {type === 'tel' ? (\n telephoneInput\n ) : (\n <input\n {...props}\n aria-describedby={describedBy}\n aria-invalid={invalid ? true : props['aria-invalid']}\n ref={ref}\n className={cx(styles.input, className, touched && styles.touched)}\n data-icon={inputIcon ? 'true' : undefined}\n disabled={disabled}\n onBlur={handleBlur}\n placeholder={placeholder}\n required={required}\n style={withVars}\n type={type}\n />\n )}\n </label>\n {errorId && (\n <span\n className={styles.error}\n id={errorId}\n role='alert'\n >\n {errorMessage}\n </span>\n )}\n </div>\n );\n}\n"],"names":["capitalizeFirstLetter","value","toLocaleUpperCase","slice","formatInlineLabel","label","endsWith","Input","className","defaultCountryCode","disabled","errorMessage","icon","invalid","onBlur","onBlurProp","placeholder","ref","required","style","type","variant","props","generatedErrorId","useId","countryCode","setCountryCode","useState","phoneNumber","setPhoneNumber","name","onChange","pattern","restProps","touched","useTouched","inputIcon","undefined","displayLabel","errorId","describedBy","filter","Boolean","join","withVars","iconSVG","handleBlur","composeEventHandlers","useEffect","target","split","currentTarget","telephoneInput","jsxs","Fragment","jsx","cx","styles","code","input","e","field","inline","error"],"mappings":"mLAAO,SAASA,EAAsBC,EAAuB,CAC3D,OAAOA,GAAQ,GAAGA,EAAM,CAAC,EAAEC,mBAAmB,GAAGD,EAAME,MAAM,CAAC,CAAC,EACjE,CAEO,SAASC,EAAkBH,EAAuB,CACvD,MAAMI,EAAQL,EAAsBC,CAAK,EACzC,OAAOI,GAAS,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ExB,SAAAA,CAAAA,GACCiB,EAAAA,IAAC,QAAK,gBAAerC,GAAYG,IAAY,SAAW,GAAOgB,OAC5DC,SAAAA,CAAAA,CACH,EAEDlB,IAAS,MACRgC,EAEAG,EAAAA,IAAC,QAAA,CACC,GAAIjC,EACJ,mBAAkBkB,EAClB,eAAc3B,EAAU,GAAOS,EAAM,cAAc,EACnD,IAAAL,EACA,UAAWuC,EAAAA,EAAGC,EAAOE,MAAOnD,EAAW0B,GAAWuB,EAAOvB,OAAO,EAChE,YAAWE,EAAY,OAASC,OAChC,SAAA3B,EACA,OAAQoC,EACR,YAAA9B,EACA,SAAAE,EACA,MAAO0B,EACP,KAAAxB,CAAA,CAAW,CAAA,EAGjB,EACCmB,GACCgB,EAAAA,IAAC,OAAA,CACC,UAAWE,EAAOM,MAClB,GAAIxB,EACJ,KAAK,QAEJ5B,SAAAA,CAAAA,CACH,CAAA,EAEJ,CAEJ"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsxs as b, Fragment as k, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { t as m } from "./classix-DG18itHa.js";
|
|
3
|
+
import { useId as A, useState as T, useEffect as V } from "react";
|
|
4
|
+
import { i as D } from "./icons-dUP7sKyt.js";
|
|
5
|
+
import { u as J, c as K } from "./use-touched-B999bBr8.js";
|
|
6
|
+
import './assets/index48.css';function O(t) {
|
|
7
|
+
return t && `${t[0].toLocaleUpperCase()}${t.slice(1)}`;
|
|
8
|
+
}
|
|
9
|
+
function Q(t) {
|
|
10
|
+
const i = O(t);
|
|
11
|
+
return i && !i.endsWith(":") ? `${i}:` : i;
|
|
12
|
+
}
|
|
13
|
+
const R = "_field_yagit_3", X = "_input_yagit_8", Y = "_touched_yagit_48", Z = "_label_yagit_57", q = "_inline_yagit_78", M = "_error_yagit_99", ee = "_code_yagit_106", e = {
|
|
14
|
+
field: R,
|
|
15
|
+
input: X,
|
|
16
|
+
touched: Y,
|
|
17
|
+
label: Z,
|
|
18
|
+
inline: q,
|
|
19
|
+
error: M,
|
|
20
|
+
code: ee
|
|
21
|
+
};
|
|
22
|
+
function re({
|
|
23
|
+
className: t,
|
|
24
|
+
defaultCountryCode: i = "+47",
|
|
25
|
+
disabled: c = !1,
|
|
26
|
+
errorMessage: y,
|
|
27
|
+
icon: I,
|
|
28
|
+
invalid: h = !1,
|
|
29
|
+
label: p,
|
|
30
|
+
onBlur: w,
|
|
31
|
+
placeholder: x,
|
|
32
|
+
ref: B,
|
|
33
|
+
required: _,
|
|
34
|
+
style: N,
|
|
35
|
+
type: n = "text",
|
|
36
|
+
variant: f = "default",
|
|
37
|
+
...r
|
|
38
|
+
}) {
|
|
39
|
+
const z = A(), [g, L] = T(""), [l, j] = T(""), {
|
|
40
|
+
name: C,
|
|
41
|
+
onChange: s,
|
|
42
|
+
pattern: G,
|
|
43
|
+
value: d,
|
|
44
|
+
...H
|
|
45
|
+
} = r, {
|
|
46
|
+
touched: E,
|
|
47
|
+
onBlur: U
|
|
48
|
+
} = J(d === ""), u = I && n !== "radio" && n !== "datetime-local" ? I : void 0, $ = p && f === "inline" ? Q(p) : p, v = h && y ? z : void 0, F = [r["aria-describedby"], v].filter(Boolean).join(" ") || void 0, P = u ? {
|
|
49
|
+
...N,
|
|
50
|
+
"--icon-svg": D(u)
|
|
51
|
+
} : N, S = K(U, w);
|
|
52
|
+
V(() => {
|
|
53
|
+
if (s && n === "tel") {
|
|
54
|
+
const o = {
|
|
55
|
+
name: C,
|
|
56
|
+
value: l ? (g || i).split(" ").join("") + l.split(" ").join("") : void 0
|
|
57
|
+
};
|
|
58
|
+
s({
|
|
59
|
+
target: o,
|
|
60
|
+
currentTarget: o
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}, [g, i, C, s, l, n]), V(() => {
|
|
64
|
+
n === "tel" && !d && (j(""), L(""));
|
|
65
|
+
}, [n, d]);
|
|
66
|
+
const W = /* @__PURE__ */ b(k, { children: [
|
|
67
|
+
/* @__PURE__ */ a("input", { disabled: c, hidden: !0, onChange: s, pattern: void 0, placeholder: x, ref: B, type: n, value: d }),
|
|
68
|
+
/* @__PURE__ */ a("input", { type: "text", className: m(e.code, e.input), disabled: c, maxLength: 5, onChange: (o) => L(o.target.value), placeholder: i, value: g }),
|
|
69
|
+
/* @__PURE__ */ a("input", { ...H, "aria-describedby": F, "aria-invalid": h ? !0 : r["aria-invalid"], type: "tel", className: m(e.input, t, E && e.touched), "data-icon": u ? "true" : void 0, disabled: c, maxLength: 14, name: void 0, onChange: (o) => j(o.target.value), onBlur: S, pattern: G, required: _, style: P, value: l })
|
|
70
|
+
] });
|
|
71
|
+
return /* @__PURE__ */ b("div", { className: e.field, "data-component": "input", children: [
|
|
72
|
+
/* @__PURE__ */ b("label", { className: m(e.label, f === "inline" && e.inline), children: [
|
|
73
|
+
$ && /* @__PURE__ */ a("span", { "data-required": _ && f !== "inline" ? !0 : void 0, children: $ }),
|
|
74
|
+
n === "tel" ? W : /* @__PURE__ */ a("input", { ...r, "aria-describedby": F, "aria-invalid": h ? !0 : r["aria-invalid"], ref: B, className: m(e.input, t, E && e.touched), "data-icon": u ? "true" : void 0, disabled: c, onBlur: S, placeholder: x, required: _, style: P, type: n })
|
|
75
|
+
] }),
|
|
76
|
+
v && /* @__PURE__ */ a("span", { className: e.error, id: v, role: "alert", children: y })
|
|
77
|
+
] });
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
re as I,
|
|
81
|
+
Q as f
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=index-CbJ2-IPc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CbJ2-IPc.js","sources":["../src/utils/text.ts","../src/components/input/index.tsx"],"sourcesContent":["export function capitalizeFirstLetter(value: string): string {\n return value ? `${value[0].toLocaleUpperCase()}${value.slice(1)}` : value;\n}\n\nexport function formatInlineLabel(value: string): string {\n const label = capitalizeFirstLetter(value);\n return label && !label.endsWith(':') ? `${label}:` : label;\n}\n","import cx from 'classix';\nimport { useEffect, useId, useState } from 'react';\n\nimport { IconName, iconSVG } from '@/components/icon/icons.ts';\nimport { composeEventHandlers } from '@/utils/compose-event-handlers';\nimport { formatInlineLabel } from '@/utils/text';\nimport { useTouched } from '@/utils/use-touched';\n\nimport styles from './styles.module.css';\n\nexport type InputProps = React.ComponentPropsWithRef<'input'> & {\n defaultCountryCode?: string;\n disabled?: boolean;\n errorMessage?: React.ReactNode;\n icon?: IconName;\n invalid?: boolean;\n label?: string;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n placeholder?: string;\n variant?: 'default' | 'inline';\n type?:\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'number'\n | 'password'\n | 'radio'\n | 'search'\n | 'tel'\n | 'text';\n};\n\nexport function Input({\n className,\n defaultCountryCode = '+47',\n disabled = false,\n errorMessage,\n icon,\n invalid = false,\n label,\n onBlur: onBlurProp,\n placeholder,\n ref,\n required,\n style,\n type = 'text',\n variant = 'default',\n ...props\n}: InputProps) {\n const generatedErrorId = useId();\n const [countryCode, setCountryCode] = useState('');\n const [phoneNumber, setPhoneNumber] = useState('');\n const { name, onChange, pattern, value, ...restProps } = props;\n const { touched, onBlur } = useTouched(value === '');\n const inputIcon = icon && type !== 'radio' && type !== 'datetime-local' ? icon : undefined;\n const displayLabel = label && variant === 'inline' ? formatInlineLabel(label) : label;\n const errorId = invalid && errorMessage ? generatedErrorId : undefined;\n const describedBy = [props['aria-describedby'], errorId].filter(Boolean).join(' ') || undefined;\n\n type withVars =\n | (React.CSSProperties & {\n '--icon-svg'?: string;\n })\n | undefined;\n\n const withVars: withVars = inputIcon\n ? {\n ...style,\n '--icon-svg': iconSVG(inputIcon),\n }\n : style;\n const handleBlur = composeEventHandlers(onBlur, onBlurProp);\n\n useEffect(() => {\n if (onChange && type === 'tel') {\n const target = {\n name,\n value: phoneNumber\n ? (countryCode || defaultCountryCode).split(' ').join('') +\n phoneNumber.split(' ').join('')\n : undefined,\n } as unknown as HTMLInputElement;\n\n onChange({ target, currentTarget: target } as React.ChangeEvent<HTMLInputElement>);\n }\n }, [countryCode, defaultCountryCode, name, onChange, phoneNumber, type]);\n\n useEffect(() => {\n if (type === 'tel' && !value) {\n setPhoneNumber('');\n setCountryCode('');\n }\n }, [type, value]);\n\n const telephoneInput = (\n <>\n <input\n disabled={disabled}\n hidden\n onChange={onChange}\n pattern={undefined}\n placeholder={placeholder}\n ref={ref}\n type={type}\n value={value}\n />\n <input\n type='text'\n className={cx(styles.code, styles.input)}\n disabled={disabled}\n maxLength={5}\n onChange={(e) => setCountryCode(e.target.value)}\n placeholder={defaultCountryCode}\n value={countryCode}\n />\n <input\n {...restProps}\n aria-describedby={describedBy}\n aria-invalid={invalid ? true : props['aria-invalid']}\n type='tel'\n className={cx(styles.input, className, touched && styles.touched)}\n data-icon={inputIcon ? 'true' : undefined}\n disabled={disabled}\n maxLength={14}\n name={undefined}\n onChange={(e) => setPhoneNumber(e.target.value)}\n onBlur={handleBlur}\n pattern={pattern}\n required={required}\n style={withVars}\n value={phoneNumber}\n />\n </>\n );\n\n return (\n <div className={styles.field}>\n <label className={cx(styles.label, variant === 'inline' && styles.inline)}>\n {displayLabel && (\n <span data-required={required && variant !== 'inline' ? true : undefined}>\n {displayLabel}\n </span>\n )}\n {type === 'tel' ? (\n telephoneInput\n ) : (\n <input\n {...props}\n aria-describedby={describedBy}\n aria-invalid={invalid ? true : props['aria-invalid']}\n ref={ref}\n className={cx(styles.input, className, touched && styles.touched)}\n data-icon={inputIcon ? 'true' : undefined}\n disabled={disabled}\n onBlur={handleBlur}\n placeholder={placeholder}\n required={required}\n style={withVars}\n type={type}\n />\n )}\n </label>\n {errorId && (\n <span\n className={styles.error}\n id={errorId}\n role='alert'\n >\n {errorMessage}\n </span>\n )}\n </div>\n );\n}\n"],"names":["capitalizeFirstLetter","value","toLocaleUpperCase","slice","formatInlineLabel","label","endsWith","Input","className","defaultCountryCode","disabled","errorMessage","icon","invalid","onBlur","onBlurProp","placeholder","ref","required","style","type","variant","props","generatedErrorId","useId","countryCode","setCountryCode","useState","phoneNumber","setPhoneNumber","name","onChange","pattern","restProps","touched","useTouched","inputIcon","undefined","displayLabel","errorId","describedBy","filter","Boolean","join","withVars","iconSVG","handleBlur","composeEventHandlers","useEffect","target","split","currentTarget","telephoneInput","jsxs","Fragment","jsx","cx","styles","code","input","e","field","inline","error"],"mappings":";;;;;AAAO,SAASA,EAAsBC,GAAuB;AAC3D,SAAOA,KAAQ,GAAGA,EAAM,CAAC,EAAEC,mBAAmB,GAAGD,EAAME,MAAM,CAAC,CAAC;AACjE;AAEO,SAASC,EAAkBH,GAAuB;AACvD,QAAMI,IAAQL,EAAsBC,CAAK;AACzC,SAAOI,KAAS,CAACA,EAAMC,SAAS,GAAG,IAAI,GAAGD,CAAK,MAAMA;AACvD;;;;;;;;;;ACyBO,SAASE,GAAM;AAAA,EACpBC,WAAAA;AAAAA,EACAC,oBAAAA,IAAqB;AAAA,EACrBC,UAAAA,IAAW;AAAA,EACXC,cAAAA;AAAAA,EACAC,MAAAA;AAAAA,EACAC,SAAAA,IAAU;AAAA,EACVR,OAAAA;AAAAA,EACAS,QAAQC;AAAAA,EACRC,aAAAA;AAAAA,EACAC,KAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,MAAAA,IAAO;AAAA,EACPC,SAAAA,IAAU;AAAA,EACV,GAAGC;AACO,GAAG;AACb,QAAMC,IAAmBC,EAAAA,GACnB,CAACC,GAAaC,CAAc,IAAIC,EAAS,EAAE,GAC3C,CAACC,GAAaC,CAAc,IAAIF,EAAS,EAAE,GAC3C;AAAA,IAAEG,MAAAA;AAAAA,IAAMC,UAAAA;AAAAA,IAAUC,SAAAA;AAAAA,IAAS/B,OAAAA;AAAAA,IAAO,GAAGgC;AAAAA,EAAAA,IAAcX,GACnD;AAAA,IAAEY,SAAAA;AAAAA,IAASpB,QAAAA;AAAAA,EAAAA,IAAWqB,EAAWlC,MAAU,EAAE,GAC7CmC,IAAYxB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5B,UAAAA,EAAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./assets/index.css');const o=require("./components/app-link/index.cjs"),t=require("./components/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./assets/index.css');const o=require("./components/app-link/index.cjs"),t=require("./components/app-shell/index.cjs"),r=require("./components/aside/index.cjs"),i=require("./components/avatar/index.cjs"),s=require("./components/badge/index.cjs"),c=require("./components/banner/index.cjs"),p=require("./components/branding/index.cjs"),_=require("./components/button/index.cjs"),a=require("./components/card/index.cjs"),d=require("./components/checkbox/index.cjs"),u=require("./components/chip/index.cjs"),m=require("./components/collapsible/index.cjs"),l=require("./components/controls/index.cjs"),x=require("./components/croppable/index.cjs"),q=require("./components/dialog/index.cjs"),g=require("./components/divider/index.cjs"),b=require("./components/dropdown/index.cjs"),v=require("./components/dropzone/index.cjs"),h=require("./components/editor/index.cjs"),S=require("./components/empty-state/index.cjs"),T=require("./components/fieldset/index.cjs"),L=require("./components/figure/index.cjs"),C=require("./components/file/index.cjs"),I=require("./components/footer/index.cjs"),F=require("./components/form/index.cjs"),f=require("./components/graph/index.cjs"),k=require("./components/group/index.cjs"),y=require("./components/header/index.cjs"),A=require("./components/icon/index.cjs"),B=require("./components/iframe/index.cjs"),D=require("./components/image/index.cjs"),M=require("./index-CQlMdqOp.cjs"),P=require("./components/link/index.cjs"),N=require("./components/list/index.cjs"),O=require("./components/loading/index.cjs"),j=require("./components/menu/index.cjs"),w=require("./components/message/index.cjs"),E=require("./components/messages/index.cjs"),e=require("./components/nav/index.cjs"),G=require("./components/object/index.cjs"),z=require("./components/page-layout/index.cjs"),H=require("./components/popover/index.cjs"),W=require("./components/portal/index.cjs"),J=require("./components/search/index.cjs"),K=require("./index-Bt7vnwji.cjs"),n=require("./components/sortable/index.cjs"),Q=require("./components/table/index.cjs"),R=require("./components/textarea/index.cjs"),U=require("./components/toast/index.cjs"),V=require("./components/toasts/index.cjs"),X=require("./components/toggle/index.cjs"),Y=require("./components/toolbar/index.cjs"),Z=require("./components/tooltip/index.cjs"),$=require("./components/widget/index.cjs");exports.AppLink=o.AppLink;exports.AppShell=t.AppShell;exports.Aside=r.Aside;exports.Avatar=i.Avatar;exports.Badge=s.Badge;exports.Banner=c.Banner;exports.Branding=p.Branding;exports.Button=_.Button;exports.Card=a.Card;exports.Checkbox=d.Checkbox;exports.Chip=u.Chip;exports.Collapsible=m.Collapsible;exports.Controls=l.Controls;exports.Croppable=x.Croppable;exports.Dialog=q.Dialog;exports.Divider=g.Divider;exports.Dropdown=b.Dropdown;exports.Dropzone=v.Dropzone;exports.Editor=h.Editor;exports.EmptyState=S.EmptyState;exports.Fieldset=T.Fieldset;exports.Figure=L.Figure;exports.File=C.File;exports.Footer=I.Footer;exports.Form=F.Form;exports.Graph=f.Graph;exports.Group=k.Group;exports.Header=y.Header;exports.Icon=A.Icon;exports.Iframe=B.Iframe;exports.Image=D.Image;exports.Input=M.Input;exports.Link=P.Link;exports.List=N.List;exports.Loading=O.Loading;exports.Menu=j.Menu;exports.Message=w.Message;exports.Messages=E.Messages;exports.Nav=e.Nav;exports.NavItem=e.NavItem;exports.NavLabel=e.NavLabel;exports.Object=G.Object;exports.PageLayout=z.PageLayout;exports.Popover=H.Popover;exports.Portal=W.Portal;exports.Search=J.Search;exports.Select=K.Select;exports.Sortable=n.Sortable;exports.useOptionalSortableItem=n.useOptionalSortableItem;exports.Table=Q.Table;exports.Textarea=R.Textarea;exports.Toast=U.Toast;exports.Toasts=V.Toasts;exports.Toggle=X.Toggle;exports.Toolbar=Y.Toolbar;exports.Tooltip=Z.Tooltip;exports.Widget=$.Widget;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,12 @@ declare type AppLinkProps = {
|
|
|
12
12
|
type: 'apple' | 'google';
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
export declare const AppShell: ({ children, className, navigation, ...props }: AppShellProps) => JSX.Element;
|
|
16
|
+
|
|
17
|
+
export declare type AppShellProps = React.ComponentPropsWithoutRef<'div'> & {
|
|
18
|
+
navigation?: React.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
|
|
15
21
|
export declare const Aside: ({ children, className, sticky, variant }: AsideProps) => JSX.Element;
|
|
16
22
|
|
|
17
23
|
declare type AsideProps = {
|
|
@@ -189,6 +195,10 @@ declare type DialogProps = default_2.DialogHTMLAttributes<HTMLDialogElement> & {
|
|
|
189
195
|
setOpen?: default_2.Dispatch<default_2.SetStateAction<boolean>>;
|
|
190
196
|
};
|
|
191
197
|
|
|
198
|
+
export declare const Divider: ({ className, ...props }: DividerProps) => JSX.Element;
|
|
199
|
+
|
|
200
|
+
export declare type DividerProps = React.ComponentPropsWithoutRef<'hr'>;
|
|
201
|
+
|
|
192
202
|
export declare const Dropdown: ({ children: selectElement, className, combobox, createOption, emptyLabel, label, renderOption, searchPlaceholder, selectedItems, variant, ...props }: DropdownProps) => JSX.Element;
|
|
193
203
|
|
|
194
204
|
export declare type DropdownCreateOption = {
|
|
@@ -575,12 +585,14 @@ declare type ImageProps = ImgHTMLAttributes<HTMLImageElement> & {
|
|
|
575
585
|
showOnError?: boolean;
|
|
576
586
|
};
|
|
577
587
|
|
|
578
|
-
export declare function Input({ className, defaultCountryCode, disabled, icon, label, onBlur: onBlurProp, placeholder, ref, required, style, type, variant, ...props }: InputProps): JSX.Element;
|
|
588
|
+
export declare function Input({ className, defaultCountryCode, disabled, errorMessage, icon, invalid, label, onBlur: onBlurProp, placeholder, ref, required, style, type, variant, ...props }: InputProps): JSX.Element;
|
|
579
589
|
|
|
580
|
-
declare type InputProps = React.ComponentPropsWithRef<'input'> & {
|
|
590
|
+
export declare type InputProps = React.ComponentPropsWithRef<'input'> & {
|
|
581
591
|
defaultCountryCode?: string;
|
|
582
592
|
disabled?: boolean;
|
|
593
|
+
errorMessage?: React.ReactNode;
|
|
583
594
|
icon?: IconName;
|
|
595
|
+
invalid?: boolean;
|
|
584
596
|
label?: string;
|
|
585
597
|
onClick?: React.MouseEventHandler<HTMLInputElement>;
|
|
586
598
|
placeholder?: string;
|
|
@@ -703,6 +715,13 @@ declare type NativeSelectProps = Omit<default_2.ComponentPropsWithoutRef<'select
|
|
|
703
715
|
|
|
704
716
|
export declare const Nav: ({ animation, children, className, horizontal, variant, ...props }: NavProps) => JSX.Element;
|
|
705
717
|
|
|
718
|
+
export declare const NavItem: ({ actions, children, className, highlighted, ...props }: NavItemProps) => JSX.Element;
|
|
719
|
+
|
|
720
|
+
export declare type NavItemProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
721
|
+
actions?: React.ReactNode;
|
|
722
|
+
highlighted?: boolean;
|
|
723
|
+
};
|
|
724
|
+
|
|
706
725
|
export declare const NavLabel: ({ className, ...props }: NavLabelProps) => JSX.Element;
|
|
707
726
|
|
|
708
727
|
export declare type NavLabelProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
@@ -723,6 +742,14 @@ declare type ObjectProps = Omit<ComponentPropsWithoutRef<'object'>, 'data' | 'ty
|
|
|
723
742
|
url: string;
|
|
724
743
|
};
|
|
725
744
|
|
|
745
|
+
export declare const PageLayout: ({ "aria-busy": ariaBusy, children, className, fillViewport, loading, sidebar, ...props }: PageLayoutProps) => JSX.Element;
|
|
746
|
+
|
|
747
|
+
export declare type PageLayoutProps = React.ComponentPropsWithoutRef<'main'> & {
|
|
748
|
+
fillViewport?: boolean;
|
|
749
|
+
loading?: boolean;
|
|
750
|
+
sidebar?: React.ReactNode;
|
|
751
|
+
};
|
|
752
|
+
|
|
726
753
|
export declare type PendingInlineImage = {
|
|
727
754
|
file: File;
|
|
728
755
|
slot: string;
|