@postenbring/hedwig-react 0.0.61 → 0.0.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/_tsup-dts-rollup.d.mts +2 -2
  2. package/dist/_tsup-dts-rollup.d.ts +2 -2
  3. package/dist/chunk-5UJ3LEKK.mjs +76 -0
  4. package/dist/chunk-5UJ3LEKK.mjs.map +1 -0
  5. package/dist/{chunk-2LKUHKL4.mjs → chunk-Q6REETZD.mjs} +12 -6
  6. package/dist/chunk-Q6REETZD.mjs.map +1 -0
  7. package/dist/chunk-ZDPU3N54.mjs +39 -0
  8. package/dist/chunk-ZDPU3N54.mjs.map +1 -0
  9. package/dist/index-no-css.js +105 -81
  10. package/dist/index-no-css.js.map +1 -1
  11. package/dist/index-no-css.mjs +3 -3
  12. package/dist/index.js +105 -81
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +3 -3
  15. package/dist/show-more/index.js +36 -25
  16. package/dist/show-more/index.js.map +1 -1
  17. package/dist/show-more/index.mjs +2 -2
  18. package/dist/show-more/show-more.d.mts +1 -1
  19. package/dist/show-more/show-more.d.ts +1 -1
  20. package/dist/show-more/show-more.js +25 -20
  21. package/dist/show-more/show-more.js.map +1 -1
  22. package/dist/show-more/show-more.mjs +1 -1
  23. package/dist/step-indicator/index.js +46 -33
  24. package/dist/step-indicator/index.js.map +1 -1
  25. package/dist/step-indicator/index.mjs +1 -1
  26. package/dist/step-indicator/step-indicator.js +46 -33
  27. package/dist/step-indicator/step-indicator.js.map +1 -1
  28. package/dist/step-indicator/step-indicator.mjs +1 -1
  29. package/dist/utilities/auto-animate-height.js +11 -5
  30. package/dist/utilities/auto-animate-height.js.map +1 -1
  31. package/dist/utilities/auto-animate-height.mjs +1 -1
  32. package/dist/utilities/index.js +11 -5
  33. package/dist/utilities/index.js.map +1 -1
  34. package/dist/utilities/index.mjs +1 -1
  35. package/package.json +3 -3
  36. package/dist/chunk-2LKUHKL4.mjs.map +0 -1
  37. package/dist/chunk-NIRIPLQ5.mjs +0 -63
  38. package/dist/chunk-NIRIPLQ5.mjs.map +0 -1
  39. package/dist/chunk-W47NV442.mjs +0 -34
  40. package/dist/chunk-W47NV442.mjs.map +0 -1
@@ -131,7 +131,7 @@ import "./chunk-V3PAFMK5.mjs";
131
131
  import "./chunk-MSFHJVHD.mjs";
132
132
  import {
133
133
  ShowMoreButton
134
- } from "./chunk-W47NV442.mjs";
134
+ } from "./chunk-ZDPU3N54.mjs";
135
135
  import "./chunk-JTZPQHKD.mjs";
136
136
  import {
137
137
  Skeleton
@@ -139,7 +139,7 @@ import {
139
139
  import "./chunk-TJH5QJMS.mjs";
140
140
  import {
141
141
  StepIndicator
142
- } from "./chunk-NIRIPLQ5.mjs";
142
+ } from "./chunk-5UJ3LEKK.mjs";
143
143
  import "./chunk-JKCVB5TR.mjs";
144
144
  import {
145
145
  StyledHtml
@@ -148,7 +148,7 @@ import "./chunk-33JD5XDW.mjs";
148
148
  import "./chunk-DZNH5JHY.mjs";
149
149
  import {
150
150
  AutoAnimateHeight
151
- } from "./chunk-2LKUHKL4.mjs";
151
+ } from "./chunk-Q6REETZD.mjs";
152
152
  import "./chunk-R4SQKVDQ.mjs";
153
153
  export {
154
154
  AccordionComponent as Accordion,
package/dist/index.js CHANGED
@@ -1517,6 +1517,7 @@ var AutoAnimateHeight = (0, import_react24.forwardRef)(
1517
1517
  "animationDuration",
1518
1518
  "animationEasing"
1519
1519
  ]);
1520
+ const timeoutRef = (0, import_react24.useRef)(null);
1520
1521
  const measurementRef = (0, import_react24.useRef)(null);
1521
1522
  const [height, setHeight] = (0, import_react24.useState)(void 0);
1522
1523
  const [clonedChildren, setClonedChildren] = (0, import_react24.useState)(
@@ -1525,13 +1526,18 @@ var AutoAnimateHeight = (0, import_react24.forwardRef)(
1525
1526
  (0, import_react24.useEffect)(() => {
1526
1527
  if (measurementRef.current) {
1527
1528
  const { height: newHeight } = measurementRef.current.getBoundingClientRect();
1529
+ if (timeoutRef.current) {
1530
+ clearTimeout(timeoutRef.current);
1531
+ }
1528
1532
  if (newHeight < (height != null ? height : 0)) {
1529
- (0, import_react_dom.flushSync)(() => {
1530
- setHeight(newHeight);
1531
- });
1532
1533
  setTimeout(() => {
1533
- setClonedChildren((0, import_react24.cloneElement)(/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children }), {}));
1534
- }, animationDurationToValue[animationDuration]);
1534
+ (0, import_react_dom.flushSync)(() => {
1535
+ setHeight(newHeight);
1536
+ });
1537
+ timeoutRef.current = setTimeout(() => {
1538
+ setClonedChildren((0, import_react24.cloneElement)(/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children }), {}));
1539
+ }, animationDurationToValue[animationDuration]);
1540
+ });
1535
1541
  } else {
1536
1542
  setHeight(newHeight);
1537
1543
  setClonedChildren((0, import_react24.cloneElement)(/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children }), {}));
