@navikt/ds-react 0.13.0 → 0.14.0-beta.1

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.
Files changed (70) hide show
  1. package/cjs/form/Fieldset/Fieldset.js +6 -3
  2. package/cjs/form/Select.js +5 -2
  3. package/cjs/form/TextField.js +8 -3
  4. package/cjs/form/Textarea.js +5 -2
  5. package/cjs/form/checkbox/Checkbox.js +9 -8
  6. package/cjs/form/checkbox/useCheckbox.js +2 -1
  7. package/cjs/form/radio/Radio.js +8 -14
  8. package/cjs/form/radio/useRadio.js +2 -1
  9. package/cjs/form/search-field/SearchField.js +5 -2
  10. package/cjs/loader/Loader.js +1 -1
  11. package/dist/complete.js +15978 -0
  12. package/dist/partial.js +4039 -0
  13. package/esm/form/Fieldset/Fieldset.js +7 -4
  14. package/esm/form/Fieldset/Fieldset.js.map +1 -1
  15. package/esm/form/Select.js +5 -2
  16. package/esm/form/Select.js.map +1 -1
  17. package/esm/form/TextField.js +9 -4
  18. package/esm/form/TextField.js.map +1 -1
  19. package/esm/form/Textarea.js +5 -2
  20. package/esm/form/Textarea.js.map +1 -1
  21. package/esm/form/checkbox/Checkbox.d.ts +6 -1
  22. package/esm/form/checkbox/Checkbox.js +10 -9
  23. package/esm/form/checkbox/Checkbox.js.map +1 -1
  24. package/esm/form/checkbox/CheckboxGroup.d.ts +1 -1
  25. package/esm/form/checkbox/CheckboxGroup.js.map +1 -1
  26. package/esm/form/checkbox/useCheckbox.js +2 -1
  27. package/esm/form/checkbox/useCheckbox.js.map +1 -1
  28. package/esm/form/radio/Radio.d.ts +4 -1
  29. package/esm/form/radio/Radio.js +9 -15
  30. package/esm/form/radio/Radio.js.map +1 -1
  31. package/esm/form/radio/RadioGroup.d.ts +1 -1
  32. package/esm/form/radio/RadioGroup.js.map +1 -1
  33. package/esm/form/radio/useRadio.js +2 -1
  34. package/esm/form/radio/useRadio.js.map +1 -1
  35. package/esm/form/search-field/SearchField.js +5 -2
  36. package/esm/form/search-field/SearchField.js.map +1 -1
  37. package/esm/loader/Loader.js +1 -1
  38. package/esm/loader/Loader.js.map +1 -1
  39. package/package.json +9 -6
  40. package/src/form/Fieldset/Fieldset.tsx +25 -12
  41. package/src/form/Select.tsx +5 -1
  42. package/src/form/TextField.tsx +30 -11
  43. package/src/form/Textarea.tsx +5 -1
  44. package/src/form/checkbox/Checkbox.tsx +30 -37
  45. package/src/form/checkbox/CheckboxGroup.tsx +2 -1
  46. package/src/form/checkbox/stories/checkbox.stories.mdx +17 -45
  47. package/src/form/checkbox/stories/checkbox.stories.tsx +55 -82
  48. package/src/form/checkbox/useCheckbox.ts +5 -1
  49. package/src/form/radio/Radio.tsx +26 -40
  50. package/src/form/radio/RadioGroup.tsx +2 -1
  51. package/src/form/radio/stories/radio.stories.mdx +3 -29
  52. package/src/form/radio/stories/radio.stories.tsx +33 -61
  53. package/src/form/radio/useRadio.ts +5 -1
  54. package/src/form/search-field/SearchField.tsx +5 -1
  55. package/src/form/search-field/stories/search-field.stories.tsx +25 -1
  56. package/src/form/stories/fieldset.stories.tsx +6 -2
  57. package/src/form/stories/select.stories.tsx +1 -1
  58. package/src/form/stories/text-field.stories.tsx +23 -1
  59. package/src/form/stories/textarea.stories.tsx +12 -2
  60. package/src/grid/stories/grid.stories.mdx +3 -3
  61. package/src/guide-panel/stories/example.css +4 -4
  62. package/src/guide-panel/stories/guidepanel.stories.mdx +7 -7
  63. package/src/guide-panel/stories/guidepanel.stories.tsx +6 -6
  64. package/src/loader/Loader.tsx +1 -1
  65. package/src/loader/stories/loader.stories.mdx +0 -16
  66. package/src/popover/stories/popover.stories.tsx +1 -1
  67. package/src/speech-bubble/stories/speechbubble.stories.mdx +4 -4
  68. package/src/speech-bubble/stories/speechbubble.stories.tsx +2 -2
  69. package/src/typography/stories/index.css +1 -1
  70. package/LICENCE +0 -31
