agroptima-design-system 0.35.0 → 0.36.0-beta.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/package.json +3 -3
- package/src/atoms/Button/BaseButton.tsx +1 -2
- package/src/atoms/Button/Button.tsx +2 -6
- package/src/atoms/Card/Card.scss +6 -6
- package/src/atoms/Card/CardContent.tsx +1 -1
- package/src/atoms/Card/CardFooter.tsx +1 -1
- package/src/atoms/Card/CardHeader.tsx +2 -4
- package/src/atoms/Checkbox.tsx +3 -4
- package/src/atoms/{Collapsible/Collapsible.scss → Collapsible.scss} +45 -27
- package/src/atoms/{Collapsible/Collapsible.tsx → Collapsible.tsx} +10 -10
- package/src/atoms/DatePicker/DateRangePicker.tsx +0 -3
- package/src/atoms/DatePicker/DateSinglePicker.tsx +0 -3
- package/src/atoms/Input.scss +0 -31
- package/src/atoms/Input.tsx +1 -7
- package/src/atoms/Modal/ModalDialog.tsx +0 -18
- package/src/atoms/Multiselect.tsx +0 -13
- package/src/atoms/Popover/Popover.tsx +1 -1
- package/src/atoms/QuantitySelector.tsx +1 -7
- package/src/atoms/Select/Select.scss +8 -14
- package/src/atoms/Select/Select.tsx +2 -13
- package/src/atoms/Select/SelectItem.tsx +3 -18
- package/src/atoms/Select/SelectItems.tsx +2 -19
- package/src/atoms/Select/SelectTrigger.tsx +0 -4
- package/src/atoms/TextArea.tsx +0 -3
- package/src/hooks/useOpen.ts +0 -1
- package/src/icons/index.tsx +0 -6
- package/src/stories/Button.stories.ts +0 -4
- package/src/stories/Changelog.mdx +4 -12
- package/src/stories/{Checkbox.stories.ts → Checkbox.stories.tsx} +17 -4
- package/src/stories/{Collapsible.stories.tsx → Collapsible.stories.js} +37 -64
- package/src/stories/DateRangePicker.stories.ts +0 -5
- package/src/stories/DateSinglePicker.stories.ts +0 -5
- package/src/stories/Drawer.stories.js +2 -2
- package/src/stories/Input.stories.ts +0 -32
- package/src/stories/Modal.stories.js +444 -0
- package/src/stories/Multiselect.stories.ts +0 -4
- package/src/stories/QuantitySelector.stories.ts +0 -5
- package/src/stories/Select.stories.ts +0 -4
- package/src/stories/TextArea.stories.ts +0 -4
- package/tests/Card.spec.tsx +3 -3
- package/tests/Checkbox.spec.tsx +6 -4
- package/tests/Modal.spec.tsx +11 -79
- package/tests/Select.spec.tsx +0 -17
- package/tsconfig.json +1 -0
- package/src/atoms/Collapsible/index.ts +0 -5
- package/src/atoms/InputWithButton/InputWithButton.scss +0 -11
- package/src/atoms/InputWithButton/InputWithButton.tsx +0 -10
- package/src/atoms/InputWithButton/index.tsx +0 -3
- package/src/icons/classic-view.svg +0 -1
- package/src/icons/duplicate.svg +0 -1
- package/src/icons/new-view.svg +0 -1
- package/src/stories/InputWithButton.stories.tsx +0 -75
- package/src/stories/Modal.stories.tsx +0 -341
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agroptima-design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0-beta.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "npm run storybook",
|
|
6
6
|
"storybook": "storybook dev -p 6006 --ci",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@storybook/test": "^8.6.12",
|
|
37
37
|
"@svgr/webpack": "^8.1.0",
|
|
38
38
|
"@testing-library/jest-dom": "^6.6.3",
|
|
39
|
-
"@testing-library/react": "^16.
|
|
40
|
-
"@testing-library/user-event": "^14.
|
|
39
|
+
"@testing-library/react": "^16.1.0",
|
|
40
|
+
"@testing-library/user-event": "^14.5.2",
|
|
41
41
|
"@types/jest": "^29.5.14",
|
|
42
42
|
"@types/jest-axe": "^3.5.9",
|
|
43
43
|
"@types/node": "^22.10.5",
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import NextLink, { type LinkProps } from 'next/link'
|
|
2
|
-
import type { AnchorHTMLAttributes, ButtonHTMLAttributes
|
|
2
|
+
import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react'
|
|
3
3
|
|
|
4
4
|
interface CommonProps {
|
|
5
5
|
disabled?: boolean
|
|
6
6
|
visible?: boolean
|
|
7
7
|
prefetch?: boolean
|
|
8
|
-
ref?: Ref<HTMLAnchorElement | HTMLButtonElement | null>
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
type HtmlButtonProps = ButtonHTMLAttributes<HTMLButtonElement>
|
|
@@ -13,7 +13,6 @@ interface CustomProps {
|
|
|
13
13
|
variant?: ButtonVariant
|
|
14
14
|
loading?: boolean
|
|
15
15
|
disabled?: boolean
|
|
16
|
-
fullWidth?: boolean
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
export type ButtonProps = CustomProps & BaseButtonProps
|
|
@@ -44,16 +43,13 @@ export function Button({
|
|
|
44
43
|
leftIcon,
|
|
45
44
|
rightIcon,
|
|
46
45
|
disabled,
|
|
47
|
-
className,
|
|
48
46
|
variant = 'primary',
|
|
49
47
|
loading = false,
|
|
50
|
-
|
|
48
|
+
className,
|
|
51
49
|
...props
|
|
52
50
|
}: ButtonProps) {
|
|
53
51
|
const leftIconName = loading ? 'Loading' : leftIcon
|
|
54
|
-
const cssClasses = classNames(className, 'button', variant
|
|
55
|
-
'full-width': fullWidth,
|
|
56
|
-
})
|
|
52
|
+
const cssClasses = classNames(className, 'button', variant)
|
|
57
53
|
|
|
58
54
|
return (
|
|
59
55
|
<BaseButton
|
package/src/atoms/Card/Card.scss
CHANGED
|
@@ -27,13 +27,13 @@ a.card {
|
|
|
27
27
|
gap: config.$space-4x;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.
|
|
30
|
+
.header {
|
|
31
31
|
display: flex;
|
|
32
32
|
flex-direction: row;
|
|
33
33
|
justify-content: space-between;
|
|
34
34
|
gap: config.$space-1x;
|
|
35
35
|
|
|
36
|
-
.
|
|
36
|
+
.title {
|
|
37
37
|
overflow: hidden;
|
|
38
38
|
text-overflow: ellipsis;
|
|
39
39
|
line-clamp: 2;
|
|
@@ -41,16 +41,16 @@ a.card {
|
|
|
41
41
|
display: -webkit-box;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
> .
|
|
44
|
+
> .bold {
|
|
45
45
|
@include typography.body-bold;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
.
|
|
49
|
+
.content {
|
|
50
50
|
margin-bottom: config.$space-1x;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
.
|
|
53
|
+
.footer {
|
|
54
54
|
display: flex;
|
|
55
55
|
flex-direction: column;
|
|
56
56
|
gap: config.$space-2x;
|
|
@@ -77,7 +77,7 @@ a.card {
|
|
|
77
77
|
@include typography.body-regular-disabled;
|
|
78
78
|
background: color_alias.$neutral-color-50;
|
|
79
79
|
|
|
80
|
-
.
|
|
80
|
+
.header .bold {
|
|
81
81
|
color: color_alias.$neutral-color-400;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -10,7 +10,7 @@ export function CardContent({
|
|
|
10
10
|
children,
|
|
11
11
|
...props
|
|
12
12
|
}: CardContentProps): React.JSX.Element {
|
|
13
|
-
const cssClasses = classNames('
|
|
13
|
+
const cssClasses = classNames('content', className)
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<div className={cssClasses} {...props}>
|
|
@@ -10,7 +10,7 @@ export function CardFooter({
|
|
|
10
10
|
children,
|
|
11
11
|
...props
|
|
12
12
|
}: CardFooterProps): React.JSX.Element {
|
|
13
|
-
const cssClasses = classNames('
|
|
13
|
+
const cssClasses = classNames('footer', className)
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<div className={cssClasses} {...props}>
|
|
@@ -14,13 +14,11 @@ export function CardHeader({
|
|
|
14
14
|
children,
|
|
15
15
|
...props
|
|
16
16
|
}: CardHeaderProps): React.JSX.Element {
|
|
17
|
-
const cssClasses = classNames('
|
|
17
|
+
const cssClasses = classNames('header', className, { bold: isBold })
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
20
|
<div className={cssClasses} {...props}>
|
|
21
|
-
<span className={classNames('
|
|
22
|
-
{title}
|
|
23
|
-
</span>
|
|
21
|
+
<span className={classNames('title', { bold: isBold })}>{title}</span>
|
|
24
22
|
{children && <div className="actions">{children}</div>}
|
|
25
23
|
</div>
|
|
26
24
|
)
|
package/src/atoms/Checkbox.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import { Label } from './Label'
|
|
|
6
6
|
export type Variant = 'primary'
|
|
7
7
|
|
|
8
8
|
export interface CheckboxProps extends React.ComponentPropsWithoutRef<'input'> {
|
|
9
|
-
label: string
|
|
10
9
|
accessibilityLabel?: string
|
|
11
10
|
hideLabel?: boolean
|
|
12
11
|
variant?: Variant
|
|
@@ -15,7 +14,6 @@ export interface CheckboxProps extends React.ComponentPropsWithoutRef<'input'> {
|
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
export function Checkbox({
|
|
18
|
-
label,
|
|
19
17
|
accessibilityLabel,
|
|
20
18
|
hideLabel = false,
|
|
21
19
|
disabled,
|
|
@@ -24,6 +22,7 @@ export function Checkbox({
|
|
|
24
22
|
indeterminate = false,
|
|
25
23
|
name,
|
|
26
24
|
className,
|
|
25
|
+
children,
|
|
27
26
|
...props
|
|
28
27
|
}: CheckboxProps) {
|
|
29
28
|
const identifier = id || name
|
|
@@ -41,7 +40,7 @@ export function Checkbox({
|
|
|
41
40
|
type="checkbox"
|
|
42
41
|
className="checkbox"
|
|
43
42
|
disabled={disabled}
|
|
44
|
-
aria-label={accessibilityLabel
|
|
43
|
+
aria-label={accessibilityLabel}
|
|
45
44
|
{...props}
|
|
46
45
|
/>
|
|
47
46
|
<Label
|
|
@@ -50,7 +49,7 @@ export function Checkbox({
|
|
|
50
49
|
disabled={disabled}
|
|
51
50
|
className={classNames({ 'visually-hidden': hideLabel })}
|
|
52
51
|
>
|
|
53
|
-
{
|
|
52
|
+
{children}
|
|
54
53
|
</Label>
|
|
55
54
|
</div>
|
|
56
55
|
)
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
@use '
|
|
2
|
-
@use '
|
|
3
|
-
@use '
|
|
4
|
-
@use '
|
|
5
|
-
@use '../../settings/mixins';
|
|
1
|
+
@use '../settings/color_alias';
|
|
2
|
+
@use '../settings/typography/content' as typography;
|
|
3
|
+
@use '../settings/config';
|
|
4
|
+
@use '../settings/depth';
|
|
6
5
|
|
|
7
6
|
details summary::-webkit-details-marker {
|
|
8
7
|
display: none;
|
|
@@ -19,22 +18,33 @@ details summary::-webkit-details-marker {
|
|
|
19
18
|
user-select: none;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
.
|
|
21
|
+
.header {
|
|
23
22
|
display: flex;
|
|
24
|
-
align-items: center;
|
|
23
|
+
align-items: center !important;
|
|
25
24
|
gap: config.$space-3x;
|
|
26
25
|
padding: config.$space-5x;
|
|
26
|
+
padding-bottom: config.$space-5x !important;
|
|
27
27
|
cursor: default;
|
|
28
28
|
|
|
29
|
-
.
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
.icon {
|
|
30
|
+
width: config.$icon-size-4x !important;
|
|
31
|
+
height: config.$icon-size-4x !important;
|
|
32
|
+
> svg {
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.title {
|
|
39
|
+
font-size: 1rem !important;
|
|
40
|
+
font-weight: normal !important;
|
|
32
41
|
flex: 1;
|
|
33
42
|
}
|
|
34
43
|
}
|
|
35
44
|
|
|
36
|
-
.
|
|
37
|
-
padding: config.$space-7x
|
|
45
|
+
.content {
|
|
46
|
+
padding: config.$space-7x;
|
|
47
|
+
padding-bottom: config.$space-3x;
|
|
38
48
|
|
|
39
49
|
&.no-horizontal-padding {
|
|
40
50
|
padding-left: 0;
|
|
@@ -42,46 +52,54 @@ details summary::-webkit-details-marker {
|
|
|
42
52
|
}
|
|
43
53
|
}
|
|
44
54
|
|
|
45
|
-
&.primary
|
|
55
|
+
&.primary {
|
|
46
56
|
&[open] {
|
|
47
|
-
.
|
|
57
|
+
.header {
|
|
48
58
|
background: transparent;
|
|
49
59
|
border-bottom: 3px solid color_alias.$primary-color-600;
|
|
50
60
|
}
|
|
51
61
|
}
|
|
52
62
|
|
|
53
63
|
&.disabled {
|
|
54
|
-
.
|
|
64
|
+
.header {
|
|
55
65
|
background: color_alias.$neutral-color-50;
|
|
56
66
|
border-bottom: 1px solid color_alias.$neutral-color-200;
|
|
57
67
|
color: color_alias.$neutral-color-200;
|
|
58
|
-
|
|
68
|
+
|
|
69
|
+
.icon {
|
|
70
|
+
> svg {
|
|
71
|
+
fill: color_alias.$neutral-color-200;
|
|
72
|
+
path {
|
|
73
|
+
fill: color_alias.$neutral-color-200;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
59
77
|
}
|
|
60
78
|
}
|
|
61
79
|
|
|
62
|
-
.
|
|
80
|
+
.header {
|
|
63
81
|
color: color_alias.$neutral-color-1000;
|
|
64
82
|
background: transparent;
|
|
65
83
|
border-bottom: 1px solid color_alias.$neutral-color-200;
|
|
66
|
-
|
|
84
|
+
|
|
85
|
+
.icon {
|
|
86
|
+
> svg {
|
|
87
|
+
fill: color_alias.$primary-color-600;
|
|
88
|
+
path {
|
|
89
|
+
fill: color_alias.$primary-color-600;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
67
93
|
|
|
68
94
|
&:hover {
|
|
69
95
|
background: color_alias.$primary-color-50;
|
|
70
96
|
}
|
|
71
97
|
}
|
|
72
98
|
}
|
|
73
|
-
|
|
74
|
-
&.secondary .collapsible-content {
|
|
75
|
-
padding: config.$space-3x config.$space-4x config.$space-6x;
|
|
76
|
-
border: 1px solid color_alias.$neutral-color-200;
|
|
77
|
-
border-top: none;
|
|
78
|
-
border-bottom-left-radius: config.$corner-radius-m;
|
|
79
|
-
border-bottom-right-radius: config.$corner-radius-m;
|
|
80
|
-
}
|
|
81
99
|
}
|
|
82
100
|
|
|
83
101
|
.collapsible[open] {
|
|
84
|
-
.
|
|
102
|
+
.arrow {
|
|
85
103
|
transform: rotate(90deg);
|
|
86
104
|
}
|
|
87
105
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import './Collapsible.scss'
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { Icon } from '../Icon'
|
|
2
|
+
import { classNames } from '../utils/classNames'
|
|
3
|
+
import { Icon } from './Icon'
|
|
5
4
|
|
|
6
|
-
export type Variant = 'primary'
|
|
5
|
+
export type Variant = 'primary'
|
|
7
6
|
|
|
8
|
-
export interface CollapsibleProps
|
|
7
|
+
export interface CollapsibleProps
|
|
8
|
+
extends React.ComponentPropsWithoutRef<'details'> {
|
|
9
9
|
title: string
|
|
10
10
|
variant?: Variant
|
|
11
11
|
name?: string
|
|
@@ -24,21 +24,21 @@ export function Collapsible({
|
|
|
24
24
|
form = false,
|
|
25
25
|
noHorizontalPadding = false,
|
|
26
26
|
...props
|
|
27
|
-
}: CollapsibleProps) {
|
|
27
|
+
}: CollapsibleProps): React.JSX.Element {
|
|
28
28
|
const cssClasses = classNames('collapsible', variant, className, {
|
|
29
29
|
open: props.open,
|
|
30
30
|
disabled: disabled,
|
|
31
31
|
})
|
|
32
|
-
const contentCssClasses = classNames('
|
|
32
|
+
const contentCssClasses = classNames('content', {
|
|
33
33
|
'no-horizontal-padding': noHorizontalPadding,
|
|
34
34
|
form: form,
|
|
35
35
|
})
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
38
|
<details name={name} className={cssClasses} aria-label={title} {...props}>
|
|
39
|
-
<summary className="
|
|
40
|
-
<Icon className="
|
|
41
|
-
<span className="
|
|
39
|
+
<summary className="header">
|
|
40
|
+
<Icon className="arrow" name="AngleRight" />
|
|
41
|
+
<span className="title">{title}</span>
|
|
42
42
|
</summary>
|
|
43
43
|
<div className={contentCssClasses}>{children}</div>
|
|
44
44
|
</details>
|
|
@@ -29,7 +29,6 @@ export type DateRangePickerProps = {
|
|
|
29
29
|
name?: string
|
|
30
30
|
helpText?: string
|
|
31
31
|
errors?: string[]
|
|
32
|
-
fullWidth?: boolean
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
export type DateRange = {
|
|
@@ -49,12 +48,10 @@ export function DateRangePicker({
|
|
|
49
48
|
label = 'Date',
|
|
50
49
|
errors,
|
|
51
50
|
helpText,
|
|
52
|
-
fullWidth = false,
|
|
53
51
|
}: DateRangePickerProps): JSX.Element {
|
|
54
52
|
const cssClasses = classNames('date-picker', variant, className, {
|
|
55
53
|
toggle: withInput,
|
|
56
54
|
invalid: errors?.length,
|
|
57
|
-
'full-width': fullWidth,
|
|
58
55
|
})
|
|
59
56
|
const helpTexts = buildHelpText(helpText, errors)
|
|
60
57
|
|
|
@@ -28,7 +28,6 @@ export type DateSinglePickerProps = {
|
|
|
28
28
|
label?: string
|
|
29
29
|
helpText?: string
|
|
30
30
|
errors?: string[]
|
|
31
|
-
fullWidth?: boolean
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
export function DateSinglePicker({
|
|
@@ -43,7 +42,6 @@ export function DateSinglePicker({
|
|
|
43
42
|
label = 'Date',
|
|
44
43
|
errors,
|
|
45
44
|
helpText,
|
|
46
|
-
fullWidth = false,
|
|
47
45
|
}: DateSinglePickerProps): JSX.Element {
|
|
48
46
|
const { isOpen, close, toggle } = useOpen(!withInput)
|
|
49
47
|
const pickerRef = useRef(null)
|
|
@@ -53,7 +51,6 @@ export function DateSinglePicker({
|
|
|
53
51
|
const cssClasses = classNames('date-picker', variant, className, {
|
|
54
52
|
toggle: withInput,
|
|
55
53
|
invalid: errors?.length,
|
|
56
|
-
'full-width': fullWidth,
|
|
57
54
|
})
|
|
58
55
|
|
|
59
56
|
const [selected, setSelected] = useState<Date | undefined>(
|
package/src/atoms/Input.scss
CHANGED
|
@@ -17,20 +17,16 @@
|
|
|
17
17
|
flex-direction: row;
|
|
18
18
|
width: 100%;
|
|
19
19
|
padding: config.$space-2x config.$space-3x config.$space-2x;
|
|
20
|
-
|
|
21
20
|
input[type='date'] {
|
|
22
21
|
min-width: -webkit-fill-available;
|
|
23
22
|
}
|
|
24
|
-
|
|
25
23
|
input[type='number'] {
|
|
26
24
|
text-align: right;
|
|
27
25
|
}
|
|
28
|
-
|
|
29
26
|
input::placeholder,
|
|
30
27
|
textarea::placeholder {
|
|
31
28
|
@include typography.input-placeholder-text;
|
|
32
29
|
}
|
|
33
|
-
|
|
34
30
|
input,
|
|
35
31
|
input:hover,
|
|
36
32
|
input:focus,
|
|
@@ -56,12 +52,10 @@
|
|
|
56
52
|
-moz-appearance: none;
|
|
57
53
|
appearance: none;
|
|
58
54
|
}
|
|
59
|
-
|
|
60
55
|
.input-suffix {
|
|
61
56
|
text-wrap: nowrap;
|
|
62
57
|
color: color_alias.$neutral-color-600;
|
|
63
58
|
}
|
|
64
|
-
|
|
65
59
|
.icon {
|
|
66
60
|
min-width: config.$icon-size-5x;
|
|
67
61
|
width: config.$icon-size-5x;
|
|
@@ -78,7 +72,6 @@
|
|
|
78
72
|
&.invalid .input-container {
|
|
79
73
|
border: 1px solid color_alias.$error-color-1000;
|
|
80
74
|
}
|
|
81
|
-
|
|
82
75
|
.input-container {
|
|
83
76
|
border-radius: config.$corner-radius-m;
|
|
84
77
|
border: 1px solid color_alias.$neutral-color-600;
|
|
@@ -94,7 +87,6 @@
|
|
|
94
87
|
&:has(textarea:disabled) {
|
|
95
88
|
border: 1px solid color_alias.$neutral-color-400;
|
|
96
89
|
background: color_alias.$neutral-color-50;
|
|
97
|
-
|
|
98
90
|
input {
|
|
99
91
|
color: color_alias.$neutral-color-400;
|
|
100
92
|
}
|
|
@@ -104,11 +96,9 @@
|
|
|
104
96
|
color: color_alias.$neutral-color-400;
|
|
105
97
|
}
|
|
106
98
|
}
|
|
107
|
-
|
|
108
99
|
.icon {
|
|
109
100
|
> svg {
|
|
110
101
|
fill: color_alias.$neutral-color-400;
|
|
111
|
-
|
|
112
102
|
path {
|
|
113
103
|
fill: color_alias.$neutral-color-400;
|
|
114
104
|
}
|
|
@@ -118,7 +108,6 @@
|
|
|
118
108
|
.password-icon {
|
|
119
109
|
> svg {
|
|
120
110
|
fill: color_alias.$neutral-color-600;
|
|
121
|
-
|
|
122
111
|
path {
|
|
123
112
|
fill: color_alias.$neutral-color-600;
|
|
124
113
|
}
|
|
@@ -126,25 +115,20 @@
|
|
|
126
115
|
}
|
|
127
116
|
}
|
|
128
117
|
}
|
|
129
|
-
|
|
130
118
|
&.file .input-container {
|
|
131
119
|
padding: 0;
|
|
132
120
|
border: transparent;
|
|
133
|
-
|
|
134
121
|
&:has(input:focus) {
|
|
135
122
|
border: transparent;
|
|
136
123
|
}
|
|
137
|
-
|
|
138
124
|
input {
|
|
139
125
|
color: color_alias.$neutral-color-600;
|
|
140
|
-
|
|
141
126
|
&::before {
|
|
142
127
|
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='12' fill='none'%3E%3Cpath d='M2.943 8.718h4.114V4.694H9.8L5 0 .2 4.694h2.743v4.024ZM5 1.898l1.488 1.455h-.802v4.023H4.314V3.353h-.802L5 1.898Zm-4.8 8.16h9.6V11.4H.2v-1.341Z' fill='%23EB004D'/%3E%3C/svg%3E");
|
|
143
128
|
position: absolute;
|
|
144
129
|
left: config.$space-3x;
|
|
145
130
|
bottom: config.$space-2x;
|
|
146
131
|
}
|
|
147
|
-
|
|
148
132
|
&::file-selector-button {
|
|
149
133
|
margin-right: config.$space-2x;
|
|
150
134
|
padding-left: config.$space-3x + config.$icon-size-2x + config.$space-1x;
|
|
@@ -152,23 +136,8 @@
|
|
|
152
136
|
}
|
|
153
137
|
}
|
|
154
138
|
}
|
|
155
|
-
|
|
156
139
|
&.hidden {
|
|
157
140
|
display: none;
|
|
158
141
|
}
|
|
159
142
|
|
|
160
|
-
&.ellipsis {
|
|
161
|
-
input {
|
|
162
|
-
text-overflow: ellipsis;
|
|
163
|
-
overflow: hidden;
|
|
164
|
-
white-space: nowrap;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
&.borderless {
|
|
169
|
-
.input-container {
|
|
170
|
-
padding-left: 0;
|
|
171
|
-
padding-right: 0;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
143
|
}
|
package/src/atoms/Input.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import type { IconType } from './Icon'
|
|
|
7
7
|
import { Icon } from './Icon'
|
|
8
8
|
import { Label } from './Label'
|
|
9
9
|
|
|
10
|
-
export type InputVariant = 'primary'
|
|
10
|
+
export type InputVariant = 'primary'
|
|
11
11
|
|
|
12
12
|
export interface InputProps extends React.ComponentPropsWithRef<'input'> {
|
|
13
13
|
label: string
|
|
@@ -20,8 +20,6 @@ export interface InputProps extends React.ComponentPropsWithRef<'input'> {
|
|
|
20
20
|
suffix?: string
|
|
21
21
|
errors?: string[]
|
|
22
22
|
rightIcon?: IconType
|
|
23
|
-
fullWidth?: boolean
|
|
24
|
-
ellipsis?: boolean
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
export function Input({
|
|
@@ -39,8 +37,6 @@ export function Input({
|
|
|
39
37
|
id,
|
|
40
38
|
errors,
|
|
41
39
|
rightIcon,
|
|
42
|
-
fullWidth = false,
|
|
43
|
-
ellipsis = false,
|
|
44
40
|
...props
|
|
45
41
|
}: InputProps): React.JSX.Element {
|
|
46
42
|
const identifier = id || name
|
|
@@ -66,8 +62,6 @@ export function Input({
|
|
|
66
62
|
file: type === 'file',
|
|
67
63
|
invalid: errors?.length,
|
|
68
64
|
hidden: type === 'hidden',
|
|
69
|
-
'full-width': fullWidth,
|
|
70
|
-
ellipsis: ellipsis,
|
|
71
65
|
})}
|
|
72
66
|
>
|
|
73
67
|
{!hideLabel && (
|
|
@@ -36,22 +36,6 @@ export function ModalDialog({
|
|
|
36
36
|
}
|
|
37
37
|
}, [])
|
|
38
38
|
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
const dialog = dialogRef.current
|
|
41
|
-
if (!dialog) return
|
|
42
|
-
|
|
43
|
-
const handleCancel = (event: Event) => {
|
|
44
|
-
event.preventDefault()
|
|
45
|
-
onClose?.()
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
dialog.addEventListener('cancel', handleCancel)
|
|
49
|
-
|
|
50
|
-
return () => {
|
|
51
|
-
dialog.removeEventListener('cancel', handleCancel)
|
|
52
|
-
}
|
|
53
|
-
}, [onClose])
|
|
54
|
-
|
|
55
39
|
useEffect(() => {
|
|
56
40
|
if (isOpen) {
|
|
57
41
|
dialogRef.current?.showModal()
|
|
@@ -62,8 +46,6 @@ export function ModalDialog({
|
|
|
62
46
|
|
|
63
47
|
return (
|
|
64
48
|
<dialog
|
|
65
|
-
role="dialog"
|
|
66
|
-
aria-modal="true"
|
|
67
49
|
ref={dialogRef}
|
|
68
50
|
className={classNames('modal', className, { 'modal-details': details })}
|
|
69
51
|
onClick={handleClick}
|
|
@@ -30,7 +30,6 @@ export interface MultiselectProps extends InputPropsWithoutOnChange {
|
|
|
30
30
|
onChange?: (value: string[]) => void
|
|
31
31
|
isSearchable?: boolean
|
|
32
32
|
searchLabel?: string
|
|
33
|
-
fullWidth?: boolean
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
export function Multiselect({
|
|
@@ -51,23 +50,15 @@ export function Multiselect({
|
|
|
51
50
|
defaultValue = [],
|
|
52
51
|
isSearchable = false,
|
|
53
52
|
searchLabel = 'Search',
|
|
54
|
-
fullWidth = false,
|
|
55
53
|
...props
|
|
56
54
|
}: MultiselectProps): React.JSX.Element {
|
|
57
55
|
const { isOpen, close, toggle } = useOpen()
|
|
58
56
|
const selectRef = useRef(null)
|
|
59
|
-
const selectTriggerRef = useRef<HTMLButtonElement | null>(null)
|
|
60
57
|
useOutsideClick(selectRef, close)
|
|
61
58
|
const [selectedOptions, setSelectedOptions] = useState<string[]>(defaultValue)
|
|
62
59
|
const isInvalid = Boolean(errors?.length)
|
|
63
60
|
const hasSelectedOptions = selectedOptions.length > 0
|
|
64
61
|
|
|
65
|
-
const handleClose = () => {
|
|
66
|
-
if (!isOpen) return
|
|
67
|
-
close()
|
|
68
|
-
selectTriggerRef?.current?.focus()
|
|
69
|
-
}
|
|
70
|
-
|
|
71
62
|
function handleSelectOption({ id }: Option) {
|
|
72
63
|
const isOptionSelected = selectedOptions.includes(id)
|
|
73
64
|
const options = isOptionSelected
|
|
@@ -83,7 +74,6 @@ export function Multiselect({
|
|
|
83
74
|
setSelectedOptions([])
|
|
84
75
|
onChange([])
|
|
85
76
|
}
|
|
86
|
-
|
|
87
77
|
const identifier = id || name
|
|
88
78
|
return (
|
|
89
79
|
<div
|
|
@@ -91,7 +81,6 @@ export function Multiselect({
|
|
|
91
81
|
disabled,
|
|
92
82
|
filled: hasSelectedOptions,
|
|
93
83
|
invalid: isInvalid,
|
|
94
|
-
'full-width': fullWidth,
|
|
95
84
|
})}
|
|
96
85
|
ref={selectRef}
|
|
97
86
|
>
|
|
@@ -110,7 +99,6 @@ export function Multiselect({
|
|
|
110
99
|
onClick={toggle}
|
|
111
100
|
onClear={handleClear}
|
|
112
101
|
isEmpty={!hasSelectedOptions}
|
|
113
|
-
buttonRef={selectTriggerRef}
|
|
114
102
|
>
|
|
115
103
|
{hasSelectedOptions
|
|
116
104
|
? `${selectedOptions.length} ${selectedLabel}`
|
|
@@ -125,7 +113,6 @@ export function Multiselect({
|
|
|
125
113
|
selectOption={handleSelectOption}
|
|
126
114
|
isSearchable={isSearchable}
|
|
127
115
|
searchLabel={searchLabel}
|
|
128
|
-
onClose={handleClose}
|
|
129
116
|
/>
|
|
130
117
|
)}
|
|
131
118
|
<HelpText helpText={helpText} errors={errors} />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import './Popover.scss'
|
|
3
|
-
import
|
|
3
|
+
import { useRef } from 'react'
|
|
4
4
|
import { useOpen } from '../../hooks/useOpen'
|
|
5
5
|
import { useOutsideClick } from '../../hooks/useOutsideClick'
|
|
6
6
|
import { classNames } from '../../utils/classNames'
|
|
@@ -14,7 +14,6 @@ export interface QuantitySelectorProps extends Omit<InputProps, 'type'> {
|
|
|
14
14
|
hideLabel?: boolean
|
|
15
15
|
id?: string
|
|
16
16
|
variant?: Variant
|
|
17
|
-
fullWidth?: boolean
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
export function QuantitySelector({
|
|
@@ -25,7 +24,6 @@ export function QuantitySelector({
|
|
|
25
24
|
disabled,
|
|
26
25
|
hideLabel = false,
|
|
27
26
|
variant = 'primary',
|
|
28
|
-
fullWidth = false,
|
|
29
27
|
...props
|
|
30
28
|
}: QuantitySelectorProps): React.JSX.Element {
|
|
31
29
|
const inputRef = useRef<HTMLInputElement>(null)
|
|
@@ -43,11 +41,7 @@ export function QuantitySelector({
|
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
43
|
return (
|
|
46
|
-
<div
|
|
47
|
-
className={classNames('quantity-selector-group', variant, className, {
|
|
48
|
-
'full-width': fullWidth,
|
|
49
|
-
})}
|
|
50
|
-
>
|
|
44
|
+
<div className={classNames('quantity-selector-group', variant, className)}>
|
|
51
45
|
{!hideLabel && (
|
|
52
46
|
<Label required={props.required} htmlFor={id}>
|
|
53
47
|
{label}
|