@norges-domstoler/dds-components 13.6.4 → 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 +34 -34
- 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
|
@@ -3248,6 +3248,40 @@ var searchTokens = {
|
|
|
3248
3248
|
suggestionsHeader: suggestionsHeader$1
|
|
3249
3249
|
};
|
|
3250
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
|
+
|
|
3251
3285
|
var border$7 = ddsDesignTokens.ddsBaseTokens.border,
|
|
3252
3286
|
borderRadius$4 = ddsDesignTokens.ddsBaseTokens.borderRadius,
|
|
3253
3287
|
colors$i = ddsDesignTokens.ddsBaseTokens.colors,
|
|
@@ -3468,40 +3502,6 @@ var SearchSuggestions = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
3468
3502
|
});
|
|
3469
3503
|
SearchSuggestions.displayName = 'SearchSuggestions';
|
|
3470
3504
|
|
|
3471
|
-
/**
|
|
3472
|
-
* Lager en change-event som kan resette verdien i et input-felt.
|
|
3473
|
-
* Dette vil resultere i en event som har: event.target.value = ''.
|
|
3474
|
-
*
|
|
3475
|
-
* @param inputElementId Id'en til et gitt input-felt
|
|
3476
|
-
* @returns En change-event som har en tom streng som target value
|
|
3477
|
-
*/
|
|
3478
|
-
function createEmptyChangeEvent(inputElementId) {
|
|
3479
|
-
var inputElement = document.getElementById(inputElementId);
|
|
3480
|
-
inputElement.value = '';
|
|
3481
|
-
var emptyChangeEvent = {
|
|
3482
|
-
target: inputElement,
|
|
3483
|
-
currentTarget: inputElement,
|
|
3484
|
-
bubbles: true,
|
|
3485
|
-
cancelable: false,
|
|
3486
|
-
defaultPrevented: false,
|
|
3487
|
-
eventPhase: 0,
|
|
3488
|
-
isTrusted: false,
|
|
3489
|
-
preventDefault: function preventDefault() {},
|
|
3490
|
-
stopPropagation: function stopPropagation() {},
|
|
3491
|
-
nativeEvent: new Event('input'),
|
|
3492
|
-
persist: function persist() {},
|
|
3493
|
-
type: 'change',
|
|
3494
|
-
timeStamp: Date.now(),
|
|
3495
|
-
isDefaultPrevented: function isDefaultPrevented() {
|
|
3496
|
-
return false;
|
|
3497
|
-
},
|
|
3498
|
-
isPropagationStopped: function isPropagationStopped() {
|
|
3499
|
-
return false;
|
|
3500
|
-
}
|
|
3501
|
-
};
|
|
3502
|
-
return emptyChangeEvent;
|
|
3503
|
-
}
|
|
3504
|
-
|
|
3505
3505
|
var input = searchTokens.input,
|
|
3506
3506
|
outerContainer$5 = searchTokens.outerContainer,
|
|
3507
3507
|
horisontalContainer = searchTokens.horisontalContainer,
|
|
@@ -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: {
|