visits-style 1.4.1 → 1.4.3
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/README.md +3 -3
- package/dist/components/Toast/index.d.ts +1 -1
- package/dist/components/Toast/types.d.ts +5 -0
- package/dist/forms/Checkbox/index.d.ts +2 -2
- package/dist/forms/HelpMessage.d.ts +3 -2
- package/dist/forms/Radio/index.d.ts +2 -2
- package/dist/forms/Select/index.d.ts +5 -5
- package/dist/forms/TextInput/index.d.ts +2 -2
- package/dist/forms/Textarea/index.d.ts +2 -2
- package/dist/index.cjs.js +40 -27
- package/dist/index.es.js +40 -27
- package/dist/utils/stopPropagation.d.ts +2 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,8 +20,8 @@ yarn add react react-dom styled-components visits-style
|
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Dependencies
|
|
23
|
-
- React, React-dom(^18.
|
|
24
|
-
- styled-components(^
|
|
23
|
+
- React, React-dom(^18.2.0)
|
|
24
|
+
- styled-components(^6.0.2)
|
|
25
25
|
|
|
26
26
|
## Example
|
|
27
27
|
|
|
@@ -47,4 +47,4 @@ root.render(<App />);
|
|
|
47
47
|
|
|
48
48
|
## Docs
|
|
49
49
|
|
|
50
|
-
- [ドキュメント](https://visits-works.github.io/visits-style
|
|
50
|
+
- [ドキュメント](https://visits-works.github.io/visits-style)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ToastContainerProps } from './types';
|
|
2
|
-
export default function Toast({ toasts, clear, fixed, margin, position }: ToastContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function Toast({ toasts, clear, fixed, margin, position, space }: ToastContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { InputHTMLAttributes } from 'react';
|
|
2
2
|
export interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
-
children?:
|
|
3
|
+
children?: React.ReactNode;
|
|
4
4
|
checked?: boolean;
|
|
5
5
|
indeterminate?: boolean;
|
|
6
6
|
}
|
|
7
|
-
declare const Checkbox: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement
|
|
7
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
|
|
8
8
|
export default Checkbox;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
interface Props {
|
|
2
|
-
help?:
|
|
3
|
-
error?:
|
|
3
|
+
help?: ReactNode;
|
|
4
|
+
error?: ReactNode;
|
|
4
5
|
noErrorMessage?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export default function HelpMessage({ help, error, noErrorMessage }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -4,5 +4,5 @@ export interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
|
|
4
4
|
children?: any;
|
|
5
5
|
checked?: boolean;
|
|
6
6
|
}
|
|
7
|
-
declare const
|
|
8
|
-
export default
|
|
7
|
+
declare const Radio: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
|
|
8
|
+
export default Radio;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { SelectHTMLAttributes } from 'react';
|
|
1
|
+
import React, { SelectHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { SizeType } from '../../types';
|
|
3
3
|
type ItemType = {
|
|
4
4
|
id: string | number;
|
|
@@ -11,9 +11,9 @@ export interface Props extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
|
11
11
|
options: ItemType[];
|
|
12
12
|
outline?: boolean;
|
|
13
13
|
/** エラーの発生時の表示テキスト */
|
|
14
|
-
error?:
|
|
14
|
+
error?: ReactNode;
|
|
15
15
|
/** 捕捉テキスト */
|
|
16
|
-
help?:
|
|
16
|
+
help?: ReactNode;
|
|
17
17
|
/** selectのサイズ */
|
|
18
18
|
inputSize?: SizeType;
|
|
19
19
|
/** optionのカスタムrender */
|
|
@@ -23,5 +23,5 @@ export interface Props extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
|
23
23
|
/** エラーが発生しても、エラーメッセージを出さないようにする */
|
|
24
24
|
noErrorMessage?: boolean;
|
|
25
25
|
}
|
|
26
|
-
declare const
|
|
27
|
-
export default
|
|
26
|
+
declare const Select: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLSelectElement>>;
|
|
27
|
+
export default Select;
|
|
@@ -6,9 +6,9 @@ export interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
|
|
6
6
|
*/
|
|
7
7
|
type?: 'text' | 'number' | 'password' | 'email' | 'tel' | 'search';
|
|
8
8
|
/** エラーの発生時の表示テキスト */
|
|
9
|
-
error?:
|
|
9
|
+
error?: React.ReactNode;
|
|
10
10
|
/** 捕捉テキスト */
|
|
11
|
-
help?:
|
|
11
|
+
help?: React.ReactNode;
|
|
12
12
|
/** ボックス系のデザインでする */
|
|
13
13
|
outline?: boolean;
|
|
14
14
|
/** 左側のアイコン */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { TextareaHTMLAttributes } from 'react';
|
|
2
2
|
export interface Props extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
3
3
|
/** エラーの発生時の表示テキスト */
|
|
4
|
-
error?:
|
|
4
|
+
error?: React.ReactNode;
|
|
5
5
|
/** 捕捉テキスト */
|
|
6
|
-
help?:
|
|
6
|
+
help?: React.ReactNode;
|
|
7
7
|
/** エラーが発生しても、エラーメッセージを出さないようにする */
|
|
8
8
|
noErrorMessage?: boolean;
|
|
9
9
|
}
|
package/dist/index.cjs.js
CHANGED
|
@@ -32,10 +32,10 @@ function Field({
|
|
|
32
32
|
...rest
|
|
33
33
|
}) {
|
|
34
34
|
return /* @__PURE__ */ jsxRuntime.jsxs(Wrapper$6, { ...rest, children: [
|
|
35
|
-
label
|
|
35
|
+
label ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { children: [
|
|
36
36
|
label,
|
|
37
37
|
required && /* @__PURE__ */ jsxRuntime.jsx("i", { children: "*" })
|
|
38
|
-
] }),
|
|
38
|
+
] }) : null,
|
|
39
39
|
children
|
|
40
40
|
] });
|
|
41
41
|
}
|
|
@@ -151,9 +151,9 @@ const TextInput = React.forwardRef(({
|
|
|
151
151
|
maxLength = 255,
|
|
152
152
|
noErrorMessage,
|
|
153
153
|
...rest
|
|
154
|
-
}, ref) => /* @__PURE__ */ jsxRuntime.jsxs(Wrapper$5, { className, outline, error, style, disabled: rest.disabled, children: [
|
|
154
|
+
}, ref) => /* @__PURE__ */ jsxRuntime.jsxs(Wrapper$5, { className, outline, error: !!error, style, disabled: rest.disabled, children: [
|
|
155
155
|
leftIcon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: leftIcon2 }),
|
|
156
|
-
rightIcon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon, { right: true, children: rightIcon2 }),
|
|
156
|
+
rightIcon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon, { $right: true, children: rightIcon2 }),
|
|
157
157
|
/* @__PURE__ */ jsxRuntime.jsx("input", { type, maxLength, ref, ...rest }),
|
|
158
158
|
/* @__PURE__ */ jsxRuntime.jsx(HelpMessage, { help, error, noErrorMessage })
|
|
159
159
|
] }));
|
|
@@ -167,9 +167,14 @@ const Icon = /* @__PURE__ */ styledComponents.styled.span.withConfig({
|
|
|
167
167
|
})(["position:absolute;top:0.375em;bottom:0;z-index:1;color:", ";", " svg,img{height:1em;width:1em;}"], ({
|
|
168
168
|
theme
|
|
169
169
|
}) => theme.border, ({
|
|
170
|
-
right
|
|
171
|
-
}) => right ? rightIcon : leftIcon);
|
|
170
|
+
$right
|
|
171
|
+
}) => $right ? rightIcon : leftIcon);
|
|
172
|
+
function shouldForwardProp$7(name) {
|
|
173
|
+
return name !== "outline" && name !== "error" && name !== "disabled";
|
|
174
|
+
}
|
|
172
175
|
const Wrapper$5 = /* @__PURE__ */ styledComponents.styled.span.withConfig({
|
|
176
|
+
shouldForwardProp: shouldForwardProp$7
|
|
177
|
+
}).withConfig({
|
|
173
178
|
displayName: "TextInput__Wrapper",
|
|
174
179
|
componentId: "sc-1myda3q-1"
|
|
175
180
|
})(["position:relative;display:block;input{max-width:100%;width:100%;height:100%;position:relative;display:block;outline:none;box-shadow:none;appearance:none;text-align:left;color:inherit;padding:", ";border:1px solid ", ";", " ", " transition-property:box-shadow;transition-duration:150ms;transition-timing-function:ease-in-out;&:focus{border-color:", ";box-shadow:", ";}&:disabled,[disabled]{resize:none;}&::placeholder{color:", ";}}&:hover{input:not(:disabled):not(:focus):not(:active){border-color:", ";}", "{color:", ";}}", ""], ({
|
|
@@ -276,7 +281,7 @@ const Checkbox = React.forwardRef(({
|
|
|
276
281
|
React.useImperativeHandle(ref, () => innerRef.current);
|
|
277
282
|
useIsomorphicLayoutEffect(() => {
|
|
278
283
|
if (innerRef.current) {
|
|
279
|
-
innerRef.current.indeterminate = indeterminate;
|
|
284
|
+
innerRef.current.indeterminate = indeterminate || false;
|
|
280
285
|
}
|
|
281
286
|
}, [indeterminate]);
|
|
282
287
|
return /* @__PURE__ */ jsxRuntime.jsxs(Wrapper$4, { className, children: [
|
|
@@ -320,7 +325,7 @@ function ChevronDown(props) {
|
|
|
320
325
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10.6 0L6 4.6 1.4 0 0 1.4l6 6 6-6L10.6 0z", fill: "currentColor" }) });
|
|
321
326
|
}
|
|
322
327
|
|
|
323
|
-
|
|
328
|
+
const Select = React.forwardRef(({
|
|
324
329
|
options = [],
|
|
325
330
|
placeholder,
|
|
326
331
|
render,
|
|
@@ -331,20 +336,20 @@ function Select({
|
|
|
331
336
|
outline,
|
|
332
337
|
optional,
|
|
333
338
|
noErrorMessage,
|
|
334
|
-
innerRef,
|
|
335
339
|
...rest
|
|
336
|
-
}) {
|
|
340
|
+
}, ref) => {
|
|
337
341
|
const list = React.useMemo(() => options.map((item) => typeof item === "string" ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: item, children: render ? render(item) : item }, item) : /* @__PURE__ */ jsxRuntime.jsx("option", { value: item.id, children: render ? render(item.name) : item.name }, item.id)), [options, render]);
|
|
338
342
|
return /* @__PURE__ */ jsxRuntime.jsxs(InputWrapper$1, { className, inputSize, outline, error: !!error, disabled: rest.disabled, children: [
|
|
339
|
-
/* @__PURE__ */ jsxRuntime.jsxs("select", { ...rest, ref
|
|
343
|
+
/* @__PURE__ */ jsxRuntime.jsxs("select", { ...rest, ref, children: [
|
|
340
344
|
placeholder && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: !optional, children: placeholder }),
|
|
341
345
|
list
|
|
342
346
|
] }),
|
|
343
347
|
/* @__PURE__ */ jsxRuntime.jsx(ChevronDown, {}),
|
|
344
348
|
/* @__PURE__ */ jsxRuntime.jsx(HelpMessage, { help, error, noErrorMessage })
|
|
345
349
|
] });
|
|
346
|
-
}
|
|
347
|
-
|
|
350
|
+
});
|
|
351
|
+
Select.displayName = "Select";
|
|
352
|
+
const Select$1 = Select;
|
|
348
353
|
function shouldForwardProp$5(name) {
|
|
349
354
|
return name !== "error" && name !== "disabled" && name !== "inputSize" && name !== "outline";
|
|
350
355
|
}
|
|
@@ -383,13 +388,12 @@ const InputWrapper$1 = /* @__PURE__ */ styledComponents.styled.span.withConfig({
|
|
|
383
388
|
theme
|
|
384
389
|
}) => disabled ? styledComponents.css(["select{", " border-style:dashed;}svg{display:none;}"], disabledColor(theme)) : void 0);
|
|
385
390
|
|
|
386
|
-
|
|
391
|
+
const Radio = React.forwardRef(({
|
|
387
392
|
className,
|
|
388
393
|
style,
|
|
389
394
|
children,
|
|
390
|
-
innerRef,
|
|
391
395
|
...rest
|
|
392
|
-
}) {
|
|
396
|
+
}, ref) => {
|
|
393
397
|
const id = `radio_${rest.name}_${rest.value}`;
|
|
394
398
|
const innerClass = React.useMemo(() => {
|
|
395
399
|
const arr = [];
|
|
@@ -404,10 +408,11 @@ function Radio({
|
|
|
404
408
|
/* @__PURE__ */ jsxRuntime.jsx(Shape, { className: innerClass, children: /* @__PURE__ */ jsxRuntime.jsx("i", {}) }),
|
|
405
409
|
children
|
|
406
410
|
] }),
|
|
407
|
-
/* @__PURE__ */ jsxRuntime.jsx("input", { id, type: "radio", ...rest, ref
|
|
411
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { id, type: "radio", ...rest, ref })
|
|
408
412
|
] });
|
|
409
|
-
}
|
|
410
|
-
|
|
413
|
+
});
|
|
414
|
+
Radio.displayName = "Radio";
|
|
415
|
+
const Radio$1 = Radio;
|
|
411
416
|
const Shape = /* @__PURE__ */ styledComponents.styled.div.withConfig({
|
|
412
417
|
displayName: "Radio__Shape",
|
|
413
418
|
componentId: "sc-13m0vd4-0"
|
|
@@ -683,11 +688,13 @@ function Tooltip$1({
|
|
|
683
688
|
disabled
|
|
684
689
|
}) {
|
|
685
690
|
const [open, setOpen] = React.useState(false);
|
|
691
|
+
const nodeId = react.useId();
|
|
686
692
|
const {
|
|
687
693
|
refs,
|
|
688
694
|
floatingStyles,
|
|
689
695
|
context
|
|
690
696
|
} = react.useFloating({
|
|
697
|
+
nodeId,
|
|
691
698
|
open,
|
|
692
699
|
placement: position,
|
|
693
700
|
middleware: [react.shift(), react.flip(), react.offset({
|
|
@@ -710,7 +717,7 @@ function Tooltip$1({
|
|
|
710
717
|
ref: refs.setReference,
|
|
711
718
|
...getReferenceProps()
|
|
712
719
|
}),
|
|
713
|
-
/* @__PURE__ */ jsxRuntime.jsx(Portal$1, { children: open ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
720
|
+
/* @__PURE__ */ jsxRuntime.jsx(Portal$1, { children: open ? /* @__PURE__ */ jsxRuntime.jsx(TooltipWrapper, { className, ref: refs.setFloating, role: "tooltip", $color: color, style: floatingStyles, ...getFloatingProps(), children: label }) : null })
|
|
714
721
|
] });
|
|
715
722
|
}
|
|
716
723
|
const TooltipWrapper = /* @__PURE__ */ styledComponents.styled.div.withConfig({
|
|
@@ -750,6 +757,7 @@ function stopPropagation$1(e) {
|
|
|
750
757
|
return;
|
|
751
758
|
e.stopPropagation();
|
|
752
759
|
}
|
|
760
|
+
|
|
753
761
|
const Popover = React.forwardRef(({
|
|
754
762
|
position,
|
|
755
763
|
label,
|
|
@@ -765,11 +773,13 @@ const Popover = React.forwardRef(({
|
|
|
765
773
|
...rest
|
|
766
774
|
}, ref) => {
|
|
767
775
|
const [open, setOpen] = React.useState(false);
|
|
776
|
+
const nodeId = react.useId();
|
|
768
777
|
const {
|
|
769
778
|
refs,
|
|
770
779
|
floatingStyles,
|
|
771
780
|
context
|
|
772
781
|
} = react.useFloating({
|
|
782
|
+
nodeId,
|
|
773
783
|
placement: position,
|
|
774
784
|
middleware: [react.shift(), react.flip({
|
|
775
785
|
fallbackAxisSideDirection: "end"
|
|
@@ -820,10 +830,10 @@ const Popover = React.forwardRef(({
|
|
|
820
830
|
}),
|
|
821
831
|
/* @__PURE__ */ jsxRuntime.jsx(Portal$1, { children: open ? /* @__PURE__ */ jsxRuntime.jsx(react.FloatingOverlay, { "data-testid": "visits-style-shadow", onClick: handleBlur, style: {
|
|
822
832
|
zIndex: 9996
|
|
823
|
-
}, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
833
|
+
}, children: /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { role: "tooltip", ref: refs.setFloating, color, style: floatingStyles, ...getFloatingProps({
|
|
824
834
|
...rest,
|
|
825
835
|
onClick: stopPropagation$1
|
|
826
|
-
}), children }) })
|
|
836
|
+
}), children }) }) : null })
|
|
827
837
|
] });
|
|
828
838
|
});
|
|
829
839
|
Popover.displayName = "Popover";
|
|
@@ -974,7 +984,8 @@ function Toast({
|
|
|
974
984
|
clear,
|
|
975
985
|
fixed,
|
|
976
986
|
margin = "16px",
|
|
977
|
-
position = "top-left"
|
|
987
|
+
position = "top-left",
|
|
988
|
+
space = "16px"
|
|
978
989
|
}) {
|
|
979
990
|
const style = React.useMemo(() => {
|
|
980
991
|
const base = {
|
|
@@ -998,12 +1009,14 @@ function Toast({
|
|
|
998
1009
|
}
|
|
999
1010
|
return base;
|
|
1000
1011
|
}, [fixed, margin, position]);
|
|
1001
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Portal$1, { children: /* @__PURE__ */ jsxRuntime.jsx(ToastList, { style, children: toasts.map((props) => /* @__PURE__ */ React.createElement(ToastItem, { ...props, key: props.id, clear })) }) });
|
|
1012
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Portal$1, { children: /* @__PURE__ */ jsxRuntime.jsx(ToastList, { style, $space: space, children: toasts.map((props) => /* @__PURE__ */ React.createElement(ToastItem, { ...props, key: props.id, clear })) }) });
|
|
1002
1013
|
}
|
|
1003
1014
|
const ToastList = /* @__PURE__ */ styledComponents.styled.ul.withConfig({
|
|
1004
1015
|
displayName: "Toast__ToastList",
|
|
1005
1016
|
componentId: "sc-8192b2-0"
|
|
1006
|
-
})(["display:flex;flex-direction:column;z-index:9999;pointer-events:none;overflow:hidden;li + li{margin-top:
|
|
1017
|
+
})(["display:flex;flex-direction:column;z-index:9999;pointer-events:none;overflow:hidden;li + li{margin-top:", ";}"], ({
|
|
1018
|
+
$space
|
|
1019
|
+
}) => $space);
|
|
1007
1020
|
|
|
1008
1021
|
function getColor$1({
|
|
1009
1022
|
theme,
|
|
@@ -1478,9 +1491,9 @@ exports.Placeholder = index$2;
|
|
|
1478
1491
|
exports.Popover = Popover$1;
|
|
1479
1492
|
exports.Portal = Portal$1;
|
|
1480
1493
|
exports.Progress = Progress;
|
|
1481
|
-
exports.Radio =
|
|
1494
|
+
exports.Radio = Radio$1;
|
|
1482
1495
|
exports.Row = Row;
|
|
1483
|
-
exports.Select =
|
|
1496
|
+
exports.Select = Select$1;
|
|
1484
1497
|
exports.Spinner = Spinner$1;
|
|
1485
1498
|
exports.Switch = Switch$1;
|
|
1486
1499
|
exports.Table = index$1;
|
package/dist/index.es.js
CHANGED
|
@@ -2,7 +2,7 @@ import { styled, css, keyframes } from 'styled-components';
|
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import React, { forwardRef, useLayoutEffect, useEffect, useRef, useMemo, useImperativeHandle, useState, cloneElement, Children, useCallback, createElement } from 'react';
|
|
4
4
|
import { getLuminance, transparentize, darken } from 'polished';
|
|
5
|
-
import { useFloating, shift, flip, offset, useInteractions, useHover, useClientPoint,
|
|
5
|
+
import { useId, useFloating, shift, flip, offset, useInteractions, useHover, useClientPoint, autoUpdate, useClick, FloatingOverlay, useDismiss, useTransitionStyles } from '@floating-ui/react';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
|
|
8
8
|
const Wrapper$6 = /* @__PURE__ */ styled.div.withConfig({
|
|
@@ -24,10 +24,10 @@ function Field({
|
|
|
24
24
|
...rest
|
|
25
25
|
}) {
|
|
26
26
|
return /* @__PURE__ */ jsxs(Wrapper$6, { ...rest, children: [
|
|
27
|
-
label
|
|
27
|
+
label ? /* @__PURE__ */ jsxs(Label, { children: [
|
|
28
28
|
label,
|
|
29
29
|
required && /* @__PURE__ */ jsx("i", { children: "*" })
|
|
30
|
-
] }),
|
|
30
|
+
] }) : null,
|
|
31
31
|
children
|
|
32
32
|
] });
|
|
33
33
|
}
|
|
@@ -143,9 +143,9 @@ const TextInput = forwardRef(({
|
|
|
143
143
|
maxLength = 255,
|
|
144
144
|
noErrorMessage,
|
|
145
145
|
...rest
|
|
146
|
-
}, ref) => /* @__PURE__ */ jsxs(Wrapper$5, { className, outline, error, style, disabled: rest.disabled, children: [
|
|
146
|
+
}, ref) => /* @__PURE__ */ jsxs(Wrapper$5, { className, outline, error: !!error, style, disabled: rest.disabled, children: [
|
|
147
147
|
leftIcon2 && /* @__PURE__ */ jsx(Icon, { children: leftIcon2 }),
|
|
148
|
-
rightIcon2 && /* @__PURE__ */ jsx(Icon, { right: true, children: rightIcon2 }),
|
|
148
|
+
rightIcon2 && /* @__PURE__ */ jsx(Icon, { $right: true, children: rightIcon2 }),
|
|
149
149
|
/* @__PURE__ */ jsx("input", { type, maxLength, ref, ...rest }),
|
|
150
150
|
/* @__PURE__ */ jsx(HelpMessage, { help, error, noErrorMessage })
|
|
151
151
|
] }));
|
|
@@ -159,9 +159,14 @@ const Icon = /* @__PURE__ */ styled.span.withConfig({
|
|
|
159
159
|
})(["position:absolute;top:0.375em;bottom:0;z-index:1;color:", ";", " svg,img{height:1em;width:1em;}"], ({
|
|
160
160
|
theme
|
|
161
161
|
}) => theme.border, ({
|
|
162
|
-
right
|
|
163
|
-
}) => right ? rightIcon : leftIcon);
|
|
162
|
+
$right
|
|
163
|
+
}) => $right ? rightIcon : leftIcon);
|
|
164
|
+
function shouldForwardProp$7(name) {
|
|
165
|
+
return name !== "outline" && name !== "error" && name !== "disabled";
|
|
166
|
+
}
|
|
164
167
|
const Wrapper$5 = /* @__PURE__ */ styled.span.withConfig({
|
|
168
|
+
shouldForwardProp: shouldForwardProp$7
|
|
169
|
+
}).withConfig({
|
|
165
170
|
displayName: "TextInput__Wrapper",
|
|
166
171
|
componentId: "sc-1myda3q-1"
|
|
167
172
|
})(["position:relative;display:block;input{max-width:100%;width:100%;height:100%;position:relative;display:block;outline:none;box-shadow:none;appearance:none;text-align:left;color:inherit;padding:", ";border:1px solid ", ";", " ", " transition-property:box-shadow;transition-duration:150ms;transition-timing-function:ease-in-out;&:focus{border-color:", ";box-shadow:", ";}&:disabled,[disabled]{resize:none;}&::placeholder{color:", ";}}&:hover{input:not(:disabled):not(:focus):not(:active){border-color:", ";}", "{color:", ";}}", ""], ({
|
|
@@ -268,7 +273,7 @@ const Checkbox = forwardRef(({
|
|
|
268
273
|
useImperativeHandle(ref, () => innerRef.current);
|
|
269
274
|
useIsomorphicLayoutEffect(() => {
|
|
270
275
|
if (innerRef.current) {
|
|
271
|
-
innerRef.current.indeterminate = indeterminate;
|
|
276
|
+
innerRef.current.indeterminate = indeterminate || false;
|
|
272
277
|
}
|
|
273
278
|
}, [indeterminate]);
|
|
274
279
|
return /* @__PURE__ */ jsxs(Wrapper$4, { className, children: [
|
|
@@ -312,7 +317,7 @@ function ChevronDown(props) {
|
|
|
312
317
|
return /* @__PURE__ */ jsx("svg", { width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M10.6 0L6 4.6 1.4 0 0 1.4l6 6 6-6L10.6 0z", fill: "currentColor" }) });
|
|
313
318
|
}
|
|
314
319
|
|
|
315
|
-
|
|
320
|
+
const Select = forwardRef(({
|
|
316
321
|
options = [],
|
|
317
322
|
placeholder,
|
|
318
323
|
render,
|
|
@@ -323,20 +328,20 @@ function Select({
|
|
|
323
328
|
outline,
|
|
324
329
|
optional,
|
|
325
330
|
noErrorMessage,
|
|
326
|
-
innerRef,
|
|
327
331
|
...rest
|
|
328
|
-
}) {
|
|
332
|
+
}, ref) => {
|
|
329
333
|
const list = useMemo(() => options.map((item) => typeof item === "string" ? /* @__PURE__ */ jsx("option", { value: item, children: render ? render(item) : item }, item) : /* @__PURE__ */ jsx("option", { value: item.id, children: render ? render(item.name) : item.name }, item.id)), [options, render]);
|
|
330
334
|
return /* @__PURE__ */ jsxs(InputWrapper$1, { className, inputSize, outline, error: !!error, disabled: rest.disabled, children: [
|
|
331
|
-
/* @__PURE__ */ jsxs("select", { ...rest, ref
|
|
335
|
+
/* @__PURE__ */ jsxs("select", { ...rest, ref, children: [
|
|
332
336
|
placeholder && /* @__PURE__ */ jsx("option", { value: "", disabled: !optional, children: placeholder }),
|
|
333
337
|
list
|
|
334
338
|
] }),
|
|
335
339
|
/* @__PURE__ */ jsx(ChevronDown, {}),
|
|
336
340
|
/* @__PURE__ */ jsx(HelpMessage, { help, error, noErrorMessage })
|
|
337
341
|
] });
|
|
338
|
-
}
|
|
339
|
-
|
|
342
|
+
});
|
|
343
|
+
Select.displayName = "Select";
|
|
344
|
+
const Select$1 = Select;
|
|
340
345
|
function shouldForwardProp$5(name) {
|
|
341
346
|
return name !== "error" && name !== "disabled" && name !== "inputSize" && name !== "outline";
|
|
342
347
|
}
|
|
@@ -375,13 +380,12 @@ const InputWrapper$1 = /* @__PURE__ */ styled.span.withConfig({
|
|
|
375
380
|
theme
|
|
376
381
|
}) => disabled ? css(["select{", " border-style:dashed;}svg{display:none;}"], disabledColor(theme)) : void 0);
|
|
377
382
|
|
|
378
|
-
|
|
383
|
+
const Radio = forwardRef(({
|
|
379
384
|
className,
|
|
380
385
|
style,
|
|
381
386
|
children,
|
|
382
|
-
innerRef,
|
|
383
387
|
...rest
|
|
384
|
-
}) {
|
|
388
|
+
}, ref) => {
|
|
385
389
|
const id = `radio_${rest.name}_${rest.value}`;
|
|
386
390
|
const innerClass = useMemo(() => {
|
|
387
391
|
const arr = [];
|
|
@@ -396,10 +400,11 @@ function Radio({
|
|
|
396
400
|
/* @__PURE__ */ jsx(Shape, { className: innerClass, children: /* @__PURE__ */ jsx("i", {}) }),
|
|
397
401
|
children
|
|
398
402
|
] }),
|
|
399
|
-
/* @__PURE__ */ jsx("input", { id, type: "radio", ...rest, ref
|
|
403
|
+
/* @__PURE__ */ jsx("input", { id, type: "radio", ...rest, ref })
|
|
400
404
|
] });
|
|
401
|
-
}
|
|
402
|
-
|
|
405
|
+
});
|
|
406
|
+
Radio.displayName = "Radio";
|
|
407
|
+
const Radio$1 = Radio;
|
|
403
408
|
const Shape = /* @__PURE__ */ styled.div.withConfig({
|
|
404
409
|
displayName: "Radio__Shape",
|
|
405
410
|
componentId: "sc-13m0vd4-0"
|
|
@@ -675,11 +680,13 @@ function Tooltip$1({
|
|
|
675
680
|
disabled
|
|
676
681
|
}) {
|
|
677
682
|
const [open, setOpen] = useState(false);
|
|
683
|
+
const nodeId = useId();
|
|
678
684
|
const {
|
|
679
685
|
refs,
|
|
680
686
|
floatingStyles,
|
|
681
687
|
context
|
|
682
688
|
} = useFloating({
|
|
689
|
+
nodeId,
|
|
683
690
|
open,
|
|
684
691
|
placement: position,
|
|
685
692
|
middleware: [shift(), flip(), offset({
|
|
@@ -702,7 +709,7 @@ function Tooltip$1({
|
|
|
702
709
|
ref: refs.setReference,
|
|
703
710
|
...getReferenceProps()
|
|
704
711
|
}),
|
|
705
|
-
/* @__PURE__ */ jsx(Portal$1, { children: open ? /* @__PURE__ */ jsx(
|
|
712
|
+
/* @__PURE__ */ jsx(Portal$1, { children: open ? /* @__PURE__ */ jsx(TooltipWrapper, { className, ref: refs.setFloating, role: "tooltip", $color: color, style: floatingStyles, ...getFloatingProps(), children: label }) : null })
|
|
706
713
|
] });
|
|
707
714
|
}
|
|
708
715
|
const TooltipWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
@@ -742,6 +749,7 @@ function stopPropagation$1(e) {
|
|
|
742
749
|
return;
|
|
743
750
|
e.stopPropagation();
|
|
744
751
|
}
|
|
752
|
+
|
|
745
753
|
const Popover = forwardRef(({
|
|
746
754
|
position,
|
|
747
755
|
label,
|
|
@@ -757,11 +765,13 @@ const Popover = forwardRef(({
|
|
|
757
765
|
...rest
|
|
758
766
|
}, ref) => {
|
|
759
767
|
const [open, setOpen] = useState(false);
|
|
768
|
+
const nodeId = useId();
|
|
760
769
|
const {
|
|
761
770
|
refs,
|
|
762
771
|
floatingStyles,
|
|
763
772
|
context
|
|
764
773
|
} = useFloating({
|
|
774
|
+
nodeId,
|
|
765
775
|
placement: position,
|
|
766
776
|
middleware: [shift(), flip({
|
|
767
777
|
fallbackAxisSideDirection: "end"
|
|
@@ -812,10 +822,10 @@ const Popover = forwardRef(({
|
|
|
812
822
|
}),
|
|
813
823
|
/* @__PURE__ */ jsx(Portal$1, { children: open ? /* @__PURE__ */ jsx(FloatingOverlay, { "data-testid": "visits-style-shadow", onClick: handleBlur, style: {
|
|
814
824
|
zIndex: 9996
|
|
815
|
-
}, children: /* @__PURE__ */ jsx(
|
|
825
|
+
}, children: /* @__PURE__ */ jsx(Tooltip, { role: "tooltip", ref: refs.setFloating, color, style: floatingStyles, ...getFloatingProps({
|
|
816
826
|
...rest,
|
|
817
827
|
onClick: stopPropagation$1
|
|
818
|
-
}), children }) })
|
|
828
|
+
}), children }) }) : null })
|
|
819
829
|
] });
|
|
820
830
|
});
|
|
821
831
|
Popover.displayName = "Popover";
|
|
@@ -966,7 +976,8 @@ function Toast({
|
|
|
966
976
|
clear,
|
|
967
977
|
fixed,
|
|
968
978
|
margin = "16px",
|
|
969
|
-
position = "top-left"
|
|
979
|
+
position = "top-left",
|
|
980
|
+
space = "16px"
|
|
970
981
|
}) {
|
|
971
982
|
const style = useMemo(() => {
|
|
972
983
|
const base = {
|
|
@@ -990,12 +1001,14 @@ function Toast({
|
|
|
990
1001
|
}
|
|
991
1002
|
return base;
|
|
992
1003
|
}, [fixed, margin, position]);
|
|
993
|
-
return /* @__PURE__ */ jsx(Portal$1, { children: /* @__PURE__ */ jsx(ToastList, { style, children: toasts.map((props) => /* @__PURE__ */ createElement(ToastItem, { ...props, key: props.id, clear })) }) });
|
|
1004
|
+
return /* @__PURE__ */ jsx(Portal$1, { children: /* @__PURE__ */ jsx(ToastList, { style, $space: space, children: toasts.map((props) => /* @__PURE__ */ createElement(ToastItem, { ...props, key: props.id, clear })) }) });
|
|
994
1005
|
}
|
|
995
1006
|
const ToastList = /* @__PURE__ */ styled.ul.withConfig({
|
|
996
1007
|
displayName: "Toast__ToastList",
|
|
997
1008
|
componentId: "sc-8192b2-0"
|
|
998
|
-
})(["display:flex;flex-direction:column;z-index:9999;pointer-events:none;overflow:hidden;li + li{margin-top:
|
|
1009
|
+
})(["display:flex;flex-direction:column;z-index:9999;pointer-events:none;overflow:hidden;li + li{margin-top:", ";}"], ({
|
|
1010
|
+
$space
|
|
1011
|
+
}) => $space);
|
|
999
1012
|
|
|
1000
1013
|
function getColor$1({
|
|
1001
1014
|
theme,
|
|
@@ -1443,4 +1456,4 @@ const normalized = /* @__PURE__ */ css(["*,::after,::before{box-sizing:border-bo
|
|
|
1443
1456
|
}) => theme.link);
|
|
1444
1457
|
const normalized$1 = normalized;
|
|
1445
1458
|
|
|
1446
|
-
export { Accordion, AppBar, Box, Button, ButtonGroup, Checkbox$1 as Checkbox, Col$1 as Col, Container, index$3 as Content, index as Divider, Field, Approved as IconApproved, ChevronDown as IconArrowDown, ChevronLeftRound as IconChevronLeftRound, ChevronRightRound as IconChevronRightRound, Close as IconClose, FileRound as IconFileRound, Pencil as IconPencil, PencilSimple as IconPencilSimple, Plus as IconPlus, Refresh as IconRefresh, User as IconUser, Modal, index$2 as Placeholder, Popover$1 as Popover, Portal$1 as Portal, Progress,
|
|
1459
|
+
export { Accordion, AppBar, Box, Button, ButtonGroup, Checkbox$1 as Checkbox, Col$1 as Col, Container, index$3 as Content, index as Divider, Field, Approved as IconApproved, ChevronDown as IconArrowDown, ChevronLeftRound as IconChevronLeftRound, ChevronRightRound as IconChevronRightRound, Close as IconClose, FileRound as IconFileRound, Pencil as IconPencil, PencilSimple as IconPencilSimple, Plus as IconPlus, Refresh as IconRefresh, User as IconUser, Modal, index$2 as Placeholder, Popover$1 as Popover, Portal$1 as Portal, Progress, Radio$1 as Radio, Row, Select$1 as Select, Spinner$1 as Spinner, Switch$1 as Switch, index$1 as Table, Tag, TextButton, TextInput$1 as TextInput, Textarea$1 as Textarea, Toast, Tooltip$1 as Tooltip, Arrow as arrow, boxShadow, theme$1 as defaultTheme, findColorInvert, hamburger as hambuger, mediaDesktop, mediaFullHD, mediaMobile, mediaTablet, mediaUntilFullHD, normalized$1 as normalizeStyle, setSize };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "visits-style",
|
|
3
3
|
"repository": "https://github.com/visits-works/visits-style",
|
|
4
4
|
"homepage": "https://github.com/visits-works/visits-style",
|
|
5
|
-
"version": "1.4.
|
|
5
|
+
"version": "1.4.3",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.cjs.js",
|
|
8
8
|
"module": "./dist/index.es.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"styled-components": ">=6.0.2"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@floating-ui/react": "^0.24.
|
|
30
|
+
"@floating-ui/react": "^0.24.5",
|
|
31
31
|
"polished": "^4.2.2"
|
|
32
32
|
}
|
|
33
33
|
}
|