@@ -1573,34 +1579,39 @@ AutoAnimateHeight.displayName = "AutoAnimateHeight";
1573
1579
 
1574
1580
  // src/show-more/show-more.tsx
1575
1581
  var import_typed_classname27 = require("@postenbring/hedwig-css/typed-classname");
1582
+ var import_react25 = require("react");
1576
1583
  var import_jsx_runtime30 = require("react/jsx-runtime");
1577
- function ShowMoreButton(_a) {
1578
- var _b = _a, { text, variant, expanded, className } = _b, rest = __objRest(_b, ["text", "variant", "expanded", "className"]);
1579
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
1580
- "button",
1581
- __spreadProps(__spreadValues({
1582
- className: (0, import_typed_classname27.clsx)(
1583
- "hds-show-more",
1584
- variant === "show-more-show-less" && "hds-show-more--show-less",
1585
- className
1586
- ),
1587
- "data-state": expanded ? "expanded" : void 0,
1588
- type: "button"
1589
- }, rest), {
1590
- children: [
1591
- text,
1592
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: (0, import_typed_classname27.clsx)("hds-show-more__icon") })
1593
- ]
1594
- })
1595
- );
1596
- }
1584
+ var ShowMoreButton = (0, import_react25.forwardRef)(
1585
+ (_a, ref) => {
1586
+ var _b = _a, { text, variant, expanded, className } = _b, rest = __objRest(_b, ["text", "variant", "expanded", "className"]);
1587
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
1588
+ "button",
1589
+ __spreadProps(__spreadValues({
1590
+ ref,
1591
+ className: (0, import_typed_classname27.clsx)(
1592
+ "hds-show-more",
1593
+ variant === "show-more-show-less" && "hds-show-more--show-less",
1594
+ className
1595
+ ),
1596
+ "data-state": expanded ? "expanded" : void 0,
1597
+ type: "button"
1598
+ }, rest), {
1599
+ children: [
1600
+ text,
1601
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: (0, import_typed_classname27.clsx)("hds-show-more__icon") })
1602
+ ]
1603
+ })
1604
+ );
1605
+ }
1606
+ );
1607
+ ShowMoreButton.displayName = "ShowMoreButton";
1597
1608
 
1598
1609
  // src/skeleton/skeleton.tsx
1599
1610
  var React11 = require("react");
1600
1611
  var import_typed_classname28 = require("@postenbring/hedwig-css/typed-classname");
1601
- var import_react25 = require("react");
1612
+ var import_react26 = require("react");
1602
1613
  var import_jsx_runtime31 = require("react/jsx-runtime");