@@ -2,6 +2,7 @@ import { useContext } from "react";
2
2
  import { useFormField } from "../useFormField";
3
3
  import { RadioProps } from "./Radio";
4
4
  import { RadioGroupContext } from "./RadioGroup";
5
+ import { omit } from "../..";
5
6
 
6
7
  /**
7
8
  * Handles props for Radios in context with Fieldset and RadioGroup
@@ -9,7 +10,10 @@ import { RadioGroupContext } from "./RadioGroup";
9
10
  export const useRadio = (props: RadioProps) => {
10
11
  const radioGroup = useContext(RadioGroupContext);
11
12
 
12
- const { inputProps, ...rest } = useFormField(props, "radio");
13
+ const { inputProps, ...rest } = useFormField(
14
+ omit(props, ["description"]),
15
+ "radio"
16
+ );
13
17
 
14
18
  if (!radioGroup) {
15
19
  console.warn("<Radio> must be used inside <RadioGroup>.");
@@ -79,7 +79,10 @@ const SearchField = forwardRef<HTMLDivElement, SearchFieldProps>(
79
79
  "navds-form-field",
80
80
  `navds-form-field--${size ?? "medium"}`,
81
81
  "navds-search-field",
82
- { "navds-search-field--error": hasError }
82
+ {
83
+ "navds-search-field--error": hasError,
84
+ "navds-search-field--disabled": !!inputProps.disabled,
85
+ }
83
86
  )}
84
87
  >
85
88
  <Label
@@ -94,6 +97,7 @@ const SearchField = forwardRef<HTMLDivElement, SearchFieldProps>(
94
97
  </Label>
95
98
  {!!description && (
96
99
  <BodyShort
100
+ as="div"
97
101
  className={cl("navds-text-field__description", {
98
102
  "sr-only": hideLabel,
99
103
  })}
@@ -15,7 +15,7 @@ export const All = () => {
15
15
  <h1>SearchField</h1>
16
16
  <SearchField
17
17
  label="Mollit eiusmod"
18
- description="Ea cupidatat eu sunt commodo"
18
+ description={<div>Ea cupidatat eu sunt commodo</div>}
19
19
  >
20
20
  <SearchField.Input />
21
21
  <SearchField.Button>
@@ -170,6 +170,30 @@ export const All = () => {
170
170
  <SearchField.Input />
171
171
  </SearchField>
172
172
  </Fieldset>
173
+
174
+ <h2>Disabled </h2>
175
+ <SearchField
176
+ disabled
177
+ label="Mollit eiusmod"
178
+ description="Ea cupidatat eu sunt commodo"
179
+ >
180
+ <SearchField.Input />
181
+ <SearchField.Button>
182
+ <Search /> Søk
183
+ </SearchField.Button>
184
+ </SearchField>
185
+ <Fieldset legend="Filter" disabled>
186
+ <SearchField
187
+ label="Mollit eiusmod"
188
+ description="Ea cupidatat eu sunt commodo"
189
+ error="Errormsg"
190
+ >
191
+ <SearchField.Input />
192
+ <SearchField.Button>
193
+ <Search /> Søk
194
+ </SearchField.Button>
195
+ </SearchField>
196
+ </Fieldset>
173
197
  </>
174
198
  );
175
199
  };
@@ -21,9 +21,13 @@ export const All = () => {
21
21
 
22
22
  <Fieldset
23
23
  legend="Mollit eiusmod"
24
- description="Quis reprehenderit esse cillum"
24
+ description={<div>Quis reprehenderit esse cillum</div>}
25
25
  >
26
- <TextField label="Textfield label" hideLabel />
26
+ <TextField
27
+ label="Textfield label"
28
+ hideLabel
29
+ description={<div>Quis reprehenderit esse cillum</div>}
30
+ />
27
31
  <TextField label="Textfield label" hideLabel />
28
32
  </Fieldset>
29
33
 
@@ -19,7 +19,7 @@ export const All = () => {
19
19
 
20
20
  <h2>Description</h2>
21
21
 
22
- <Select label="Ipsum enim quis culpa" description="Aute enim">
22
+ <Select label="Ipsum enim quis culpa" description={<div>Aute enim</div>}>
23
23
  <option value="">Velg land</option>
24
24
  <option value="norge">Norge</option>
25
25
  <option value="sverige">Sverige</option>
@@ -15,7 +15,10 @@ export const All = () => {
15
15
 
16
16
  <h2>Description</h2>
17
17
 
18
- <TextField label="Laborum excepteur" description="Cillum mollit" />
18
+ <TextField
19
+ label="Laborum excepteur"
20
+ description={<div>Cillum mollit</div>}
21
+ />
19
22
 
20
23
  <h2>Passord-type</h2>
21
24
  <TextField label="Passord" type="password" />
@@ -52,6 +55,25 @@ export const All = () => {
52
55
  description="Cillum mollit"
53
56
  disabled
54
57
  />
58
+ <TextField
59
+ size="small"
60
+ label="Laborum excepteur"
61
+ description="Cillum mollit"
62
+ disabled
63
+ />
64
+ <h2>Readonly</h2>
65
+
66
+ <TextField
67
+ label="Laborum excepteur"
68
+ description="Cillum mollit"
69
+ readOnly
70
+ />
71
+ <TextField
72
+ label="Laborum excepteur"
73
+ description="Cillum mollit"
74
+ size="small"
75
+ readOnly
76
+ />
55
77
  </div>
56
78
  );
57
79
  };
@@ -23,7 +23,7 @@ export const All = () => {
23
23
 
24
24
  <Textarea
25
25
  label="In anim elit"
26
- description="Reprehenderit esse proident"
26
+ description={<div>Reprehenderit esse proident</div>}
27
27
  value={value}
28
28
  onChange={handleChange}
29
29
  />
@@ -78,7 +78,17 @@ export const All = () => {
78
78
  description="Reprehenderit esse proident"
79
79
  maxLength={400}
80
80
  disabled
81
- value={value}
81
+ value="Consectetur commodo mollit voluptate esse minim elit deserunt fugiat consectetur laboris."
82
+ onChange={handleChange}
83
+ />
84
+ <h2>Readonly</h2>
85
+
86
+ <Textarea
87
+ label="In anim elit"
88
+ description="Reprehenderit esse proident"
89
+ maxLength={400}
90
+ readOnly
91
+ value="Consectetur commodo mollit voluptate esse minim elit deserunt fugiat consectetur laboris."
82
92
  onChange={handleChange}
83
93
  />
84
94
  </div>
@@ -31,13 +31,13 @@ Stylingen som blir satt av den:
31
31
  .navds-content-container {
32
32
  margin-left: auto;
33
33
  margin-right: auto;
34
- max-width: var(--navds-content-container-max-width); # 79.5rem (1272px)
35
- padding: var(--navds-content-container-padding-small); # 1rem
34
+ max-width: 79.5rem; # (1272px)
35
+ padding: var(--navds-spacing-4); # 1rem
36
36
  }
37
37
 
38
38
  @media (min-width: 448px) {
39
39
  .navds-content-container {
40
- padding: var(--navds-content-container-padding-medium-and-larger); # 1.5rem
40
+ padding: var(--navds-spacing-6); # 1.5rem
41
41
  }
42
42
  }
43
43
  ```
@@ -1,13 +1,13 @@
1
1
  .sb-guidepanel__tokens--purple {
2
- --navds-guide-panel-color-border: var(--navds-color-purple-40);
2
+ --navds-guide-panel-color-border: var(--navds-global-color-purple-400);
3
3
  --navds-guide-panel-color-illustration-background: var(
4
- --navds-color-purple-20
4
+ --navds-global-color-purple-200
5
5
  );
6
6
  }
7
7
 
8
8
  .sb-guidepanel__tokens--green {
9
- --navds-guide-panel-color-border: var(--navds-color-green-40);
9
+ --navds-guide-panel-color-border: var(--navds-global-color-green-400);
10
10
  --navds-guide-panel-color-illustration-background: var(
11
- --navds-color-green-20
11
+ --navds-global-color-green-200
12
12
  );
13
13
  }
@@ -38,9 +38,9 @@ Istedenfor fargetema/themes slik som tidligere veileder brukte velger man nå se
38
38
  overskrive tokens. Det anbefalses å gjøre dette med eks Styled-Components eller css-klasser, men kan inlines også
39
39
 
40
40
  ```css
41
- /* default */
42
- --navds-guide-panel-color-border: var(--navds-color-blue-40);
43
- --navds-guide-panel-color-illustration-background: var(--navds-color-blue-20);
41
+ /* Tokens */
42
+ --navds-guide-panel-color-border
43
+ --navds-guide-panel-color-illustration-background
44
44
  ```
45
45
 
46
46
  ```jsx
