@norges-domstoler/dds-components 13.6.3 → 13.7.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/dist/cjs/components/Search/Search.d.ts +2 -1
- package/dist/cjs/components/Search/Search.stories.d.ts +1 -0
- package/dist/cjs/index.js +44 -38
- package/dist/components/AppShell/AppShell.js +8 -1
- package/dist/components/AppShell/Navigation/Navigation.js +2 -2
- package/dist/components/Search/Search.d.ts +2 -1
- package/dist/components/Search/Search.js +6 -6
- package/dist/components/Search/Search.stories.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes, InputHTMLAttributes, MouseEvent } from 'react';
|
|
2
1
|
import { InputProps as BaseInputProps } from '@norges-domstoler/dds-form';
|
|
2
|
+
import { ButtonHTMLAttributes, InputHTMLAttributes, MouseEvent } from 'react';
|
|
3
3
|
export type SearchSize = 'small' | 'medium' | 'large';
|
|
4
4
|
type ButtonProps = {
|
|
5
5
|
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
6
6
|
label?: string;
|
|
7
7
|
loading?: boolean;
|
|
8
|
+
purpose?: 'primary' | 'secondary';
|
|
8
9
|
} & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
9
10
|
export type SearchProps = Pick<BaseInputProps, 'tip' | 'label'> & {
|
|
10
11
|
/**Størrelsen på komponenten. */
|
|
@@ -8,6 +8,7 @@ declare const _default: {
|
|
|
8
8
|
onClick: (event: import("react").MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
9
9
|
label?: string | undefined;
|
|
10
10
|
loading?: boolean | undefined;
|
|
11
|
+
purpose?: "secondary" | "primary" | undefined;
|
|
11
12
|
} & import("react").ButtonHTMLAttributes<HTMLButtonElement>) | undefined;
|
|
12
13
|
} & import("react").InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>> & {
|
|
13
14
|
AutocompleteWrapper: {
|
package/dist/cjs/index.js
CHANGED
|
@@ -7,8 +7,8 @@ var ddsIcons = require('@norges-domstoler/dds-icons');
|
|
|
7
7
|
var ddsTypography = require('@norges-domstoler/dds-typography');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
var styled = require('styled-components');
|
|
10
|
-
var React = require('react');
|
|
11
10
|
var ddsDesignTokens = require('@norges-domstoler/dds-design-tokens');
|
|
11
|
+
var React = require('react');
|
|
12
12
|
var tslib = require('tslib');
|
|
13
13
|
var ReactSelect = require('react-select');
|
|
14
14
|
var reactDom = require('react-dom');
|
|
@@ -181,7 +181,7 @@ var navTokens = appShellTokens.navigation;
|
|
|
181
181
|
var Sidebar = styled__default.default.div.withConfig({
|
|
182
182
|
displayName: "Navigation__Sidebar",
|
|
183
183
|
componentId: "sc-twhp5c-0"
|
|
184
|
-
})(["display:flex;flex-direction:column;height:100vh;width:", ";padding:", ";color:", ";background-color:", ";position:sticky;top:0;left:0;"], navTokens.width, navTokens.padding, navTokens.color, navTokens.backgroundColor);
|
|
184
|
+
})(["display:flex;flex-direction:column;height:100vh;width:", ";padding:", ";color:", ";background-color:", ";box-sizing:border-box;position:sticky;top:0;left:0;"], navTokens.width, navTokens.padding, navTokens.color, navTokens.backgroundColor);
|
|
185
185
|
var LogoAndVersionContainer = styled__default.default.div.withConfig({
|
|
186
186
|
displayName: "Navigation__LogoAndVersionContainer",
|
|
187
187
|
componentId: "sc-twhp5c-1"
|
|
@@ -226,7 +226,7 @@ var Navigation$1 = function Navigation(_ref) {
|
|
|
226
226
|
return item;
|
|
227
227
|
}), external.length > 0 && jsxRuntime.jsx(DividerWrapper, {
|
|
228
228
|
children: jsxRuntime.jsx(StyledDivider$1, {})
|
|
229
|
-
}), React.Children.map(external, function (item
|
|
229
|
+
}), React.Children.map(external, function (item) {
|
|
230
230
|
if (item.type !== NavigationItem$1) {
|
|
231
231
|
console.warn('Du bruker en React-komponent som ikke er tillat i AppShell-external. Du kan kun bruke AppShell.NavItem i AppShell-external.');
|
|
232
232
|
return null;
|
|
@@ -241,6 +241,10 @@ var AppShellContainer = styled__default.default.div.withConfig({
|
|
|
241
241
|
displayName: "AppShell__AppShellContainer",
|
|
242
242
|
componentId: "sc-1c8yu5p-0"
|
|
243
243
|
})(["display:flex;flex-direction:row;"]);
|
|
244
|
+
var MainContent = styled__default.default.main.withConfig({
|
|
245
|
+
displayName: "AppShell__MainContent",
|
|
246
|
+
componentId: "sc-1c8yu5p-1"
|
|
247
|
+
})(["min-width:calc(100vw - ", ");max-width:calc(100vw - ", ");"], appShellTokens.navigation.width, appShellTokens.navigation.width);
|
|
244
248
|
var AppShell$1 = function AppShell(_ref) {
|
|
245
249
|
var children = _ref.children,
|
|
246
250
|
_ref$version = _ref.version,
|
|
@@ -255,7 +259,9 @@ var AppShell$1 = function AppShell(_ref) {
|
|
|
255
259
|
version: version,
|
|
256
260
|
internal: internal,
|
|
257
261
|
external: external
|
|
258
|
-
}),
|
|
262
|
+
}), jsxRuntime.jsx(MainContent, {
|
|
263
|
+
children: children
|
|
264
|
+
})]
|
|
259
265
|
});
|
|
260
266
|
};
|
|
261
267
|
|
|
@@ -3242,6 +3248,40 @@ var searchTokens = {
|
|
|
3242
3248
|
suggestionsHeader: suggestionsHeader$1
|
|
3243
3249
|
};
|
|
3244
3250
|
|
|
3251
|
+
/**
|
|
3252
|
+
* Lager en change-event som kan resette verdien i et input-felt.
|
|
3253
|
+
* Dette vil resultere i en event som har: event.target.value = ''.
|
|
3254
|
+
*
|
|
3255
|
+
* @param inputElementId Id'en til et gitt input-felt
|
|
3256
|
+
* @returns En change-event som har en tom streng som target value
|
|
3257
|
+
*/
|
|
3258
|
+
function createEmptyChangeEvent(inputElementId) {
|
|
3259
|
+
var inputElement = document.getElementById(inputElementId);
|
|
3260
|
+
inputElement.value = '';
|
|
3261
|
+
var emptyChangeEvent = {
|
|
3262
|
+
target: inputElement,
|
|
3263
|
+
currentTarget: inputElement,
|
|
3264
|
+
bubbles: true,
|
|
3265
|
+
cancelable: false,
|
|
3266
|
+
defaultPrevented: false,
|
|
3267
|
+
eventPhase: 0,
|
|
3268
|
+
isTrusted: false,
|
|
3269
|
+
preventDefault: function preventDefault() {},
|
|
3270
|
+
stopPropagation: function stopPropagation() {},
|
|
3271
|
+
nativeEvent: new Event('input'),
|
|
3272
|
+
persist: function persist() {},
|
|
3273
|
+
type: 'change',
|
|
3274
|
+
timeStamp: Date.now(),
|
|
3275
|
+
isDefaultPrevented: function isDefaultPrevented() {
|
|
3276
|
+
return false;
|
|
3277
|
+
},
|
|
3278
|
+
isPropagationStopped: function isPropagationStopped() {
|
|
3279
|
+
return false;
|
|
3280
|
+
}
|
|
3281
|
+
};
|
|
3282
|
+
return emptyChangeEvent;
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3245
3285
|
var border$7 = ddsDesignTokens.ddsBaseTokens.border,
|
|
3246
3286
|
borderRadius$4 = ddsDesignTokens.ddsBaseTokens.borderRadius,
|
|
3247
3287
|
colors$i = ddsDesignTokens.ddsBaseTokens.colors,
|
|
@@ -3462,40 +3502,6 @@ var SearchSuggestions = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
3462
3502
|
});
|
|
3463
3503
|
SearchSuggestions.displayName = 'SearchSuggestions';
|
|
3464
3504
|
|
|
3465
|
-
/**
|
|
3466
|
-
* Lager en change-event som kan resette verdien i et input-felt.
|
|
3467
|
-
* Dette vil resultere i en event som har: event.target.value = ''.
|
|
3468
|
-
*
|
|
3469
|
-
* @param inputElementId Id'en til et gitt input-felt
|
|
3470
|
-
* @returns En change-event som har en tom streng som target value
|
|
3471
|
-
*/
|
|
3472
|
-
function createEmptyChangeEvent(inputElementId) {
|
|
3473
|
-
var inputElement = document.getElementById(inputElementId);
|
|
3474
|
-
inputElement.value = '';
|
|
3475
|
-
var emptyChangeEvent = {
|
|
3476
|
-
target: inputElement,
|
|
3477
|
-
currentTarget: inputElement,
|
|
3478
|
-
bubbles: true,
|
|
3479
|
-
cancelable: false,
|
|
3480
|
-
defaultPrevented: false,
|
|
3481
|
-
eventPhase: 0,
|
|
3482
|
-
isTrusted: false,
|
|
3483
|
-
preventDefault: function preventDefault() {},
|
|
3484
|
-
stopPropagation: function stopPropagation() {},
|
|
3485
|
-
nativeEvent: new Event('input'),
|
|
3486
|
-
persist: function persist() {},
|
|
3487
|
-
type: 'change',
|
|
3488
|
-
timeStamp: Date.now(),
|
|
3489
|
-
isDefaultPrevented: function isDefaultPrevented() {
|
|
3490
|
-
return false;
|
|
3491
|
-
},
|
|
3492
|
-
isPropagationStopped: function isPropagationStopped() {
|
|
3493
|
-
return false;
|
|
3494
|
-
}
|
|
3495
|
-
};
|
|
3496
|
-
return emptyChangeEvent;
|
|
3497
|
-
}
|
|
3498
|
-
|
|
3499
3505
|
var input = searchTokens.input,
|
|
3500
3506
|
outerContainer$5 = searchTokens.outerContainer,
|
|
3501
3507
|
horisontalContainer = searchTokens.horisontalContainer,
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
+
import { appShellTokens } from './AppShell.tokens.js';
|
|
3
4
|
import { Navigation } from './Navigation/Navigation.js';
|
|
4
5
|
|
|
5
6
|
var AppShellContainer = styled.div.withConfig({
|
|
6
7
|
displayName: "AppShell__AppShellContainer",
|
|
7
8
|
componentId: "sc-1c8yu5p-0"
|
|
8
9
|
})(["display:flex;flex-direction:row;"]);
|
|
10
|
+
var MainContent = styled.main.withConfig({
|
|
11
|
+
displayName: "AppShell__MainContent",
|
|
12
|
+
componentId: "sc-1c8yu5p-1"
|
|
13
|
+
})(["min-width:calc(100vw - ", ");max-width:calc(100vw - ", ");"], appShellTokens.navigation.width, appShellTokens.navigation.width);
|
|
9
14
|
var AppShell = function AppShell(_ref) {
|
|
10
15
|
var children = _ref.children,
|
|
11
16
|
_ref$version = _ref.version,
|
|
@@ -20,7 +25,9 @@ var AppShell = function AppShell(_ref) {
|
|
|
20
25
|
version: version,
|
|
21
26
|
internal: internal,
|
|
22
27
|
external: external
|
|
23
|
-
}),
|
|
28
|
+
}), jsx(MainContent, {
|
|
29
|
+
children: children
|
|
30
|
+
})]
|
|
24
31
|
});
|
|
25
32
|
};
|
|
26
33
|
|
|
@@ -9,7 +9,7 @@ var navTokens = appShellTokens.navigation;
|
|
|
9
9
|
var Sidebar = styled.div.withConfig({
|
|
10
10
|
displayName: "Navigation__Sidebar",
|
|
11
11
|
componentId: "sc-twhp5c-0"
|
|
12
|
-
})(["display:flex;flex-direction:column;height:100vh;width:", ";padding:", ";color:", ";background-color:", ";position:sticky;top:0;left:0;"], navTokens.width, navTokens.padding, navTokens.color, navTokens.backgroundColor);
|
|
12
|
+
})(["display:flex;flex-direction:column;height:100vh;width:", ";padding:", ";color:", ";background-color:", ";box-sizing:border-box;position:sticky;top:0;left:0;"], navTokens.width, navTokens.padding, navTokens.color, navTokens.backgroundColor);
|
|
13
13
|
var LogoAndVersionContainer = styled.div.withConfig({
|
|
14
14
|
displayName: "Navigation__LogoAndVersionContainer",
|
|
15
15
|
componentId: "sc-twhp5c-1"
|
|
@@ -54,7 +54,7 @@ var Navigation = function Navigation(_ref) {
|
|
|
54
54
|
return item;
|
|
55
55
|
}), external.length > 0 && jsx(DividerWrapper, {
|
|
56
56
|
children: jsx(StyledDivider, {})
|
|
57
|
-
}), Children.map(external, function (item
|
|
57
|
+
}), Children.map(external, function (item) {
|
|
58
58
|
if (item.type !== NavigationItem) {
|
|
59
59
|
console.warn('Du bruker en React-komponent som ikke er tillat i AppShell-external. Du kan kun bruke AppShell.NavItem i AppShell-external.');
|
|
60
60
|
return null;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes, InputHTMLAttributes, MouseEvent } from 'react';
|
|
2
1
|
import { InputProps as BaseInputProps } from '@norges-domstoler/dds-form';
|
|
2
|
+
import { ButtonHTMLAttributes, InputHTMLAttributes, MouseEvent } from 'react';
|
|
3
3
|
export type SearchSize = 'small' | 'medium' | 'large';
|
|
4
4
|
type ButtonProps = {
|
|
5
5
|
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
6
6
|
label?: string;
|
|
7
7
|
loading?: boolean;
|
|
8
|
+
purpose?: 'primary' | 'secondary';
|
|
8
9
|
} & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
9
10
|
export type SearchProps = Pick<BaseInputProps, 'tip' | 'label'> & {
|
|
10
11
|
/**Størrelsen på komponenten. */
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import { __rest } from 'tslib';
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import { forwardRef, useId, useState } from 'react';
|
|
5
|
-
import styled, { css } from 'styled-components';
|
|
6
|
-
import { Input as Input$1 } from '@norges-domstoler/dds-form';
|
|
7
4
|
import { derivativeIdGenerator, useCombinedRef, spaceSeparatedIdListGenerator } from '@norges-domstoler/dds-core';
|
|
5
|
+
import { Input as Input$1 } from '@norges-domstoler/dds-form';
|
|
8
6
|
import { Icon, SearchIcon, CloseSmallIcon } from '@norges-domstoler/dds-icons';
|
|
9
|
-
import { Button } from '../Button/Button.js';
|
|
10
7
|
import { getFontStyling, Label } from '@norges-domstoler/dds-typography';
|
|
8
|
+
import { forwardRef, useId, useState } from 'react';
|
|
9
|
+
import styled, { css } from 'styled-components';
|
|
10
|
+
import { renderInputMessage } from '../../utils/renderInputMessage.js';
|
|
11
|
+
import { Button } from '../Button/Button.js';
|
|
11
12
|
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
|
12
13
|
import { useAutocompleteSearch } from './AutocompleteSearch.context.js';
|
|
13
14
|
import { typographyTypes, searchTokens } from './Search.tokens.js';
|
|
14
|
-
import { SearchSuggestions } from './SearchSuggestions.js';
|
|
15
15
|
import { createEmptyChangeEvent } from './Search.utils.js';
|
|
16
|
-
import {
|
|
16
|
+
import { SearchSuggestions } from './SearchSuggestions.js';
|
|
17
17
|
|
|
18
18
|
var input = searchTokens.input,
|
|
19
19
|
outerContainer = searchTokens.outerContainer,
|
|
@@ -8,6 +8,7 @@ declare const _default: {
|
|
|
8
8
|
onClick: (event: import("react").MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
9
9
|
label?: string | undefined;
|
|
10
10
|
loading?: boolean | undefined;
|
|
11
|
+
purpose?: "secondary" | "primary" | undefined;
|
|
11
12
|
} & import("react").ButtonHTMLAttributes<HTMLButtonElement>) | undefined;
|
|
12
13
|
} & import("react").InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>> & {
|
|
13
14
|
AutocompleteWrapper: {
|