agroptima-design-system 0.34.4 → 0.34.6-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 +1 -1
- package/src/atoms/Button/Button.tsx +6 -2
- package/src/atoms/DatePicker/DateRangePicker.tsx +3 -0
- package/src/atoms/DatePicker/DateSinglePicker.tsx +3 -0
- package/src/atoms/Input.tsx +3 -0
- package/src/atoms/Multiselect.tsx +3 -0
- package/src/atoms/QuantitySelector.tsx +7 -1
- package/src/atoms/Select/Select.scss +9 -2
- package/src/atoms/Select/Select.tsx +3 -0
- package/src/atoms/TextArea.tsx +3 -0
- package/src/stories/Button.stories.ts +4 -0
- package/src/stories/Changelog.mdx +8 -2
- package/src/stories/DateRangePicker.stories.ts +5 -0
- package/src/stories/DateSinglePicker.stories.ts +5 -0
- package/src/stories/Input.stories.ts +4 -0
- package/src/stories/Multiselect.stories.ts +4 -0
- package/src/stories/QuantitySelector.stories.ts +5 -0
- package/src/stories/Select.stories.ts +4 -0
- package/src/stories/TextArea.stories.ts +4 -0
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ interface CustomProps {
|
|
|
13
13
|
variant?: ButtonVariant
|
|
14
14
|
loading?: boolean
|
|
15
15
|
disabled?: boolean
|
|
16
|
+
fullWidth?: boolean
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export type ButtonProps = CustomProps & BaseButtonProps
|
|
@@ -43,13 +44,16 @@ export function Button({
|
|
|
43
44
|
leftIcon,
|
|
44
45
|
rightIcon,
|
|
45
46
|
disabled,
|
|
47
|
+
className,
|
|
46
48
|
variant = 'primary',
|
|
47
49
|
loading = false,
|
|
48
|
-
|
|
50
|
+
fullWidth = false,
|
|
49
51
|
...props
|
|
50
52
|
}: ButtonProps) {
|
|
51
53
|
const leftIconName = loading ? 'Loading' : leftIcon
|
|
52
|
-
const cssClasses = classNames(className, 'button', variant
|
|
54
|
+
const cssClasses = classNames(className, 'button', variant, {
|
|
55
|
+
'full-width': fullWidth,
|
|
56
|
+
})
|
|
53
57
|
|
|
54
58
|
return (
|
|
55
59
|
<BaseButton
|
|
@@ -29,6 +29,7 @@ export type DateRangePickerProps = {
|
|
|
29
29
|
name?: string
|
|
30
30
|
helpText?: string
|
|
31
31
|
errors?: string[]
|
|
32
|
+
fullWidth?: boolean
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
export type DateRange = {
|
|
@@ -48,10 +49,12 @@ export function DateRangePicker({
|
|
|
48
49
|
label = 'Date',
|
|
49
50
|
errors,
|
|
50
51
|
helpText,
|
|
52
|
+
fullWidth = false,
|
|
51
53
|
}: DateRangePickerProps): JSX.Element {
|
|
52
54
|
const cssClasses = classNames('date-picker', variant, className, {
|
|
53
55
|
toggle: withInput,
|
|
54
56
|
invalid: errors?.length,
|
|
57
|
+
'full-width': fullWidth,
|
|
55
58
|
})
|
|
56
59
|
const helpTexts = buildHelpText(helpText, errors)
|
|
57
60
|
|
|
@@ -28,6 +28,7 @@ export type DateSinglePickerProps = {
|
|
|
28
28
|
label?: string
|
|
29
29
|
helpText?: string
|
|
30
30
|
errors?: string[]
|
|
31
|
+
fullWidth?: boolean
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
export function DateSinglePicker({
|
|
@@ -42,6 +43,7 @@ export function DateSinglePicker({
|
|
|
42
43
|
label = 'Date',
|
|
43
44
|
errors,
|
|
44
45
|
helpText,
|
|
46
|
+
fullWidth = false,
|
|
45
47
|
}: DateSinglePickerProps): JSX.Element {
|
|
46
48
|
const { isOpen, close, toggle } = useOpen(!withInput)
|
|
47
49
|
const pickerRef = useRef(null)
|
|
@@ -51,6 +53,7 @@ export function DateSinglePicker({
|
|
|
51
53
|
const cssClasses = classNames('date-picker', variant, className, {
|
|
52
54
|
toggle: withInput,
|
|
53
55
|
invalid: errors?.length,
|
|
56
|
+
'full-width': fullWidth,
|
|
54
57
|
})
|
|
55
58
|
|
|
56
59
|
const [selected, setSelected] = useState<Date | undefined>(
|
package/src/atoms/Input.tsx
CHANGED
|
@@ -20,6 +20,7 @@ export interface InputProps extends React.ComponentPropsWithRef<'input'> {
|
|
|
20
20
|
suffix?: string
|
|
21
21
|
errors?: string[]
|
|
22
22
|
rightIcon?: IconType
|
|
23
|
+
fullWidth?: boolean
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export function Input({
|
|
@@ -37,6 +38,7 @@ export function Input({
|
|
|
37
38
|
id,
|
|
38
39
|
errors,
|
|
39
40
|
rightIcon,
|
|
41
|
+
fullWidth = false,
|
|
40
42
|
...props
|
|
41
43
|
}: InputProps): React.JSX.Element {
|
|
42
44
|
const identifier = id || name
|
|
@@ -62,6 +64,7 @@ export function Input({
|
|
|
62
64
|
file: type === 'file',
|
|
63
65
|
invalid: errors?.length,
|
|
64
66
|
hidden: type === 'hidden',
|
|
67
|
+
'full-width': fullWidth,
|
|
65
68
|
})}
|
|
66
69
|
>
|
|
67
70
|
{!hideLabel && (
|
|
@@ -30,6 +30,7 @@ export interface MultiselectProps extends InputPropsWithoutOnChange {
|
|
|
30
30
|
onChange?: (value: string[]) => void
|
|
31
31
|
isSearchable?: boolean
|
|
32
32
|
searchLabel?: string
|
|
33
|
+
fullWidth?: boolean
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export function Multiselect({
|
|
@@ -50,6 +51,7 @@ export function Multiselect({
|
|
|
50
51
|
defaultValue = [],
|
|
51
52
|
isSearchable = false,
|
|
52
53
|
searchLabel = 'Search',
|
|
54
|
+
fullWidth = false,
|
|
53
55
|
...props
|
|
54
56
|
}: MultiselectProps): React.JSX.Element {
|
|
55
57
|
const { isOpen, close, toggle } = useOpen()
|
|
@@ -81,6 +83,7 @@ export function Multiselect({
|
|
|
81
83
|
disabled,
|
|
82
84
|
filled: hasSelectedOptions,
|
|
83
85
|
invalid: isInvalid,
|
|
86
|
+
'full-width': fullWidth,
|
|
84
87
|
})}
|
|
85
88
|
ref={selectRef}
|
|
86
89
|
>
|
|
@@ -14,6 +14,7 @@ export interface QuantitySelectorProps extends Omit<InputProps, 'type'> {
|
|
|
14
14
|
hideLabel?: boolean
|
|
15
15
|
id?: string
|
|
16
16
|
variant?: Variant
|
|
17
|
+
fullWidth?: boolean
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export function QuantitySelector({
|
|
@@ -24,6 +25,7 @@ export function QuantitySelector({
|
|
|
24
25
|
disabled,
|
|
25
26
|
hideLabel = false,
|
|
26
27
|
variant = 'primary',
|
|
28
|
+
fullWidth = false,
|
|
27
29
|
...props
|
|
28
30
|
}: QuantitySelectorProps): React.JSX.Element {
|
|
29
31
|
const inputRef = useRef<HTMLInputElement>(null)
|
|
@@ -41,7 +43,11 @@ export function QuantitySelector({
|
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
return (
|
|
44
|
-
<div
|
|
46
|
+
<div
|
|
47
|
+
className={classNames('quantity-selector-group', variant, className, {
|
|
48
|
+
'full-width': fullWidth,
|
|
49
|
+
})}
|
|
50
|
+
>
|
|
45
51
|
{!hideLabel && (
|
|
46
52
|
<Label required={props.required} htmlFor={id}>
|
|
47
53
|
{label}
|
|
@@ -4,11 +4,15 @@
|
|
|
4
4
|
@use '../../settings/depth';
|
|
5
5
|
@use '../../settings/mixins';
|
|
6
6
|
|
|
7
|
+
$elements-space: config.$space-2x;
|
|
7
8
|
|
|
8
9
|
.select-group {
|
|
9
10
|
display: flex;
|
|
10
11
|
flex-direction: column;
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
label {
|
|
14
|
+
margin-bottom: $elements-space;
|
|
15
|
+
}
|
|
12
16
|
|
|
13
17
|
.select {
|
|
14
18
|
@include typography.select-text;
|
|
@@ -31,6 +35,9 @@
|
|
|
31
35
|
height: config.$icon-size-3x;
|
|
32
36
|
}
|
|
33
37
|
|
|
38
|
+
.help-text {
|
|
39
|
+
margin-top: $elements-space;
|
|
40
|
+
}
|
|
34
41
|
|
|
35
42
|
&.primary {
|
|
36
43
|
&.disabled .select-container {
|
|
@@ -120,7 +127,7 @@
|
|
|
120
127
|
overflow-y: auto;
|
|
121
128
|
overflow-anchor: none;
|
|
122
129
|
z-index: depth.$z-dropdown-options;
|
|
123
|
-
margin: 0;
|
|
130
|
+
margin: $elements-space 0 0;
|
|
124
131
|
padding: config.$space-1x 0;
|
|
125
132
|
text-align: left;
|
|
126
133
|
position: absolute;
|
|
@@ -29,6 +29,7 @@ export interface SelectProps extends InputPropsWithoutOnChange {
|
|
|
29
29
|
onChange?: (value: string) => void
|
|
30
30
|
isSearchable?: boolean
|
|
31
31
|
searchLabel?: string
|
|
32
|
+
fullWidth?: boolean
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
const EMPTY_OPTION = { id: '', label: '' }
|
|
@@ -50,6 +51,7 @@ export function Select({
|
|
|
50
51
|
defaultValue,
|
|
51
52
|
isSearchable = false,
|
|
52
53
|
searchLabel = 'Search',
|
|
54
|
+
fullWidth = false,
|
|
53
55
|
...props
|
|
54
56
|
}: SelectProps): React.JSX.Element {
|
|
55
57
|
const { isOpen, close, toggle } = useOpen()
|
|
@@ -79,6 +81,7 @@ export function Select({
|
|
|
79
81
|
disabled,
|
|
80
82
|
filled: selectedOption.id,
|
|
81
83
|
invalid: isInvalid,
|
|
84
|
+
'full-width': fullWidth,
|
|
82
85
|
})}
|
|
83
86
|
ref={selectRef}
|
|
84
87
|
>
|
package/src/atoms/TextArea.tsx
CHANGED
|
@@ -15,6 +15,7 @@ export interface TextAreaProps
|
|
|
15
15
|
variant?: TextAreaVariant
|
|
16
16
|
id?: string
|
|
17
17
|
errors?: string[]
|
|
18
|
+
fullWidth?: boolean
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export function TextArea({
|
|
@@ -28,6 +29,7 @@ export function TextArea({
|
|
|
28
29
|
disabled,
|
|
29
30
|
name,
|
|
30
31
|
errors,
|
|
32
|
+
fullWidth = false,
|
|
31
33
|
...props
|
|
32
34
|
}: TextAreaProps) {
|
|
33
35
|
const identifier = id || name
|
|
@@ -35,6 +37,7 @@ export function TextArea({
|
|
|
35
37
|
<div
|
|
36
38
|
className={classNames('input-group', variant, className, {
|
|
37
39
|
invalid: errors?.length,
|
|
40
|
+
'full-width': fullWidth,
|
|
38
41
|
})}
|
|
39
42
|
>
|
|
40
43
|
{!hideLabel && (
|
|
@@ -4,14 +4,20 @@ import { Meta } from "@storybook/blocks";
|
|
|
4
4
|
|
|
5
5
|
# Changelog
|
|
6
6
|
|
|
7
|
-
## 0.34.
|
|
7
|
+
## 0.34.6
|
|
8
|
+
|
|
9
|
+
* Add fullWidth prop to Select, Button, Input, MultiSelect, TextArea, QuantitySelector, DateRangePicker, DateSinglePicker components
|
|
10
|
+
* Fix extra space when open Select and MultiSelect components
|
|
8
11
|
|
|
9
|
-
* Update DatePicker related stories with a defaultValue
|
|
10
12
|
|
|
11
13
|
## 0.33.4
|
|
12
14
|
|
|
13
15
|
* Add hasAction and onClick props to Divider component
|
|
14
16
|
|
|
17
|
+
## 0.34.3
|
|
18
|
+
|
|
19
|
+
* Update DatePicker related stories with a defaultValue
|
|
20
|
+
|
|
15
21
|
## 0.33.1
|
|
16
22
|
|
|
17
23
|
* Add onChange prop to RadioGroup component
|
|
@@ -47,6 +47,10 @@ const meta = {
|
|
|
47
47
|
description:
|
|
48
48
|
'Optional array of errors. If passed, the errors are listed and invalid style is applied.',
|
|
49
49
|
},
|
|
50
|
+
fullWidth: {
|
|
51
|
+
description: 'Makes the TextArea take the full width of the container',
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
},
|
|
50
54
|
},
|
|
51
55
|
}
|
|
52
56
|
|