@bbl-digital/snorre 4.0.0-beta.5 → 4.0.0-beta.7
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/bundle.js +74 -52
- package/esm/core/FileInput/FileInput.stories.js +44 -28
- package/esm/core/FileInput/index.js +8 -1
- package/esm/core/FileInput/styles.js +32 -12
- package/esm/core/Input/Input.stories.js +96 -59
- package/esm/core/Input/index.js +4 -1
- package/esm/core/Input/styles.js +16 -24
- package/esm/icons/Icon.stories.js +358 -10
- package/esm/shared/components/SbIconGrid/index.js +3 -2
- package/lib/core/FileInput/FileInput.stories.d.ts +14 -30
- package/lib/core/FileInput/FileInput.stories.d.ts.map +1 -1
- package/lib/core/FileInput/FileInput.stories.js +44 -28
- package/lib/core/FileInput/index.d.ts +5 -1
- package/lib/core/FileInput/index.d.ts.map +1 -1
- package/lib/core/FileInput/index.js +8 -1
- package/lib/core/FileInput/styles.d.ts +3 -0
- package/lib/core/FileInput/styles.d.ts.map +1 -1
- package/lib/core/FileInput/styles.js +32 -12
- package/lib/core/Input/Input.stories.d.ts +19 -50
- package/lib/core/Input/Input.stories.d.ts.map +1 -1
- package/lib/core/Input/Input.stories.js +96 -59
- package/lib/core/Input/index.d.ts +6 -4
- package/lib/core/Input/index.d.ts.map +1 -1
- package/lib/core/Input/index.js +4 -1
- package/lib/core/Input/styles.d.ts +1 -1
- package/lib/core/Input/styles.d.ts.map +1 -1
- package/lib/core/Input/styles.js +16 -24
- package/lib/icons/Icon.stories.js +358 -10
- package/lib/icons/withIcon.d.ts +2 -0
- package/lib/icons/withIcon.d.ts.map +1 -1
- package/lib/shared/components/SbIconGrid/index.d.ts +1 -1
- package/lib/shared/components/SbIconGrid/index.d.ts.map +1 -1
- package/lib/shared/components/SbIconGrid/index.js +3 -2
- package/package.json +3 -2
|
@@ -1,121 +1,158 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions';
|
|
2
2
|
import Input from '.';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
3
|
+
const meta = {
|
|
5
4
|
title: 'Core/Input',
|
|
6
5
|
component: Input
|
|
7
6
|
};
|
|
7
|
+
export default meta;
|
|
8
8
|
export const Default = {
|
|
9
|
-
|
|
10
|
-
type:
|
|
11
|
-
label:
|
|
12
|
-
placeholder:
|
|
13
|
-
}
|
|
9
|
+
args: {
|
|
10
|
+
type: 'text',
|
|
11
|
+
label: 'Label',
|
|
12
|
+
placeholder: 'Placeholder text'
|
|
13
|
+
},
|
|
14
14
|
name: 'Default'
|
|
15
15
|
};
|
|
16
16
|
export const Focused = {
|
|
17
|
-
|
|
18
|
-
type:
|
|
19
|
-
label:
|
|
20
|
-
placeholder:
|
|
17
|
+
args: {
|
|
18
|
+
type: 'text',
|
|
19
|
+
label: 'Focused',
|
|
20
|
+
placeholder: 'Placeholder text',
|
|
21
21
|
focus: true
|
|
22
|
-
}
|
|
22
|
+
},
|
|
23
23
|
name: 'Focused'
|
|
24
24
|
};
|
|
25
25
|
export const Disabled = {
|
|
26
|
-
|
|
27
|
-
type:
|
|
28
|
-
label:
|
|
29
|
-
placeholder:
|
|
26
|
+
args: {
|
|
27
|
+
type: 'text',
|
|
28
|
+
label: 'Disabled',
|
|
29
|
+
placeholder: 'Field disabled',
|
|
30
30
|
disabled: true
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
32
|
name: 'Disabled'
|
|
33
33
|
};
|
|
34
34
|
export const Passsword = {
|
|
35
|
-
|
|
36
|
-
type:
|
|
37
|
-
label:
|
|
38
|
-
placeholder:
|
|
39
|
-
value:
|
|
40
|
-
}
|
|
35
|
+
args: {
|
|
36
|
+
type: 'password',
|
|
37
|
+
label: 'Inputfield - password',
|
|
38
|
+
placeholder: 'Password field',
|
|
39
|
+
value: 'Secret password'
|
|
40
|
+
},
|
|
41
41
|
name: 'Passsword'
|
|
42
42
|
};
|
|
43
43
|
export const Search = {
|
|
44
|
-
|
|
45
|
-
type:
|
|
44
|
+
args: {
|
|
45
|
+
type: 'search',
|
|
46
46
|
highlight: true,
|
|
47
|
-
placeholder:
|
|
48
|
-
}
|
|
47
|
+
placeholder: 'Placeholder text'
|
|
48
|
+
},
|
|
49
49
|
name: 'Search'
|
|
50
50
|
};
|
|
51
51
|
export const Highlighted = {
|
|
52
|
-
|
|
53
|
-
type:
|
|
54
|
-
placeholder:
|
|
52
|
+
args: {
|
|
53
|
+
type: 'text',
|
|
54
|
+
placeholder: 'Placeholder text',
|
|
55
55
|
highlight: true
|
|
56
|
-
}
|
|
56
|
+
},
|
|
57
57
|
name: 'Highlighted'
|
|
58
58
|
};
|
|
59
59
|
export const Reset = {
|
|
60
|
-
|
|
61
|
-
type:
|
|
60
|
+
args: {
|
|
61
|
+
type: 'text',
|
|
62
62
|
value: 'should be empty',
|
|
63
|
-
placeholder:
|
|
63
|
+
placeholder: 'Placeholder text',
|
|
64
64
|
highlight: true,
|
|
65
65
|
reset: true
|
|
66
|
-
}
|
|
66
|
+
},
|
|
67
67
|
name: 'Reset'
|
|
68
68
|
};
|
|
69
69
|
export const WithDebounce = {
|
|
70
|
-
|
|
71
|
-
type:
|
|
72
|
-
value:
|
|
70
|
+
args: {
|
|
71
|
+
type: 'text',
|
|
72
|
+
value: '',
|
|
73
73
|
onDebounceChange: value => {
|
|
74
74
|
action('debounce callback..');
|
|
75
75
|
console.log('debounce callback..', value);
|
|
76
76
|
},
|
|
77
|
-
placeholder:
|
|
77
|
+
placeholder: 'Placeholder text',
|
|
78
78
|
highlight: true,
|
|
79
79
|
debounceDelay: 500
|
|
80
|
-
}
|
|
80
|
+
},
|
|
81
81
|
name: 'WithDebounce'
|
|
82
82
|
};
|
|
83
83
|
export const WithMaxlength = {
|
|
84
|
-
|
|
85
|
-
type:
|
|
86
|
-
value:
|
|
84
|
+
args: {
|
|
85
|
+
type: 'text',
|
|
86
|
+
value: '',
|
|
87
87
|
onChange: value => {
|
|
88
88
|
action('value changed..');
|
|
89
89
|
console.log('value changed..', value);
|
|
90
90
|
},
|
|
91
|
-
placeholder:
|
|
91
|
+
placeholder: 'Placeholder text',
|
|
92
92
|
highlight: true,
|
|
93
93
|
maxlength: 50
|
|
94
|
-
}
|
|
94
|
+
},
|
|
95
95
|
name: 'With maxlength'
|
|
96
96
|
};
|
|
97
97
|
export const Format = {
|
|
98
|
-
|
|
99
|
-
type:
|
|
100
|
-
value:
|
|
101
|
-
placeholder:
|
|
98
|
+
args: {
|
|
99
|
+
type: 'text',
|
|
100
|
+
value: '123123123',
|
|
101
|
+
placeholder: 'Start typing a price',
|
|
102
102
|
format: 'price'
|
|
103
|
-
}
|
|
103
|
+
},
|
|
104
104
|
name: 'Format'
|
|
105
105
|
};
|
|
106
106
|
export const Height = {
|
|
107
|
-
|
|
108
|
-
type:
|
|
109
|
-
height:
|
|
107
|
+
args: {
|
|
108
|
+
type: 'search',
|
|
109
|
+
height: '50px',
|
|
110
110
|
highlight: true
|
|
111
|
-
}
|
|
111
|
+
},
|
|
112
112
|
name: 'Height'
|
|
113
113
|
};
|
|
114
114
|
export const Info = {
|
|
115
|
-
|
|
116
|
-
label:
|
|
117
|
-
info:
|
|
118
|
-
invalidMessage:
|
|
119
|
-
}
|
|
115
|
+
args: {
|
|
116
|
+
label: 'With info',
|
|
117
|
+
info: 'Hello, this is important information',
|
|
118
|
+
invalidMessage: 'error'
|
|
119
|
+
},
|
|
120
120
|
name: 'Info'
|
|
121
|
+
};
|
|
122
|
+
export const CardInput = {
|
|
123
|
+
args: {
|
|
124
|
+
cardInput: true,
|
|
125
|
+
placeholder: 'Im styled as a card',
|
|
126
|
+
highlight: true,
|
|
127
|
+
type: 'search'
|
|
128
|
+
},
|
|
129
|
+
name: 'CardInput'
|
|
130
|
+
};
|
|
131
|
+
export const Controls = {
|
|
132
|
+
args: {
|
|
133
|
+
label: 'With info',
|
|
134
|
+
info: 'Hello, this is important information',
|
|
135
|
+
invalidMessage: 'error',
|
|
136
|
+
value: '',
|
|
137
|
+
name: '',
|
|
138
|
+
cardInput: false,
|
|
139
|
+
className: '',
|
|
140
|
+
debounceDelay: 500,
|
|
141
|
+
disabled: false,
|
|
142
|
+
focus: false,
|
|
143
|
+
format: undefined,
|
|
144
|
+
height: '',
|
|
145
|
+
invalid: false,
|
|
146
|
+
maxlength: undefined,
|
|
147
|
+
highlight: false,
|
|
148
|
+
infoPlacement: undefined,
|
|
149
|
+
placeholder: 'Hello',
|
|
150
|
+
reset: false,
|
|
151
|
+
type: 'text',
|
|
152
|
+
onChange: action('value changed..'),
|
|
153
|
+
onBlur: action('on blur..'),
|
|
154
|
+
onDebounceChange: action('on debounce change..'),
|
|
155
|
+
onFocus: action('on focus..')
|
|
156
|
+
},
|
|
157
|
+
name: 'Controls'
|
|
121
158
|
};
|
package/esm/core/Input/index.js
CHANGED
|
@@ -17,6 +17,8 @@ const Input = /*#__PURE__*/React.forwardRef(({
|
|
|
17
17
|
height,
|
|
18
18
|
info,
|
|
19
19
|
infoPlacement = 'left',
|
|
20
|
+
className,
|
|
21
|
+
cardInput,
|
|
20
22
|
...props
|
|
21
23
|
}, ref) => {
|
|
22
24
|
const [value, setValueChanged] = useState(props.value ? props.value : '');
|
|
@@ -61,6 +63,7 @@ const Input = /*#__PURE__*/React.forwardRef(({
|
|
|
61
63
|
css: styles.relative,
|
|
62
64
|
children: [_jsxs("label", {
|
|
63
65
|
css: theme => [styles.default(theme), props.highlight && styles.highligted(height), type === 'search' && styles.searchLabel(theme), (props.invalid || props.invalidMessage) && styles.invalid(theme), height && styles.height(height)],
|
|
66
|
+
className: className,
|
|
64
67
|
children: [props.label && _jsx("span", {
|
|
65
68
|
css: info && styles.pr4,
|
|
66
69
|
children: props.label
|
|
@@ -78,7 +81,7 @@ const Input = /*#__PURE__*/React.forwardRef(({
|
|
|
78
81
|
maxLength: maxlength,
|
|
79
82
|
ref: ref,
|
|
80
83
|
name: props.name,
|
|
81
|
-
css: theme => [type === 'text' && styles.text(theme), type === 'search' && styles.search(theme), type === 'password' && styles.password(theme), type === 'number' && styles.number(theme),
|
|
84
|
+
css: theme => [type === 'text' && styles.text(theme), type === 'search' && styles.search(theme), type === 'password' && styles.password(theme), type === 'number' && styles.number(theme), props.disabled && styles.disabled(theme), cardInput && styles.cardInput(theme)],
|
|
82
85
|
children: React.Children.map(props.children, child => {
|
|
83
86
|
if (!child) {
|
|
84
87
|
return null;
|