@@ -55,16 +55,16 @@ overskrive tokens. Det anbefalses å gjøre dette med eks Styled-Components elle
55
55
  /* Inline */
56
56
  <GuidePanel
57
57
  style={{
58
- ["--navds-guide-panel-color-illustration-background" as any]: "var(--navds-color-orange-20)",
59
- ["--navds-guide-panel-color-border" as any]: "var(--navds-color-orange-40)",
58
+ ["--navds-guide-panel-color-illustration-background" as any]: "var(--navds-global-color-orange-200)",
59
+ ["--navds-guide-panel-color-border" as any]: "var(--navds-global-color-orange-400)",
60
60
  }}
61
61
  >
62
62
  Cupidatat proident adipisicing eu nulla laborum dolore irure aliqua.
63
63
  </GuidePanel>
64
64
  <GuidePanel
65
65
  style={{
66
- ["--navds-guide-panel-color-illustration-background" as any]: "var(--navds-color-orange-20)",
67
- ["--navds-guide-panel-color-border" as any]: "var(--navds-color-orange-40)",
66
+ ["--navds-guide-panel-color-illustration-background" as any]: "var(--navds-global-color-orange-200)",
67
+ ["--navds-guide-panel-color-border" as any]: "var(--navds-global-color-orange-400)",
68
68
  }}
