@soul-refiner/design-system 0.2.57 → 0.2.59
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/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/input/select/index.d.ts +2 -0
- package/dist/components/input/select/index.js +1 -0
- package/dist/components/input/select/select.d.ts +9 -0
- package/dist/components/input/select/select.js +46 -0
- package/dist/components/surfaces/modal/modal.d.ts +1 -1
- package/dist/components/surfaces/modal/modal.js +10 -2
- package/package.json +1 -1
|
@@ -8,5 +8,7 @@ export { Radio } from './radio';
|
|
|
8
8
|
export type { RadioProps } from './radio';
|
|
9
9
|
export { Search } from './search';
|
|
10
10
|
export type { SearchProps } from './search';
|
|
11
|
+
export { Select } from './select';
|
|
12
|
+
export type { SelectProps } from './select';
|
|
11
13
|
export { TextInput } from './text_input';
|
|
12
14
|
export type { TextInputProps } from './text_input';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Select } from './select';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SelectProps {
|
|
3
|
+
label: string | React.ReactNode;
|
|
4
|
+
onClick: (event: React.MouseEvent) => void;
|
|
5
|
+
selected: boolean;
|
|
6
|
+
sx?: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const Select: ({ label, onClick, selected, sx, value, }: SelectProps) => React.JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { P } from 'components/atoms/typography/paragraph';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
export const Select = ({ label, onClick, selected, sx, value, }) => {
|
|
6
|
+
return (React.createElement(Label, { onClick: onClick, "$sx": sx },
|
|
7
|
+
React.createElement("input", { value: value, type: "radio", checked: selected, readOnly: true }),
|
|
8
|
+
React.createElement(SelectBox, { "$selected": selected }),
|
|
9
|
+
React.createElement(P, { as: "div" }, label)));
|
|
10
|
+
};
|
|
11
|
+
const Label = styled.div `
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-flow: row nowrap;
|
|
14
|
+
gap: 24px;
|
|
15
|
+
align-items: center;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
user-select: none;
|
|
18
|
+
|
|
19
|
+
input {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
${({ $sx }) => ($sx ? $sx : '')}
|
|
23
|
+
`;
|
|
24
|
+
const SelectBox = styled.div `
|
|
25
|
+
position: relative;
|
|
26
|
+
width: 18px;
|
|
27
|
+
height: 18px;
|
|
28
|
+
border: 1px solid var(--color-grey-8);
|
|
29
|
+
border-radius: 4px;
|
|
30
|
+
|
|
31
|
+
${({ $selected }) => $selected
|
|
32
|
+
? `
|
|
33
|
+
background-color: var(--color-primary-blue-2);
|
|
34
|
+
border-color: var(--color-primary-blue-2);
|
|
35
|
+
|
|
36
|
+
&::after {
|
|
37
|
+
position: absolute;
|
|
38
|
+
content: '✔';
|
|
39
|
+
top: -1px;
|
|
40
|
+
left: 4px;
|
|
41
|
+
font-size: 13px;
|
|
42
|
+
color: var(--color-white);
|
|
43
|
+
font-weight: 500;
|
|
44
|
+
}`
|
|
45
|
+
: ''}
|
|
46
|
+
`;
|
|
@@ -23,7 +23,7 @@ declare const Modal: {
|
|
|
23
23
|
Dismiss: {
|
|
24
24
|
({ children: child, setClosed, }: {
|
|
25
25
|
children: React.ReactElement;
|
|
26
|
-
setClosed?: (() => void) | undefined;
|
|
26
|
+
setClosed?: ((event?: React.MouseEvent) => void) | undefined;
|
|
27
27
|
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
28
28
|
displayName: string;
|
|
29
29
|
};
|
|
@@ -34,7 +34,10 @@ const ModalTrigger = ({ children: child, }) => {
|
|
|
34
34
|
const [, setOpen] = React.useContext(ModalContext);
|
|
35
35
|
return (child &&
|
|
36
36
|
React.cloneElement(child, {
|
|
37
|
-
onClick: callAll(() => setOpen(true), child.props.onClick)
|
|
37
|
+
onClick: callAll(() => setOpen(true), child.props.onClick, (event) => {
|
|
38
|
+
event?.stopPropagation();
|
|
39
|
+
event?.preventDefault();
|
|
40
|
+
}),
|
|
38
41
|
}));
|
|
39
42
|
};
|
|
40
43
|
ModalTrigger.displayName = 'Modal.Trigger';
|
|
@@ -43,7 +46,11 @@ const ModalDismiss = ({ children: child, setClosed, }) => {
|
|
|
43
46
|
const [, setOpen] = React.useContext(ModalContext);
|
|
44
47
|
return (child &&
|
|
45
48
|
React.cloneElement(child, {
|
|
46
|
-
onClick: callAll(() => setOpen(false), child.props.onClick, () =>
|
|
49
|
+
onClick: callAll(() => setOpen(false), child.props.onClick, (event) => {
|
|
50
|
+
setClosed && setClosed();
|
|
51
|
+
event?.stopPropagation();
|
|
52
|
+
event?.preventDefault();
|
|
53
|
+
}),
|
|
47
54
|
}));
|
|
48
55
|
};
|
|
49
56
|
ModalDismiss.displayName = 'Modal.Dismiss';
|
|
@@ -54,6 +61,7 @@ const ModalContent = ({ backgroundDark = true, children, footer, header, setClos
|
|
|
54
61
|
if (event.currentTarget != event.target)
|
|
55
62
|
return;
|
|
56
63
|
event.stopPropagation();
|
|
64
|
+
event.preventDefault();
|
|
57
65
|
setClosed ? setClosed() : setOpen(false);
|
|
58
66
|
};
|
|
59
67
|
return (React.createElement(Wrapper, { "$backgroundDark": backgroundDark, "$open": open, onClick: handleOutsideClick },
|