@smartyweb/ui 2.6.0-irina-button-review.gea26df8 → 3.0.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/buttons/Button/Button.d.ts +1 -7
- package/dist/buttons/Link/destination.d.ts +17 -5
- package/dist/index.cjs +1 -1
- package/dist/index.js +276 -299
- package/package.json +1 -1
|
@@ -12,10 +12,6 @@ interface SharedProps {
|
|
|
12
12
|
*/
|
|
13
13
|
type AsLink = SharedProps & {
|
|
14
14
|
href: string;
|
|
15
|
-
/** Still accepted, but the href decides — `as={Link}` is no longer needed. */
|
|
16
|
-
as?: React.ElementType;
|
|
17
|
-
/** External hrefs open in a new tab already; this forces it for an internal one. */
|
|
18
|
-
openInNewTab?: boolean;
|
|
19
15
|
/** Saves the file instead of opening it: always a plain <a download>, never a new tab. */
|
|
20
16
|
download?: boolean;
|
|
21
17
|
/** A link cannot be disabled, so a disabled link-button renders a disabled <button>. */
|
|
@@ -25,12 +21,10 @@ type AsLink = SharedProps & {
|
|
|
25
21
|
/** No href — a <button>, type="button" so it never submits a form by accident. */
|
|
26
22
|
type AsButton = SharedProps & {
|
|
27
23
|
href?: never;
|
|
28
|
-
as?: "button";
|
|
29
|
-
openInNewTab?: never;
|
|
30
24
|
download?: never;
|
|
31
25
|
type?: "button" | "submit" | "reset";
|
|
32
26
|
disabled?: boolean;
|
|
33
27
|
};
|
|
34
28
|
export type ButtonProps = AsLink | AsButton;
|
|
35
|
-
export declare function Button({
|
|
29
|
+
export declare function Button({ variant, size, href, download, disabled, type, onClick, children, }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
36
30
|
export {};
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
export type Destination = "external" | "download" | "plain" | "router";
|
|
2
3
|
/**
|
|
3
|
-
* Where an href leads, which decides what <
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Where an href leads, which decides what <Anchor> renders: http(s) opens in a new tab,
|
|
5
|
+
* an internal route goes through the <LinkProvider> router, and anything else — including
|
|
6
|
+
* a file such as a PDF, which opens in the browser — is a plain <a>.
|
|
6
7
|
*/
|
|
7
8
|
export declare function destinationOf(href: string, download: boolean): Destination;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
export interface AnchorProps {
|
|
10
|
+
className: string;
|
|
11
|
+
href: string;
|
|
12
|
+
/** Saves the file instead of opening it: always a plain <a download>, never a new tab. */
|
|
13
|
+
download?: boolean | undefined;
|
|
14
|
+
onClick?: React.MouseEventHandler | undefined;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The link half of <Link> and <Button>: renders the href where `destinationOf` says it
|
|
19
|
+
* leads, so both components share one routing rule.
|
|
20
|
+
*/
|
|
21
|
+
export declare function Anchor({ className, href, download, onClick, children }: AnchorProps): 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"),r=require("react"),Y="_h1_1765w_1",ee={h1:Y};function R({children:e,className:n}){const s=[ee.h1,n].filter(Boolean).join(" ");return t.jsx("h1",{className:s,children:e})}const ne="_h2_1eque_1",te={h2:ne};function se({children:e}){return t.jsx("h2",{className:te.h2,children:e})}const ie="_paragraph_11t85_1",oe={paragraph:ie};function re({children:e}){return t.jsx("p",{className:oe.paragraph,children:e})}const F=typeof process<"u"&&process.env.NODE_ENV!=="production",B=new Set;function C(e){B.has(e)||(B.add(e),console.warn(`[@smartyweb/ui] ${e}`))}function ae(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 A(e,n){for(const s of r.Children.toArray(e)){if(!r.isValidElement(s)){if(typeof s!="string"&&typeof s!="number")continue;const i=String(s).trim();if(i==="")continue;C(`<UnorderedList> received the text ${JSON.stringify(i.slice(0,40))} as a direct child. A <ul> may only contain list items — wrap it in <ListItem>.`);continue}if(s.type===r.Fragment){const{children:i}=s.props;A(i,n);continue}n(s.type)||s.type==="li"||C(`<UnorderedList> received ${ae(s.type)} as a direct child. A <ul> may only contain list items — wrap it in <ListItem>.`)}}function le(){C("<ListItem> was rendered outside of an <UnorderedList>. It renders an <li>, which browsers only style correctly inside a list.")}const ce="_list_1p627_1",ue="_item_1p627_14",W={list:ce,item:ue},H=r.createContext(!1);function T({children:e}){const n=r.useContext(H);return F&&!n&&le(),t.jsx("li",{className:W.item,children:e})}T.isSmartyListItem=!0;function de(e){return e===T?!0:typeof e=="function"&&e.isSmartyListItem===!0}function fe({children:e}){return F&&A(e,de),t.jsx(H,{value:!0,children:t.jsx("ul",{role:"list",className:W.list,children:e})})}const _e="_link_1m7hb_1",me="_accent_1m7hb_28",pe="_disabled_1m7hb_38",he="_newTabNote_1m7hb_48",g={link:_e,accent:me,disabled:pe,newTabNote:he},xe=/\.[a-z][a-z\d]{1,4}$/;function P(e,n){if(n)return"download";if(/^(https?:)?\/\//i.test(e))return"external";if(e.startsWith("#")||/^[a-z][a-z\d+.-]*:/i.test(e))return"plain";const s=(e.split(/[?#]/)[0]??"").toLowerCase();return xe.test(s)?"plain":"router"}function U(){return t.jsx("span",{className:g.newTabNote,children:" (opens in new tab)"})}const z=r.createContext(null);function ye({component:e,children:n}){return t.jsx(z,{value:e,children:n})}function V(){return r.useContext(z)}const ve="_button_1391k_1",je="_sm_1391k_26",be="_primary_1391k_33",Ne="_secondary_1391k_49",ge="_negative_1391k_68",$={button:ve,sm:je,primary:be,secondary:Ne,negative:ge};function Le({as:e,variant:n="primary",size:s="default",href:i,openInNewTab:c=!1,download:d=!1,disabled:o,type:f="button",onClick:_,children:u}){const m=V(),b=[$.button,$[n],s==="sm"&&$.sm].filter(Boolean).join(" ");if(i===void 0||o)return t.jsx("button",{className:b,type:f,disabled:o,onClick:_,children:u});const y=P(i,d),p=y==="external"||c&&y!=="download",w=e??(y==="router"&&m?m:"a");return t.jsxs(w,{className:b,href:i,target:p?"_blank":void 0,rel:p?"noopener noreferrer":void 0,download:y==="download"?"":void 0,onClick:_,children:[u,p&&t.jsx(U,{})]})}function q({variant:e="default",href:n,download:s=!1,disabled:i,onClick:c,children:d}){const o=V(),_=[g.link,e==="accent"&&g.accent,i&&g.disabled].filter(Boolean).join(" ");if(n===void 0)return t.jsx("button",{type:"button",className:_,disabled:i,onClick:i?void 0:c,"aria-disabled":i,children:d});const u=P(n,s);if(u==="external")return t.jsxs("a",{className:_,href:n,target:"_blank",rel:"noopener noreferrer",onClick:c,children:[d,t.jsx(U,{})]});const m=u==="router"&&o?o:"a";return t.jsx(m,{className:_,href:n,download:u==="download"?"":void 0,onClick:c,children:d})}const we=typeof process<"u"&&process.env.NODE_ENV!=="production",E=new Set;function $e(e){E.has(e)||(E.add(e),console.warn(`[@smartyweb/ui] ${e}`))}function ke(){$e("<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 Ce="_nav_dxkjl_3",Oe="_list_dxkjl_7",Te="_item_dxkjl_16",Ie="_link_dxkjl_20",Se="_current_dxkjl_48",j={nav:Ce,list:Oe,item:Te,link:Ie,current:Se},J=r.createContext(null);function De({label:e,current:n,children:s}){return we&&!e?.trim()&&ke(),t.jsx("nav",{className:j.nav,"aria-label":e,children:t.jsx(J,{value:n??null,children:t.jsx("ul",{className:j.list,children:s})})})}function Be({as:e="a",href:n,current:s,openInNewTab:i,onClick:c,children:d}){const o=r.useContext(J),f=s??(o!==null&&o===n),_=[j.link,f&&j.current].filter(Boolean).join(" ");return t.jsx("li",{className:j.item,children:t.jsx(e,{className:_,href:n,target:i?"_blank":void 0,rel:i?"noopener noreferrer":void 0,onClick:c,"aria-current":f?"location":void 0,children:d})})}const K=typeof process<"u"&&process.env.NODE_ENV!=="production",M=new Set;function O(e){M.has(e)||(M.add(e),console.warn(`[@smartyweb/ui] ${e}`))}function Ee(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 X(e,n){for(const s of r.Children.toArray(e)){if(!r.isValidElement(s)){if(typeof s!="string"&&typeof s!="number")continue;const i=String(s).trim();if(i==="")continue;O(`<TableOfContents> received the text ${JSON.stringify(i.slice(0,40))} as a direct child. Its list may only contain entries — wrap it in <TableOfContentsLink href="#…">.`);continue}if(s.type===r.Fragment){const{children:i}=s.props;X(i,n);continue}n(s.type)||s.type==="li"||O(`<TableOfContents> received ${Ee(s.type)} as a direct child. Its list may only contain entries — use <TableOfContentsLink href="#…"> instead.`)}}function Me(){O("<TableOfContentsLink> was rendered outside of a <TableOfContents>. It renders an <li>, which browsers only style correctly inside a list.")}const Re="_nav_1us0j_1",Fe="_heading_1us0j_8",Ae="_list_1us0j_19",We="_item_1us0j_28",L={nav:Re,heading:Fe,list:Ae,item:We},G=r.createContext(!1);function I({href:e,children:n}){const s=r.useContext(G);return K&&!s&&Me(),t.jsx("li",{className:L.item,children:t.jsx(q,{href:e,children:n})})}I.isSmartyTableOfContentsLink=!0;function He(e){return e===I?!0:typeof e=="function"&&e.isSmartyTableOfContentsLink===!0}function Pe({title:e="Table of contents",children:n}){const s=r.useId();return K&&X(n,He),t.jsxs("nav",{className:L.nav,"aria-labelledby":s,children:[t.jsx("h2",{id:s,className:L.heading,children:e}),t.jsx(G,{value:!0,children:t.jsx("ul",{role:"list",className:L.list,children:n})})]})}const Ue="_hero_93692_11",ze="_layout_93692_16",Ve="_content_93692_21",qe="_titleLine_93692_25",Je="_titleWord_93692_29",Ke="_description_93692_35",Xe="_media_93692_48",x={hero:Ue,layout:ze,content:Ve,titleLine:qe,titleWord:Je,description:Ke,media:Xe};function Ge(e){return e.replace(/([- ])/g,n=>`${n===" "?" ":n}|split|`).split("|split|")}const Ze=e=>({"--hero-index":e});function Qe({title:e,description:n,media:s}){const i=Array.isArray(e);let c=0;const d=(i?e:[e]).map(o=>Ge(o).map(f=>({word:f,index:c++})));return t.jsx("section",{className:x.hero,children:t.jsxs("div",{className:x.layout,children:[t.jsx("div",{className:x.media,children:s}),t.jsxs("div",{className:x.content,children:[t.jsx(R,{children:d.map((o,f)=>t.jsx("span",{className:i?x.titleLine:void 0,children:o.map(({word:_,index:u})=>t.jsx("span",{className:x.titleWord,style:Ze(u),children:_},u))},f))}),t.jsx("p",{className:x.description,children:n})]})]})})}function Ye(){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 en="_field_14suf_1",nn="_error_14suf_17",tn="_message_14suf_21",sn="_content_14suf_36",on="_reveal_14suf_43",rn="_label_14suf_53",an="_tags_14suf_64",ln="_chips_14suf_71",cn="_input_14suf_78",un="_counter_14suf_95",dn="_empty_14suf_107",fn="_disabled_14suf_134",_n="_chip_14suf_71",mn="_chipText_14suf_160",pn="_remove_14suf_165",hn="_invalid_14suf_176",l={field:en,error:nn,message:tn,content:sn,reveal:on,label:rn,tags:an,chips:ln,input:cn,counter:un,empty:dn,disabled:fn,chip:_n,chipText:mn,remove:pn,invalid:hn};function xn({children:e,invalid:n,onRemove:s}){return t.jsxs("li",{className:[l.chip,n&&l.invalid].filter(Boolean).join(" "),children:[t.jsx("span",{className:l.chipText,children:e}),s&&t.jsx("button",{type:"button",className:l.remove,"aria-label":`Remove ${e}${n?" (invalid)":""}`,onClick:s,children:t.jsx(Ye,{})})]})}const k=100;function yn({label:e,value:n,onChange:s,disabled:i=!1,isTagInvalid:c,onInputChange:d,error:o}){const f=r.useId(),_=`${f}-message`,u=r.useRef(null),[m,S]=r.useState(""),b=n.length>=k,y=a=>{S(a),d?.(a)},p=a=>{const h=a.split(/[\s,]+/),D=h.pop()??"",N=h.filter(Boolean).slice(0,Math.max(0,k-n.length));N.length&&s([...n,...N]),y(D)},w=a=>{a.key==="Enter"&&m&&!a.nativeEvent.isComposing?(a.preventDefault(),p(`${m},`)):a.key==="Backspace"&&!m&&n.length&&s(n.slice(0,-1))},Z=a=>{i||a.target===u.current||a.target.closest("button")||(a.preventDefault(),u.current?.focus())},Q=[l.field,!n.length&&l.empty,i&&l.disabled,o&&l.error].filter(Boolean).join(" ");return t.jsxs("div",{children:[t.jsxs("div",{className:Q,onMouseDown:Z,children:[t.jsxs("div",{className:l.content,children:[t.jsx("label",{htmlFor:f,className:l.label,children:e}),t.jsx("div",{className:l.reveal,children:t.jsxs("div",{className:l.tags,children:[n.length>0&&t.jsx("ul",{role:"list",className:l.chips,children:n.map((a,h)=>t.jsx(xn,{invalid:c?.(a,h)??!1,onRemove:i?void 0:()=>{s(n.filter((D,N)=>N!==h)),h===n.length-1&&u.current?.focus()},children:a},h))}),t.jsx("input",{ref:u,id:f,className:l.input,size:1,value:m,disabled:i,readOnly:b,"aria-invalid":o?!0:void 0,"aria-describedby":o?_:void 0,onChange:a=>{p(a.target.value)},onKeyDown:w,onBlur:()=>{p(`${m},`)}})]})})]}),t.jsx("div",{className:l.reveal,children:t.jsxs("p",{className:l.counter,children:[n.length," / ",k]})})]}),t.jsx("p",{id:_,className:l.message,"aria-live":"polite",children:o})]})}const vn="_field_otub4_1",jn="_label_otub4_16",bn="_reveal_otub4_27",Nn="_input_otub4_37",gn="_empty_otub4_56",v={field:vn,label:jn,reveal:bn,input:Nn,empty:gn};function Ln({label:e,value:n,onChange:s}){const i=r.useId(),c=r.useRef(null),d=o=>{o.target!==c.current&&(o.preventDefault(),c.current?.focus())};return t.jsxs("div",{className:[v.field,!n&&v.empty].filter(Boolean).join(" "),onMouseDown:d,children:[t.jsx("label",{htmlFor:i,className:v.label,children:e}),t.jsx("div",{className:v.reveal,children:t.jsx("div",{children:t.jsx("input",{ref:c,id:i,className:v.input,value:n,onChange:o=>{s(o.target.value)}})})})]})}exports.Button=Le;exports.H1=R;exports.H2=se;exports.Hero=Qe;exports.Link=q;exports.LinkProvider=ye;exports.ListItem=T;exports.MultitagField=yn;exports.Paragraph=re;exports.SideNav=De;exports.SideNavLink=Be;exports.TableOfContents=Pe;exports.TableOfContentsLink=I;exports.TextField=Ln;exports.UnorderedList=fe;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),Z="_h1_1765w_1",Q={h1:Z};function D({children:e,className:n}){const s=[Q.h1,n].filter(Boolean).join(" ");return t.jsx("h1",{className:s,children:e})}const Y="_h2_1eque_1",ee={h2:Y};function ne({children:e}){return t.jsx("h2",{className:ee.h2,children:e})}const te="_paragraph_11t85_1",se={paragraph:te};function ie({children:e}){return t.jsx("p",{className:se.paragraph,children:e})}const B=typeof process<"u"&&process.env.NODE_ENV!=="production",T=new Set;function $(e){T.has(e)||(T.add(e),console.warn(`[@smartyweb/ui] ${e}`))}function oe(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 E(e,n){for(const s of r.Children.toArray(e)){if(!r.isValidElement(s)){if(typeof s!="string"&&typeof s!="number")continue;const i=String(s).trim();if(i==="")continue;$(`<UnorderedList> received the text ${JSON.stringify(i.slice(0,40))} as a direct child. A <ul> may only contain list items — wrap it in <ListItem>.`);continue}if(s.type===r.Fragment){const{children:i}=s.props;E(i,n);continue}n(s.type)||s.type==="li"||$(`<UnorderedList> received ${oe(s.type)} as a direct child. A <ul> may only contain list items — wrap it in <ListItem>.`)}}function re(){$("<ListItem> was rendered outside of an <UnorderedList>. It renders an <li>, which browsers only style correctly inside a list.")}const ae="_list_1p627_1",ce="_item_1p627_14",M={list:ae,item:ce},R=r.createContext(!1);function k({children:e}){const n=r.useContext(R);return B&&!n&&re(),t.jsx("li",{className:M.item,children:e})}k.isSmartyListItem=!0;function le(e){return e===k?!0:typeof e=="function"&&e.isSmartyListItem===!0}function ue({children:e}){return B&&E(e,le),t.jsx(R,{value:!0,children:t.jsx("ul",{role:"list",className:M.list,children:e})})}const de="_link_1m7hb_1",fe="_accent_1m7hb_28",_e="_disabled_1m7hb_38",me="_newTabNote_1m7hb_48",v={link:de,accent:fe,disabled:_e,newTabNote:me},A=r.createContext(null);function pe({component:e,children:n}){return t.jsx(A,{value:e,children:n})}function he(){return r.useContext(A)}const xe=/\.[a-z][a-z\d]{1,4}$/;function ye(e,n){if(n)return"download";if(/^(https?:)?\/\//i.test(e))return"external";if(e.startsWith("#")||/^[a-z][a-z\d+.-]*:/i.test(e))return"plain";const s=(e.split(/[?#]/)[0]??"").toLowerCase();return xe.test(s)?"plain":"router"}function je(){return t.jsx("span",{className:v.newTabNote,children:" (opens in new tab)"})}function F({className:e,href:n,download:s=!1,onClick:i,children:a}){const d=he(),o=ye(n,s);if(o==="external")return t.jsxs("a",{className:e,href:n,target:"_blank",rel:"noopener noreferrer",onClick:i,children:[a,t.jsx(je,{})]});const c=o==="router"&&d?d:"a";return t.jsx(c,{className:e,href:n,download:o==="download"?"":void 0,onClick:i,children:a})}const ve="_button_1391k_1",be="_sm_1391k_26",Ne="_primary_1391k_33",ge="_secondary_1391k_49",Le="_negative_1391k_68",g={button:ve,sm:be,primary:Ne,secondary:ge,negative:Le};function $e({variant:e="primary",size:n="default",href:s,download:i,disabled:a,type:d="button",onClick:o,children:c}){const f=[g.button,g[e],n==="sm"&&g.sm].filter(Boolean).join(" ");return s===void 0||a?t.jsx("button",{className:f,type:d,disabled:a,onClick:o,children:c}):t.jsx(F,{className:f,href:s,download:i,onClick:o,children:c})}function W({variant:e="default",href:n,download:s,disabled:i,onClick:a,children:d}){const c=[v.link,e==="accent"&&v.accent,i&&v.disabled].filter(Boolean).join(" ");return n===void 0?t.jsx("button",{type:"button",className:c,disabled:i,onClick:i?void 0:a,"aria-disabled":i,children:d}):t.jsx(F,{className:c,href:n,download:s,onClick:a,children:d})}const we=typeof process<"u"&&process.env.NODE_ENV!=="production",I=new Set;function ke(e){I.has(e)||(I.add(e),console.warn(`[@smartyweb/ui] ${e}`))}function Ce(){ke("<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",Te="_list_dxkjl_7",Ie="_item_dxkjl_16",Se="_link_dxkjl_20",De="_current_dxkjl_48",y={nav:Oe,list:Te,item:Ie,link:Se,current:De},H=r.createContext(null);function Be({label:e,current:n,children:s}){return we&&!e?.trim()&&Ce(),t.jsx("nav",{className:y.nav,"aria-label":e,children:t.jsx(H,{value:n??null,children:t.jsx("ul",{className:y.list,children:s})})})}function Ee({as:e="a",href:n,current:s,openInNewTab:i,onClick:a,children:d}){const o=r.useContext(H),c=s??(o!==null&&o===n),_=[y.link,c&&y.current].filter(Boolean).join(" ");return t.jsx("li",{className:y.item,children:t.jsx(e,{className:_,href:n,target:i?"_blank":void 0,rel:i?"noopener noreferrer":void 0,onClick:a,"aria-current":c?"location":void 0,children:d})})}const P=typeof process<"u"&&process.env.NODE_ENV!=="production",S=new Set;function w(e){S.has(e)||(S.add(e),console.warn(`[@smartyweb/ui] ${e}`))}function Me(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 U(e,n){for(const s of r.Children.toArray(e)){if(!r.isValidElement(s)){if(typeof s!="string"&&typeof s!="number")continue;const i=String(s).trim();if(i==="")continue;w(`<TableOfContents> received the text ${JSON.stringify(i.slice(0,40))} as a direct child. Its list may only contain entries — wrap it in <TableOfContentsLink href="#…">.`);continue}if(s.type===r.Fragment){const{children:i}=s.props;U(i,n);continue}n(s.type)||s.type==="li"||w(`<TableOfContents> received ${Me(s.type)} as a direct child. Its list may only contain entries — use <TableOfContentsLink href="#…"> instead.`)}}function Re(){w("<TableOfContentsLink> was rendered outside of a <TableOfContents>. It renders an <li>, which browsers only style correctly inside a list.")}const Ae="_nav_1us0j_1",Fe="_heading_1us0j_8",We="_list_1us0j_19",He="_item_1us0j_28",b={nav:Ae,heading:Fe,list:We,item:He},z=r.createContext(!1);function C({href:e,children:n}){const s=r.useContext(z);return P&&!s&&Re(),t.jsx("li",{className:b.item,children:t.jsx(W,{href:e,children:n})})}C.isSmartyTableOfContentsLink=!0;function Pe(e){return e===C?!0:typeof e=="function"&&e.isSmartyTableOfContentsLink===!0}function Ue({title:e="Table of contents",children:n}){const s=r.useId();return P&&U(n,Pe),t.jsxs("nav",{className:b.nav,"aria-labelledby":s,children:[t.jsx("h2",{id:s,className:b.heading,children:e}),t.jsx(z,{value:!0,children:t.jsx("ul",{role:"list",className:b.list,children:n})})]})}const ze="_hero_93692_11",Ve="_layout_93692_16",qe="_content_93692_21",Je="_titleLine_93692_25",Ke="_titleWord_93692_29",Xe="_description_93692_35",Ge="_media_93692_48",p={hero:ze,layout:Ve,content:qe,titleLine:Je,titleWord:Ke,description:Xe,media:Ge};function Ze(e){return e.replace(/([- ])/g,n=>`${n===" "?" ":n}|split|`).split("|split|")}const Qe=e=>({"--hero-index":e});function Ye({title:e,description:n,media:s}){const i=Array.isArray(e);let a=0;const d=(i?e:[e]).map(o=>Ze(o).map(c=>({word:c,index:a++})));return t.jsx("section",{className:p.hero,children:t.jsxs("div",{className:p.layout,children:[t.jsx("div",{className:p.media,children:s}),t.jsxs("div",{className:p.content,children:[t.jsx(D,{children:d.map((o,c)=>t.jsx("span",{className:i?p.titleLine:void 0,children:o.map(({word:_,index:f})=>t.jsx("span",{className:p.titleWord,style:Qe(f),children:_},f))},c))}),t.jsx("p",{className:p.description,children:n})]})]})})}function en(){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 nn="_field_14suf_1",tn="_error_14suf_17",sn="_message_14suf_21",on="_content_14suf_36",rn="_reveal_14suf_43",an="_label_14suf_53",cn="_tags_14suf_64",ln="_chips_14suf_71",un="_input_14suf_78",dn="_counter_14suf_95",fn="_empty_14suf_107",_n="_disabled_14suf_134",mn="_chip_14suf_71",pn="_chipText_14suf_160",hn="_remove_14suf_165",xn="_invalid_14suf_176",u={field:nn,error:tn,message:sn,content:on,reveal:rn,label:an,tags:cn,chips:ln,input:un,counter:dn,empty:fn,disabled:_n,chip:mn,chipText:pn,remove:hn,invalid:xn};function yn({children:e,invalid:n,onRemove:s}){return t.jsxs("li",{className:[u.chip,n&&u.invalid].filter(Boolean).join(" "),children:[t.jsx("span",{className:u.chipText,children:e}),s&&t.jsx("button",{type:"button",className:u.remove,"aria-label":`Remove ${e}${n?" (invalid)":""}`,onClick:s,children:t.jsx(en,{})})]})}const L=100;function jn({label:e,value:n,onChange:s,disabled:i=!1,isTagInvalid:a,onInputChange:d,error:o}){const c=r.useId(),_=`${c}-message`,f=r.useRef(null),[h,V]=r.useState(""),q=n.length>=L,J=l=>{V(l),d?.(l)},N=l=>{const m=l.split(/[\s,]+/),O=m.pop()??"",j=m.filter(Boolean).slice(0,Math.max(0,L-n.length));j.length&&s([...n,...j]),J(O)},K=l=>{l.key==="Enter"&&h&&!l.nativeEvent.isComposing?(l.preventDefault(),N(`${h},`)):l.key==="Backspace"&&!h&&n.length&&s(n.slice(0,-1))},X=l=>{i||l.target===f.current||l.target.closest("button")||(l.preventDefault(),f.current?.focus())},G=[u.field,!n.length&&u.empty,i&&u.disabled,o&&u.error].filter(Boolean).join(" ");return t.jsxs("div",{children:[t.jsxs("div",{className:G,onMouseDown:X,children:[t.jsxs("div",{className:u.content,children:[t.jsx("label",{htmlFor:c,className:u.label,children:e}),t.jsx("div",{className:u.reveal,children:t.jsxs("div",{className:u.tags,children:[n.length>0&&t.jsx("ul",{role:"list",className:u.chips,children:n.map((l,m)=>t.jsx(yn,{invalid:a?.(l,m)??!1,onRemove:i?void 0:()=>{s(n.filter((O,j)=>j!==m)),m===n.length-1&&f.current?.focus()},children:l},m))}),t.jsx("input",{ref:f,id:c,className:u.input,size:1,value:h,disabled:i,readOnly:q,"aria-invalid":o?!0:void 0,"aria-describedby":o?_:void 0,onChange:l=>{N(l.target.value)},onKeyDown:K,onBlur:()=>{N(`${h},`)}})]})})]}),t.jsx("div",{className:u.reveal,children:t.jsxs("p",{className:u.counter,children:[n.length," / ",L]})})]}),t.jsx("p",{id:_,className:u.message,"aria-live":"polite",children:o})]})}const vn="_field_otub4_1",bn="_label_otub4_16",Nn="_reveal_otub4_27",gn="_input_otub4_37",Ln="_empty_otub4_56",x={field:vn,label:bn,reveal:Nn,input:gn,empty:Ln};function $n({label:e,value:n,onChange:s}){const i=r.useId(),a=r.useRef(null),d=o=>{o.target!==a.current&&(o.preventDefault(),a.current?.focus())};return t.jsxs("div",{className:[x.field,!n&&x.empty].filter(Boolean).join(" "),onMouseDown:d,children:[t.jsx("label",{htmlFor:i,className:x.label,children:e}),t.jsx("div",{className:x.reveal,children:t.jsx("div",{children:t.jsx("input",{ref:a,id:i,className:x.input,value:n,onChange:o=>{s(o.target.value)}})})})]})}exports.Button=$e;exports.H1=D;exports.H2=ne;exports.Hero=Ye;exports.Link=W;exports.LinkProvider=pe;exports.ListItem=k;exports.MultitagField=jn;exports.Paragraph=ie;exports.SideNav=Be;exports.SideNavLink=Ee;exports.TableOfContents=Ue;exports.TableOfContentsLink=C;exports.TextField=$n;exports.UnorderedList=ue;
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as s, jsxs as
|
|
3
|
-
import { Children as
|
|
4
|
-
const
|
|
5
|
-
h1:
|
|
2
|
+
import { jsx as s, jsxs as d } from "react/jsx-runtime";
|
|
3
|
+
import { Children as B, isValidElement as E, Fragment as A, createContext as $, useContext as w, useId as C, useRef as M, useState as tn } from "react";
|
|
4
|
+
const sn = "_h1_1765w_1", on = {
|
|
5
|
+
h1: sn
|
|
6
6
|
};
|
|
7
|
-
function
|
|
8
|
-
const t = [
|
|
7
|
+
function rn({ children: n, className: e }) {
|
|
8
|
+
const t = [on.h1, e].filter(Boolean).join(" ");
|
|
9
9
|
return /* @__PURE__ */ s("h1", { className: t, children: n });
|
|
10
10
|
}
|
|
11
|
-
const
|
|
12
|
-
h2:
|
|
11
|
+
const an = "_h2_1eque_1", cn = {
|
|
12
|
+
h2: an
|
|
13
13
|
};
|
|
14
|
-
function
|
|
15
|
-
return /* @__PURE__ */ s("h2", { className:
|
|
14
|
+
function ke({ children: n }) {
|
|
15
|
+
return /* @__PURE__ */ s("h2", { className: cn.h2, children: n });
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
paragraph:
|
|
17
|
+
const ln = "_paragraph_11t85_1", un = {
|
|
18
|
+
paragraph: ln
|
|
19
19
|
};
|
|
20
|
-
function
|
|
21
|
-
return /* @__PURE__ */ s("p", { className:
|
|
20
|
+
function Oe({ children: n }) {
|
|
21
|
+
return /* @__PURE__ */ s("p", { className: un.paragraph, children: n });
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
25
|
-
|
|
23
|
+
const R = typeof process < "u" && process.env.NODE_ENV !== "production", I = /* @__PURE__ */ new Set();
|
|
24
|
+
function T(n) {
|
|
25
|
+
I.has(n) || (I.add(n), console.warn(`[@smartyweb/ui] ${n}`));
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function dn(n) {
|
|
28
28
|
if (typeof n == "string") return `<${n}>`;
|
|
29
29
|
if (typeof n == "function") return `<${n.name || "Component"}>`;
|
|
30
30
|
if (typeof n == "object" && n !== null && "displayName" in n) {
|
|
@@ -33,147 +33,83 @@ function _n(n) {
|
|
|
33
33
|
}
|
|
34
34
|
return "an unknown element";
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
for (const t of
|
|
38
|
-
if (!
|
|
36
|
+
function W(n, e) {
|
|
37
|
+
for (const t of B.toArray(n)) {
|
|
38
|
+
if (!E(t)) {
|
|
39
39
|
if (typeof t != "string" && typeof t != "number") continue;
|
|
40
40
|
const i = String(t).trim();
|
|
41
41
|
if (i === "") continue;
|
|
42
|
-
|
|
42
|
+
T(
|
|
43
43
|
`<UnorderedList> received the text ${JSON.stringify(i.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
|
-
if (t.type ===
|
|
47
|
+
if (t.type === A) {
|
|
48
48
|
const { children: i } = t.props;
|
|
49
|
-
|
|
49
|
+
W(i, e);
|
|
50
50
|
continue;
|
|
51
51
|
}
|
|
52
|
-
e(t.type) || t.type === "li" ||
|
|
53
|
-
`<UnorderedList> received ${
|
|
52
|
+
e(t.type) || t.type === "li" || T(
|
|
53
|
+
`<UnorderedList> received ${dn(t.type)} as a direct child. A <ul> may only contain list items — wrap it in <ListItem>.`
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
|
|
57
|
+
function fn() {
|
|
58
|
+
T(
|
|
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
|
|
63
|
-
list:
|
|
64
|
-
item:
|
|
65
|
-
},
|
|
66
|
-
function
|
|
67
|
-
const e =
|
|
68
|
-
return
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function
|
|
72
|
-
return n ===
|
|
73
|
-
}
|
|
74
|
-
function
|
|
75
|
-
return
|
|
76
|
-
}
|
|
77
|
-
const
|
|
78
|
-
link:
|
|
79
|
-
accent:
|
|
80
|
-
disabled:
|
|
81
|
-
newTabNote:
|
|
82
|
-
},
|
|
83
|
-
function
|
|
62
|
+
const _n = "_list_1p627_1", mn = "_item_1p627_14", F = {
|
|
63
|
+
list: _n,
|
|
64
|
+
item: mn
|
|
65
|
+
}, z = $(!1);
|
|
66
|
+
function H({ children: n }) {
|
|
67
|
+
const e = w(z);
|
|
68
|
+
return R && !e && fn(), /* @__PURE__ */ s("li", { className: F.item, children: n });
|
|
69
|
+
}
|
|
70
|
+
H.isSmartyListItem = !0;
|
|
71
|
+
function pn(n) {
|
|
72
|
+
return n === H ? !0 : typeof n == "function" && n.isSmartyListItem === !0;
|
|
73
|
+
}
|
|
74
|
+
function Te({ children: n }) {
|
|
75
|
+
return R && W(n, pn), /* @__PURE__ */ s(z, { value: !0, children: /* @__PURE__ */ s("ul", { role: "list", className: F.list, children: n }) });
|
|
76
|
+
}
|
|
77
|
+
const hn = "_link_1m7hb_1", yn = "_accent_1m7hb_28", vn = "_disabled_1m7hb_38", bn = "_newTabNote_1m7hb_48", N = {
|
|
78
|
+
link: hn,
|
|
79
|
+
accent: yn,
|
|
80
|
+
disabled: vn,
|
|
81
|
+
newTabNote: bn
|
|
82
|
+
}, U = $(null);
|
|
83
|
+
function xe({ component: n, children: e }) {
|
|
84
|
+
return /* @__PURE__ */ s(U, { value: n, children: e });
|
|
85
|
+
}
|
|
86
|
+
function Nn() {
|
|
87
|
+
return w(U);
|
|
88
|
+
}
|
|
89
|
+
const gn = /\.[a-z][a-z\d]{1,4}$/;
|
|
90
|
+
function $n(n, e) {
|
|
84
91
|
if (e) return "download";
|
|
85
92
|
if (/^(https?:)?\/\//i.test(n)) return "external";
|
|
86
93
|
if (n.startsWith("#") || /^[a-z][a-z\d+.-]*:/i.test(n)) return "plain";
|
|
87
94
|
const t = (n.split(/[?#]/)[0] ?? "").toLowerCase();
|
|
88
|
-
return
|
|
89
|
-
}
|
|
90
|
-
function X() {
|
|
91
|
-
return /* @__PURE__ */ s("span", { className: $.newTabNote, children: " (opens in new tab)" });
|
|
92
|
-
}
|
|
93
|
-
const q = k(null);
|
|
94
|
-
function Te({ component: n, children: e }) {
|
|
95
|
-
return /* @__PURE__ */ s(q, { value: n, children: e });
|
|
95
|
+
return gn.test(t) ? "plain" : "router";
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
return
|
|
97
|
+
function wn() {
|
|
98
|
+
return /* @__PURE__ */ s("span", { className: N.newTabNote, children: " (opens in new tab)" });
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
primary: kn,
|
|
104
|
-
secondary: On,
|
|
105
|
-
negative: Tn
|
|
106
|
-
};
|
|
107
|
-
function xe({
|
|
108
|
-
as: n,
|
|
109
|
-
variant: e = "primary",
|
|
110
|
-
size: t = "default",
|
|
111
|
-
href: i,
|
|
112
|
-
openInNewTab: c = !1,
|
|
113
|
-
download: u = !1,
|
|
114
|
-
disabled: o,
|
|
115
|
-
type: d = "button",
|
|
116
|
-
onClick: f,
|
|
117
|
-
children: l
|
|
118
|
-
}) {
|
|
119
|
-
const m = G(), g = [T.button, T[e], t === "sm" && T.sm].filter(Boolean).join(" ");
|
|
120
|
-
if (i === void 0 || o)
|
|
121
|
-
return /* @__PURE__ */ s("button", { className: g, type: d, disabled: o, onClick: f, children: l });
|
|
122
|
-
const v = K(i, u), p = v === "external" || c && v !== "download";
|
|
123
|
-
return (
|
|
124
|
-
// The router link comes from context, set once at the app root, so it keeps its
|
|
125
|
-
// identity across renders — the remount this rule guards against cannot happen.
|
|
126
|
-
// eslint-disable-next-line react-hooks/static-components
|
|
127
|
-
/* @__PURE__ */ _(
|
|
128
|
-
n ?? (v === "router" && m ? m : "a"),
|
|
129
|
-
{
|
|
130
|
-
className: g,
|
|
131
|
-
href: i,
|
|
132
|
-
target: p ? "_blank" : void 0,
|
|
133
|
-
rel: p ? "noopener noreferrer" : void 0,
|
|
134
|
-
download: v === "download" ? "" : void 0,
|
|
135
|
-
onClick: f,
|
|
136
|
-
children: [
|
|
137
|
-
l,
|
|
138
|
-
p && /* @__PURE__ */ s(X, {})
|
|
139
|
-
]
|
|
140
|
-
}
|
|
141
|
-
)
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
function xn({
|
|
145
|
-
variant: n = "default",
|
|
146
|
-
href: e,
|
|
147
|
-
download: t = !1,
|
|
148
|
-
disabled: i,
|
|
149
|
-
onClick: c,
|
|
150
|
-
children: u
|
|
151
|
-
}) {
|
|
152
|
-
const o = G(), f = [$.link, n === "accent" && $.accent, i && $.disabled].filter(Boolean).join(" ");
|
|
153
|
-
if (e === void 0)
|
|
154
|
-
return /* @__PURE__ */ s(
|
|
155
|
-
"button",
|
|
156
|
-
{
|
|
157
|
-
type: "button",
|
|
158
|
-
className: f,
|
|
159
|
-
disabled: i,
|
|
160
|
-
onClick: i ? void 0 : c,
|
|
161
|
-
"aria-disabled": i,
|
|
162
|
-
children: u
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
const l = K(e, t);
|
|
166
|
-
return l === "external" ? /* @__PURE__ */ _(
|
|
100
|
+
function V({ className: n, href: e, download: t = !1, onClick: i, children: r }) {
|
|
101
|
+
const u = Nn(), o = $n(e, t);
|
|
102
|
+
return o === "external" ? /* @__PURE__ */ d(
|
|
167
103
|
"a",
|
|
168
104
|
{
|
|
169
|
-
className:
|
|
105
|
+
className: n,
|
|
170
106
|
href: e,
|
|
171
107
|
target: "_blank",
|
|
172
108
|
rel: "noopener noreferrer",
|
|
173
|
-
onClick:
|
|
109
|
+
onClick: i,
|
|
174
110
|
children: [
|
|
175
|
-
|
|
176
|
-
/* @__PURE__ */ s(
|
|
111
|
+
r,
|
|
112
|
+
/* @__PURE__ */ s(wn, {})
|
|
177
113
|
]
|
|
178
114
|
}
|
|
179
115
|
) : (
|
|
@@ -181,61 +117,102 @@ function xn({
|
|
|
181
117
|
// identity across renders — the remount this rule guards against cannot happen.
|
|
182
118
|
// eslint-disable-next-line react-hooks/static-components
|
|
183
119
|
/* @__PURE__ */ s(
|
|
184
|
-
|
|
120
|
+
o === "router" && u ? u : "a",
|
|
185
121
|
{
|
|
186
|
-
className:
|
|
122
|
+
className: n,
|
|
187
123
|
href: e,
|
|
188
|
-
download:
|
|
189
|
-
onClick:
|
|
190
|
-
children:
|
|
124
|
+
download: o === "download" ? "" : void 0,
|
|
125
|
+
onClick: i,
|
|
126
|
+
children: r
|
|
191
127
|
}
|
|
192
128
|
)
|
|
193
129
|
);
|
|
194
130
|
}
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
131
|
+
const Ln = "_button_1391k_1", kn = "_sm_1391k_26", On = "_primary_1391k_33", Tn = "_secondary_1391k_49", xn = "_negative_1391k_68", k = {
|
|
132
|
+
button: Ln,
|
|
133
|
+
sm: kn,
|
|
134
|
+
primary: On,
|
|
135
|
+
secondary: Tn,
|
|
136
|
+
negative: xn
|
|
137
|
+
};
|
|
138
|
+
function Ce({
|
|
139
|
+
variant: n = "primary",
|
|
140
|
+
size: e = "default",
|
|
141
|
+
href: t,
|
|
142
|
+
download: i,
|
|
143
|
+
disabled: r,
|
|
144
|
+
type: u = "button",
|
|
145
|
+
onClick: o,
|
|
146
|
+
children: c
|
|
147
|
+
}) {
|
|
148
|
+
const f = [k.button, k[n], e === "sm" && k.sm].filter(Boolean).join(" ");
|
|
149
|
+
return t === void 0 || r ? /* @__PURE__ */ s("button", { className: f, type: u, disabled: r, onClick: o, children: c }) : /* @__PURE__ */ s(V, { className: f, href: t, download: i, onClick: o, children: c });
|
|
198
150
|
}
|
|
199
|
-
function
|
|
200
|
-
|
|
151
|
+
function Cn({
|
|
152
|
+
variant: n = "default",
|
|
153
|
+
href: e,
|
|
154
|
+
download: t,
|
|
155
|
+
disabled: i,
|
|
156
|
+
onClick: r,
|
|
157
|
+
children: u
|
|
158
|
+
}) {
|
|
159
|
+
const c = [N.link, n === "accent" && N.accent, i && N.disabled].filter(Boolean).join(" ");
|
|
160
|
+
return e === void 0 ? /* @__PURE__ */ s(
|
|
161
|
+
"button",
|
|
162
|
+
{
|
|
163
|
+
type: "button",
|
|
164
|
+
className: c,
|
|
165
|
+
disabled: i,
|
|
166
|
+
onClick: i ? void 0 : r,
|
|
167
|
+
"aria-disabled": i,
|
|
168
|
+
children: u
|
|
169
|
+
}
|
|
170
|
+
) : /* @__PURE__ */ s(V, { className: c, href: e, download: t, onClick: r, children: u });
|
|
171
|
+
}
|
|
172
|
+
const jn = typeof process < "u" && process.env.NODE_ENV !== "production", S = /* @__PURE__ */ new Set();
|
|
173
|
+
function In(n) {
|
|
174
|
+
S.has(n) || (S.add(n), console.warn(`[@smartyweb/ui] ${n}`));
|
|
175
|
+
}
|
|
176
|
+
function Sn() {
|
|
177
|
+
In(
|
|
201
178
|
"<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."
|
|
202
179
|
);
|
|
203
180
|
}
|
|
204
|
-
const
|
|
205
|
-
nav:
|
|
206
|
-
list:
|
|
207
|
-
item:
|
|
208
|
-
link:
|
|
181
|
+
const Dn = "_nav_dxkjl_3", Bn = "_list_dxkjl_7", En = "_item_dxkjl_16", An = "_link_dxkjl_20", Mn = "_current_dxkjl_48", v = {
|
|
182
|
+
nav: Dn,
|
|
183
|
+
list: Bn,
|
|
184
|
+
item: En,
|
|
185
|
+
link: An,
|
|
209
186
|
current: Mn
|
|
210
|
-
},
|
|
211
|
-
function
|
|
212
|
-
return
|
|
187
|
+
}, P = $(null);
|
|
188
|
+
function je({ label: n, current: e, children: t }) {
|
|
189
|
+
return jn && !n?.trim() && Sn(), /* @__PURE__ */ s("nav", { className: v.nav, "aria-label": n, children: /* @__PURE__ */ s(P, { value: e ?? null, children: /* @__PURE__ */ s("ul", { className: v.list, children: t }) }) });
|
|
213
190
|
}
|
|
214
|
-
function
|
|
191
|
+
function Ie({
|
|
215
192
|
as: n = "a",
|
|
216
193
|
href: e,
|
|
217
194
|
current: t,
|
|
218
195
|
openInNewTab: i,
|
|
219
|
-
onClick:
|
|
196
|
+
onClick: r,
|
|
220
197
|
children: u
|
|
221
198
|
}) {
|
|
222
|
-
const o =
|
|
223
|
-
return /* @__PURE__ */ s("li", { className:
|
|
199
|
+
const o = w(P), c = t ?? (o !== null && o === e), _ = [v.link, c && v.current].filter(Boolean).join(" ");
|
|
200
|
+
return /* @__PURE__ */ s("li", { className: v.item, children: /* @__PURE__ */ s(
|
|
224
201
|
n,
|
|
225
202
|
{
|
|
226
|
-
className:
|
|
203
|
+
className: _,
|
|
227
204
|
href: e,
|
|
228
205
|
target: i ? "_blank" : void 0,
|
|
229
206
|
rel: i ? "noopener noreferrer" : void 0,
|
|
230
|
-
onClick:
|
|
231
|
-
"aria-current":
|
|
207
|
+
onClick: r,
|
|
208
|
+
"aria-current": c ? "location" : void 0,
|
|
232
209
|
children: u
|
|
233
210
|
}
|
|
234
211
|
) });
|
|
235
212
|
}
|
|
236
|
-
const
|
|
237
|
-
function
|
|
238
|
-
|
|
213
|
+
const J = typeof process < "u" && process.env.NODE_ENV !== "production", D = /* @__PURE__ */ new Set();
|
|
214
|
+
function x(n) {
|
|
215
|
+
D.has(n) || (D.add(n), console.warn(`[@smartyweb/ui] ${n}`));
|
|
239
216
|
}
|
|
240
217
|
function Rn(n) {
|
|
241
218
|
if (typeof n == "string") return `<${n}>`;
|
|
@@ -246,81 +223,81 @@ function Rn(n) {
|
|
|
246
223
|
}
|
|
247
224
|
return "an unknown element";
|
|
248
225
|
}
|
|
249
|
-
function
|
|
250
|
-
for (const t of
|
|
251
|
-
if (!
|
|
226
|
+
function K(n, e) {
|
|
227
|
+
for (const t of B.toArray(n)) {
|
|
228
|
+
if (!E(t)) {
|
|
252
229
|
if (typeof t != "string" && typeof t != "number") continue;
|
|
253
230
|
const i = String(t).trim();
|
|
254
231
|
if (i === "") continue;
|
|
255
|
-
|
|
232
|
+
x(
|
|
256
233
|
`<TableOfContents> received the text ${JSON.stringify(i.slice(0, 40))} as a direct child. Its list may only contain entries — wrap it in <TableOfContentsLink href="#…">.`
|
|
257
234
|
);
|
|
258
235
|
continue;
|
|
259
236
|
}
|
|
260
|
-
if (t.type ===
|
|
237
|
+
if (t.type === A) {
|
|
261
238
|
const { children: i } = t.props;
|
|
262
|
-
|
|
239
|
+
K(i, e);
|
|
263
240
|
continue;
|
|
264
241
|
}
|
|
265
|
-
e(t.type) || t.type === "li" ||
|
|
242
|
+
e(t.type) || t.type === "li" || x(
|
|
266
243
|
`<TableOfContents> received ${Rn(t.type)} as a direct child. Its list may only contain entries — use <TableOfContentsLink href="#…"> instead.`
|
|
267
244
|
);
|
|
268
245
|
}
|
|
269
246
|
}
|
|
270
|
-
function
|
|
271
|
-
|
|
247
|
+
function Wn() {
|
|
248
|
+
x(
|
|
272
249
|
"<TableOfContentsLink> was rendered outside of a <TableOfContents>. It renders an <li>, which browsers only style correctly inside a list."
|
|
273
250
|
);
|
|
274
251
|
}
|
|
275
|
-
const
|
|
276
|
-
nav:
|
|
277
|
-
heading:
|
|
278
|
-
list:
|
|
279
|
-
item:
|
|
280
|
-
},
|
|
281
|
-
function
|
|
282
|
-
const t =
|
|
283
|
-
return
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
function
|
|
287
|
-
return n ===
|
|
288
|
-
}
|
|
289
|
-
function
|
|
290
|
-
const t =
|
|
291
|
-
return
|
|
292
|
-
/* @__PURE__ */ s("h2", { id: t, className:
|
|
293
|
-
/* @__PURE__ */ s(
|
|
252
|
+
const Fn = "_nav_1us0j_1", zn = "_heading_1us0j_8", Hn = "_list_1us0j_19", Un = "_item_1us0j_28", g = {
|
|
253
|
+
nav: Fn,
|
|
254
|
+
heading: zn,
|
|
255
|
+
list: Hn,
|
|
256
|
+
item: Un
|
|
257
|
+
}, X = $(!1);
|
|
258
|
+
function q({ href: n, children: e }) {
|
|
259
|
+
const t = w(X);
|
|
260
|
+
return J && !t && Wn(), /* @__PURE__ */ s("li", { className: g.item, children: /* @__PURE__ */ s(Cn, { href: n, children: e }) });
|
|
261
|
+
}
|
|
262
|
+
q.isSmartyTableOfContentsLink = !0;
|
|
263
|
+
function Vn(n) {
|
|
264
|
+
return n === q ? !0 : typeof n == "function" && n.isSmartyTableOfContentsLink === !0;
|
|
265
|
+
}
|
|
266
|
+
function Se({ title: n = "Table of contents", children: e }) {
|
|
267
|
+
const t = C();
|
|
268
|
+
return J && K(e, Vn), /* @__PURE__ */ d("nav", { className: g.nav, "aria-labelledby": t, children: [
|
|
269
|
+
/* @__PURE__ */ s("h2", { id: t, className: g.heading, children: n }),
|
|
270
|
+
/* @__PURE__ */ s(X, { value: !0, children: /* @__PURE__ */ s("ul", { role: "list", className: g.list, children: e }) })
|
|
294
271
|
] });
|
|
295
272
|
}
|
|
296
|
-
const
|
|
297
|
-
hero:
|
|
298
|
-
layout:
|
|
299
|
-
content:
|
|
300
|
-
titleLine:
|
|
301
|
-
titleWord:
|
|
302
|
-
description:
|
|
303
|
-
media:
|
|
273
|
+
const Pn = "_hero_93692_11", Jn = "_layout_93692_16", Kn = "_content_93692_21", Xn = "_titleLine_93692_25", qn = "_titleWord_93692_29", Gn = "_description_93692_35", Zn = "_media_93692_48", p = {
|
|
274
|
+
hero: Pn,
|
|
275
|
+
layout: Jn,
|
|
276
|
+
content: Kn,
|
|
277
|
+
titleLine: Xn,
|
|
278
|
+
titleWord: qn,
|
|
279
|
+
description: Gn,
|
|
280
|
+
media: Zn
|
|
304
281
|
};
|
|
305
|
-
function
|
|
282
|
+
function Qn(n) {
|
|
306
283
|
return n.replace(/([- ])/g, (e) => `${e === " " ? " " : e}|split|`).split("|split|");
|
|
307
284
|
}
|
|
308
|
-
const
|
|
309
|
-
function
|
|
285
|
+
const Yn = (n) => ({ "--hero-index": n });
|
|
286
|
+
function De({ title: n, description: e, media: t }) {
|
|
310
287
|
const i = Array.isArray(n);
|
|
311
|
-
let
|
|
288
|
+
let r = 0;
|
|
312
289
|
const u = (i ? n : [n]).map(
|
|
313
|
-
(o) =>
|
|
290
|
+
(o) => Qn(o).map((c) => ({ word: c, index: r++ }))
|
|
314
291
|
);
|
|
315
|
-
return /* @__PURE__ */ s("section", { className:
|
|
316
|
-
/* @__PURE__ */ s("div", { className:
|
|
317
|
-
/* @__PURE__ */
|
|
318
|
-
/* @__PURE__ */ s(
|
|
319
|
-
/* @__PURE__ */ s("p", { className:
|
|
292
|
+
return /* @__PURE__ */ s("section", { className: p.hero, children: /* @__PURE__ */ d("div", { className: p.layout, children: [
|
|
293
|
+
/* @__PURE__ */ s("div", { className: p.media, children: t }),
|
|
294
|
+
/* @__PURE__ */ d("div", { className: p.content, children: [
|
|
295
|
+
/* @__PURE__ */ s(rn, { children: u.map((o, c) => /* @__PURE__ */ s("span", { className: i ? p.titleLine : void 0, children: o.map(({ word: _, index: f }) => /* @__PURE__ */ s("span", { className: p.titleWord, style: Yn(f), children: _ }, f)) }, c)) }),
|
|
296
|
+
/* @__PURE__ */ s("p", { className: p.description, children: e })
|
|
320
297
|
] })
|
|
321
298
|
] }) });
|
|
322
299
|
}
|
|
323
|
-
function
|
|
300
|
+
function ne() {
|
|
324
301
|
return /* @__PURE__ */ s("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ s(
|
|
325
302
|
"path",
|
|
326
303
|
{
|
|
@@ -331,136 +308,136 @@ function Yn() {
|
|
|
331
308
|
}
|
|
332
309
|
) });
|
|
333
310
|
}
|
|
334
|
-
const
|
|
335
|
-
field:
|
|
336
|
-
error:
|
|
337
|
-
message:
|
|
338
|
-
content:
|
|
339
|
-
reveal:
|
|
340
|
-
label:
|
|
341
|
-
tags:
|
|
342
|
-
chips:
|
|
343
|
-
input:
|
|
344
|
-
counter:
|
|
345
|
-
empty:
|
|
346
|
-
disabled:
|
|
347
|
-
chip:
|
|
348
|
-
chipText:
|
|
349
|
-
remove:
|
|
350
|
-
invalid:
|
|
311
|
+
const ee = "_field_14suf_1", te = "_error_14suf_17", se = "_message_14suf_21", ie = "_content_14suf_36", oe = "_reveal_14suf_43", re = "_label_14suf_53", ae = "_tags_14suf_64", ce = "_chips_14suf_71", le = "_input_14suf_78", ue = "_counter_14suf_95", de = "_empty_14suf_107", fe = "_disabled_14suf_134", _e = "_chip_14suf_71", me = "_chipText_14suf_160", pe = "_remove_14suf_165", he = "_invalid_14suf_176", l = {
|
|
312
|
+
field: ee,
|
|
313
|
+
error: te,
|
|
314
|
+
message: se,
|
|
315
|
+
content: ie,
|
|
316
|
+
reveal: oe,
|
|
317
|
+
label: re,
|
|
318
|
+
tags: ae,
|
|
319
|
+
chips: ce,
|
|
320
|
+
input: le,
|
|
321
|
+
counter: ue,
|
|
322
|
+
empty: de,
|
|
323
|
+
disabled: fe,
|
|
324
|
+
chip: _e,
|
|
325
|
+
chipText: me,
|
|
326
|
+
remove: pe,
|
|
327
|
+
invalid: he
|
|
351
328
|
};
|
|
352
|
-
function
|
|
353
|
-
return /* @__PURE__ */
|
|
354
|
-
/* @__PURE__ */ s("span", { className:
|
|
329
|
+
function ye({ children: n, invalid: e, onRemove: t }) {
|
|
330
|
+
return /* @__PURE__ */ d("li", { className: [l.chip, e && l.invalid].filter(Boolean).join(" "), children: [
|
|
331
|
+
/* @__PURE__ */ s("span", { className: l.chipText, children: n }),
|
|
355
332
|
t && /* @__PURE__ */ s(
|
|
356
333
|
"button",
|
|
357
334
|
{
|
|
358
335
|
type: "button",
|
|
359
|
-
className:
|
|
336
|
+
className: l.remove,
|
|
360
337
|
"aria-label": `Remove ${n}${e ? " (invalid)" : ""}`,
|
|
361
338
|
onClick: t,
|
|
362
|
-
children: /* @__PURE__ */ s(
|
|
339
|
+
children: /* @__PURE__ */ s(ne, {})
|
|
363
340
|
}
|
|
364
341
|
)
|
|
365
342
|
] });
|
|
366
343
|
}
|
|
367
|
-
const
|
|
368
|
-
function
|
|
344
|
+
const O = 100;
|
|
345
|
+
function Be({
|
|
369
346
|
label: n,
|
|
370
347
|
value: e,
|
|
371
348
|
onChange: t,
|
|
372
349
|
disabled: i = !1,
|
|
373
|
-
isTagInvalid:
|
|
350
|
+
isTagInvalid: r,
|
|
374
351
|
onInputChange: u,
|
|
375
352
|
error: o
|
|
376
353
|
}) {
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
},
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
},
|
|
383
|
-
|
|
384
|
-
},
|
|
385
|
-
i ||
|
|
386
|
-
},
|
|
387
|
-
|
|
388
|
-
!e.length &&
|
|
389
|
-
i &&
|
|
390
|
-
o &&
|
|
354
|
+
const c = C(), _ = `${c}-message`, f = M(null), [h, G] = tn(""), Z = e.length >= O, Q = (a) => {
|
|
355
|
+
G(a), u?.(a);
|
|
356
|
+
}, L = (a) => {
|
|
357
|
+
const m = a.split(/[\s,]+/), j = m.pop() ?? "", b = m.filter(Boolean).slice(0, Math.max(0, O - e.length));
|
|
358
|
+
b.length && t([...e, ...b]), Q(j);
|
|
359
|
+
}, Y = (a) => {
|
|
360
|
+
a.key === "Enter" && h && !a.nativeEvent.isComposing ? (a.preventDefault(), L(`${h},`)) : a.key === "Backspace" && !h && e.length && t(e.slice(0, -1));
|
|
361
|
+
}, nn = (a) => {
|
|
362
|
+
i || a.target === f.current || a.target.closest("button") || (a.preventDefault(), f.current?.focus());
|
|
363
|
+
}, en = [
|
|
364
|
+
l.field,
|
|
365
|
+
!e.length && l.empty,
|
|
366
|
+
i && l.disabled,
|
|
367
|
+
o && l.error
|
|
391
368
|
].filter(Boolean).join(" ");
|
|
392
|
-
return /* @__PURE__ */
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
/* @__PURE__ */
|
|
395
|
-
/* @__PURE__ */ s("label", { htmlFor:
|
|
396
|
-
/* @__PURE__ */ s("div", { className:
|
|
397
|
-
e.length > 0 && /* @__PURE__ */ s("ul", { role: "list", className:
|
|
398
|
-
|
|
369
|
+
return /* @__PURE__ */ d("div", { children: [
|
|
370
|
+
/* @__PURE__ */ d("div", { className: en, onMouseDown: nn, children: [
|
|
371
|
+
/* @__PURE__ */ d("div", { className: l.content, children: [
|
|
372
|
+
/* @__PURE__ */ s("label", { htmlFor: c, className: l.label, children: n }),
|
|
373
|
+
/* @__PURE__ */ s("div", { className: l.reveal, children: /* @__PURE__ */ d("div", { className: l.tags, children: [
|
|
374
|
+
e.length > 0 && /* @__PURE__ */ s("ul", { role: "list", className: l.chips, children: e.map((a, m) => /* @__PURE__ */ s(
|
|
375
|
+
ye,
|
|
399
376
|
{
|
|
400
|
-
invalid:
|
|
377
|
+
invalid: r?.(a, m) ?? !1,
|
|
401
378
|
onRemove: i ? void 0 : () => {
|
|
402
|
-
t(e.filter((
|
|
379
|
+
t(e.filter((j, b) => b !== m)), m === e.length - 1 && f.current?.focus();
|
|
403
380
|
},
|
|
404
|
-
children:
|
|
381
|
+
children: a
|
|
405
382
|
},
|
|
406
|
-
|
|
383
|
+
m
|
|
407
384
|
)) }),
|
|
408
385
|
/* @__PURE__ */ s(
|
|
409
386
|
"input",
|
|
410
387
|
{
|
|
411
|
-
ref:
|
|
412
|
-
id:
|
|
413
|
-
className:
|
|
388
|
+
ref: f,
|
|
389
|
+
id: c,
|
|
390
|
+
className: l.input,
|
|
414
391
|
size: 1,
|
|
415
|
-
value:
|
|
392
|
+
value: h,
|
|
416
393
|
disabled: i,
|
|
417
|
-
readOnly:
|
|
394
|
+
readOnly: Z,
|
|
418
395
|
"aria-invalid": o ? !0 : void 0,
|
|
419
|
-
"aria-describedby": o ?
|
|
420
|
-
onChange: (
|
|
421
|
-
|
|
396
|
+
"aria-describedby": o ? _ : void 0,
|
|
397
|
+
onChange: (a) => {
|
|
398
|
+
L(a.target.value);
|
|
422
399
|
},
|
|
423
|
-
onKeyDown:
|
|
400
|
+
onKeyDown: Y,
|
|
424
401
|
onBlur: () => {
|
|
425
|
-
|
|
402
|
+
L(`${h},`);
|
|
426
403
|
}
|
|
427
404
|
}
|
|
428
405
|
)
|
|
429
406
|
] }) })
|
|
430
407
|
] }),
|
|
431
|
-
/* @__PURE__ */ s("div", { className:
|
|
408
|
+
/* @__PURE__ */ s("div", { className: l.reveal, children: /* @__PURE__ */ d("p", { className: l.counter, children: [
|
|
432
409
|
e.length,
|
|
433
410
|
" / ",
|
|
434
|
-
|
|
411
|
+
O
|
|
435
412
|
] }) })
|
|
436
413
|
] }),
|
|
437
|
-
/* @__PURE__ */ s("p", { id:
|
|
414
|
+
/* @__PURE__ */ s("p", { id: _, className: l.message, "aria-live": "polite", children: o })
|
|
438
415
|
] });
|
|
439
416
|
}
|
|
440
|
-
const
|
|
441
|
-
field:
|
|
442
|
-
label:
|
|
443
|
-
reveal:
|
|
444
|
-
input:
|
|
445
|
-
empty:
|
|
417
|
+
const ve = "_field_otub4_1", be = "_label_otub4_16", Ne = "_reveal_otub4_27", ge = "_input_otub4_37", $e = "_empty_otub4_56", y = {
|
|
418
|
+
field: ve,
|
|
419
|
+
label: be,
|
|
420
|
+
reveal: Ne,
|
|
421
|
+
input: ge,
|
|
422
|
+
empty: $e
|
|
446
423
|
};
|
|
447
|
-
function
|
|
448
|
-
const i =
|
|
449
|
-
o.target !==
|
|
424
|
+
function Ee({ label: n, value: e, onChange: t }) {
|
|
425
|
+
const i = C(), r = M(null), u = (o) => {
|
|
426
|
+
o.target !== r.current && (o.preventDefault(), r.current?.focus());
|
|
450
427
|
};
|
|
451
|
-
return /* @__PURE__ */
|
|
428
|
+
return /* @__PURE__ */ d(
|
|
452
429
|
"div",
|
|
453
430
|
{
|
|
454
|
-
className: [
|
|
431
|
+
className: [y.field, !e && y.empty].filter(Boolean).join(" "),
|
|
455
432
|
onMouseDown: u,
|
|
456
433
|
children: [
|
|
457
|
-
/* @__PURE__ */ s("label", { htmlFor: i, className:
|
|
458
|
-
/* @__PURE__ */ s("div", { className:
|
|
434
|
+
/* @__PURE__ */ s("label", { htmlFor: i, className: y.label, children: n }),
|
|
435
|
+
/* @__PURE__ */ s("div", { className: y.reveal, children: /* @__PURE__ */ s("div", { children: /* @__PURE__ */ s(
|
|
459
436
|
"input",
|
|
460
437
|
{
|
|
461
|
-
ref:
|
|
438
|
+
ref: r,
|
|
462
439
|
id: i,
|
|
463
|
-
className:
|
|
440
|
+
className: y.input,
|
|
464
441
|
value: e,
|
|
465
442
|
onChange: (o) => {
|
|
466
443
|
t(o.target.value);
|
|
@@ -472,19 +449,19 @@ function Be({ label: n, value: e, onChange: t }) {
|
|
|
472
449
|
);
|
|
473
450
|
}
|
|
474
451
|
export {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
452
|
+
Ce as Button,
|
|
453
|
+
rn as H1,
|
|
454
|
+
ke as H2,
|
|
455
|
+
De as Hero,
|
|
456
|
+
Cn as Link,
|
|
457
|
+
xe as LinkProvider,
|
|
458
|
+
H as ListItem,
|
|
459
|
+
Be as MultitagField,
|
|
460
|
+
Oe as Paragraph,
|
|
461
|
+
je as SideNav,
|
|
462
|
+
Ie as SideNavLink,
|
|
463
|
+
Se as TableOfContents,
|
|
464
|
+
q as TableOfContentsLink,
|
|
465
|
+
Ee as TextField,
|
|
466
|
+
Te as UnorderedList
|
|
490
467
|
};
|