@danske/sapphire-css 16.3.0 → 26.1.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.
Files changed (91) hide show
  1. package/README.md +2 -12
  2. package/build/themes/cjs/default-dark.d.ts +3 -2
  3. package/build/themes/cjs/default-dark.js +5 -1
  4. package/build/themes/cjs/default.d.ts +3 -2
  5. package/build/themes/cjs/default.js +5 -1
  6. package/build/themes/cjs/index.d.ts +4 -0
  7. package/build/themes/cjs/june-dark.d.ts +3 -2
  8. package/build/themes/cjs/june-dark.js +5 -1
  9. package/build/themes/cjs/june.d.ts +3 -2
  10. package/build/themes/cjs/june.js +5 -1
  11. package/build/themes/esm/default-dark.d.ts +3 -2
  12. package/build/themes/esm/default-dark.js +5 -1
  13. package/build/themes/esm/default.d.ts +3 -2
  14. package/build/themes/esm/default.js +5 -1
  15. package/build/themes/esm/index.d.ts +4 -0
  16. package/build/themes/esm/june-dark.d.ts +3 -2
  17. package/build/themes/esm/june-dark.js +5 -1
  18. package/build/themes/esm/june.d.ts +3 -2
  19. package/build/themes/esm/june.js +5 -1
  20. package/components/accordion/accordion.module.css +163 -0
  21. package/components/avatar/avatar.module.css +137 -0
  22. package/components/badge/badge.module.css +246 -79
  23. package/components/badge/badge.module.css.d.ts +42 -10
  24. package/components/button/button.module.css +401 -74
  25. package/components/button/button.module.css.d.ts +11 -5
  26. package/components/buttonGroup/buttonGroup.module.css +20 -4
  27. package/components/buttonGroup/buttonGroup.module.css.d.ts +2 -1
  28. package/components/calendar/calendar.module.css +9 -2
  29. package/components/calendar/calendar.module.css.d.ts +1 -2
  30. package/components/checkbox/checkbox.module.css +44 -11
  31. package/components/checkbox/checkbox.module.css.d.ts +3 -0
  32. package/components/dateField/dateField.module.css +81 -86
  33. package/components/dateField/dateField.module.css.d.ts +3 -6
  34. package/components/dialog/dialog.module.css +34 -15
  35. package/components/dialog/dialog.module.css.d.ts +2 -2
  36. package/components/field/field.module.css +164 -0
  37. package/components/fieldGroup/fieldGroup.module.css +8 -54
  38. package/components/fieldGroup/fieldGroup.module.css.d.ts +4 -8
  39. package/components/icon/icon.module.css +11 -6
  40. package/components/icon/icon.module.css.d.ts +1 -0
  41. package/components/iconButton/iconButton.module.css +356 -70
  42. package/components/iconButton/iconButton.module.css.d.ts +8 -4
  43. package/components/label/label.module.css +29 -0
  44. package/components/link/link.module.css +71 -13
  45. package/components/link/link.module.css.d.ts +7 -2
  46. package/components/list/list.module.css +47 -21
  47. package/components/list/list.module.css.d.ts +1 -1
  48. package/components/listbox/listbox.module.css +53 -13
  49. package/components/listbox/listbox.module.css.d.ts +3 -1
  50. package/components/notificationBadge/notificationBadge.module.css +126 -0
  51. package/components/panel/panel.module.css +32 -14
  52. package/components/panel/panel.module.css.d.ts +3 -2
  53. package/components/paragraph/paragraph.module.css +4 -7
  54. package/components/paragraph/paragraph.module.css.d.ts +1 -2
  55. package/components/radio/radio.module.css +34 -9
  56. package/components/radio/radio.module.css.d.ts +2 -0
  57. package/components/searchField/searchField.module.css +43 -19
  58. package/components/searchField/searchField.module.css.d.ts +2 -0
  59. package/components/segmentedControl/segmentedControl.module.css +7 -7
  60. package/components/select/select.module.css +22 -63
  61. package/components/select/select.module.css.d.ts +1 -5
  62. package/components/spinner/spinner.module.css +64 -0
  63. package/components/surface/surface.module.css +5 -1
  64. package/components/surface/surface.module.css.d.ts +1 -0
  65. package/components/switch/switch.module.css +44 -44
  66. package/components/switch/switch.module.css.d.ts +1 -0
  67. package/components/table/table.module.css +22 -40
  68. package/components/tabs/tabs.module.css +155 -23
  69. package/components/tabs/tabs.module.css.d.ts +9 -2
  70. package/components/text/text.module.css +207 -0
  71. package/components/textField/textField.module.css +67 -89
  72. package/components/textField/textField.module.css.d.ts +3 -7
  73. package/components/toast/toast.module.css +101 -0
  74. package/components/tooltip/tooltip.module.css +13 -8
  75. package/components/tooltip/tooltip.module.css.d.ts +1 -0
  76. package/package.json +13 -9
  77. package/themes/default-dark.assets.css +1 -0
  78. package/themes/default-dark.d.ts +3 -2
  79. package/themes/default-dark.js +5 -1
  80. package/themes/default-dark.tokens.scss +1 -0
  81. package/themes/default.assets.css +1 -0
  82. package/themes/default.d.ts +3 -2
  83. package/themes/default.js +5 -1
  84. package/themes/default.tokens.scss +1 -0
  85. package/themes/index.d.ts +4 -0
  86. package/themes/june-dark.d.ts +3 -2
  87. package/themes/june-dark.js +5 -1
  88. package/themes/june-dark.scss +3 -0
  89. package/themes/june.d.ts +3 -2
  90. package/themes/june.js +5 -1
  91. package/themes/june.scss +3 -0
