agroptima-design-system 1.2.32-beta.1 → 1.2.32
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
CHANGED
package/src/atoms/Input.scss
CHANGED
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
-webkit-appearance: none;
|
|
29
29
|
-moz-appearance: none;
|
|
30
30
|
appearance: none;
|
|
31
|
-
@include mixins.icon-color(var(--primary-color-600));
|
|
32
31
|
|
|
33
32
|
&:focus-visible {
|
|
34
33
|
outline: none;
|
|
@@ -38,6 +37,13 @@
|
|
|
38
37
|
border-left: 1px solid var(--neutral-color-400);
|
|
39
38
|
color: var(--neutral-color-400);
|
|
40
39
|
cursor: default;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.input-with-select .input-container .input-suffix .select-suffix-trigger {
|
|
44
|
+
@include mixins.icon-color(var(--primary-color-600));
|
|
45
|
+
|
|
46
|
+
&:disabled {
|
|
41
47
|
@include mixins.icon-color(var(--neutral-color-400));
|
|
42
48
|
}
|
|
43
49
|
}
|
|
@@ -9,7 +9,7 @@ const meta = {
|
|
|
9
9
|
description: {
|
|
10
10
|
component:
|
|
11
11
|
'<h2>Usage guidelines</h2>' +
|
|
12
|
-
'<p>The InputWithSelect component is used when the value the user types needs a unit or symbol attached to it, such as a
|
|
12
|
+
'<p>The InputWithSelect component is used when the value the user types needs a unit or symbol attached to it, such as a percentage or a measurement. It combines an input field with a compact select fused into the same field, placed as a suffix.</p>' +
|
|
13
13
|
'<ul>' +
|
|
14
14
|
' <li>Use when the unit is closely tied to the value and only a short, fixed list of symbols applies (e.g. %, kg, m²)</li>' +
|
|
15
15
|
' <li>Keep the list of options short, these are not meant to be searched</li>' +
|
|
@@ -61,24 +61,25 @@ type Story = StoryObj<typeof meta>
|
|
|
61
61
|
|
|
62
62
|
export const Primary: Story = {
|
|
63
63
|
args: {
|
|
64
|
-
label: '
|
|
65
|
-
name: '
|
|
64
|
+
label: 'Weight',
|
|
65
|
+
name: 'weight',
|
|
66
66
|
type: 'number',
|
|
67
67
|
defaultValue: 10,
|
|
68
|
-
helpText: '
|
|
69
|
-
selectAccessibilityLabel: 'Select
|
|
68
|
+
helpText: 'This text can help you',
|
|
69
|
+
selectAccessibilityLabel: 'Select weight unit',
|
|
70
70
|
options: [
|
|
71
|
-
{ id: '
|
|
72
|
-
{ id: '
|
|
71
|
+
{ id: 'kg', label: 'kg' },
|
|
72
|
+
{ id: 'g', label: 'g' },
|
|
73
|
+
{ id: 'lb', label: 'lb' },
|
|
73
74
|
],
|
|
74
|
-
id: '
|
|
75
|
+
id: 'weight',
|
|
75
76
|
},
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
export const WithErrors: Story = {
|
|
79
80
|
args: {
|
|
80
81
|
...Primary.args,
|
|
81
|
-
errors: ['
|
|
82
|
+
errors: ['Weight must be greater than 0'],
|
|
82
83
|
},
|
|
83
84
|
}
|
|
84
85
|
|
|
@@ -4,8 +4,8 @@ import React from 'react'
|
|
|
4
4
|
import { InputWithSelect } from '../src/atoms/InputWithSelect'
|
|
5
5
|
|
|
6
6
|
const options = [
|
|
7
|
-
{ id: '
|
|
8
|
-
{ id: '
|
|
7
|
+
{ id: 'percentage', label: '%' },
|
|
8
|
+
{ id: 'kilogram', label: 'kg' },
|
|
9
9
|
]
|
|
10
10
|
|
|
11
11
|
describe('InputWithSelect', () => {
|
|
@@ -45,7 +45,7 @@ describe('InputWithSelect', () => {
|
|
|
45
45
|
|
|
46
46
|
await user.click(screen.getByRole('option', { name: 'kg' }))
|
|
47
47
|
|
|
48
|
-
expect(handleSelectChange).toHaveBeenCalledWith('
|
|
48
|
+
expect(handleSelectChange).toHaveBeenCalledWith('kilogram')
|
|
49
49
|
expect(
|
|
50
50
|
screen.getByRole('combobox', { name: 'Select unit: kg' }),
|
|
51
51
|
).toHaveTextContent('kg')
|