@sanity/sanity-id 0.1.0 → 0.1.1

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.
@@ -1,55 +1 @@
1
- "use client";
2
- import { jsx as a } from "react/jsx-runtime";
3
- import { c as o } from "./clsx-OuTLNxxd.js";
4
- import { useState as u, useEffect as m, Suspense as f } from "react";
5
- import { usePathname as h, useSearchParams as _ } from "next/navigation";
6
- import { L as p } from "./Link-Nwcy0Qhp.js";
7
- function q(r) {
8
- const [e, t] = u(!1), n = h(), c = _();
9
- return m(() => {
10
- if (!r) {
11
- t(!1);
12
- return;
13
- }
14
- if (!URL.canParse?.(r, location.origin)) {
15
- t(!1);
16
- return;
17
- }
18
- const i = new URL(r, location.origin);
19
- if (i.pathname !== n) {
20
- t(!1);
21
- return;
22
- }
23
- const l = c?.toString();
24
- if (i.searchParams.toString() !== l) {
25
- t(!1);
26
- return;
27
- }
28
- t(!0);
29
- }, [r, n, c]), e;
30
- }
31
- function S({ active: r, ...e }) {
32
- let t = e["aria-current"];
33
- const n = q(e.href);
34
- return t ??= n || r ? "page" : "false", /* @__PURE__ */ a(p, { ...e, "aria-current": t });
35
- }
36
- const d = "_nav_pqq36_1", g = "_list_pqq36_5", v = "_listItem_pqq36_9", N = "_link_pqq36_15", s = {
37
- nav: d,
38
- list: g,
39
- listItem: v,
40
- link: N
41
- };
42
- function C(r) {
43
- return /* @__PURE__ */ a("nav", { "aria-label": r.label, className: o(r.className, s.nav), children: /* @__PURE__ */ a("ol", { className: s.list, children: r.links.map((e) => /* @__PURE__ */ a("li", { className: s.listItem, children: /* @__PURE__ */ a(f, { children: /* @__PURE__ */ a(
44
- S,
45
- {
46
- href: e.href,
47
- "aria-current": e.current ? "page" : void 0,
48
- className: s.link,
49
- children: e.title
50
- }
51
- ) }) }, e.href + e.title)) }) });
52
- }
53
- export {
54
- C as Breadcrumbs
55
- };
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("./clsx-C11secjj.js"),n=require("./Link-zm9qxqps.js"),a="_nav_pqq36_1",c="_list_pqq36_5",r="_listItem_pqq36_9",m="_link_pqq36_15",t={nav:a,list:c,listItem:r,link:m};function o(l){return s.jsx("nav",{"aria-label":l.label,className:i.clsx(l.className,t.nav),children:s.jsx("ol",{className:t.list,children:l.links.map(e=>s.jsx("li",{className:t.listItem,children:s.jsx(n.Link,{href:e.href,"aria-current":e.current?"page":void 0,className:t.link,children:e.title})},e.href+e.title))})})}exports.Breadcrumbs=o;
package/dist/Button.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { default as default_2 } from 'react';
2
- import { default as default_3 } from 'next/link';
1
+ import { default as default_2 } from 'next/link';
3
2
  import { IconSymbol } from '@sanity/icons';
4
3
  import { JSX } from 'react/jsx-runtime';
5
4
 
