@blockle/blocks 0.9.1 → 0.10.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 +2 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +2 -0
- package/dist/momotaro.chunk.d.ts +29 -1
- package/dist/reset.css.cjs +1 -1
- package/dist/reset.css.mjs +1 -1
- package/dist/styles/components/display/Divider/divider.css.cjs +1 -1
- package/dist/styles/components/display/Divider/divider.css.mjs +1 -1
- package/dist/styles/components/form/Button/Button.css.cjs +1 -1
- package/dist/styles/components/form/Button/Button.css.mjs +1 -1
- package/dist/styles/components/form/Checkbox/checkbox.css.cjs +1 -1
- package/dist/styles/components/form/Checkbox/checkbox.css.mjs +1 -1
- package/dist/styles/components/form/Input/input.css.cjs +1 -1
- package/dist/styles/components/form/Input/input.css.mjs +1 -1
- package/dist/styles/components/form/Radio/radio.css.cjs +1 -1
- package/dist/styles/components/form/Radio/radio.css.mjs +1 -1
- package/dist/styles/components/form/Select/select.css.cjs +1 -1
- package/dist/styles/components/form/Select/select.css.mjs +1 -1
- package/dist/styles/components/form/Slider/Slider.cjs +155 -0
- package/dist/styles/components/form/Slider/Slider.mjs +156 -0
- package/dist/styles/components/form/Slider/slider.css.cjs +73 -0
- package/dist/styles/components/form/Slider/slider.css.mjs +74 -0
- package/dist/styles/components/form/Switch/switch.css.cjs +1 -1
- package/dist/styles/components/form/Switch/switch.css.mjs +1 -1
- package/dist/styles/components/overlay/Dialog/dialog.css.cjs +1 -1
- package/dist/styles/components/overlay/Dialog/dialog.css.mjs +1 -1
- package/dist/styles/components/typography/Heading/heading.css.cjs +1 -1
- package/dist/styles/components/typography/Heading/heading.css.mjs +1 -1
- package/dist/styles/components/typography/Text/text.css.cjs +1 -1
- package/dist/styles/components/typography/Text/text.css.mjs +1 -1
- package/dist/styles/lib/css/atoms/sprinkles.css.cjs +1 -1
- package/dist/styles/lib/css/atoms/sprinkles.css.mjs +1 -1
- package/dist/styles/lib/css/layers/layers.css.cjs +1 -1
- package/dist/styles/lib/css/layers/layers.css.mjs +1 -1
- package/dist/styles/lib/theme/vars.css.cjs +1 -1
- package/dist/styles/lib/theme/vars.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/button.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/button.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/checkbox.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/checkbox.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/dialog.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/dialog.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/divider.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/divider.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/dropdown.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/dropdown.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/helpers.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/helpers.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/index.cjs +3 -1
- package/dist/styles/themes/momotaro/components/index.mjs +3 -1
- package/dist/styles/themes/momotaro/components/input.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/input.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/label.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/label.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/link.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/link.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/progress.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/progress.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/radio.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/radio.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/select.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/select.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/slider.css.cjs +65 -0
- package/dist/styles/themes/momotaro/components/slider.css.mjs +66 -0
- package/dist/styles/themes/momotaro/components/spinner.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/spinner.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/switch.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/switch.css.mjs +1 -1
- package/dist/styles/themes/momotaro/momotaro.css.cjs +1 -1
- package/dist/styles/themes/momotaro/momotaro.css.mjs +1 -1
- package/dist/styles/themes/momotaro/tokens.css.cjs +3 -3
- package/dist/styles/themes/momotaro/tokens.css.mjs +3 -3
- package/package.json +20 -20
package/dist/index.cjs
CHANGED
|
@@ -14,6 +14,7 @@ const styles_components_form_Checkbox_Checkbox_cjs = require("./styles/component
|
|
|
14
14
|
const styles_components_form_Input_Input_cjs = require("./styles/components/form/Input/Input.cjs");
|
|
15
15
|
const styles_components_form_Radio_Radio_cjs = require("./styles/components/form/Radio/Radio.cjs");
|
|
16
16
|
const styles_components_form_Select_Select_cjs = require("./styles/components/form/Select/Select.cjs");
|
|
17
|
+
const styles_components_form_Slider_Slider_cjs = require("./styles/components/form/Slider/Slider.cjs");
|
|
17
18
|
const styles_components_form_Switch_Switch_cjs = require("./styles/components/form/Switch/Switch.cjs");
|
|
18
19
|
const styles_components_other_BlocksProvider_BlocksProvider_cjs = require("./styles/components/other/BlocksProvider/BlocksProvider.cjs");
|
|
19
20
|
const styles_components_overlay_Dialog_Dialog_cjs = require("./styles/components/overlay/Dialog/Dialog.cjs");
|
|
@@ -155,6 +156,7 @@ exports.Label = styles_components_form_Checkbox_Checkbox_cjs.Label;
|
|
|
155
156
|
exports.Input = styles_components_form_Input_Input_cjs.Input;
|
|
156
157
|
exports.Radio = styles_components_form_Radio_Radio_cjs.Radio;
|
|
157
158
|
exports.Select = styles_components_form_Select_Select_cjs.Select;
|
|
159
|
+
exports.Slider = styles_components_form_Slider_Slider_cjs.Slider;
|
|
158
160
|
exports.Switch = styles_components_form_Switch_Switch_cjs.Switch;
|
|
159
161
|
exports.BlocksProvider = styles_components_other_BlocksProvider_BlocksProvider_cjs.BlocksProvider;
|
|
160
162
|
exports.Dialog = styles_components_overlay_Dialog_Dialog_cjs.Dialog;
|
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, Slot, Spinner, SpinnerProps, Stack, StackProps, Switch, SwitchProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, makeComponentTheme, makeTheme, style, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, useRootAriaHidden, vars } from './momotaro.chunk.js';
|
|
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, Slot, Spinner, SpinnerProps, Stack, StackProps, Switch, SwitchProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, 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, Slot, Spinner, SpinnerProps, Stack, StackProps, Switch, SwitchProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, makeComponentTheme, makeTheme, style, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, useRootAriaHidden, vars } from './momotaro.chunk.js';
|
|
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, Slot, Spinner, SpinnerProps, Stack, StackProps, Switch, SwitchProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, makeComponentTheme, makeTheme, style, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, useRootAriaHidden, vars } from './momotaro.chunk.js';
|
package/dist/index.mjs
CHANGED
|
@@ -15,6 +15,7 @@ import { Checkbox, Label } from "./styles/components/form/Checkbox/Checkbox.mjs"
|
|
|
15
15
|
import { Input } from "./styles/components/form/Input/Input.mjs";
|
|
16
16
|
import { Radio } from "./styles/components/form/Radio/Radio.mjs";
|
|
17
17
|
import { Select } from "./styles/components/form/Select/Select.mjs";
|
|
18
|
+
import { Slider } from "./styles/components/form/Slider/Slider.mjs";
|
|
18
19
|
import { Switch } from "./styles/components/form/Switch/Switch.mjs";
|
|
19
20
|
import { BlocksProvider } from "./styles/components/other/BlocksProvider/BlocksProvider.mjs";
|
|
20
21
|
import { Dialog, Portal, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, useRootAriaHidden } from "./styles/components/overlay/Dialog/Dialog.mjs";
|
|
@@ -152,6 +153,7 @@ export {
|
|
|
152
153
|
Progress,
|
|
153
154
|
Radio,
|
|
154
155
|
Select,
|
|
156
|
+
Slider,
|
|
155
157
|
Slot,
|
|
156
158
|
Spinner,
|
|
157
159
|
Stack,
|
package/dist/momotaro.chunk.d.ts
CHANGED
|
@@ -390,6 +390,16 @@ type SelectTheme = {
|
|
|
390
390
|
variant: 'solid' | 'outline';
|
|
391
391
|
};
|
|
392
392
|
};
|
|
393
|
+
type SliderTheme = {
|
|
394
|
+
base: string;
|
|
395
|
+
track: string;
|
|
396
|
+
filledTrack: string;
|
|
397
|
+
thumb: string;
|
|
398
|
+
variants: {
|
|
399
|
+
size: 'small' | 'medium' | 'large';
|
|
400
|
+
colorScheme: 'primary' | 'secondary';
|
|
401
|
+
};
|
|
402
|
+
};
|
|
393
403
|
type ComponentThemes = {
|
|
394
404
|
button: ButtonTheme;
|
|
395
405
|
checkbox: CheckboxTheme;
|
|
@@ -404,6 +414,7 @@ type ComponentThemes = {
|
|
|
404
414
|
select: SelectTheme;
|
|
405
415
|
spinner: SpinnerTheme;
|
|
406
416
|
switch: SwitchTheme;
|
|
417
|
+
slider: SliderTheme;
|
|
407
418
|
};
|
|
408
419
|
/**
|
|
409
420
|
* ComponentThemeProps is a helper type to define the props passed to useComponentStyles.
|
|
@@ -712,6 +723,23 @@ declare const Select: react__default.ForwardRefExoticComponent<{
|
|
|
712
723
|
} | undefined;
|
|
713
724
|
} & HTMLElementProps<HTMLSelectElement> & react__default.RefAttributes<HTMLSelectElement>>;
|
|
714
725
|
|
|
726
|
+
type SliderProps = {
|
|
727
|
+
name?: string;
|
|
728
|
+
min?: number;
|
|
729
|
+
max?: number;
|
|
730
|
+
step?: number;
|
|
731
|
+
value?: number;
|
|
732
|
+
defaultValue?: number;
|
|
733
|
+
onChange?: (value: number) => void;
|
|
734
|
+
orientation?: 'horizontal' | 'vertical';
|
|
735
|
+
'aria-labelledby'?: string;
|
|
736
|
+
'aria-valuetext'?: string;
|
|
737
|
+
'aria-label'?: string;
|
|
738
|
+
size: SliderTheme['variants']['size'];
|
|
739
|
+
colorScheme: SliderTheme['variants']['colorScheme'];
|
|
740
|
+
};
|
|
741
|
+
declare const Slider: react__default.FC<SliderProps>;
|
|
742
|
+
|
|
715
743
|
type SwitchProps = {
|
|
716
744
|
onChange?: (value: boolean) => void;
|
|
717
745
|
} & Omit<HTMLElementProps<HTMLInputElement>, 'onChange'>;
|
|
@@ -1106,4 +1134,4 @@ declare const classnames: (...args: Args[]) => string | undefined;
|
|
|
1106
1134
|
|
|
1107
1135
|
declare const momotaro: Theme;
|
|
1108
1136
|
|
|
1109
|
-
export { BlocksProvider, type BlocksProviderProps, Box, type BoxProps, Button, type ButtonProps, Checkbox, type CheckboxProps, Dialog, type DialogProps, Divider, type DividerProps, Heading, type HeadingProps, Inline, type InlineProps, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Portal, type PortalProps, Progress, type ProgressProps, Radio, type RadioProps, Select, type SelectProps, Slot, Spinner, type SpinnerProps, Stack, type StackProps, Switch, type SwitchProps, Text, type TextProps, type ThemeComponentsStyles, type ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, makeComponentTheme, makeTheme, momotaro, style, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, useRootAriaHidden, vars };
|
|
1137
|
+
export { BlocksProvider, type BlocksProviderProps, Box, type BoxProps, Button, type ButtonProps, Checkbox, type CheckboxProps, Dialog, type DialogProps, Divider, type DividerProps, Heading, type HeadingProps, Inline, type InlineProps, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Portal, type PortalProps, Progress, type ProgressProps, Radio, type RadioProps, Select, type SelectProps, Slider, type SliderProps, Slot, Spinner, type SpinnerProps, Stack, type StackProps, Switch, type SwitchProps, Text, type TextProps, type ThemeComponentsStyles, type ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, makeComponentTheme, makeTheme, momotaro, style, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, useRootAriaHidden, vars };
|
package/dist/reset.css.cjs
CHANGED
package/dist/reset.css.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
3
|
const css = require("@vanilla-extract/css");
|
|
4
4
|
const styles_lib_css_layers_layers_css_cjs = require("../../../lib/css/layers/layers.css.cjs");
|
|
5
|
-
fileScope.setFileScope("src/components/display/Divider/divider.css.ts", "blocks");
|
|
5
|
+
fileScope.setFileScope("src/components/display/Divider/divider.css.ts", "@blockle/blocks");
|
|
6
6
|
const divider = css.style({
|
|
7
7
|
"@layer": {
|
|
8
8
|
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
2
|
import { style } from "@vanilla-extract/css";
|
|
3
3
|
import { blocksLayer } from "../../../lib/css/layers/layers.css.mjs";
|
|
4
|
-
setFileScope("src/components/display/Divider/divider.css.ts", "blocks");
|
|
4
|
+
setFileScope("src/components/display/Divider/divider.css.ts", "@blockle/blocks");
|
|
5
5
|
const divider = style({
|
|
6
6
|
"@layer": {
|
|
7
7
|
[blocksLayer]: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
3
|
const css = require("@vanilla-extract/css");
|
|
4
4
|
const styles_lib_css_layers_layers_css_cjs = require("../../../lib/css/layers/layers.css.cjs");
|
|
5
|
-
fileScope.setFileScope("src/components/form/Button/Button.css.ts", "blocks");
|
|
5
|
+
fileScope.setFileScope("src/components/form/Button/Button.css.ts", "@blockle/blocks");
|
|
6
6
|
const buttonReset = css.style({
|
|
7
7
|
"@layer": {
|
|
8
8
|
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
2
|
import { style } from "@vanilla-extract/css";
|
|
3
3
|
import { blocksLayer } from "../../../lib/css/layers/layers.css.mjs";
|
|
4
|
-
setFileScope("src/components/form/Button/Button.css.ts", "blocks");
|
|
4
|
+
setFileScope("src/components/form/Button/Button.css.ts", "@blockle/blocks");
|
|
5
5
|
const buttonReset = style({
|
|
6
6
|
"@layer": {
|
|
7
7
|
[blocksLayer]: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
3
|
const css = require("@vanilla-extract/css");
|
|
4
4
|
const styles_lib_css_layers_layers_css_cjs = require("../../../lib/css/layers/layers.css.cjs");
|
|
5
|
-
fileScope.setFileScope("src/components/form/Checkbox/checkbox.css.ts", "blocks");
|
|
5
|
+
fileScope.setFileScope("src/components/form/Checkbox/checkbox.css.ts", "@blockle/blocks");
|
|
6
6
|
const container = css.style({
|
|
7
7
|
"@layer": {
|
|
8
8
|
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
2
|
import { style } from "@vanilla-extract/css";
|
|
3
3
|
import { blocksLayer } from "../../../lib/css/layers/layers.css.mjs";
|
|
4
|
-
setFileScope("src/components/form/Checkbox/checkbox.css.ts", "blocks");
|
|
4
|
+
setFileScope("src/components/form/Checkbox/checkbox.css.ts", "@blockle/blocks");
|
|
5
5
|
const container = style({
|
|
6
6
|
"@layer": {
|
|
7
7
|
[blocksLayer]: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
3
|
const css = require("@vanilla-extract/css");
|
|
4
4
|
const styles_lib_css_layers_layers_css_cjs = require("../../../lib/css/layers/layers.css.cjs");
|
|
5
|
-
fileScope.setFileScope("src/components/form/Input/input.css.ts", "blocks");
|
|
5
|
+
fileScope.setFileScope("src/components/form/Input/input.css.ts", "@blockle/blocks");
|
|
6
6
|
const input = css.style({
|
|
7
7
|
"@layer": {
|
|
8
8
|
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
2
|
import { style } from "@vanilla-extract/css";
|
|
3
3
|
import { blocksLayer } from "../../../lib/css/layers/layers.css.mjs";
|
|
4
|
-
setFileScope("src/components/form/Input/input.css.ts", "blocks");
|
|
4
|
+
setFileScope("src/components/form/Input/input.css.ts", "@blockle/blocks");
|
|
5
5
|
const input = style({
|
|
6
6
|
"@layer": {
|
|
7
7
|
[blocksLayer]: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
3
|
const css = require("@vanilla-extract/css");
|
|
4
4
|
const styles_lib_css_layers_layers_css_cjs = require("../../../lib/css/layers/layers.css.cjs");
|
|
5
|
-
fileScope.setFileScope("src/components/form/Radio/radio.css.ts", "blocks");
|
|
5
|
+
fileScope.setFileScope("src/components/form/Radio/radio.css.ts", "@blockle/blocks");
|
|
6
6
|
const container = css.style({
|
|
7
7
|
"@layer": {
|
|
8
8
|
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
2
|
import { style } from "@vanilla-extract/css";
|
|
3
3
|
import { blocksLayer } from "../../../lib/css/layers/layers.css.mjs";
|
|
4
|
-
setFileScope("src/components/form/Radio/radio.css.ts", "blocks");
|
|
4
|
+
setFileScope("src/components/form/Radio/radio.css.ts", "@blockle/blocks");
|
|
5
5
|
const container = style({
|
|
6
6
|
"@layer": {
|
|
7
7
|
[blocksLayer]: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
3
|
const css = require("@vanilla-extract/css");
|
|
4
4
|
const styles_lib_css_layers_layers_css_cjs = require("../../../lib/css/layers/layers.css.cjs");
|
|
5
|
-
fileScope.setFileScope("src/components/form/Select/select.css.ts", "blocks");
|
|
5
|
+
fileScope.setFileScope("src/components/form/Select/select.css.ts", "@blockle/blocks");
|
|
6
6
|
const wrapper = css.style({
|
|
7
7
|
"@layer": {
|
|
8
8
|
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
2
|
import { style } from "@vanilla-extract/css";
|
|
3
3
|
import { blocksLayer } from "../../../lib/css/layers/layers.css.mjs";
|
|
4
|
-
setFileScope("src/components/form/Select/select.css.ts", "blocks");
|
|
4
|
+
setFileScope("src/components/form/Select/select.css.ts", "@blockle/blocks");
|
|
5
5
|
const wrapper = style({
|
|
6
6
|
"@layer": {
|
|
7
7
|
[blocksLayer]: {
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
5
|
+
const styles_components_form_Slider_slider_css_cjs = require("./slider.css.cjs");
|
|
6
|
+
function getProgress(event, rect) {
|
|
7
|
+
const { clientX, clientY } = event;
|
|
8
|
+
const { width, height, left, top } = rect;
|
|
9
|
+
const x = (clientX - left) / width;
|
|
10
|
+
const y = (clientY - top) / height;
|
|
11
|
+
return [x, y];
|
|
12
|
+
}
|
|
13
|
+
function usePointerProgress({ container, orientation, onChange }) {
|
|
14
|
+
react.useEffect(() => {
|
|
15
|
+
const element = container.current;
|
|
16
|
+
function pointerdown(event) {
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
event.stopPropagation();
|
|
19
|
+
if (!element) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const containerRect = element.getBoundingClientRect();
|
|
23
|
+
const axisIndex = orientation === "horizontal" ? 0 : 1;
|
|
24
|
+
const progress = getProgress(event, containerRect);
|
|
25
|
+
onChange(progress[axisIndex]);
|
|
26
|
+
const pointermove = (event2) => {
|
|
27
|
+
event2.preventDefault();
|
|
28
|
+
const progress2 = getProgress(event2, containerRect);
|
|
29
|
+
onChange(progress2[axisIndex]);
|
|
30
|
+
};
|
|
31
|
+
const pointerup = () => {
|
|
32
|
+
document.removeEventListener("pointermove", pointermove);
|
|
33
|
+
document.removeEventListener("pointerup", pointerup);
|
|
34
|
+
};
|
|
35
|
+
document.addEventListener("pointermove", pointermove);
|
|
36
|
+
document.addEventListener("pointerup", pointerup);
|
|
37
|
+
}
|
|
38
|
+
if (!element) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
element.addEventListener("pointerdown", pointerdown);
|
|
42
|
+
return () => {
|
|
43
|
+
element.removeEventListener("pointerdown", pointerdown);
|
|
44
|
+
};
|
|
45
|
+
}, [container, onChange, orientation]);
|
|
46
|
+
}
|
|
47
|
+
function getBoundValue(newValue, min, max, step) {
|
|
48
|
+
let value = Math.round(newValue / step) * step;
|
|
49
|
+
value = Math.max(min, Math.min(max, value));
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
const Slider = ({
|
|
53
|
+
min = 0,
|
|
54
|
+
max = 100,
|
|
55
|
+
step = 1,
|
|
56
|
+
orientation = "horizontal",
|
|
57
|
+
defaultValue = 0,
|
|
58
|
+
onChange,
|
|
59
|
+
value,
|
|
60
|
+
name,
|
|
61
|
+
size,
|
|
62
|
+
colorScheme,
|
|
63
|
+
...restProps
|
|
64
|
+
}) => {
|
|
65
|
+
const [internValue, setInternValue] = react.useState(
|
|
66
|
+
getBoundValue(value ?? defaultValue, min, max, step)
|
|
67
|
+
);
|
|
68
|
+
const baseClass = styles_components_display_Divider_Divider_cjs.useComponentStyles("slider", { base: true, variants: { size, colorScheme } });
|
|
69
|
+
const trackClass = styles_components_display_Divider_Divider_cjs.useComponentStyles("slider", { track: true }, false);
|
|
70
|
+
const filledTrackClass = styles_components_display_Divider_Divider_cjs.useComponentStyles("slider", { filledTrack: true }, false);
|
|
71
|
+
const thumbClass = styles_components_display_Divider_Divider_cjs.useComponentStyles("slider", { thumb: true }, false);
|
|
72
|
+
const containerRef = react.useRef(null);
|
|
73
|
+
react.useEffect(() => {
|
|
74
|
+
if (value !== void 0) {
|
|
75
|
+
setInternValue(getBoundValue(value, min, max, step));
|
|
76
|
+
}
|
|
77
|
+
}, [value, min, max, step]);
|
|
78
|
+
react.useEffect(() => {
|
|
79
|
+
if (onChange && internValue !== value) {
|
|
80
|
+
onChange(internValue);
|
|
81
|
+
}
|
|
82
|
+
}, [internValue, onChange, value]);
|
|
83
|
+
usePointerProgress({
|
|
84
|
+
container: containerRef,
|
|
85
|
+
orientation,
|
|
86
|
+
onChange(progress) {
|
|
87
|
+
if (orientation === "vertical") {
|
|
88
|
+
progress = 1 - progress;
|
|
89
|
+
}
|
|
90
|
+
setInternValue(getBoundValue(max * progress, min, max, step));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const onKeyDown = react.useCallback(
|
|
94
|
+
(event) => {
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
event.stopPropagation();
|
|
97
|
+
const specialKey = ["PageUp", "PageDown"];
|
|
98
|
+
const stepModifier = event.shiftKey || specialKey.includes(event.key) ? (max - min) / 10 : step;
|
|
99
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowDown" || event.key === "PageDown") {
|
|
100
|
+
return setInternValue((value2) => getBoundValue(value2 - stepModifier, min, max, step));
|
|
101
|
+
}
|
|
102
|
+
if (event.key === "ArrowRight" || event.key === "ArrowUp" || event.key === "PageUp") {
|
|
103
|
+
return setInternValue((value2) => getBoundValue(value2 + stepModifier, min, max, step));
|
|
104
|
+
}
|
|
105
|
+
if (event.key === "Home") {
|
|
106
|
+
return setInternValue(min);
|
|
107
|
+
}
|
|
108
|
+
if (event.key === "End") {
|
|
109
|
+
return setInternValue(max);
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
[max, min, step]
|
|
113
|
+
);
|
|
114
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
115
|
+
"div",
|
|
116
|
+
{
|
|
117
|
+
ref: containerRef,
|
|
118
|
+
className: styles_components_display_Divider_Divider_cjs.classnames(
|
|
119
|
+
styles_components_form_Slider_slider_css_cjs.container,
|
|
120
|
+
orientation === "vertical" ? styles_components_form_Slider_slider_css_cjs.containerVertical : "",
|
|
121
|
+
baseClass
|
|
122
|
+
),
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_form_Slider_slider_css_cjs.track, trackClass), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_form_Slider_slider_css_cjs.filledTrack, filledTrackClass),
|
|
128
|
+
style: {
|
|
129
|
+
inlineSize: `${internValue / max * 100}%`
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
) }),
|
|
133
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_form_Slider_slider_css_cjs.thumb, thumbClass),
|
|
137
|
+
tabIndex: 0,
|
|
138
|
+
role: "slider",
|
|
139
|
+
"aria-valuemin": min,
|
|
140
|
+
"aria-valuemax": max,
|
|
141
|
+
"aria-valuenow": internValue,
|
|
142
|
+
"aria-orientation": orientation,
|
|
143
|
+
style: {
|
|
144
|
+
[orientation === "horizontal" ? "insetInlineStart" : "insetInlineEnd"]: `${internValue / max * 100}%`
|
|
145
|
+
},
|
|
146
|
+
onKeyDown,
|
|
147
|
+
...restProps
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value: internValue })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
exports.Slider = Slider;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState, useRef, useCallback } from "react";
|
|
3
|
+
import { useComponentStyles, classnames } from "../../display/Divider/Divider.mjs";
|
|
4
|
+
import { containerVertical, container, track, filledTrack, thumb } from "./slider.css.mjs";
|
|
5
|
+
function getProgress(event, rect) {
|
|
6
|
+
const { clientX, clientY } = event;
|
|
7
|
+
const { width, height, left, top } = rect;
|
|
8
|
+
const x = (clientX - left) / width;
|
|
9
|
+
const y = (clientY - top) / height;
|
|
10
|
+
return [x, y];
|
|
11
|
+
}
|
|
12
|
+
function usePointerProgress({ container: container2, orientation, onChange }) {
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const element = container2.current;
|
|
15
|
+
function pointerdown(event) {
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
event.stopPropagation();
|
|
18
|
+
if (!element) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const containerRect = element.getBoundingClientRect();
|
|
22
|
+
const axisIndex = orientation === "horizontal" ? 0 : 1;
|
|
23
|
+
const progress = getProgress(event, containerRect);
|
|
24
|
+
onChange(progress[axisIndex]);
|
|
25
|
+
const pointermove = (event2) => {
|
|
26
|
+
event2.preventDefault();
|
|
27
|
+
const progress2 = getProgress(event2, containerRect);
|
|
28
|
+
onChange(progress2[axisIndex]);
|
|
29
|
+
};
|
|
30
|
+
const pointerup = () => {
|
|
31
|
+
document.removeEventListener("pointermove", pointermove);
|
|
32
|
+
document.removeEventListener("pointerup", pointerup);
|
|
33
|
+
};
|
|
34
|
+
document.addEventListener("pointermove", pointermove);
|
|
35
|
+
document.addEventListener("pointerup", pointerup);
|
|
36
|
+
}
|
|
37
|
+
if (!element) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
element.addEventListener("pointerdown", pointerdown);
|
|
41
|
+
return () => {
|
|
42
|
+
element.removeEventListener("pointerdown", pointerdown);
|
|
43
|
+
};
|
|
44
|
+
}, [container2, onChange, orientation]);
|
|
45
|
+
}
|
|
46
|
+
function getBoundValue(newValue, min, max, step) {
|
|
47
|
+
let value = Math.round(newValue / step) * step;
|
|
48
|
+
value = Math.max(min, Math.min(max, value));
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
const Slider = ({
|
|
52
|
+
min = 0,
|
|
53
|
+
max = 100,
|
|
54
|
+
step = 1,
|
|
55
|
+
orientation = "horizontal",
|
|
56
|
+
defaultValue = 0,
|
|
57
|
+
onChange,
|
|
58
|
+
value,
|
|
59
|
+
name,
|
|
60
|
+
size,
|
|
61
|
+
colorScheme,
|
|
62
|
+
...restProps
|
|
63
|
+
}) => {
|
|
64
|
+
const [internValue, setInternValue] = useState(
|
|
65
|
+
getBoundValue(value ?? defaultValue, min, max, step)
|
|
66
|
+
);
|
|
67
|
+
const baseClass = useComponentStyles("slider", { base: true, variants: { size, colorScheme } });
|
|
68
|
+
const trackClass = useComponentStyles("slider", { track: true }, false);
|
|
69
|
+
const filledTrackClass = useComponentStyles("slider", { filledTrack: true }, false);
|
|
70
|
+
const thumbClass = useComponentStyles("slider", { thumb: true }, false);
|
|
71
|
+
const containerRef = useRef(null);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (value !== void 0) {
|
|
74
|
+
setInternValue(getBoundValue(value, min, max, step));
|
|
75
|
+
}
|
|
76
|
+
}, [value, min, max, step]);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (onChange && internValue !== value) {
|
|
79
|
+
onChange(internValue);
|
|
80
|
+
}
|
|
81
|
+
}, [internValue, onChange, value]);
|
|
82
|
+
usePointerProgress({
|
|
83
|
+
container: containerRef,
|
|
84
|
+
orientation,
|
|
85
|
+
onChange(progress) {
|
|
86
|
+
if (orientation === "vertical") {
|
|
87
|
+
progress = 1 - progress;
|
|
88
|
+
}
|
|
89
|
+
setInternValue(getBoundValue(max * progress, min, max, step));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
const onKeyDown = useCallback(
|
|
93
|
+
(event) => {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
event.stopPropagation();
|
|
96
|
+
const specialKey = ["PageUp", "PageDown"];
|
|
97
|
+
const stepModifier = event.shiftKey || specialKey.includes(event.key) ? (max - min) / 10 : step;
|
|
98
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowDown" || event.key === "PageDown") {
|
|
99
|
+
return setInternValue((value2) => getBoundValue(value2 - stepModifier, min, max, step));
|
|
100
|
+
}
|
|
101
|
+
if (event.key === "ArrowRight" || event.key === "ArrowUp" || event.key === "PageUp") {
|
|
102
|
+
return setInternValue((value2) => getBoundValue(value2 + stepModifier, min, max, step));
|
|
103
|
+
}
|
|
104
|
+
if (event.key === "Home") {
|
|
105
|
+
return setInternValue(min);
|
|
106
|
+
}
|
|
107
|
+
if (event.key === "End") {
|
|
108
|
+
return setInternValue(max);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
[max, min, step]
|
|
112
|
+
);
|
|
113
|
+
return /* @__PURE__ */ jsxs(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
ref: containerRef,
|
|
117
|
+
className: classnames(
|
|
118
|
+
container,
|
|
119
|
+
orientation === "vertical" ? containerVertical : "",
|
|
120
|
+
baseClass
|
|
121
|
+
),
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ jsx("div", { className: classnames(track, trackClass), children: /* @__PURE__ */ jsx(
|
|
124
|
+
"div",
|
|
125
|
+
{
|
|
126
|
+
className: classnames(filledTrack, filledTrackClass),
|
|
127
|
+
style: {
|
|
128
|
+
inlineSize: `${internValue / max * 100}%`
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
) }),
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
"div",
|
|
134
|
+
{
|
|
135
|
+
className: classnames(thumb, thumbClass),
|
|
136
|
+
tabIndex: 0,
|
|
137
|
+
role: "slider",
|
|
138
|
+
"aria-valuemin": min,
|
|
139
|
+
"aria-valuemax": max,
|
|
140
|
+
"aria-valuenow": internValue,
|
|
141
|
+
"aria-orientation": orientation,
|
|
142
|
+
style: {
|
|
143
|
+
[orientation === "horizontal" ? "insetInlineStart" : "insetInlineEnd"]: `${internValue / max * 100}%`
|
|
144
|
+
},
|
|
145
|
+
onKeyDown,
|
|
146
|
+
...restProps
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
/* @__PURE__ */ jsx("input", { type: "hidden", name, value: internValue })
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
export {
|
|
155
|
+
Slider
|
|
156
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
|
+
const css = require("@vanilla-extract/css");
|
|
4
|
+
const styles_lib_css_layers_layers_css_cjs = require("../../../lib/css/layers/layers.css.cjs");
|
|
5
|
+
fileScope.setFileScope("src/components/form/Slider/slider.css.ts", "@blockle/blocks");
|
|
6
|
+
const container = css.style({
|
|
7
|
+
"@layer": {
|
|
8
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
9
|
+
position: "relative",
|
|
10
|
+
writingMode: "horizontal-tb"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}, "container");
|
|
14
|
+
const containerVertical = css.style({
|
|
15
|
+
"@layer": {
|
|
16
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
17
|
+
writingMode: "vertical-lr"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}, "containerVertical");
|
|
21
|
+
const track = css.style({
|
|
22
|
+
"@layer": {
|
|
23
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
24
|
+
cursor: "pointer",
|
|
25
|
+
position: "absolute",
|
|
26
|
+
inlineSize: "100%",
|
|
27
|
+
insetBlockStart: "50%",
|
|
28
|
+
transform: "translateY(-50%)",
|
|
29
|
+
selectors: {
|
|
30
|
+
[`${containerVertical} &`]: {
|
|
31
|
+
transform: "translateX(-50%)"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, "track");
|
|
37
|
+
const filledTrack = css.style({
|
|
38
|
+
"@layer": {
|
|
39
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
40
|
+
position: "absolute",
|
|
41
|
+
blockSize: "100%",
|
|
42
|
+
borderRadius: "inherit",
|
|
43
|
+
selectors: {
|
|
44
|
+
[`${containerVertical} &`]: {
|
|
45
|
+
insetInlineEnd: "0%"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, "filledTrack");
|
|
51
|
+
const thumb = css.style({
|
|
52
|
+
"@layer": {
|
|
53
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
54
|
+
cursor: "pointer",
|
|
55
|
+
position: "absolute",
|
|
56
|
+
blockSize: "100%",
|
|
57
|
+
insetBlockStart: "50%",
|
|
58
|
+
transform: "translate(-50%, -50%)",
|
|
59
|
+
touchAction: "none",
|
|
60
|
+
selectors: {
|
|
61
|
+
[`${containerVertical} &`]: {
|
|
62
|
+
transform: "translate(-50%, 50%)"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, "thumb");
|
|
68
|
+
fileScope.endFileScope();
|
|
69
|
+
exports.container = container;
|
|
70
|
+
exports.containerVertical = containerVertical;
|
|
71
|
+
exports.filledTrack = filledTrack;
|
|
72
|
+
exports.thumb = thumb;
|
|
73
|
+
exports.track = track;
|