@nypl/web-reader 4.3.3 → 4.3.5

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 CHANGED
@@ -1648,2397 +1648,2384 @@ function variantSolid(props) {
1648
1648
  }
1649
1649
  var button_default = ButtonStyle;
1650
1650
 
1651
- // node_modules/@chakra-ui/shared-utils/dist/index.mjs
1652
- function isDev() {
1653
- return process.env.NODE_ENV !== "production";
1654
- }
1655
- function isObject(value) {
1656
- const type = typeof value;
1657
- return value != null && (type === "object" || type === "function") && !Array.isArray(value);
1658
- }
1659
- var warn = (options) => {
1660
- const { condition, message } = options;
1661
- if (condition && isDev()) {
1662
- console.warn(message);
1663
- }
1651
+ // src/ui/nypl-base-theme/foundations/breakpoints.ts
1652
+ var breakpoints = {
1653
+ sm: "20em",
1654
+ // 320px
1655
+ md: "38em",
1656
+ // 600px
1657
+ lg: "60em",
1658
+ // 960px
1659
+ xl: "80em",
1660
+ // 1280px
1661
+ "2xl": "96em"
1664
1662
  };
1665
- function runIfFn(valueOrFn, ...args) {
1666
- return isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
1667
- }
1668
- var isFunction = (value) => typeof value === "function";
1669
- var dataAttr = (condition) => condition ? "" : void 0;
1663
+ var breakpoints_default = breakpoints;
1670
1664
 
1671
- // node_modules/@chakra-ui/styled-system/dist/index.mjs
1672
- var import_lodash = __toESM(require_lodash(), 1);
1673
- var import_lodash2 = __toESM(require_lodash(), 1);
1674
- var import_lodash3 = __toESM(require_lodash(), 1);
1675
- var import_lodash4 = __toESM(require_lodash(), 1);
1676
- var isImportant = (value) => /!(important)?$/.test(value);
1677
- var withoutImportant = (value) => typeof value === "string" ? value.replace(/!(important)?$/, "").trim() : value;
1678
- var tokenToCSSVar = (scale, value) => (theme2) => {
1679
- const valueStr = String(value);
1680
- const important = isImportant(valueStr);
1681
- const valueWithoutImportant = withoutImportant(valueStr);
1682
- const key = scale ? `${scale}.${valueWithoutImportant}` : valueWithoutImportant;
1683
- let transformed = isObject(theme2.__cssMap) && key in theme2.__cssMap ? theme2.__cssMap[key].varRef : value;
1684
- transformed = withoutImportant(transformed);
1685
- return important ? `${transformed} !important` : transformed;
1686
- };
1687
- function createTransform(options) {
1688
- const { scale, transform: transform2, compose: compose2 } = options;
1689
- const fn = (value, theme2) => {
1690
- var _a2;
1691
- const _value = tokenToCSSVar(scale, value)(theme2);
1692
- let result = (_a2 = transform2 == null ? void 0 : transform2(_value, theme2)) != null ? _a2 : _value;
1693
- if (compose2) {
1694
- result = compose2(result, theme2);
1695
- }
1696
- return result;
1697
- };
1698
- return fn;
1699
- }
1700
- var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
1701
- function toConfig(scale, transform2) {
1702
- return (property) => {
1703
- const result = { property, scale };
1704
- result.transform = createTransform({
1705
- scale,
1706
- transform: transform2
1707
- });
1708
- return result;
1709
- };
1710
- }
1711
- var getRtl = ({ rtl, ltr }) => (theme2) => theme2.direction === "rtl" ? rtl : ltr;
1712
- function logical(options) {
1713
- const { property, scale, transform: transform2 } = options;
1714
- return {
1715
- scale,
1716
- property: getRtl(property),
1717
- transform: scale ? createTransform({
1718
- scale,
1719
- compose: transform2
1720
- }) : transform2
1721
- };
1722
- }
1723
- var transformTemplate = [
1724
- "rotate(var(--chakra-rotate, 0))",
1725
- "scaleX(var(--chakra-scale-x, 1))",
1726
- "scaleY(var(--chakra-scale-y, 1))",
1727
- "skewX(var(--chakra-skew-x, 0))",
1728
- "skewY(var(--chakra-skew-y, 0))"
1729
- ];
1730
- function getTransformTemplate() {
1731
- return [
1732
- "translateX(var(--chakra-translate-x, 0))",
1733
- "translateY(var(--chakra-translate-y, 0))",
1734
- ...transformTemplate
1735
- ].join(" ");
1736
- }
1737
- function getTransformGpuTemplate() {
1738
- return [
1739
- "translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",
1740
- ...transformTemplate
1741
- ].join(" ");
1742
- }
1743
- var filterTemplate = {
1744
- "--chakra-blur": "var(--chakra-empty,/*!*/ /*!*/)",
1745
- "--chakra-brightness": "var(--chakra-empty,/*!*/ /*!*/)",
1746
- "--chakra-contrast": "var(--chakra-empty,/*!*/ /*!*/)",
1747
- "--chakra-grayscale": "var(--chakra-empty,/*!*/ /*!*/)",
1748
- "--chakra-hue-rotate": "var(--chakra-empty,/*!*/ /*!*/)",
1749
- "--chakra-invert": "var(--chakra-empty,/*!*/ /*!*/)",
1750
- "--chakra-saturate": "var(--chakra-empty,/*!*/ /*!*/)",
1751
- "--chakra-sepia": "var(--chakra-empty,/*!*/ /*!*/)",
1752
- "--chakra-drop-shadow": "var(--chakra-empty,/*!*/ /*!*/)",
1753
- filter: [
1754
- "var(--chakra-blur)",
1755
- "var(--chakra-brightness)",
1756
- "var(--chakra-contrast)",
1757
- "var(--chakra-grayscale)",
1758
- "var(--chakra-hue-rotate)",
1759
- "var(--chakra-invert)",
1760
- "var(--chakra-saturate)",
1761
- "var(--chakra-sepia)",
1762
- "var(--chakra-drop-shadow)"
1763
- ].join(" ")
1764
- };
1765
- var backdropFilterTemplate = {
1766
- backdropFilter: [
1767
- "var(--chakra-backdrop-blur)",
1768
- "var(--chakra-backdrop-brightness)",
1769
- "var(--chakra-backdrop-contrast)",
1770
- "var(--chakra-backdrop-grayscale)",
1771
- "var(--chakra-backdrop-hue-rotate)",
1772
- "var(--chakra-backdrop-invert)",
1773
- "var(--chakra-backdrop-opacity)",
1774
- "var(--chakra-backdrop-saturate)",
1775
- "var(--chakra-backdrop-sepia)"
1776
- ].join(" "),
1777
- "--chakra-backdrop-blur": "var(--chakra-empty,/*!*/ /*!*/)",
1778
- "--chakra-backdrop-brightness": "var(--chakra-empty,/*!*/ /*!*/)",
1779
- "--chakra-backdrop-contrast": "var(--chakra-empty,/*!*/ /*!*/)",
1780
- "--chakra-backdrop-grayscale": "var(--chakra-empty,/*!*/ /*!*/)",
1781
- "--chakra-backdrop-hue-rotate": "var(--chakra-empty,/*!*/ /*!*/)",
1782
- "--chakra-backdrop-invert": "var(--chakra-empty,/*!*/ /*!*/)",
1783
- "--chakra-backdrop-opacity": "var(--chakra-empty,/*!*/ /*!*/)",
1784
- "--chakra-backdrop-saturate": "var(--chakra-empty,/*!*/ /*!*/)",
1785
- "--chakra-backdrop-sepia": "var(--chakra-empty,/*!*/ /*!*/)"
1786
- };
1787
- function getRingTemplate(value) {
1788
- return {
1789
- "--chakra-ring-offset-shadow": `var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)`,
1790
- "--chakra-ring-shadow": `var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)`,
1791
- "--chakra-ring-width": value,
1792
- boxShadow: [
1793
- `var(--chakra-ring-offset-shadow)`,
1794
- `var(--chakra-ring-shadow)`,
1795
- `var(--chakra-shadow, 0 0 #0000)`
1796
- ].join(", ")
1797
- };
1798
- }
1799
- var flexDirectionTemplate = {
1800
- "row-reverse": {
1801
- space: "--chakra-space-x-reverse",
1802
- divide: "--chakra-divide-x-reverse"
1803
- },
1804
- "column-reverse": {
1805
- space: "--chakra-space-y-reverse",
1806
- divide: "--chakra-divide-y-reverse"
1807
- }
1808
- };
1809
- var directionMap = {
1810
- "to-t": "to top",
1811
- "to-tr": "to top right",
1812
- "to-r": "to right",
1813
- "to-br": "to bottom right",
1814
- "to-b": "to bottom",
1815
- "to-bl": "to bottom left",
1816
- "to-l": "to left",
1817
- "to-tl": "to top left"
1818
- };
1819
- var valueSet = new Set(Object.values(directionMap));
1820
- var globalSet = /* @__PURE__ */ new Set([
1821
- "none",
1822
- "-moz-initial",
1823
- "inherit",
1824
- "initial",
1825
- "revert",
1826
- "unset"
1827
- ]);
1828
- var trimSpace = (str) => str.trim();
1829
- function parseGradient(value, theme2) {
1830
- if (value == null || globalSet.has(value))
1831
- return value;
1832
- const prevent = isCSSFunction(value) || globalSet.has(value);
1833
- if (!prevent)
1834
- return `url('${value}')`;
1835
- const regex = /(^[a-z-A-Z]+)\((.*)\)/g;
1836
- const results = regex.exec(value);
1837
- const type = results == null ? void 0 : results[1];
1838
- const values = results == null ? void 0 : results[2];
1839
- if (!type || !values)
1840
- return value;
1841
- const _type = type.includes("-gradient") ? type : `${type}-gradient`;
1842
- const [maybeDirection, ...stops] = values.split(",").map(trimSpace).filter(Boolean);
1843
- if ((stops == null ? void 0 : stops.length) === 0)
1844
- return value;
1845
- const direction = maybeDirection in directionMap ? directionMap[maybeDirection] : maybeDirection;
1846
- stops.unshift(direction);
1847
- const _values = stops.map((stop) => {
1848
- if (valueSet.has(stop))
1849
- return stop;
1850
- const firstStop = stop.indexOf(" ");
1851
- const [_color, _stop] = firstStop !== -1 ? [stop.substr(0, firstStop), stop.substr(firstStop + 1)] : [stop];
1852
- const _stopOrFunc = isCSSFunction(_stop) ? _stop : _stop && _stop.split(" ");
1853
- const key = `colors.${_color}`;
1854
- const color2 = key in theme2.__cssMap ? theme2.__cssMap[key].varRef : _color;
1855
- return _stopOrFunc ? [
1856
- color2,
1857
- ...Array.isArray(_stopOrFunc) ? _stopOrFunc : [_stopOrFunc]
1858
- ].join(" ") : color2;
1859
- });
1860
- return `${_type}(${_values.join(", ")})`;
1861
- }
1862
- var isCSSFunction = (value) => {
1863
- return typeof value === "string" && value.includes("(") && value.includes(")");
1864
- };
1865
- var gradientTransform = (value, theme2) => parseGradient(value, theme2 != null ? theme2 : {});
1866
- function isCssVar(value) {
1867
- return /^var\(--.+\)$/.test(value);
1868
- }
1869
- var analyzeCSSValue = (value) => {
1870
- const num = parseFloat(value.toString());
1871
- const unit = value.toString().replace(String(num), "");
1872
- return { unitless: !unit, value: num, unit };
1873
- };
1874
- var wrap = (str) => (value) => `${str}(${value})`;
1875
- var transformFunctions = {
1876
- filter(value) {
1877
- return value !== "auto" ? value : filterTemplate;
1665
+ // src/ui/nypl-base-theme/foundations/typography.ts
1666
+ var typography2 = {
1667
+ fonts: {
1668
+ body: "-apple-system, BlinkMacSystemFont, system-ui, sans-serif",
1669
+ heading: "-apple-system, BlinkMacSystemFont, system-ui, sans-seri",
1670
+ mono: `Courier,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace`
1878
1671
  },
1879
- backdropFilter(value) {
1880
- return value !== "auto" ? value : backdropFilterTemplate;
1672
+ fontSizes: {
1673
+ "-2": "0.75rem",
1674
+ "-1": "0.875rem",
1675
+ "0": "1rem",
1676
+ "1": "1.125rem",
1677
+ "2": "1.25rem",
1678
+ "3": "1.75rem",
1679
+ "4": "2.25rem",
1680
+ "5": "3rem"
1881
1681
  },
1882
- ring(value) {
1883
- return getRingTemplate(transformFunctions.px(value));
1682
+ fontWeights: {
1683
+ light: 300,
1684
+ regular: 400,
1685
+ medium: 500,
1686
+ bold: 700
1884
1687
  },
1885
- bgClip(value) {
1886
- return value === "text" ? { color: "transparent", backgroundClip: "text" } : { backgroundClip: value };
1887
- },
1888
- transform(value) {
1889
- if (value === "auto")
1890
- return getTransformTemplate();
1891
- if (value === "auto-gpu")
1892
- return getTransformGpuTemplate();
1893
- return value;
1894
- },
1895
- vh(value) {
1896
- return value === "$100vh" ? "var(--chakra-vh)" : value;
1688
+ lineHeights: [1, 1.1, 1.25, 1.5, 2, 2.5],
1689
+ letterSpacings: {
1690
+ tighter: "-0.05em",
1691
+ tight: "-0.025em",
1692
+ normal: "0",
1693
+ wide: "0.025em",
1694
+ wider: "0.05em",
1695
+ widest: "0.1em"
1696
+ }
1697
+ };
1698
+ var typography_default2 = typography2;
1699
+
1700
+ // src/ui/nypl-base-theme/foundations/colors.ts
1701
+ var colors2 = {
1702
+ transparent: "transparent",
1703
+ // ui fills
1704
+ ui: {
1705
+ black: "#000",
1706
+ white: "#fff",
1707
+ focus: "#4181F1",
1708
+ link: {
1709
+ primary: "#0576D3",
1710
+ secondary: "#004B98"
1711
+ },
1712
+ success: {
1713
+ primary: "#077719",
1714
+ secondary: "#095212"
1715
+ },
1716
+ warning: {
1717
+ primary: "#F0974E",
1718
+ secondary: "#EC7B1F"
1719
+ },
1720
+ status: {
1721
+ primary: "#F9E08E",
1722
+ secondary: "#FBE7E1"
1723
+ },
1724
+ error: "#97272C",
1725
+ disabled: {
1726
+ primary: "#E0E0E0",
1727
+ secondary: "#FAFAFA"
1728
+ },
1729
+ test: "#FF6347",
1730
+ gray: {
1731
+ active: "#D9D9D9",
1732
+ disabled: "#979797",
1733
+ icon: "#1C1B1F",
1734
+ medium: "#BDBDBD",
1735
+ dark: "#616161",
1736
+ "x-dark": "#424242",
1737
+ "light-cool": "#E0E0E0",
1738
+ "light-warm": "#EFEDEB",
1739
+ "x-light-cool": "#F5F5F5",
1740
+ "x-light-warm": "#F8F8F7",
1741
+ "xx-light-cool": "#FAFAFA"
1742
+ }
1897
1743
  },
1898
- px(value) {
1899
- if (value == null)
1900
- return value;
1901
- const { unitless } = analyzeCSSValue(value);
1902
- return unitless || typeof value === "number" ? `${value}px` : value;
1744
+ // brand fills. Only primary and secondary filled in for now.
1745
+ brand: {
1746
+ primary: "#C60917",
1747
+ secondary: "#760000",
1748
+ "nypl-red": "#D0343A"
1903
1749
  },
1904
- fraction(value) {
1905
- return !(typeof value === "number") || value > 1 ? value : `${value * 100}%`;
1750
+ /**
1751
+ * The following color scales are useful for color edge cases
1752
+ * where a distinct named ui or brand color doesn't quite work.
1753
+ */
1754
+ // based on ui/gray/medium
1755
+ gray: {
1756
+ "50": "#F2F2F2",
1757
+ "100": "#DBDBDB",
1758
+ "200": "#C4C4C4",
1759
+ "300": "#ADADAD",
1760
+ "400": "#969696",
1761
+ "500": "#808080",
1762
+ "600": "#666666",
1763
+ "700": "#4D4D4D",
1764
+ "800": "#333333",
1765
+ "900": "#1A1A1A"
1906
1766
  },
1907
- float(value, theme2) {
1908
- const map = { left: "right", right: "left" };
1909
- return theme2.direction === "rtl" ? map[value] : value;
1767
+ // based on NYPL red
1768
+ red: {
1769
+ 50: "#ffe7e6",
1770
+ 100: "#f6c2bf",
1771
+ 200: "#e99796",
1772
+ 300: "#de6d6e",
1773
+ 400: "#d4454a",
1774
+ 500: "#ba2f2b",
1775
+ 600: "#922b21",
1776
+ 700: "#692216",
1777
+ 800: "#41150a",
1778
+ 900: "#1d0a01"
1910
1779
  },
1911
- degree(value) {
1912
- if (isCssVar(value) || value == null)
1913
- return value;
1914
- const unitless = typeof value === "string" && !value.endsWith("deg");
1915
- return typeof value === "number" || unitless ? `${value}deg` : value;
1780
+ // based on ui/warning/secondary
1781
+ orange: {
1782
+ "50": "#FDF1E7",
1783
+ "100": "#F9D8BD",
1784
+ "200": "#F6BF93",
1785
+ "300": "#F2A669",
1786
+ "400": "#EF8D3E",
1787
+ "500": "#EB7414",
1788
+ "600": "#BC5D10",
1789
+ "700": "#8D460C",
1790
+ "800": "#5E2F08",
1791
+ "900": "#2F1704"
1916
1792
  },
1917
- gradient: gradientTransform,
1918
- blur: wrap("blur"),
1919
- opacity: wrap("opacity"),
1920
- brightness: wrap("brightness"),
1921
- contrast: wrap("contrast"),
1922
- dropShadow: wrap("drop-shadow"),
1923
- grayscale: wrap("grayscale"),
1924
- hueRotate: wrap("hue-rotate"),
1925
- invert: wrap("invert"),
1926
- saturate: wrap("saturate"),
1927
- sepia: wrap("sepia"),
1928
- bgImage(value) {
1929
- if (value == null)
1930
- return value;
1931
- const prevent = isCSSFunction(value) || globalSet.has(value);
1932
- return !prevent ? `url(${value})` : value;
1793
+ // based on ui/status/primary
1794
+ yellow: {
1795
+ "50": "#FEF8E7",
1796
+ "100": "#FBECBB",
1797
+ "200": "#F9E090",
1798
+ "300": "#F7D464",
1799
+ "400": "#F4C938",
1800
+ "500": "#F2BD0D",
1801
+ "600": "#C2970A",
1802
+ "700": "#917108",
1803
+ "800": "#614B05",
1804
+ "900": "#302603"
1933
1805
  },
1934
- outline(value) {
1935
- const isNoneOrZero = String(value) === "0" || String(value) === "none";
1936
- return value !== null && isNoneOrZero ? { outline: "2px solid transparent", outlineOffset: "2px" } : { outline: value };
1806
+ // based on ui/success/primary
1807
+ green: {
1808
+ "50": "#E7FEEB",
1809
+ "100": "#BCFBC6",
1810
+ "200": "#90F8A1",
1811
+ "300": "#65F67C",
1812
+ "400": "#3AF357",
1813
+ "500": "#0EF133",
1814
+ "600": "#0BC128",
1815
+ "700": "#08911E",
1816
+ "800": "#066014",
1817
+ "900": "#03300A"
1937
1818
  },
1938
- flexDirection(value) {
1939
- var _a2;
1940
- const { space: space2, divide: divide2 } = (_a2 = flexDirectionTemplate[value]) != null ? _a2 : {};
1941
- const result = { flexDirection: value };
1942
- if (space2)
1943
- result[space2] = 1;
1944
- if (divide2)
1945
- result[divide2] = 1;
1946
- return result;
1819
+ // based on NYPL blue
1820
+ blue: {
1821
+ 50: "#dbefff",
1822
+ 100: "#add2ff",
1823
+ 200: "#7cb8ff",
1824
+ 300: "#4aa2ff",
1825
+ 400: "#1a8fff",
1826
+ 500: "#007ee6",
1827
+ 600: "#0056b4",
1828
+ 700: "#003582",
1829
+ 800: "#001a51",
1830
+ 900: "#000621"
1947
1831
  }
1948
1832
  };
1949
- var t = {
1950
- borderWidths: toConfig("borderWidths"),
1951
- borderStyles: toConfig("borderStyles"),
1952
- colors: toConfig("colors"),
1953
- borders: toConfig("borders"),
1954
- gradients: toConfig("gradients", transformFunctions.gradient),
1955
- radii: toConfig("radii", transformFunctions.px),
1956
- space: toConfig("space", pipe(transformFunctions.vh, transformFunctions.px)),
1957
- spaceT: toConfig("space", pipe(transformFunctions.vh, transformFunctions.px)),
1958
- degreeT(property) {
1959
- return { property, transform: transformFunctions.degree };
1960
- },
1961
- prop(property, scale, transform2) {
1962
- return __spreadValues({
1963
- property,
1964
- scale
1965
- }, scale && {
1966
- transform: createTransform({ scale, transform: transform2 })
1967
- });
1968
- },
1969
- propT(property, transform2) {
1970
- return { property, transform: transform2 };
1971
- },
1972
- sizes: toConfig("sizes", pipe(transformFunctions.vh, transformFunctions.px)),
1973
- sizesT: toConfig("sizes", pipe(transformFunctions.vh, transformFunctions.fraction)),
1974
- shadows: toConfig("shadows"),
1975
- logical,
1976
- blur: toConfig("blur", transformFunctions.blur)
1977
- };
1978
- var background = {
1979
- background: t.colors("background"),
1980
- backgroundColor: t.colors("backgroundColor"),
1981
- backgroundImage: t.gradients("backgroundImage"),
1982
- backgroundSize: true,
1983
- backgroundPosition: true,
1984
- backgroundRepeat: true,
1985
- backgroundAttachment: true,
1986
- backgroundClip: { transform: transformFunctions.bgClip },
1987
- bgSize: t.prop("backgroundSize"),
1988
- bgPosition: t.prop("backgroundPosition"),
1989
- bg: t.colors("background"),
1990
- bgColor: t.colors("backgroundColor"),
1991
- bgPos: t.prop("backgroundPosition"),
1992
- bgRepeat: t.prop("backgroundRepeat"),
1993
- bgAttachment: t.prop("backgroundAttachment"),
1994
- bgGradient: t.gradients("backgroundImage"),
1995
- bgClip: { transform: transformFunctions.bgClip }
1833
+ var colors_default2 = colors2;
1834
+
1835
+ // src/ui/nypl-base-theme/foundations/radii.ts
1836
+ var radii = {
1837
+ none: "0",
1838
+ sm: "0.125rem",
1839
+ base: "0.25rem",
1840
+ md: "0.375rem",
1841
+ lg: "0.5rem",
1842
+ xl: "0.75rem",
1843
+ "2xl": "1rem",
1844
+ "3xl": "1.5rem",
1845
+ full: "9999px"
1996
1846
  };
1997
- Object.assign(background, {
1998
- bgImage: background.backgroundImage,
1999
- bgImg: background.backgroundImage
2000
- });
2001
- var border = {
2002
- border: t.borders("border"),
2003
- borderWidth: t.borderWidths("borderWidth"),
2004
- borderStyle: t.borderStyles("borderStyle"),
2005
- borderColor: t.colors("borderColor"),
2006
- borderRadius: t.radii("borderRadius"),
2007
- borderTop: t.borders("borderTop"),
2008
- borderBlockStart: t.borders("borderBlockStart"),
2009
- borderTopLeftRadius: t.radii("borderTopLeftRadius"),
2010
- borderStartStartRadius: t.logical({
2011
- scale: "radii",
2012
- property: {
2013
- ltr: "borderTopLeftRadius",
2014
- rtl: "borderTopRightRadius"
2015
- }
2016
- }),
2017
- borderEndStartRadius: t.logical({
2018
- scale: "radii",
2019
- property: {
2020
- ltr: "borderBottomLeftRadius",
2021
- rtl: "borderBottomRightRadius"
2022
- }
2023
- }),
2024
- borderTopRightRadius: t.radii("borderTopRightRadius"),
2025
- borderStartEndRadius: t.logical({
2026
- scale: "radii",
2027
- property: {
2028
- ltr: "borderTopRightRadius",
2029
- rtl: "borderTopLeftRadius"
1847
+ var radii_default = radii;
1848
+
1849
+ // src/ui/nypl-base-theme/foundations/spacing.ts
1850
+ var spacing = {
1851
+ space: {
1852
+ px: "1px",
1853
+ 0: "0",
1854
+ 0.5: "0.125rem",
1855
+ // 4px
1856
+ 1: "0.25rem",
1857
+ 1.5: "0.375rem",
1858
+ // 8px
1859
+ 2: "0.5rem",
1860
+ 2.5: "0.625rem",
1861
+ 3: "0.75rem",
1862
+ 3.5: "0.875rem",
1863
+ // 16px
1864
+ 4: "1rem",
1865
+ 5: "1.25rem",
1866
+ // 24px
1867
+ 6: "1.5rem",
1868
+ 7: "1.75rem",
1869
+ // 32 px
1870
+ 8: "2rem",
1871
+ 9: "2.25rem",
1872
+ 10: "2.5rem",
1873
+ // 48px
1874
+ 12: "3rem",
1875
+ 14: "3.5rem",
1876
+ // 64px
1877
+ 16: "4rem",
1878
+ 20: "5rem",
1879
+ // 96px
1880
+ 24: "6rem",
1881
+ 28: "7rem",
1882
+ 32: "8rem",
1883
+ 36: "9rem",
1884
+ 40: "10rem",
1885
+ 44: "11rem",
1886
+ 48: "12rem",
1887
+ 52: "13rem",
1888
+ 56: "14rem",
1889
+ 60: "15rem",
1890
+ 64: "16rem",
1891
+ 72: "18rem",
1892
+ 80: "20rem",
1893
+ 96: "24rem"
1894
+ }
1895
+ };
1896
+ var spacing_default = spacing;
1897
+
1898
+ // src/ui/nypl-base-theme/components/checkbox.ts
1899
+ var baseStyleLabel = {
1900
+ userSelect: "none",
1901
+ fontWeight: "light",
1902
+ _disabled: { color: "ui.gray.x-dark", opacity: 1 }
1903
+ };
1904
+ var Checkbox = {
1905
+ // style object for base or default style
1906
+ baseStyle: {
1907
+ control: {
1908
+ borderColor: "ui.gray.dark",
1909
+ _hover: {
1910
+ bg: "white",
1911
+ _disabled: {
1912
+ bg: "ui.gray.x-light-cool"
1913
+ }
1914
+ },
1915
+ _checked: {
1916
+ bg: "white",
1917
+ color: "gray.800",
1918
+ borderColor: "ui.gray.dark",
1919
+ _hover: {
1920
+ bg: "white",
1921
+ borderColor: "ui.gray.x-dark"
1922
+ }
1923
+ },
1924
+ _disabled: {
1925
+ bg: "ui.gray.x-light-cool",
1926
+ borderColor: "ui.gray.medium"
1927
+ }
1928
+ },
1929
+ label: baseStyleLabel
1930
+ },
1931
+ // styles for different sizes ("sm", "md", "lg")
1932
+ sizes: {},
1933
+ // styles for different visual variants ("outline", "solid")
1934
+ variants: {},
1935
+ // default values for `size`, `variant`, `colorScheme`
1936
+ defaultProps: {
1937
+ size: "md",
1938
+ colorScheme: "gray"
1939
+ }
1940
+ };
1941
+ var checkbox_default = Checkbox;
1942
+
1943
+ // src/ui/nypl-base-theme/components/input.ts
1944
+ var size = {
1945
+ lg: {
1946
+ fontSize: "lg",
1947
+ px: 4,
1948
+ h: 12,
1949
+ borderRadius: "none"
1950
+ },
1951
+ md: {
1952
+ fontSize: "sm",
1953
+ px: 4,
1954
+ h: 9,
1955
+ borderRadius: "none"
1956
+ },
1957
+ sm: {
1958
+ fontSize: "sm",
1959
+ px: 3,
1960
+ h: 8,
1961
+ borderRadius: "none"
1962
+ },
1963
+ xs: {
1964
+ fontSize: "xs",
1965
+ px: 2,
1966
+ h: 6,
1967
+ borderRadius: "none"
1968
+ }
1969
+ };
1970
+ var sizes2 = {
1971
+ lg: {
1972
+ field: size.lg,
1973
+ addon: size.lg
1974
+ },
1975
+ md: {
1976
+ field: size.md,
1977
+ addon: size.md
1978
+ },
1979
+ sm: {
1980
+ field: size.sm,
1981
+ addon: size.sm
1982
+ },
1983
+ xs: {
1984
+ field: size.xs,
1985
+ addon: size.xs
1986
+ }
1987
+ };
1988
+ var Input = {
1989
+ // style object for base or default style
1990
+ baseStyle: {
1991
+ field: {
1992
+ borderRadius: "none",
1993
+ fontSize: "sm",
1994
+ _focus: {
1995
+ borderColor: "ui.link.primary",
1996
+ _hover: {
1997
+ borderColor: "ui.link.primary"
1998
+ }
1999
+ },
2000
+ _placeholder: {
2001
+ fontStyle: "italic",
2002
+ color: "ui.gray.dark"
2003
+ },
2004
+ _invalid: {
2005
+ borderColor: "ui.error",
2006
+ _placeholder: {
2007
+ color: "ui.error"
2008
+ },
2009
+ _hover: {
2010
+ borderColor: "ui.error"
2011
+ }
2012
+ }
2030
2013
  }
2031
- }),
2032
- borderEndEndRadius: t.logical({
2033
- scale: "radii",
2034
- property: {
2035
- ltr: "borderBottomRightRadius",
2036
- rtl: "borderBottomLeftRadius"
2014
+ },
2015
+ // styles for different sizes ("sm", "md", "lg")
2016
+ sizes: sizes2,
2017
+ // styles for different visual variants ("outline", "solid")
2018
+ variants: {
2019
+ outline: {
2020
+ field: {
2021
+ _disabled: {
2022
+ bg: "ui.gray.xx-light-cool"
2023
+ },
2024
+ _focus: {
2025
+ boxShadow: "none",
2026
+ _hover: {
2027
+ borderColor: "ui.link.primary"
2028
+ }
2029
+ },
2030
+ _invalid: {
2031
+ boxShadow: "none"
2032
+ }
2033
+ }
2037
2034
  }
2038
- }),
2039
- borderRight: t.borders("borderRight"),
2040
- borderInlineEnd: t.borders("borderInlineEnd"),
2041
- borderBottom: t.borders("borderBottom"),
2042
- borderBlockEnd: t.borders("borderBlockEnd"),
2043
- borderBottomLeftRadius: t.radii("borderBottomLeftRadius"),
2044
- borderBottomRightRadius: t.radii("borderBottomRightRadius"),
2045
- borderLeft: t.borders("borderLeft"),
2046
- borderInlineStart: {
2047
- property: "borderInlineStart",
2048
- scale: "borders"
2049
2035
  },
2050
- borderInlineStartRadius: t.logical({
2051
- scale: "radii",
2052
- property: {
2053
- ltr: ["borderTopLeftRadius", "borderBottomLeftRadius"],
2054
- rtl: ["borderTopRightRadius", "borderBottomRightRadius"]
2036
+ // default values for `size`, `variant`, `colorScheme`
2037
+ defaultProps: {
2038
+ size: "md"
2039
+ }
2040
+ };
2041
+ var input_default = Input;
2042
+
2043
+ // src/ui/nypl-base-theme/foundations/global.ts
2044
+ var global2 = {
2045
+ // styles for the `body`
2046
+ body: {
2047
+ bg: "white",
2048
+ color: "black"
2049
+ },
2050
+ // styles for the `a`
2051
+ a: {
2052
+ color: "ui.link.primary",
2053
+ _hover: {
2054
+ textDecoration: "underline"
2055
2055
  }
2056
- }),
2057
- borderInlineEndRadius: t.logical({
2058
- scale: "radii",
2059
- property: {
2060
- ltr: ["borderTopRightRadius", "borderBottomRightRadius"],
2061
- rtl: ["borderTopLeftRadius", "borderBottomLeftRadius"]
2062
- }
2063
- }),
2064
- borderX: t.borders(["borderLeft", "borderRight"]),
2065
- borderInline: t.borders("borderInline"),
2066
- borderY: t.borders(["borderTop", "borderBottom"]),
2067
- borderBlock: t.borders("borderBlock"),
2068
- borderTopWidth: t.borderWidths("borderTopWidth"),
2069
- borderBlockStartWidth: t.borderWidths("borderBlockStartWidth"),
2070
- borderTopColor: t.colors("borderTopColor"),
2071
- borderBlockStartColor: t.colors("borderBlockStartColor"),
2072
- borderTopStyle: t.borderStyles("borderTopStyle"),
2073
- borderBlockStartStyle: t.borderStyles("borderBlockStartStyle"),
2074
- borderBottomWidth: t.borderWidths("borderBottomWidth"),
2075
- borderBlockEndWidth: t.borderWidths("borderBlockEndWidth"),
2076
- borderBottomColor: t.colors("borderBottomColor"),
2077
- borderBlockEndColor: t.colors("borderBlockEndColor"),
2078
- borderBottomStyle: t.borderStyles("borderBottomStyle"),
2079
- borderBlockEndStyle: t.borderStyles("borderBlockEndStyle"),
2080
- borderLeftWidth: t.borderWidths("borderLeftWidth"),
2081
- borderInlineStartWidth: t.borderWidths("borderInlineStartWidth"),
2082
- borderLeftColor: t.colors("borderLeftColor"),
2083
- borderInlineStartColor: t.colors("borderInlineStartColor"),
2084
- borderLeftStyle: t.borderStyles("borderLeftStyle"),
2085
- borderInlineStartStyle: t.borderStyles("borderInlineStartStyle"),
2086
- borderRightWidth: t.borderWidths("borderRightWidth"),
2087
- borderInlineEndWidth: t.borderWidths("borderInlineEndWidth"),
2088
- borderRightColor: t.colors("borderRightColor"),
2089
- borderInlineEndColor: t.colors("borderInlineEndColor"),
2090
- borderRightStyle: t.borderStyles("borderRightStyle"),
2091
- borderInlineEndStyle: t.borderStyles("borderInlineEndStyle"),
2092
- borderTopRadius: t.radii(["borderTopLeftRadius", "borderTopRightRadius"]),
2093
- borderBottomRadius: t.radii([
2094
- "borderBottomLeftRadius",
2095
- "borderBottomRightRadius"
2096
- ]),
2097
- borderLeftRadius: t.radii(["borderTopLeftRadius", "borderBottomLeftRadius"]),
2098
- borderRightRadius: t.radii([
2099
- "borderTopRightRadius",
2100
- "borderBottomRightRadius"
2101
- ])
2056
+ }
2102
2057
  };
2103
- Object.assign(border, {
2104
- rounded: border.borderRadius,
2105
- roundedTop: border.borderTopRadius,
2106
- roundedTopLeft: border.borderTopLeftRadius,
2107
- roundedTopRight: border.borderTopRightRadius,
2108
- roundedTopStart: border.borderStartStartRadius,
2109
- roundedTopEnd: border.borderStartEndRadius,
2110
- roundedBottom: border.borderBottomRadius,
2111
- roundedBottomLeft: border.borderBottomLeftRadius,
2112
- roundedBottomRight: border.borderBottomRightRadius,
2113
- roundedBottomStart: border.borderEndStartRadius,
2114
- roundedBottomEnd: border.borderEndEndRadius,
2115
- roundedLeft: border.borderLeftRadius,
2116
- roundedRight: border.borderRightRadius,
2117
- roundedStart: border.borderInlineStartRadius,
2118
- roundedEnd: border.borderInlineEndRadius,
2119
- borderStart: border.borderInlineStart,
2120
- borderEnd: border.borderInlineEnd,
2121
- borderTopStartRadius: border.borderStartStartRadius,
2122
- borderTopEndRadius: border.borderStartEndRadius,
2123
- borderBottomStartRadius: border.borderEndStartRadius,
2124
- borderBottomEndRadius: border.borderEndEndRadius,
2125
- borderStartRadius: border.borderInlineStartRadius,
2126
- borderEndRadius: border.borderInlineEndRadius,
2127
- borderStartWidth: border.borderInlineStartWidth,
2128
- borderEndWidth: border.borderInlineEndWidth,
2129
- borderStartColor: border.borderInlineStartColor,
2130
- borderEndColor: border.borderInlineEndColor,
2131
- borderStartStyle: border.borderInlineStartStyle,
2132
- borderEndStyle: border.borderInlineEndStyle
2133
- });
2134
- var color = {
2135
- color: t.colors("color"),
2136
- textColor: t.colors("color"),
2137
- fill: t.colors("fill"),
2138
- stroke: t.colors("stroke")
2058
+ var global_default = global2;
2059
+
2060
+ // src/ui/nypl-base-theme/components/form-label.ts
2061
+ var baseStyle2 = {
2062
+ fontSize: "sm",
2063
+ marginEnd: 0,
2064
+ mb: 2,
2065
+ fontWeight: "medium",
2066
+ transition: "all 0.2s",
2067
+ opacity: 1,
2068
+ _disabled: {
2069
+ opacity: 1
2070
+ }
2139
2071
  };
2140
- var effect = {
2141
- boxShadow: t.shadows("boxShadow"),
2142
- mixBlendMode: true,
2143
- blendMode: t.prop("mixBlendMode"),
2144
- backgroundBlendMode: true,
2145
- bgBlendMode: t.prop("backgroundBlendMode"),
2146
- opacity: true
2072
+ var form_label_default = {
2073
+ baseStyle: baseStyle2
2147
2074
  };
2148
- Object.assign(effect, {
2149
- shadow: effect.boxShadow
2150
- });
2151
- var filter = {
2152
- filter: { transform: transformFunctions.filter },
2153
- blur: t.blur("--chakra-blur"),
2154
- brightness: t.propT("--chakra-brightness", transformFunctions.brightness),
2155
- contrast: t.propT("--chakra-contrast", transformFunctions.contrast),
2156
- hueRotate: t.degreeT("--chakra-hue-rotate"),
2157
- invert: t.propT("--chakra-invert", transformFunctions.invert),
2158
- saturate: t.propT("--chakra-saturate", transformFunctions.saturate),
2159
- dropShadow: t.propT("--chakra-drop-shadow", transformFunctions.dropShadow),
2160
- backdropFilter: { transform: transformFunctions.backdropFilter },
2161
- backdropBlur: t.blur("--chakra-backdrop-blur"),
2162
- backdropBrightness: t.propT(
2163
- "--chakra-backdrop-brightness",
2164
- transformFunctions.brightness
2165
- ),
2166
- backdropContrast: t.propT("--chakra-backdrop-contrast", transformFunctions.contrast),
2167
- backdropHueRotate: t.degreeT("--chakra-backdrop-hue-rotate"),
2168
- backdropInvert: t.propT("--chakra-backdrop-invert", transformFunctions.invert),
2169
- backdropSaturate: t.propT("--chakra-backdrop-saturate", transformFunctions.saturate)
2075
+
2076
+ // src/ui/nypl-base-theme/components/form.ts
2077
+ var baseStyle3 = {
2078
+ requiredIndicator: {
2079
+ marginStart: 1,
2080
+ color: "red.500"
2081
+ },
2082
+ helperText: {
2083
+ mt: 2,
2084
+ color: "black",
2085
+ lineHeight: "normal",
2086
+ fontSize: "xs"
2087
+ }
2170
2088
  };
2171
- var flexbox = {
2172
- alignItems: true,
2173
- alignContent: true,
2174
- justifyItems: true,
2175
- justifyContent: true,
2176
- flexWrap: true,
2177
- flexDirection: { transform: transformFunctions.flexDirection },
2178
- flex: true,
2179
- flexFlow: true,
2180
- flexGrow: true,
2181
- flexShrink: true,
2182
- flexBasis: t.sizes("flexBasis"),
2183
- justifySelf: true,
2184
- alignSelf: true,
2185
- order: true,
2186
- placeItems: true,
2187
- placeContent: true,
2188
- placeSelf: true,
2189
- gap: t.space("gap"),
2190
- rowGap: t.space("rowGap"),
2191
- columnGap: t.space("columnGap")
2089
+ var form_default = {
2090
+ baseStyle: baseStyle3
2192
2091
  };
2193
- Object.assign(flexbox, {
2194
- flexDir: flexbox.flexDirection
2195
- });
2196
- var grid = {
2197
- gridGap: t.space("gridGap"),
2198
- gridColumnGap: t.space("gridColumnGap"),
2199
- gridRowGap: t.space("gridRowGap"),
2200
- gridColumn: true,
2201
- gridRow: true,
2202
- gridAutoFlow: true,
2203
- gridAutoColumns: true,
2204
- gridColumnStart: true,
2205
- gridColumnEnd: true,
2206
- gridRowStart: true,
2207
- gridRowEnd: true,
2208
- gridAutoRows: true,
2209
- gridTemplate: true,
2210
- gridTemplateColumns: true,
2211
- gridTemplateRows: true,
2212
- gridTemplateAreas: true,
2213
- gridArea: true
2092
+
2093
+ // src/ui/nypl-base-theme/components/form-error.ts
2094
+ var baseStyle4 = {
2095
+ text: {
2096
+ color: "ui.error",
2097
+ mt: 2,
2098
+ fontSize: "xs"
2099
+ },
2100
+ icon: {
2101
+ marginEnd: "0.5em",
2102
+ color: "ui.error"
2103
+ }
2214
2104
  };
2215
- var interactivity = {
2216
- appearance: true,
2217
- cursor: true,
2218
- resize: true,
2219
- userSelect: true,
2220
- pointerEvents: true,
2221
- outline: { transform: transformFunctions.outline },
2222
- outlineOffset: true,
2223
- outlineColor: t.colors("outlineColor")
2105
+ var form_error_default = {
2106
+ baseStyle: baseStyle4
2224
2107
  };
2225
- var layout = {
2226
- width: t.sizesT("width"),
2227
- inlineSize: t.sizesT("inlineSize"),
2228
- height: t.sizes("height"),
2229
- blockSize: t.sizes("blockSize"),
2230
- boxSize: t.sizes(["width", "height"]),
2231
- minWidth: t.sizes("minWidth"),
2232
- minInlineSize: t.sizes("minInlineSize"),
2233
- minHeight: t.sizes("minHeight"),
2234
- minBlockSize: t.sizes("minBlockSize"),
2235
- maxWidth: t.sizes("maxWidth"),
2236
- maxInlineSize: t.sizes("maxInlineSize"),
2237
- maxHeight: t.sizes("maxHeight"),
2238
- maxBlockSize: t.sizes("maxBlockSize"),
2239
- overflow: true,
2240
- overflowX: true,
2241
- overflowY: true,
2242
- overscrollBehavior: true,
2243
- overscrollBehaviorX: true,
2244
- overscrollBehaviorY: true,
2245
- display: true,
2246
- aspectRatio: true,
2247
- hideFrom: {
2248
- scale: "breakpoints",
2249
- transform: (value, theme2) => {
2250
- var _a2, _b, _c;
2251
- const breakpoint = (_c = (_b = (_a2 = theme2.__breakpoints) == null ? void 0 : _a2.get(value)) == null ? void 0 : _b.minW) != null ? _c : value;
2252
- const mq = `@media screen and (min-width: ${breakpoint})`;
2253
- return { [mq]: { display: "none" } };
2254
- }
2255
- },
2256
- hideBelow: {
2257
- scale: "breakpoints",
2258
- transform: (value, theme2) => {
2259
- var _a2, _b, _c;
2260
- const breakpoint = (_c = (_b = (_a2 = theme2.__breakpoints) == null ? void 0 : _a2.get(value)) == null ? void 0 : _b._minW) != null ? _c : value;
2261
- const mq = `@media screen and (max-width: ${breakpoint})`;
2262
- return { [mq]: { display: "none" } };
2108
+
2109
+ // src/ui/nypl-base-theme/components/text-area.ts
2110
+ var sizes3 = {
2111
+ xs: input_default.sizes.xs.field,
2112
+ sm: input_default.sizes.sm.field,
2113
+ md: input_default.sizes.md.field,
2114
+ lg: input_default.sizes.lg.field
2115
+ };
2116
+ var text_area_default = {
2117
+ baseStyle: {
2118
+ _disabled: {
2119
+ bg: "ui.gray.x-light-cool"
2263
2120
  }
2264
2121
  },
2265
- verticalAlign: true,
2266
- boxSizing: true,
2267
- boxDecorationBreak: true,
2268
- float: t.propT("float", transformFunctions.float),
2269
- objectFit: true,
2270
- objectPosition: true,
2271
- visibility: true,
2272
- isolation: true
2273
- };
2274
- Object.assign(layout, {
2275
- w: layout.width,
2276
- h: layout.height,
2277
- minW: layout.minWidth,
2278
- maxW: layout.maxWidth,
2279
- minH: layout.minHeight,
2280
- maxH: layout.maxHeight,
2281
- overscroll: layout.overscrollBehavior,
2282
- overscrollX: layout.overscrollBehaviorX,
2283
- overscrollY: layout.overscrollBehaviorY
2284
- });
2285
- var list = {
2286
- listStyleType: true,
2287
- listStylePosition: true,
2288
- listStylePos: t.prop("listStylePosition"),
2289
- listStyleImage: true,
2290
- listStyleImg: t.prop("listStyleImage")
2291
- };
2292
- function get(obj, path, fallback, index) {
2293
- const key = typeof path === "string" ? path.split(".") : [path];
2294
- for (index = 0; index < key.length; index += 1) {
2295
- if (!obj)
2296
- break;
2297
- obj = obj[key[index]];
2298
- }
2299
- return obj === void 0 ? fallback : obj;
2300
- }
2301
- var memoize = (fn) => {
2302
- const cache = /* @__PURE__ */ new WeakMap();
2303
- const memoizedFn = (obj, path, fallback, index) => {
2304
- if (typeof obj === "undefined") {
2305
- return fn(obj, path, fallback);
2306
- }
2307
- if (!cache.has(obj)) {
2308
- cache.set(obj, /* @__PURE__ */ new Map());
2309
- }
2310
- const map = cache.get(obj);
2311
- if (map.has(path)) {
2312
- return map.get(path);
2313
- }
2314
- const value = fn(obj, path, fallback, index);
2315
- map.set(path, value);
2316
- return value;
2317
- };
2318
- return memoizedFn;
2319
- };
2320
- var memoizedGet = memoize(get);
2321
- var srOnly = {
2322
- border: "0px",
2323
- clip: "rect(0, 0, 0, 0)",
2324
- width: "1px",
2325
- height: "1px",
2326
- margin: "-1px",
2327
- padding: "0px",
2328
- overflow: "hidden",
2329
- whiteSpace: "nowrap",
2330
- position: "absolute"
2331
- };
2332
- var srFocusable = {
2333
- position: "static",
2334
- width: "auto",
2335
- height: "auto",
2336
- clip: "auto",
2337
- padding: "0",
2338
- margin: "0",
2339
- overflow: "visible",
2340
- whiteSpace: "normal"
2122
+ sizes: sizes3
2341
2123
  };
2342
- var getWithPriority = (theme2, key, styles) => {
2343
- const result = {};
2344
- const obj = memoizedGet(theme2, key, {});
2345
- for (const prop in obj) {
2346
- const isInStyles = prop in styles && styles[prop] != null;
2347
- if (!isInStyles)
2348
- result[prop] = obj[prop];
2124
+
2125
+ // src/ui/nypl-base-theme/index.ts
2126
+ var theme = extendTheme(__spreadProps(__spreadValues({
2127
+ styles: { global: global_default },
2128
+ breakpoints: breakpoints_default,
2129
+ radii: radii_default,
2130
+ colors: colors_default2
2131
+ }, typography_default2), {
2132
+ space: spacing_default,
2133
+ /**
2134
+ * Chakra documentation on component styles:
2135
+ * https://chakra-ui.com/docs/theming/component-style
2136
+ */
2137
+ components: {
2138
+ Button: button_default,
2139
+ Checkbox: checkbox_default,
2140
+ Input: input_default,
2141
+ FormLabel: form_label_default,
2142
+ Form: form_default,
2143
+ FormError: form_error_default,
2144
+ Textarea: text_area_default
2349
2145
  }
2350
- return result;
2351
- };
2352
- var others = {
2353
- srOnly: {
2354
- transform(value) {
2355
- if (value === true)
2356
- return srOnly;
2357
- if (value === "focusable")
2358
- return srFocusable;
2359
- return {};
2360
- }
2361
- },
2362
- layerStyle: {
2363
- processResult: true,
2364
- transform: (value, theme2, styles) => getWithPriority(theme2, `layerStyles.${value}`, styles)
2146
+ }));
2147
+ var nypl_base_theme_default = theme;
2148
+
2149
+ // src/ui/theme/components/button.ts
2150
+ var getButtonStyle = (getColor2) => ({
2151
+ // style object for base or default style
2152
+ baseStyle: {
2153
+ borderRadius: "none"
2365
2154
  },
2366
- textStyle: {
2367
- processResult: true,
2368
- transform: (value, theme2, styles) => getWithPriority(theme2, `textStyles.${value}`, styles)
2155
+ // styles for different sizes ("sm", "md", "lg")
2156
+ sizes: {},
2157
+ // styles for different visual variants ("outline", "solid")
2158
+ variants: {
2159
+ solid: variantSolid2(getColor2),
2160
+ settings: variantSettings(getColor2)
2369
2161
  },
2370
- apply: {
2371
- processResult: true,
2372
- transform: (value, theme2, styles) => getWithPriority(theme2, value, styles)
2162
+ // default values for `size`, `variant`, `colorScheme`
2163
+ defaultProps: {
2164
+ size: "sm",
2165
+ variant: "solid"
2373
2166
  }
2374
- };
2375
- var position = {
2376
- position: true,
2377
- pos: t.prop("position"),
2378
- zIndex: t.prop("zIndex", "zIndices"),
2379
- inset: t.spaceT("inset"),
2380
- insetX: t.spaceT(["left", "right"]),
2381
- insetInline: t.spaceT("insetInline"),
2382
- insetY: t.spaceT(["top", "bottom"]),
2383
- insetBlock: t.spaceT("insetBlock"),
2384
- top: t.spaceT("top"),
2385
- insetBlockStart: t.spaceT("insetBlockStart"),
2386
- bottom: t.spaceT("bottom"),
2387
- insetBlockEnd: t.spaceT("insetBlockEnd"),
2388
- left: t.spaceT("left"),
2389
- insetInlineStart: t.logical({
2390
- scale: "space",
2391
- property: { ltr: "left", rtl: "right" }
2392
- }),
2393
- right: t.spaceT("right"),
2394
- insetInlineEnd: t.logical({
2395
- scale: "space",
2396
- property: { ltr: "right", rtl: "left" }
2397
- })
2398
- };
2399
- Object.assign(position, {
2400
- insetStart: position.insetInlineStart,
2401
- insetEnd: position.insetInlineEnd
2402
2167
  });
2403
- var ring = {
2404
- ring: { transform: transformFunctions.ring },
2405
- ringColor: t.colors("--chakra-ring-color"),
2406
- ringOffset: t.prop("--chakra-ring-offset-width"),
2407
- ringOffsetColor: t.colors("--chakra-ring-offset-color"),
2408
- ringInset: t.prop("--chakra-ring-inset")
2409
- };
2410
- var space = {
2411
- margin: t.spaceT("margin"),
2412
- marginTop: t.spaceT("marginTop"),
2413
- marginBlockStart: t.spaceT("marginBlockStart"),
2414
- marginRight: t.spaceT("marginRight"),
2415
- marginInlineEnd: t.spaceT("marginInlineEnd"),
2416
- marginBottom: t.spaceT("marginBottom"),
2417
- marginBlockEnd: t.spaceT("marginBlockEnd"),
2418
- marginLeft: t.spaceT("marginLeft"),
2419
- marginInlineStart: t.spaceT("marginInlineStart"),
2420
- marginX: t.spaceT(["marginInlineStart", "marginInlineEnd"]),
2421
- marginInline: t.spaceT("marginInline"),
2422
- marginY: t.spaceT(["marginTop", "marginBottom"]),
2423
- marginBlock: t.spaceT("marginBlock"),
2424
- padding: t.space("padding"),
2425
- paddingTop: t.space("paddingTop"),
2426
- paddingBlockStart: t.space("paddingBlockStart"),
2427
- paddingRight: t.space("paddingRight"),
2428
- paddingBottom: t.space("paddingBottom"),
2429
- paddingBlockEnd: t.space("paddingBlockEnd"),
2430
- paddingLeft: t.space("paddingLeft"),
2431
- paddingInlineStart: t.space("paddingInlineStart"),
2432
- paddingInlineEnd: t.space("paddingInlineEnd"),
2433
- paddingX: t.space(["paddingInlineStart", "paddingInlineEnd"]),
2434
- paddingInline: t.space("paddingInline"),
2435
- paddingY: t.space(["paddingTop", "paddingBottom"]),
2436
- paddingBlock: t.space("paddingBlock")
2168
+ var variantSolid2 = (getColor2) => (props) => {
2169
+ const { "aria-expanded": expanded } = props;
2170
+ const bgColor = getColor2("ui.gray.light-warm", "ui.black", "ui.sepia");
2171
+ const bgColorActive = getColor2(
2172
+ "ui.gray.active",
2173
+ "ui.gray.x-dark",
2174
+ "ui.sepiaChecked"
2175
+ );
2176
+ const color2 = getColor2("gray.800", "ui.white", "gray.800");
2177
+ const _focus = {
2178
+ bgColor: bgColorActive,
2179
+ color: color2,
2180
+ ring: "2px",
2181
+ ringInset: "inset"
2182
+ };
2183
+ const _hover = {
2184
+ bgColor: bgColorActive,
2185
+ color: color2,
2186
+ _disabled: { bgColor }
2187
+ };
2188
+ const _active = { bgColor: bgColorActive, color: color2 };
2189
+ const _checked = { bgColor, color: color2 };
2190
+ const _disabled = { bgColor };
2191
+ return {
2192
+ border: "none",
2193
+ borderColor: "gray.100",
2194
+ height: "45px",
2195
+ transition: "none",
2196
+ fontSize: 0,
2197
+ letterSpacing: 1,
2198
+ maxWidth: "100%",
2199
+ cursor: "pointer",
2200
+ bgColor: expanded ? bgColorActive : bgColor,
2201
+ color: color2,
2202
+ _focus,
2203
+ _hover,
2204
+ _active,
2205
+ _checked,
2206
+ _disabled
2207
+ };
2437
2208
  };
2438
- Object.assign(space, {
2439
- m: space.margin,
2440
- mt: space.marginTop,
2441
- mr: space.marginRight,
2442
- me: space.marginInlineEnd,
2443
- marginEnd: space.marginInlineEnd,
2444
- mb: space.marginBottom,
2445
- ml: space.marginLeft,
2446
- ms: space.marginInlineStart,
2447
- marginStart: space.marginInlineStart,
2448
- mx: space.marginX,
2449
- my: space.marginY,
2450
- p: space.padding,
2451
- pt: space.paddingTop,
2452
- py: space.paddingY,
2453
- px: space.paddingX,
2454
- pb: space.paddingBottom,
2455
- pl: space.paddingLeft,
2456
- ps: space.paddingInlineStart,
2457
- paddingStart: space.paddingInlineStart,
2458
- pr: space.paddingRight,
2459
- pe: space.paddingInlineEnd,
2460
- paddingEnd: space.paddingInlineEnd
2461
- });
2462
- var textDecoration = {
2463
- textDecorationColor: t.colors("textDecorationColor"),
2464
- textDecoration: true,
2465
- textDecor: { property: "textDecoration" },
2466
- textDecorationLine: true,
2467
- textDecorationStyle: true,
2468
- textDecorationThickness: true,
2469
- textUnderlineOffset: true,
2470
- textShadow: t.shadows("textShadow")
2471
- };
2472
- var transform = {
2473
- clipPath: true,
2474
- transform: t.propT("transform", transformFunctions.transform),
2475
- transformOrigin: true,
2476
- translateX: t.spaceT("--chakra-translate-x"),
2477
- translateY: t.spaceT("--chakra-translate-y"),
2478
- skewX: t.degreeT("--chakra-skew-x"),
2479
- skewY: t.degreeT("--chakra-skew-y"),
2480
- scaleX: t.prop("--chakra-scale-x"),
2481
- scaleY: t.prop("--chakra-scale-y"),
2482
- scale: t.prop(["--chakra-scale-x", "--chakra-scale-y"]),
2483
- rotate: t.degreeT("--chakra-rotate")
2484
- };
2485
- var transition = {
2486
- transition: true,
2487
- transitionDelay: true,
2488
- animation: true,
2489
- willChange: true,
2490
- transitionDuration: t.prop("transitionDuration", "transition.duration"),
2491
- transitionProperty: t.prop("transitionProperty", "transition.property"),
2492
- transitionTimingFunction: t.prop(
2493
- "transitionTimingFunction",
2494
- "transition.easing"
2495
- )
2496
- };
2497
- var typography2 = {
2498
- fontFamily: t.prop("fontFamily", "fonts"),
2499
- fontSize: t.prop("fontSize", "fontSizes", transformFunctions.px),
2500
- fontWeight: t.prop("fontWeight", "fontWeights"),
2501
- lineHeight: t.prop("lineHeight", "lineHeights"),
2502
- letterSpacing: t.prop("letterSpacing", "letterSpacings"),
2503
- textAlign: true,
2504
- fontStyle: true,
2505
- textIndent: true,
2506
- wordBreak: true,
2507
- overflowWrap: true,
2508
- textOverflow: true,
2509
- textTransform: true,
2510
- whiteSpace: true,
2511
- isTruncated: {
2512
- transform(value) {
2513
- if (value === true) {
2514
- return {
2515
- overflow: "hidden",
2516
- textOverflow: "ellipsis",
2517
- whiteSpace: "nowrap"
2518
- };
2209
+ var variantSettings = (getColor2) => (props) => {
2210
+ const { bgColor } = props;
2211
+ const color2 = getColor2("ui.black", "ui.white", "ui.black");
2212
+ const checkedBgColor = getColor2(
2213
+ "ui.gray.light-warm",
2214
+ "ui.gray.x-dark",
2215
+ "ui.sepiaChecked"
2216
+ );
2217
+ return __spreadProps(__spreadValues({}, variantSolid2(getColor2)(props)), {
2218
+ bgColor: getColor2("ui.white", "ui.black", "ui.sepia"),
2219
+ border: "1px solid",
2220
+ color: color2,
2221
+ py: 8,
2222
+ width: [8, 16, 36],
2223
+ fontSize: [0, 0, 2],
2224
+ whiteSpace: ["normal", "normal", "nowrap"],
2225
+ p: {
2226
+ textAlign: "center"
2227
+ },
2228
+ _active: {
2229
+ bgColor
2230
+ },
2231
+ _checked: {
2232
+ color: color2,
2233
+ bgColor: checkedBgColor,
2234
+ borderBottomColor: checkedBgColor,
2235
+ p: {
2236
+ textDecoration: "underline",
2237
+ textUnderlinePosition: "under"
2519
2238
  }
2520
- }
2521
- },
2522
- noOfLines: {
2523
- static: {
2524
- overflow: "hidden",
2525
- textOverflow: "ellipsis",
2526
- display: "-webkit-box",
2527
- WebkitBoxOrient: "vertical",
2528
- WebkitLineClamp: "var(--chakra-line-clamp)"
2529
2239
  },
2530
- property: "--chakra-line-clamp"
2531
- }
2532
- };
2533
- var scroll = {
2534
- scrollBehavior: true,
2535
- scrollSnapAlign: true,
2536
- scrollSnapStop: true,
2537
- scrollSnapType: true,
2538
- scrollMargin: t.spaceT("scrollMargin"),
2539
- scrollMarginTop: t.spaceT("scrollMarginTop"),
2540
- scrollMarginBottom: t.spaceT("scrollMarginBottom"),
2541
- scrollMarginLeft: t.spaceT("scrollMarginLeft"),
2542
- scrollMarginRight: t.spaceT("scrollMarginRight"),
2543
- scrollMarginX: t.spaceT(["scrollMarginLeft", "scrollMarginRight"]),
2544
- scrollMarginY: t.spaceT(["scrollMarginTop", "scrollMarginBottom"]),
2545
- scrollPadding: t.spaceT("scrollPadding"),
2546
- scrollPaddingTop: t.spaceT("scrollPaddingTop"),
2547
- scrollPaddingBottom: t.spaceT("scrollPaddingBottom"),
2548
- scrollPaddingLeft: t.spaceT("scrollPaddingLeft"),
2549
- scrollPaddingRight: t.spaceT("scrollPaddingRight"),
2550
- scrollPaddingX: t.spaceT(["scrollPaddingLeft", "scrollPaddingRight"]),
2551
- scrollPaddingY: t.spaceT(["scrollPaddingTop", "scrollPaddingBottom"])
2552
- };
2553
- function resolveReference(operand) {
2554
- if (isObject(operand) && operand.reference) {
2555
- return operand.reference;
2556
- }
2557
- return String(operand);
2558
- }
2559
- var toExpression = (operator, ...operands) => operands.map(resolveReference).join(` ${operator} `).replace(/calc/g, "");
2560
- var add = (...operands) => `calc(${toExpression("+", ...operands)})`;
2561
- var subtract = (...operands) => `calc(${toExpression("-", ...operands)})`;
2562
- var multiply = (...operands) => `calc(${toExpression("*", ...operands)})`;
2563
- var divide = (...operands) => `calc(${toExpression("/", ...operands)})`;
2564
- var negate = (x) => {
2565
- const value = resolveReference(x);
2566
- if (value != null && !Number.isNaN(parseFloat(value))) {
2567
- return String(value).startsWith("-") ? String(value).slice(1) : `-${value}`;
2568
- }
2569
- return multiply(value, -1);
2240
+ _hover: {
2241
+ bgColor
2242
+ },
2243
+ _focus: {
2244
+ bgColor,
2245
+ ring: "2px",
2246
+ ringInset: "inset"
2247
+ }
2248
+ });
2570
2249
  };
2571
- var calc = Object.assign(
2572
- (x) => ({
2573
- add: (...operands) => calc(add(x, ...operands)),
2574
- subtract: (...operands) => calc(subtract(x, ...operands)),
2575
- multiply: (...operands) => calc(multiply(x, ...operands)),
2576
- divide: (...operands) => calc(divide(x, ...operands)),
2577
- negate: () => calc(negate(x)),
2578
- toString: () => x.toString()
2579
- }),
2580
- {
2581
- add,
2582
- subtract,
2583
- multiply,
2584
- divide,
2585
- negate
2586
- }
2587
- );
2588
- function analyzeCSSValue2(value) {
2589
- const num = parseFloat(value.toString());
2590
- const unit = value.toString().replace(String(num), "");
2591
- return { unitless: !unit, value: num, unit };
2592
- }
2593
- function px(value) {
2594
- if (value == null)
2595
- return value;
2596
- const { unitless } = analyzeCSSValue2(value);
2597
- return unitless || typeof value === "number" ? `${value}px` : value;
2250
+ var button_default2 = getButtonStyle;
2251
+
2252
+ // src/ui/theme/index.ts
2253
+ function getTheme(colorMode = "day") {
2254
+ return extendTheme2(
2255
+ __spreadProps(__spreadValues({
2256
+ colors: colors_default
2257
+ }, typography_default), {
2258
+ /**
2259
+ * Chakra documentation on component styles:
2260
+ * https://chakra-ui.com/docs/theming/component-style
2261
+ */
2262
+ components: {
2263
+ Button: button_default2(getColor(colorMode)),
2264
+ Text: text_default,
2265
+ Alert: alert_default,
2266
+ SkipNavigation: skipNavigation_default
2267
+ },
2268
+ currentColorMode: colorMode
2269
+ }),
2270
+ nypl_base_theme_default
2271
+ );
2598
2272
  }
2599
- function toMediaQueryString(min, max) {
2600
- const query = ["@media screen"];
2601
- if (min)
2602
- query.push("and", `(min-width: ${px(min)})`);
2603
- if (max)
2604
- query.push("and", `(max-width: ${px(max)})`);
2605
- return query.join(" ");
2273
+
2274
+ // src/ui/ToggleButton.tsx
2275
+ function ToggleButton(props) {
2276
+ const _a2 = props, {
2277
+ children,
2278
+ colorMode,
2279
+ icon,
2280
+ iconFill,
2281
+ label,
2282
+ value,
2283
+ isChecked
2284
+ } = _a2, rest = __objRest(_a2, [
2285
+ "children",
2286
+ "colorMode",
2287
+ "icon",
2288
+ "iconFill",
2289
+ "label",
2290
+ "value",
2291
+ "isChecked"
2292
+ ]);
2293
+ const { getInputProps, getRadioProps } = useRadio(props);
2294
+ const input = getInputProps();
2295
+ const radio = getRadioProps();
2296
+ const theme2 = useTheme2();
2297
+ return (
2298
+ // This will override the default theme if we specify the colorMode to the toggle button.
2299
+ /* @__PURE__ */ React16.createElement(ThemeProvider, { theme: getTheme(colorMode != null ? colorMode : theme2.currentColorMode) }, /* @__PURE__ */ React16.createElement(fonts_default, null), /* @__PURE__ */ React16.createElement(ChakraBox, { as: "label", display: "flex", flexGrow: 1, "aria-label": label }, /* @__PURE__ */ React16.createElement("input", __spreadValues({}, input)), /* @__PURE__ */ React16.createElement(Button_default, __spreadValues(__spreadValues({ as: "div", variant: "settings", flexGrow: 1 }, radio), rest), icon && /* @__PURE__ */ React16.createElement(
2300
+ Icon14,
2301
+ {
2302
+ as: icon,
2303
+ verticalAlign: "middle",
2304
+ mr: 1.5,
2305
+ w: 6,
2306
+ h: 6,
2307
+ fill: iconFill && iconFill
2308
+ }
2309
+ ), label && /* @__PURE__ */ React16.createElement(Text, null, label))))
2310
+ );
2606
2311
  }
2607
- var state = {
2608
- hover: (str, post) => `${str}:hover ${post}, ${str}[data-hover] ${post}`,
2609
- focus: (str, post) => `${str}:focus ${post}, ${str}[data-focus] ${post}`,
2610
- focusVisible: (str, post) => `${str}:focus-visible ${post}`,
2611
- focusWithin: (str, post) => `${str}:focus-within ${post}`,
2612
- active: (str, post) => `${str}:active ${post}, ${str}[data-active] ${post}`,
2613
- disabled: (str, post) => `${str}:disabled ${post}, ${str}[data-disabled] ${post}`,
2614
- invalid: (str, post) => `${str}:invalid ${post}, ${str}[data-invalid] ${post}`,
2615
- checked: (str, post) => `${str}:checked ${post}, ${str}[data-checked] ${post}`,
2616
- indeterminate: (str, post) => `${str}:indeterminate ${post}, ${str}[aria-checked=mixed] ${post}, ${str}[data-indeterminate] ${post}`,
2617
- readOnly: (str, post) => `${str}:read-only ${post}, ${str}[readonly] ${post}, ${str}[data-read-only] ${post}`,
2618
- expanded: (str, post) => `${str}:read-only ${post}, ${str}[aria-expanded=true] ${post}, ${str}[data-expanded] ${post}`,
2619
- placeholderShown: (str, post) => `${str}:placeholder-shown ${post}`
2312
+ var FontToggleButton = (props) => {
2313
+ return /* @__PURE__ */ React16.createElement(ToggleButton, __spreadValues({ fontSize: [-2, -2, -1, -1, 0], py: 6 }, props));
2620
2314
  };
2621
- var toGroup = (fn) => merge((v) => fn(v, "&"), "[role=group]", "[data-group]", ".group");
2622
- var toPeer = (fn) => merge((v) => fn(v, "~ &"), "[data-peer]", ".peer");
2623
- var merge = (fn, ...selectors) => selectors.map(fn).join(", ");
2624
- var pseudoSelectors = {
2625
- _hover: "&:hover, &[data-hover]",
2626
- _active: "&:active, &[data-active]",
2627
- _focus: "&:focus, &[data-focus]",
2628
- _highlighted: "&[data-highlighted]",
2629
- _focusWithin: "&:focus-within",
2630
- _focusVisible: "&:focus-visible, &[data-focus-visible]",
2631
- _disabled: "&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",
2632
- _readOnly: "&[aria-readonly=true], &[readonly], &[data-readonly]",
2633
- _before: "&::before",
2634
- _after: "&::after",
2635
- _empty: "&:empty",
2636
- _expanded: "&[aria-expanded=true], &[data-expanded]",
2637
- _checked: "&[aria-checked=true], &[data-checked]",
2638
- _grabbed: "&[aria-grabbed=true], &[data-grabbed]",
2639
- _pressed: "&[aria-pressed=true], &[data-pressed]",
2640
- _invalid: "&[aria-invalid=true], &[data-invalid]",
2641
- _valid: "&[data-valid], &[data-state=valid]",
2642
- _loading: "&[data-loading], &[aria-busy=true]",
2643
- _selected: "&[aria-selected=true], &[data-selected]",
2644
- _hidden: "&[hidden], &[data-hidden]",
2645
- _autofill: "&:-webkit-autofill",
2646
- _even: "&:nth-of-type(even)",
2647
- _odd: "&:nth-of-type(odd)",
2648
- _first: "&:first-of-type",
2649
- _firstLetter: "&::first-letter",
2650
- _last: "&:last-of-type",
2651
- _notFirst: "&:not(:first-of-type)",
2652
- _notLast: "&:not(:last-of-type)",
2653
- _visited: "&:visited",
2654
- _activeLink: "&[aria-current=page]",
2655
- _activeStep: "&[aria-current=step]",
2656
- _indeterminate: "&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",
2657
- _groupHover: toGroup(state.hover),
2658
- _peerHover: toPeer(state.hover),
2659
- _groupFocus: toGroup(state.focus),
2660
- _peerFocus: toPeer(state.focus),
2661
- _groupFocusVisible: toGroup(state.focusVisible),
2662
- _peerFocusVisible: toPeer(state.focusVisible),
2663
- _groupActive: toGroup(state.active),
2664
- _peerActive: toPeer(state.active),
2665
- _groupDisabled: toGroup(state.disabled),
2666
- _peerDisabled: toPeer(state.disabled),
2667
- _groupInvalid: toGroup(state.invalid),
2668
- _peerInvalid: toPeer(state.invalid),
2669
- _groupChecked: toGroup(state.checked),
2670
- _peerChecked: toPeer(state.checked),
2671
- _groupFocusWithin: toGroup(state.focusWithin),
2672
- _peerFocusWithin: toPeer(state.focusWithin),
2673
- _peerPlaceholderShown: toPeer(state.placeholderShown),
2674
- _placeholder: "&::placeholder",
2675
- _placeholderShown: "&:placeholder-shown",
2676
- _fullScreen: "&:fullscreen",
2677
- _selection: "&::selection",
2678
- _rtl: "[dir=rtl] &, &[dir=rtl]",
2679
- _ltr: "[dir=ltr] &, &[dir=ltr]",
2680
- _mediaDark: "@media (prefers-color-scheme: dark)",
2681
- _mediaReduceMotion: "@media (prefers-reduced-motion: reduce)",
2682
- _dark: ".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",
2683
- _light: ".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",
2684
- _horizontal: "&[data-orientation=horizontal]",
2685
- _vertical: "&[data-orientation=vertical]"
2315
+ var ColorModeToggleButton = (_a2) => {
2316
+ var _b = _a2, {
2317
+ bgColor
2318
+ } = _b, rest = __objRest(_b, [
2319
+ "bgColor"
2320
+ ]);
2321
+ return /* @__PURE__ */ React16.createElement(
2322
+ ToggleButton,
2323
+ __spreadValues({
2324
+ sx: {
2325
+ _checked: {
2326
+ bgColor,
2327
+ p: {
2328
+ textDecoration: "underline",
2329
+ textUnderlinePosition: "under"
2330
+ }
2331
+ }
2332
+ }
2333
+ }, rest)
2334
+ );
2686
2335
  };
2687
- var pseudoPropNames = Object.keys(
2688
- pseudoSelectors
2689
- );
2690
- function omit(object, keysToOmit = []) {
2691
- const clone = Object.assign({}, object);
2692
- for (const key of keysToOmit) {
2693
- if (key in clone) {
2694
- delete clone[key];
2695
- }
2696
- }
2697
- return clone;
2698
- }
2699
- var systemProps = (0, import_lodash3.default)(
2700
- {},
2701
- background,
2702
- border,
2703
- color,
2704
- flexbox,
2705
- layout,
2706
- filter,
2707
- ring,
2708
- interactivity,
2709
- grid,
2710
- others,
2711
- position,
2712
- effect,
2713
- space,
2714
- scroll,
2715
- typography2,
2716
- textDecoration,
2717
- transform,
2718
- list,
2719
- transition
2720
- );
2721
- var layoutSystem = Object.assign({}, space, layout, flexbox, grid, position);
2722
- var layoutPropNames = Object.keys(
2723
- layoutSystem
2724
- );
2725
- var propNames = [...Object.keys(systemProps), ...pseudoPropNames];
2726
- var styleProps = __spreadValues(__spreadValues({}, systemProps), pseudoSelectors);
2727
- var isStyleProp = (prop) => prop in styleProps;
2728
- var expandResponsive = (styles) => (theme2) => {
2729
- if (!theme2.__breakpoints)
2730
- return styles;
2731
- const { isResponsive, toArrayValue, media: medias } = theme2.__breakpoints;
2732
- const computedStyles = {};
2733
- for (const key in styles) {
2734
- let value = runIfFn(styles[key], theme2);
2735
- if (value == null)
2736
- continue;
2737
- value = isObject(value) && isResponsive(value) ? toArrayValue(value) : value;
2738
- if (!Array.isArray(value)) {
2739
- computedStyles[key] = value;
2740
- continue;
2336
+ var ToggleButton_default = ToggleButton;
2337
+
2338
+ // src/ui/ToggleGroup.tsx
2339
+ import React17 from "react";
2340
+ import { Flex, useRadioGroup } from "@chakra-ui/react";
2341
+ var ToggleGroup = ({
2342
+ value,
2343
+ label,
2344
+ name,
2345
+ children,
2346
+ onChange
2347
+ }) => {
2348
+ const { getRootProps, getRadioProps } = useRadioGroup({
2349
+ name,
2350
+ onChange,
2351
+ value
2352
+ });
2353
+ const group = getRootProps();
2354
+ return /* @__PURE__ */ React17.createElement(Flex, __spreadProps(__spreadValues({}, group), { "aria-label": label, flex: "1 0 auto", flexWrap: "nowrap" }), React17.Children.map(children, (element) => {
2355
+ try {
2356
+ const value2 = element.props.value;
2357
+ const radio = getRadioProps({ value: value2 });
2358
+ return React17.cloneElement(element, __spreadValues({}, radio));
2359
+ } catch (e) {
2360
+ throw new Error(
2361
+ "ToggleGroup expects ToggleButton children with `value` props."
2362
+ );
2741
2363
  }
2742
- const queries = value.slice(0, medias.length).length;
2743
- for (let index = 0; index < queries; index += 1) {
2744
- const media = medias == null ? void 0 : medias[index];
2745
- if (!media) {
2746
- computedStyles[key] = value[index];
2747
- continue;
2364
+ }));
2365
+ };
2366
+ var ToggleGroup_default = ToggleGroup;
2367
+
2368
+ // src/ui/PdfSettings.tsx
2369
+ import { MdOutlineZoomIn, MdOutlineZoomOut } from "react-icons/md";
2370
+ function PdfSettings(props) {
2371
+ const { navigator, paginationValue } = props;
2372
+ const { zoomOut, zoomIn, setScroll } = navigator;
2373
+ const iconFill = "ui.gray.icon";
2374
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(ButtonGroup, { display: "flex", spacing: 0 }, /* @__PURE__ */ React18.createElement(
2375
+ Button_default,
2376
+ {
2377
+ flexGrow: 1,
2378
+ "aria-label": "Zoom Out",
2379
+ onClick: zoomOut,
2380
+ variant: "settings"
2381
+ },
2382
+ /* @__PURE__ */ React18.createElement(Icon15, { as: MdOutlineZoomOut, w: 7, h: 7, pl: 1 }),
2383
+ "Zoom Out"
2384
+ ), /* @__PURE__ */ React18.createElement(
2385
+ Button_default,
2386
+ {
2387
+ flexGrow: 1,
2388
+ "aria-label": "Zoom In",
2389
+ onClick: zoomIn,
2390
+ variant: "settings"
2391
+ },
2392
+ /* @__PURE__ */ React18.createElement(Icon15, { as: MdOutlineZoomIn, w: 7, h: 7, pl: 1 }),
2393
+ "Zoom In"
2394
+ )), /* @__PURE__ */ React18.createElement(
2395
+ ToggleGroup_default,
2396
+ {
2397
+ onChange: setScroll,
2398
+ value: paginationValue,
2399
+ label: "pagination options"
2400
+ },
2401
+ /* @__PURE__ */ React18.createElement(
2402
+ ToggleButton_default,
2403
+ {
2404
+ value: "paginated",
2405
+ borderRadius: "0 0 0 4px",
2406
+ label: "Paginated",
2407
+ icon: Paginated_default,
2408
+ iconFill
2748
2409
  }
2749
- computedStyles[media] = computedStyles[media] || {};
2750
- if (value[index] == null) {
2751
- continue;
2410
+ ),
2411
+ /* @__PURE__ */ React18.createElement(
2412
+ ToggleButton_default,
2413
+ {
2414
+ value: "scrolling",
2415
+ borderRadius: "0 0 4px 0",
2416
+ label: "Scrolling",
2417
+ icon: Continuous_default,
2418
+ iconFill
2752
2419
  }
2753
- computedStyles[media][key] = value[index];
2754
- }
2755
- }
2756
- return computedStyles;
2757
- };
2758
- function splitByComma(value) {
2759
- const chunks = [];
2760
- let chunk2 = "";
2761
- let inParens = false;
2762
- for (let i = 0; i < value.length; i++) {
2763
- const char = value[i];
2764
- if (char === "(") {
2765
- inParens = true;
2766
- chunk2 += char;
2767
- } else if (char === ")") {
2768
- inParens = false;
2769
- chunk2 += char;
2770
- } else if (char === "," && !inParens) {
2771
- chunks.push(chunk2);
2772
- chunk2 = "";
2773
- } else {
2774
- chunk2 += char;
2775
- }
2776
- }
2777
- chunk2 = chunk2.trim();
2778
- if (chunk2) {
2779
- chunks.push(chunk2);
2780
- }
2781
- return chunks;
2782
- }
2783
- function isCssVar2(value) {
2784
- return /^var\(--.+\)$/.test(value);
2420
+ )
2421
+ ));
2785
2422
  }
2786
- var isCSSVariableTokenValue = (key, value) => key.startsWith("--") && typeof value === "string" && !isCssVar2(value);
2787
- var resolveTokenValue = (theme2, value) => {
2788
- var _a2, _b;
2789
- if (value == null)
2790
- return value;
2791
- const getVar = (val) => {
2792
- var _a22, _b2;
2793
- return (_b2 = (_a22 = theme2.__cssMap) == null ? void 0 : _a22[val]) == null ? void 0 : _b2.varRef;
2794
- };
2795
- const getValue = (val) => {
2796
- var _a22;
2797
- return (_a22 = getVar(val)) != null ? _a22 : val;
2798
- };
2799
- const [tokenValue, fallbackValue] = splitByComma(value);
2800
- value = (_b = (_a2 = getVar(tokenValue)) != null ? _a2 : getValue(fallbackValue)) != null ? _b : getValue(value);
2801
- return value;
2802
- };
2803
- function getCss(options) {
2804
- const { configs = {}, pseudos = {}, theme: theme2 } = options;
2805
- const css2 = (stylesOrFn, nested = false) => {
2806
- var _a2, _b, _c;
2807
- const _styles = runIfFn(stylesOrFn, theme2);
2808
- const styles = expandResponsive(_styles)(theme2);
2809
- let computedStyles = {};
2810
- for (let key in styles) {
2811
- const valueOrFn = styles[key];
2812
- let value = runIfFn(valueOrFn, theme2);
2813
- if (key in pseudos) {
2814
- key = pseudos[key];
2423
+
2424
+ // src/ui/HtmlSettings.tsx
2425
+ import * as React19 from "react";
2426
+ import { Box, ButtonGroup as ButtonGroup2, Heading, Text as Text2 } from "@chakra-ui/react";
2427
+ function HtmlSettings(props) {
2428
+ const { navigator, iconFill, readerState, paginationValue } = props;
2429
+ const buttonTextColor = useColorModeValue_default("ui.black", "ui.white", "ui.black");
2430
+ const checkedButtonBgColor = useColorModeValue_default(
2431
+ "ui.gray.light-warm",
2432
+ "ui.gray.x-dark",
2433
+ "ui.sepiaChecked"
2434
+ );
2435
+ if (!readerState.settings)
2436
+ return null;
2437
+ const { colorMode, fontFamily } = readerState.settings;
2438
+ const {
2439
+ setFontFamily,
2440
+ decreaseFontSize,
2441
+ increaseFontSize,
2442
+ resetSettings,
2443
+ setColorMode,
2444
+ setScroll
2445
+ } = navigator;
2446
+ return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
2447
+ ToggleGroup_default,
2448
+ {
2449
+ value: fontFamily,
2450
+ label: "text font options",
2451
+ onChange: setFontFamily
2452
+ },
2453
+ /* @__PURE__ */ React19.createElement(FontToggleButton, { value: "publisher", label: "Default" }),
2454
+ /* @__PURE__ */ React19.createElement(
2455
+ FontToggleButton,
2456
+ {
2457
+ value: "serif",
2458
+ label: "Serif",
2459
+ fontFamily: "serif",
2460
+ fontWeight: "regular"
2815
2461
  }
2816
- if (isCSSVariableTokenValue(key, value)) {
2817
- value = resolveTokenValue(theme2, value);
2462
+ ),
2463
+ /* @__PURE__ */ React19.createElement(
2464
+ FontToggleButton,
2465
+ {
2466
+ value: "sans-serif",
2467
+ label: "Sans-Serif",
2468
+ fontFamily: "body",
2469
+ fontWeight: "regular"
2818
2470
  }
2819
- let config = configs[key];
2820
- if (config === true) {
2821
- config = { property: key };
2471
+ ),
2472
+ /* @__PURE__ */ React19.createElement(
2473
+ FontToggleButton,
2474
+ {
2475
+ value: "open-dyslexic",
2476
+ label: "Dyslexia",
2477
+ fontFamily: "opendyslexic",
2478
+ fontWeight: "regular"
2822
2479
  }
2823
- if (isObject(value)) {
2824
- computedStyles[key] = (_a2 = computedStyles[key]) != null ? _a2 : {};
2825
- computedStyles[key] = (0, import_lodash2.default)(
2826
- {},
2827
- computedStyles[key],
2828
- css2(value, true)
2829
- );
2830
- continue;
2480
+ )
2481
+ ), /* @__PURE__ */ React19.createElement(
2482
+ Box,
2483
+ {
2484
+ bgColor: checkedButtonBgColor,
2485
+ display: "flex",
2486
+ flexDirection: "column",
2487
+ px: [3, 3, 7],
2488
+ py: [4, 4, 5]
2489
+ },
2490
+ /* @__PURE__ */ React19.createElement(
2491
+ Heading,
2492
+ {
2493
+ as: "h3",
2494
+ color: buttonTextColor,
2495
+ pb: [1.5, 1.5, 2.5],
2496
+ fontSize: 2,
2497
+ fontWeight: "light"
2498
+ },
2499
+ FONT_DETAILS[fontFamily].heading
2500
+ ),
2501
+ /* @__PURE__ */ React19.createElement(
2502
+ Text2,
2503
+ {
2504
+ color: buttonTextColor,
2505
+ fontFamily: FONT_DETAILS[fontFamily].token,
2506
+ fontSize: -1,
2507
+ fontWeight: FONT_DETAILS[fontFamily].fontWeight,
2508
+ margin: 0
2509
+ },
2510
+ FONT_DETAILS[fontFamily].body
2511
+ )
2512
+ ), /* @__PURE__ */ React19.createElement(
2513
+ ToggleGroup_default,
2514
+ {
2515
+ value: colorMode,
2516
+ label: "reading theme options",
2517
+ onChange: setColorMode
2518
+ },
2519
+ /* @__PURE__ */ React19.createElement(
2520
+ ColorModeToggleButton,
2521
+ {
2522
+ colorMode: "day",
2523
+ icon: Day_default,
2524
+ value: "day",
2525
+ label: "Day",
2526
+ bgColor: "ui.white",
2527
+ textColor: "ui.black"
2831
2528
  }
2832
- let rawValue = (_c = (_b = config == null ? void 0 : config.transform) == null ? void 0 : _b.call(config, value, theme2, _styles)) != null ? _c : value;
2833
- rawValue = (config == null ? void 0 : config.processResult) ? css2(rawValue, true) : rawValue;
2834
- const configProperty = runIfFn(config == null ? void 0 : config.property, theme2);
2835
- if (!nested && (config == null ? void 0 : config.static)) {
2836
- const staticStyles = runIfFn(config.static, theme2);
2837
- computedStyles = (0, import_lodash2.default)({}, computedStyles, staticStyles);
2529
+ ),
2530
+ /* @__PURE__ */ React19.createElement(
2531
+ ColorModeToggleButton,
2532
+ {
2533
+ colorMode: "sepia",
2534
+ icon: Sepia_default,
2535
+ value: "sepia",
2536
+ label: "Sepia",
2537
+ bgColor: "ui.sepia",
2538
+ textColor: "ui.black"
2838
2539
  }
2839
- if (configProperty && Array.isArray(configProperty)) {
2840
- for (const property of configProperty) {
2841
- computedStyles[property] = rawValue;
2842
- }
2843
- continue;
2540
+ ),
2541
+ /* @__PURE__ */ React19.createElement(
2542
+ ColorModeToggleButton,
2543
+ {
2544
+ colorMode: "night",
2545
+ icon: Night_default,
2546
+ value: "night",
2547
+ label: "Night",
2548
+ bgColor: "ui.black",
2549
+ textColor: "ui.white"
2844
2550
  }
2845
- if (configProperty) {
2846
- if (configProperty === "&" && isObject(rawValue)) {
2847
- computedStyles = (0, import_lodash2.default)({}, computedStyles, rawValue);
2848
- } else {
2849
- computedStyles[configProperty] = rawValue;
2551
+ )
2552
+ ), /* @__PURE__ */ React19.createElement(ButtonGroup2, { display: "flex", spacing: 0 }, /* @__PURE__ */ React19.createElement(
2553
+ Button_default,
2554
+ {
2555
+ flexGrow: 1,
2556
+ "aria-label": "Reset settings",
2557
+ onClick: resetSettings,
2558
+ variant: "settings"
2559
+ },
2560
+ /* @__PURE__ */ React19.createElement(
2561
+ Reset_default,
2562
+ {
2563
+ w: "45px",
2564
+ h: "45px",
2565
+ fill: areSettingsDefault(readerState.settings) ? "ui.gray.disabled" : iconFill
2566
+ }
2567
+ )
2568
+ ), /* @__PURE__ */ React19.createElement(
2569
+ Button_default,
2570
+ {
2571
+ "aria-label": "Decrease font size",
2572
+ flexGrow: 1,
2573
+ onClick: decreaseFontSize,
2574
+ sx: {
2575
+ _active: {
2576
+ bgColor: checkedButtonBgColor
2850
2577
  }
2851
- continue;
2578
+ },
2579
+ value: "decrease font size",
2580
+ variant: "settings"
2581
+ },
2582
+ /* @__PURE__ */ React19.createElement(ReduceFont_default, { w: "45px", h: "45px", fill: iconFill })
2583
+ ), /* @__PURE__ */ React19.createElement(
2584
+ Button_default,
2585
+ {
2586
+ "aria-label": "Increase font size",
2587
+ flexGrow: 1,
2588
+ onClick: increaseFontSize,
2589
+ sx: {
2590
+ _active: {
2591
+ bgColor: checkedButtonBgColor
2592
+ }
2593
+ },
2594
+ value: "increase font size",
2595
+ variant: "settings"
2596
+ },
2597
+ /* @__PURE__ */ React19.createElement(EnlargeFont_default, { w: "45px", h: "45px", fill: iconFill })
2598
+ )), /* @__PURE__ */ React19.createElement(
2599
+ ToggleGroup_default,
2600
+ {
2601
+ onChange: setScroll,
2602
+ value: paginationValue,
2603
+ label: "pagination options"
2604
+ },
2605
+ /* @__PURE__ */ React19.createElement(
2606
+ ToggleButton_default,
2607
+ {
2608
+ value: "paginated",
2609
+ borderRadius: "0 0 0 4px",
2610
+ label: "Paginated",
2611
+ icon: Paginated_default,
2612
+ iconFill
2852
2613
  }
2853
- if (isObject(rawValue)) {
2854
- computedStyles = (0, import_lodash2.default)({}, computedStyles, rawValue);
2855
- continue;
2614
+ ),
2615
+ /* @__PURE__ */ React19.createElement(
2616
+ ToggleButton_default,
2617
+ {
2618
+ value: "scrolling",
2619
+ borderRadius: "0 0 4px 0",
2620
+ label: "Scrolling",
2621
+ icon: Continuous_default,
2622
+ iconFill
2856
2623
  }
2857
- computedStyles[key] = rawValue;
2858
- }
2859
- return computedStyles;
2860
- };
2861
- return css2;
2862
- }
2863
- var css = (styles) => (theme2) => {
2864
- const cssFn = getCss({
2865
- theme: theme2,
2866
- pseudos: pseudoSelectors,
2867
- configs: systemProps
2868
- });
2869
- return cssFn(styles);
2624
+ )
2625
+ ));
2626
+ }
2627
+ var areSettingsDefault = (readerSettings) => {
2628
+ if (!readerSettings) {
2629
+ return false;
2630
+ }
2631
+ let setting;
2632
+ for (setting in DEFAULT_SETTINGS) {
2633
+ if (readerSettings[setting] !== DEFAULT_SETTINGS[setting]) {
2634
+ return false;
2635
+ }
2636
+ }
2637
+ return true;
2870
2638
  };
2871
- function normalize2(value, toArray) {
2872
- if (Array.isArray(value))
2873
- return value;
2874
- if (isObject(value))
2875
- return toArray(value);
2876
- if (value != null)
2877
- return [value];
2639
+
2640
+ // src/ui/SettingsButton.tsx
2641
+ function SettingsCard(props) {
2642
+ var _a2, _b;
2643
+ const [isOpen, setIsOpen] = React20.useState(false);
2644
+ const open = () => setIsOpen(true);
2645
+ const close = () => setIsOpen(false);
2646
+ const contentBgColor = useColorModeValue_default("ui.white", "ui.black", "ui.white");
2647
+ const iconFill = useColorModeValue_default(
2648
+ "ui.gray.icon",
2649
+ "ui.white",
2650
+ "ui.gray.icon"
2651
+ );
2652
+ const paginationValue = ((_b = (_a2 = props.state) == null ? void 0 : _a2.settings) == null ? void 0 : _b.isScrolling) ? "scrolling" : "paginated";
2653
+ return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
2654
+ Popover,
2655
+ {
2656
+ gutter: 0,
2657
+ closeOnBlur: true,
2658
+ placement: "bottom-start",
2659
+ isOpen,
2660
+ onClose: close,
2661
+ onOpen: open,
2662
+ autoFocus: true,
2663
+ preventOverflow: true,
2664
+ strategy: "fixed"
2665
+ },
2666
+ /* @__PURE__ */ React20.createElement(PopoverTrigger, null, /* @__PURE__ */ React20.createElement(
2667
+ Button_default,
2668
+ {
2669
+ "aria-label": "Settings",
2670
+ onClick: open,
2671
+ onMouseDown: (e) => e.preventDefault(),
2672
+ border: "none",
2673
+ gap: [0, 0, 2]
2674
+ },
2675
+ /* @__PURE__ */ React20.createElement(Icon16, { as: ReaderSettings_default, fill: iconFill, w: 6, h: 6 }),
2676
+ /* @__PURE__ */ React20.createElement(Text3, { variant: "headerNav" }, "Settings")
2677
+ )),
2678
+ /* @__PURE__ */ React20.createElement(
2679
+ PopoverContent,
2680
+ {
2681
+ overflow: "hidden",
2682
+ bgColor: contentBgColor,
2683
+ borderColor: "ui.gray.disabled",
2684
+ borderRadius: "0 0 2px 2px",
2685
+ filter: "drop-shadow(0 1px 2px #00000040)",
2686
+ width: ["90vw", "90vw", "inherit"],
2687
+ marginRight: [4, 4, 4, 0],
2688
+ maxWidth: "100vw"
2689
+ },
2690
+ /* @__PURE__ */ React20.createElement(PopoverBody, { p: 0 }, props.type === "PDF" && /* @__PURE__ */ React20.createElement(
2691
+ PdfSettings,
2692
+ {
2693
+ navigator: props.navigator,
2694
+ readerState: props.state,
2695
+ paginationValue
2696
+ }
2697
+ ), props.type === "HTML" && /* @__PURE__ */ React20.createElement(
2698
+ HtmlSettings,
2699
+ {
2700
+ navigator: props.navigator,
2701
+ iconFill,
2702
+ readerState: props.state,
2703
+ paginationValue
2704
+ }
2705
+ ))
2706
+ )
2707
+ ));
2878
2708
  }
2879
- function getNextIndex(values, i) {
2880
- for (let j = i + 1; j < values.length; j++) {
2881
- if (values[j] != null)
2882
- return j;
2709
+
2710
+ // src/ui/TableOfContent.tsx
2711
+ import React24 from "react";
2712
+ import { Portal, Text as Text4, Icon as Icon17, Box as Box2 } from "@chakra-ui/react";
2713
+
2714
+ // node_modules/@chakra-ui/system/dist/chunk-UIGT7YZF.mjs
2715
+ import { ThemeContext } from "@emotion/react";
2716
+ import { useContext } from "react";
2717
+ function useTheme3() {
2718
+ const theme2 = useContext(
2719
+ ThemeContext
2720
+ );
2721
+ if (!theme2) {
2722
+ throw Error(
2723
+ "useTheme: `theme` is undefined. Seems you forgot to wrap your app in `<ChakraProvider />` or `<ThemeProvider />`"
2724
+ );
2883
2725
  }
2884
- return -1;
2726
+ return theme2;
2885
2727
  }
2886
- function createResolver(theme2) {
2887
- const breakpointUtil = theme2.__breakpoints;
2888
- return function resolver(config, prop, value, props) {
2889
- var _a2, _b;
2890
- if (!breakpointUtil)
2891
- return;
2892
- const result = {};
2893
- const normalized = normalize2(value, breakpointUtil.toArrayValue);
2894
- if (!normalized)
2895
- return result;
2896
- const len = normalized.length;
2897
- const isSingle = len === 1;
2898
- const isMultipart = !!config.parts;
2899
- for (let i = 0; i < len; i++) {
2900
- const key = breakpointUtil.details[i];
2901
- const nextKey = breakpointUtil.details[getNextIndex(normalized, i)];
2902
- const query = toMediaQueryString(key.minW, nextKey == null ? void 0 : nextKey._minW);
2903
- const styles = runIfFn((_a2 = config[prop]) == null ? void 0 : _a2[normalized[i]], props);
2904
- if (!styles)
2905
- continue;
2906
- if (isMultipart) {
2907
- (_b = config.parts) == null ? void 0 : _b.forEach((part) => {
2908
- (0, import_lodash4.default)(result, {
2909
- [part]: isSingle ? styles[part] : { [query]: styles[part] }
2910
- });
2911
- });
2912
- continue;
2913
- }
2914
- if (!isMultipart) {
2915
- if (isSingle)
2916
- (0, import_lodash4.default)(result, styles);
2917
- else
2918
- result[query] = styles;
2919
- continue;
2920
- }
2921
- result[query] = styles;
2728
+
2729
+ // node_modules/@chakra-ui/color-mode/dist/chunk-UQDW7KKV.mjs
2730
+ import { createContext, useContext as useContext2 } from "react";
2731
+ var ColorModeContext = createContext({});
2732
+ ColorModeContext.displayName = "ColorModeContext";
2733
+ function useColorMode() {
2734
+ const context = useContext2(ColorModeContext);
2735
+ if (context === void 0) {
2736
+ throw new Error("useColorMode must be used within a ColorModeProvider");
2737
+ }
2738
+ return context;
2739
+ }
2740
+
2741
+ // node_modules/@chakra-ui/system/dist/chunk-7FWEOSAE.mjs
2742
+ function useChakra() {
2743
+ const colorModeResult = useColorMode();
2744
+ const theme2 = useTheme3();
2745
+ return __spreadProps(__spreadValues({}, colorModeResult), { theme: theme2 });
2746
+ }
2747
+
2748
+ // node_modules/@chakra-ui/shared-utils/dist/index.mjs
2749
+ function isObject(value) {
2750
+ const type = typeof value;
2751
+ return value != null && (type === "object" || type === "function") && !Array.isArray(value);
2752
+ }
2753
+ function runIfFn(valueOrFn, ...args) {
2754
+ return isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
2755
+ }
2756
+ var isFunction = (value) => typeof value === "function";
2757
+ var dataAttr = (condition) => condition ? "" : void 0;
2758
+
2759
+ // node_modules/@chakra-ui/styled-system/dist/index.mjs
2760
+ var import_lodash = __toESM(require_lodash(), 1);
2761
+ var import_lodash2 = __toESM(require_lodash(), 1);
2762
+ var import_lodash3 = __toESM(require_lodash(), 1);
2763
+ var import_lodash4 = __toESM(require_lodash(), 1);
2764
+ var isImportant = (value) => /!(important)?$/.test(value);
2765
+ var withoutImportant = (value) => typeof value === "string" ? value.replace(/!(important)?$/, "").trim() : value;
2766
+ var tokenToCSSVar = (scale, value) => (theme2) => {
2767
+ const valueStr = String(value);
2768
+ const important = isImportant(valueStr);
2769
+ const valueWithoutImportant = withoutImportant(valueStr);
2770
+ const key = scale ? `${scale}.${valueWithoutImportant}` : valueWithoutImportant;
2771
+ let transformed = isObject(theme2.__cssMap) && key in theme2.__cssMap ? theme2.__cssMap[key].varRef : value;
2772
+ transformed = withoutImportant(transformed);
2773
+ return important ? `${transformed} !important` : transformed;
2774
+ };
2775
+ function createTransform(options) {
2776
+ const { scale, transform: transform2, compose: compose2 } = options;
2777
+ const fn = (value, theme2) => {
2778
+ var _a2;
2779
+ const _value = tokenToCSSVar(scale, value)(theme2);
2780
+ let result = (_a2 = transform2 == null ? void 0 : transform2(_value, theme2)) != null ? _a2 : _value;
2781
+ if (compose2) {
2782
+ result = compose2(result, theme2);
2922
2783
  }
2923
2784
  return result;
2924
2785
  };
2786
+ return fn;
2925
2787
  }
2926
- function resolveStyleConfig(config) {
2927
- return (props) => {
2928
- var _a2;
2929
- const { variant, size: size2, theme: theme2 } = props;
2930
- const recipe = createResolver(theme2);
2931
- return (0, import_lodash4.default)(
2932
- {},
2933
- runIfFn((_a2 = config.baseStyle) != null ? _a2 : {}, props),
2934
- recipe(config, "sizes", size2, props),
2935
- recipe(config, "variants", variant, props)
2936
- );
2788
+ var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
2789
+ function toConfig(scale, transform2) {
2790
+ return (property) => {
2791
+ const result = { property, scale };
2792
+ result.transform = createTransform({
2793
+ scale,
2794
+ transform: transform2
2795
+ });
2796
+ return result;
2937
2797
  };
2938
2798
  }
2939
- function omitThemingProps(props) {
2940
- return omit(props, ["styleConfig", "size", "variant", "colorScheme"]);
2799
+ var getRtl = ({ rtl, ltr }) => (theme2) => theme2.direction === "rtl" ? rtl : ltr;
2800
+ function logical(options) {
2801
+ const { property, scale, transform: transform2 } = options;
2802
+ return {
2803
+ scale,
2804
+ property: getRtl(property),
2805
+ transform: scale ? createTransform({
2806
+ scale,
2807
+ compose: transform2
2808
+ }) : transform2
2809
+ };
2941
2810
  }
2942
-
2943
- // node_modules/@chakra-ui/theme-tools/dist/chunk-N4TQSR52.mjs
2944
- var createBreakpoints = (config) => {
2945
- warn({
2946
- condition: true,
2947
- message: [
2948
- `[chakra-ui]: createBreakpoints(...) will be deprecated pretty soon`,
2949
- `simply pass the breakpoints as an object. Remove the createBreakpoints(..) call`
2950
- ].join("")
2951
- });
2952
- return __spreadValues({ base: "0em" }, config);
2953
- };
2954
-
2955
- // src/ui/nypl-base-theme/foundations/breakpoints.ts
2956
- var breakpoints_default = createBreakpoints({
2957
- sm: "20em",
2958
- // 320px
2959
- md: "38em",
2960
- // 600px
2961
- lg: "60em",
2962
- // 960px
2963
- xl: "80em",
2964
- // 1280px
2965
- "2xl": "96em"
2966
- });
2967
-
2968
- // src/ui/nypl-base-theme/foundations/typography.ts
2969
- var typography3 = {
2970
- fonts: {
2971
- body: "-apple-system, BlinkMacSystemFont, system-ui, sans-serif",
2972
- heading: "-apple-system, BlinkMacSystemFont, system-ui, sans-seri",
2973
- mono: `Courier,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace`
2974
- },
2975
- fontSizes: {
2976
- "-2": "0.75rem",
2977
- "-1": "0.875rem",
2978
- "0": "1rem",
2979
- "1": "1.125rem",
2980
- "2": "1.25rem",
2981
- "3": "1.75rem",
2982
- "4": "2.25rem",
2983
- "5": "3rem"
2984
- },
2985
- fontWeights: {
2986
- light: 300,
2987
- regular: 400,
2988
- medium: 500,
2989
- bold: 700
2811
+ var transformTemplate = [
2812
+ "rotate(var(--chakra-rotate, 0))",
2813
+ "scaleX(var(--chakra-scale-x, 1))",
2814
+ "scaleY(var(--chakra-scale-y, 1))",
2815
+ "skewX(var(--chakra-skew-x, 0))",
2816
+ "skewY(var(--chakra-skew-y, 0))"
2817
+ ];
2818
+ function getTransformTemplate() {
2819
+ return [
2820
+ "translateX(var(--chakra-translate-x, 0))",
2821
+ "translateY(var(--chakra-translate-y, 0))",
2822
+ ...transformTemplate
2823
+ ].join(" ");
2824
+ }
2825
+ function getTransformGpuTemplate() {
2826
+ return [
2827
+ "translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",
2828
+ ...transformTemplate
2829
+ ].join(" ");
2830
+ }
2831
+ var filterTemplate = {
2832
+ "--chakra-blur": "var(--chakra-empty,/*!*/ /*!*/)",
2833
+ "--chakra-brightness": "var(--chakra-empty,/*!*/ /*!*/)",
2834
+ "--chakra-contrast": "var(--chakra-empty,/*!*/ /*!*/)",
2835
+ "--chakra-grayscale": "var(--chakra-empty,/*!*/ /*!*/)",
2836
+ "--chakra-hue-rotate": "var(--chakra-empty,/*!*/ /*!*/)",
2837
+ "--chakra-invert": "var(--chakra-empty,/*!*/ /*!*/)",
2838
+ "--chakra-saturate": "var(--chakra-empty,/*!*/ /*!*/)",
2839
+ "--chakra-sepia": "var(--chakra-empty,/*!*/ /*!*/)",
2840
+ "--chakra-drop-shadow": "var(--chakra-empty,/*!*/ /*!*/)",
2841
+ filter: [
2842
+ "var(--chakra-blur)",
2843
+ "var(--chakra-brightness)",
2844
+ "var(--chakra-contrast)",
2845
+ "var(--chakra-grayscale)",
2846
+ "var(--chakra-hue-rotate)",
2847
+ "var(--chakra-invert)",
2848
+ "var(--chakra-saturate)",
2849
+ "var(--chakra-sepia)",
2850
+ "var(--chakra-drop-shadow)"
2851
+ ].join(" ")
2852
+ };
2853
+ var backdropFilterTemplate = {
2854
+ backdropFilter: [
2855
+ "var(--chakra-backdrop-blur)",
2856
+ "var(--chakra-backdrop-brightness)",
2857
+ "var(--chakra-backdrop-contrast)",
2858
+ "var(--chakra-backdrop-grayscale)",
2859
+ "var(--chakra-backdrop-hue-rotate)",
2860
+ "var(--chakra-backdrop-invert)",
2861
+ "var(--chakra-backdrop-opacity)",
2862
+ "var(--chakra-backdrop-saturate)",
2863
+ "var(--chakra-backdrop-sepia)"
2864
+ ].join(" "),
2865
+ "--chakra-backdrop-blur": "var(--chakra-empty,/*!*/ /*!*/)",
2866
+ "--chakra-backdrop-brightness": "var(--chakra-empty,/*!*/ /*!*/)",
2867
+ "--chakra-backdrop-contrast": "var(--chakra-empty,/*!*/ /*!*/)",
2868
+ "--chakra-backdrop-grayscale": "var(--chakra-empty,/*!*/ /*!*/)",
2869
+ "--chakra-backdrop-hue-rotate": "var(--chakra-empty,/*!*/ /*!*/)",
2870
+ "--chakra-backdrop-invert": "var(--chakra-empty,/*!*/ /*!*/)",
2871
+ "--chakra-backdrop-opacity": "var(--chakra-empty,/*!*/ /*!*/)",
2872
+ "--chakra-backdrop-saturate": "var(--chakra-empty,/*!*/ /*!*/)",
2873
+ "--chakra-backdrop-sepia": "var(--chakra-empty,/*!*/ /*!*/)"
2874
+ };
2875
+ function getRingTemplate(value) {
2876
+ return {
2877
+ "--chakra-ring-offset-shadow": `var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)`,
2878
+ "--chakra-ring-shadow": `var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)`,
2879
+ "--chakra-ring-width": value,
2880
+ boxShadow: [
2881
+ `var(--chakra-ring-offset-shadow)`,
2882
+ `var(--chakra-ring-shadow)`,
2883
+ `var(--chakra-shadow, 0 0 #0000)`
2884
+ ].join(", ")
2885
+ };
2886
+ }
2887
+ var flexDirectionTemplate = {
2888
+ "row-reverse": {
2889
+ space: "--chakra-space-x-reverse",
2890
+ divide: "--chakra-divide-x-reverse"
2990
2891
  },
2991
- lineHeights: [1, 1.1, 1.25, 1.5, 2, 2.5],
2992
- letterSpacings: {
2993
- tighter: "-0.05em",
2994
- tight: "-0.025em",
2995
- normal: "0",
2996
- wide: "0.025em",
2997
- wider: "0.05em",
2998
- widest: "0.1em"
2892
+ "column-reverse": {
2893
+ space: "--chakra-space-y-reverse",
2894
+ divide: "--chakra-divide-y-reverse"
2999
2895
  }
3000
2896
  };
3001
- var typography_default2 = typography3;
3002
-
3003
- // src/ui/nypl-base-theme/foundations/colors.ts
3004
- var colors2 = {
3005
- transparent: "transparent",
3006
- // ui fills
3007
- ui: {
3008
- black: "#000",
3009
- white: "#fff",
3010
- focus: "#4181F1",
3011
- link: {
3012
- primary: "#0576D3",
3013
- secondary: "#004B98"
3014
- },
3015
- success: {
3016
- primary: "#077719",
3017
- secondary: "#095212"
3018
- },
3019
- warning: {
3020
- primary: "#F0974E",
3021
- secondary: "#EC7B1F"
3022
- },
3023
- status: {
3024
- primary: "#F9E08E",
3025
- secondary: "#FBE7E1"
3026
- },
3027
- error: "#97272C",
3028
- disabled: {
3029
- primary: "#E0E0E0",
3030
- secondary: "#FAFAFA"
3031
- },
3032
- test: "#FF6347",
3033
- gray: {
3034
- active: "#D9D9D9",
3035
- disabled: "#979797",
3036
- icon: "#1C1B1F",
3037
- medium: "#BDBDBD",
3038
- dark: "#616161",
3039
- "x-dark": "#424242",
3040
- "light-cool": "#E0E0E0",
3041
- "light-warm": "#EFEDEB",
3042
- "x-light-cool": "#F5F5F5",
3043
- "x-light-warm": "#F8F8F7",
3044
- "xx-light-cool": "#FAFAFA"
3045
- }
2897
+ var directionMap = {
2898
+ "to-t": "to top",
2899
+ "to-tr": "to top right",
2900
+ "to-r": "to right",
2901
+ "to-br": "to bottom right",
2902
+ "to-b": "to bottom",
2903
+ "to-bl": "to bottom left",
2904
+ "to-l": "to left",
2905
+ "to-tl": "to top left"
2906
+ };
2907
+ var valueSet = new Set(Object.values(directionMap));
2908
+ var globalSet = /* @__PURE__ */ new Set([
2909
+ "none",
2910
+ "-moz-initial",
2911
+ "inherit",
2912
+ "initial",
2913
+ "revert",
2914
+ "unset"
2915
+ ]);
2916
+ var trimSpace = (str) => str.trim();
2917
+ function parseGradient(value, theme2) {
2918
+ if (value == null || globalSet.has(value))
2919
+ return value;
2920
+ const prevent = isCSSFunction(value) || globalSet.has(value);
2921
+ if (!prevent)
2922
+ return `url('${value}')`;
2923
+ const regex = /(^[a-z-A-Z]+)\((.*)\)/g;
2924
+ const results = regex.exec(value);
2925
+ const type = results == null ? void 0 : results[1];
2926
+ const values = results == null ? void 0 : results[2];
2927
+ if (!type || !values)
2928
+ return value;
2929
+ const _type = type.includes("-gradient") ? type : `${type}-gradient`;
2930
+ const [maybeDirection, ...stops] = values.split(",").map(trimSpace).filter(Boolean);
2931
+ if ((stops == null ? void 0 : stops.length) === 0)
2932
+ return value;
2933
+ const direction = maybeDirection in directionMap ? directionMap[maybeDirection] : maybeDirection;
2934
+ stops.unshift(direction);
2935
+ const _values = stops.map((stop) => {
2936
+ if (valueSet.has(stop))
2937
+ return stop;
2938
+ const firstStop = stop.indexOf(" ");
2939
+ const [_color, _stop] = firstStop !== -1 ? [stop.substr(0, firstStop), stop.substr(firstStop + 1)] : [stop];
2940
+ const _stopOrFunc = isCSSFunction(_stop) ? _stop : _stop && _stop.split(" ");
2941
+ const key = `colors.${_color}`;
2942
+ const color2 = key in theme2.__cssMap ? theme2.__cssMap[key].varRef : _color;
2943
+ return _stopOrFunc ? [
2944
+ color2,
2945
+ ...Array.isArray(_stopOrFunc) ? _stopOrFunc : [_stopOrFunc]
2946
+ ].join(" ") : color2;
2947
+ });
2948
+ return `${_type}(${_values.join(", ")})`;
2949
+ }
2950
+ var isCSSFunction = (value) => {
2951
+ return typeof value === "string" && value.includes("(") && value.includes(")");
2952
+ };
2953
+ var gradientTransform = (value, theme2) => parseGradient(value, theme2 != null ? theme2 : {});
2954
+ function isCssVar(value) {
2955
+ return /^var\(--.+\)$/.test(value);
2956
+ }
2957
+ var analyzeCSSValue = (value) => {
2958
+ const num = parseFloat(value.toString());
2959
+ const unit = value.toString().replace(String(num), "");
2960
+ return { unitless: !unit, value: num, unit };
2961
+ };
2962
+ var wrap = (str) => (value) => `${str}(${value})`;
2963
+ var transformFunctions = {
2964
+ filter(value) {
2965
+ return value !== "auto" ? value : filterTemplate;
3046
2966
  },
3047
- // brand fills. Only primary and secondary filled in for now.
3048
- brand: {
3049
- primary: "#C60917",
3050
- secondary: "#760000",
3051
- "nypl-red": "#D0343A"
2967
+ backdropFilter(value) {
2968
+ return value !== "auto" ? value : backdropFilterTemplate;
3052
2969
  },
3053
- /**
3054
- * The following color scales are useful for color edge cases
3055
- * where a distinct named ui or brand color doesn't quite work.
3056
- */
3057
- // based on ui/gray/medium
3058
- gray: {
3059
- "50": "#F2F2F2",
3060
- "100": "#DBDBDB",
3061
- "200": "#C4C4C4",
3062
- "300": "#ADADAD",
3063
- "400": "#969696",
3064
- "500": "#808080",
3065
- "600": "#666666",
3066
- "700": "#4D4D4D",
3067
- "800": "#333333",
3068
- "900": "#1A1A1A"
2970
+ ring(value) {
2971
+ return getRingTemplate(transformFunctions.px(value));
3069
2972
  },
3070
- // based on NYPL red
3071
- red: {
3072
- 50: "#ffe7e6",
3073
- 100: "#f6c2bf",
3074
- 200: "#e99796",
3075
- 300: "#de6d6e",
3076
- 400: "#d4454a",
3077
- 500: "#ba2f2b",
3078
- 600: "#922b21",
3079
- 700: "#692216",
3080
- 800: "#41150a",
3081
- 900: "#1d0a01"
2973
+ bgClip(value) {
2974
+ return value === "text" ? { color: "transparent", backgroundClip: "text" } : { backgroundClip: value };
3082
2975
  },
3083
- // based on ui/warning/secondary
3084
- orange: {
3085
- "50": "#FDF1E7",
3086
- "100": "#F9D8BD",
3087
- "200": "#F6BF93",
3088
- "300": "#F2A669",
3089
- "400": "#EF8D3E",
3090
- "500": "#EB7414",
3091
- "600": "#BC5D10",
3092
- "700": "#8D460C",
3093
- "800": "#5E2F08",
3094
- "900": "#2F1704"
2976
+ transform(value) {
2977
+ if (value === "auto")
2978
+ return getTransformTemplate();
2979
+ if (value === "auto-gpu")
2980
+ return getTransformGpuTemplate();
2981
+ return value;
3095
2982
  },
3096
- // based on ui/status/primary
3097
- yellow: {
3098
- "50": "#FEF8E7",
3099
- "100": "#FBECBB",
3100
- "200": "#F9E090",
3101
- "300": "#F7D464",
3102
- "400": "#F4C938",
3103
- "500": "#F2BD0D",
3104
- "600": "#C2970A",
3105
- "700": "#917108",
3106
- "800": "#614B05",
3107
- "900": "#302603"
2983
+ vh(value) {
2984
+ return value === "$100vh" ? "var(--chakra-vh)" : value;
3108
2985
  },
3109
- // based on ui/success/primary
3110
- green: {
3111
- "50": "#E7FEEB",
3112
- "100": "#BCFBC6",
3113
- "200": "#90F8A1",
3114
- "300": "#65F67C",
3115
- "400": "#3AF357",
3116
- "500": "#0EF133",
3117
- "600": "#0BC128",
3118
- "700": "#08911E",
3119
- "800": "#066014",
3120
- "900": "#03300A"
2986
+ px(value) {
2987
+ if (value == null)
2988
+ return value;
2989
+ const { unitless } = analyzeCSSValue(value);
2990
+ return unitless || typeof value === "number" ? `${value}px` : value;
3121
2991
  },
3122
- // based on NYPL blue
3123
- blue: {
3124
- 50: "#dbefff",
3125
- 100: "#add2ff",
3126
- 200: "#7cb8ff",
3127
- 300: "#4aa2ff",
3128
- 400: "#1a8fff",
3129
- 500: "#007ee6",
3130
- 600: "#0056b4",
3131
- 700: "#003582",
3132
- 800: "#001a51",
3133
- 900: "#000621"
2992
+ fraction(value) {
2993
+ return !(typeof value === "number") || value > 1 ? value : `${value * 100}%`;
2994
+ },
2995
+ float(value, theme2) {
2996
+ const map = { left: "right", right: "left" };
2997
+ return theme2.direction === "rtl" ? map[value] : value;
2998
+ },
2999
+ degree(value) {
3000
+ if (isCssVar(value) || value == null)
3001
+ return value;
3002
+ const unitless = typeof value === "string" && !value.endsWith("deg");
3003
+ return typeof value === "number" || unitless ? `${value}deg` : value;
3004
+ },
3005
+ gradient: gradientTransform,
3006
+ blur: wrap("blur"),
3007
+ opacity: wrap("opacity"),
3008
+ brightness: wrap("brightness"),
3009
+ contrast: wrap("contrast"),
3010
+ dropShadow: wrap("drop-shadow"),
3011
+ grayscale: wrap("grayscale"),
3012
+ hueRotate: wrap("hue-rotate"),
3013
+ invert: wrap("invert"),
3014
+ saturate: wrap("saturate"),
3015
+ sepia: wrap("sepia"),
3016
+ bgImage(value) {
3017
+ if (value == null)
3018
+ return value;
3019
+ const prevent = isCSSFunction(value) || globalSet.has(value);
3020
+ return !prevent ? `url(${value})` : value;
3021
+ },
3022
+ outline(value) {
3023
+ const isNoneOrZero = String(value) === "0" || String(value) === "none";
3024
+ return value !== null && isNoneOrZero ? { outline: "2px solid transparent", outlineOffset: "2px" } : { outline: value };
3025
+ },
3026
+ flexDirection(value) {
3027
+ var _a2;
3028
+ const { space: space2, divide: divide2 } = (_a2 = flexDirectionTemplate[value]) != null ? _a2 : {};
3029
+ const result = { flexDirection: value };
3030
+ if (space2)
3031
+ result[space2] = 1;
3032
+ if (divide2)
3033
+ result[divide2] = 1;
3034
+ return result;
3134
3035
  }
3135
3036
  };
3136
- var colors_default2 = colors2;
3137
-
3138
- // src/ui/nypl-base-theme/foundations/radii.ts
3139
- var radii = {
3140
- none: "0",
3141
- sm: "0.125rem",
3142
- base: "0.25rem",
3143
- md: "0.375rem",
3144
- lg: "0.5rem",
3145
- xl: "0.75rem",
3146
- "2xl": "1rem",
3147
- "3xl": "1.5rem",
3148
- full: "9999px"
3037
+ var t = {
3038
+ borderWidths: toConfig("borderWidths"),
3039
+ borderStyles: toConfig("borderStyles"),
3040
+ colors: toConfig("colors"),
3041
+ borders: toConfig("borders"),
3042
+ gradients: toConfig("gradients", transformFunctions.gradient),
3043
+ radii: toConfig("radii", transformFunctions.px),
3044
+ space: toConfig("space", pipe(transformFunctions.vh, transformFunctions.px)),
3045
+ spaceT: toConfig("space", pipe(transformFunctions.vh, transformFunctions.px)),
3046
+ degreeT(property) {
3047
+ return { property, transform: transformFunctions.degree };
3048
+ },
3049
+ prop(property, scale, transform2) {
3050
+ return __spreadValues({
3051
+ property,
3052
+ scale
3053
+ }, scale && {
3054
+ transform: createTransform({ scale, transform: transform2 })
3055
+ });
3056
+ },
3057
+ propT(property, transform2) {
3058
+ return { property, transform: transform2 };
3059
+ },
3060
+ sizes: toConfig("sizes", pipe(transformFunctions.vh, transformFunctions.px)),
3061
+ sizesT: toConfig("sizes", pipe(transformFunctions.vh, transformFunctions.fraction)),
3062
+ shadows: toConfig("shadows"),
3063
+ logical,
3064
+ blur: toConfig("blur", transformFunctions.blur)
3149
3065
  };
3150
- var radii_default = radii;
3151
-
3152
- // src/ui/nypl-base-theme/foundations/spacing.ts
3153
- var spacing = {
3154
- space: {
3155
- px: "1px",
3156
- 0: "0",
3157
- 0.5: "0.125rem",
3158
- // 4px
3159
- 1: "0.25rem",
3160
- 1.5: "0.375rem",
3161
- // 8px
3162
- 2: "0.5rem",
3163
- 2.5: "0.625rem",
3164
- 3: "0.75rem",
3165
- 3.5: "0.875rem",
3166
- // 16px
3167
- 4: "1rem",
3168
- 5: "1.25rem",
3169
- // 24px
3170
- 6: "1.5rem",
3171
- 7: "1.75rem",
3172
- // 32 px
3173
- 8: "2rem",
3174
- 9: "2.25rem",
3175
- 10: "2.5rem",
3176
- // 48px
3177
- 12: "3rem",
3178
- 14: "3.5rem",
3179
- // 64px
3180
- 16: "4rem",
3181
- 20: "5rem",
3182
- // 96px
3183
- 24: "6rem",
3184
- 28: "7rem",
3185
- 32: "8rem",
3186
- 36: "9rem",
3187
- 40: "10rem",
3188
- 44: "11rem",
3189
- 48: "12rem",
3190
- 52: "13rem",
3191
- 56: "14rem",
3192
- 60: "15rem",
3193
- 64: "16rem",
3194
- 72: "18rem",
3195
- 80: "20rem",
3196
- 96: "24rem"
3197
- }
3066
+ var background = {
3067
+ background: t.colors("background"),
3068
+ backgroundColor: t.colors("backgroundColor"),
3069
+ backgroundImage: t.gradients("backgroundImage"),
3070
+ backgroundSize: true,
3071
+ backgroundPosition: true,
3072
+ backgroundRepeat: true,
3073
+ backgroundAttachment: true,
3074
+ backgroundClip: { transform: transformFunctions.bgClip },
3075
+ bgSize: t.prop("backgroundSize"),
3076
+ bgPosition: t.prop("backgroundPosition"),
3077
+ bg: t.colors("background"),
3078
+ bgColor: t.colors("backgroundColor"),
3079
+ bgPos: t.prop("backgroundPosition"),
3080
+ bgRepeat: t.prop("backgroundRepeat"),
3081
+ bgAttachment: t.prop("backgroundAttachment"),
3082
+ bgGradient: t.gradients("backgroundImage"),
3083
+ bgClip: { transform: transformFunctions.bgClip }
3084
+ };
3085
+ Object.assign(background, {
3086
+ bgImage: background.backgroundImage,
3087
+ bgImg: background.backgroundImage
3088
+ });
3089
+ var border = {
3090
+ border: t.borders("border"),
3091
+ borderWidth: t.borderWidths("borderWidth"),
3092
+ borderStyle: t.borderStyles("borderStyle"),
3093
+ borderColor: t.colors("borderColor"),
3094
+ borderRadius: t.radii("borderRadius"),
3095
+ borderTop: t.borders("borderTop"),
3096
+ borderBlockStart: t.borders("borderBlockStart"),
3097
+ borderTopLeftRadius: t.radii("borderTopLeftRadius"),
3098
+ borderStartStartRadius: t.logical({
3099
+ scale: "radii",
3100
+ property: {
3101
+ ltr: "borderTopLeftRadius",
3102
+ rtl: "borderTopRightRadius"
3103
+ }
3104
+ }),
3105
+ borderEndStartRadius: t.logical({
3106
+ scale: "radii",
3107
+ property: {
3108
+ ltr: "borderBottomLeftRadius",
3109
+ rtl: "borderBottomRightRadius"
3110
+ }
3111
+ }),
3112
+ borderTopRightRadius: t.radii("borderTopRightRadius"),
3113
+ borderStartEndRadius: t.logical({
3114
+ scale: "radii",
3115
+ property: {
3116
+ ltr: "borderTopRightRadius",
3117
+ rtl: "borderTopLeftRadius"
3118
+ }
3119
+ }),
3120
+ borderEndEndRadius: t.logical({
3121
+ scale: "radii",
3122
+ property: {
3123
+ ltr: "borderBottomRightRadius",
3124
+ rtl: "borderBottomLeftRadius"
3125
+ }
3126
+ }),
3127
+ borderRight: t.borders("borderRight"),
3128
+ borderInlineEnd: t.borders("borderInlineEnd"),
3129
+ borderBottom: t.borders("borderBottom"),
3130
+ borderBlockEnd: t.borders("borderBlockEnd"),
3131
+ borderBottomLeftRadius: t.radii("borderBottomLeftRadius"),
3132
+ borderBottomRightRadius: t.radii("borderBottomRightRadius"),
3133
+ borderLeft: t.borders("borderLeft"),
3134
+ borderInlineStart: {
3135
+ property: "borderInlineStart",
3136
+ scale: "borders"
3137
+ },
3138
+ borderInlineStartRadius: t.logical({
3139
+ scale: "radii",
3140
+ property: {
3141
+ ltr: ["borderTopLeftRadius", "borderBottomLeftRadius"],
3142
+ rtl: ["borderTopRightRadius", "borderBottomRightRadius"]
3143
+ }
3144
+ }),
3145
+ borderInlineEndRadius: t.logical({
3146
+ scale: "radii",
3147
+ property: {
3148
+ ltr: ["borderTopRightRadius", "borderBottomRightRadius"],
3149
+ rtl: ["borderTopLeftRadius", "borderBottomLeftRadius"]
3150
+ }
3151
+ }),
3152
+ borderX: t.borders(["borderLeft", "borderRight"]),
3153
+ borderInline: t.borders("borderInline"),
3154
+ borderY: t.borders(["borderTop", "borderBottom"]),
3155
+ borderBlock: t.borders("borderBlock"),
3156
+ borderTopWidth: t.borderWidths("borderTopWidth"),
3157
+ borderBlockStartWidth: t.borderWidths("borderBlockStartWidth"),
3158
+ borderTopColor: t.colors("borderTopColor"),
3159
+ borderBlockStartColor: t.colors("borderBlockStartColor"),
3160
+ borderTopStyle: t.borderStyles("borderTopStyle"),
3161
+ borderBlockStartStyle: t.borderStyles("borderBlockStartStyle"),
3162
+ borderBottomWidth: t.borderWidths("borderBottomWidth"),
3163
+ borderBlockEndWidth: t.borderWidths("borderBlockEndWidth"),
3164
+ borderBottomColor: t.colors("borderBottomColor"),
3165
+ borderBlockEndColor: t.colors("borderBlockEndColor"),
3166
+ borderBottomStyle: t.borderStyles("borderBottomStyle"),
3167
+ borderBlockEndStyle: t.borderStyles("borderBlockEndStyle"),
3168
+ borderLeftWidth: t.borderWidths("borderLeftWidth"),
3169
+ borderInlineStartWidth: t.borderWidths("borderInlineStartWidth"),
3170
+ borderLeftColor: t.colors("borderLeftColor"),
3171
+ borderInlineStartColor: t.colors("borderInlineStartColor"),
3172
+ borderLeftStyle: t.borderStyles("borderLeftStyle"),
3173
+ borderInlineStartStyle: t.borderStyles("borderInlineStartStyle"),
3174
+ borderRightWidth: t.borderWidths("borderRightWidth"),
3175
+ borderInlineEndWidth: t.borderWidths("borderInlineEndWidth"),
3176
+ borderRightColor: t.colors("borderRightColor"),
3177
+ borderInlineEndColor: t.colors("borderInlineEndColor"),
3178
+ borderRightStyle: t.borderStyles("borderRightStyle"),
3179
+ borderInlineEndStyle: t.borderStyles("borderInlineEndStyle"),
3180
+ borderTopRadius: t.radii(["borderTopLeftRadius", "borderTopRightRadius"]),
3181
+ borderBottomRadius: t.radii([
3182
+ "borderBottomLeftRadius",
3183
+ "borderBottomRightRadius"
3184
+ ]),
3185
+ borderLeftRadius: t.radii(["borderTopLeftRadius", "borderBottomLeftRadius"]),
3186
+ borderRightRadius: t.radii([
3187
+ "borderTopRightRadius",
3188
+ "borderBottomRightRadius"
3189
+ ])
3190
+ };
3191
+ Object.assign(border, {
3192
+ rounded: border.borderRadius,
3193
+ roundedTop: border.borderTopRadius,
3194
+ roundedTopLeft: border.borderTopLeftRadius,
3195
+ roundedTopRight: border.borderTopRightRadius,
3196
+ roundedTopStart: border.borderStartStartRadius,
3197
+ roundedTopEnd: border.borderStartEndRadius,
3198
+ roundedBottom: border.borderBottomRadius,
3199
+ roundedBottomLeft: border.borderBottomLeftRadius,
3200
+ roundedBottomRight: border.borderBottomRightRadius,
3201
+ roundedBottomStart: border.borderEndStartRadius,
3202
+ roundedBottomEnd: border.borderEndEndRadius,
3203
+ roundedLeft: border.borderLeftRadius,
3204
+ roundedRight: border.borderRightRadius,
3205
+ roundedStart: border.borderInlineStartRadius,
3206
+ roundedEnd: border.borderInlineEndRadius,
3207
+ borderStart: border.borderInlineStart,
3208
+ borderEnd: border.borderInlineEnd,
3209
+ borderTopStartRadius: border.borderStartStartRadius,
3210
+ borderTopEndRadius: border.borderStartEndRadius,
3211
+ borderBottomStartRadius: border.borderEndStartRadius,
3212
+ borderBottomEndRadius: border.borderEndEndRadius,
3213
+ borderStartRadius: border.borderInlineStartRadius,
3214
+ borderEndRadius: border.borderInlineEndRadius,
3215
+ borderStartWidth: border.borderInlineStartWidth,
3216
+ borderEndWidth: border.borderInlineEndWidth,
3217
+ borderStartColor: border.borderInlineStartColor,
3218
+ borderEndColor: border.borderInlineEndColor,
3219
+ borderStartStyle: border.borderInlineStartStyle,
3220
+ borderEndStyle: border.borderInlineEndStyle
3221
+ });
3222
+ var color = {
3223
+ color: t.colors("color"),
3224
+ textColor: t.colors("color"),
3225
+ fill: t.colors("fill"),
3226
+ stroke: t.colors("stroke")
3227
+ };
3228
+ var effect = {
3229
+ boxShadow: t.shadows("boxShadow"),
3230
+ mixBlendMode: true,
3231
+ blendMode: t.prop("mixBlendMode"),
3232
+ backgroundBlendMode: true,
3233
+ bgBlendMode: t.prop("backgroundBlendMode"),
3234
+ opacity: true
3235
+ };
3236
+ Object.assign(effect, {
3237
+ shadow: effect.boxShadow
3238
+ });
3239
+ var filter = {
3240
+ filter: { transform: transformFunctions.filter },
3241
+ blur: t.blur("--chakra-blur"),
3242
+ brightness: t.propT("--chakra-brightness", transformFunctions.brightness),
3243
+ contrast: t.propT("--chakra-contrast", transformFunctions.contrast),
3244
+ hueRotate: t.degreeT("--chakra-hue-rotate"),
3245
+ invert: t.propT("--chakra-invert", transformFunctions.invert),
3246
+ saturate: t.propT("--chakra-saturate", transformFunctions.saturate),
3247
+ dropShadow: t.propT("--chakra-drop-shadow", transformFunctions.dropShadow),
3248
+ backdropFilter: { transform: transformFunctions.backdropFilter },
3249
+ backdropBlur: t.blur("--chakra-backdrop-blur"),
3250
+ backdropBrightness: t.propT(
3251
+ "--chakra-backdrop-brightness",
3252
+ transformFunctions.brightness
3253
+ ),
3254
+ backdropContrast: t.propT("--chakra-backdrop-contrast", transformFunctions.contrast),
3255
+ backdropHueRotate: t.degreeT("--chakra-backdrop-hue-rotate"),
3256
+ backdropInvert: t.propT("--chakra-backdrop-invert", transformFunctions.invert),
3257
+ backdropSaturate: t.propT("--chakra-backdrop-saturate", transformFunctions.saturate)
3198
3258
  };
3199
- var spacing_default = spacing;
3200
-
3201
- // src/ui/nypl-base-theme/components/checkbox.ts
3202
- var baseStyleLabel = {
3203
- userSelect: "none",
3204
- fontWeight: "light",
3205
- _disabled: { color: "ui.gray.x-dark", opacity: 1 }
3259
+ var flexbox = {
3260
+ alignItems: true,
3261
+ alignContent: true,
3262
+ justifyItems: true,
3263
+ justifyContent: true,
3264
+ flexWrap: true,
3265
+ flexDirection: { transform: transformFunctions.flexDirection },
3266
+ flex: true,
3267
+ flexFlow: true,
3268
+ flexGrow: true,
3269
+ flexShrink: true,
3270
+ flexBasis: t.sizes("flexBasis"),
3271
+ justifySelf: true,
3272
+ alignSelf: true,
3273
+ order: true,
3274
+ placeItems: true,
3275
+ placeContent: true,
3276
+ placeSelf: true,
3277
+ gap: t.space("gap"),
3278
+ rowGap: t.space("rowGap"),
3279
+ columnGap: t.space("columnGap")
3206
3280
  };
3207
- var Checkbox = {
3208
- // style object for base or default style
3209
- baseStyle: {
3210
- control: {
3211
- borderColor: "ui.gray.dark",
3212
- _hover: {
3213
- bg: "white",
3214
- _disabled: {
3215
- bg: "ui.gray.x-light-cool"
3216
- }
3217
- },
3218
- _checked: {
3219
- bg: "white",
3220
- color: "gray.800",
3221
- borderColor: "ui.gray.dark",
3222
- _hover: {
3223
- bg: "white",
3224
- borderColor: "ui.gray.x-dark"
3225
- }
3226
- },
3227
- _disabled: {
3228
- bg: "ui.gray.x-light-cool",
3229
- borderColor: "ui.gray.medium"
3230
- }
3231
- },
3232
- label: baseStyleLabel
3233
- },
3234
- // styles for different sizes ("sm", "md", "lg")
3235
- sizes: {},
3236
- // styles for different visual variants ("outline", "solid")
3237
- variants: {},
3238
- // default values for `size`, `variant`, `colorScheme`
3239
- defaultProps: {
3240
- size: "md",
3241
- colorScheme: "gray"
3242
- }
3281
+ Object.assign(flexbox, {
3282
+ flexDir: flexbox.flexDirection
3283
+ });
3284
+ var grid = {
3285
+ gridGap: t.space("gridGap"),
3286
+ gridColumnGap: t.space("gridColumnGap"),
3287
+ gridRowGap: t.space("gridRowGap"),
3288
+ gridColumn: true,
3289
+ gridRow: true,
3290
+ gridAutoFlow: true,
3291
+ gridAutoColumns: true,
3292
+ gridColumnStart: true,
3293
+ gridColumnEnd: true,
3294
+ gridRowStart: true,
3295
+ gridRowEnd: true,
3296
+ gridAutoRows: true,
3297
+ gridTemplate: true,
3298
+ gridTemplateColumns: true,
3299
+ gridTemplateRows: true,
3300
+ gridTemplateAreas: true,
3301
+ gridArea: true
3243
3302
  };
3244
- var checkbox_default = Checkbox;
3245
-
3246
- // src/ui/nypl-base-theme/components/input.ts
3247
- var size = {
3248
- lg: {
3249
- fontSize: "lg",
3250
- px: 4,
3251
- h: 12,
3252
- borderRadius: "none"
3253
- },
3254
- md: {
3255
- fontSize: "sm",
3256
- px: 4,
3257
- h: 9,
3258
- borderRadius: "none"
3259
- },
3260
- sm: {
3261
- fontSize: "sm",
3262
- px: 3,
3263
- h: 8,
3264
- borderRadius: "none"
3265
- },
3266
- xs: {
3267
- fontSize: "xs",
3268
- px: 2,
3269
- h: 6,
3270
- borderRadius: "none"
3271
- }
3303
+ var interactivity = {
3304
+ appearance: true,
3305
+ cursor: true,
3306
+ resize: true,
3307
+ userSelect: true,
3308
+ pointerEvents: true,
3309
+ outline: { transform: transformFunctions.outline },
3310
+ outlineOffset: true,
3311
+ outlineColor: t.colors("outlineColor")
3272
3312
  };
3273
- var sizes2 = {
3274
- lg: {
3275
- field: size.lg,
3276
- addon: size.lg
3277
- },
3278
- md: {
3279
- field: size.md,
3280
- addon: size.md
3313
+ var layout = {
3314
+ width: t.sizesT("width"),
3315
+ inlineSize: t.sizesT("inlineSize"),
3316
+ height: t.sizes("height"),
3317
+ blockSize: t.sizes("blockSize"),
3318
+ boxSize: t.sizes(["width", "height"]),
3319
+ minWidth: t.sizes("minWidth"),
3320
+ minInlineSize: t.sizes("minInlineSize"),
3321
+ minHeight: t.sizes("minHeight"),
3322
+ minBlockSize: t.sizes("minBlockSize"),
3323
+ maxWidth: t.sizes("maxWidth"),
3324
+ maxInlineSize: t.sizes("maxInlineSize"),
3325
+ maxHeight: t.sizes("maxHeight"),
3326
+ maxBlockSize: t.sizes("maxBlockSize"),
3327
+ overflow: true,
3328
+ overflowX: true,
3329
+ overflowY: true,
3330
+ overscrollBehavior: true,
3331
+ overscrollBehaviorX: true,
3332
+ overscrollBehaviorY: true,
3333
+ display: true,
3334
+ aspectRatio: true,
3335
+ hideFrom: {
3336
+ scale: "breakpoints",
3337
+ transform: (value, theme2) => {
3338
+ var _a2, _b, _c;
3339
+ const breakpoint = (_c = (_b = (_a2 = theme2.__breakpoints) == null ? void 0 : _a2.get(value)) == null ? void 0 : _b.minW) != null ? _c : value;
3340
+ const mq = `@media screen and (min-width: ${breakpoint})`;
3341
+ return { [mq]: { display: "none" } };
3342
+ }
3281
3343
  },
3282
- sm: {
3283
- field: size.sm,
3284
- addon: size.sm
3344
+ hideBelow: {
3345
+ scale: "breakpoints",
3346
+ transform: (value, theme2) => {
3347
+ var _a2, _b, _c;
3348
+ const breakpoint = (_c = (_b = (_a2 = theme2.__breakpoints) == null ? void 0 : _a2.get(value)) == null ? void 0 : _b._minW) != null ? _c : value;
3349
+ const mq = `@media screen and (max-width: ${breakpoint})`;
3350
+ return { [mq]: { display: "none" } };
3351
+ }
3285
3352
  },
3286
- xs: {
3287
- field: size.xs,
3288
- addon: size.xs
3289
- }
3353
+ verticalAlign: true,
3354
+ boxSizing: true,
3355
+ boxDecorationBreak: true,
3356
+ float: t.propT("float", transformFunctions.float),
3357
+ objectFit: true,
3358
+ objectPosition: true,
3359
+ visibility: true,
3360
+ isolation: true
3290
3361
  };
3291
- var Input = {
3292
- // style object for base or default style
3293
- baseStyle: {
3294
- field: {
3295
- borderRadius: "none",
3296
- fontSize: "sm",
3297
- _focus: {
3298
- borderColor: "ui.link.primary",
3299
- _hover: {
3300
- borderColor: "ui.link.primary"
3301
- }
3302
- },
3303
- _placeholder: {
3304
- fontStyle: "italic",
3305
- color: "ui.gray.dark"
3306
- },
3307
- _invalid: {
3308
- borderColor: "ui.error",
3309
- _placeholder: {
3310
- color: "ui.error"
3311
- },
3312
- _hover: {
3313
- borderColor: "ui.error"
3314
- }
3315
- }
3362
+ Object.assign(layout, {
3363
+ w: layout.width,
3364
+ h: layout.height,
3365
+ minW: layout.minWidth,
3366
+ maxW: layout.maxWidth,
3367
+ minH: layout.minHeight,
3368
+ maxH: layout.maxHeight,
3369
+ overscroll: layout.overscrollBehavior,
3370
+ overscrollX: layout.overscrollBehaviorX,
3371
+ overscrollY: layout.overscrollBehaviorY
3372
+ });
3373
+ var list = {
3374
+ listStyleType: true,
3375
+ listStylePosition: true,
3376
+ listStylePos: t.prop("listStylePosition"),
3377
+ listStyleImage: true,
3378
+ listStyleImg: t.prop("listStyleImage")
3379
+ };
3380
+ function get(obj, path, fallback, index) {
3381
+ const key = typeof path === "string" ? path.split(".") : [path];
3382
+ for (index = 0; index < key.length; index += 1) {
3383
+ if (!obj)
3384
+ break;
3385
+ obj = obj[key[index]];
3386
+ }
3387
+ return obj === void 0 ? fallback : obj;
3388
+ }
3389
+ var memoize = (fn) => {
3390
+ const cache = /* @__PURE__ */ new WeakMap();
3391
+ const memoizedFn = (obj, path, fallback, index) => {
3392
+ if (typeof obj === "undefined") {
3393
+ return fn(obj, path, fallback);
3316
3394
  }
3317
- },
3318
- // styles for different sizes ("sm", "md", "lg")
3319
- sizes: sizes2,
3320
- // styles for different visual variants ("outline", "solid")
3321
- variants: {
3322
- outline: {
3323
- field: {
3324
- _disabled: {
3325
- bg: "ui.gray.xx-light-cool"
3326
- },
3327
- _focus: {
3328
- boxShadow: "none",
3329
- _hover: {
3330
- borderColor: "ui.link.primary"
3331
- }
3332
- },
3333
- _invalid: {
3334
- boxShadow: "none"
3335
- }
3336
- }
3395
+ if (!cache.has(obj)) {
3396
+ cache.set(obj, /* @__PURE__ */ new Map());
3337
3397
  }
3338
- },
3339
- // default values for `size`, `variant`, `colorScheme`
3340
- defaultProps: {
3341
- size: "md"
3342
- }
3343
- };
3344
- var input_default = Input;
3345
-
3346
- // src/ui/nypl-base-theme/foundations/global.ts
3347
- var global2 = {
3348
- // styles for the `body`
3349
- body: {
3350
- bg: "white",
3351
- color: "black"
3352
- },
3353
- // styles for the `a`
3354
- a: {
3355
- color: "ui.link.primary",
3356
- _hover: {
3357
- textDecoration: "underline"
3398
+ const map = cache.get(obj);
3399
+ if (map.has(path)) {
3400
+ return map.get(path);
3358
3401
  }
3359
- }
3402
+ const value = fn(obj, path, fallback, index);
3403
+ map.set(path, value);
3404
+ return value;
3405
+ };
3406
+ return memoizedFn;
3360
3407
  };
3361
- var global_default = global2;
3362
-
3363
- // src/ui/nypl-base-theme/components/form-label.ts
3364
- var baseStyle2 = {
3365
- fontSize: "sm",
3366
- marginEnd: 0,
3367
- mb: 2,
3368
- fontWeight: "medium",
3369
- transition: "all 0.2s",
3370
- opacity: 1,
3371
- _disabled: {
3372
- opacity: 1
3373
- }
3408
+ var memoizedGet = memoize(get);
3409
+ var srOnly = {
3410
+ border: "0px",
3411
+ clip: "rect(0, 0, 0, 0)",
3412
+ width: "1px",
3413
+ height: "1px",
3414
+ margin: "-1px",
3415
+ padding: "0px",
3416
+ overflow: "hidden",
3417
+ whiteSpace: "nowrap",
3418
+ position: "absolute"
3374
3419
  };
3375
- var form_label_default = {
3376
- baseStyle: baseStyle2
3420
+ var srFocusable = {
3421
+ position: "static",
3422
+ width: "auto",
3423
+ height: "auto",
3424
+ clip: "auto",
3425
+ padding: "0",
3426
+ margin: "0",
3427
+ overflow: "visible",
3428
+ whiteSpace: "normal"
3377
3429
  };
3378
-
3379
- // src/ui/nypl-base-theme/components/form.ts
3380
- var baseStyle3 = {
3381
- requiredIndicator: {
3382
- marginStart: 1,
3383
- color: "red.500"
3384
- },
3385
- helperText: {
3386
- mt: 2,
3387
- color: "black",
3388
- lineHeight: "normal",
3389
- fontSize: "xs"
3430
+ var getWithPriority = (theme2, key, styles) => {
3431
+ const result = {};
3432
+ const obj = memoizedGet(theme2, key, {});
3433
+ for (const prop in obj) {
3434
+ const isInStyles = prop in styles && styles[prop] != null;
3435
+ if (!isInStyles)
3436
+ result[prop] = obj[prop];
3390
3437
  }
3438
+ return result;
3391
3439
  };
3392
- var form_default = {
3393
- baseStyle: baseStyle3
3394
- };
3395
-
3396
- // src/ui/nypl-base-theme/components/form-error.ts
3397
- var baseStyle4 = {
3398
- text: {
3399
- color: "ui.error",
3400
- mt: 2,
3401
- fontSize: "xs"
3440
+ var others = {
3441
+ srOnly: {
3442
+ transform(value) {
3443
+ if (value === true)
3444
+ return srOnly;
3445
+ if (value === "focusable")
3446
+ return srFocusable;
3447
+ return {};
3448
+ }
3402
3449
  },
3403
- icon: {
3404
- marginEnd: "0.5em",
3405
- color: "ui.error"
3450
+ layerStyle: {
3451
+ processResult: true,
3452
+ transform: (value, theme2, styles) => getWithPriority(theme2, `layerStyles.${value}`, styles)
3453
+ },
3454
+ textStyle: {
3455
+ processResult: true,
3456
+ transform: (value, theme2, styles) => getWithPriority(theme2, `textStyles.${value}`, styles)
3457
+ },
3458
+ apply: {
3459
+ processResult: true,
3460
+ transform: (value, theme2, styles) => getWithPriority(theme2, value, styles)
3406
3461
  }
3407
3462
  };
3408
- var form_error_default = {
3409
- baseStyle: baseStyle4
3463
+ var position = {
3464
+ position: true,
3465
+ pos: t.prop("position"),
3466
+ zIndex: t.prop("zIndex", "zIndices"),
3467
+ inset: t.spaceT("inset"),
3468
+ insetX: t.spaceT(["left", "right"]),
3469
+ insetInline: t.spaceT("insetInline"),
3470
+ insetY: t.spaceT(["top", "bottom"]),
3471
+ insetBlock: t.spaceT("insetBlock"),
3472
+ top: t.spaceT("top"),
3473
+ insetBlockStart: t.spaceT("insetBlockStart"),
3474
+ bottom: t.spaceT("bottom"),
3475
+ insetBlockEnd: t.spaceT("insetBlockEnd"),
3476
+ left: t.spaceT("left"),
3477
+ insetInlineStart: t.logical({
3478
+ scale: "space",
3479
+ property: { ltr: "left", rtl: "right" }
3480
+ }),
3481
+ right: t.spaceT("right"),
3482
+ insetInlineEnd: t.logical({
3483
+ scale: "space",
3484
+ property: { ltr: "right", rtl: "left" }
3485
+ })
3410
3486
  };
3411
-
3412
- // src/ui/nypl-base-theme/components/text-area.ts
3413
- var sizes3 = {
3414
- xs: input_default.sizes.xs.field,
3415
- sm: input_default.sizes.sm.field,
3416
- md: input_default.sizes.md.field,
3417
- lg: input_default.sizes.lg.field
3487
+ Object.assign(position, {
3488
+ insetStart: position.insetInlineStart,
3489
+ insetEnd: position.insetInlineEnd
3490
+ });
3491
+ var ring = {
3492
+ ring: { transform: transformFunctions.ring },
3493
+ ringColor: t.colors("--chakra-ring-color"),
3494
+ ringOffset: t.prop("--chakra-ring-offset-width"),
3495
+ ringOffsetColor: t.colors("--chakra-ring-offset-color"),
3496
+ ringInset: t.prop("--chakra-ring-inset")
3497
+ };
3498
+ var space = {
3499
+ margin: t.spaceT("margin"),
3500
+ marginTop: t.spaceT("marginTop"),
3501
+ marginBlockStart: t.spaceT("marginBlockStart"),
3502
+ marginRight: t.spaceT("marginRight"),
3503
+ marginInlineEnd: t.spaceT("marginInlineEnd"),
3504
+ marginBottom: t.spaceT("marginBottom"),
3505
+ marginBlockEnd: t.spaceT("marginBlockEnd"),
3506
+ marginLeft: t.spaceT("marginLeft"),
3507
+ marginInlineStart: t.spaceT("marginInlineStart"),
3508
+ marginX: t.spaceT(["marginInlineStart", "marginInlineEnd"]),
3509
+ marginInline: t.spaceT("marginInline"),
3510
+ marginY: t.spaceT(["marginTop", "marginBottom"]),
3511
+ marginBlock: t.spaceT("marginBlock"),
3512
+ padding: t.space("padding"),
3513
+ paddingTop: t.space("paddingTop"),
3514
+ paddingBlockStart: t.space("paddingBlockStart"),
3515
+ paddingRight: t.space("paddingRight"),
3516
+ paddingBottom: t.space("paddingBottom"),
3517
+ paddingBlockEnd: t.space("paddingBlockEnd"),
3518
+ paddingLeft: t.space("paddingLeft"),
3519
+ paddingInlineStart: t.space("paddingInlineStart"),
3520
+ paddingInlineEnd: t.space("paddingInlineEnd"),
3521
+ paddingX: t.space(["paddingInlineStart", "paddingInlineEnd"]),
3522
+ paddingInline: t.space("paddingInline"),
3523
+ paddingY: t.space(["paddingTop", "paddingBottom"]),
3524
+ paddingBlock: t.space("paddingBlock")
3525
+ };
3526
+ Object.assign(space, {
3527
+ m: space.margin,
3528
+ mt: space.marginTop,
3529
+ mr: space.marginRight,
3530
+ me: space.marginInlineEnd,
3531
+ marginEnd: space.marginInlineEnd,
3532
+ mb: space.marginBottom,
3533
+ ml: space.marginLeft,
3534
+ ms: space.marginInlineStart,
3535
+ marginStart: space.marginInlineStart,
3536
+ mx: space.marginX,
3537
+ my: space.marginY,
3538
+ p: space.padding,
3539
+ pt: space.paddingTop,
3540
+ py: space.paddingY,
3541
+ px: space.paddingX,
3542
+ pb: space.paddingBottom,
3543
+ pl: space.paddingLeft,
3544
+ ps: space.paddingInlineStart,
3545
+ paddingStart: space.paddingInlineStart,
3546
+ pr: space.paddingRight,
3547
+ pe: space.paddingInlineEnd,
3548
+ paddingEnd: space.paddingInlineEnd
3549
+ });
3550
+ var textDecoration = {
3551
+ textDecorationColor: t.colors("textDecorationColor"),
3552
+ textDecoration: true,
3553
+ textDecor: { property: "textDecoration" },
3554
+ textDecorationLine: true,
3555
+ textDecorationStyle: true,
3556
+ textDecorationThickness: true,
3557
+ textUnderlineOffset: true,
3558
+ textShadow: t.shadows("textShadow")
3559
+ };
3560
+ var transform = {
3561
+ clipPath: true,
3562
+ transform: t.propT("transform", transformFunctions.transform),
3563
+ transformOrigin: true,
3564
+ translateX: t.spaceT("--chakra-translate-x"),
3565
+ translateY: t.spaceT("--chakra-translate-y"),
3566
+ skewX: t.degreeT("--chakra-skew-x"),
3567
+ skewY: t.degreeT("--chakra-skew-y"),
3568
+ scaleX: t.prop("--chakra-scale-x"),
3569
+ scaleY: t.prop("--chakra-scale-y"),
3570
+ scale: t.prop(["--chakra-scale-x", "--chakra-scale-y"]),
3571
+ rotate: t.degreeT("--chakra-rotate")
3418
3572
  };
3419
- var text_area_default = {
3420
- baseStyle: {
3421
- _disabled: {
3422
- bg: "ui.gray.x-light-cool"
3573
+ var transition = {
3574
+ transition: true,
3575
+ transitionDelay: true,
3576
+ animation: true,
3577
+ willChange: true,
3578
+ transitionDuration: t.prop("transitionDuration", "transition.duration"),
3579
+ transitionProperty: t.prop("transitionProperty", "transition.property"),
3580
+ transitionTimingFunction: t.prop(
3581
+ "transitionTimingFunction",
3582
+ "transition.easing"
3583
+ )
3584
+ };
3585
+ var typography3 = {
3586
+ fontFamily: t.prop("fontFamily", "fonts"),
3587
+ fontSize: t.prop("fontSize", "fontSizes", transformFunctions.px),
3588
+ fontWeight: t.prop("fontWeight", "fontWeights"),
3589
+ lineHeight: t.prop("lineHeight", "lineHeights"),
3590
+ letterSpacing: t.prop("letterSpacing", "letterSpacings"),
3591
+ textAlign: true,
3592
+ fontStyle: true,
3593
+ textIndent: true,
3594
+ wordBreak: true,
3595
+ overflowWrap: true,
3596
+ textOverflow: true,
3597
+ textTransform: true,
3598
+ whiteSpace: true,
3599
+ isTruncated: {
3600
+ transform(value) {
3601
+ if (value === true) {
3602
+ return {
3603
+ overflow: "hidden",
3604
+ textOverflow: "ellipsis",
3605
+ whiteSpace: "nowrap"
3606
+ };
3607
+ }
3423
3608
  }
3424
3609
  },
3425
- sizes: sizes3
3610
+ noOfLines: {
3611
+ static: {
3612
+ overflow: "hidden",
3613
+ textOverflow: "ellipsis",
3614
+ display: "-webkit-box",
3615
+ WebkitBoxOrient: "vertical",
3616
+ WebkitLineClamp: "var(--chakra-line-clamp)"
3617
+ },
3618
+ property: "--chakra-line-clamp"
3619
+ }
3426
3620
  };
3427
-
3428
- // src/ui/nypl-base-theme/index.ts
3429
- var theme = extendTheme(__spreadProps(__spreadValues({
3430
- styles: { global: global_default },
3431
- breakpoints: breakpoints_default,
3432
- radii: radii_default,
3433
- colors: colors_default2
3434
- }, typography_default2), {
3435
- space: spacing_default,
3436
- /**
3437
- * Chakra documentation on component styles:
3438
- * https://chakra-ui.com/docs/theming/component-style
3439
- */
3440
- components: {
3441
- Button: button_default,
3442
- Checkbox: checkbox_default,
3443
- Input: input_default,
3444
- FormLabel: form_label_default,
3445
- Form: form_default,
3446
- FormError: form_error_default,
3447
- Textarea: text_area_default
3621
+ var scroll = {
3622
+ scrollBehavior: true,
3623
+ scrollSnapAlign: true,
3624
+ scrollSnapStop: true,
3625
+ scrollSnapType: true,
3626
+ scrollMargin: t.spaceT("scrollMargin"),
3627
+ scrollMarginTop: t.spaceT("scrollMarginTop"),
3628
+ scrollMarginBottom: t.spaceT("scrollMarginBottom"),
3629
+ scrollMarginLeft: t.spaceT("scrollMarginLeft"),
3630
+ scrollMarginRight: t.spaceT("scrollMarginRight"),
3631
+ scrollMarginX: t.spaceT(["scrollMarginLeft", "scrollMarginRight"]),
3632
+ scrollMarginY: t.spaceT(["scrollMarginTop", "scrollMarginBottom"]),
3633
+ scrollPadding: t.spaceT("scrollPadding"),
3634
+ scrollPaddingTop: t.spaceT("scrollPaddingTop"),
3635
+ scrollPaddingBottom: t.spaceT("scrollPaddingBottom"),
3636
+ scrollPaddingLeft: t.spaceT("scrollPaddingLeft"),
3637
+ scrollPaddingRight: t.spaceT("scrollPaddingRight"),
3638
+ scrollPaddingX: t.spaceT(["scrollPaddingLeft", "scrollPaddingRight"]),
3639
+ scrollPaddingY: t.spaceT(["scrollPaddingTop", "scrollPaddingBottom"])
3640
+ };
3641
+ function resolveReference(operand) {
3642
+ if (isObject(operand) && operand.reference) {
3643
+ return operand.reference;
3448
3644
  }
3449
- }));
3450
- var nypl_base_theme_default = theme;
3451
-
3452
- // src/ui/theme/components/button.ts
3453
- var getButtonStyle = (getColor2) => ({
3454
- // style object for base or default style
3455
- baseStyle: {
3456
- borderRadius: "none"
3457
- },
3458
- // styles for different sizes ("sm", "md", "lg")
3459
- sizes: {},
3460
- // styles for different visual variants ("outline", "solid")
3461
- variants: {
3462
- solid: variantSolid2(getColor2),
3463
- settings: variantSettings(getColor2)
3464
- },
3465
- // default values for `size`, `variant`, `colorScheme`
3466
- defaultProps: {
3467
- size: "sm",
3468
- variant: "solid"
3645
+ return String(operand);
3646
+ }
3647
+ var toExpression = (operator, ...operands) => operands.map(resolveReference).join(` ${operator} `).replace(/calc/g, "");
3648
+ var add = (...operands) => `calc(${toExpression("+", ...operands)})`;
3649
+ var subtract = (...operands) => `calc(${toExpression("-", ...operands)})`;
3650
+ var multiply = (...operands) => `calc(${toExpression("*", ...operands)})`;
3651
+ var divide = (...operands) => `calc(${toExpression("/", ...operands)})`;
3652
+ var negate = (x) => {
3653
+ const value = resolveReference(x);
3654
+ if (value != null && !Number.isNaN(parseFloat(value))) {
3655
+ return String(value).startsWith("-") ? String(value).slice(1) : `-${value}`;
3469
3656
  }
3470
- });
3471
- var variantSolid2 = (getColor2) => (props) => {
3472
- const { "aria-expanded": expanded } = props;
3473
- const bgColor = getColor2("ui.gray.light-warm", "ui.black", "ui.sepia");
3474
- const bgColorActive = getColor2(
3475
- "ui.gray.active",
3476
- "ui.gray.x-dark",
3477
- "ui.sepiaChecked"
3478
- );
3479
- const color2 = getColor2("gray.800", "ui.white", "gray.800");
3480
- const _focus = {
3481
- bgColor: bgColorActive,
3482
- color: color2,
3483
- ring: "2px",
3484
- ringInset: "inset"
3485
- };
3486
- const _hover = {
3487
- bgColor: bgColorActive,
3488
- color: color2,
3489
- _disabled: { bgColor }
3490
- };
3491
- const _active = { bgColor: bgColorActive, color: color2 };
3492
- const _checked = { bgColor, color: color2 };
3493
- const _disabled = { bgColor };
3494
- return {
3495
- border: "none",
3496
- borderColor: "gray.100",
3497
- height: "45px",
3498
- transition: "none",
3499
- fontSize: 0,
3500
- letterSpacing: 1,
3501
- maxWidth: "100%",
3502
- cursor: "pointer",
3503
- bgColor: expanded ? bgColorActive : bgColor,
3504
- color: color2,
3505
- _focus,
3506
- _hover,
3507
- _active,
3508
- _checked,
3509
- _disabled
3510
- };
3511
- };
3512
- var variantSettings = (getColor2) => (props) => {
3513
- const { bgColor } = props;
3514
- const color2 = getColor2("ui.black", "ui.white", "ui.black");
3515
- const checkedBgColor = getColor2(
3516
- "ui.gray.light-warm",
3517
- "ui.gray.x-dark",
3518
- "ui.sepiaChecked"
3519
- );
3520
- return __spreadProps(__spreadValues({}, variantSolid2(getColor2)(props)), {
3521
- bgColor: getColor2("ui.white", "ui.black", "ui.sepia"),
3522
- border: "1px solid",
3523
- color: color2,
3524
- py: 8,
3525
- width: [8, 16, 36],
3526
- fontSize: [0, 0, 2],
3527
- whiteSpace: ["normal", "normal", "nowrap"],
3528
- p: {
3529
- textAlign: "center"
3530
- },
3531
- _active: {
3532
- bgColor
3533
- },
3534
- _checked: {
3535
- color: color2,
3536
- bgColor: checkedBgColor,
3537
- borderBottomColor: checkedBgColor,
3538
- p: {
3539
- textDecoration: "underline",
3540
- textUnderlinePosition: "under"
3541
- }
3542
- },
3543
- _hover: {
3544
- bgColor
3545
- },
3546
- _focus: {
3547
- bgColor,
3548
- ring: "2px",
3549
- ringInset: "inset"
3550
- }
3551
- });
3657
+ return multiply(value, -1);
3552
3658
  };
3553
- var button_default2 = getButtonStyle;
3554
-
3555
- // src/ui/theme/index.ts
3556
- function getTheme(colorMode = "day") {
3557
- return extendTheme2(
3558
- __spreadProps(__spreadValues({
3559
- colors: colors_default
3560
- }, typography_default), {
3561
- /**
3562
- * Chakra documentation on component styles:
3563
- * https://chakra-ui.com/docs/theming/component-style
3564
- */
3565
- components: {
3566
- Button: button_default2(getColor(colorMode)),
3567
- Text: text_default,
3568
- Alert: alert_default,
3569
- SkipNavigation: skipNavigation_default
3570
- },
3571
- currentColorMode: colorMode
3572
- }),
3573
- nypl_base_theme_default
3574
- );
3659
+ var calc = Object.assign(
3660
+ (x) => ({
3661
+ add: (...operands) => calc(add(x, ...operands)),
3662
+ subtract: (...operands) => calc(subtract(x, ...operands)),
3663
+ multiply: (...operands) => calc(multiply(x, ...operands)),
3664
+ divide: (...operands) => calc(divide(x, ...operands)),
3665
+ negate: () => calc(negate(x)),
3666
+ toString: () => x.toString()
3667
+ }),
3668
+ {
3669
+ add,
3670
+ subtract,
3671
+ multiply,
3672
+ divide,
3673
+ negate
3674
+ }
3675
+ );
3676
+ function analyzeCSSValue2(value) {
3677
+ const num = parseFloat(value.toString());
3678
+ const unit = value.toString().replace(String(num), "");
3679
+ return { unitless: !unit, value: num, unit };
3680
+ }
3681
+ function px(value) {
3682
+ if (value == null)
3683
+ return value;
3684
+ const { unitless } = analyzeCSSValue2(value);
3685
+ return unitless || typeof value === "number" ? `${value}px` : value;
3575
3686
  }
3576
-
3577
- // src/ui/ToggleButton.tsx
3578
- function ToggleButton(props) {
3579
- const _a2 = props, { children, colorMode, icon, iconFill, label, value } = _a2, rest = __objRest(_a2, ["children", "colorMode", "icon", "iconFill", "label", "value"]);
3580
- const { getInputProps, getCheckboxProps } = useRadio(props);
3581
- const input = getInputProps();
3582
- const checkbox = getCheckboxProps();
3583
- const theme2 = useTheme2();
3584
- return (
3585
- // This will override the default theme if we specify the colorMode to the toggle button.
3586
- /* @__PURE__ */ React16.createElement(ThemeProvider, { theme: getTheme(colorMode != null ? colorMode : theme2.currentColorMode) }, /* @__PURE__ */ React16.createElement(fonts_default, null), /* @__PURE__ */ React16.createElement(ChakraBox, { as: "label", display: "flex", flexGrow: 1, "aria-label": label }, /* @__PURE__ */ React16.createElement("input", __spreadValues({}, input)), /* @__PURE__ */ React16.createElement(
3587
- Button_default,
3588
- __spreadValues(__spreadValues({
3589
- as: "div",
3590
- variant: "settings",
3591
- flexGrow: 1
3592
- }, checkbox), rest),
3593
- icon && /* @__PURE__ */ React16.createElement(
3594
- Icon14,
3595
- {
3596
- as: icon,
3597
- verticalAlign: "middle",
3598
- mr: 1.5,
3599
- w: 6,
3600
- h: 6,
3601
- fill: iconFill && iconFill
3602
- }
3603
- ),
3604
- label && /* @__PURE__ */ React16.createElement(Text, null, label)
3605
- )))
3606
- );
3687
+ function toMediaQueryString(min, max) {
3688
+ const query = ["@media screen"];
3689
+ if (min)
3690
+ query.push("and", `(min-width: ${px(min)})`);
3691
+ if (max)
3692
+ query.push("and", `(max-width: ${px(max)})`);
3693
+ return query.join(" ");
3607
3694
  }
3608
- var FontToggleButton = (props) => {
3609
- return /* @__PURE__ */ React16.createElement(ToggleButton, __spreadValues({ fontSize: [-2, -2, -1, -1, 0], py: 6 }, props));
3695
+ var state = {
3696
+ hover: (str, post) => `${str}:hover ${post}, ${str}[data-hover] ${post}`,
3697
+ focus: (str, post) => `${str}:focus ${post}, ${str}[data-focus] ${post}`,
3698
+ focusVisible: (str, post) => `${str}:focus-visible ${post}`,
3699
+ focusWithin: (str, post) => `${str}:focus-within ${post}`,
3700
+ active: (str, post) => `${str}:active ${post}, ${str}[data-active] ${post}`,
3701
+ disabled: (str, post) => `${str}:disabled ${post}, ${str}[data-disabled] ${post}`,
3702
+ invalid: (str, post) => `${str}:invalid ${post}, ${str}[data-invalid] ${post}`,
3703
+ checked: (str, post) => `${str}:checked ${post}, ${str}[data-checked] ${post}`,
3704
+ indeterminate: (str, post) => `${str}:indeterminate ${post}, ${str}[aria-checked=mixed] ${post}, ${str}[data-indeterminate] ${post}`,
3705
+ readOnly: (str, post) => `${str}:read-only ${post}, ${str}[readonly] ${post}, ${str}[data-read-only] ${post}`,
3706
+ expanded: (str, post) => `${str}:read-only ${post}, ${str}[aria-expanded=true] ${post}, ${str}[data-expanded] ${post}`,
3707
+ placeholderShown: (str, post) => `${str}:placeholder-shown ${post}`
3610
3708
  };
3611
- var ColorModeToggleButton = (_a2) => {
3612
- var _b = _a2, {
3613
- bgColor
3614
- } = _b, rest = __objRest(_b, [
3615
- "bgColor"
3616
- ]);
3617
- return /* @__PURE__ */ React16.createElement(
3618
- ToggleButton,
3619
- __spreadValues({
3620
- sx: {
3621
- _checked: {
3622
- bgColor,
3623
- p: {
3624
- textDecoration: "underline",
3625
- textUnderlinePosition: "under"
3626
- }
3627
- }
3628
- }
3629
- }, rest)
3630
- );
3709
+ var toGroup = (fn) => merge((v) => fn(v, "&"), "[role=group]", "[data-group]", ".group");
3710
+ var toPeer = (fn) => merge((v) => fn(v, "~ &"), "[data-peer]", ".peer");
3711
+ var merge = (fn, ...selectors) => selectors.map(fn).join(", ");
3712
+ var pseudoSelectors = {
3713
+ _hover: "&:hover, &[data-hover]",
3714
+ _active: "&:active, &[data-active]",
3715
+ _focus: "&:focus, &[data-focus]",
3716
+ _highlighted: "&[data-highlighted]",
3717
+ _focusWithin: "&:focus-within",
3718
+ _focusVisible: "&:focus-visible, &[data-focus-visible]",
3719
+ _disabled: "&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",
3720
+ _readOnly: "&[aria-readonly=true], &[readonly], &[data-readonly]",
3721
+ _before: "&::before",
3722
+ _after: "&::after",
3723
+ _empty: "&:empty",
3724
+ _expanded: "&[aria-expanded=true], &[data-expanded]",
3725
+ _checked: "&[aria-checked=true], &[data-checked]",
3726
+ _grabbed: "&[aria-grabbed=true], &[data-grabbed]",
3727
+ _pressed: "&[aria-pressed=true], &[data-pressed]",
3728
+ _invalid: "&[aria-invalid=true], &[data-invalid]",
3729
+ _valid: "&[data-valid], &[data-state=valid]",
3730
+ _loading: "&[data-loading], &[aria-busy=true]",
3731
+ _selected: "&[aria-selected=true], &[data-selected]",
3732
+ _hidden: "&[hidden], &[data-hidden]",
3733
+ _autofill: "&:-webkit-autofill",
3734
+ _even: "&:nth-of-type(even)",
3735
+ _odd: "&:nth-of-type(odd)",
3736
+ _first: "&:first-of-type",
3737
+ _firstLetter: "&::first-letter",
3738
+ _last: "&:last-of-type",
3739
+ _notFirst: "&:not(:first-of-type)",
3740
+ _notLast: "&:not(:last-of-type)",
3741
+ _visited: "&:visited",
3742
+ _activeLink: "&[aria-current=page]",
3743
+ _activeStep: "&[aria-current=step]",
3744
+ _indeterminate: "&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",
3745
+ _groupHover: toGroup(state.hover),
3746
+ _peerHover: toPeer(state.hover),
3747
+ _groupFocus: toGroup(state.focus),
3748
+ _peerFocus: toPeer(state.focus),
3749
+ _groupFocusVisible: toGroup(state.focusVisible),
3750
+ _peerFocusVisible: toPeer(state.focusVisible),
3751
+ _groupActive: toGroup(state.active),
3752
+ _peerActive: toPeer(state.active),
3753
+ _groupDisabled: toGroup(state.disabled),
3754
+ _peerDisabled: toPeer(state.disabled),
3755
+ _groupInvalid: toGroup(state.invalid),
3756
+ _peerInvalid: toPeer(state.invalid),
3757
+ _groupChecked: toGroup(state.checked),
3758
+ _peerChecked: toPeer(state.checked),
3759
+ _groupFocusWithin: toGroup(state.focusWithin),
3760
+ _peerFocusWithin: toPeer(state.focusWithin),
3761
+ _peerPlaceholderShown: toPeer(state.placeholderShown),
3762
+ _placeholder: "&::placeholder",
3763
+ _placeholderShown: "&:placeholder-shown",
3764
+ _fullScreen: "&:fullscreen",
3765
+ _selection: "&::selection",
3766
+ _rtl: "[dir=rtl] &, &[dir=rtl]",
3767
+ _ltr: "[dir=ltr] &, &[dir=ltr]",
3768
+ _mediaDark: "@media (prefers-color-scheme: dark)",
3769
+ _mediaReduceMotion: "@media (prefers-reduced-motion: reduce)",
3770
+ _dark: ".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",
3771
+ _light: ".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",
3772
+ _horizontal: "&[data-orientation=horizontal]",
3773
+ _vertical: "&[data-orientation=vertical]"
3631
3774
  };
3632
- var ToggleButton_default = ToggleButton;
3633
-
3634
- // src/ui/ToggleGroup.tsx
3635
- import React17 from "react";
3636
- import { Flex, useRadioGroup } from "@chakra-ui/react";
3637
- var ToggleGroup = ({
3638
- value,
3639
- label,
3640
- name,
3641
- children,
3642
- onChange
3643
- }) => {
3644
- const { getRootProps, getRadioProps } = useRadioGroup({
3645
- name,
3646
- onChange,
3647
- value
3648
- });
3649
- const group = getRootProps();
3650
- return /* @__PURE__ */ React17.createElement(Flex, __spreadProps(__spreadValues({}, group), { "aria-label": label, flex: "1 0 auto", flexWrap: "nowrap" }), React17.Children.map(children, (element) => {
3651
- try {
3652
- const value2 = element.props.value;
3653
- const radio = getRadioProps({ value: value2 });
3654
- return React17.cloneElement(element, __spreadValues({}, radio));
3655
- } catch (e) {
3656
- throw new Error(
3657
- "ToggleGroup expects ToggleButton children with `value` props."
3658
- );
3775
+ var pseudoPropNames = Object.keys(
3776
+ pseudoSelectors
3777
+ );
3778
+ function omit(object, keysToOmit = []) {
3779
+ const clone = Object.assign({}, object);
3780
+ for (const key of keysToOmit) {
3781
+ if (key in clone) {
3782
+ delete clone[key];
3659
3783
  }
3660
- }));
3661
- };
3662
- var ToggleGroup_default = ToggleGroup;
3663
-
3664
- // src/ui/PdfSettings.tsx
3665
- import { MdOutlineZoomIn, MdOutlineZoomOut } from "react-icons/md";
3666
- function PdfSettings(props) {
3667
- const { navigator, paginationValue } = props;
3668
- const { zoomOut, zoomIn, setScroll } = navigator;
3669
- const iconFill = "ui.gray.icon";
3670
- return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(ButtonGroup, { display: "flex", spacing: 0 }, /* @__PURE__ */ React18.createElement(
3671
- Button_default,
3672
- {
3673
- flexGrow: 1,
3674
- "aria-label": "Zoom Out",
3675
- onClick: zoomOut,
3676
- variant: "settings"
3677
- },
3678
- /* @__PURE__ */ React18.createElement(Icon15, { as: MdOutlineZoomOut, w: 7, h: 7, pl: 1 }),
3679
- "Zoom Out"
3680
- ), /* @__PURE__ */ React18.createElement(
3681
- Button_default,
3682
- {
3683
- flexGrow: 1,
3684
- "aria-label": "Zoom In",
3685
- onClick: zoomIn,
3686
- variant: "settings"
3687
- },
3688
- /* @__PURE__ */ React18.createElement(Icon15, { as: MdOutlineZoomIn, w: 7, h: 7, pl: 1 }),
3689
- "Zoom In"
3690
- )), /* @__PURE__ */ React18.createElement(
3691
- ToggleGroup_default,
3692
- {
3693
- onChange: setScroll,
3694
- value: paginationValue,
3695
- label: "pagination options"
3696
- },
3697
- /* @__PURE__ */ React18.createElement(
3698
- ToggleButton_default,
3699
- {
3700
- value: "paginated",
3701
- borderRadius: "0 0 0 4px",
3702
- label: "Paginated",
3703
- icon: Paginated_default,
3704
- iconFill
3705
- }
3706
- ),
3707
- /* @__PURE__ */ React18.createElement(
3708
- ToggleButton_default,
3709
- {
3710
- value: "scrolling",
3711
- borderRadius: "0 0 4px 0",
3712
- label: "Scrolling",
3713
- icon: Continuous_default,
3714
- iconFill
3715
- }
3716
- )
3717
- ));
3784
+ }
3785
+ return clone;
3718
3786
  }
3719
-
3720
- // src/ui/HtmlSettings.tsx
3721
- import * as React19 from "react";
3722
- import { Box, ButtonGroup as ButtonGroup2, Heading, Text as Text2 } from "@chakra-ui/react";
3723
- function HtmlSettings(props) {
3724
- const { navigator, iconFill, readerState, paginationValue } = props;
3725
- const buttonTextColor = useColorModeValue_default("ui.black", "ui.white", "ui.black");
3726
- const checkedButtonBgColor = useColorModeValue_default(
3727
- "ui.gray.light-warm",
3728
- "ui.gray.x-dark",
3729
- "ui.sepiaChecked"
3730
- );
3731
- if (!readerState.settings)
3732
- return null;
3733
- const { colorMode, fontFamily } = readerState.settings;
3734
- const {
3735
- setFontFamily,
3736
- decreaseFontSize,
3737
- increaseFontSize,
3738
- resetSettings,
3739
- setColorMode,
3740
- setScroll
3741
- } = navigator;
3742
- return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
3743
- ToggleGroup_default,
3744
- {
3745
- value: fontFamily,
3746
- label: "text font options",
3747
- onChange: setFontFamily
3748
- },
3749
- /* @__PURE__ */ React19.createElement(FontToggleButton, { value: "publisher", label: "Default" }),
3750
- /* @__PURE__ */ React19.createElement(
3751
- FontToggleButton,
3752
- {
3753
- value: "serif",
3754
- label: "Serif",
3755
- fontFamily: "serif",
3756
- fontWeight: "regular"
3787
+ var systemProps = (0, import_lodash3.default)(
3788
+ {},
3789
+ background,
3790
+ border,
3791
+ color,
3792
+ flexbox,
3793
+ layout,
3794
+ filter,
3795
+ ring,
3796
+ interactivity,
3797
+ grid,
3798
+ others,
3799
+ position,
3800
+ effect,
3801
+ space,
3802
+ scroll,
3803
+ typography3,
3804
+ textDecoration,
3805
+ transform,
3806
+ list,
3807
+ transition
3808
+ );
3809
+ var layoutSystem = Object.assign({}, space, layout, flexbox, grid, position);
3810
+ var layoutPropNames = Object.keys(
3811
+ layoutSystem
3812
+ );
3813
+ var propNames = [...Object.keys(systemProps), ...pseudoPropNames];
3814
+ var styleProps = __spreadValues(__spreadValues({}, systemProps), pseudoSelectors);
3815
+ var isStyleProp = (prop) => prop in styleProps;
3816
+ var expandResponsive = (styles) => (theme2) => {
3817
+ if (!theme2.__breakpoints)
3818
+ return styles;
3819
+ const { isResponsive, toArrayValue, media: medias } = theme2.__breakpoints;
3820
+ const computedStyles = {};
3821
+ for (const key in styles) {
3822
+ let value = runIfFn(styles[key], theme2);
3823
+ if (value == null)
3824
+ continue;
3825
+ value = isObject(value) && isResponsive(value) ? toArrayValue(value) : value;
3826
+ if (!Array.isArray(value)) {
3827
+ computedStyles[key] = value;
3828
+ continue;
3829
+ }
3830
+ const queries = value.slice(0, medias.length).length;
3831
+ for (let index = 0; index < queries; index += 1) {
3832
+ const media = medias == null ? void 0 : medias[index];
3833
+ if (!media) {
3834
+ computedStyles[key] = value[index];
3835
+ continue;
3757
3836
  }
3758
- ),
3759
- /* @__PURE__ */ React19.createElement(
3760
- FontToggleButton,
3761
- {
3762
- value: "sans-serif",
3763
- label: "Sans-Serif",
3764
- fontFamily: "body",
3765
- fontWeight: "regular"
3837
+ computedStyles[media] = computedStyles[media] || {};
3838
+ if (value[index] == null) {
3839
+ continue;
3766
3840
  }
3767
- ),
3768
- /* @__PURE__ */ React19.createElement(
3769
- FontToggleButton,
3770
- {
3771
- value: "open-dyslexic",
3772
- label: "Dyslexia",
3773
- fontFamily: "opendyslexic",
3774
- fontWeight: "regular"
3841
+ computedStyles[media][key] = value[index];
3842
+ }
3843
+ }
3844
+ return computedStyles;
3845
+ };
3846
+ function splitByComma(value) {
3847
+ const chunks = [];
3848
+ let chunk2 = "";
3849
+ let inParens = false;
3850
+ for (let i = 0; i < value.length; i++) {
3851
+ const char = value[i];
3852
+ if (char === "(") {
3853
+ inParens = true;
3854
+ chunk2 += char;
3855
+ } else if (char === ")") {
3856
+ inParens = false;
3857
+ chunk2 += char;
3858
+ } else if (char === "," && !inParens) {
3859
+ chunks.push(chunk2);
3860
+ chunk2 = "";
3861
+ } else {
3862
+ chunk2 += char;
3863
+ }
3864
+ }
3865
+ chunk2 = chunk2.trim();
3866
+ if (chunk2) {
3867
+ chunks.push(chunk2);
3868
+ }
3869
+ return chunks;
3870
+ }
3871
+ function isCssVar2(value) {
3872
+ return /^var\(--.+\)$/.test(value);
3873
+ }
3874
+ var isCSSVariableTokenValue = (key, value) => key.startsWith("--") && typeof value === "string" && !isCssVar2(value);
3875
+ var resolveTokenValue = (theme2, value) => {
3876
+ var _a2, _b;
3877
+ if (value == null)
3878
+ return value;
3879
+ const getVar = (val) => {
3880
+ var _a22, _b2;
3881
+ return (_b2 = (_a22 = theme2.__cssMap) == null ? void 0 : _a22[val]) == null ? void 0 : _b2.varRef;
3882
+ };
3883
+ const getValue = (val) => {
3884
+ var _a22;
3885
+ return (_a22 = getVar(val)) != null ? _a22 : val;
3886
+ };
3887
+ const [tokenValue, fallbackValue] = splitByComma(value);
3888
+ value = (_b = (_a2 = getVar(tokenValue)) != null ? _a2 : getValue(fallbackValue)) != null ? _b : getValue(value);
3889
+ return value;
3890
+ };
3891
+ function getCss(options) {
3892
+ const { configs = {}, pseudos = {}, theme: theme2 } = options;
3893
+ const css2 = (stylesOrFn, nested = false) => {
3894
+ var _a2, _b, _c;
3895
+ const _styles = runIfFn(stylesOrFn, theme2);
3896
+ const styles = expandResponsive(_styles)(theme2);
3897
+ let computedStyles = {};
3898
+ for (let key in styles) {
3899
+ const valueOrFn = styles[key];
3900
+ let value = runIfFn(valueOrFn, theme2);
3901
+ if (key in pseudos) {
3902
+ key = pseudos[key];
3775
3903
  }
3776
- )
3777
- ), /* @__PURE__ */ React19.createElement(
3778
- Box,
3779
- {
3780
- bgColor: checkedButtonBgColor,
3781
- display: "flex",
3782
- flexDirection: "column",
3783
- px: [3, 3, 7],
3784
- py: [4, 4, 5]
3785
- },
3786
- /* @__PURE__ */ React19.createElement(
3787
- Heading,
3788
- {
3789
- as: "h3",
3790
- color: buttonTextColor,
3791
- pb: [1.5, 1.5, 2.5],
3792
- fontSize: 2,
3793
- fontWeight: "light"
3794
- },
3795
- FONT_DETAILS[fontFamily].heading
3796
- ),
3797
- /* @__PURE__ */ React19.createElement(
3798
- Text2,
3799
- {
3800
- color: buttonTextColor,
3801
- fontFamily: FONT_DETAILS[fontFamily].token,
3802
- fontSize: -1,
3803
- fontWeight: FONT_DETAILS[fontFamily].fontWeight,
3804
- margin: 0
3805
- },
3806
- FONT_DETAILS[fontFamily].body
3807
- )
3808
- ), /* @__PURE__ */ React19.createElement(
3809
- ToggleGroup_default,
3810
- {
3811
- value: colorMode,
3812
- label: "reading theme options",
3813
- onChange: setColorMode
3814
- },
3815
- /* @__PURE__ */ React19.createElement(
3816
- ColorModeToggleButton,
3817
- {
3818
- colorMode: "day",
3819
- icon: Day_default,
3820
- value: "day",
3821
- label: "Day",
3822
- bgColor: "ui.white",
3823
- textColor: "ui.black"
3904
+ if (isCSSVariableTokenValue(key, value)) {
3905
+ value = resolveTokenValue(theme2, value);
3824
3906
  }
3825
- ),
3826
- /* @__PURE__ */ React19.createElement(
3827
- ColorModeToggleButton,
3828
- {
3829
- colorMode: "sepia",
3830
- icon: Sepia_default,
3831
- value: "sepia",
3832
- label: "Sepia",
3833
- bgColor: "ui.sepia",
3834
- textColor: "ui.black"
3907
+ let config = configs[key];
3908
+ if (config === true) {
3909
+ config = { property: key };
3835
3910
  }
3836
- ),
3837
- /* @__PURE__ */ React19.createElement(
3838
- ColorModeToggleButton,
3839
- {
3840
- colorMode: "night",
3841
- icon: Night_default,
3842
- value: "night",
3843
- label: "Night",
3844
- bgColor: "ui.black",
3845
- textColor: "ui.white"
3911
+ if (isObject(value)) {
3912
+ computedStyles[key] = (_a2 = computedStyles[key]) != null ? _a2 : {};
3913
+ computedStyles[key] = (0, import_lodash2.default)(
3914
+ {},
3915
+ computedStyles[key],
3916
+ css2(value, true)
3917
+ );
3918
+ continue;
3846
3919
  }
3847
- )
3848
- ), /* @__PURE__ */ React19.createElement(ButtonGroup2, { display: "flex", spacing: 0 }, /* @__PURE__ */ React19.createElement(
3849
- Button_default,
3850
- {
3851
- flexGrow: 1,
3852
- "aria-label": "Reset settings",
3853
- onClick: resetSettings,
3854
- variant: "settings"
3855
- },
3856
- /* @__PURE__ */ React19.createElement(
3857
- Reset_default,
3858
- {
3859
- w: "45px",
3860
- h: "45px",
3861
- fill: areSettingsDefault(readerState.settings) ? "ui.gray.disabled" : iconFill
3920
+ let rawValue = (_c = (_b = config == null ? void 0 : config.transform) == null ? void 0 : _b.call(config, value, theme2, _styles)) != null ? _c : value;
3921
+ rawValue = (config == null ? void 0 : config.processResult) ? css2(rawValue, true) : rawValue;
3922
+ const configProperty = runIfFn(config == null ? void 0 : config.property, theme2);
3923
+ if (!nested && (config == null ? void 0 : config.static)) {
3924
+ const staticStyles = runIfFn(config.static, theme2);
3925
+ computedStyles = (0, import_lodash2.default)({}, computedStyles, staticStyles);
3862
3926
  }
3863
- )
3864
- ), /* @__PURE__ */ React19.createElement(
3865
- Button_default,
3866
- {
3867
- "aria-label": "Decrease font size",
3868
- flexGrow: 1,
3869
- onClick: decreaseFontSize,
3870
- sx: {
3871
- _active: {
3872
- bgColor: checkedButtonBgColor
3873
- }
3874
- },
3875
- value: "decrease font size",
3876
- variant: "settings"
3877
- },
3878
- /* @__PURE__ */ React19.createElement(ReduceFont_default, { w: "45px", h: "45px", fill: iconFill })
3879
- ), /* @__PURE__ */ React19.createElement(
3880
- Button_default,
3881
- {
3882
- "aria-label": "Increase font size",
3883
- flexGrow: 1,
3884
- onClick: increaseFontSize,
3885
- sx: {
3886
- _active: {
3887
- bgColor: checkedButtonBgColor
3927
+ if (configProperty && Array.isArray(configProperty)) {
3928
+ for (const property of configProperty) {
3929
+ computedStyles[property] = rawValue;
3888
3930
  }
3889
- },
3890
- value: "increase font size",
3891
- variant: "settings"
3892
- },
3893
- /* @__PURE__ */ React19.createElement(EnlargeFont_default, { w: "45px", h: "45px", fill: iconFill })
3894
- )), /* @__PURE__ */ React19.createElement(
3895
- ToggleGroup_default,
3896
- {
3897
- onChange: setScroll,
3898
- value: paginationValue,
3899
- label: "pagination options"
3900
- },
3901
- /* @__PURE__ */ React19.createElement(
3902
- ToggleButton_default,
3903
- {
3904
- value: "paginated",
3905
- borderRadius: "0 0 0 4px",
3906
- label: "Paginated",
3907
- icon: Paginated_default,
3908
- iconFill
3931
+ continue;
3909
3932
  }
3910
- ),
3911
- /* @__PURE__ */ React19.createElement(
3912
- ToggleButton_default,
3913
- {
3914
- value: "scrolling",
3915
- borderRadius: "0 0 4px 0",
3916
- label: "Scrolling",
3917
- icon: Continuous_default,
3918
- iconFill
3933
+ if (configProperty) {
3934
+ if (configProperty === "&" && isObject(rawValue)) {
3935
+ computedStyles = (0, import_lodash2.default)({}, computedStyles, rawValue);
3936
+ } else {
3937
+ computedStyles[configProperty] = rawValue;
3938
+ }
3939
+ continue;
3919
3940
  }
3920
- )
3921
- ));
3922
- }
3923
- var areSettingsDefault = (readerSettings) => {
3924
- if (!readerSettings) {
3925
- return false;
3926
- }
3927
- let setting;
3928
- for (setting in DEFAULT_SETTINGS) {
3929
- if (readerSettings[setting] !== DEFAULT_SETTINGS[setting]) {
3930
- return false;
3941
+ if (isObject(rawValue)) {
3942
+ computedStyles = (0, import_lodash2.default)({}, computedStyles, rawValue);
3943
+ continue;
3944
+ }
3945
+ computedStyles[key] = rawValue;
3931
3946
  }
3932
- }
3933
- return true;
3947
+ return computedStyles;
3948
+ };
3949
+ return css2;
3950
+ }
3951
+ var css = (styles) => (theme2) => {
3952
+ const cssFn = getCss({
3953
+ theme: theme2,
3954
+ pseudos: pseudoSelectors,
3955
+ configs: systemProps
3956
+ });
3957
+ return cssFn(styles);
3934
3958
  };
3935
-
3936
- // src/ui/SettingsButton.tsx
3937
- function SettingsCard(props) {
3938
- var _a2, _b;
3939
- const [isOpen, setIsOpen] = React20.useState(false);
3940
- const open = () => setIsOpen(true);
3941
- const close = () => setIsOpen(false);
3942
- const contentBgColor = useColorModeValue_default("ui.white", "ui.black", "ui.white");
3943
- const iconFill = useColorModeValue_default(
3944
- "ui.gray.icon",
3945
- "ui.white",
3946
- "ui.gray.icon"
3947
- );
3948
- const paginationValue = ((_b = (_a2 = props.state) == null ? void 0 : _a2.settings) == null ? void 0 : _b.isScrolling) ? "scrolling" : "paginated";
3949
- return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
3950
- Popover,
3951
- {
3952
- gutter: 0,
3953
- closeOnBlur: true,
3954
- placement: "bottom-start",
3955
- isOpen,
3956
- onClose: close,
3957
- onOpen: open,
3958
- autoFocus: true,
3959
- preventOverflow: true,
3960
- strategy: "fixed"
3961
- },
3962
- /* @__PURE__ */ React20.createElement(PopoverTrigger, null, /* @__PURE__ */ React20.createElement(
3963
- Button_default,
3964
- {
3965
- "aria-label": "Settings",
3966
- onClick: open,
3967
- onMouseDown: (e) => e.preventDefault(),
3968
- border: "none",
3969
- gap: [0, 0, 2]
3970
- },
3971
- /* @__PURE__ */ React20.createElement(Icon16, { as: ReaderSettings_default, fill: iconFill, w: 6, h: 6 }),
3972
- /* @__PURE__ */ React20.createElement(Text3, { variant: "headerNav" }, "Settings")
3973
- )),
3974
- /* @__PURE__ */ React20.createElement(
3975
- PopoverContent,
3976
- {
3977
- overflow: "hidden",
3978
- bgColor: contentBgColor,
3979
- borderColor: "ui.gray.disabled",
3980
- borderRadius: "0 0 2px 2px",
3981
- filter: "drop-shadow(0 1px 2px #00000040)",
3982
- width: ["90vw", "90vw", "inherit"],
3983
- marginRight: [4, 4, 4, 0],
3984
- maxWidth: "100vw"
3985
- },
3986
- /* @__PURE__ */ React20.createElement(PopoverBody, { p: 0 }, props.type === "PDF" && /* @__PURE__ */ React20.createElement(
3987
- PdfSettings,
3988
- {
3989
- navigator: props.navigator,
3990
- readerState: props.state,
3991
- paginationValue
3992
- }
3993
- ), props.type === "HTML" && /* @__PURE__ */ React20.createElement(
3994
- HtmlSettings,
3995
- {
3996
- navigator: props.navigator,
3997
- iconFill,
3998
- readerState: props.state,
3999
- paginationValue
4000
- }
4001
- ))
4002
- )
4003
- ));
3959
+ function normalize2(value, toArray) {
3960
+ if (Array.isArray(value))
3961
+ return value;
3962
+ if (isObject(value))
3963
+ return toArray(value);
3964
+ if (value != null)
3965
+ return [value];
4004
3966
  }
4005
-
4006
- // src/ui/TableOfContent.tsx
4007
- import React24 from "react";
4008
- import { Portal, Text as Text4, Icon as Icon17, Box as Box2 } from "@chakra-ui/react";
4009
-
4010
- // node_modules/@chakra-ui/system/dist/chunk-UIGT7YZF.mjs
4011
- import { ThemeContext } from "@emotion/react";
4012
- import { useContext } from "react";
4013
- function useTheme3() {
4014
- const theme2 = useContext(
4015
- ThemeContext
4016
- );
4017
- if (!theme2) {
4018
- throw Error(
4019
- "useTheme: `theme` is undefined. Seems you forgot to wrap your app in `<ChakraProvider />` or `<ThemeProvider />`"
4020
- );
3967
+ function getNextIndex(values, i) {
3968
+ for (let j = i + 1; j < values.length; j++) {
3969
+ if (values[j] != null)
3970
+ return j;
4021
3971
  }
4022
- return theme2;
3972
+ return -1;
4023
3973
  }
4024
-
4025
- // node_modules/@chakra-ui/color-mode/dist/chunk-UQDW7KKV.mjs
4026
- import { createContext, useContext as useContext2 } from "react";
4027
- var ColorModeContext = createContext({});
4028
- ColorModeContext.displayName = "ColorModeContext";
4029
- function useColorMode() {
4030
- const context = useContext2(ColorModeContext);
4031
- if (context === void 0) {
4032
- throw new Error("useColorMode must be used within a ColorModeProvider");
4033
- }
4034
- return context;
3974
+ function createResolver(theme2) {
3975
+ const breakpointUtil = theme2.__breakpoints;
3976
+ return function resolver(config, prop, value, props) {
3977
+ var _a2, _b;
3978
+ if (!breakpointUtil)
3979
+ return;
3980
+ const result = {};
3981
+ const normalized = normalize2(value, breakpointUtil.toArrayValue);
3982
+ if (!normalized)
3983
+ return result;
3984
+ const len = normalized.length;
3985
+ const isSingle = len === 1;
3986
+ const isMultipart = !!config.parts;
3987
+ for (let i = 0; i < len; i++) {
3988
+ const key = breakpointUtil.details[i];
3989
+ const nextKey = breakpointUtil.details[getNextIndex(normalized, i)];
3990
+ const query = toMediaQueryString(key.minW, nextKey == null ? void 0 : nextKey._minW);
3991
+ const styles = runIfFn((_a2 = config[prop]) == null ? void 0 : _a2[normalized[i]], props);
3992
+ if (!styles)
3993
+ continue;
3994
+ if (isMultipart) {
3995
+ (_b = config.parts) == null ? void 0 : _b.forEach((part) => {
3996
+ (0, import_lodash4.default)(result, {
3997
+ [part]: isSingle ? styles[part] : { [query]: styles[part] }
3998
+ });
3999
+ });
4000
+ continue;
4001
+ }
4002
+ if (!isMultipart) {
4003
+ if (isSingle)
4004
+ (0, import_lodash4.default)(result, styles);
4005
+ else
4006
+ result[query] = styles;
4007
+ continue;
4008
+ }
4009
+ result[query] = styles;
4010
+ }
4011
+ return result;
4012
+ };
4035
4013
  }
4036
-
4037
- // node_modules/@chakra-ui/system/dist/chunk-7FWEOSAE.mjs
4038
- function useChakra() {
4039
- const colorModeResult = useColorMode();
4040
- const theme2 = useTheme3();
4041
- return __spreadProps(__spreadValues({}, colorModeResult), { theme: theme2 });
4014
+ function resolveStyleConfig(config) {
4015
+ return (props) => {
4016
+ var _a2;
4017
+ const { variant, size: size2, theme: theme2 } = props;
4018
+ const recipe = createResolver(theme2);
4019
+ return (0, import_lodash4.default)(
4020
+ {},
4021
+ runIfFn((_a2 = config.baseStyle) != null ? _a2 : {}, props),
4022
+ recipe(config, "sizes", size2, props),
4023
+ recipe(config, "variants", variant, props)
4024
+ );
4025
+ };
4026
+ }
4027
+ function omitThemingProps(props) {
4028
+ return omit(props, ["styleConfig", "size", "variant", "colorScheme"]);
4042
4029
  }
4043
4030
 
4044
4031
  // node_modules/@chakra-ui/utils/dist/chunk-O3SWHQEE.mjs
@@ -4184,7 +4171,7 @@ function once(fn) {
4184
4171
  return result;
4185
4172
  };
4186
4173
  }
4187
- var warn2 = /* @__PURE__ */ once((options) => () => {
4174
+ var warn = /* @__PURE__ */ once((options) => () => {
4188
4175
  const { condition, message } = options;
4189
4176
  if (condition && __DEV__) {
4190
4177
  console.warn(message);
@@ -4287,7 +4274,7 @@ function focus(element, options = {}) {
4287
4274
  return -1;
4288
4275
  function triggerFocus() {
4289
4276
  if (!element) {
4290
- warn2({
4277
+ warn({
4291
4278
  condition: true,
4292
4279
  message: "[chakra-ui]: can't call focus() on `null` or `undefined` element"
4293
4280
  });
@@ -6738,7 +6725,7 @@ var getResourceUrl = (index, readingOrder) => {
6738
6725
  }
6739
6726
  return readingOrder[index].href;
6740
6727
  };
6741
- var loadResource = (resourceUrl, proxyUrl) => __async(void 0, null, function* () {
6728
+ var fetchAsUint8Array = (resourceUrl, proxyUrl) => __async(void 0, null, function* () {
6742
6729
  const url = proxyUrl ? `${proxyUrl}${encodeURIComponent(resourceUrl)}` : resourceUrl;
6743
6730
  const response = yield fetch(url, { mode: "cors" });
6744
6731
  const array = new Uint8Array(yield response.arrayBuffer());
@@ -6892,6 +6879,12 @@ function makePdfReducer(args) {
6892
6879
  // end of the PDF that was just parsed
6893
6880
  pageNumber: state2.pageNumber === -1 ? action.numPages : state2.pageNumber
6894
6881
  });
6882
+ case "PDF_LOAD_ERROR":
6883
+ return __spreadProps(__spreadValues({}, state2), {
6884
+ state: "ERROR",
6885
+ error: action.error,
6886
+ settings: DEFAULT_SETTINGS
6887
+ });
6895
6888
  case "SET_SCROLL":
6896
6889
  if (state2.state !== "ACTIVE") {
6897
6890
  return handleInvalidTransition(state2, action);
@@ -6947,7 +6940,7 @@ function usePdfReader(args) {
6947
6940
  webpubManifestUrl,
6948
6941
  manifest,
6949
6942
  proxyUrl,
6950
- getContent,
6943
+ getContent = fetchAsUint8Array,
6951
6944
  injectablesReflowable,
6952
6945
  injectablesFixed,
6953
6946
  height = DEFAULT_HEIGHT,
@@ -7003,17 +6996,22 @@ function usePdfReader(args) {
7003
6996
  if (!manifest.readingOrder || !manifest.readingOrder.length) {
7004
6997
  throw new Error("Manifest has no Reading Order");
7005
6998
  }
7006
- const resourceUrl = getResourceUrl(
6999
+ const currentResource = getResourceUrl(
7007
7000
  state2.resourceIndex,
7008
7001
  manifest.readingOrder
7009
7002
  );
7010
- loadResource(resourceUrl, proxyUrl).then((data) => {
7011
- dispatch({
7012
- type: "RESOURCE_FETCH_SUCCESS",
7013
- resource: { data }
7003
+ const fetchResource = () => __async(this, null, function* () {
7004
+ getContent(currentResource, proxyUrl).then((data) => {
7005
+ dispatch({
7006
+ type: "RESOURCE_FETCH_SUCCESS",
7007
+ resource: { data }
7008
+ });
7014
7009
  });
7015
7010
  });
7016
- }, [state2.resourceIndex, manifest, proxyUrl]);
7011
+ if (manifest.readingOrder && manifest.readingOrder.length) {
7012
+ fetchResource();
7013
+ }
7014
+ }, [state2.resourceIndex, manifest, proxyUrl, getContent]);
7017
7015
  const resizePage = React34.useCallback(
7018
7016
  (pdfWidth, pdfHeight, containerSize2) => {
7019
7017
  const wRatio = pdfWidth / containerSize2.width;
@@ -7102,12 +7100,20 @@ function usePdfReader(args) {
7102
7100
  state: null
7103
7101
  };
7104
7102
  }
7103
+ if (state2.state === "ERROR")
7104
+ throw state2.error;
7105
7105
  const onDocumentLoadSuccess = ({ numPages }) => {
7106
7106
  dispatch({
7107
7107
  type: "PDF_PARSED",
7108
7108
  numPages
7109
7109
  });
7110
7110
  };
7111
+ const onDocumentLoadError = (error2) => {
7112
+ dispatch({
7113
+ type: "PDF_LOAD_ERROR",
7114
+ error: error2
7115
+ });
7116
+ };
7111
7117
  function onRenderSuccess(page) {
7112
7118
  if (!page.height || !page.width)
7113
7119
  throw new Error(
@@ -7147,28 +7153,36 @@ function usePdfReader(args) {
7147
7153
  overflow-y: auto;
7148
7154
  }
7149
7155
  `),
7150
- /* @__PURE__ */ React34.createElement(Document, { file: state2.resource, onLoadSuccess: onDocumentLoadSuccess }, isParsed && state2.numPages && /* @__PURE__ */ React34.createElement(React34.Fragment, null, state2.settings.isScrolling && Array.from(new Array(state2.numPages), (_, index) => /* @__PURE__ */ React34.createElement(
7151
- ScrollPage_default,
7152
- {
7153
- key: `page_${index + 1}`,
7154
- width: containerSize.width,
7155
- placeholderHeight: state2.pdfHeight,
7156
- placeholderWidth: state2.pdfWidth,
7157
- scale: state2.scale,
7158
- pageNumber: index + 1,
7159
- onLoadSuccess: onRenderSuccess
7160
- }
7161
- )), !state2.settings.isScrolling && /* @__PURE__ */ React34.createElement(
7162
- ChakraPage_default,
7156
+ /* @__PURE__ */ React34.createElement(
7157
+ Document,
7163
7158
  {
7164
- pageNumber: state2.pageNumber,
7165
- onLoadSuccess: onRenderSuccess,
7166
- width: state2.pageWidth,
7167
- height: state2.pageHeight,
7168
- scale: state2.scale,
7169
- loading: /* @__PURE__ */ React34.createElement(React34.Fragment, null)
7170
- }
7171
- )))
7159
+ file: state2.resource,
7160
+ onLoadSuccess: onDocumentLoadSuccess,
7161
+ onLoadError: onDocumentLoadError
7162
+ },
7163
+ isParsed && state2.numPages && /* @__PURE__ */ React34.createElement(React34.Fragment, null, state2.settings.isScrolling && Array.from(new Array(state2.numPages), (_, index) => /* @__PURE__ */ React34.createElement(
7164
+ ScrollPage_default,
7165
+ {
7166
+ key: `page_${index + 1}`,
7167
+ width: containerSize.width,
7168
+ placeholderHeight: state2.pdfHeight,
7169
+ placeholderWidth: state2.pdfWidth,
7170
+ scale: state2.scale,
7171
+ pageNumber: index + 1,
7172
+ onLoadSuccess: onRenderSuccess
7173
+ }
7174
+ )), !state2.settings.isScrolling && /* @__PURE__ */ React34.createElement(
7175
+ ChakraPage_default,
7176
+ {
7177
+ pageNumber: state2.pageNumber,
7178
+ onLoadSuccess: onRenderSuccess,
7179
+ width: state2.pageWidth,
7180
+ height: state2.pageHeight,
7181
+ scale: state2.scale,
7182
+ loading: /* @__PURE__ */ React34.createElement(React34.Fragment, null)
7183
+ }
7184
+ ))
7185
+ )
7172
7186
  ),
7173
7187
  state: state2,
7174
7188
  manifest,
@@ -8407,11 +8421,13 @@ function useWebReader(args) {
8407
8421
  const readerType = getReaderType(
8408
8422
  manifest ? manifest.metadata.conformsTo : null
8409
8423
  );
8424
+ const getContentHtml = getContent;
8425
+ const getContentPdf = getContent;
8410
8426
  const htmlReader = useHtmlReader(
8411
8427
  readerType === "HTML" && manifest ? {
8412
8428
  webpubManifestUrl,
8413
8429
  manifest,
8414
- getContent,
8430
+ getContent: getContentHtml,
8415
8431
  injectablesReflowable,
8416
8432
  injectablesFixed,
8417
8433
  height,
@@ -8424,6 +8440,7 @@ function useWebReader(args) {
8424
8440
  readerType === "PDF" && manifest ? {
8425
8441
  webpubManifestUrl,
8426
8442
  manifest,
8443
+ getContent: getContentPdf,
8427
8444
  proxyUrl,
8428
8445
  pdfWorkerSrc,
8429
8446
  height,