@@ -29,7 +28,7 @@ export declare namespace Button {
29
28
  declare function Link({ href, target, prefetch, ...props }: Link.Props): JSX.Element;
30
29
 
31
30
  declare namespace Link {
32
- type Props = Omit<default_2.ComponentProps<typeof default_3>, "prefetch" | "href"> & {
31
+ type Props = Omit<React.ComponentProps<typeof default_2>, "prefetch" | "href"> & {
33
32
  prefetch?: boolean | null | "hover";
34
33
  href?: string;
35
34
  };
package/dist/Button.js CHANGED
@@ -1,53 +1 @@
1
- "use client";
2
- import { jsxs as y, jsx as o } from "react/jsx-runtime";
3
- import { c as l } from "./clsx-OuTLNxxd.js";
4
- import { L as x } from "./Link-Nwcy0Qhp.js";
5
- import { S as _ } from "./SanityIcon-D1oKyiRW.js";
6
- import { u as N } from "./useLinkWithRef-D_gJ65VG.js";
7
- const k = "_button_1x1xj_1", v = "_icon_1x1xj_7", S = "_iconLeft_1x1xj_200", W = "_iconRight_1x1xj_204", i = {
8
- button: k,
9
- icon: v,
10
- iconLeft: S,
11
- iconRight: W
12
- };
13
- function q({
14
- as: a,
15
- size: f,
16
- fill: c,
17
- color: m,
18
- state: d,
19
- iconLeft: e,
20
- iconRight: t,
21
- children: u,
22
- rounded: b,
23
- injectRef: j = !0,
24
- disableLinkRef: p = !1,
25
- ...s
26
- }) {
27
- let r = s.href;
28
- const h = N(s.href);
29
- j && !p && (r = h), f ??= "md", c ??= "solid", m ??= "primary", d === "loading" && (e && !t ? e = "spinner" : t && !e ? t = "spinner" : e = "spinner"), typeof e == "string" && (e = /* @__PURE__ */ o(_, { icon: e })), typeof t == "string" && (t = /* @__PURE__ */ o(_, { icon: t }));
30
- let n = "div";
31
- return a === "a" ? n = x : a === "external" ? n = "a" : a ? n = a : r ? n = x : s.onClick && (n = "button"), /* @__PURE__ */ y(
32
- n,
33
- {
34
- ...s,
35
- className: l(i.button, s.className),
36
- "data-size": f,
37
- "data-fill": c,
38
- "data-color": m,
39
- "data-state": d,
40
- "data-rounded": b,
41
- "data-no-label": u ? void 0 : !0,
42
- href: r,
43
- children: [
44
- e && /* @__PURE__ */ o("span", { className: l(i.icon, i.iconLeft), children: e }),
45
- u,
46
- t && /* @__PURE__ */ o("span", { className: l(i.icon, i.iconRight), children: t })
47
- ]
48
- }
49
- );
50
- }
51
- export {
52
- q as Button
53
- };
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),o=require("./clsx-C11secjj.js"),_=require("./Link-zm9qxqps.js"),j=require("./SanityIcon-D4sDJgMO.js"),k=require("./useLinkWithRef-Bt1HfBJb.js"),q="_button_1x1xj_1",S="_icon_1x1xj_7",N="_iconLeft_1x1xj_200",v="_iconRight_1x1xj_204",a={button:q,icon:S,iconLeft:N,iconRight:v};function I({as:c,size:r,fill:u,color:f,state:x,iconLeft:e,iconRight:n,children:d,rounded:m,injectRef:b=!0,disableLinkRef:y=!1,...s}){let l=s.href;const h=k.useLinkWithRef(s.href);b&&!y&&(l=h),r??="md",u??="solid",f??="primary",x==="loading"&&(e&&!n?e="spinner":n&&!e?n="spinner":e="spinner"),typeof e=="string"&&(e=i.jsx(j.SanityIcon,{icon:e})),typeof n=="string"&&(n=i.jsx(j.SanityIcon,{icon:n}));let t="div";return c==="a"?t=_.Link:c==="external"?t="a":c?t=c:l?t=_.Link:s.onClick&&(t="button"),i.jsxs(t,{...s,className:o.clsx(a.button,s.className),"data-size":r,"data-fill":u,"data-color":f,"data-state":x,"data-rounded":m,"data-no-label":d?void 0:!0,href:l,children:[e&&i.jsx("span",{className:o.clsx(a.icon,a.iconLeft),children:e}),d,n&&i.jsx("span",{className:o.clsx(a.icon,a.iconRight),children:n})]})}exports.Button=I;
package/dist/Card.js CHANGED
@@ -1,16 +1 @@
1
- import { c as o } from "./clsx-OuTLNxxd.js";
2
- import { Children as a, cloneElement as e } from "react";
3
- const n = "_card_7gri7_1", t = {
4
- card: n
5
- };
6
- function i(r) {
7
- const c = a.only(r.children), d = c.props;
8
- return e(c, {
9
- className: o(d.className, t.card),
10
- "data-rounded": r.rounded ?? "md",
11
- "data-border": r.border ?? !0
12
- });
13
- }
14
- export {
15
- i as Card
16
- };
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./clsx-C11secjj.js"),c=require("react"),n="_card_7gri7_1",a={card:n};function o(r){const e=c.Children.only(r.children),d=e.props;return c.cloneElement(e,{className:t.clsx(d.className,a.card),"data-rounded":r.rounded??"md","data-border":r.border??!0})}exports.Card=o;
package/dist/Checkbox.js CHANGED
@@ -1,34 +1 @@
1
- import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
- import { c as l } from "./clsx-OuTLNxxd.js";
3
- import { S as p } from "./SanityIcon-D1oKyiRW.js";
4
- const i = "_wrapper_14d0t_2", _ = "_input_14d0t_19", b = "_box_14d0t_23", d = "_label_14d0t_59", m = "_icon_14d0t_73", a = {
5
- wrapper: i,
6
- input: _,
7
- box: b,
8
- label: d,
9
- icon: m
10
- };
11
- function k({
12
- size: c,
13
- state: e,
14
- className: o,
15
- children: s,
16
- ...n
17
- }) {
18
- return c ??= "md", /* @__PURE__ */ r(
19
- "label",
20
- {
21
- className: l(o, a.wrapper),
22
- "data-state": e,
23
- "data-size": c,
24
- children: [
25
- /* @__PURE__ */ t("input", { ...n, className: a.input, type: "checkbox" }),
26
- /* @__PURE__ */ t("div", { className: a.box, "data-checkbox": !0, children: /* @__PURE__ */ t(p, { icon: "checkmark", className: a.icon }) }),
27
- /* @__PURE__ */ t("span", { className: a.label, "data-label": !0, children: s })
28
- ]
29
- }
30
- );
31
- }
32
- export {
33
- k as Checkbox
34
- };
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("./clsx-C11secjj.js"),l=require("./SanityIcon-D4sDJgMO.js"),i="_wrapper_14d0t_2",b="_input_14d0t_19",p="_box_14d0t_23",u="_label_14d0t_59",x="_icon_14d0t_73",t={wrapper:i,input:b,box:p,label:u,icon:x};function d({size:c,state:a,className:s,children:n,...o}){return c??="md",e.jsxs("label",{className:r.clsx(s,t.wrapper),"data-state":a,"data-size":c,children:[e.jsx("input",{...o,className:t.input,type:"checkbox"}),e.jsx("div",{className:t.box,"data-checkbox":!0,children:e.jsx(l.SanityIcon,{icon:"checkmark",className:t.icon})}),e.jsx("span",{className:t.label,"data-label":!0,children:n})]})}exports.Checkbox=d;
package/dist/Eyebrow.js CHANGED
@@ -1,34 +1 @@
1
- import { jsxs as l, jsx as n } from "react/jsx-runtime";
2
- import { c as t } from "./clsx-OuTLNxxd.js";
3
- import { LinkCTA as b } from "./LinkCTA.js";
4
- const w = "_eyebrow_13ek1_1", m = "_eyebrowInner_13ek1_5", y = "_linkCta_13ek1_8", e = {
5
- eyebrow: w,
6
- eyebrowInner: m,
7
- linkCta: y
8
- };
9
- function f({
10
- children: o,
11
- className: s,
12
- ctaText: r,
13
- ctaHref: a,
14
- ctaAccessibleLabel: c,
15
- ...i
16
- }) {
17
- return /* @__PURE__ */ l("div", { ...i, className: t(s, e.eyebrow), children: [
18
- /* @__PURE__ */ n("span", { className: e.eyebrowInner, children: o }),
19
- !!r && /* @__PURE__ */ n(
20
- b,
21
- {
22
- className: e.linkCta,
23
- href: a,
24
- "aria-label": c,
25
- arrowColor: "accent",
26
- size: "lg",
27
- children: r
28
- }
29
- )
30
- ] });
31
- }
32
- export {
33
- f as Eyebrow
34
- };
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("./clsx-C11secjj.js"),a=require("./LinkCTA.js"),b="_eyebrow_13ek1_1",y="_eyebrowInner_13ek1_5",w="_linkCta_13ek1_8",r={eyebrow:b,eyebrowInner:y,linkCta:w};function k({children:s,className:o,ctaText:n,ctaHref:c,ctaAccessibleLabel:i,...t}){return e.jsxs("div",{...t,className:l.clsx(o,r.eyebrow),children:[e.jsx("span",{className:r.eyebrowInner,children:s}),!!n&&e.jsx(a.LinkCTA,{className:r.linkCta,href:c,"aria-label":i,arrowColor:"accent",size:"lg",children:n})]})}exports.Eyebrow=k;
@@ -22,7 +22,7 @@ export declare namespace IconButton {
22
22
  declare function Link({ href, target, prefetch, ...props }: Link.Props): JSX.Element;
23
23
 
24
24
  declare namespace Link {
25
- type Props = Omit<default_2.ComponentProps<typeof default_3>, "prefetch" | "href"> & {
25
+ type Props = Omit<React.ComponentProps<typeof default_3>, "prefetch" | "href"> & {
26
26
  prefetch?: boolean | null | "hover";
27
27
  href?: string;
28
28
  };
@@ -1,39 +1 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { c as b } from "./clsx-OuTLNxxd.js";
3
- import { S as f } from "./SanityIcon-D1oKyiRW.js";
4
- import { L as d } from "./Link-Nwcy0Qhp.js";
5
- const _ = "_button_1vbof_1", I = "_icon_1vbof_7", v = "_customIcon_1vbof_188", a = {
6
- button: _,
7
- icon: I,
8
- customIcon: v
9
- };
10
- function L({
11
- as: r,
12
- href: i,
13
- type: t,
14
- icon: n,
15
- label: u,
16
- size: m,
17
- color: e,
18
- fill: l,
19
- ...c
20
- }) {
21
- let o = r;
22
- return m ??= "md", l ??= "solid", e ??= "primary", i ? o ??= d : c.onClick ? o ??= "button" : o ??= "div", o === "button" ? t ??= "button" : t = void 0, /* @__PURE__ */ s(
23
- o,
24
- {
25
- ...c,
26
- "aria-label": u,
27
- className: b(c.className, a.button),
28
- href: i,
29
- type: t,
30
- "data-size": m,
31
- "data-fill": l,
32
- "data-color": e,
33
- children: typeof n == "string" ? /* @__PURE__ */ s(f, { icon: n, className: a.icon }) : /* @__PURE__ */ s("span", { className: a.customIcon, children: n })
34
- }
35
- );
36
- }
37
- export {
38
- L as IconButton
39
- };
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),m=require("./clsx-C11secjj.js"),d=require("./SanityIcon-D4sDJgMO.js"),_=require("./Link-zm9qxqps.js"),f="_button_1vbof_1",I="_icon_1vbof_7",v="_customIcon_1vbof_188",e={button:f,icon:I,customIcon:v};function x({as:r,href:i,type:n,icon:o,label:b,size:a,color:u,fill:l,...c}){let t=r;return a??="md",l??="solid",u??="primary",i?t??=_.Link:c.onClick?t??="button":t??="div",t==="button"?n??="button":n=void 0,s.jsx(t,{...c,"aria-label":b,className:m.clsx(c.className,e.button),href:i,type:n,"data-size":a,"data-fill":l,"data-color":u,children:typeof o=="string"?s.jsx(d.SanityIcon,{icon:o,className:e.icon}):s.jsx("span",{className:e.customIcon,children:o})})}exports.IconButton=x;
package/dist/Input.js CHANGED
@@ -1,17 +1 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { c as i } from "./clsx-OuTLNxxd.js";
3
- import { i as r } from "./Input.module-P--gA8sq.js";
4
- function u({ size: t, state: s, ...a }) {
5
- return t ??= "md", /* @__PURE__ */ m(
6
- "input",
7
- {
8
- ...a,
9
- className: i(a.className, r.input),
10
- "data-size": t,
11
- "data-state": s
12
- }
13
- );
14
- }
15
- export {
16
- u as Input
17
- };
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("./clsx-C11secjj.js"),a=require("./Input.module-CJkUSxF9.js");function i({size:t,state:u,...e}){return t??="md",n.jsx("input",{...e,className:s.clsx(e.className,a.inputCss.input),"data-size":t,"data-state":u})}exports.Input=i;
@@ -0,0 +1 @@
1
+ "use strict";const t="_input_ij2oq_2",s={input:t};exports.inputCss=s;
package/dist/Label.js CHANGED
@@ -1,23 +1 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { c as i } from "./clsx-OuTLNxxd.js";
3
- import { L as n } from "./Link-Nwcy0Qhp.js";
4
- const o = "_label_1nkqt_1", r = {
5
- label: o
6
- };
7
- function d(e) {
8
- const l = e.size ?? "md", c = e.color ?? "primary";
9
- let a = "div";
10
- return e.href && (a = n), e.as && (a = e.as), /* @__PURE__ */ t(
11
- a,
12
- {
13
- className: i(r.label, e.className),
14
- "data-size": l,
15
- "data-color": c,
16
- href: e.href,
17
- children: e.children
18
- }
19
- );
20
- }
21
- export {
22
- d as Label
23
- };
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("./clsx-C11secjj.js"),i=require("./Link-zm9qxqps.js"),s="_label_1nkqt_1",r={label:s};function o(e){const t=e.size??"md",c=e.color??"primary";let l="div";return e.href&&(l=i.Link),e.as&&(l=e.as),n.jsx(l,{className:a.clsx(r.label,e.className),"data-size":t,"data-color":c,href:e.href,children:e.children})}exports.Label=o;
@@ -0,0 +1 @@
1
+ "use client";"use strict";const r=require("react/jsx-runtime"),u=require("next/link"),s=require("./utils.js");function l({href:n="",target:e,prefetch:i="hover",...t}){return s.isInternalHref(n)?n=s.toRelativeUrl(n):e??="_blank",n?r.jsx(u,{...t,href:n,prefetch:i==="hover"?void 0:i,target:e}):r.jsx("a",{...t})}exports.Link=l;
package/dist/LinkCTA.js CHANGED
@@ -1,56 +1 @@
1
- "use client";
2
- import { jsx as a, jsxs as p } from "react/jsx-runtime";
3
- import { c as u } from "./clsx-OuTLNxxd.js";
4
- import { isInternalHref as k } from "./utils.js";
5
- import { Children as d, Suspense as _, isValidElement as N, cloneElement as C } from "react";
6
- import { u as x } from "./useLinkWithRef-D_gJ65VG.js";
7
- import { L } from "./Link-Nwcy0Qhp.js";
8
- function g(e) {
9
- const n = d.only(e.children);
10
- return /* @__PURE__ */ a(_, { fallback: n, children: /* @__PURE__ */ a(A, { children: n }) });
11
- }
12
- function A(e) {
13
- const n = d.only(e.children), t = n?.props, i = x(t?.href);
14
- return N(n) ? C(n, { href: i }) : n;
15
- }
16
- const E = "_linkCta_1594k_1", R = "_arrow_1594k_48", b = "_icon_1594k_67", r = {
17
- linkCta: E,
18
- arrow: R,
19
- icon: b
20
- };
21
- function I({
22
- arrowColor: e,
23
- arrowDirection: n,
24
- arrowPosition: t,
25
- children: i,
26
- size: s,
27
- state: m,
28
- href: c,
29
- external: f,
30
- ...l
31
- }) {
32
- e ??= "base", n ??= "right", t ??= "left", s ??= "md";
33
- let o = "div";
34
- const h = k(c ?? "");
35
- return c && !h && (n = "top-right"), c && (o = f ? "a" : L), /* @__PURE__ */ a(g, { children: /* @__PURE__ */ p(
36
- o,
37
- {
38
- ...l,
39
- className: u(l.className, r.linkCta),
40
- "data-arrow-direction": n,
41
- "data-arrow-color": e,
42
- "data-arrow-position": t,
43
- "data-size": s,
44
- "data-state": m,
45
- href: c,
46
- children: [
47
- t === "left" && /* @__PURE__ */ a("span", { className: r.arrow, children: /* @__PURE__ */ a("span", { className: r.icon, children: "→" }) }),
48
- i,
49
- t === "right" && /* @__PURE__ */ a("span", { className: r.arrow, children: /* @__PURE__ */ a("span", { className: r.icon, children: "→" }) })
50
- ]
51
- }
52
- ) });
53
- }
54
- export {
55
- I as LinkCTA
56
- };
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),k=require("./clsx-C11secjj.js"),m=require("./utils.js"),c=require("react"),x=require("./useLinkWithRef-Bt1HfBJb.js"),j=require("./Link-zm9qxqps.js");function p(s){const n=c.Children.only(s.children);return e.jsx(c.Suspense,{fallback:n,children:e.jsx(_,{children:n})})}function _(s){const n=c.Children.only(s.children),t=n?.props,a=x.useLinkWithRef(t?.href);return c.isValidElement(n)?c.cloneElement(n,{href:a}):n}const C="_linkCta_1594k_1",q="_arrow_1594k_48",L="_icon_1594k_67",i={linkCta:C,arrow:q,icon:L};function N({arrowColor:s,arrowDirection:n,arrowPosition:t,children:a,size:l,state:u,href:r,external:h,...d}){s??="base",n??="right",t??="left",l??="md";let o="div";const f=m.isInternalHref(r??"");return r&&!f&&(n="top-right"),r&&(o=h?"a":j.Link),e.jsx(p,{children:e.jsxs(o,{...d,className:k.clsx(d.className,i.linkCta),"data-arrow-direction":n,"data-arrow-color":s,"data-arrow-position":t,"data-size":l,"data-state":u,href:r,children:[t==="left"&&e.jsx("span",{className:i.arrow,children:e.jsx("span",{className:i.icon,children:"→"})}),a,t==="right"&&e.jsx("span",{className:i.arrow,children:e.jsx("span",{className:i.icon,children:"→"})})]})})}exports.LinkCTA=N;
package/dist/Radio.js CHANGED
@@ -1,32 +1 @@
1
- import { jsxs as l, jsx as p } from "react/jsx-runtime";
2
- import { c } from "./clsx-OuTLNxxd.js";
3
- const n = "_wrapper_1paov_2", i = "_input_1paov_19", _ = "_box_1paov_23", b = "_label_1paov_59", a = {
4
- wrapper: n,
5
- input: i,
6
- box: _,
7
- label: b
8
- };
9
- function d({
10
- size: o,
11
- state: s,
12
- className: t,
13
- children: e,
14
- ...r
15
- }) {
16
- return o ??= "md", /* @__PURE__ */ l(
17
- "label",
18
- {
19
- className: c(t, a.wrapper),
20
- "data-state": s,
21
- "data-size": o,
22
- children: [
23
- /* @__PURE__ */ p("input", { ...r, className: a.input, type: "radio" }),
24
- /* @__PURE__ */ p("div", { className: a.box }),
25
- /* @__PURE__ */ p("p", { className: a.label, children: e })
26
- ]
27
- }
28
- );
29
- }
30
- export {
31
- d as Radio
32
- };
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),r=require("./clsx-C11secjj.js"),n="_wrapper_1paov_2",c="_input_1paov_19",i="_box_1paov_23",u="_label_1paov_59",e={wrapper:n,input:c,box:i,label:u};function _({size:s,state:t,className:o,children:l,...p}){return s??="md",a.jsxs("label",{className:r.clsx(o,e.wrapper),"data-state":t,"data-size":s,children:[a.jsx("input",{...p,className:e.input,type:"radio"}),a.jsx("div",{className:e.box}),a.jsx("p",{className:e.label,children:l})]})}exports.Radio=_;
@@ -1,95 +1 @@
1
- "use client";
2
- import { jsxs as l, jsx as a } from "react/jsx-runtime";
3
- import { useRef as N, useState as S, useEffect as I, Fragment as v } from "react";
4
- import { c as C } from "./clsx-OuTLNxxd.js";
5
- import { slugify as R } from "./utils.js";
6
- import { S as b } from "./SanityIcon-D1oKyiRW.js";
7
- const j = "_fieldset_11kmu_2", F = "_indicator_11kmu_35", H = "_radio_11kmu_55", W = "_icon_11kmu_70", $ = "_tooltip_11kmu_96", s = {
8
- fieldset: j,
9
- indicator: F,
10
- radio: H,
11
- icon: W,
12
- tooltip: $
13
- };
14
- function B({
15
- className: r,
16
- defaultValue: i,
17
- onChange: d,
18
- name: e,
19
- size: n,
20
- state: k,
21
- legend: m,
22
- value: c,
23
- options: o,
24
- ...p
25
- }) {
26
- const f = N(null), [u, _] = S(
27
- () => x(o, c, i)
28
- );
29
- I(() => {
30
- _(x(o, c, i));
31
- }, [c, o, i]), n ??= "md";
32
- function y(t) {
33
- f.current?.animate(
34
- [{ scale: "1" }, { scale: "1.5 0.5" }, { scale: "1" }],
35
- {
36
- duration: 350,
37
- easing: "ease-out"
38
- }
39
- ), _(t.target.dataset.index ?? ""), d?.(t);
40
- }
41
- return /* @__PURE__ */ l(
42
- "fieldset",
43
- {
44
- ...p,
45
- className: C(r, s.fieldset),
46
- style: { "--index": u },
47
- "data-state": k,
48
- "data-size": n,
49
- suppressHydrationWarning: !0,
50
- children: [
51
- m && /* @__PURE__ */ a("legend", { className: "sr-only", children: m }),
52
- o.map((t, g) => /* @__PURE__ */ l(v, { children: [
53
- /* @__PURE__ */ a(
54
- "input",
55
- {
56
- type: "radio",
57
- id: h(e, t),
58
- name: e,
59
- className: s.radio,
60
- value: t.value ?? "",
61
- "data-index": g,
62
- onChange: y,
63
- checked: c ? t.value === c : !1,
64
- defaultChecked: !c && i ? t.value === i : void 0
65
- }
66
- ),
67
- /* @__PURE__ */ l(
68
- "label",
69
- {
70
- className: s.icon,
71
- htmlFor: h(e, t),
72
- "data-force-tooltip": String(g) === u,
73
- suppressHydrationWarning: !0,
74
- children: [
75
- /* @__PURE__ */ a(b, { icon: t.icon, className: s.icona }),
76
- /* @__PURE__ */ a("div", { className: s.tooltip, children: t.label })
77
- ]
78
- }
79
- )
80
- ] }, t.value)),
81
- /* @__PURE__ */ a("div", { className: s.indicator, ref: f })
82
- ]
83
- }
84
- );
85
- }
86
- function h(r, i) {
87
- return i.id ? i.id : R(`${r}-${i.value}`);
88
- }
89
- function x(r, i, d) {
90
- let e = r.findIndex((n) => !!i && n.value === i);
91
- return e >= 0 || (e = r.findIndex((n) => !!d && n.value === d), e >= 0) ? e.toString() : "";
92
- }
93
- export {
94
- B as RadioSwitch
95
- };
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=require("react"),k=require("./clsx-C11secjj.js"),N=require("./utils.js"),I=require("./SanityIcon-D4sDJgMO.js"),q="_fieldset_11kmu_2",v="_indicator_11kmu_35",R="_radio_11kmu_55",b="_icon_11kmu_70",C="_tooltip_11kmu_96",a={fieldset:q,indicator:v,radio:R,icon:b,tooltip:C};function p({className:n,defaultValue:e,onChange:d,name:i,size:c,state:j,legend:u,value:r,options:o,...y}){const f=l.useRef(null),[m,x]=l.useState(()=>h(o,r,e));l.useEffect(()=>{x(h(o,r,e))},[r,o,e]),c??="md";function S(t){f.current?.animate([{scale:"1"},{scale:"1.5 0.5"},{scale:"1"}],{duration:350,easing:"ease-out"}),x(t.target.dataset.index??""),d?.(t)}return s.jsxs("fieldset",{...y,className:k.clsx(n,a.fieldset),style:{"--index":m},"data-state":j,"data-size":c,suppressHydrationWarning:!0,children:[u&&s.jsx("legend",{className:"sr-only",children:u}),o.map((t,_)=>s.jsxs(l.Fragment,{children:[s.jsx("input",{type:"radio",id:g(i,t),name:i,className:a.radio,value:t.value??"","data-index":_,onChange:S,checked:r?t.value===r:!1,defaultChecked:!r&&e?t.value===e:void 0}),s.jsxs("label",{className:a.icon,htmlFor:g(i,t),"data-force-tooltip":String(_)===m,suppressHydrationWarning:!0,children:[s.jsx(I.SanityIcon,{icon:t.icon,className:a.icona}),s.jsx("div",{className:a.tooltip,children:t.label})]})]},t.value)),s.jsx("div",{className:a.indicator,ref:f})]})}function g(n,e){return e.id?e.id:N.slugify(`${n}-${e.value}`)}function h(n,e,d){let i=n.findIndex(c=>!!e&&c.value===e);return i>=0||(i=n.findIndex(c=>!!d&&c.value===d),i>=0)?i.toString():""}exports.RadioSwitch=p;
@@ -0,0 +1 @@
1
+ "use strict";const n=require("react/jsx-runtime"),e="3.7.0";function t({icon:o,...r}){const s=`/iconophor/sanity-icons/${e}/${o}?replace-colors=currentColor&symbol=true#icon`;return n.jsx("svg",{...r,"data-icon":o,viewBox:"0 0 25 25",children:n.jsx("use",{href:o?s:void 0})})}exports.SanityIcon=t;
package/dist/Select.js CHANGED
@@ -1,26 +1 @@
1
- import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
- import { c as a } from "./clsx-OuTLNxxd.js";
3
- import { S as n } from "./SanityIcon-D1oKyiRW.js";
4
- import { i } from "./Input.module-P--gA8sq.js";
5
- const l = "_wrapper_15676_2", m = "_select_15676_7", p = "_icon_15676_23", s = {
6
- wrapper: l,
7
- select: m,
8
- icon: p
9
- };
10
- function w({ size: c, state: o, ...e }) {
11
- return c ??= "md", /* @__PURE__ */ r("div", { className: a(s.wrapper, e.className), children: [
12
- /* @__PURE__ */ t(
13
- "select",
14
- {
15
- ...e,
16
- className: a(i.input, s.select),
17
- "data-size": c,
18
- "data-state": o
19
- }
20
- ),
21
- /* @__PURE__ */ t(n, { icon: "select", className: s.icon })
22
- ] });
23
- }
24
- export {
25
- w as Select
26
- };
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("./clsx-C11secjj.js"),a=require("./SanityIcon-D4sDJgMO.js"),i=require("./Input.module-CJkUSxF9.js"),l="_wrapper_15676_2",o="_select_15676_7",u="_icon_15676_23",s={wrapper:l,select:o,icon:u};function p({size:c,state:r,...t}){return c??="md",e.jsxs("div",{className:n.clsx(s.wrapper,t.className),children:[e.jsx("select",{...t,className:n.clsx(i.inputCss.input,s.select),"data-size":c,"data-state":r}),e.jsx(a.SanityIcon,{icon:"select",className:s.icon})]})}exports.Select=p;
package/dist/Switch.js CHANGED
@@ -1,32 +1 @@
1
- import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
- import { c as r } from "./clsx-OuTLNxxd.js";
3
- const m = "_wrapper_h3ntq_2", i = "_input_h3ntq_18", o = "_thumb_h3ntq_22", _ = "_label_h3ntq_70", t = {
4
- wrapper: m,
5
- input: i,
6
- thumb: o,
7
- label: _
8
- };
9
- function b({
10
- children: e,
11
- className: n,
12
- size: s,
13
- state: c,
14
- ...p
15
- }) {
16
- return s ??= "md", /* @__PURE__ */ l(
17
- "label",
18
- {
19
- className: r(n, t.wrapper),
20
- "data-size": s,
21
- "data-state": c,
22
- children: [
23
- /* @__PURE__ */ a("input", { ...p, className: t.input, type: "checkbox" }),
24
- /* @__PURE__ */ a("div", { className: t.thumb }),
25
- /* @__PURE__ */ a("div", { className: t.label, children: e })
26
- ]
27
- }
28
- );
29
- }
30
- export {
31
- b as Switch
32
- };
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("./clsx-C11secjj.js"),i="_wrapper_h3ntq_2",u="_input_h3ntq_18",p="_thumb_h3ntq_22",o="_label_h3ntq_70",e={wrapper:i,input:u,thumb:p,label:o};function b({children:a,className:n,size:s,state:c,...l}){return s??="md",t.jsxs("label",{className:r.clsx(n,e.wrapper),"data-size":s,"data-state":c,children:[t.jsx("input",{...l,className:e.input,type:"checkbox"}),t.jsx("div",{className:e.thumb}),t.jsx("div",{className:e.label,children:a})]})}exports.Switch=b;
package/dist/TextArea.js CHANGED
@@ -1,22 +1 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { c as m } from "./clsx-OuTLNxxd.js";
3
- import { forwardRef as o } from "react";
4
- import { i as x } from "./Input.module-P--gA8sq.js";
5
- const c = "_textarea_1f7g2_7", i = {
6
- textarea: c
7
- }, f = o(
8
- ({ size: t, state: e, ...a }, r) => (t ??= "md", /* @__PURE__ */ s(
9
- "textarea",
10
- {
11
- ...a,
12
- ref: r,
13
- className: m(x.input, i.textarea, a.className),
14
- "data-size": t,
15
- "data-state": e
16
- }
17
- ))
18
- );
19
- f.displayName = "TextArea";
20
- export {
21
- f as TextArea
22
- };
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),n=require("./clsx-C11secjj.js"),u=require("react"),o=require("./Input.module-CJkUSxF9.js"),x="_textarea_1f7g2_7",i={textarea:x},a=u.forwardRef(({size:e,state:r,...t},s)=>(e??="md",c.jsx("textarea",{...t,ref:s,className:n.clsx(o.inputCss.input,i.textarea,t.className),"data-size":e,"data-state":r})));a.displayName="TextArea";exports.TextArea=a;
@@ -0,0 +1 @@
1
+ "use strict";function i(r){var f,n,t="";if(typeof r=="string"||typeof r=="number")t+=r;else if(typeof r=="object")if(Array.isArray(r)){var s=r.length;for(f=0;f<s;f++)r[f]&&(n=i(r[f]))&&(t&&(t+=" "),t+=n)}else for(n in r)r[n]&&(t&&(t+=" "),t+=n);return t}function o(){for(var r,f,n=0,t="",s=arguments.length;n<s;n++)(r=arguments[n])&&(f=i(r))&&(t&&(t+=" "),t+=f);return t}exports.clsx=o;