@blockle/blocks 0.12.0 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +9 -18
- package/dist/index.mjs +11 -20
- package/dist/momotaro.chunk.d.ts +267 -268
- package/dist/styles/components/display/Divider/Divider.cjs +1 -1
- package/dist/styles/components/display/Divider/Divider.mjs +1 -1
- package/dist/styles/components/overlay/Dialog/Dialog.cjs +30 -61
- package/dist/styles/components/overlay/Dialog/Dialog.mjs +33 -64
- package/dist/styles/components/overlay/Dialog/dialog.css.cjs +10 -12
- package/dist/styles/components/overlay/Dialog/dialog.css.mjs +10 -12
- package/dist/styles/themes/momotaro/components/dialog.css.cjs +13 -16
- package/dist/styles/themes/momotaro/components/dialog.css.mjs +13 -16
- package/dist/styles/themes/momotaro/components/divider.css.cjs +4 -0
- package/dist/styles/themes/momotaro/components/divider.css.mjs +4 -0
- package/dist/styles/themes/momotaro/components/progress.css.cjs +6 -6
- package/dist/styles/themes/momotaro/components/progress.css.mjs +6 -6
- package/package.json +38 -38
package/dist/index.cjs
CHANGED
|
@@ -136,22 +136,6 @@ const Link = react.forwardRef(function Link2({ asChild, className, children, var
|
|
|
136
136
|
}
|
|
137
137
|
);
|
|
138
138
|
});
|
|
139
|
-
const useClickOutside = (ref, onClickOutside, { enabled = true } = {}) => {
|
|
140
|
-
react.useEffect(() => {
|
|
141
|
-
if (!enabled) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
const listener = (event) => {
|
|
145
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
146
|
-
onClickOutside();
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
document.addEventListener("click", listener);
|
|
150
|
-
return () => {
|
|
151
|
-
document.removeEventListener("click", listener);
|
|
152
|
-
};
|
|
153
|
-
}, [ref, onClickOutside, enabled]);
|
|
154
|
-
};
|
|
155
139
|
function getDopoverPosition(align, anchorRef, popoverRef) {
|
|
156
140
|
if (!anchorRef.current || !popoverRef.current) {
|
|
157
141
|
return [0, 0];
|
|
@@ -264,7 +248,7 @@ const Popover = ({
|
|
|
264
248
|
}
|
|
265
249
|
}, [hide, open]);
|
|
266
250
|
styles_components_overlay_Dialog_Dialog_cjs.useKeyboard("Escape", onRequestClose, { enabled: visible });
|
|
267
|
-
useClickOutside(popoverRef, onRequestClose, { enabled: visible });
|
|
251
|
+
styles_components_overlay_Dialog_Dialog_cjs.useClickOutside(popoverRef, onRequestClose, { enabled: visible });
|
|
268
252
|
if (!visible) {
|
|
269
253
|
return null;
|
|
270
254
|
}
|
|
@@ -352,6 +336,13 @@ const Tooltip = ({
|
|
|
352
336
|
)
|
|
353
337
|
] });
|
|
354
338
|
};
|
|
339
|
+
const useRootAriaHidden = (hidden) => {
|
|
340
|
+
const context = react.useContext(styles_components_display_Divider_Divider_cjs.BlocksProviderContext);
|
|
341
|
+
if (!context) {
|
|
342
|
+
throw new Error("useRootAriaHidden must be used within a BlocksProvider");
|
|
343
|
+
}
|
|
344
|
+
context.setAriaHidden(hidden);
|
|
345
|
+
};
|
|
355
346
|
exports.breakpointQuery = styles_lib_css_atoms_breakpoints_cjs.breakpointQuery;
|
|
356
347
|
exports.style = styles_lib_css_style_style_cjs.style;
|
|
357
348
|
exports.makeComponentTheme = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme;
|
|
@@ -380,7 +371,6 @@ exports.Portal = styles_components_overlay_Dialog_Dialog_cjs.Portal;
|
|
|
380
371
|
exports.useIsomorphicLayoutEffect = styles_components_overlay_Dialog_Dialog_cjs.useIsomorphicLayoutEffect;
|
|
381
372
|
exports.useKeyboard = styles_components_overlay_Dialog_Dialog_cjs.useKeyboard;
|
|
382
373
|
exports.usePreventBodyScroll = styles_components_overlay_Dialog_Dialog_cjs.usePreventBodyScroll;
|
|
383
|
-
exports.useRootAriaHidden = styles_components_overlay_Dialog_Dialog_cjs.useRootAriaHidden;
|
|
384
374
|
exports.Heading = styles_components_typography_Heading_Heading_cjs.Heading;
|
|
385
375
|
exports.Text = styles_components_typography_Text_Text_cjs.Text;
|
|
386
376
|
exports.Inline = Inline;
|
|
@@ -388,3 +378,4 @@ exports.Link = Link;
|
|
|
388
378
|
exports.Progress = Progress;
|
|
389
379
|
exports.Stack = Stack;
|
|
390
380
|
exports.Tooltip = Tooltip;
|
|
381
|
+
exports.useRootAriaHidden = useRootAriaHidden;
|
package/dist/index.mjs
CHANGED
|
@@ -5,11 +5,11 @@ import { style } from "./styles/lib/css/style/style.mjs";
|
|
|
5
5
|
import { makeComponentTheme } from "./styles/lib/theme/makeComponentTheme.mjs";
|
|
6
6
|
import { makeTheme } from "./styles/lib/theme/makeTheme.mjs";
|
|
7
7
|
import { vars } from "./styles/lib/theme/vars.css.mjs";
|
|
8
|
-
import { useComponentStyles, Box, classnames, createSlottable, composeRefs } from "./styles/components/display/Divider/Divider.mjs";
|
|
8
|
+
import { useComponentStyles, Box, classnames, createSlottable, composeRefs, BlocksProviderContext } from "./styles/components/display/Divider/Divider.mjs";
|
|
9
9
|
import { Divider, Slot, useComponentStyleDefaultProps } from "./styles/components/display/Divider/Divider.mjs";
|
|
10
10
|
import { atoms } from "./styles/lib/css/atoms/sprinkles.css.mjs";
|
|
11
11
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
12
|
-
import { forwardRef,
|
|
12
|
+
import { forwardRef, useState, useRef, useLayoutEffect, useEffect, useCallback, useId, Children, isValidElement, cloneElement, useContext } from "react";
|
|
13
13
|
import { Button, Spinner } from "./styles/components/form/Button/Button.mjs";
|
|
14
14
|
import { Checkbox, Label } from "./styles/components/form/Checkbox/Checkbox.mjs";
|
|
15
15
|
import { Input } from "./styles/components/form/Input/Input.mjs";
|
|
@@ -18,8 +18,8 @@ import { Select } from "./styles/components/form/Select/Select.mjs";
|
|
|
18
18
|
import { Slider } from "./styles/components/form/Slider/Slider.mjs";
|
|
19
19
|
import { Switch } from "./styles/components/form/Switch/Switch.mjs";
|
|
20
20
|
import { BlocksProvider } from "./styles/components/other/BlocksProvider/BlocksProvider.mjs";
|
|
21
|
-
import { useLayer, useVisibilityState, useIsomorphicLayoutEffect, hasAnimationDuration, useKeyboard, Portal } from "./styles/components/overlay/Dialog/Dialog.mjs";
|
|
22
|
-
import { Dialog, usePreventBodyScroll
|
|
21
|
+
import { useLayer, useVisibilityState, useIsomorphicLayoutEffect, hasAnimationDuration, useKeyboard, useClickOutside, Portal } from "./styles/components/overlay/Dialog/Dialog.mjs";
|
|
22
|
+
import { Dialog, usePreventBodyScroll } from "./styles/components/overlay/Dialog/Dialog.mjs";
|
|
23
23
|
import { Heading } from "./styles/components/typography/Heading/Heading.mjs";
|
|
24
24
|
import { Text } from "./styles/components/typography/Text/Text.mjs";
|
|
25
25
|
const Progress = forwardRef(function Progress2({ value, max = 100, className, ...restProps }, ref) {
|
|
@@ -138,22 +138,6 @@ const Link = forwardRef(function Link2({ asChild, className, children, variant,
|
|
|
138
138
|
}
|
|
139
139
|
);
|
|
140
140
|
});
|
|
141
|
-
const useClickOutside = (ref, onClickOutside, { enabled = true } = {}) => {
|
|
142
|
-
useEffect(() => {
|
|
143
|
-
if (!enabled) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
const listener = (event) => {
|
|
147
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
148
|
-
onClickOutside();
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
document.addEventListener("click", listener);
|
|
152
|
-
return () => {
|
|
153
|
-
document.removeEventListener("click", listener);
|
|
154
|
-
};
|
|
155
|
-
}, [ref, onClickOutside, enabled]);
|
|
156
|
-
};
|
|
157
141
|
function getDopoverPosition(align, anchorRef, popoverRef) {
|
|
158
142
|
if (!anchorRef.current || !popoverRef.current) {
|
|
159
143
|
return [0, 0];
|
|
@@ -354,6 +338,13 @@ const Tooltip = ({
|
|
|
354
338
|
)
|
|
355
339
|
] });
|
|
356
340
|
};
|
|
341
|
+
const useRootAriaHidden = (hidden) => {
|
|
342
|
+
const context = useContext(BlocksProviderContext);
|
|
343
|
+
if (!context) {
|
|
344
|
+
throw new Error("useRootAriaHidden must be used within a BlocksProvider");
|
|
345
|
+
}
|
|
346
|
+
context.setAriaHidden(hidden);
|
|
347
|
+
};
|
|
357
348
|
export {
|
|
358
349
|
BlocksProvider,
|
|
359
350
|
Box,
|