1603
- var Skeleton = (0, import_react25.forwardRef)(
1614
+ var Skeleton = (0, import_react26.forwardRef)(
1604
1615
  (_a, ref) => {
1605
1616
  var _b = _a, { as: Component = "div", children, variant = "text", width, height, className, style } = _b, rest = __objRest(_b, ["as", "children", "variant", "width", "height", "className", "style"]);
1606
1617
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
@@ -1620,41 +1631,54 @@ Skeleton.displayName = "Skeleton";
1620
1631
 
1621
1632
  // src/step-indicator/step-indicator.tsx
1622
1633
  var import_typed_classname29 = require("@postenbring/hedwig-css/typed-classname");
1634
+ var import_react27 = require("react");
1623
1635
  var import_jsx_runtime32 = require("react/jsx-runtime");
1624
- function StepIndicator(_a) {
1625
- var _b = _a, {
1626
- activeStep,
1627
- totalSteps,
1628
- className,
1629
- label,
1630
- lang = "en",
1631
- title,
1632
- titleAs: TitleComponent
1633
- } = _b, rest = __objRest(_b, [
1634
- "activeStep",
1635
- "totalSteps",
1636
- "className",
1637
- "label",
1638
- "lang",
1639
- "title",
1640
- "titleAs"
1641
- ]);
1642
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", __spreadProps(__spreadValues({ className: (0, import_typed_classname29.clsx)("hds-step-indicator", className), lang }, rest), { children: [
1643
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: (0, import_typed_classname29.clsx)("hds-step-indicator__header"), children: [
1644
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: (0, import_typed_classname29.clsx)("hds-step-indicator__left-label"), children: label }),
1645
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: stepLabelTranslations[lang](activeStep, totalSteps) })
1646
- ] }),
1647
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: (0, import_typed_classname29.clsx)("hds-step-indicator__steps"), children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1636
+ var StepIndicator = (0, import_react27.forwardRef)(
1637
+ (_a, ref) => {
1638
+ var _b = _a, {
1639
+ activeStep,
1640
+ totalSteps,
1641
+ className,
1642
+ label,
1643
+ lang = "en",
1644
+ title,
1645
+ titleAs: TitleComponent
1646
+ } = _b, rest = __objRest(_b, [
1647
+ "activeStep",
1648
+ "totalSteps",
1649
+ "className",
1650
+ "label",
1651
+ "lang",
1652
+ "title",
1653
+ "titleAs"
1654
+ ]);
1655
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
1648
1656
  "div",
1649
- {
1650
- className: (0, import_typed_classname29.clsx)("hds-step-indicator__step"),
1651
- "data-state": getStepState(i + 1, activeStep)
1652
- },
1653
- i
1654
- )) }),
1655
- title ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TitleComponent, { className: (0, import_typed_classname29.clsx)("hds-step-indicator__title"), children: title }) : null
1656
- ] }));
1657
- }
1657
+ __spreadProps(__spreadValues({
1658
+ ref,
1659
+ className: (0, import_typed_classname29.clsx)("hds-step-indicator", className),
1660
+ lang
1661
+ }, rest), {
1662
+ children: [
1663
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: (0, import_typed_classname29.clsx)("hds-step-indicator__header"), children: [
1664
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: (0, import_typed_classname29.clsx)("hds-step-indicator__left-label"), children: label }),
1665
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: stepLabelTranslations[lang](activeStep, totalSteps) })
1666
+ ] }),
1667
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: (0, import_typed_classname29.clsx)("hds-step-indicator__steps"), children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1668
+ "div",
1669
+ {
1670
+ className: (0, import_typed_classname29.clsx)("hds-step-indicator__step"),
1671
+ "data-state": getStepState(i + 1, activeStep)
1672
+ },
1673
+ i
1674
+ )) }),
1675
+ title ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TitleComponent, { className: (0, import_typed_classname29.clsx)("hds-step-indicator__title"), children: title }) : null
1676
+ ]
1677
+ })
1678
+ );
1679
+ }
1680
+ );
1681
+ StepIndicator.displayName = "StepIndicator";
1658
1682
  var stepLabelTranslations = {
1659
1683
  no: (activeStep, totalSteps) => `steg ${activeStep} av ${totalSteps}`,
1660
1684
  en: (activeStep, totalSteps) => `step ${activeStep} of ${totalSteps}`,
@@ -1672,10 +1696,10 @@ function getStepState(renderedStep, activeStep) {
1672
1696
  }
1673
1697
 
1674
1698
  // src/styled-html/styled-html.tsx
1675
- var import_react26 = require("react");
1699
+ var import_react28 = require("react");
1676
1700
  var import_typed_classname30 = require("@postenbring/hedwig-css/typed-classname");
1677
1701
  var import_jsx_runtime33 = require("react/jsx-runtime");
1678
- var StyledHtml = (0, import_react26.forwardRef)(
1702
+ var StyledHtml = (0, import_react28.forwardRef)(
1679
1703
  (_a, ref) => {
1680
1704
  var _b = _a, { as: Component = "div", children, size, darkmode = false, className } = _b, rest = __objRest(_b, ["as", "children", "size", "darkmode", "className"]);
1681
1705
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
@@ -1697,12 +1721,12 @@ var StyledHtml = (0, import_react26.forwardRef)(
1697
1721
  StyledHtml.displayName = "StyledHtml";
1698
1722
 
1699
1723
  // src/tabs/tabs.tsx
1700
- var import_react28 = require("react");
1724
+ var import_react30 = require("react");
1701
1725
  var import_typed_classname31 = require("@postenbring/hedwig-css/typed-classname");
1702
1726
 
1703
1727
  // src/tabs/context.ts
1704
- var import_react27 = require("react");
1705
- var TabsContext = (0, import_react27.createContext)({
1728
+ var import_react29 = require("react");
1729
+ var TabsContext = (0, import_react29.createContext)({
1706
1730
  mounted: false,
1707
1731
  activeTabId: void 0,
1708
1732
  // eslint-disable-next-line @typescript-eslint/no-unused-vars -- Added default section, without handling
@@ -1712,10 +1736,10 @@ var TabsContext = (0, import_react27.createContext)({
1712
1736
 
1713
1737
  // src/tabs/tabs.tsx
1714
1738
  var import_jsx_runtime34 = require("react/jsx-runtime");
1715
- var Tabs = (0, import_react28.forwardRef)(
1739
+ var Tabs = (0, import_react30.forwardRef)(
1716
1740
  (_a, ref) => {
1717
1741
  var _b = _a, { as: Component = "div", defaultTab, children } = _b, rest = __objRest(_b, ["as", "defaultTab", "children"]);
1718
- const [activeTabId, setActiveTabId] = (0, import_react28.useState)(defaultTab);
1742
+ const [activeTabId, setActiveTabId] = (0, import_react30.useState)(defaultTab);
1719
1743
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Component, __spreadProps(__spreadValues({ className: (0, import_typed_classname31.clsx)("hds-tabs"), ref }, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
1720
1744
  TabsContext.Provider,
1721
1745
  {
@@ -1728,12 +1752,12 @@ var Tabs = (0, import_react28.forwardRef)(
1728
1752
  Tabs.displayName = "Tabs";
1729
1753
 
1730
1754
  // src/tabs/tabs-list.tsx
1731
- var import_react29 = require("react");
1755
+ var import_react31 = require("react");
1732
1756
  var import_typed_classname32 = require("@postenbring/hedwig-css/typed-classname");
1733
1757
  var import_jsx_runtime35 = require("react/jsx-runtime");
1734
1758
  function TabsList(_a) {
1735
1759
  var _b = _a, { children, direction = "horizontal", className } = _b, rest = __objRest(_b, ["children", "direction", "className"]);
1736
- const tabsListRef = (0, import_react29.useRef)(null);
1760
+ const tabsListRef = (0, import_react31.useRef)(null);
1737
1761
  const { width: tabsWidth } = useResize(tabsListRef);
1738
1762
  const { innerWidth } = window;
1739
1763
  const wideEnough = innerWidth >= tabsWidth;
@@ -1758,10 +1782,10 @@ function TabsList(_a) {
1758
1782
  );
1759
1783
  }
1760
1784
  TabsList.displayName = "Tabs.List";
1761
- var Tab = (0, import_react29.forwardRef)(
1785
+ var Tab = (0, import_react31.forwardRef)(
1762
1786
  (_a, ref) => {
1763
1787
  var _b = _a, { as: Component = "button", children, tabId, className, onClick } = _b, rest = __objRest(_b, ["as", "children", "tabId", "className", "onClick"]);
1764
- const context = (0, import_react29.useContext)(TabsContext);
1788
+ const context = (0, import_react31.useContext)(TabsContext);
1765
1789
  if (!context.mounted) {
1766
1790
  throw new Error("Context required. Did you use <TabContent/> outside of <Tabs/>?");
1767
1791
  }
@@ -1791,7 +1815,7 @@ var Tab = (0, import_react29.forwardRef)(
1791
1815
  Tab.displayName = "Tabs.Tab";
1792
1816
 
1793
1817
  // src/tabs/tabs-content.tsx
1794
- var import_react30 = require("react");
1818
+ var import_react32 = require("react");
1795
1819
  var import_typed_classname33 = require("@postenbring/hedwig-css/typed-classname");
1796
1820
  var import_jsx_runtime36 = require("react/jsx-runtime");
1797
1821
  function TabsContents(_a) {
@@ -1799,10 +1823,10 @@ function TabsContents(_a) {
1799
1823
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", __spreadProps(__spreadValues({ className: (0, import_typed_classname33.clsx)("hds-tabs--contents") }, rest), { children }));
1800
1824
  }
1801
1825
  TabsContents.displayName = "Tabs.Contents";
1802
- var TabsContent = (0, import_react30.forwardRef)(
1826
+ var TabsContent = (0, import_react32.forwardRef)(
1803
1827
  (_a, ref) => {
1804
1828
  var _b = _a, { as: Component = "div", forTabId, children } = _b, rest = __objRest(_b, ["as", "forTabId", "children"]);
1805
- const context = (0, import_react30.useContext)(TabsContext);
1829
+ const context = (0, import_react32.useContext)(TabsContext);
1806
1830
  if (!context.mounted) {
1807
1831
  throw new Error("Context required. Did you use <Tabs.Content /> outside of <Tabs/>?");
1808
1832
  }
@@ -1822,7 +1846,7 @@ TabsComponent.Contents = TabsContents;
1822
1846
  TabsComponent.Content = TabsContent;
1823
1847
 
1824
1848
  // src/text/text.tsx
1825
- var import_react31 = require("react");
1849
+ var import_react33 = require("react");
1826
1850
  var import_typed_classname34 = require("@postenbring/hedwig-css/typed-classname");
1827
1851
  var import_jsx_runtime37 = require("react/jsx-runtime");
1828
1852
  var defaultHTMLTag = {
@@ -1840,7 +1864,7 @@ var defaultHTMLTag = {
1840
1864
  caption: "p",
1841
1865
  "caption-title": "p"
1842
1866
  };
1843
- var Text = (0, import_react31.forwardRef)(
1867
+ var Text = (0, import_react33.forwardRef)(
1844
1868
  (_a, ref) => {
1845
1869
  var _b = _a, {
1846
1870
  as,
@@ -1916,10 +1940,10 @@ function textVariant(variant, displayName) {
1916
1940
  }
1917
1941
 
1918
1942
  // src/warning-banner/warning-banner.tsx
1919
- var import_react32 = require("react");
1943
+ var import_react34 = require("react");
1920
1944
  var import_typed_classname35 = require("@postenbring/hedwig-css/typed-classname");
1921
1945
  var import_jsx_runtime39 = require("react/jsx-runtime");
1922
- var WarningBanner = (0, import_react32.forwardRef)(
1946
+ var WarningBanner = (0, import_react34.forwardRef)(
1923
1947
  (_a, ref) => {
1924
1948
  var _b = _a, { title, description, className } = _b, rest = __objRest(_b, ["title", "description", "className"]);
1925
1949
  const expandable = !!description;
@@ -1930,7 +1954,7 @@ var WarningBanner = (0, import_react32.forwardRef)(
1930
1954
  }
1931
1955
  );
1932
1956
  WarningBanner.displayName = "WarningBanner";
1933
- var WarningBannerTitle = (0, import_react32.forwardRef)(
1957
+ var WarningBannerTitle = (0, import_react34.forwardRef)(
1934
1958
  (_a, ref) => {
1935
1959
  var _b = _a, {
1936
1960
  variant,
@@ -1943,7 +1967,7 @@ var WarningBannerTitle = (0, import_react32.forwardRef)(
1943
1967
  "children",
1944
1968
  "className"
1945
1969
  ]);
1946
- const [open, setOpen] = (0, import_react32.useState)(false);
1970
+ const [open, setOpen] = (0, import_react34.useState)(false);
1947
1971
  if (variant === "expandable") {
1948
1972
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
1949
1973
  Component,
@@ -1976,7 +2000,7 @@ var WarningBannerTitle = (0, import_react32.forwardRef)(
1976
2000
  }
1977
2001
  );
1978
2002
  WarningBannerTitle.displayName = "WarningBannerTitle";
1979
- var WarningBannerDescription = (0, import_react32.forwardRef)(
2003
+ var WarningBannerDescription = (0, import_react34.forwardRef)(
1980
2004
  (_a, ref) => {
1981
2005
  var _b = _a, { as: Component = "p", className } = _b, rest = __objRest(_b, ["as", "className"]);
1982
2006
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(