@blockle/blocks 0.12.1 → 0.13.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.
- package/dist/index.cjs +5 -22
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +8 -25
- package/dist/momotaro.chunk.d.ts +297 -279
- package/dist/styles/components/display/Divider/Divider.cjs +43 -59
- package/dist/styles/components/display/Divider/Divider.mjs +43 -59
- package/dist/styles/components/form/Button/Button.cjs +4 -4
- package/dist/styles/components/form/Button/Button.mjs +3 -3
- package/dist/styles/components/overlay/Dialog/Dialog.cjs +18 -21
- package/dist/styles/components/overlay/Dialog/Dialog.mjs +18 -21
- package/dist/styles/themes/momotaro/components/divider.css.cjs +4 -0
- package/dist/styles/themes/momotaro/components/divider.css.mjs +4 -0
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
|
@@ -119,39 +119,23 @@ const Stack = ({
|
|
|
119
119
|
}
|
|
120
120
|
);
|
|
121
121
|
};
|
|
122
|
-
const
|
|
122
|
+
const { Template, Slot } = styles_components_display_Divider_Divider_cjs.createAsChildTemplate("a");
|
|
123
123
|
const Link = react.forwardRef(function Link2({ asChild, className, children, variant, underline, ...restProps }, ref) {
|
|
124
124
|
const linkClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("link", {
|
|
125
125
|
base: true,
|
|
126
126
|
variants: { variant, underline }
|
|
127
127
|
});
|
|
128
128
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
129
|
-
|
|
129
|
+
Template,
|
|
130
130
|
{
|
|
131
131
|
asChild,
|
|
132
132
|
ref,
|
|
133
133
|
className: styles_components_display_Divider_Divider_cjs.classnames(className, linkClassName),
|
|
134
134
|
...restProps,
|
|
135
|
-
children
|
|
135
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Slot, { children })
|
|
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
|
}
|
|
@@ -366,9 +350,8 @@ exports.makeTheme = styles_lib_theme_makeTheme_cjs.makeTheme;
|
|
|
366
350
|
exports.vars = styles_lib_theme_vars_css_cjs.vars;
|
|
367
351
|
exports.Box = styles_components_display_Divider_Divider_cjs.Box;
|
|
368
352
|
exports.Divider = styles_components_display_Divider_Divider_cjs.Divider;
|
|
369
|
-
exports.Slot = styles_components_display_Divider_Divider_cjs.Slot;
|
|
370
353
|
exports.classnames = styles_components_display_Divider_Divider_cjs.classnames;
|
|
371
|
-
exports.
|
|
354
|
+
exports.createAsChildTemplate = styles_components_display_Divider_Divider_cjs.createAsChildTemplate;
|
|
372
355
|
exports.useComponentStyleDefaultProps = styles_components_display_Divider_Divider_cjs.useComponentStyleDefaultProps;
|
|
373
356
|
exports.useComponentStyles = styles_components_display_Divider_Divider_cjs.useComponentStyles;
|
|
374
357
|
exports.atoms = styles_lib_css_atoms_sprinkles_css_cjs.atoms;
|
package/dist/index.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Label, LabelProps, Link, LinkProps, Portal, PortalProps, Progress, ProgressProps, Radio, RadioProps, Select, SelectProps, Slider, SliderProps,
|
|
1
|
+
export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Label, LabelProps, Link, LinkProps, Portal, PortalProps, Progress, ProgressProps, Radio, RadioProps, Select, SelectProps, Slider, SliderProps, Spinner, SpinnerProps, Stack, StackProps, Switch, SwitchProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, Tooltip, TooltipProps, atoms, breakpointQuery, classnames, createAsChildTemplate, makeComponentTheme, makeTheme, style, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, useRootAriaHidden, vars } from './momotaro.chunk.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Label, LabelProps, Link, LinkProps, Portal, PortalProps, Progress, ProgressProps, Radio, RadioProps, Select, SelectProps, Slider, SliderProps,
|
|
1
|
+
export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Label, LabelProps, Link, LinkProps, Portal, PortalProps, Progress, ProgressProps, Radio, RadioProps, Select, SelectProps, Slider, SliderProps, Spinner, SpinnerProps, Stack, StackProps, Switch, SwitchProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, Tooltip, TooltipProps, atoms, breakpointQuery, classnames, createAsChildTemplate, makeComponentTheme, makeTheme, style, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, useRootAriaHidden, vars } from './momotaro.chunk.js';
|
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,
|
|
9
|
-
import { Divider,
|
|
8
|
+
import { useComponentStyles, Box, classnames, createAsChildTemplate, composeRefs, BlocksProviderContext } from "./styles/components/display/Divider/Divider.mjs";
|
|
9
|
+
import { Divider, 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,7 +18,7 @@ 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";
|
|
21
|
+
import { useLayer, useVisibilityState, useIsomorphicLayoutEffect, hasAnimationDuration, useKeyboard, useClickOutside, Portal } from "./styles/components/overlay/Dialog/Dialog.mjs";
|
|
22
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";
|
|
@@ -121,39 +121,23 @@ const Stack = ({
|
|
|
121
121
|
}
|
|
122
122
|
);
|
|
123
123
|
};
|
|
124
|
-
const
|
|
124
|
+
const { Template, Slot } = createAsChildTemplate("a");
|
|
125
125
|
const Link = forwardRef(function Link2({ asChild, className, children, variant, underline, ...restProps }, ref) {
|
|
126
126
|
const linkClassName = useComponentStyles("link", {
|
|
127
127
|
base: true,
|
|
128
128
|
variants: { variant, underline }
|
|
129
129
|
});
|
|
130
130
|
return /* @__PURE__ */ jsx(
|
|
131
|
-
|
|
131
|
+
Template,
|
|
132
132
|
{
|
|
133
133
|
asChild,
|
|
134
134
|
ref,
|
|
135
135
|
className: classnames(className, linkClassName),
|
|
136
136
|
...restProps,
|
|
137
|
-
children
|
|
137
|
+
children: /* @__PURE__ */ jsx(Slot, { children })
|
|
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];
|
|
@@ -378,7 +362,6 @@ export {
|
|
|
378
362
|
Radio,
|
|
379
363
|
Select,
|
|
380
364
|
Slider,
|
|
381
|
-
Slot,
|
|
382
365
|
Spinner,
|
|
383
366
|
Stack,
|
|
384
367
|
Switch,
|
|
@@ -387,7 +370,7 @@ export {
|
|
|
387
370
|
atoms,
|
|
388
371
|
breakpointQuery,
|
|
389
372
|
classnames,
|
|
390
|
-
|
|
373
|
+
createAsChildTemplate,
|
|
391
374
|
makeComponentTheme,
|
|
392
375
|
makeTheme,
|
|
393
376
|
style,
|