69
69
  >
70
70
  Cupidatat proident adipisicing eu nulla laborum dolore irure aliqua.
@@ -21,24 +21,24 @@ export const All = () => {
21
21
  <h2>custom colors</h2>
22
22
  <GuidePanel
23
23
  style={{
24
- ["--navds-guide-panel-color-illustration-background" as any]: "var(--navds-color-purple-20)",
25
- ["--navds-guide-panel-color-border" as any]: "var(--navds-color-purple-40)",
24
+ ["--navds-guide-panel-color-illustration-background" as any]: "var(--navds-global-color-purple-200)",
25
+ ["--navds-guide-panel-color-border" as any]: "var(--navds-global-color-purple-400)",
26
26
  }}
27
27
  >
28
28
  {panelText}
29
29
  </GuidePanel>
30
30
  <GuidePanel
31
31
  style={{
32
- ["--navds-guide-panel-color-illustration-background" as any]: "var(--navds-color-green-20)",
33
- ["--navds-guide-panel-color-border" as any]: "var(--navds-color-green-40)",
32
+ ["--navds-guide-panel-color-illustration-background" as any]: "var(--navds-global-color-green-200)",
33
+ ["--navds-guide-panel-color-border" as any]: "var(--navds-global-color-green-400)",
34
34
  }}
35
35
  >
36
36
  {panelText}
37
37
  </GuidePanel>
38
38
  <GuidePanel
39
39
  style={{
40
- ["--navds-guide-panel-color-illustration-background" as any]: "var(--navds-color-orange-20)",
41
- ["--navds-guide-panel-color-border" as any]: "var(--navds-color-orange-40)",
40
+ ["--navds-guide-panel-color-illustration-background" as any]: "var(--navds-global-color-orange-200)",
41
+ ["--navds-guide-panel-color-border" as any]: "var(--navds-global-color-orange-400)",
42
42
  }}
43
43
  >
44
44
  {panelText}Ullamco reprehenderit fugiat reprehenderit ad nisi aliqua
@@ -74,7 +74,7 @@ const Loader = forwardRef<SVGSVGElement, LoaderProps>(
74
74
  cx="25"
75
75
  cy="25"
76
76
  r="20"
77
- stroke={"var(--navds-color-gray-40)"}
77
+ stroke={"var(--navds-global-color-gray-400)"}
78
78
  fill="none"
79
79
  strokeWidth="5"
80
80
  strokeDasharray="50 155"
@@ -85,19 +85,3 @@ Størrelsen justeres også automatisk, slik at alt man trenger er å sette Loade
85
85
  <Loader />
86
86
  </Button>
87
87
  </Canvas>
88
-
89
- ## Overskrive farger for å sikre kontrast
90
-
91
- I de casene der man må justere fargene for å ha bedre kontrast så kan man endre på selve css-variablene som bli brukt
92
-
93
- ```css
94
- --navds-loader-color-foreground: var(--navds-color-gray-40);
95
- --navds-loader-color-background: var(--navds-color-gray-10);
96
- --navds-loader-color-neutral-foreground: var(--navds-color-gray-40);
97
- --navds-loader-color-interaction-foreground: var(--navds-color-blue-50);
98
- --navds-loader-color-inverted-foreground: var(--navds-color-white);
99
- --navds-loader-color-inverted-background: rgba(255, 255, 255, 0.3);
100
- --navds-loader-color-transparent-background: transparent;
101
- --navds-loader-color-on-button-background: rgba(255, 255, 255, 0.3);
102
- --navds-loader-color-on-button-foreground: currentColor;
103
- ```
@@ -17,7 +17,7 @@ const Template = (props) => {
17
17
  <>
18
18
  <div
19
19
  style={{
20
- background: "var(--navds-color-gray-60)",
20
+ background: "var(--navds-global-color-gray-600)",
21
21
  textAlign: "center",
22
22
  width: "2rem",
23
23
  height: "2rem",
@@ -80,8 +80,8 @@ Man kan endre bakgrunnsfargen selv med `illustrationBgColor` og `backgroundColor
80
80
  <SpeechBubble
81
81
  illustration="OLA"
82
82
  position="left"
83
- illustrationBgColor="var(--navds-color-lightblue-10)"
84
- backgroundColor="var(--navds-color-lightblue-20)"
83
+ illustrationBgColor="var(--navds-global-color-lightblue-100)"
84
+ backgroundColor="var(--navds-global-color-lightblue-200)"
85
85
  >
86
86
  <SpeechBubble.Bubble>
87
87
  Aute minim nisi sunt mollit duis sunt nulla minim non proident.
@@ -93,8 +93,8 @@ Man kan endre bakgrunnsfargen selv med `illustrationBgColor` og `backgroundColor
93
93
  <SpeechBubble
94
94
  illustration="OLA"
95
95
  position="left"
96
- illustrationBgColor="var(--navds-color-lightblue-10)"
97
- backgroundColor="var(--navds-color-lightblue-20)"
96
+ illustrationBgColor="var(--navds-global-color-lightblue-100)"
97
+ backgroundColor="var(--navds-global-color-lightblue-200)"
98
98
  >
99
99
  <SpeechBubble.Bubble>
100
100
  Aute minim nisi sunt mollit duis sunt nulla minim non proident.
@@ -14,7 +14,7 @@ export const All = () => {
14
14
  <SpeechBubble
15
15
  illustration={<Illustration />}
16
16
  topText="Ola Normann 01.01.21 14:00"
17
- backgroundColor="var(--navds-color-lightblue-20)"
17
+ backgroundColor="var(--navds-global-color-lightblue-200)"
18
18
  >
19
19
  <SpeechBubble.Bubble>
20
20
  Aute minim nisi sunt mollit duis sunt nulla minim non proident.
@@ -42,7 +42,7 @@ export const All = () => {
42
42
  </div>
43
43
  }
44
44
  position="right"
45
- backgroundColor="var(--navds-color-gray-10)"
45
+ backgroundColor="var(--navds-global-color-gray-100)"
46
46
  >
47
47
  <SpeechBubble.Bubble>
48
48
  Aute minim nisi sunt mollit duis sunt nulla minim non proident.
@@ -1,3 +1,3 @@
1
1
  .typo-story > div:nth-child(even) {
2
- background: var(--navds-color-gray-20);
2
+ background: var(--navds-global-color-gray-200);
3
3
  }
package/LICENCE DELETED
@@ -1,31 +0,0 @@
1
- Font License
2
-
3
- The Source Sans Pro font files in packages/node_modules/nav-frontend-typografi-style/assets are a subset of Source Sans Pro, licensed under the SIL Open Font License, and copyright Adobe Systems Incorporated, with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
4
-
5
- Icon License
6
-
7
- This project uses Streamline Icons. If you use nav-frontend-moduler in your project please adhere to the Streamline Icons license agreement found here: https://streamlineicons.com/ux/extended-license.html
8
-
9
- The rest of the codebase (excluding 3rd party dependencies):
10
-
11
- # The MIT License
12
-
13
- Copyright 2019 NAV (Arbeids- og velferdsdirektoratet) - The Norwegian Labour and Welfare Administration
14
-
15
- Permission is hereby granted, free of charge, to any person obtaining
16
- a copy of this software and associated documentation files (the "Software"),
17
- to deal in the Software without restriction, including without limitation
18
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
19
- and/or sell copies of the Software, and to permit persons to whom the
20
- Software is furnished to do so, subject to the following conditions:
21
-
22
- The above copyright notice and this permission notice shall be included
23
- in all copies or substantial portions of the Software.
24
-
25
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
29
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
30
- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
31
- USE OR OTHER DEALINGS IN THE SOFTWARE.