@sanity/sanity-id 0.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.
Files changed (77) hide show
  1. package/.turbo/turbo-build.log +32 -0
  2. package/README.md +272 -0
  3. package/css/all.css +3 -0
  4. package/css/colors.css +498 -0
  5. package/css/tailwind.css +3 -0
  6. package/css/variables.css +326 -0
  7. package/dist/Breadcrumbs.js +53 -0
  8. package/dist/Button.js +50 -0
  9. package/dist/Card.js +16 -0
  10. package/dist/Checkbox.js +31 -0
  11. package/dist/Eyebrow.js +30 -0
  12. package/dist/IconButton.js +38 -0
  13. package/dist/Input.js +16 -0
  14. package/dist/Input.module-P--gA8sq.js +6 -0
  15. package/dist/Label.js +22 -0
  16. package/dist/Link-BWIwmuYV.js +4068 -0
  17. package/dist/LinkCTA.js +53 -0
  18. package/dist/Radio.js +29 -0
  19. package/dist/RadioSwitch.js +87 -0
  20. package/dist/SanityIcon-Bl5or1b8.js +13 -0
  21. package/dist/Select.js +22 -0
  22. package/dist/Switch.js +29 -0
  23. package/dist/TextArea.js +21 -0
  24. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  25. package/dist/clsx-OuTLNxxd.js +16 -0
  26. package/dist/colors.js +935 -0
  27. package/dist/styles.css +1 -0
  28. package/dist/tailwind.js +577 -0
  29. package/dist/useLinkWithRef-D9NOX6Bd.js +21 -0
  30. package/dist/utils.js +23 -0
  31. package/package.json +56 -0
  32. package/postcss.config.js +6 -0
  33. package/src/colors.ts +3 -0
  34. package/src/components/Breadcrumbs.module.css +21 -0
  35. package/src/components/Breadcrumbs.tsx +38 -0
  36. package/src/components/Button.module.css +407 -0
  37. package/src/components/Button.tsx +110 -0
  38. package/src/components/Card.module.css +19 -0
  39. package/src/components/Card.tsx +18 -0
  40. package/src/components/Checkbox.module.css +82 -0
  41. package/src/components/Checkbox.tsx +38 -0
  42. package/src/components/Eyebrow.module.css +28 -0
  43. package/src/components/Eyebrow.tsx +37 -0
  44. package/src/components/IconButton.module.css +196 -0
  45. package/src/components/IconButton.tsx +62 -0
  46. package/src/components/Input.module.css +55 -0
  47. package/src/components/Input.tsx +23 -0
  48. package/src/components/Label.module.css +53 -0
  49. package/src/components/Label.tsx +33 -0
  50. package/src/components/LinkCTA.module.css +122 -0
  51. package/src/components/LinkCTA.tsx +77 -0
  52. package/src/components/Radio.module.css +91 -0
  53. package/src/components/Radio.tsx +33 -0
  54. package/src/components/RadioSwitch.module.css +125 -0
  55. package/src/components/RadioSwitch.tsx +122 -0
  56. package/src/components/Select.module.css +35 -0
  57. package/src/components/Select.tsx +28 -0
  58. package/src/components/Switch.module.css +112 -0
  59. package/src/components/Switch.tsx +33 -0
  60. package/src/components/TextArea.module.css +17 -0
  61. package/src/components/TextArea.tsx +30 -0
  62. package/src/components/helpers/AddRefParam.tsx +29 -0
  63. package/src/components/helpers/Link.tsx +56 -0
  64. package/src/components/helpers/NavLink.tsx +20 -0
  65. package/src/components/helpers/SanityIcon.tsx +25 -0
  66. package/src/components/helpers/useIsCurrentPage.ts +39 -0
  67. package/src/components/helpers/useLinkWithRef.ts +27 -0
  68. package/src/components/helpers/useSafePathname.ts +17 -0
  69. package/src/css.d.ts +4 -0
  70. package/src/tailwind.ts +408 -0
  71. package/src/tokens/dynamic-colors.ts +154 -0
  72. package/src/tokens/primitive-colors.ts +237 -0
  73. package/src/tokens/semantic-colors.ts +574 -0
  74. package/src/utils.ts +58 -0
  75. package/tailwind.config.ts +7 -0
  76. package/tsconfig.json +17 -0
  77. package/vite.config.ts +29 -0
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ import { c as p } from "./clsx-OuTLNxxd.js";
3
+ import { isInternalHref as u } from "./utils.js";
4
+ import { Children as m, Suspense as k, isValidElement as E, cloneElement as R } from "react";
5
+ import { u as h } from "./useLinkWithRef-D9NOX6Bd.js";
6
+ import { L as _ } from "./Link-BWIwmuYV.js";
7
+ function N(t) {
8
+ const e = m.only(t.children);
9
+ return /* @__PURE__ */ React.createElement(k, { fallback: e }, /* @__PURE__ */ React.createElement(C, null, e));
10
+ }
11
+ function C(t) {
12
+ const e = m.only(t.children), a = e?.props, l = h(a?.href);
13
+ return E(e) ? R(e, { href: l }) : e;
14
+ }
15
+ const L = "_linkCta_1594k_1", g = "_arrow_1594k_48", A = "_icon_1594k_67", n = {
16
+ linkCta: L,
17
+ arrow: g,
18
+ icon: A
19
+ };
20
+ function v({
21
+ arrowColor: t,
22
+ arrowDirection: e,
23
+ arrowPosition: a,
24
+ children: l,
25
+ size: r,
26
+ state: o,
27
+ href: c,
28
+ external: d,
29
+ ...s
30
+ }) {
31
+ t ??= "base", e ??= "right", a ??= "left", r ??= "md";
32
+ let i = "div";
33
+ const f = u(c ?? "");
34
+ return c && !f && (e = "top-right"), c && (i = d ? "a" : _), /* @__PURE__ */ React.createElement(N, null, /* @__PURE__ */ React.createElement(
35
+ i,
36
+ {
37
+ ...s,
38
+ className: p(s.className, n.linkCta),
39
+ "data-arrow-direction": e,
40
+ "data-arrow-color": t,
41
+ "data-arrow-position": a,
42
+ "data-size": r,
43
+ "data-state": o,
44
+ href: c
45
+ },
46
+ a === "left" && /* @__PURE__ */ React.createElement("span", { className: n.arrow }, /* @__PURE__ */ React.createElement("span", { className: n.icon }, "→")),
47
+ l,
48
+ a === "right" && /* @__PURE__ */ React.createElement("span", { className: n.arrow }, /* @__PURE__ */ React.createElement("span", { className: n.icon }, "→"))
49
+ ));
50
+ }
51
+ export {
52
+ v as LinkCTA
53
+ };
package/dist/Radio.js ADDED
@@ -0,0 +1,29 @@
1
+ import { c as o } from "./clsx-OuTLNxxd.js";
2
+ const r = "_wrapper_1paov_2", s = "_input_1paov_19", n = "_box_1paov_23", _ = "_label_1paov_59", a = {
3
+ wrapper: r,
4
+ input: s,
5
+ box: n,
6
+ label: _
7
+ };
8
+ function i({
9
+ size: e,
10
+ state: t,
11
+ className: c,
12
+ children: p,
13
+ ...l
14
+ }) {
15
+ return e ??= "md", /* @__PURE__ */ React.createElement(
16
+ "label",
17
+ {
18
+ className: o(c, a.wrapper),
19
+ "data-state": t,
20
+ "data-size": e
21
+ },
22
+ /* @__PURE__ */ React.createElement("input", { ...l, className: a.input, type: "radio" }),
23
+ /* @__PURE__ */ React.createElement("div", { className: a.box }),
24
+ /* @__PURE__ */ React.createElement("p", { className: a.label }, p)
25
+ );
26
+ }
27
+ export {
28
+ i as Radio
29
+ };
@@ -0,0 +1,87 @@
1
+ "use client";
2
+ import { useRef as x, useState as y, useEffect as N, Fragment as S } from "react";
3
+ import { c as h } from "./clsx-OuTLNxxd.js";
4
+ import { slugify as p } from "./utils.js";
5
+ import { S as I } from "./SanityIcon-Bl5or1b8.js";
6
+ const v = "_fieldset_11kmu_2", C = "_indicator_11kmu_35", b = "_radio_11kmu_55", F = "_icon_11kmu_70", H = "_tooltip_11kmu_96", r = {
7
+ fieldset: v,
8
+ indicator: C,
9
+ radio: b,
10
+ icon: F,
11
+ tooltip: H
12
+ };
13
+ function j({
14
+ className: c,
15
+ defaultValue: e,
16
+ onChange: s,
17
+ name: a,
18
+ size: i,
19
+ state: R,
20
+ legend: d,
21
+ value: n,
22
+ options: o,
23
+ ...E
24
+ }) {
25
+ const l = x(null), [m, f] = y(
26
+ () => g(o, n, e)
27
+ );
28
+ N(() => {
29
+ f(g(o, n, e));
30
+ }, [n, o, e]), i ??= "md";
31
+ function k(t) {
32
+ l.current?.animate(
33
+ [{ scale: "1" }, { scale: "1.5 0.5" }, { scale: "1" }],
34
+ {
35
+ duration: 350,
36
+ easing: "ease-out"
37
+ }
38
+ ), f(t.target.dataset.index ?? ""), s?.(t);
39
+ }
40
+ return /* @__PURE__ */ React.createElement(
41
+ "fieldset",
42
+ {
43
+ ...E,
44
+ className: h(c, r.fieldset),
45
+ style: { "--index": m },
46
+ "data-state": R,
47
+ "data-size": i,
48
+ suppressHydrationWarning: !0
49
+ },
50
+ d && /* @__PURE__ */ React.createElement("legend", { className: "sr-only" }, d),
51
+ o.map((t, u) => /* @__PURE__ */ React.createElement(S, { key: t.value }, /* @__PURE__ */ React.createElement(
52
+ "input",
53
+ {
54
+ type: "radio",
55
+ id: _(a, t),
56
+ name: a,
57
+ className: r.radio,
58
+ value: t.value ?? "",
59
+ "data-index": u,
60
+ onChange: k,
61
+ checked: n ? t.value === n : !1,
62
+ defaultChecked: !n && e ? t.value === e : void 0
63
+ }
64
+ ), /* @__PURE__ */ React.createElement(
65
+ "label",
66
+ {
67
+ className: r.icon,
68
+ htmlFor: _(a, t),
69
+ "data-force-tooltip": String(u) === m,
70
+ suppressHydrationWarning: !0
71
+ },
72
+ /* @__PURE__ */ React.createElement(I, { icon: t.icon, className: r.icona }),
73
+ /* @__PURE__ */ React.createElement("div", { className: r.tooltip }, t.label)
74
+ ))),
75
+ /* @__PURE__ */ React.createElement("div", { className: r.indicator, ref: l })
76
+ );
77
+ }
78
+ function _(c, e) {
79
+ return e.id ? e.id : p(`${c}-${e.value}`);
80
+ }
81
+ function g(c, e, s) {
82
+ let a = c.findIndex((i) => !!e && i.value === e);
83
+ return a >= 0 || (a = c.findIndex((i) => !!s && i.value === s), a >= 0) ? a.toString() : "";
84
+ }
85
+ export {
86
+ j as RadioSwitch
87
+ };
@@ -0,0 +1,13 @@
1
+ const c = { "@sanity/icons": "^3.7.0" }, t = {
2
+ peerDependencies: c
3
+ }, r = t?.peerDependencies?.["@sanity/icons"]?.replace(
4
+ /[^\d\.]/g,
5
+ ""
6
+ );
7
+ function s({ icon: e, ...n }) {
8
+ const o = `/iconophor/sanity-icons/${r}/${e}?replace-colors=currentColor&symbol=true#icon`;
9
+ return /* @__PURE__ */ React.createElement("svg", { ...n, "data-icon": e, viewBox: "0 0 25 25" }, /* @__PURE__ */ React.createElement("use", { href: e ? o : void 0 }));
10
+ }
11
+ export {
12
+ s as S
13
+ };
package/dist/Select.js ADDED
@@ -0,0 +1,22 @@
1
+ import { c as a } from "./clsx-OuTLNxxd.js";
2
+ import { S as n } from "./SanityIcon-Bl5or1b8.js";
3
+ import { i as r } from "./Input.module-P--gA8sq.js";
4
+ const o = "_wrapper_15676_2", l = "_select_15676_7", i = "_icon_15676_23", e = {
5
+ wrapper: o,
6
+ select: l,
7
+ icon: i
8
+ };
9
+ function d({ size: t, state: s, ...c }) {
10
+ return t ??= "md", /* @__PURE__ */ React.createElement("div", { className: a(e.wrapper, c.className) }, /* @__PURE__ */ React.createElement(
11
+ "select",
12
+ {
13
+ ...c,
14
+ className: a(r.input, e.select),
15
+ "data-size": t,
16
+ "data-state": s
17
+ }
18
+ ), /* @__PURE__ */ React.createElement(n, { icon: "select", className: e.icon }));
19
+ }
20
+ export {
21
+ d as Select
22
+ };
package/dist/Switch.js ADDED
@@ -0,0 +1,29 @@
1
+ import { c as s } from "./clsx-OuTLNxxd.js";
2
+ const r = "_wrapper_h3ntq_2", p = "_input_h3ntq_18", m = "_thumb_h3ntq_22", _ = "_label_h3ntq_70", t = {
3
+ wrapper: r,
4
+ input: p,
5
+ thumb: m,
6
+ label: _
7
+ };
8
+ function b({
9
+ children: a,
10
+ className: c,
11
+ size: e,
12
+ state: n,
13
+ ...l
14
+ }) {
15
+ return e ??= "md", /* @__PURE__ */ React.createElement(
16
+ "label",
17
+ {
18
+ className: s(c, t.wrapper),
19
+ "data-size": e,
20
+ "data-state": n
21
+ },
22
+ /* @__PURE__ */ React.createElement("input", { ...l, className: t.input, type: "checkbox" }),
23
+ /* @__PURE__ */ React.createElement("div", { className: t.thumb }),
24
+ /* @__PURE__ */ React.createElement("div", { className: t.label }, a)
25
+ );
26
+ }
27
+ export {
28
+ b as Switch
29
+ };
@@ -0,0 +1,21 @@
1
+ import { c as s } from "./clsx-OuTLNxxd.js";
2
+ import { forwardRef as m } from "react";
3
+ import { i as c } from "./Input.module-P--gA8sq.js";
4
+ const o = "_textarea_1f7g2_7", x = {
5
+ textarea: o
6
+ }, i = m(
7
+ ({ size: t, state: e, ...a }, r) => (t ??= "md", /* @__PURE__ */ React.createElement(
8
+ "textarea",
9
+ {
10
+ ...a,
11
+ ref: r,
12
+ className: s(c.input, x.textarea, a.className),
13
+ "data-size": t,
14
+ "data-state": e
15
+ }
16
+ ))
17
+ );
18
+ i.displayName = "TextArea";
19
+ export {
20
+ i as TextArea
21
+ };
@@ -0,0 +1,6 @@
1
+ function e(t) {
2
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
3
+ }
4
+ export {
5
+ e as g
6
+ };
@@ -0,0 +1,16 @@
1
+ function a(r) {
2
+ var f, n, t = "";
3
+ if (typeof r == "string" || typeof r == "number") t += r;
4
+ else if (typeof r == "object") if (Array.isArray(r)) {
5
+ var o = r.length;
6
+ for (f = 0; f < o; f++) r[f] && (n = a(r[f])) && (t && (t += " "), t += n);
7
+ } else for (n in r) r[n] && (t && (t += " "), t += n);
8
+ return t;
9
+ }
10
+ function i() {
11
+ for (var r, f, n = 0, t = "", o = arguments.length; n < o; n++) (r = arguments[n]) && (f = a(r)) && (t && (t += " "), t += f);
12
+ return t;
13
+ }
14
+ export {
15
+ i as c
16
+ };