@bbl-digital/snorre 4.0.13 → 4.0.15
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/bundle.js +46 -28
- package/esm/core/Html/Html.stories.js +13 -12
- package/esm/core/Html/index.js +16 -9
- package/esm/core/Input/Input.stories.js +15 -0
- package/esm/core/Input/index.js +1 -1
- package/esm/core/Input/styles.js +27 -17
- package/lib/core/Html/Html.stories.d.ts +9 -19
- package/lib/core/Html/Html.stories.d.ts.map +1 -1
- package/lib/core/Html/Html.stories.js +13 -12
- package/lib/core/Html/index.d.ts +3 -3
- package/lib/core/Html/index.d.ts.map +1 -1
- package/lib/core/Html/index.js +16 -9
- package/lib/core/Input/Input.stories.d.ts +2 -0
- package/lib/core/Input/Input.stories.d.ts.map +1 -1
- package/lib/core/Input/Input.stories.js +15 -0
- package/lib/core/Input/index.d.ts.map +1 -1
- package/lib/core/Input/index.js +1 -1
- package/lib/core/Input/styles.d.ts +1 -0
- package/lib/core/Input/styles.d.ts.map +1 -1
- package/lib/core/Input/styles.js +27 -17
- package/package.json +1 -1
@@ -1,22 +1,23 @@
|
|
1
1
|
import Html from '.';
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
3
3
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
4
|
-
|
4
|
+
const meta = {
|
5
5
|
title: 'Core/Html',
|
6
6
|
component: Html
|
7
7
|
};
|
8
|
+
export default meta;
|
8
9
|
export const HtmlDefault = {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
name: 'Html',
|
11
|
+
args: {
|
12
|
+
text: '<h3>Html text</h3><p><i>Displays text as html</i></p>'
|
13
|
+
}
|
13
14
|
};
|
14
15
|
export const ExternalLinks = {
|
15
|
-
|
16
|
+
name: 'External links',
|
17
|
+
args: {
|
16
18
|
externalLinks: true,
|
17
|
-
text:
|
18
|
-
}
|
19
|
-
name: 'External links'
|
19
|
+
text: '<h3>Html text</h3><p><i>Displays text as html</i><a href="vg.no">vg.no</a></p>'
|
20
|
+
}
|
20
21
|
};
|
21
22
|
export const Whitespace = {
|
22
23
|
render: () => /*#__PURE__*/_jsxs("div", {
|
@@ -35,9 +36,9 @@ export const Whitespace = {
|
|
35
36
|
name: 'Whitespace'
|
36
37
|
};
|
37
38
|
export const RemoveMargins = {
|
38
|
-
|
39
|
+
name: 'Remove margins',
|
40
|
+
args: {
|
39
41
|
removeMargins: true,
|
40
42
|
text: '<h1>Header</h1><p>Hello</p><p>New line</p>'
|
41
|
-
}
|
42
|
-
name: 'Remove margins'
|
43
|
+
}
|
43
44
|
};
|
package/esm/core/Html/index.js
CHANGED
@@ -1,13 +1,20 @@
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
2
|
-
import React from 'react';
|
3
2
|
import { styles } from './styles';
|
4
3
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
5
|
-
const Html =
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
4
|
+
const Html = ({
|
5
|
+
className,
|
6
|
+
dark,
|
7
|
+
externalLinks,
|
8
|
+
removeMargins,
|
9
|
+
secondary,
|
10
|
+
size,
|
11
|
+
text,
|
12
|
+
whiteSpace
|
13
|
+
}) => _jsx("div", {
|
14
|
+
css: theme => [styles.default(theme), secondary && styles.secondary(theme), dark && styles.dark(theme), size && styles.size(size), styles.whiteSpace(whiteSpace ? whiteSpace : 'pre-wrap'), removeMargins && styles.removeMargins],
|
15
|
+
className: className,
|
16
|
+
dangerouslySetInnerHTML: {
|
17
|
+
__html: externalLinks ? text.replace(/href/g, "target='_blank' href") : text
|
18
|
+
}
|
19
|
+
});
|
13
20
|
export default Html;
|
@@ -128,6 +128,21 @@ export const CardInput = {
|
|
128
128
|
},
|
129
129
|
name: 'CardInput'
|
130
130
|
};
|
131
|
+
export const Invalid = {
|
132
|
+
args: {
|
133
|
+
label: 'Invalid',
|
134
|
+
invalid: true,
|
135
|
+
invalidMessage: 'error'
|
136
|
+
},
|
137
|
+
name: 'Invalid'
|
138
|
+
};
|
139
|
+
export const InvalidNoLabel = {
|
140
|
+
args: {
|
141
|
+
invalid: true,
|
142
|
+
invalidMessage: 'error'
|
143
|
+
},
|
144
|
+
name: 'Invalid no label'
|
145
|
+
};
|
131
146
|
export const Controls = {
|
132
147
|
args: {
|
133
148
|
label: 'With info',
|
package/esm/core/Input/index.js
CHANGED
@@ -91,7 +91,7 @@ const Input = /*#__PURE__*/React.forwardRef(({
|
|
91
91
|
}), type === 'search' && _jsx(IconSearch, {}), props.invalidMessage && _jsx(IconErrorOutline, {
|
92
92
|
size: "16px"
|
93
93
|
}), props.invalidMessage && _jsx("span", {
|
94
|
-
css: styles.errorMessage,
|
94
|
+
css: (styles.errorMessage, !props?.label && styles.errorMessageNoLabel),
|
95
95
|
children: props.invalidMessage
|
96
96
|
})]
|
97
97
|
}), info && _jsx("span", {
|