@unpunnyfuns/swatchbook-blocks 0.20.0 → 0.20.2
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/index.mjs +76 -55
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +6 -0
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1082,62 +1082,65 @@ function ColorTable({ filter, caption, sortBy = "path", sortDir = "asc", searcha
|
|
|
1082
1082
|
"aria-label": "Fuzzy-search colors by path or value",
|
|
1083
1083
|
"data-testid": "color-table-search"
|
|
1084
1084
|
})
|
|
1085
|
-
}), /* @__PURE__ */
|
|
1086
|
-
className: "sb-color-
|
|
1087
|
-
children:
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
/* @__PURE__ */ jsx("th", {
|
|
1094
|
-
className: "sb-color-table__th sb-color-table__th--swatch",
|
|
1095
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
1096
|
-
className: "sb-color-table__sr-only",
|
|
1097
|
-
children: "Swatch"
|
|
1098
|
-
})
|
|
1099
|
-
}),
|
|
1100
|
-
/* @__PURE__ */ jsx("th", {
|
|
1101
|
-
className: "sb-color-table__th sb-color-table__th--path",
|
|
1102
|
-
children: "Name"
|
|
1103
|
-
}),
|
|
1104
|
-
/* @__PURE__ */ jsx("th", {
|
|
1105
|
-
className: "sb-color-table__th",
|
|
1106
|
-
children: "Value"
|
|
1107
|
-
}),
|
|
1108
|
-
/* @__PURE__ */ jsx("th", {
|
|
1109
|
-
className: "sb-color-table__th",
|
|
1110
|
-
children: "CSS var"
|
|
1111
|
-
}),
|
|
1112
|
-
/* @__PURE__ */ jsx("th", {
|
|
1113
|
-
className: "sb-color-table__th",
|
|
1114
|
-
children: "Alias"
|
|
1085
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1086
|
+
className: "sb-color-table__scroll",
|
|
1087
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
1088
|
+
className: "sb-color-table__table",
|
|
1089
|
+
children: [
|
|
1090
|
+
/* @__PURE__ */ jsx("caption", {
|
|
1091
|
+
className: "sb-color-table__caption",
|
|
1092
|
+
children: captionText
|
|
1115
1093
|
}),
|
|
1116
|
-
/* @__PURE__ */ jsx("
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1094
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
1095
|
+
/* @__PURE__ */ jsx("th", {
|
|
1096
|
+
className: "sb-color-table__th sb-color-table__th--swatch",
|
|
1097
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1098
|
+
className: "sb-color-table__sr-only",
|
|
1099
|
+
children: "Swatch"
|
|
1100
|
+
})
|
|
1101
|
+
}),
|
|
1102
|
+
/* @__PURE__ */ jsx("th", {
|
|
1103
|
+
className: "sb-color-table__th sb-color-table__th--path",
|
|
1104
|
+
children: "Name"
|
|
1105
|
+
}),
|
|
1106
|
+
/* @__PURE__ */ jsx("th", {
|
|
1107
|
+
className: "sb-color-table__th",
|
|
1108
|
+
children: "Value"
|
|
1109
|
+
}),
|
|
1110
|
+
/* @__PURE__ */ jsx("th", {
|
|
1111
|
+
className: "sb-color-table__th",
|
|
1112
|
+
children: "CSS var"
|
|
1113
|
+
}),
|
|
1114
|
+
/* @__PURE__ */ jsx("th", {
|
|
1115
|
+
className: "sb-color-table__th",
|
|
1116
|
+
children: "Alias"
|
|
1117
|
+
}),
|
|
1118
|
+
/* @__PURE__ */ jsx("th", {
|
|
1119
|
+
className: "sb-color-table__th sb-color-table__th--expand",
|
|
1120
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1121
|
+
className: "sb-color-table__sr-only",
|
|
1122
|
+
children: "Expand"
|
|
1123
|
+
})
|
|
1121
1124
|
})
|
|
1122
|
-
})
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1125
|
+
] }) }),
|
|
1126
|
+
/* @__PURE__ */ jsxs("tbody", { children: [visibleGroups.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", {
|
|
1127
|
+
colSpan: COLUMN_COUNT,
|
|
1128
|
+
className: "sb-color-table__td sb-color-table__empty-row",
|
|
1129
|
+
children: [
|
|
1130
|
+
"No colors match \"",
|
|
1131
|
+
query.trim(),
|
|
1132
|
+
"\"."
|
|
1133
|
+
]
|
|
1134
|
+
}) }), visibleGroups.map((group) => /* @__PURE__ */ jsx(GroupRow, {
|
|
1135
|
+
group,
|
|
1136
|
+
selectedLabel: selectedByBase[group.base],
|
|
1137
|
+
expanded: expandedByBase.has(group.base),
|
|
1138
|
+
onToggleExpand: toggleExpand,
|
|
1139
|
+
onSelectVariant: selectVariant,
|
|
1140
|
+
...onSelect !== void 0 && { onSelect }
|
|
1141
|
+
}, group.base))] })
|
|
1142
|
+
]
|
|
1143
|
+
})
|
|
1141
1144
|
})]
|
|
1142
1145
|
});
|
|
1143
1146
|
}
|
|
@@ -2068,13 +2071,31 @@ function GradientPalette({ filter, caption, sortBy = "path", sortDir = "asc" })
|
|
|
2068
2071
|
//#endregion
|
|
2069
2072
|
//#region src/internal/prefers-reduced-motion.ts
|
|
2070
2073
|
/**
|
|
2074
|
+
* True when rendering inside Chromatic's snapshot runner. Chromatic's
|
|
2075
|
+
* browser ships a recognisable user-agent string; checked here so
|
|
2076
|
+
* motion-looping components can fall back to their static state for
|
|
2077
|
+
* deterministic snapshots without needing a global Chromatic parameter
|
|
2078
|
+
* (globally forcing `prefersReducedMotion: true` broke Chromatic's
|
|
2079
|
+
* verification parser in our setup — see commit 893331f).
|
|
2080
|
+
*/
|
|
2081
|
+
function isChromatic() {
|
|
2082
|
+
if (typeof navigator === "undefined") return false;
|
|
2083
|
+
return navigator.userAgent.includes("Chromatic");
|
|
2084
|
+
}
|
|
2085
|
+
/**
|
|
2071
2086
|
* Reactive `prefers-reduced-motion: reduce` detector. Returns the current
|
|
2072
|
-
* match and updates if the user toggles the OS-level preference.
|
|
2087
|
+
* match and updates if the user toggles the OS-level preference. Also
|
|
2088
|
+
* returns `true` under Chromatic to keep animated samples deterministic
|
|
2089
|
+
* during visual regression capture.
|
|
2073
2090
|
*/
|
|
2074
2091
|
function usePrefersReducedMotion() {
|
|
2075
2092
|
const [reduced, setReduced] = useState(false);
|
|
2076
2093
|
useEffect(() => {
|
|
2077
2094
|
if (typeof window === "undefined") return;
|
|
2095
|
+
if (isChromatic()) {
|
|
2096
|
+
setReduced(true);
|
|
2097
|
+
return;
|
|
2098
|
+
}
|
|
2078
2099
|
const query = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
2079
2100
|
setReduced(query.matches);
|
|
2080
2101
|
const onChange = (e) => setReduced(e.matches);
|