@blockle/blocks-react 3.1.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/components/display/Divider/divider.css.js +3 -3
  2. package/dist/components/display/Tag/Tag.d.ts +28 -0
  3. package/dist/components/display/Tag/Tag.d.ts.map +1 -0
  4. package/dist/components/display/Tag/Tag.js +46 -0
  5. package/dist/components/feedback/Alert/Alert.d.ts +15 -6
  6. package/dist/components/feedback/Alert/Alert.d.ts.map +1 -1
  7. package/dist/components/feedback/Alert/Alert.js +8 -37
  8. package/dist/components/feedback/Toast/ToastContext.d.ts +6 -0
  9. package/dist/components/feedback/Toast/ToastContext.d.ts.map +1 -1
  10. package/dist/components/feedback/Toast/ToastProvider.d.ts +6 -0
  11. package/dist/components/feedback/Toast/ToastProvider.d.ts.map +1 -1
  12. package/dist/components/feedback/Toast/ToastProvider.js +90 -29
  13. package/dist/components/feedback/Toast/useCountdowns.d.ts +14 -0
  14. package/dist/components/feedback/Toast/useCountdowns.d.ts.map +1 -0
  15. package/dist/components/feedback/Toast/useCountdowns.js +74 -0
  16. package/dist/components/form/Button/Button.d.ts +11 -3
  17. package/dist/components/form/Button/Button.d.ts.map +1 -1
  18. package/dist/components/form/Checkbox/Checkbox.d.ts.map +1 -1
  19. package/dist/components/form/Checkbox/Checkbox.js +7 -25
  20. package/dist/components/form/IconButton/IconButton.d.ts +29 -0
  21. package/dist/components/form/IconButton/IconButton.d.ts.map +1 -0
  22. package/dist/components/form/IconButton/IconButton.js +61 -0
  23. package/dist/components/form/Label/Label.d.ts +1 -1
  24. package/dist/components/form/Label/Label.d.ts.map +1 -1
  25. package/dist/components/form/NumericInput/NumericInput.d.ts +11 -1
  26. package/dist/components/form/NumericInput/NumericInput.d.ts.map +1 -1
  27. package/dist/components/form/NumericInput/NumericInput.js +52 -24
  28. package/dist/components/form/Select/Select.d.ts.map +1 -1
  29. package/dist/components/form/Select/Select.js +2 -23
  30. package/dist/components/form/Select/select.css.js +1 -1
  31. package/dist/components/form/Textarea/Textarea.css.d.ts +2 -0
  32. package/dist/components/form/Textarea/Textarea.css.d.ts.map +1 -1
  33. package/dist/components/form/Textarea/Textarea.css.js +17 -1
  34. package/dist/components/form/Textarea/Textarea.d.ts +11 -0
  35. package/dist/components/form/Textarea/Textarea.d.ts.map +1 -1
  36. package/dist/components/form/Textarea/Textarea.js +8 -2
  37. package/dist/components/layout/Inline/Inline.d.ts +11 -3
  38. package/dist/components/layout/Inline/Inline.d.ts.map +1 -1
  39. package/dist/components/layout/Inline/Inline.js +5 -3
  40. package/dist/components/layout/Stack/Stack.d.ts +12 -8
  41. package/dist/components/layout/Stack/Stack.d.ts.map +1 -1
  42. package/dist/components/layout/Stack/Stack.js +8 -4
  43. package/dist/components/navigation/Link/Link.d.ts +1 -1
  44. package/dist/components/navigation/Link/Link.d.ts.map +1 -1
  45. package/dist/components/navigation/Link/Link.js +2 -2
  46. package/dist/components/navigation/Tabs/Tab.d.ts +21 -0
  47. package/dist/components/navigation/Tabs/Tab.d.ts.map +1 -0
  48. package/dist/components/navigation/Tabs/Tab.js +138 -0
  49. package/dist/components/navigation/Tabs/TabIndicator.d.ts +6 -0
  50. package/dist/components/navigation/Tabs/TabIndicator.d.ts.map +1 -0
  51. package/dist/components/navigation/Tabs/TabIndicator.js +19 -0
  52. package/dist/components/navigation/Tabs/TabList.d.ts +10 -0
  53. package/dist/components/navigation/Tabs/TabList.d.ts.map +1 -0
  54. package/dist/components/navigation/Tabs/TabList.js +101 -0
  55. package/dist/components/navigation/Tabs/TabListContext.d.ts +13 -0
  56. package/dist/components/navigation/Tabs/TabListContext.d.ts.map +1 -0
  57. package/dist/components/navigation/Tabs/TabListContext.js +6 -0
  58. package/dist/components/navigation/Tabs/TabNav.d.ts +15 -0
  59. package/dist/components/navigation/Tabs/TabNav.d.ts.map +1 -0
  60. package/dist/components/navigation/Tabs/TabNav.js +44 -0
  61. package/dist/components/navigation/Tabs/TabPanel.d.ts +14 -0
  62. package/dist/components/navigation/Tabs/TabPanel.d.ts.map +1 -0
  63. package/dist/components/navigation/Tabs/TabPanel.js +31 -0
  64. package/dist/components/navigation/Tabs/Tabs.d.ts +13 -0
  65. package/dist/components/navigation/Tabs/Tabs.d.ts.map +1 -0
  66. package/dist/components/navigation/Tabs/Tabs.js +33 -0
  67. package/dist/components/navigation/Tabs/TabsContext.d.ts +13 -0
  68. package/dist/components/navigation/Tabs/TabsContext.d.ts.map +1 -0
  69. package/dist/components/navigation/Tabs/TabsContext.js +27 -0
  70. package/dist/components/navigation/Tabs/tabs.css.d.ts +7 -0
  71. package/dist/components/navigation/Tabs/tabs.css.d.ts.map +1 -0
  72. package/dist/components/navigation/Tabs/tabs.css.js +122 -0
  73. package/dist/components/overlay/Dialog/Dialog.d.ts +1 -1
  74. package/dist/components/overlay/Dialog/Dialog.d.ts.map +1 -1
  75. package/dist/components/overlay/Dialog/Dialog.js +9 -7
  76. package/dist/components/overlay/Drawer/Drawer.d.ts +1 -1
  77. package/dist/components/overlay/Drawer/Drawer.d.ts.map +1 -1
  78. package/dist/components/overlay/Drawer/Drawer.js +9 -7
  79. package/dist/components/overlay/Menu/Menu.d.ts +52 -0
  80. package/dist/components/overlay/Menu/Menu.d.ts.map +1 -0
  81. package/dist/components/overlay/Menu/Menu.js +273 -0
  82. package/dist/components/overlay/Menu/menu-utils.d.ts +33 -0
  83. package/dist/components/overlay/Menu/menu-utils.d.ts.map +1 -0
  84. package/dist/components/overlay/Menu/menu-utils.js +54 -0
  85. package/dist/components/overlay/Popover/Popover.d.ts +9 -0
  86. package/dist/components/overlay/Popover/Popover.d.ts.map +1 -1
  87. package/dist/components/overlay/Popover/Popover.js +70 -31
  88. package/dist/components/overlay/Popover/popover-utils.d.ts +32 -1
  89. package/dist/components/overlay/Popover/popover-utils.d.ts.map +1 -1
  90. package/dist/components/overlay/Popover/popover-utils.js +77 -22
  91. package/dist/components/overlay/modalOverlayStack.d.ts +8 -0
  92. package/dist/components/overlay/modalOverlayStack.d.ts.map +1 -0
  93. package/dist/components/overlay/modalOverlayStack.js +37 -0
  94. package/dist/components/overlay/useModalOverlay.d.ts +6 -14
  95. package/dist/components/overlay/useModalOverlay.d.ts.map +1 -1
  96. package/dist/components/overlay/useModalOverlay.js +8 -31
  97. package/dist/components/typography/Heading/Heading.d.ts +2 -1
  98. package/dist/components/typography/Heading/Heading.d.ts.map +1 -1
  99. package/dist/components/typography/Heading/Heading.js +9 -1
  100. package/dist/components/typography/Text/Text.d.ts +3 -2
  101. package/dist/components/typography/Text/Text.d.ts.map +1 -1
  102. package/dist/components/typography/Text/Text.js +9 -1
  103. package/dist/components/typography/textOverflow.css.d.ts +3 -0
  104. package/dist/components/typography/textOverflow.css.d.ts.map +1 -0
  105. package/dist/components/typography/textOverflow.css.js +32 -0
  106. package/dist/components/typography/textOverflow.d.ts +9 -0
  107. package/dist/components/typography/textOverflow.d.ts.map +1 -0
  108. package/dist/components/typography/textOverflow.js +10 -0
  109. package/dist/hooks/useModalDialog/useModalDialog.d.ts +5 -0
  110. package/dist/hooks/useModalDialog/useModalDialog.d.ts.map +1 -1
  111. package/dist/hooks/useModalDialog/useModalDialog.js +3 -2
  112. package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.d.ts +5 -0
  113. package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.d.ts.map +1 -1
  114. package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.js +31 -16
  115. package/dist/icons/icons.d.ts +8 -0
  116. package/dist/icons/icons.d.ts.map +1 -0
  117. package/dist/icons/icons.js +39 -0
  118. package/dist/index.d.ts +8 -0
  119. package/dist/index.d.ts.map +1 -1
  120. package/dist/index.js +16 -0
  121. package/dist/testUtils/browser/consumerStyles.css.d.ts +2 -0
  122. package/dist/testUtils/browser/consumerStyles.css.d.ts.map +1 -0
  123. package/dist/testUtils/browser/contrast.d.ts +6 -2
  124. package/dist/testUtils/browser/contrast.d.ts.map +1 -1
  125. package/dist/testUtils/browser/emulateNoAnchorPositioning.d.ts +8 -0
  126. package/dist/testUtils/browser/emulateNoAnchorPositioning.d.ts.map +1 -0
  127. package/dist/testUtils/browser/render.d.ts +6 -2
  128. package/dist/testUtils/browser/render.d.ts.map +1 -1
  129. package/dist/testUtils/browser/screenshot.d.ts +2 -0
  130. package/dist/testUtils/browser/screenshot.d.ts.map +1 -0
  131. package/dist/testUtils/testTheme.css.d.ts.map +1 -1
  132. package/package.json +2 -2
  133. package/dist/components/feedback/Alert/Alert.css.d.ts +0 -2
  134. package/dist/components/feedback/Alert/Alert.css.d.ts.map +0 -1
  135. package/dist/components/feedback/Alert/Alert.css.js +0 -15
