@smartyweb/ui 2.2.0-max-ci-versioning.g3837ac7 → 2.2.0-max-no-comments.ged46dbb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/buttons/Link/Link.d.ts +0 -1
- package/dist/forms/MultitagField/Chip.d.ts +0 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +116 -118
- package/dist/internal/devWarnings.d.ts +2 -0
- package/dist/navigation/SideNav/SideNavContext.d.ts +0 -4
- package/dist/navigation/SideNav/devWarnings.d.ts +0 -6
- package/dist/text/UnorderedList/UnorderedListContext.d.ts +0 -1
- package/dist/text/UnorderedList/devWarnings.d.ts +0 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ If a variable is not set, components fall back to `system-ui` (headings/body) or
|
|
|
63
63
|
| -------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
64
64
|
| `/new-component` | Build or align a component from its live Figma node — bindings, fidelity table, gates, measured report. |
|
|
65
65
|
| `/validate-tokens` | Check the library still mirrors Figma — recapture every component's bindings, run the mirror, repair. |
|
|
66
|
-
| `/
|
|
66
|
+
| `/version-up` | Cut a new version with changesets (bump, changelog, release prep). |
|
|
67
67
|
| `/commit-push` | Commit and push all changes with a summary commit message. |
|
|
68
68
|
| `/use-in-storefront` | Carry a component into a storefront-2 page — install, place, gates, preview. |
|
|
69
69
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
interface ChipProps {
|
|
2
2
|
children: string;
|
|
3
3
|
invalid: boolean;
|
|
4
|
-
/** Undefined, the chip has no remove button — Figma's disabled chip. */
|
|
5
4
|
onRemove: (() => void) | undefined;
|
|
6
5
|
}
|
|
7
6
|
export declare function Chip({ children, invalid, onRemove }: ChipProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("react"),E="_h1_1765w_1",
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("react"),E="_h1_1765w_1",F={h1:E};function I({children:e,className:n}){const s=[F.h1,n].filter(Boolean).join(" ");return t.jsx("h1",{className:s,children:e})}const R="_h2_1eque_1",T={h2:R};function W({children:e}){return t.jsx("h2",{className:T.h2,children:e})}const U="_paragraph_11t85_1",P={paragraph:U};function K({children:e}){return t.jsx("p",{className:P.paragraph,children:e})}const L=typeof process<"u"&&process.env.NODE_ENV!=="production",w=new Set;function x(e){w.has(e)||(w.add(e),console.warn(`[@smartyweb/ui] ${e}`))}function G(e){if(typeof e=="string")return`<${e}>`;if(typeof e=="function")return`<${e.name||"Component"}>`;if(typeof e=="object"&&e!==null&&"displayName"in e){const{displayName:n}=e;if(typeof n=="string")return`<${n}>`}return"an unknown element"}function k(e,n){for(const s of l.Children.toArray(e)){if(!l.isValidElement(s)){if(typeof s!="string"&&typeof s!="number")continue;const r=String(s).trim();if(r==="")continue;x(`<UnorderedList> received the text ${JSON.stringify(r.slice(0,40))} as a direct child. A <ul> may only contain list items — wrap it in <ListItem>.`);continue}if(s.type===l.Fragment){const{children:r}=s.props;k(r,n);continue}n(s.type)||s.type==="li"||x(`<UnorderedList> received ${G(s.type)} as a direct child. A <ul> may only contain list items — wrap it in <ListItem>. If that component renders a <ListItem> itself, set its static \`isSmartyListItem = true\`.`)}}function V(){x("<ListItem> was rendered outside of an <UnorderedList>. It renders an <li>, which browsers only style correctly inside a list.")}const J="_list_1p627_1",X="_item_1p627_14",z={list:J,item:X},S=l.createContext(!1);function b({children:e}){const n=l.useContext(S);return L&&!n&&V(),t.jsx("li",{className:z.item,children:e})}b.isSmartyListItem=!0;function Z(e){return e===b?!0:typeof e=="function"&&e.isSmartyListItem===!0}function Q({children:e}){return L&&k(e,Z),t.jsx(S,{value:!0,children:t.jsx("ul",{role:"list",className:z.list,children:e})})}const Y="_button_81qo0_1",ee="_sm_81qo0_26",te="_primary_81qo0_33",ne="_secondary_81qo0_49",se="_negative_81qo0_68",j={button:Y,sm:ee,primary:te,secondary:ne,negative:se};function ie({as:e="button",variant:n="primary",size:s="default",href:r,openInNewTab:d,disabled:m,type:a,onClick:c,children:u}){const p=[j.button,j[n],s==="sm"&&j.sm].filter(Boolean).join(" ");return t.jsx(e,{className:p,href:r,target:d?"_blank":void 0,rel:d?"noopener noreferrer":void 0,disabled:m,type:a,onClick:c,children:u})}function re(){x("<SideNav> was rendered with no accessible name. Pass `label` so screen reader users can tell this nav apart from the other navigation landmarks on the page.")}const oe="_nav_dxkjl_3",ae="_list_dxkjl_7",ce="_item_dxkjl_16",le="_link_dxkjl_20",de="_current_dxkjl_48",g={nav:oe,list:ae,item:ce,link:le,current:de},C=l.createContext(null);function ue({label:e,current:n,children:s}){return L&&!e?.trim()&&re(),t.jsx("nav",{className:g.nav,"aria-label":e,children:t.jsx(C,{value:n??null,children:t.jsx("ul",{className:g.list,children:s})})})}function _e({as:e="a",href:n,current:s,openInNewTab:r,onClick:d,children:m}){const a=l.useContext(C),c=s??(a!==null&&a===n),u=[g.link,c&&g.current].filter(Boolean).join(" ");return t.jsx("li",{className:g.item,children:t.jsx(e,{className:u,href:n,target:r?"_blank":void 0,rel:r?"noopener noreferrer":void 0,onClick:d,"aria-current":c?"location":void 0,children:m})})}const me="_hero_93692_11",pe="_layout_93692_16",fe="_content_93692_21",he="_titleLine_93692_25",ge="_titleWord_93692_29",xe="_description_93692_35",ye="_media_93692_48",h={hero:me,layout:pe,content:fe,titleLine:he,titleWord:ge,description:xe,media:ye},ve=" ";function je(e){return e.replace(/([- ])/g,n=>`${n===" "?ve:n}|split|`).split("|split|")}const Ne=e=>({"--hero-index":e});function Le({title:e,description:n,media:s}){const r=Array.isArray(e);let d=0;const m=(r?e:[e]).map(a=>je(a).map(c=>({word:c,index:d++})));return t.jsx("section",{className:h.hero,children:t.jsxs("div",{className:h.layout,children:[t.jsx("div",{className:h.media,children:s}),t.jsxs("div",{className:h.content,children:[t.jsx(I,{children:m.map((a,c)=>t.jsx("span",{className:r?h.titleLine:void 0,children:a.map(({word:u,index:_})=>t.jsx("span",{className:h.titleWord,style:Ne(_),children:u},_))},c))}),t.jsx("p",{className:h.description,children:n})]})]})})}function be(){return t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.58586 8L1.29297 2.70711L2.70718 1.29289L8.00008 6.58579L13.293 1.29289L14.7072 2.70711L9.41429 8L14.7072 13.2929L13.293 14.7071L8.00008 9.41421L2.70718 14.7071L1.29297 13.2929L6.58586 8Z",fill:"currentColor"})})}const $e="_field_7z5g3_1",we="_error_7z5g3_17",Ie="_message_7z5g3_21",ke="_content_7z5g3_36",ze="_reveal_7z5g3_43",Se="_label_7z5g3_53",Ce="_tags_7z5g3_64",Be="_input_7z5g3_71",Oe="_counter_7z5g3_88",Ae="_empty_7z5g3_100",Me="_disabled_7z5g3_127",qe="_chip_7z5g3_132",De="_chipText_7z5g3_153",He="_remove_7z5g3_158",Ee="_invalid_7z5g3_169",o={field:$e,error:we,message:Ie,content:ke,reveal:ze,label:Se,tags:Ce,input:Be,counter:Oe,empty:Ae,disabled:Me,chip:qe,chipText:De,remove:He,invalid:Ee};function Fe({children:e,invalid:n,onRemove:s}){return t.jsxs("span",{className:[o.chip,n&&o.invalid].filter(Boolean).join(" "),children:[t.jsx("span",{className:o.chipText,children:e}),s&&t.jsx("button",{type:"button",className:o.remove,"aria-label":`Remove ${e}${n?" (invalid)":""}`,onClick:s,children:t.jsx(be,{})})]})}const N=100;function Re({label:e,value:n,onChange:s,disabled:r=!1,isTagInvalid:d,onInputChange:m,error:a}){const c=l.useId(),u=`${c}-message`,_=l.useRef(null),[p,B]=l.useState(""),O=n.length>=N,A=i=>{B(i),m?.(i)},y=i=>{const f=i.split(/[\s,]+/),v=f.pop()??"",$=f.filter(Boolean).slice(0,Math.max(0,N-n.length));$.length&&s([...n,...$]),A(v)},M=i=>{i.key==="Enter"&&p&&!i.nativeEvent.isComposing?(i.preventDefault(),y(`${p},`)):i.key==="Backspace"&&!p&&n.length&&s(n.slice(0,-1))},q=i=>{r||i.target===_.current||i.target.closest("button")||(i.preventDefault(),_.current?.focus())},D=i=>{s(n.filter((f,v)=>v!==i)),i===n.length-1&&_.current?.focus()},H=[o.field,!n.length&&o.empty,r&&o.disabled,a&&o.error].filter(Boolean).join(" ");return t.jsxs("div",{children:[t.jsxs("div",{className:H,onMouseDown:q,children:[t.jsxs("div",{className:o.content,children:[t.jsx("label",{htmlFor:c,className:o.label,children:e}),t.jsx("div",{className:o.reveal,children:t.jsxs("div",{className:o.tags,children:[n.map((i,f)=>t.jsx(Fe,{invalid:d?.(i,f)??!1,onRemove:r?void 0:()=>{D(f)},children:i},f)),t.jsx("input",{ref:_,id:c,className:o.input,size:1,value:p,disabled:r,readOnly:O,"aria-invalid":a?!0:void 0,"aria-describedby":a?u:void 0,onChange:i=>{y(i.target.value)},onKeyDown:M,onBlur:()=>{y(`${p},`)}})]})})]}),t.jsx("div",{className:o.reveal,children:t.jsxs("p",{className:o.counter,children:[n.length," / ",N]})})]}),t.jsx("p",{id:u,className:o.message,"aria-live":"polite",children:a})]})}exports.Button=ie;exports.H1=I;exports.H2=W;exports.Hero=Le;exports.ListItem=b;exports.MultitagField=Re;exports.Paragraph=K;exports.SideNav=ue;exports.SideNavLink=_e;exports.UnorderedList=Q;
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as n, jsxs as _ } from "react/jsx-runtime";
|
|
3
|
-
import { Children as
|
|
4
|
-
const
|
|
5
|
-
h1:
|
|
3
|
+
import { Children as F, isValidElement as R, Fragment as T, createContext as I, useContext as k, useId as H, useRef as U, useState as K } from "react";
|
|
4
|
+
const P = "_h1_1765w_1", G = {
|
|
5
|
+
h1: P
|
|
6
6
|
};
|
|
7
|
-
function
|
|
8
|
-
const s = [
|
|
7
|
+
function V({ children: e, className: t }) {
|
|
8
|
+
const s = [G.h1, t].filter(Boolean).join(" ");
|
|
9
9
|
return /* @__PURE__ */ n("h1", { className: s, children: e });
|
|
10
10
|
}
|
|
11
11
|
const J = "_h2_1eque_1", X = {
|
|
12
12
|
h2: J
|
|
13
13
|
};
|
|
14
|
-
function
|
|
14
|
+
function Ue({ children: e }) {
|
|
15
15
|
return /* @__PURE__ */ n("h2", { className: X.h2, children: e });
|
|
16
16
|
}
|
|
17
17
|
const Z = "_paragraph_11t85_1", Q = {
|
|
@@ -20,8 +20,8 @@ const Z = "_paragraph_11t85_1", Q = {
|
|
|
20
20
|
function Ke({ children: e }) {
|
|
21
21
|
return /* @__PURE__ */ n("p", { className: Q.paragraph, children: e });
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
23
|
+
const $ = typeof process < "u" && process.env.NODE_ENV !== "production", w = /* @__PURE__ */ new Set();
|
|
24
|
+
function y(e) {
|
|
25
25
|
w.has(e) || (w.add(e), console.warn(`[@smartyweb/ui] ${e}`));
|
|
26
26
|
}
|
|
27
27
|
function Y(e) {
|
|
@@ -33,51 +33,51 @@ function Y(e) {
|
|
|
33
33
|
}
|
|
34
34
|
return "an unknown element";
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
for (const s of
|
|
36
|
+
function z(e, t) {
|
|
37
|
+
for (const s of F.toArray(e)) {
|
|
38
38
|
if (!R(s)) {
|
|
39
39
|
if (typeof s != "string" && typeof s != "number") continue;
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
`<UnorderedList> received the text ${JSON.stringify(
|
|
40
|
+
const o = String(s).trim();
|
|
41
|
+
if (o === "") continue;
|
|
42
|
+
y(
|
|
43
|
+
`<UnorderedList> received the text ${JSON.stringify(o.slice(0, 40))} as a direct child. A <ul> may only contain list items — wrap it in <ListItem>.`
|
|
44
44
|
);
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
47
47
|
if (s.type === T) {
|
|
48
|
-
const { children:
|
|
49
|
-
|
|
48
|
+
const { children: o } = s.props;
|
|
49
|
+
z(o, t);
|
|
50
50
|
continue;
|
|
51
51
|
}
|
|
52
|
-
t(s.type) || s.type === "li" ||
|
|
53
|
-
`<UnorderedList> received ${Y(s.type)} as a direct child. A <ul> may only contain list items — wrap it in <ListItem
|
|
52
|
+
t(s.type) || s.type === "li" || y(
|
|
53
|
+
`<UnorderedList> received ${Y(s.type)} as a direct child. A <ul> may only contain list items — wrap it in <ListItem>. If that component renders a <ListItem> itself, set its static \`isSmartyListItem = true\`.`
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
function ee() {
|
|
58
|
-
|
|
58
|
+
y(
|
|
59
59
|
"<ListItem> was rendered outside of an <UnorderedList>. It renders an <li>, which browsers only style correctly inside a list."
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
|
-
const te = "_list_1p627_1", ne = "_item_1p627_14",
|
|
62
|
+
const te = "_list_1p627_1", ne = "_item_1p627_14", j = {
|
|
63
63
|
list: te,
|
|
64
64
|
item: ne
|
|
65
|
-
},
|
|
65
|
+
}, C = I(!1);
|
|
66
66
|
function S({ children: e }) {
|
|
67
|
-
const t =
|
|
68
|
-
return
|
|
67
|
+
const t = k(C);
|
|
68
|
+
return $ && !t && ee(), /* @__PURE__ */ n("li", { className: j.item, children: e });
|
|
69
69
|
}
|
|
70
70
|
S.isSmartyListItem = !0;
|
|
71
71
|
function se(e) {
|
|
72
72
|
return e === S ? !0 : typeof e == "function" && e.isSmartyListItem === !0;
|
|
73
73
|
}
|
|
74
74
|
function Pe({ children: e }) {
|
|
75
|
-
return
|
|
75
|
+
return $ && z(e, se), /* @__PURE__ */ n(C, { value: !0, children: /* @__PURE__ */ n("ul", { role: "list", className: j.list, children: e }) });
|
|
76
76
|
}
|
|
77
|
-
const ie = "_button_81qo0_1",
|
|
77
|
+
const ie = "_button_81qo0_1", oe = "_sm_81qo0_26", re = "_primary_81qo0_33", ae = "_secondary_81qo0_49", ce = "_negative_81qo0_68", L = {
|
|
78
78
|
button: ie,
|
|
79
|
-
sm:
|
|
80
|
-
primary:
|
|
79
|
+
sm: oe,
|
|
80
|
+
primary: re,
|
|
81
81
|
secondary: ae,
|
|
82
82
|
negative: ce
|
|
83
83
|
};
|
|
@@ -85,19 +85,19 @@ function Ge({
|
|
|
85
85
|
as: e = "button",
|
|
86
86
|
variant: t = "primary",
|
|
87
87
|
size: s = "default",
|
|
88
|
-
href:
|
|
88
|
+
href: o,
|
|
89
89
|
openInNewTab: l,
|
|
90
90
|
disabled: m,
|
|
91
91
|
type: a,
|
|
92
92
|
onClick: c,
|
|
93
93
|
children: d
|
|
94
94
|
}) {
|
|
95
|
-
const p = [
|
|
95
|
+
const p = [L.button, L[t], s === "sm" && L.sm].filter(Boolean).join(" ");
|
|
96
96
|
return /* @__PURE__ */ n(
|
|
97
97
|
e,
|
|
98
98
|
{
|
|
99
99
|
className: p,
|
|
100
|
-
href:
|
|
100
|
+
href: o,
|
|
101
101
|
target: l ? "_blank" : void 0,
|
|
102
102
|
rel: l ? "noopener noreferrer" : void 0,
|
|
103
103
|
disabled: m,
|
|
@@ -107,75 +107,71 @@ function Ge({
|
|
|
107
107
|
}
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
x.has(e) || (x.add(e), console.warn(`[@smartyweb/ui] ${e}`));
|
|
113
|
-
}
|
|
114
|
-
function ue() {
|
|
115
|
-
de(
|
|
110
|
+
function le() {
|
|
111
|
+
y(
|
|
116
112
|
"<SideNav> was rendered with no accessible name. Pass `label` so screen reader users can tell this nav apart from the other navigation landmarks on the page."
|
|
117
113
|
);
|
|
118
114
|
}
|
|
119
|
-
const
|
|
120
|
-
nav:
|
|
121
|
-
list:
|
|
122
|
-
item:
|
|
123
|
-
link:
|
|
124
|
-
current:
|
|
125
|
-
}, B =
|
|
126
|
-
function
|
|
127
|
-
return
|
|
115
|
+
const de = "_nav_dxkjl_3", ue = "_list_dxkjl_7", _e = "_item_dxkjl_16", me = "_link_dxkjl_20", pe = "_current_dxkjl_48", g = {
|
|
116
|
+
nav: de,
|
|
117
|
+
list: ue,
|
|
118
|
+
item: _e,
|
|
119
|
+
link: me,
|
|
120
|
+
current: pe
|
|
121
|
+
}, B = I(null);
|
|
122
|
+
function Ve({ label: e, current: t, children: s }) {
|
|
123
|
+
return $ && !e?.trim() && le(), /* @__PURE__ */ n("nav", { className: g.nav, "aria-label": e, children: /* @__PURE__ */ n(B, { value: t ?? null, children: /* @__PURE__ */ n("ul", { className: g.list, children: s }) }) });
|
|
128
124
|
}
|
|
129
|
-
function
|
|
125
|
+
function Je({
|
|
130
126
|
as: e = "a",
|
|
131
127
|
href: t,
|
|
132
128
|
current: s,
|
|
133
|
-
openInNewTab:
|
|
129
|
+
openInNewTab: o,
|
|
134
130
|
onClick: l,
|
|
135
131
|
children: m
|
|
136
132
|
}) {
|
|
137
|
-
const a =
|
|
138
|
-
return /* @__PURE__ */ n("li", { className:
|
|
133
|
+
const a = k(B), c = s ?? (a !== null && a === t), d = [g.link, c && g.current].filter(Boolean).join(" ");
|
|
134
|
+
return /* @__PURE__ */ n("li", { className: g.item, children: /* @__PURE__ */ n(
|
|
139
135
|
e,
|
|
140
136
|
{
|
|
141
137
|
className: d,
|
|
142
138
|
href: t,
|
|
143
|
-
target:
|
|
144
|
-
rel:
|
|
139
|
+
target: o ? "_blank" : void 0,
|
|
140
|
+
rel: o ? "noopener noreferrer" : void 0,
|
|
145
141
|
onClick: l,
|
|
146
142
|
"aria-current": c ? "location" : void 0,
|
|
147
143
|
children: m
|
|
148
144
|
}
|
|
149
145
|
) });
|
|
150
146
|
}
|
|
151
|
-
const
|
|
152
|
-
hero:
|
|
153
|
-
layout:
|
|
154
|
-
content:
|
|
155
|
-
titleLine:
|
|
156
|
-
titleWord:
|
|
157
|
-
description:
|
|
158
|
-
media:
|
|
159
|
-
};
|
|
160
|
-
function
|
|
161
|
-
return e.replace(/([- ])/g, (t) => `${t === " " ?
|
|
147
|
+
const fe = "_hero_93692_11", he = "_layout_93692_16", ge = "_content_93692_21", ye = "_titleLine_93692_25", ve = "_titleWord_93692_29", Ne = "_description_93692_35", Le = "_media_93692_48", h = {
|
|
148
|
+
hero: fe,
|
|
149
|
+
layout: he,
|
|
150
|
+
content: ge,
|
|
151
|
+
titleLine: ye,
|
|
152
|
+
titleWord: ve,
|
|
153
|
+
description: Ne,
|
|
154
|
+
media: Le
|
|
155
|
+
}, be = " ";
|
|
156
|
+
function $e(e) {
|
|
157
|
+
return e.replace(/([- ])/g, (t) => `${t === " " ? be : t}|split|`).split("|split|");
|
|
162
158
|
}
|
|
163
159
|
const xe = (e) => ({ "--hero-index": e });
|
|
164
|
-
function
|
|
165
|
-
const
|
|
160
|
+
function Xe({ title: e, description: t, media: s }) {
|
|
161
|
+
const o = Array.isArray(e);
|
|
166
162
|
let l = 0;
|
|
167
|
-
const m = (
|
|
168
|
-
(a) =>
|
|
163
|
+
const m = (o ? e : [e]).map(
|
|
164
|
+
(a) => $e(a).map((c) => ({ word: c, index: l++ }))
|
|
169
165
|
);
|
|
170
166
|
return /* @__PURE__ */ n("section", { className: h.hero, children: /* @__PURE__ */ _("div", { className: h.layout, children: [
|
|
171
167
|
/* @__PURE__ */ n("div", { className: h.media, children: s }),
|
|
172
168
|
/* @__PURE__ */ _("div", { className: h.content, children: [
|
|
173
|
-
/* @__PURE__ */ n(
|
|
169
|
+
/* @__PURE__ */ n(V, { children: m.map((a, c) => /* @__PURE__ */ n("span", { className: o ? h.titleLine : void 0, children: a.map(({ word: d, index: u }) => /* @__PURE__ */ n("span", { className: h.titleWord, style: xe(u), children: d }, u)) }, c)) }),
|
|
174
170
|
/* @__PURE__ */ n("p", { className: h.description, children: t })
|
|
175
171
|
] })
|
|
176
172
|
] }) });
|
|
177
173
|
}
|
|
178
|
-
function
|
|
174
|
+
function we() {
|
|
179
175
|
return /* @__PURE__ */ n("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
180
176
|
"path",
|
|
181
177
|
{
|
|
@@ -186,74 +182,76 @@ function ke() {
|
|
|
186
182
|
}
|
|
187
183
|
) });
|
|
188
184
|
}
|
|
189
|
-
const
|
|
190
|
-
field:
|
|
191
|
-
error:
|
|
192
|
-
message:
|
|
193
|
-
content:
|
|
194
|
-
reveal:
|
|
185
|
+
const Ie = "_field_7z5g3_1", ke = "_error_7z5g3_17", ze = "_message_7z5g3_21", je = "_content_7z5g3_36", Ce = "_reveal_7z5g3_43", Se = "_label_7z5g3_53", Be = "_tags_7z5g3_64", Oe = "_input_7z5g3_71", Ae = "_counter_7z5g3_88", De = "_empty_7z5g3_100", Me = "_disabled_7z5g3_127", Ee = "_chip_7z5g3_132", We = "_chipText_7z5g3_153", qe = "_remove_7z5g3_158", Fe = "_invalid_7z5g3_169", r = {
|
|
186
|
+
field: Ie,
|
|
187
|
+
error: ke,
|
|
188
|
+
message: ze,
|
|
189
|
+
content: je,
|
|
190
|
+
reveal: Ce,
|
|
195
191
|
label: Se,
|
|
196
192
|
tags: Be,
|
|
197
|
-
input:
|
|
193
|
+
input: Oe,
|
|
198
194
|
counter: Ae,
|
|
199
|
-
empty:
|
|
200
|
-
disabled:
|
|
201
|
-
chip:
|
|
202
|
-
chipText:
|
|
203
|
-
remove:
|
|
204
|
-
invalid:
|
|
195
|
+
empty: De,
|
|
196
|
+
disabled: Me,
|
|
197
|
+
chip: Ee,
|
|
198
|
+
chipText: We,
|
|
199
|
+
remove: qe,
|
|
200
|
+
invalid: Fe
|
|
205
201
|
};
|
|
206
|
-
function
|
|
207
|
-
return /* @__PURE__ */ _("span", { className: [
|
|
208
|
-
/* @__PURE__ */ n("span", { className:
|
|
202
|
+
function Re({ children: e, invalid: t, onRemove: s }) {
|
|
203
|
+
return /* @__PURE__ */ _("span", { className: [r.chip, t && r.invalid].filter(Boolean).join(" "), children: [
|
|
204
|
+
/* @__PURE__ */ n("span", { className: r.chipText, children: e }),
|
|
209
205
|
s && /* @__PURE__ */ n(
|
|
210
206
|
"button",
|
|
211
207
|
{
|
|
212
208
|
type: "button",
|
|
213
|
-
className:
|
|
209
|
+
className: r.remove,
|
|
214
210
|
"aria-label": `Remove ${e}${t ? " (invalid)" : ""}`,
|
|
215
211
|
onClick: s,
|
|
216
|
-
children: /* @__PURE__ */ n(
|
|
212
|
+
children: /* @__PURE__ */ n(we, {})
|
|
217
213
|
}
|
|
218
214
|
)
|
|
219
215
|
] });
|
|
220
216
|
}
|
|
221
|
-
const
|
|
222
|
-
function
|
|
217
|
+
const b = 100;
|
|
218
|
+
function Ze({
|
|
223
219
|
label: e,
|
|
224
220
|
value: t,
|
|
225
221
|
onChange: s,
|
|
226
|
-
disabled:
|
|
222
|
+
disabled: o = !1,
|
|
227
223
|
isTagInvalid: l,
|
|
228
224
|
onInputChange: m,
|
|
229
225
|
error: a
|
|
230
226
|
}) {
|
|
231
|
-
const c =
|
|
232
|
-
|
|
227
|
+
const c = H(), d = `${c}-message`, u = U(null), [p, O] = K(""), A = t.length >= b, D = (i) => {
|
|
228
|
+
O(i), m?.(i);
|
|
233
229
|
}, v = (i) => {
|
|
234
|
-
const f = i.split(/[\s,]+/),
|
|
235
|
-
|
|
236
|
-
},
|
|
230
|
+
const f = i.split(/[\s,]+/), N = f.pop() ?? "", x = f.filter(Boolean).slice(0, Math.max(0, b - t.length));
|
|
231
|
+
x.length && s([...t, ...x]), D(N);
|
|
232
|
+
}, M = (i) => {
|
|
237
233
|
i.key === "Enter" && p && !i.nativeEvent.isComposing ? (i.preventDefault(), v(`${p},`)) : i.key === "Backspace" && !p && t.length && s(t.slice(0, -1));
|
|
234
|
+
}, E = (i) => {
|
|
235
|
+
o || i.target === u.current || i.target.closest("button") || (i.preventDefault(), u.current?.focus());
|
|
238
236
|
}, W = (i) => {
|
|
239
|
-
|
|
237
|
+
s(t.filter((f, N) => N !== i)), i === t.length - 1 && u.current?.focus();
|
|
240
238
|
}, q = [
|
|
241
|
-
|
|
242
|
-
!t.length &&
|
|
243
|
-
|
|
244
|
-
a &&
|
|
239
|
+
r.field,
|
|
240
|
+
!t.length && r.empty,
|
|
241
|
+
o && r.disabled,
|
|
242
|
+
a && r.error
|
|
245
243
|
].filter(Boolean).join(" ");
|
|
246
244
|
return /* @__PURE__ */ _("div", { children: [
|
|
247
|
-
/* @__PURE__ */ _("div", { className: q, onMouseDown:
|
|
248
|
-
/* @__PURE__ */ _("div", { className:
|
|
249
|
-
/* @__PURE__ */ n("label", { htmlFor: c, className:
|
|
250
|
-
/* @__PURE__ */ n("div", { className:
|
|
245
|
+
/* @__PURE__ */ _("div", { className: q, onMouseDown: E, children: [
|
|
246
|
+
/* @__PURE__ */ _("div", { className: r.content, children: [
|
|
247
|
+
/* @__PURE__ */ n("label", { htmlFor: c, className: r.label, children: e }),
|
|
248
|
+
/* @__PURE__ */ n("div", { className: r.reveal, children: /* @__PURE__ */ _("div", { className: r.tags, children: [
|
|
251
249
|
t.map((i, f) => /* @__PURE__ */ n(
|
|
252
|
-
|
|
250
|
+
Re,
|
|
253
251
|
{
|
|
254
252
|
invalid: l?.(i, f) ?? !1,
|
|
255
|
-
onRemove:
|
|
256
|
-
|
|
253
|
+
onRemove: o ? void 0 : () => {
|
|
254
|
+
W(f);
|
|
257
255
|
},
|
|
258
256
|
children: i
|
|
259
257
|
},
|
|
@@ -264,17 +262,17 @@ function Qe({
|
|
|
264
262
|
{
|
|
265
263
|
ref: u,
|
|
266
264
|
id: c,
|
|
267
|
-
className:
|
|
265
|
+
className: r.input,
|
|
268
266
|
size: 1,
|
|
269
267
|
value: p,
|
|
270
|
-
disabled:
|
|
268
|
+
disabled: o,
|
|
271
269
|
readOnly: A,
|
|
272
270
|
"aria-invalid": a ? !0 : void 0,
|
|
273
271
|
"aria-describedby": a ? d : void 0,
|
|
274
272
|
onChange: (i) => {
|
|
275
273
|
v(i.target.value);
|
|
276
274
|
},
|
|
277
|
-
onKeyDown:
|
|
275
|
+
onKeyDown: M,
|
|
278
276
|
onBlur: () => {
|
|
279
277
|
v(`${p},`);
|
|
280
278
|
}
|
|
@@ -282,24 +280,24 @@ function Qe({
|
|
|
282
280
|
)
|
|
283
281
|
] }) })
|
|
284
282
|
] }),
|
|
285
|
-
/* @__PURE__ */ n("div", { className:
|
|
283
|
+
/* @__PURE__ */ n("div", { className: r.reveal, children: /* @__PURE__ */ _("p", { className: r.counter, children: [
|
|
286
284
|
t.length,
|
|
287
285
|
" / ",
|
|
288
|
-
|
|
286
|
+
b
|
|
289
287
|
] }) })
|
|
290
288
|
] }),
|
|
291
|
-
/* @__PURE__ */ n("p", { id: d, className:
|
|
289
|
+
/* @__PURE__ */ n("p", { id: d, className: r.message, "aria-live": "polite", children: a })
|
|
292
290
|
] });
|
|
293
291
|
}
|
|
294
292
|
export {
|
|
295
293
|
Ge as Button,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
294
|
+
V as H1,
|
|
295
|
+
Ue as H2,
|
|
296
|
+
Xe as Hero,
|
|
299
297
|
S as ListItem,
|
|
300
|
-
|
|
298
|
+
Ze as MultitagField,
|
|
301
299
|
Ke as Paragraph,
|
|
302
|
-
|
|
303
|
-
|
|
300
|
+
Ve as SideNav,
|
|
301
|
+
Je as SideNavLink,
|
|
304
302
|
Pe as UnorderedList
|
|
305
303
|
};
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
export declare const isDev: boolean;
|
|
2
|
-
/**
|
|
3
|
-
* Warns when <SideNav> renders without an accessible name. <nav> is a landmark, and
|
|
4
|
-
* an unnamed one is announced as bare "navigation" — indistinguishable from every
|
|
5
|
-
* other nav on the page in a screen reader's landmark list.
|
|
6
|
-
*/
|
|
7
1
|
export declare function warnOnMissingLabel(): void;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export declare const isDev: boolean;
|
|
3
|
-
/**
|
|
4
|
-
* Warns when <UnorderedList> is handed anything other than <ListItem> (or a raw
|
|
5
|
-
* <li>). A <ul> may only contain <li>, so other children are invalid HTML and
|
|
6
|
-
* lose the bullet + spacing styles.
|
|
7
|
-
*
|
|
8
|
-
* Note: a custom wrapper that renders a <ListItem> internally will trip this —
|
|
9
|
-
* see the escape hatch in ListItem.tsx.
|
|
10
|
-
*/
|
|
11
2
|
export declare function warnOnNonListItemChildren(children: ReactNode, isListItem: (type: unknown) => boolean): void;
|
|
12
|
-
/** Warns when <ListItem> is rendered outside of an <UnorderedList>. */
|
|
13
3
|
export declare function warnOnOrphanListItem(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartyweb/ui",
|
|
3
|
-
"version": "2.2.0-max-
|
|
3
|
+
"version": "2.2.0-max-no-comments.ged46dbb",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"release": "changeset publish",
|
|
27
27
|
"storybook": "node sd.config.js && storybook dev -p 6006",
|
|
28
28
|
"build-storybook": "storybook build",
|
|
29
|
-
"lint": "node scripts/check-use-client.mjs && eslint src --max-warnings 0 && stylelint 'src/**/*.scss'",
|
|
29
|
+
"lint": "node scripts/check-use-client.mjs && node scripts/check-comments.mjs && eslint src --max-warnings 0 && stylelint 'src/**/*.scss'",
|
|
30
30
|
"mirror": "node scripts/mirror-check.mjs",
|
|
31
31
|
"mirror:selftest": "node scripts/mirror-selftest.mjs",
|
|
32
32
|
"format:check": "prettier --check ."
|