@bbl-digital/snorre 4.0.0-beta.5 → 4.0.0-beta.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/dist/bundle.js +74 -52
  2. package/esm/core/FileInput/FileInput.stories.js +44 -28
  3. package/esm/core/FileInput/index.js +8 -1
  4. package/esm/core/FileInput/styles.js +32 -12
  5. package/esm/core/Input/Input.stories.js +96 -59
  6. package/esm/core/Input/index.js +4 -1
  7. package/esm/core/Input/styles.js +16 -24
  8. package/esm/icons/Icon.stories.js +358 -10
  9. package/esm/shared/components/SbIconGrid/index.js +3 -2
  10. package/lib/core/FileInput/FileInput.stories.d.ts +14 -30
  11. package/lib/core/FileInput/FileInput.stories.d.ts.map +1 -1
  12. package/lib/core/FileInput/FileInput.stories.js +44 -28
  13. package/lib/core/FileInput/index.d.ts +5 -1
  14. package/lib/core/FileInput/index.d.ts.map +1 -1
  15. package/lib/core/FileInput/index.js +8 -1
  16. package/lib/core/FileInput/styles.d.ts +3 -0
  17. package/lib/core/FileInput/styles.d.ts.map +1 -1
  18. package/lib/core/FileInput/styles.js +32 -12
  19. package/lib/core/Input/Input.stories.d.ts +19 -50
  20. package/lib/core/Input/Input.stories.d.ts.map +1 -1
  21. package/lib/core/Input/Input.stories.js +96 -59
  22. package/lib/core/Input/index.d.ts +6 -4
  23. package/lib/core/Input/index.d.ts.map +1 -1
  24. package/lib/core/Input/index.js +4 -1
  25. package/lib/core/Input/styles.d.ts +1 -1
  26. package/lib/core/Input/styles.d.ts.map +1 -1
  27. package/lib/core/Input/styles.js +16 -24
  28. package/lib/icons/Icon.stories.js +358 -10
  29. package/lib/icons/withIcon.d.ts +2 -0
  30. package/lib/icons/withIcon.d.ts.map +1 -1
  31. package/lib/shared/components/SbIconGrid/index.d.ts +1 -1
  32. package/lib/shared/components/SbIconGrid/index.d.ts.map +1 -1
  33. package/lib/shared/components/SbIconGrid/index.js +3 -2
  34. package/package.json +3 -2
@@ -1,121 +1,158 @@
1
1
  import { action } from '@storybook/addon-actions';
2
2
  import Input from '.';
3
- import { jsx as _jsx } from "react/jsx-runtime";
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
- render: () => /*#__PURE__*/_jsx(Input, {
10
- type: "text",
11
- label: "Label",
12
- placeholder: "Placeholder text"
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
- render: () => /*#__PURE__*/_jsx(Input, {
18
- type: "text",
19
- label: "Focused",
20
- placeholder: "Placeholder text",
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
- render: () => /*#__PURE__*/_jsx(Input, {
27
- type: "text",
28
- label: "Disabled",
29
- placeholder: "Field disabled",
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
- render: () => /*#__PURE__*/_jsx(Input, {
36
- type: "password",
37
- label: "Inputfield - password",
38
- placeholder: "Password field",
39
- value: "Secret password"
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
- render: () => /*#__PURE__*/_jsx(Input, {
45
- type: "search",
44
+ args: {
45
+ type: 'search',
46
46
  highlight: true,
47
- placeholder: "Placeholder text"
48
- }),
47
+ placeholder: 'Placeholder text'
48
+ },
49
49
  name: 'Search'
50
50
  };
51
51
  export const Highlighted = {
52
- render: () => /*#__PURE__*/_jsx(Input, {
53
- type: "text",
54
- placeholder: "Placeholder text",
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
- render: () => /*#__PURE__*/_jsx(Input, {
61
- type: "text",
60
+ args: {
61
+ type: 'text',
62
62
  value: 'should be empty',
63
- placeholder: "Placeholder text",
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
- render: () => /*#__PURE__*/_jsx(Input, {
71
- type: "text",
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: "Placeholder text",
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
- render: () => /*#__PURE__*/_jsx(Input, {
85
- type: "text",
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: "Placeholder text",
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
- render: () => /*#__PURE__*/_jsx(Input, {
99
- type: "text",
100
- value: "123123123",
101
- placeholder: "Start typing a price",
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
- render: () => /*#__PURE__*/_jsx(Input, {
108
- type: "search",
109
- height: "50px",
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
- render: () => /*#__PURE__*/_jsx(Input, {
116
- label: "With info",
117
- info: "Hello, this is important information",
118
- invalidMessage: "error"
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
  };
@@ -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), type === 'file' && styles.file, props.disabled && styles.disabled(theme), props.cardInput && styles.cardInput],
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;