@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
package/dist/index.js
CHANGED
|
@@ -1,107 +1,114 @@
|
|
|
1
1
|
import { AppLink as e } from "./components/app-link/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
2
|
+
import { AppShell as p } from "./components/app-shell/index.js";
|
|
3
|
+
import { Aside as x } from "./components/aside/index.js";
|
|
4
|
+
import { Avatar as a } from "./components/avatar/index.js";
|
|
5
|
+
import { Badge as i } from "./components/badge/index.js";
|
|
6
|
+
import { Banner as n } from "./components/banner/index.js";
|
|
7
|
+
import { Branding as d } from "./components/branding/index.js";
|
|
8
|
+
import { Button as u } from "./components/button/index.js";
|
|
9
|
+
import { Card as S } from "./components/card/index.js";
|
|
10
|
+
import { Checkbox as v } from "./components/checkbox/index.js";
|
|
11
|
+
import { Chip as L } from "./components/chip/index.js";
|
|
12
|
+
import { Collapsible as h } from "./components/collapsible/index.js";
|
|
13
|
+
import { Controls as A } from "./components/controls/index.js";
|
|
14
|
+
import { Croppable as D } from "./components/croppable/index.js";
|
|
15
|
+
import { Dialog as M } from "./components/dialog/index.js";
|
|
16
|
+
import { Divider as P } from "./components/divider/index.js";
|
|
17
|
+
import { Dropdown as E } from "./components/dropdown/index.js";
|
|
18
|
+
import { Dropzone as O } from "./components/dropzone/index.js";
|
|
19
|
+
import { Editor as w } from "./components/editor/index.js";
|
|
20
|
+
import { EmptyState as H } from "./components/empty-state/index.js";
|
|
21
|
+
import { Fieldset as q } from "./components/fieldset/index.js";
|
|
22
|
+
import { Figure as K } from "./components/figure/index.js";
|
|
23
|
+
import { File as R } from "./components/file/index.js";
|
|
24
|
+
import { Footer as V } from "./components/footer/index.js";
|
|
25
|
+
import { Form as Y } from "./components/form/index.js";
|
|
26
|
+
import { Graph as _ } from "./components/graph/index.js";
|
|
27
|
+
import { Group as oo } from "./components/group/index.js";
|
|
28
|
+
import { Header as eo } from "./components/header/index.js";
|
|
29
|
+
import { Icon as po } from "./components/icon/index.js";
|
|
30
|
+
import { Iframe as xo } from "./components/iframe/index.js";
|
|
31
|
+
import { Image as ao } from "./components/image/index.js";
|
|
32
|
+
import { I as io } from "./index-CbJ2-IPc.js";
|
|
33
|
+
import { Link as no } from "./components/link/index.js";
|
|
34
|
+
import { List as bo } from "./components/list/index.js";
|
|
35
|
+
import { Loading as Io } from "./components/loading/index.js";
|
|
36
|
+
import { Menu as To } from "./components/menu/index.js";
|
|
37
|
+
import { Message as Co } from "./components/message/index.js";
|
|
38
|
+
import { Messages as co } from "./components/messages/index.js";
|
|
39
|
+
import { Nav as Fo, NavItem as Ao, NavLabel as Bo } from "./components/nav/index.js";
|
|
40
|
+
import { Object as ko } from "./components/object/index.js";
|
|
41
|
+
import { PageLayout as No } from "./components/page-layout/index.js";
|
|
42
|
+
import { Popover as yo } from "./components/popover/index.js";
|
|
43
|
+
import { Portal as Go } from "./components/portal/index.js";
|
|
44
|
+
import { Search as jo } from "./components/search/index.js";
|
|
45
|
+
import { S as zo } from "./index-BLb3JiCr.js";
|
|
46
|
+
import { Sortable as Wo, useOptionalSortableItem as qo } from "./components/sortable/index.js";
|
|
47
|
+
import { Table as Ko } from "./components/table/index.js";
|
|
48
|
+
import { Textarea as Ro } from "./components/textarea/index.js";
|
|
49
|
+
import { Toast as Vo } from "./components/toast/index.js";
|
|
50
|
+
import { Toasts as Yo } from "./components/toasts/index.js";
|
|
51
|
+
import { Toggle as _o } from "./components/toggle/index.js";
|
|
52
|
+
import { Toolbar as or } from "./components/toolbar/index.js";
|
|
53
|
+
import { Tooltip as er } from "./components/tooltip/index.js";
|
|
54
|
+
import { Widget as pr } from "./components/widget/index.js";
|
|
52
55
|
import './assets/index.css';export {
|
|
53
56
|
e as AppLink,
|
|
54
|
-
p as
|
|
55
|
-
x as
|
|
56
|
-
a as
|
|
57
|
-
i as
|
|
58
|
-
n as
|
|
59
|
-
d as
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
h as
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
M as
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
H as
|
|
73
|
-
q as
|
|
74
|
-
K as
|
|
75
|
-
R as
|
|
76
|
-
V as
|
|
77
|
-
Y as
|
|
78
|
-
_ as
|
|
79
|
-
oo as
|
|
80
|
-
eo as
|
|
81
|
-
po as
|
|
82
|
-
xo as
|
|
83
|
-
ao as
|
|
84
|
-
io as
|
|
85
|
-
no as
|
|
86
|
-
bo as
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
57
|
+
p as AppShell,
|
|
58
|
+
x as Aside,
|
|
59
|
+
a as Avatar,
|
|
60
|
+
i as Badge,
|
|
61
|
+
n as Banner,
|
|
62
|
+
d as Branding,
|
|
63
|
+
u as Button,
|
|
64
|
+
S as Card,
|
|
65
|
+
v as Checkbox,
|
|
66
|
+
L as Chip,
|
|
67
|
+
h as Collapsible,
|
|
68
|
+
A as Controls,
|
|
69
|
+
D as Croppable,
|
|
70
|
+
M as Dialog,
|
|
71
|
+
P as Divider,
|
|
72
|
+
E as Dropdown,
|
|
73
|
+
O as Dropzone,
|
|
74
|
+
w as Editor,
|
|
75
|
+
H as EmptyState,
|
|
76
|
+
q as Fieldset,
|
|
77
|
+
K as Figure,
|
|
78
|
+
R as File,
|
|
79
|
+
V as Footer,
|
|
80
|
+
Y as Form,
|
|
81
|
+
_ as Graph,
|
|
82
|
+
oo as Group,
|
|
83
|
+
eo as Header,
|
|
84
|
+
po as Icon,
|
|
85
|
+
xo as Iframe,
|
|
86
|
+
ao as Image,
|
|
87
|
+
io as Input,
|
|
88
|
+
no as Link,
|
|
89
|
+
bo as List,
|
|
90
|
+
Io as Loading,
|
|
91
|
+
To as Menu,
|
|
92
|
+
Co as Message,
|
|
93
|
+
co as Messages,
|
|
94
|
+
Fo as Nav,
|
|
95
|
+
Ao as NavItem,
|
|
96
|
+
Bo as NavLabel,
|
|
97
|
+
ko as Object,
|
|
98
|
+
No as PageLayout,
|
|
99
|
+
yo as Popover,
|
|
100
|
+
Go as Portal,
|
|
101
|
+
jo as Search,
|
|
102
|
+
zo as Select,
|
|
103
|
+
Wo as Sortable,
|
|
104
|
+
Ko as Table,
|
|
105
|
+
Ro as Textarea,
|
|
106
|
+
Vo as Toast,
|
|
107
|
+
Yo as Toasts,
|
|
108
|
+
_o as Toggle,
|
|
109
|
+
or as Toolbar,
|
|
110
|
+
er as Tooltip,
|
|
111
|
+
pr as Widget,
|
|
112
|
+
qo as useOptionalSortableItem
|
|
106
113
|
};
|
|
107
114
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/tokens.json
CHANGED
package/package.json
CHANGED
package/dist/index-5yOssOic.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";require('./assets/index45.css');const o=require("react/jsx-runtime"),d=require("./classix-5H4IWnMA.cjs"),p=require("react"),V=require("./icons-Dv_p0bUF.cjs"),E=require("./use-touched-Bq5Gjbpz.cjs");function w(t){return t&&`${t[0].toLocaleUpperCase()}${t.slice(1)}`}function S(t){const n=w(t);return n&&!n.endsWith(":")?`${n}:`:n}const G="_input_p0mz8_3",H="_touched_p0mz8_43",U="_label_p0mz8_48",W="_inline_p0mz8_69",k="_code_p0mz8_86",s={input:G,touched:H,label:U,inline:W,code:k};function A({className:t,defaultCountryCode:n="+47",disabled:c=!1,icon:g,label:h,onBlur:T,placeholder:f,ref:j,required:m,style:v,type:e="text",variant:_="default",...L}){const[x,b]=p.useState(""),[u,z]=p.useState(""),{name:I,onChange:a,pattern:$,value:l,...F}=L,{touched:B,onBlur:P}=E.useTouched(l===""),r=g&&e!=="radio"&&e!=="datetime-local"?g:void 0,N=h&&_==="inline"?S(h):h,q=r?{...v,"--icon-svg":V.iconSVG(r)}:v,C=E.composeEventHandlers(P,T);p.useEffect(()=>{if(a&&e==="tel"){const i={name:I,value:u?(x||n).split(" ").join("")+u.split(" ").join(""):void 0};a({target:i,currentTarget:i})}},[x,n,I,a,u,e]),p.useEffect(()=>{e==="tel"&&!l&&(z(""),b(""))},[e,l]);const R=o.jsxs(o.Fragment,{children:[o.jsx("input",{disabled:c,hidden:!0,onChange:a,pattern:void 0,placeholder:f,ref:j,type:e,value:l}),o.jsx("input",{type:"text",className:d.t(s.code,s.input),disabled:c,maxLength:5,onChange:i=>b(i.target.value),placeholder:n,value:x}),o.jsx("input",{...F,type:"tel",className:d.t(s.input,t,B&&s.touched),"data-icon":r?"true":void 0,disabled:c,maxLength:14,name:void 0,onChange:i=>z(i.target.value),onBlur:C,pattern:$,required:m,style:q,value:u})]});return o.jsxs("label",{className:d.t(s.label,_==="inline"&&s.inline),"data-component":"input",children:[N&&o.jsx("span",{"data-required":m&&_!=="inline"?!0:void 0,children:N}),e==="tel"?R:o.jsx("input",{...L,ref:j,className:d.t(s.input,t,B&&s.touched),"data-icon":r?"true":void 0,disabled:c,onBlur:C,placeholder:f,required:m,style:q,type:e})]})}exports.Input=A;exports.formatInlineLabel=S;
|
|
2
|
-
//# sourceMappingURL=index-5yOssOic.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-5yOssOic.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, 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 icon?: IconName;\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 icon,\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 [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\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 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 <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 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 );\n}\n"],"names":["capitalizeFirstLetter","value","toLocaleUpperCase","slice","formatInlineLabel","label","endsWith","Input","className","defaultCountryCode","disabled","icon","onBlur","onBlurProp","placeholder","ref","required","style","type","variant","props","countryCode","setCountryCode","useState","phoneNumber","setPhoneNumber","name","onChange","pattern","restProps","touched","useTouched","inputIcon","undefined","displayLabel","withVars","iconSVG","handleBlur","composeEventHandlers","useEffect","target","split","join","currentTarget","telephoneInput","jsxs","Fragment","jsx","cx","styles","code","input","e","inline"],"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,CAACA,EAAMC,SAAS,GAAG,EAAI,GAAGD,CAAK,IAAMA,CACvD,0JCuBO,SAASE,EAAM,CACpBC,UAAAA,EACAC,mBAAAA,EAAqB,MACrBC,SAAAA,EAAW,GACXC,KAAAA,EACAN,MAAAA,EACAO,OAAQC,EACRC,YAAAA,EACAC,IAAAA,EACAC,SAAAA,EACAC,MAAAA,EACAC,KAAAA,EAAO,OACPC,QAAAA,EAAU,UACV,GAAGC,CACO,EAAG,CACb,KAAM,CAACC,EAAaC,CAAc,EAAIC,EAAAA,SAAS,EAAE,EAC3C,CAACC,EAAaC,CAAc,EAAIF,EAAAA,SAAS,EAAE,EAC3C,CAAEG,KAAAA,EAAMC,SAAAA,EAAUC,QAAAA,EAAS3B,MAAAA,EAAO,GAAG4B,CAAAA,EAAcT,EACnD,CAAEU,QAAAA,EAASlB,OAAAA,CAAAA,EAAWmB,EAAAA,WAAW9B,IAAU,EAAE,EAC7C+B,EAAYrB,GAAQO,IAAS,SAAWA,IAAS,iBAAmBP,EAAOsB,OAC3EC,EAAe7B,GAASc,IAAY,SAAWf,EAAkBC,CAAK,EAAIA,EAQ1E8B,EAAqBH,EACvB,CACE,GAAGf,EACH,aAAcmB,EAAAA,QAAQJ,CAAS,CAAA,EAEjCf,EACEoB,EAAaC,EAAAA,qBAAqB1B,EAAQC,CAAU,EAE1D0B,EAAAA,UAAU,IAAM,CACd,GAAIZ,GAAYT,IAAS,MAAO,CAC9B,MAAMsB,EAAS,CACbd,KAAAA,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E,iBAAA,QACvEnB,SAAAA,CAAAA,GACCa,EAAAA,IAAC,QAAK,gBAAe/B,GAAYG,IAAY,SAAW,GAAOc,OAC5DC,SAAAA,CAAAA,CACH,EAEDhB,IAAS,MACR0B,EAEAG,EAAAA,IAAC,QAAA,CACC,GAAI3B,EACJ,IAAAL,EACA,UAAWiC,EAAAA,EAAGC,EAAOE,MAAO3C,EAAWsB,GAAWmB,EAAOnB,OAAO,EAChE,YAAWE,EAAY,OAASC,OAChC,SAAAvB,EACA,OAAQ2B,EACR,YAAAvB,EACA,SAAAE,EACA,MAAOmB,EACP,KAAAjB,CAAA,CAAW,CAAA,EAGjB,CAEJ"}
|
package/dist/index-Cv6TtBnd.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { jsxs as $, Fragment as G, jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import { t as p } from "./classix-DG18itHa.js";
|
|
3
|
-
import { useState as E, useEffect as F } from "react";
|
|
4
|
-
import { i as H } from "./icons-dUP7sKyt.js";
|
|
5
|
-
import { u as U, c as W } from "./use-touched-B999bBr8.js";
|
|
6
|
-
import './assets/index45.css';function k(t) {
|
|
7
|
-
return t && `${t[0].toLocaleUpperCase()}${t.slice(1)}`;
|
|
8
|
-
}
|
|
9
|
-
function A(t) {
|
|
10
|
-
const e = k(t);
|
|
11
|
-
return e && !e.endsWith(":") ? `${e}:` : e;
|
|
12
|
-
}
|
|
13
|
-
const D = "_input_p0mz8_3", J = "_touched_p0mz8_43", K = "_label_p0mz8_48", M = "_inline_p0mz8_69", O = "_code_p0mz8_86", o = {
|
|
14
|
-
input: D,
|
|
15
|
-
touched: J,
|
|
16
|
-
label: K,
|
|
17
|
-
inline: M,
|
|
18
|
-
code: O
|
|
19
|
-
};
|
|
20
|
-
function q({
|
|
21
|
-
className: t,
|
|
22
|
-
defaultCountryCode: e = "+47",
|
|
23
|
-
disabled: s = !1,
|
|
24
|
-
icon: f,
|
|
25
|
-
label: m,
|
|
26
|
-
onBlur: P,
|
|
27
|
-
placeholder: g,
|
|
28
|
-
ref: v,
|
|
29
|
-
required: d,
|
|
30
|
-
style: x,
|
|
31
|
-
type: n = "text",
|
|
32
|
-
variant: h = "default",
|
|
33
|
-
...z
|
|
34
|
-
}) {
|
|
35
|
-
const [_, L] = E(""), [a, b] = E(""), {
|
|
36
|
-
name: B,
|
|
37
|
-
onChange: l,
|
|
38
|
-
pattern: S,
|
|
39
|
-
value: u,
|
|
40
|
-
...T
|
|
41
|
-
} = z, {
|
|
42
|
-
touched: I,
|
|
43
|
-
onBlur: V
|
|
44
|
-
} = U(u === ""), r = f && n !== "radio" && n !== "datetime-local" ? f : void 0, N = m && h === "inline" ? A(m) : m, j = r ? {
|
|
45
|
-
...x,
|
|
46
|
-
"--icon-svg": H(r)
|
|
47
|
-
} : x, C = W(V, P);
|
|
48
|
-
F(() => {
|
|
49
|
-
if (l && n === "tel") {
|
|
50
|
-
const i = {
|
|
51
|
-
name: B,
|
|
52
|
-
value: a ? (_ || e).split(" ").join("") + a.split(" ").join("") : void 0
|
|
53
|
-
};
|
|
54
|
-
l({
|
|
55
|
-
target: i,
|
|
56
|
-
currentTarget: i
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}, [_, e, B, l, a, n]), F(() => {
|
|
60
|
-
n === "tel" && !u && (b(""), L(""));
|
|
61
|
-
}, [n, u]);
|
|
62
|
-
const w = /* @__PURE__ */ $(G, { children: [
|
|
63
|
-
/* @__PURE__ */ c("input", { disabled: s, hidden: !0, onChange: l, pattern: void 0, placeholder: g, ref: v, type: n, value: u }),
|
|
64
|
-
/* @__PURE__ */ c("input", { type: "text", className: p(o.code, o.input), disabled: s, maxLength: 5, onChange: (i) => L(i.target.value), placeholder: e, value: _ }),
|
|
65
|
-
/* @__PURE__ */ c("input", { ...T, type: "tel", className: p(o.input, t, I && o.touched), "data-icon": r ? "true" : void 0, disabled: s, maxLength: 14, name: void 0, onChange: (i) => b(i.target.value), onBlur: C, pattern: S, required: d, style: j, value: a })
|
|
66
|
-
] });
|
|
67
|
-
return /* @__PURE__ */ $("label", { className: p(o.label, h === "inline" && o.inline), "data-component": "input", children: [
|
|
68
|
-
N && /* @__PURE__ */ c("span", { "data-required": d && h !== "inline" ? !0 : void 0, children: N }),
|
|
69
|
-
n === "tel" ? w : /* @__PURE__ */ c("input", { ...z, ref: v, className: p(o.input, t, I && o.touched), "data-icon": r ? "true" : void 0, disabled: s, onBlur: C, placeholder: g, required: d, style: j, type: n })
|
|
70
|
-
] });
|
|
71
|
-
}
|
|
72
|
-
export {
|
|
73
|
-
q as I,
|
|
74
|
-
A as f
|
|
75
|
-
};
|
|
76
|
-
//# sourceMappingURL=index-Cv6TtBnd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-Cv6TtBnd.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, 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 icon?: IconName;\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 icon,\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 [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\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 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 <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 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 );\n}\n"],"names":["capitalizeFirstLetter","value","toLocaleUpperCase","slice","formatInlineLabel","label","endsWith","Input","className","defaultCountryCode","disabled","icon","onBlur","onBlurProp","placeholder","ref","required","style","type","variant","props","countryCode","setCountryCode","useState","phoneNumber","setPhoneNumber","name","onChange","pattern","restProps","touched","useTouched","inputIcon","undefined","displayLabel","withVars","iconSVG","handleBlur","composeEventHandlers","useEffect","target","split","join","currentTarget","telephoneInput","jsxs","Fragment","jsx","cx","styles","code","input","e","inline"],"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;;;;;;;;ACuBO,SAASE,EAAM;AAAA,EACpBC,WAAAA;AAAAA,EACAC,oBAAAA,IAAqB;AAAA,EACrBC,UAAAA,IAAW;AAAA,EACXC,MAAAA;AAAAA,EACAN,OAAAA;AAAAA,EACAO,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,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAAS,EAAE,GAC3C,CAACC,GAAaC,CAAc,IAAIF,EAAS,EAA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