@@ -0,0 +1,164 @@
1
+ .sapphire-field {
2
+ display: inline-grid;
3
+ grid-template-columns: auto; /* One column by default */
4
+ row-gap: var(--sapphire-field-size-spacing-vertical);
5
+ column-gap: var(--sapphire-field-size-spacing-horizontal);
6
+ font-family: var(--sapphire-field-font-name);
7
+ grid-auto-rows: min-content;
8
+
9
+ /* The below is meant to address a font rendering quirk in OSX where the text
10
+ * looks bolder than intended due to subpixel rendering. This quirk generally
11
+ * occurs for bold fonts on dark backgrounds but depending on the font, it
12
+ * can happen in other contexts as well.
13
+ *
14
+ * These do not do anything except in webkit browsers & firefox on OSX.
15
+ *
16
+ * For more details see:
17
+ * - https://azuredevops/Main/WCCJ/_git/sapphire/pullRequest/212710?path=%2Fpackages%2Fcss%2Fcomponents%2Fbutton%2Fbutton.module.css&discussionId=1507702&_a=files
18
+ * - https://usabilitypost.com/2012/11/05/stop-fixing-font-smoothing/
19
+ */
20
+ -webkit-font-smoothing: antialiased;
21
+ -moz-osx-font-smoothing: grayscale;
22
+
23
+ box-sizing: border-box;
24
+ }
25
+
26
+ /**
27
+ * We need to reset browser styles in case the DOM element is a <fieldset>
28
+ */
29
+ fieldset.sapphire-field {
30
+ border: 0;
31
+ margin: 0;
32
+ padding: 0;
33
+ }
34
+
35
+ .sapphire-field__label {
36
+ order: 1;
37
+ justify-content: end;
38
+ }
39
+
40
+ /**
41
+ * We need to reset browser styles in case the DOM element is a <legend>.
42
+ * Setting "float" is ugly, but seems like it needs to be done.
43
+ * https://stackoverflow.com/questions/3973456/default-css-values-for-a-fieldset-legend
44
+ */
45
+ legend.sapphire-field__label {
46
+ padding: 0;
47
+ float: left;
48
+ }
49
+
50
+ .sapphire-field__control {
51
+ order: 2;
52
+ min-width: 100%;
53
+ }
54
+
55
+ /**
56
+ * For when the control contains a group of inputs
57
+ */
58
+ .sapphire-field__control--group {
59
+ display: flex;
60
+ gap: var(--sapphire-field-size-spacing-control-group);
61
+ }
62
+
63
+ /**
64
+ * Modifier which makes the control's width exceed the
65
+ * field's container. This is useful when the control's
66
+ * contents must not shrink beyond a min width.
67
+ */
68
+ .sapphire-field--no-shrink .sapphire-field__control {
69
+ min-width: initial;
70
+ }
71
+
72
+ .sapphire-field__message {
73
+ /**
74
+ * The below "min-width" and "max-width" combination is a little bit magical.
75
+ * It results in this element always having a width equal to the widest of the
76
+ * other grid rows but never greater than that.
77
+ *
78
+ * The reason for why "max-width: 100%" alone is not enough has to do with
79
+ * its interacton with the grid's column width definiton from the parent.
80
+ **/
81
+ min-width: 100%;
82
+ max-width: min-content;
83
+ order: 3;
84
+ }
85
+
86
+ /**
87
+ * Note
88
+ * An error message or a note, which by design are mutually exclusive.
89
+ */
90
+ .sapphire-field__note-row {
91
+ display: flex;
92
+ align-items: top;
93
+ font-size: var(--sapphire-field-size-font-note-l);
94
+ line-height: var(--sapphire-field-size-line-height-note-l);
95
+ color: var(--sapphire-field-color-note-default);
96
+ }
97
+
98
+ .sapphire-field--medium .sapphire-field__note-row {
99
+ font-size: var(--sapphire-field-size-font-note-m);
100
+ line-height: var(--sapphire-field-size-line-height-note-m);
101
+ }
102
+
103
+ .sapphire-field__note {
104
+ flex: 1;
105
+ }
106
+
107
+ .sapphire-field--error .sapphire-field__note {
108
+ color: var(--sapphire-field-color-note-error);
109
+ }
110
+
111
+ /**
112
+ * Disabled
113
+ */
114
+ .sapphire-field.is-disabled {
115
+ opacity: var(--sapphire-field-opacity-disabled);
116
+ cursor: not-allowed;
117
+ }
118
+ .sapphire-field.is-disabled .sapphire-field__control * {
119
+ cursor: inherit;
120
+ }
121
+
122
+ /**
123
+ * Side placement
124
+ */
125
+ .sapphire-field--label-placement-side {
126
+ grid-template-columns: max-content auto;
127
+ }
128
+ .sapphire-field--label-placement-side .sapphire-field__control,
129
+ .sapphire-field--label-placement-side .sapphire-field__message {
130
+ grid-column: 2;
131
+ }
132
+ .sapphire-field--label-placement-side .sapphire-field__label {
133
+ /* label is center aligned with control by default. But if the control is too long (e.g. textarea)
134
+ * the label stays at the top (max-height)
135
+ */
136
+ display: flex;
137
+ align-items: center;
138
+ max-height: var(--sapphire-field-size-max-height-label);
139
+ }
140
+
141
+ /*
142
+ * FieldSet - a wrapper for fields, that handles spacing, and label alignment when labels are on
143
+ * the side.
144
+ */
145
+ .sapphire-fieldset {
146
+ display: inline-flex;
147
+ flex-direction: column;
148
+ width: min-content; /* this is needed to have the labels column shrunk to the largest one */
149
+ gap: var(--sapphire-field-size-spacing-fieldset-large);
150
+ }
151
+
152
+ .sapphire-fieldset .sapphire-field--label-placement-side {
153
+ grid-template-columns: 1fr min-content;
154
+ }
155
+
156
+ .sapphire-fieldset
157
+ .sapphire-field--label-placement-side
158
+ .sapphire-field__label {
159
+ /* That is necessary because of width: min-content on field-set. Would be nice to avoid it
160
+ but couldn't find a way to avoid it while meeting the other requirements of having labels
161
+ aligned and not take up more space than needed.
162
+ */
163
+ white-space: nowrap;
164
+ }
@@ -1,64 +1,18 @@
1
- .sapphire-fieldGroup-label-container {
2
- /* The below is meant to address a font rendering quirk in OSX where the text
3
- * looks bolder than intended due to subpixel rendering. This quirk generally
4
- * occurs for bold fonts on dark backgrounds but depending on the font, it
5
- * can happen in other contexts as well.
6
- *
7
- * These do not do anything except in webkit browsers & firefox on OSX.
8
- *
9
- * For more details see:
10
- * - https://azuredevops/Main/WCCJ/_git/sapphire/pullRequest/212710?path=%2Fpackages%2Fcss%2Fcomponents%2Fbutton%2Fbutton.module.css&discussionId=1507702&_a=files
11
- * - https://usabilitypost.com/2012/11/05/stop-fixing-font-smoothing/
12
- */
13
- -webkit-font-smoothing: antialiased;
14
- -moz-osx-font-smoothing: grayscale;
15
-
16
- display: flex;
17
- align-items: center;
18
- gap: var(--sapphire-field-group-size-spacing-heading-horizontal);
19
- margin-bottom: var(--sapphire-field-group-size-spacing-heading-vertical);
20
- }
21
-
22
- .sapphire-fieldGroup-label-text {
23
- font-family: var(--sapphire-field-group-font-heading-name);
24
- font-weight: var(--sapphire-field-group-font-heading-weight);
25
- font-size: var(--sapphire-field-group-size-font-default);
26
- line-height: var(--sapphire-field-group-size-line-height);
27
- color: var(--sapphire-field-group-color-label);
28
- }
29
-
30
- .sapphire-fieldGroup-label-text--disabled {
31
- opacity: var(--sapphire-radio-opacity-disabled);
32
- }
33
-
34
- .sapphire-fieldGroup-content {
1
+ .sapphire-field-group {
35
2
  display: flex;
36
- }
37
-
38
- .sapphire-fieldGroup-content--horizontal {
39
- flex-direction: row;
40
3
  flex-wrap: wrap;
4
+ column-gap: var(--sapphire-field-group-size-spacing-field-horizontal);
5
+ row-gap: var(--sapphire-field-group-size-spacing-field-vertical-l);
41
6
  }
42
7
 
43
- .sapphire-fieldGroup-content--horizontal
44
- .sapphire-fieldGroup-field:not(:last-child) {
45
- margin-right: var(--sapphire-field-group-size-spacing-field-horizontal);
8
+ .sapphire-field-group--horizontal {
9
+ flex-direction: row;
46
10
  }
47
11
 
48
- .sapphire-fieldGroup-content--vertical {
12
+ .sapphire-field-group--vertical {
49
13
  flex-direction: column;
50
14
  }
51
15
 
52
- .sapphire-fieldGroup-content--vertical
53
- .sapphire-fieldGroup-field:not(:last-child) {
54
- margin-bottom: var(--sapphire-field-group-size-spacing-field-vertical);
55
- }
56
-
57
- .sapphire-fieldGroup-error-text {
58
- display: block;
59
- font-family: var(--sapphire-field-group-font-heading-name);
60
- font-weight: var(--sapphire-field-group-font-error-text-weight);
61
- font-size: var(--sapphire-field-group-size-font-error-text);
62
- margin-top: var(--sapphire-field-group-size-spacing-error-text-vertical);
63
- color: var(--sapphire-field-group-color-error-text);
16
+ .sapphire-field-group--medium {
17
+ row-gap: var(--sapphire-field-group-size-spacing-field-vertical-m);
64
18
  }
@@ -1,12 +1,8 @@
1
1
  declare const styles: {
2
- readonly "sapphire-fieldGroup-label-container": string;
3
- readonly "sapphire-fieldGroup-label-text": string;
4
- readonly "sapphire-fieldGroup-label-text--disabled": string;
5
- readonly "sapphire-fieldGroup-content": string;
6
- readonly "sapphire-fieldGroup-content--horizontal": string;
7
- readonly "sapphire-fieldGroup-field": string;
8
- readonly "sapphire-fieldGroup-content--vertical": string;
9
- readonly "sapphire-fieldGroup-error-text": string;
2
+ readonly "sapphire-field-group": string;
3
+ readonly "sapphire-field-group--horizontal": string;
4
+ readonly "sapphire-field-group--vertical": string;
5
+ readonly "sapphire-field-group--medium": string;
10
6
  };
11
7
  export = styles;
12
8
 
@@ -1,14 +1,19 @@
1
1
  .sapphire-icon.sapphire-icon--small {
2
- height: var(--sapphire-icon-size-small);
3
- width: var(--sapphire-icon-size-small);
2
+ height: var(--sapphire-icon-size-s);
3
+ width: var(--sapphire-icon-size-s);
4
4
  }
5
5
 
6
6
  .sapphire-icon.sapphire-icon--medium {
7
- height: var(--sapphire-icon-size-medium);
8
- width: var(--sapphire-icon-size-medium);
7
+ height: var(--sapphire-icon-size-m);
8
+ width: var(--sapphire-icon-size-m);
9
9
  }
10
10
 
11
11
  .sapphire-icon.sapphire-icon--large {
12
- height: var(--sapphire-icon-size-large);
13
- width: var(--sapphire-icon-size-large);
12
+ height: var(--sapphire-icon-size-l);
13
+ width: var(--sapphire-icon-size-l);
14
+ }
15
+
16
+ .sapphire-icon.sapphire-icon--extra-large {
17
+ height: var(--sapphire-icon-size-xl);
18
+ width: var(--sapphire-icon-size-xl);
14
19
  }
@@ -3,6 +3,7 @@ declare const styles: {
3
3
  readonly "sapphire-icon--small": string;
4
4
  readonly "sapphire-icon--medium": string;
5
5
  readonly "sapphire-icon--large": string;
6
+ readonly "sapphire-icon--extra-large": string;
6
7
  };
7
8
  export = styles;
8
9