@@ -11,9 +11,6 @@ const divider = style({
11
11
  justifyContent: "center",
12
12
  clear: "both",
13
13
  minBlockSize: "1px",
14
- ":empty": {
15
- gap: 0
16
- },
17
14
  ":before": {
18
15
  flex: 1,
19
16
  content: '""',
@@ -27,6 +24,9 @@ const divider = style({
27
24
  backgroundColor: dividerColorVar
28
25
  },
29
26
  selectors: {
27
+ "&:empty:after": {
28
+ display: "none"
29
+ },
30
30
  '&[data-alignment="start"]:before': {
31
31
  maxInlineSize: "3rem"
32
32
  },
@@ -0,0 +1,28 @@
1
+ import { ComponentThemes, HTMLElementProps } from '@blockle/blocks-core';
2
+ import { default as React } from 'react';
3
+ type TagTheme = ComponentThemes['tag'];
4
+ export type TagProps = {
5
+ /**
6
+ * Render the single child element instead of a `span`, with the Tag's
7
+ * classes and attributes merged onto it
8
+ */
9
+ asChild?: boolean;
10
+ children: React.ReactNode;
11
+ /**
12
+ * Content placed after the text, such as an `IconButton` that removes the
13
+ * Tag. It is sized to the Tag's line height, so it doesn't make the Tag
14
+ * taller.
15
+ */
16
+ endSlot?: React.ReactNode;
17
+ intent?: TagTheme['variants']['intent'];
18
+ ref?: React.Ref<HTMLSpanElement>;
19
+ size?: TagTheme['variants']['size'];
20
+ /**
21
+ * Content placed before the text, such as an `Icon`, an avatar `img` or an
22
+ * emoji. It is sized to the Tag's line height.
23
+ */
24
+ startSlot?: React.ReactNode;
25
+ } & Omit<HTMLElementProps<HTMLSpanElement>, 'children' | 'ref' | 'size'>;
26
+ export declare const Tag: React.FC<TagProps>;
27
+ export {};
28
+ //# sourceMappingURL=Tag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tag.d.ts","sourceRoot":"","sources":["../../../../src/components/display/Tag/Tag.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,KAAK,QAAQ,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;AAEvC,MAAM,MAAM,QAAQ,GAAG;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IACpC;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,EAAE,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC,CAAC;AAQzE,eAAO,MAAM,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAoClC,CAAC"}
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import { classnames } from "@blockle/blocks-core";
4
+ import { createSlottable } from "@blockle/blocks-react-slot";
5
+ import { useComponentStyles } from "../../../hooks/useComponentStyles/useComponentStyles.js";
6
+ const [Template, Slot] = createSlottable("span");
7
+ function hasContent(node) {
8
+ return node !== void 0 && node !== null && node !== false && node !== "";
9
+ }
10
+ const Tag = ({
11
+ asChild,
12
+ children,
13
+ className,
14
+ endSlot,
15
+ intent,
16
+ size,
17
+ startSlot,
18
+ ...restProps
19
+ }) => {
20
+ const tagClassName = useComponentStyles("tag", {
21
+ root: true,
22
+ variants: { intent, size }
23
+ });
24
+ const startSlotClassName = useComponentStyles(
25
+ "tag",
26
+ { startSlot: true },
27
+ false
28
+ );
29
+ const endSlotClassName = useComponentStyles("tag", { endSlot: true }, false);
30
+ return /* @__PURE__ */ jsxs(
31
+ Template,
32
+ {
33
+ asChild,
34
+ className: classnames(tagClassName, className),
35
+ ...restProps,
36
+ children: [
37
+ hasContent(startSlot) && /* @__PURE__ */ jsx("span", { className: startSlotClassName, children: startSlot }),
38
+ /* @__PURE__ */ jsx(Slot, { children }),
39
+ hasContent(endSlot) && /* @__PURE__ */ jsx("span", { className: endSlotClassName, children: endSlot })
40
+ ]
41
+ }
42
+ );
43
+ };
44
+ export {
45
+ Tag
46
+ };
@@ -2,15 +2,24 @@ import { ComponentThemes, HTMLElementProps } from '@blockle/blocks-core';
2
2
  type AlertTheme = ComponentThemes['alert'];
3
3
  export type AlertProps = {
4
4
  children?: React.ReactNode;
5
+ /**
6
+ * Content placed after the message, such as a `Button`, or an `IconButton`
7
+ * to dismiss the Alert. The message takes the remaining width.
8
+ */
9
+ endSlot?: React.ReactNode;
5
10
  intent?: AlertTheme['variants']['intent'];
6
- onRequestClose?: () => void;
7
11
  /**
8
- * Accessible name of the close button, rendered when `onRequestClose` is set.
9
- * Pass your own wording to translate it.
10
- * @default 'Close'
12
+ * `alert` announces the message as urgent, for a message shown in response
13
+ * to something that just happened. Use `status` for a lasting notice, such
14
+ * as a banner that stays while a record is archived.
15
+ * @default 'alert'
16
+ */
17
+ role?: 'alert' | 'status';
18
+ /**
19
+ * Content placed before the message, such as an icon
11
20
  */
12
- closeLabel?: string;
13
- } & HTMLElementProps<HTMLDivElement>;
21
+ startSlot?: React.ReactNode;
22
+ } & Omit<HTMLElementProps<HTMLDivElement>, 'role'>;
14
23
  export declare const Alert: React.FC<AlertProps>;
15
24
  export {};
16
25
  //# sourceMappingURL=Alert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../../src/components/feedback/Alert/Alert.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAO9B,KAAK,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;AAE3C,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC;AAErC,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA0DtC,CAAC"}
1
+ {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../../src/components/feedback/Alert/Alert.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAK9B,KAAK,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;AAE3C,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC1C;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,GAAG,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;AAEnD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA8BtC,CAAC"}
@@ -2,15 +2,14 @@
2
2
  import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import { classnames } from "@blockle/blocks-core";
4
4
  import { useComponentStyles } from "../../../hooks/useComponentStyles/useComponentStyles.js";
5
- import { Button } from "../../form/Button/Button.js";
6
5
  import { Box } from "../../layout/Box/Box.js";
7
- import { closeButton } from "./Alert.css.js";
8
6
  const Alert = ({
9
7
  intent = "info",
10
8
  children,
11
- onRequestClose,
12
- closeLabel = "Close",
13
9
  className,
10
+ endSlot,
11
+ role = "alert",
12
+ startSlot,
14
13
  ...restProps
15
14
  }) => {
16
15
  const containerClassName = useComponentStyles("alert", {
@@ -20,44 +19,16 @@ const Alert = ({
20
19
  return /* @__PURE__ */ jsxs(
21
20
  Box,
22
21
  {
23
- role: "alert",
22
+ role,
24
23
  className: classnames(containerClassName, className),
25
24
  display: "flex",
26
25
  alignItems: "center",
27
- justifyContent: "space-between",
26
+ gap: 2,
28
27
  ...restProps,
29
28
  children: [
30
- /* @__PURE__ */ jsx("div", { children }),
31
- onRequestClose ? /* @__PURE__ */ jsx(
32
- Button,
33
- {
34
- variant: "ghost",
35
- size: "small",
36
- className: closeButton,
37
- "aria-label": closeLabel,
38
- onClick: () => onRequestClose?.(),
39
- children: /* @__PURE__ */ jsxs(
40
- "svg",
41
- {
42
- role: "presentation",
43
- xmlns: "http://www.w3.org/2000/svg",
44
- width: "24",
45
- height: "24",
46
- viewBox: "0 0 24 24",
47
- fill: "none",
48
- stroke: "currentColor",
49
- strokeWidth: "2",
50
- strokeLinecap: "round",
51
- strokeLinejoin: "round",
52
- children: [
53
- /* @__PURE__ */ jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
54
- /* @__PURE__ */ jsx("path", { d: "M18 6l-12 12" }),
55
- /* @__PURE__ */ jsx("path", { d: "M6 6l12 12" })
56
- ]
57
- }
58
- )
59
- }
60
- ) : null
29
+ startSlot,
30
+ /* @__PURE__ */ jsx(Box, { flexGrow: 1, children }),
31
+ endSlot
61
32
  ]
62
33
  }
63
34
  );
@@ -1,6 +1,12 @@
1
1
  import { AlertProps } from '../Alert/Alert.js';
2
2
  export type Toast = {
3
3
  id: string;
4
+ /**
5
+ * Milliseconds before the toast removes itself. The countdown pauses while
6
+ * any toast is hovered or focused, or the page is hidden. Leave it out to
7
+ * keep the toast until it's closed, and always leave it out when the toast
8
+ * contains an action, such as an "Undo" button.
9
+ */
4
10
  duration?: number;
5
11
  children?: React.ReactNode;
6
12
  intent?: AlertProps['intent'];
@@ -1 +1 @@
1
- {"version":3,"file":"ToastContext.d.ts","sourceRoot":"","sources":["../../../../src/components/feedback/Toast/ToastContext.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC5B,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,YAAY,kDAA+C,CAAC"}
1
+ {"version":3,"file":"ToastContext.d.ts","sourceRoot":"","sources":["../../../../src/components/feedback/Toast/ToastContext.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC5B,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,YAAY,kDAA+C,CAAC"}
@@ -3,6 +3,12 @@ export type { ToastPlacement };
3
3
  type ToastPosition = 'bottom-left' | 'bottom-center' | 'bottom-right' | 'top-left' | 'top-center' | 'top-right';
4
4
  export type ToastProviderProps = {
5
5
  children?: React.ReactNode;
6
+ /**
7
+ * Accessible name of each Toast's close button. Pass your own wording to
8
+ * translate it.
9
+ * @default 'Close'
10
+ */
11
+ closeLabel?: string;
6
12
  /** Where the toasts sit on the screen. Defaults to `bottom` */
7
13
  placement?: ToastPlacement;
8
14
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/feedback/Toast/ToastProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA4BvE,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,KAAK,aAAa,GACd,aAAa,GACb,eAAe,GACf,cAAc,GACd,UAAU,GACV,YAAY,GACZ,WAAW,CAAC;AAWhB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,+DAA+D;IAC/D,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAoGtD,CAAC"}
1
+ {"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/feedback/Toast/ToastProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA+BvE,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,KAAK,aAAa,GACd,aAAa,GACb,eAAe,GACf,cAAc,GACd,UAAU,GACV,YAAY,GACZ,WAAW,CAAC;AAWhB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAqLtD,CAAC"}
@@ -1,12 +1,15 @@
1
1
  "use client";
2
2
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
3
3
  import { classnames } from "@blockle/blocks-core";
4
- import { useState, useRef, useCallback, useMemo } from "react";
4
+ import { useState, useRef, useCallback, useEffect, useMemo } from "react";
5
5
  import { flushSync } from "react-dom";
6
6
  import { useComponentStyles } from "../../../hooks/useComponentStyles/useComponentStyles.js";
7
+ import { CloseIcon } from "../../../icons/icons.js";
8
+ import { IconButton } from "../../form/IconButton/IconButton.js";
7
9
  import { Alert } from "../Alert/Alert.js";
8
10
  import { toast, stack, placement } from "./Toast.css.js";
9
11
  import { ToastContext } from "./ToastContext.js";
12
+ import { useCountdowns } from "./useCountdowns.js";
10
13
  function makeTransition(transition) {
11
14
  if (document.startViewTransition) {
12
15
  const viewTransition = document.startViewTransition(() => {
@@ -30,6 +33,7 @@ const placementByPosition = {
30
33
  };
31
34
  const ToastProvider = ({
32
35
  children,
36
+ closeLabel = "Close",
33
37
  placement: placementProp,
34
38
  position
35
39
  }) => {
@@ -45,37 +49,66 @@ const ToastProvider = ({
45
49
  const [toasts, setToasts] = useState([]);
46
50
  const toastsRef = useRef(toasts);
47
51
  toastsRef.current = toasts;
48
- const removeToast = useCallback((id) => {
52
+ const stackRef = useRef(null);
53
+ const hoveredIdsRef = useRef(/* @__PURE__ */ new Set());
54
+ const focusWithinRef = useRef(false);
55
+ const commitRemoval = useCallback((id) => {
49
56
  makeTransition(() => {
50
57
  setToasts((prev) => prev.filter((toast2) => toast2.id !== id));
51
58
  });
52
59
  }, []);
53
- const addToast = useCallback((toast2) => {
54
- const toasts2 = toastsRef.current;
55
- const match = toasts2.findIndex(({ id }) => id === toast2.id) !== -1;
56
- function updateState(prev) {
57
- const match2 = prev.findIndex(({ id }) => id === toast2.id) !== -1;
58
- if (match2) {
59
- return prev.map((item) => item.id === toast2.id ? toast2 : item);
60
+ const countdowns = useCountdowns(commitRemoval);
61
+ const syncPaused = useCallback(() => {
62
+ countdowns.setPaused(
63
+ hoveredIdsRef.current.size > 0 || focusWithinRef.current || document.visibilityState === "hidden"
64
+ );
65
+ }, [countdowns]);
66
+ const removeToast = useCallback(
67
+ (id) => {
68
+ countdowns.clear(id);
69
+ hoveredIdsRef.current.delete(id);
70
+ syncPaused();
71
+ commitRemoval(id);
72
+ },
73
+ [countdowns, syncPaused, commitRemoval]
74
+ );
75
+ const addToast = useCallback(
76
+ (toast2) => {
77
+ const toasts2 = toastsRef.current;
78
+ const match = toasts2.findIndex(({ id }) => id === toast2.id) !== -1;
79
+ function updateState(prev) {
80
+ const match2 = prev.findIndex(({ id }) => id === toast2.id) !== -1;
81
+ if (match2) {
82
+ return prev.map((item) => item.id === toast2.id ? toast2 : item);
83
+ }
84
+ return [...prev, toast2];
60
85
  }
61
- return [...prev, toast2];
62
- }
63
- if (match) {
64
- setToasts(updateState);
65
- return;
66
- }
67
- makeTransition(() => {
68
- setToasts(updateState);
69
- });
70
- if (toast2.duration) {
71
- const toastId = toast2.id;
72
- setTimeout(() => {
73
- makeTransition(() => {
74
- setToasts((prev) => prev.filter((toast22) => toast22.id !== toastId));
75
- });
76
- }, toast2.duration);
77
- }
78
- }, []);
86
+ syncPaused();
87
+ if (toast2.duration) {
88
+ countdowns.set(toast2.id, toast2.duration);
89
+ } else {
90
+ countdowns.clear(toast2.id);
91
+ }
92
+ if (match) {
93
+ setToasts(updateState);
94
+ return;
95
+ }
96
+ makeTransition(() => {
97
+ setToasts(updateState);
98
+ });
99
+ },
100
+ [countdowns, syncPaused]
101
+ );
102
+ useEffect(() => {
103
+ document.addEventListener("visibilitychange", syncPaused);
104
+ return () => {
105
+ document.removeEventListener("visibilitychange", syncPaused);
106
+ };
107
+ }, [syncPaused]);
108
+ useEffect(() => {
109
+ focusWithinRef.current = stackRef.current?.contains(document.activeElement) ?? false;
110
+ syncPaused();
111
+ }, [toasts, syncPaused]);
79
112
  const contextValue = useMemo(
80
113
  () => ({
81
114
  add: addToast,
@@ -93,6 +126,7 @@ const ToastProvider = ({
93
126
  placement[placement$1],
94
127
  rootClassName
95
128
  ),
129
+ ref: stackRef,
96
130
  children: toasts.map(({ id, children: children2, intent }) => /* @__PURE__ */ jsx(
97
131
  Alert,
98
132
  {
@@ -101,9 +135,36 @@ const ToastProvider = ({
101
135
  style: {
102
136
  viewTransitionName: `toast-${id}`
103
137
  },
104
- onRequestClose: () => {
105
- removeToast(id);
138
+ onPointerEnter: () => {
139
+ hoveredIdsRef.current.add(id);
140
+ syncPaused();
141
+ },
142
+ onPointerLeave: () => {
143
+ hoveredIdsRef.current.delete(id);
144
+ syncPaused();
145
+ },
146
+ onFocus: () => {
147
+ focusWithinRef.current = true;
148
+ syncPaused();
149
+ },
150
+ onBlur: (event) => {
151
+ const stack2 = stackRef.current;
152
+ focusWithinRef.current = !!stack2 && (stack2.contains(event.relatedTarget) || stack2.contains(document.activeElement));
153
+ syncPaused();
106
154
  },
155
+ endSlot: /* @__PURE__ */ jsx(
156
+ IconButton,
157
+ {
158
+ label: closeLabel,
159
+ variant: "ghost",
160
+ size: "small",
161
+ intent: "neutral",
162
+ onClick: () => {
163
+ removeToast(id);
164
+ },
165
+ children: /* @__PURE__ */ jsx(CloseIcon, {})
166
+ }
167
+ ),
107
168
  children: children2
108
169
  },
109
170
  id
@@ -0,0 +1,14 @@
1
+ export type Countdowns = {
2
+ /** Starts a countdown of `duration` for `id`, replacing any it had */
3
+ set: (id: string, duration: number) => void;
4
+ /** Drops the countdown of `id` without calling `onEnd` */
5
+ clear: (id: string) => void;
6
+ /** Pauses or resumes every countdown; a resumed one runs its time left */
7
+ setPaused: (paused: boolean) => void;
8
+ };
9
+ /**
10
+ * Pausable countdowns keyed by id, calling `onEnd` with the id once its
11
+ * time has run. They only count down while mounted, and are stopped on unmount.
12
+ */
13
+ export declare function useCountdowns(onEnd: (id: string) => void): Countdowns;
14
+ //# sourceMappingURL=useCountdowns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCountdowns.d.ts","sourceRoot":"","sources":["../../../../src/components/feedback/Toast/useCountdowns.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,UAAU,GAAG;IACvB,sEAAsE;IACtE,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,0DAA0D;IAC1D,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,0EAA0E;IAC1E,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,GAAG,UAAU,CAsFrE"}
@@ -0,0 +1,74 @@
1
+ "use client";
2
+ import { useRef, useMemo, useEffect } from "react";
3
+ function useCountdowns(onEnd) {
4
+ const onEndRef = useRef(onEnd);
5
+ onEndRef.current = onEnd;
6
+ const countdownsRef = useRef(/* @__PURE__ */ new Map());
7
+ const pausedRef = useRef(false);
8
+ const mountedRef = useRef(false);
9
+ const countdowns = useMemo(() => {
10
+ function run(id, countdown) {
11
+ countdown.startedAt = Date.now();
12
+ countdown.timeout = setTimeout(() => {
13
+ countdownsRef.current.delete(id);
14
+ onEndRef.current(id);
15
+ }, countdown.remaining);
16
+ }
17
+ function stop(countdown) {
18
+ clearTimeout(countdown.timeout);
19
+ if (countdown.startedAt !== void 0) {
20
+ countdown.remaining -= Date.now() - countdown.startedAt;
21
+ countdown.startedAt = void 0;
22
+ }
23
+ }
24
+ function isRunning() {
25
+ return mountedRef.current && !pausedRef.current;
26
+ }
27
+ function clear(id) {
28
+ const countdown = countdownsRef.current.get(id);
29
+ if (countdown) {
30
+ stop(countdown);
31
+ countdownsRef.current.delete(id);
32
+ }
33
+ }
34
+ function sync() {
35
+ for (const [id, countdown] of countdownsRef.current) {
36
+ stop(countdown);
37
+ if (isRunning()) {
38
+ run(id, countdown);
39
+ }
40
+ }
41
+ }
42
+ return {
43
+ set(id, duration) {
44
+ clear(id);
45
+ const countdown = { remaining: duration };
46
+ countdownsRef.current.set(id, countdown);
47
+ if (isRunning()) {
48
+ run(id, countdown);
49
+ }
50
+ },
51
+ clear,
52
+ setPaused(paused) {
53
+ if (paused === pausedRef.current) {
54
+ return;
55
+ }
56
+ pausedRef.current = paused;
57
+ sync();
58
+ },
59
+ sync
60
+ };
61
+ }, []);
62
+ useEffect(() => {
63
+ mountedRef.current = true;
64
+ countdowns.sync();
65
+ return () => {
66
+ mountedRef.current = false;
67
+ countdowns.sync();
68
+ };
69
+ }, [countdowns]);
70
+ return countdowns;
71
+ }
72
+ export {
73
+ useCountdowns
74
+ };
@@ -1,6 +1,16 @@
1
1
  import { Atoms, ComponentThemes, HTMLElementProps, MarginAtoms } from '@blockle/blocks-core';
2
2
  import { default as React } from 'react';
3
3
  type ButtonTheme = ComponentThemes['button'];
4
+ type ButtonIntentProps = {
5
+ /**
6
+ * Use the surrounding text color; only for the ghost and outline variants
7
+ */
8
+ intent: 'inherit';
9
+ variant: Exclude<ButtonTheme['variants']['variant'], 'solid'>;
10
+ } | {
11
+ intent?: Exclude<ButtonTheme['variants']['intent'], 'inherit'>;
12
+ variant?: ButtonTheme['variants']['variant'];
13
+ };
4
14
  export type ButtonProps = {
5
15
  alignSelf?: Atoms['alignSelf'];
6
16
  asChild?: boolean;
@@ -8,14 +18,12 @@ export type ButtonProps = {
8
18
  disabled?: boolean;
9
19
  endSlot?: React.ReactNode;
10
20
  inlineSize?: Atoms['inlineSize'];
11
- intent?: ButtonTheme['variants']['intent'];
12
21
  loading?: boolean;
13
22
  popovertarget?: string;
14
23
  size?: ButtonTheme['variants']['size'];
15
24
  startSlot?: React.ReactNode;
16
25
  type?: 'button' | 'submit' | 'reset';
17
- variant?: ButtonTheme['variants']['variant'];
18
- } & Omit<HTMLElementProps<HTMLButtonElement>, 'size'> & MarginAtoms;
26
+ } & ButtonIntentProps & Omit<HTMLElementProps<HTMLButtonElement>, 'size'> & MarginAtoms;
19
27
  export declare const Button: React.FC<ButtonProps>;
20
28
  export {};
21
29
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/form/Button/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,KAAK,EAEV,KAAK,eAAe,EAGpB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,KAAK,WAAW,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;AAE7C,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,OAAO,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;CAC9C,GAAG,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,GACnD,WAAW,CAAC;AAId,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAsDxC,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/form/Button/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,KAAK,EAEV,KAAK,eAAe,EAGpB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,KAAK,WAAW,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;AAE7C,KAAK,iBAAiB,GAClB;IACE;;OAEG;IACH,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;CAC/D,GACD;IACE,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IAC/D,OAAO,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;CAC9C,CAAC;AAEN,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;CACtC,GAAG,iBAAiB,GACnB,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,GACjD,WAAW,CAAC;AAId,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAsDxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/form/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;AAEvC,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA+C5C,CAAC"}
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/form/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;AAEvC,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAiD5C,CAAC"}
@@ -3,6 +3,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import { classnames } from "@blockle/blocks-core";
4
4
  import { useId } from "react";
5
5
  import { useComponentStyles } from "../../../hooks/useComponentStyles/useComponentStyles.js";
6
+ import { CheckIcon } from "../../../icons/icons.js";
6
7
  import { Label } from "../Label/Label.js";
7
8
  import { input, icon, container } from "./checkbox.css.js";
8
9
  const Checkbox = ({
@@ -35,7 +36,12 @@ const Checkbox = ({
35
36
  ...restProps
36
37
  }
37
38
  ),
38
- /* @__PURE__ */ jsx("div", { className: classnames(icon, iconClassName), "aria-hidden": true, children: /* @__PURE__ */ jsx(DefaultIcon, {}) })
39
+ /* @__PURE__ */ jsx("div", { className: classnames(icon, iconClassName), "aria-hidden": true, children: /* @__PURE__ */ jsx(
40
+ CheckIcon,
41
+ {
42
+ style: { width: "1rem", height: "1rem", display: "block" }
43
+ }
44
+ ) })
39
45
  ]
40
46
  }
41
47
  );
@@ -47,30 +53,6 @@ const Checkbox = ({
47
53
  children && /* @__PURE__ */ jsx(Label, { required, htmlFor: inputId, children })
48
54
  ] });
49
55
  };
50
- const DefaultIcon = () => {
51
- return (
52
- // TOOD - replace with actual icon component renderer
53
- /* @__PURE__ */ jsx(
54
- "svg",
55
- {
56
- viewBox: "0 0 24 24",
57
- fill: "none",
58
- strokeWidth: "1.5",
59
- stroke: "currentColor",
60
- style: { width: "1rem", height: "1rem", display: "block" },
61
- role: "presentation",
62
- children: /* @__PURE__ */ jsx(
63
- "path",
64
- {
65
- strokeLinecap: "round",
66
- strokeLinejoin: "round",
67
- d: "m4.5 12.75 6 6 9-13.5"
68
- }
69
- )
70
- }
71
- )
72
- );
73
- };
74
56
  export {
75
57
  Checkbox
76
58
  };
@@ -0,0 +1,29 @@
1
+ import { ComponentThemes, HTMLElementProps, MarginAtoms } from '@blockle/blocks-core';
2
+ import { default as React } from 'react';
3
+ type IconButtonTheme = ComponentThemes['iconButton'];
4
+ type IconButtonIntentProps = {
5
+ /**
6
+ * Use the surrounding text color; only for the ghost and outline variants
7
+ */
8
+ intent: 'inherit';
9
+ variant: Exclude<IconButtonTheme['variants']['variant'], 'solid'>;
10
+ } | {
11
+ intent?: Exclude<IconButtonTheme['variants']['intent'], 'inherit'>;
12
+ variant?: IconButtonTheme['variants']['variant'];
13
+ };
14
+ export type IconButtonProps = {
15
+ asChild?: boolean;
16
+ children: React.ReactNode;
17
+ disabled?: boolean;
18
+ /**
19
+ * Accessible name of the button, rendered as `aria-label`
20
+ */
21
+ label: string;
22
+ loading?: boolean;
23
+ shape?: IconButtonTheme['variants']['shape'];
24
+ size?: IconButtonTheme['variants']['size'];
25
+ type?: 'button' | 'submit' | 'reset';
26
+ } & IconButtonIntentProps & Omit<HTMLElementProps<HTMLButtonElement>, 'size'> & MarginAtoms;
27
+ export declare const IconButton: React.FC<IconButtonProps>;
28
+ export {};
29
+ //# sourceMappingURL=IconButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/form/IconButton/IconButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EAGpB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,KAAK,eAAe,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;AAErD,KAAK,qBAAqB,GACtB;IACE;;OAEG;IACH,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;CACnE,GACD;IACE,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IACnE,OAAO,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;CAClD,CAAC;AAEN,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;IAC7C,IAAI,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;CACtC,GAAG,qBAAqB,GACvB,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,GACjD,WAAW,CAAC;AAId,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgEhD,CAAC"}