@norges-domstoler/dds-components 10.4.0 → 10.5.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.
@@ -0,0 +1,2 @@
1
+ import { SvgProps } from '../utils/propTypes';
2
+ export declare function DoubleChevronLeftIcon(props: SvgProps): JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SvgProps } from '../utils/propTypes';
2
+ export declare function DoubleChevronRightIcon(props: SvgProps): JSX.Element;
@@ -37,6 +37,8 @@ export * from './copy';
37
37
  export * from './court';
38
38
  export * from './dateRange';
39
39
  export * from './deaths';
40
+ export * from './doubleChevronLeft';
41
+ export * from './doubleChevronRight';
40
42
  export * from './download';
41
43
  export * from './downloadDone';
42
44
  export * from './dragHandle';
package/dist/cjs/index.js CHANGED
@@ -1262,6 +1262,22 @@ function DeathsIcon(props) {
1262
1262
  }));
1263
1263
  }
1264
1264
 
1265
+ function DoubleChevronLeftIcon(props) {
1266
+ return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
1267
+ children: jsxRuntime.jsx("path", {
1268
+ d: "M 18.414,7.41398L 17,6L 11,12L 17,18L 18.414,16.586L 13.828,12L 18.414,7.41398 Z M 12.414,7.41398L 11,6L 5.00001,12L 11,18L 12.414,16.586L 7.82801,12L 12.414,7.41398 Z "
1269
+ })
1270
+ }));
1271
+ }
1272
+
1273
+ function DoubleChevronRightIcon(props) {
1274
+ return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
1275
+ children: jsxRuntime.jsx("path", {
1276
+ d: "M 5.586,7.41398L 7,6L 13,12L 7,18L 5.586,16.586L 10.172,12L 5.586,7.41398 Z M 11.586,7.41399L 13,6.00001L 19,12L 13,18L 11.586,16.586L 16.172,12L 11.586,7.41399 Z "
1277
+ })
1278
+ }));
1279
+ }
1280
+
1265
1281
  function DownloadIcon(props) {
1266
1282
  return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
1267
1283
  children: jsxRuntime.jsx("path", {
@@ -10730,6 +10746,50 @@ var FormGenerator = function FormGenerator(props) {
10730
10746
  _useState2 = _slicedToArray(_useState, 2),
10731
10747
  myState = _useState2[0],
10732
10748
  setState = _useState2[1];
10749
+ var addFieldToState = function addFieldToState(field, state) {
10750
+ var key = '';
10751
+ switch (field.component) {
10752
+ case exports.FormGeneratorSupportedFields.Checkbox:
10753
+ case exports.FormGeneratorSupportedFields.ToggleButton:
10754
+ key = field.props.name || field.props.id || 'FIELD_MISSING_NAME_OR_ID';
10755
+ state = Object.assign(Object.assign({}, state), _defineProperty({}, key, field.props.defaultChecked));
10756
+ return state;
10757
+ case exports.FormGeneratorSupportedFields.CheckboxGroup:
10758
+ case exports.FormGeneratorSupportedFields.ToggleButtonGroup:
10759
+ field.children.forEach(function (child) {
10760
+ state = addFieldToState(child, state);
10761
+ });
10762
+ return state;
10763
+ case exports.FormGeneratorSupportedFields.RadioButton:
10764
+ case exports.FormGeneratorSupportedFields.RadioButtonGroup:
10765
+ key = field.props.name || field.props.id || 'FIELD_MISSING_NAME_OR_ID';
10766
+ state = Object.assign(Object.assign({}, state), _defineProperty({}, key, field.props.value));
10767
+ return state;
10768
+ case exports.FormGeneratorSupportedFields.Select:
10769
+ key = field.name || field.props.id || 'FIELD_MISSING_NAME_OR_ID';
10770
+ state = Object.assign(Object.assign({}, state), _defineProperty({}, key, field.props.defaultValue));
10771
+ return state;
10772
+ case exports.FormGeneratorSupportedFields.Datepicker:
10773
+ case exports.FormGeneratorSupportedFields.TextInput:
10774
+ key = field.props.name || field.props.id || 'FIELD_MISSING_NAME_OR_ID';
10775
+ state = Object.assign(Object.assign({}, state), _defineProperty({}, key, field.props.defaultValue));
10776
+ return state;
10777
+ }
10778
+ return state;
10779
+ };
10780
+ React.useEffect(function () {
10781
+ var state = {};
10782
+ fields.forEach(function (field) {
10783
+ if (isFormGeneratorRow(field)) {
10784
+ field.fields.forEach(function (field) {
10785
+ state = addFieldToState(field, state);
10786
+ });
10787
+ } else {
10788
+ state = addFieldToState(field, state);
10789
+ }
10790
+ });
10791
+ setState(state);
10792
+ }, []);
10733
10793
  var fieldOnChange = function fieldOnChange(event) {
10734
10794
  var _event$target = event.target,
10735
10795
  id = _event$target.id,
@@ -11504,6 +11564,8 @@ exports.DescriptionListDesc = DescriptionListDesc;
11504
11564
  exports.DescriptionListGroup = DescriptionListGroup;
11505
11565
  exports.DescriptionListTerm = DescriptionListTerm;
11506
11566
  exports.Divider = Divider;
11567
+ exports.DoubleChevronLeftIcon = DoubleChevronLeftIcon;
11568
+ exports.DoubleChevronRightIcon = DoubleChevronRightIcon;
11507
11569
  exports.DownloadDoneIcon = DownloadDoneIcon;
11508
11570
  exports.DownloadIcon = DownloadIcon;
11509
11571
  exports.DragHandleIcon = DragHandleIcon;
@@ -1,7 +1,7 @@
1
1
  import { slicedToArray as _slicedToArray, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { __rest } from 'tslib';
3
3
  import { jsx, Fragment } from 'react/jsx-runtime';
4
- import { useState, createElement } from 'react';
4
+ import { useState, useEffect, createElement } from 'react';
5
5
  import { Button } from '../Button/Button.js';
6
6
  import { Card } from '../Card/Card.js';
7
7
  import '../Card/CardAccordion/CardAccordion.js';
@@ -53,6 +53,50 @@ var FormGenerator = function FormGenerator(props) {
53
53
  _useState2 = _slicedToArray(_useState, 2),
54
54
  myState = _useState2[0],
55
55
  setState = _useState2[1];
56
+ var addFieldToState = function addFieldToState(field, state) {
57
+ var key = '';
58
+ switch (field.component) {
59
+ case FormGeneratorSupportedFields.Checkbox:
60
+ case FormGeneratorSupportedFields.ToggleButton:
61
+ key = field.props.name || field.props.id || 'FIELD_MISSING_NAME_OR_ID';
62
+ state = Object.assign(Object.assign({}, state), _defineProperty({}, key, field.props.defaultChecked));
63
+ return state;
64
+ case FormGeneratorSupportedFields.CheckboxGroup:
65
+ case FormGeneratorSupportedFields.ToggleButtonGroup:
66
+ field.children.forEach(function (child) {
67
+ state = addFieldToState(child, state);
68
+ });
69
+ return state;
70
+ case FormGeneratorSupportedFields.RadioButton:
71
+ case FormGeneratorSupportedFields.RadioButtonGroup:
72
+ key = field.props.name || field.props.id || 'FIELD_MISSING_NAME_OR_ID';
73
+ state = Object.assign(Object.assign({}, state), _defineProperty({}, key, field.props.value));
74
+ return state;
75
+ case FormGeneratorSupportedFields.Select:
76
+ key = field.name || field.props.id || 'FIELD_MISSING_NAME_OR_ID';
77
+ state = Object.assign(Object.assign({}, state), _defineProperty({}, key, field.props.defaultValue));
78
+ return state;
79
+ case FormGeneratorSupportedFields.Datepicker:
80
+ case FormGeneratorSupportedFields.TextInput:
81
+ key = field.props.name || field.props.id || 'FIELD_MISSING_NAME_OR_ID';
82
+ state = Object.assign(Object.assign({}, state), _defineProperty({}, key, field.props.defaultValue));
83
+ return state;
84
+ }
85
+ return state;
86
+ };
87
+ useEffect(function () {
88
+ var state = {};
89
+ fields.forEach(function (field) {
90
+ if (isFormGeneratorRow(field)) {
91
+ field.fields.forEach(function (field) {
92
+ state = addFieldToState(field, state);
93
+ });
94
+ } else {
95
+ state = addFieldToState(field, state);
96
+ }
97
+ });
98
+ setState(state);
99
+ }, []);
56
100
  var fieldOnChange = function fieldOnChange(event) {
57
101
  var _event$target = event.target,
58
102
  id = _event$target.id,
@@ -0,0 +1,2 @@
1
+ import { SvgProps } from '../utils/propTypes';
2
+ export declare function DoubleChevronLeftIcon(props: SvgProps): JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { SvgWrapper } from '../utils/SvgWrapper.js';
3
+
4
+ function DoubleChevronLeftIcon(props) {
5
+ return jsx(SvgWrapper, Object.assign({}, props, {
6
+ children: jsx("path", {
7
+ d: "M 18.414,7.41398L 17,6L 11,12L 17,18L 18.414,16.586L 13.828,12L 18.414,7.41398 Z M 12.414,7.41398L 11,6L 5.00001,12L 11,18L 12.414,16.586L 7.82801,12L 12.414,7.41398 Z "
8
+ })
9
+ }));
10
+ }
11
+
12
+ export { DoubleChevronLeftIcon };
@@ -0,0 +1,2 @@
1
+ import { SvgProps } from '../utils/propTypes';
2
+ export declare function DoubleChevronRightIcon(props: SvgProps): JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { SvgWrapper } from '../utils/SvgWrapper.js';
3
+
4
+ function DoubleChevronRightIcon(props) {
5
+ return jsx(SvgWrapper, Object.assign({}, props, {
6
+ children: jsx("path", {
7
+ d: "M 5.586,7.41398L 7,6L 13,12L 7,18L 5.586,16.586L 10.172,12L 5.586,7.41398 Z M 11.586,7.41399L 13,6.00001L 19,12L 13,18L 11.586,16.586L 16.172,12L 11.586,7.41399 Z "
8
+ })
9
+ }));
10
+ }
11
+
12
+ export { DoubleChevronRightIcon };
@@ -37,6 +37,8 @@ export * from './copy';
37
37
  export * from './court';
38
38
  export * from './dateRange';
39
39
  export * from './deaths';
40
+ export * from './doubleChevronLeft';
41
+ export * from './doubleChevronRight';
40
42
  export * from './download';
41
43
  export * from './downloadDone';
42
44
  export * from './dragHandle';
package/dist/index.js CHANGED
@@ -100,6 +100,8 @@ export { CopyIcon } from './icons/tsx/copy.js';
100
100
  export { CourtIcon } from './icons/tsx/court.js';
101
101
  export { DateRangeIcon } from './icons/tsx/dateRange.js';
102
102
  export { DeathsIcon } from './icons/tsx/deaths.js';
103
+ export { DoubleChevronLeftIcon } from './icons/tsx/doubleChevronLeft.js';
104
+ export { DoubleChevronRightIcon } from './icons/tsx/doubleChevronRight.js';
103
105
  export { DownloadIcon } from './icons/tsx/download.js';
104
106
  export { DownloadDoneIcon } from './icons/tsx/downloadDone.js';
105
107
  export { DragHandleIcon } from './icons/tsx/dragHandle.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norges-domstoler/dds-components",
3
- "version": "10.4.0",
3
+ "version": "10.5.0",
4
4
  "description": "React components used in Elsa - domstolenes designsystem",
5
5
  "author": "Elsa team",
6
6
  "license": "MIT",