@helsenorge/designsystem-react 3.0.0 → 3.0.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 (131) hide show
  1. package/CHANGELOG.md +380 -668
  2. package/HelpBubble.js +1 -1
  3. package/HelpBubble.js.map +1 -1
  4. package/HorizontalScroll.js.map +1 -1
  5. package/Input.js +1 -1
  6. package/Input.js.map +1 -1
  7. package/ListHeader.js +1 -1
  8. package/ListHeader.js.map +1 -1
  9. package/Modal.js.map +1 -1
  10. package/PopOver.js +1 -1
  11. package/PopOver.js.map +1 -1
  12. package/RadioButton.js +1 -1
  13. package/RadioButton.js.map +1 -1
  14. package/Textarea.js +1 -1
  15. package/Textarea.js.map +1 -1
  16. package/Title.js.map +1 -1
  17. package/Tooltip.js.map +1 -1
  18. package/TooltipWord.js +1 -1
  19. package/TooltipWord.js.map +1 -1
  20. package/components/AnchorLink/styles.module.scss +11 -6
  21. package/components/Avatar/styles.module.scss +2 -2
  22. package/components/Badge/styles.module.scss +7 -1
  23. package/components/Button/styles.module.scss +35 -21
  24. package/components/Checkbox/styles.module.scss +12 -12
  25. package/components/Close/styles.module.scss +15 -7
  26. package/components/Dropdown/index.js +1 -1
  27. package/components/Dropdown/index.js.map +1 -1
  28. package/components/Dropdown/styles.module.scss +31 -10
  29. package/components/Duolist/styles.module.scss +5 -3
  30. package/components/ErrorWrapper/styles.module.scss +8 -6
  31. package/components/Expander/styles.module.scss +46 -15
  32. package/components/ExpanderHierarchy/expander.module.scss +13 -8
  33. package/components/ExpanderHierarchy/expander.module.scss.d.ts +1 -1
  34. package/components/ExpanderHierarchy/styles.module.scss +3 -3
  35. package/components/ExpanderList/index.js.map +1 -1
  36. package/components/ExpanderList/styles.module.scss +17 -6
  37. package/components/FormExample/FormExample.d.ts.map +1 -1
  38. package/components/FormExample/index.js.map +1 -1
  39. package/components/FormExample/styles.module.scss +6 -6
  40. package/components/FormGroup/styles.module.scss +5 -4
  41. package/components/FormLayout/styles.module.scss +5 -2
  42. package/components/HelpBubble/HelpBubble.d.ts +2 -2
  43. package/components/HelpBubble/HelpBubble.d.ts.map +1 -1
  44. package/components/HelpBubble/index.js +1 -1
  45. package/components/HelpBubble/styles.module.scss +10 -10
  46. package/components/HelpBubble/styles.module.scss.d.ts +0 -1
  47. package/components/HelpBubbleExample/index.js +1 -1
  48. package/components/HighlightBox/index.js.map +1 -1
  49. package/components/HighlightBox/styles.module.scss +38 -29
  50. package/components/HorizontalScroll/HorizontalScroll.d.ts.map +1 -1
  51. package/components/HorizontalScroll/styles.module.scss +10 -3
  52. package/components/Icons/SortUp.js +1 -1
  53. package/components/Icons/SortUp.js.map +1 -1
  54. package/components/Input/Input.d.ts.map +1 -1
  55. package/components/Input/styles.module.scss +8 -7
  56. package/components/LinkList/styles.module.scss +23 -5
  57. package/components/List/styles.module.scss +4 -0
  58. package/components/ListHeader/ListHeader.d.ts +9 -7
  59. package/components/ListHeader/ListHeader.d.ts.map +1 -1
  60. package/components/ListHeader/styles.module.scss +36 -11
  61. package/components/Loader/styles.module.scss +40 -18
  62. package/components/Logo/index.js.map +1 -1
  63. package/components/MaxCharacters/styles.module.scss +7 -5
  64. package/components/Modal/styles.module.scss +39 -23
  65. package/components/NotificationPanel/DetailButton/styles.module.scss +9 -5
  66. package/components/NotificationPanel/index.js.map +1 -1
  67. package/components/NotificationPanel/styles.module.scss +45 -12
  68. package/components/Panel/styles.module.scss +53 -29
  69. package/components/PanelList/styles.module.scss +6 -5
  70. package/components/PopMenu/PopMenu.d.ts.map +1 -1
  71. package/components/PopMenu/styles.module.scss +28 -7
  72. package/components/PopOver/PopOver.d.ts +5 -3
  73. package/components/PopOver/PopOver.d.ts.map +1 -1
  74. package/components/PopOver/componentdata.json +1 -1
  75. package/components/PopOver/styles.module.scss +16 -13
  76. package/components/RadioButton/RadioButton.d.ts.map +1 -1
  77. package/components/RadioButton/styles.module.scss +12 -14
  78. package/components/Select/styles.module.scss +14 -8
  79. package/components/Slider/Slider.d.ts.map +1 -1
  80. package/components/Slider/index.js +1 -1
  81. package/components/Slider/index.js.map +1 -1
  82. package/components/Slider/styles.module.scss +1 -1
  83. package/components/Spacer/styles.module.scss +13 -1
  84. package/components/StatusDot/styles.module.scss +2 -2
  85. package/components/Stepper/styles.module.scss +28 -20
  86. package/components/Table/Table.d.ts.map +1 -1
  87. package/components/Table/index.js +1 -1
  88. package/components/Table/index.js.map +1 -1
  89. package/components/Table/styles.module.scss +32 -20
  90. package/components/Tag/styles.module.scss +39 -27
  91. package/components/TagList/styles.module.scss +3 -3
  92. package/components/Textarea/Textarea.d.ts.map +1 -1
  93. package/components/Textarea/styles.module.scss +6 -5
  94. package/components/Tile/styles.module.scss +11 -6
  95. package/components/Title/Title.d.ts +1 -1
  96. package/components/Title/Title.d.ts.map +1 -1
  97. package/components/Title/styles.module.scss +5 -0
  98. package/components/Tooltip/TooltipWord/TooltipWord.d.ts +1 -1
  99. package/components/Tooltip/TooltipWord/TooltipWord.d.ts.map +1 -1
  100. package/components/Tooltip/TooltipWord/styles.module.scss +3 -3
  101. package/components/Tooltip/index.js +1 -1
  102. package/components/TooltipExample/index.js +1 -1
  103. package/components/Validation/styles.module.scss +3 -3
  104. package/hoc/withBreakpoint/withBreakpoint.d.ts +1 -1
  105. package/hoc/withBreakpoint/withBreakpoint.d.ts.map +1 -1
  106. package/hoc/withBreakpoint/withBreakpoint.js.map +1 -1
  107. package/hooks/useFocusTrap.d.ts.map +1 -1
  108. package/hooks/useFocusTrap.js.map +1 -1
  109. package/hooks/useSize.js.map +1 -1
  110. package/package.json +1 -1
  111. package/scss/_body.scss +3 -1
  112. package/scss/_breakpoints.scss +5 -8
  113. package/scss/_figma-tokens.scss +2 -2
  114. package/scss/_fonts.scss +36 -21
  115. package/scss/_grid.scss +5 -4
  116. package/scss/_input.scss +20 -11
  117. package/scss/_palette.scss +3 -11
  118. package/scss/_print.scss +58 -18
  119. package/scss/_screen-reader.scss +0 -2
  120. package/scss/_spacers.scss +17 -15
  121. package/scss/_title.scss +11 -5
  122. package/scss/helsenorge.scss +1 -1
  123. package/scss/typography.module.scss +20 -13
  124. package/utils/component.d.ts +1 -0
  125. package/utils/component.d.ts.map +1 -1
  126. package/utils/component.js +1 -1
  127. package/utils/component.js.map +1 -1
  128. package/utils/debounce.d.ts +1 -2
  129. package/utils/debounce.d.ts.map +1 -1
  130. package/utils/debounce.js +1 -1
  131. package/utils/debounce.js.map +1 -1
package/scss/_print.scss CHANGED
@@ -1,3 +1,4 @@
1
+ @use 'sass:map';
1
2
  @import 'palette';
2
3
  @import 'breakpoints';
3
4
 
@@ -14,10 +15,11 @@
14
15
  }
15
16
 
16
17
  body {
17
- min-width: map-get($grid-breakpoints, lg) !important;
18
+ min-width: map.get($grid-breakpoints, lg) !important;
18
19
  }
20
+
19
21
  .container {
20
- min-width: map-get($grid-breakpoints, lg) !important;
22
+ min-width: map.get($grid-breakpoints, lg) !important;
21
23
  }
22
24
 
23
25
  abbr[title]::after {
@@ -60,120 +62,158 @@
60
62
  }
61
63
 
62
64
  .col-print-1 {
63
- max-width: 8.33333%;
65
+ max-width: 8.3333%;
64
66
  }
67
+
65
68
  .col-print-2 {
66
- max-width: 16.66667%;
69
+ max-width: 16.6667%;
67
70
  }
71
+
68
72
  .col-print-3 {
69
73
  max-width: 25%;
70
74
  }
75
+
71
76
  .col-print-4 {
72
- max-width: 33.33333%;
77
+ max-width: 33.3333%;
73
78
  }
79
+
74
80
  .col-print-5 {
75
- max-width: 41.66667%;
81
+ max-width: 41.6667%;
76
82
  }
83
+
77
84
  .col-print-6 {
78
85
  max-width: 50%;
79
86
  }
87
+
80
88
  .col-print-7 {
81
- max-width: 58.33333%;
89
+ max-width: 58.3333%;
82
90
  }
91
+
83
92
  .col-print-8 {
84
- max-width: 66.66667%;
93
+ max-width: 66.6667%;
85
94
  }
95
+
86
96
  .col-print-9 {
87
97
  max-width: 75%;
88
98
  }
99
+
89
100
  .col-print-10 {
90
- max-width: 83.33333%;
101
+ max-width: 83.3333%;
91
102
  }
103
+
92
104
  .col-print-11 {
93
- max-width: 91.66667%;
105
+ max-width: 91.6667%;
94
106
  }
107
+
95
108
  .col-print-12 {
96
109
  max-width: 100%;
97
110
  }
111
+
98
112
  .order-print-first {
99
113
  order: -1;
100
114
  }
115
+
101
116
  .order-print-last {
102
117
  order: 13;
103
118
  }
119
+
104
120
  .order-print-0 {
105
121
  order: 0;
106
122
  }
123
+
107
124
  .order-print-1 {
108
125
  order: 1;
109
126
  }
127
+
110
128
  .order-print-2 {
111
129
  order: 2;
112
130
  }
131
+
113
132
  .order-print-3 {
114
133
  order: 3;
115
134
  }
135
+
116
136
  .order-print-4 {
117
137
  order: 4;
118
138
  }
139
+
119
140
  .order-print-5 {
120
141
  order: 5;
121
142
  }
143
+
122
144
  .order-print-6 {
123
145
  order: 6;
124
146
  }
147
+
125
148
  .order-print-7 {
126
149
  order: 7;
127
150
  }
151
+
128
152
  .order-print-8 {
129
153
  order: 8;
130
154
  }
155
+
131
156
  .order-print-9 {
132
157
  order: 9;
133
158
  }
159
+
134
160
  .order-print-10 {
135
161
  order: 10;
136
162
  }
163
+
137
164
  .order-print-11 {
138
165
  order: 11;
139
166
  }
167
+
140
168
  .order-print-12 {
141
169
  order: 12;
142
170
  }
171
+
143
172
  .offset-print-0 {
144
173
  margin-left: 0;
145
174
  }
175
+
146
176
  .offset-print-1 {
147
- margin-left: 8.33333%;
177
+ margin-left: 8.3333%;
148
178
  }
179
+
149
180
  .offset-print-2 {
150
- margin-left: 16.66667%;
181
+ margin-left: 16.6667%;
151
182
  }
183
+
152
184
  .offset-print-3 {
153
185
  margin-left: 25%;
154
186
  }
187
+
155
188
  .offset-print-4 {
156
- margin-left: 33.33333%;
189
+ margin-left: 33.3333%;
157
190
  }
191
+
158
192
  .offset-print-5 {
159
- margin-left: 41.66667%;
193
+ margin-left: 41.6667%;
160
194
  }
195
+
161
196
  .offset-print-6 {
162
197
  margin-left: 50%;
163
198
  }
199
+
164
200
  .offset-print-7 {
165
- margin-left: 58.33333%;
201
+ margin-left: 58.3333%;
166
202
  }
203
+
167
204
  .offset-print-8 {
168
- margin-left: 66.66667%;
205
+ margin-left: 66.6667%;
169
206
  }
207
+
170
208
  .offset-print-9 {
171
209
  margin-left: 75%;
172
210
  }
211
+
173
212
  .offset-print-10 {
174
- margin-left: 83.33333%;
213
+ margin-left: 83.3333%;
175
214
  }
215
+
176
216
  .offset-print-11 {
177
- margin-left: 91.66667%;
217
+ margin-left: 91.6667%;
178
218
  }
179
219
  }
@@ -30,7 +30,6 @@
30
30
  @mixin sr-only() {
31
31
  border: 0 !important;
32
32
  clip: rect(1px, 1px, 1px, 1px) !important; /* 1 */
33
- -webkit-clip-path: inset(50%) !important;
34
33
  clip-path: inset(50%) !important; /* 2 */
35
34
  height: 1px !important;
36
35
  margin: -1px !important;
@@ -54,7 +53,6 @@
54
53
  &:active,
55
54
  &:focus {
56
55
  clip: auto !important;
57
- -webkit-clip-path: none !important;
58
56
  clip-path: none !important;
59
57
  height: auto !important;
60
58
  margin: auto !important;
@@ -1,3 +1,5 @@
1
+ @use 'sass:map';
2
+
1
3
  $spacer: 1rem;
2
4
  $spacers: (
3
5
  0: 0,
@@ -17,24 +19,24 @@ $spacers: (
17
19
  );
18
20
 
19
21
  @function getSpacer($spacerSize) {
20
- $spacerValue: map-get(
22
+ $spacer-value: map.get(
21
23
  (
22
- 4xs: map-get($spacers, 1),
23
- 3xs: map-get($spacers, 2),
24
- 2xs: map-get($spacers, 3),
25
- xs: map-get($spacers, 4),
26
- s: map-get($spacers, 5),
27
- m: map-get($spacers, 6),
28
- l: map-get($spacers, 7),
29
- xl: map-get($spacers, 8),
30
- 2xl: map-get($spacers, 9),
31
- 3xl: map-get($spacers, 10),
32
- 4xl: map-get($spacers, 11),
33
- 5xl: map-get($spacers, 12),
34
- 6xl: map-get($spacers, 13),
24
+ 4xs: map.get($spacers, 1),
25
+ 3xs: map.get($spacers, 2),
26
+ 2xs: map.get($spacers, 3),
27
+ xs: map.get($spacers, 4),
28
+ s: map.get($spacers, 5),
29
+ m: map.get($spacers, 6),
30
+ l: map.get($spacers, 7),
31
+ xl: map.get($spacers, 8),
32
+ 2xl: map.get($spacers, 9),
33
+ 3xl: map.get($spacers, 10),
34
+ 4xl: map.get($spacers, 11),
35
+ 5xl: map.get($spacers, 12),
36
+ 6xl: map.get($spacers, 13),
35
37
  ),
36
38
  $spacerSize
37
39
  );
38
40
 
39
- @return $spacerValue;
41
+ @return $spacer-value;
40
42
  }
package/scss/_title.scss CHANGED
@@ -1,3 +1,4 @@
1
+ @use 'sass:map';
1
2
  @import './spacers';
2
3
  @import './breakpoints';
3
4
  @import './font-settings';
@@ -6,7 +7,8 @@
6
7
  font-size: 2.375rem;
7
8
  line-height: 2.875rem;
8
9
  font-weight: 600;
9
- @media (min-width: map-get($grid-breakpoints, md)) {
10
+
11
+ @media (min-width: map.get($grid-breakpoints, md)) {
10
12
  font-size: 4rem;
11
13
  line-height: 5rem;
12
14
  }
@@ -16,7 +18,8 @@
16
18
  font-size: 2.25rem;
17
19
  line-height: 2.75rem;
18
20
  font-weight: 600;
19
- @media (min-width: map-get($grid-breakpoints, md)) {
21
+
22
+ @media (min-width: map.get($grid-breakpoints, md)) {
20
23
  font-size: 3.25rem;
21
24
  line-height: 3.75rem;
22
25
  }
@@ -26,7 +29,8 @@
26
29
  font-size: 1.625rem;
27
30
  line-height: 2.125rem;
28
31
  font-weight: 600;
29
- @media (min-width: map-get($grid-breakpoints, md)) {
32
+
33
+ @media (min-width: map.get($grid-breakpoints, md)) {
30
34
  font-size: 2rem;
31
35
  line-height: 2.75rem;
32
36
  }
@@ -36,7 +40,8 @@
36
40
  font-size: 1.375rem;
37
41
  line-height: 1.875rem;
38
42
  font-weight: 600;
39
- @media (min-width: map-get($grid-breakpoints, md)) {
43
+
44
+ @media (min-width: map.get($grid-breakpoints, md)) {
40
45
  font-size: 1.5rem;
41
46
  line-height: 2rem;
42
47
  }
@@ -53,7 +58,8 @@
53
58
  line-height: 1.5rem;
54
59
  font-weight: 700;
55
60
  text-transform: uppercase;
56
- @media (min-width: map-get($grid-breakpoints, md)) {
61
+
62
+ @media (min-width: map.get($grid-breakpoints, md)) {
57
63
  font-size: $font-size-sm;
58
64
  }
59
65
  }
@@ -1,7 +1,7 @@
1
1
  @import 'reset';
2
2
  @import 'spacers';
3
3
  @import 'breakpoints';
4
- @import 'bootstrap/scss/bootstrap-grid.scss';
4
+ @import 'bootstrap/scss/bootstrap-grid';
5
5
  @import 'palette';
6
6
  @import 'fonts';
7
7
  @import 'body';
@@ -1,12 +1,13 @@
1
+ @use 'sass:map';
1
2
  @import './spacers';
2
3
  @import './breakpoints';
3
- @import './fonts.scss';
4
+ @import './fonts';
4
5
  @import './palette';
5
- @import './title.scss';
6
+ @import './title';
6
7
 
7
8
  /*
8
9
  Denne filen er ment til å importeres som en css module:
9
- import designsystemtypography from './scss/_typography.scss'
10
+ import designsystemtypography from './scss/typography.scss'
10
11
  <div className={designsystemtypography.title1}></div>
11
12
  */
12
13
 
@@ -43,7 +44,8 @@ import designsystemtypography from './scss/_typography.scss'
43
44
  font-size: 1.375rem;
44
45
  line-height: getSpacer(l);
45
46
  font-weight: 600;
46
- @media (min-width: map-get($grid-breakpoints, md)) {
47
+
48
+ @media (min-width: map.get($grid-breakpoints, md)) {
47
49
  font-size: getSpacer(m);
48
50
  }
49
51
  }
@@ -52,7 +54,8 @@ import designsystemtypography from './scss/_typography.scss'
52
54
  font-size: $font-size-md;
53
55
  line-height: 1.625rem;
54
56
  font-weight: 600;
55
- @media (min-width: map-get($grid-breakpoints, md)) {
57
+
58
+ @media (min-width: map.get($grid-breakpoints, md)) {
56
59
  font-size: getSpacer(m);
57
60
  line-height: $lineheight-size-md;
58
61
  }
@@ -61,7 +64,8 @@ import designsystemtypography from './scss/_typography.scss'
61
64
  .label {
62
65
  font-size: $font-size-sm;
63
66
  line-height: getSpacer(m);
64
- @media (min-width: map-get($grid-breakpoints, md)) {
67
+
68
+ @media (min-width: map.get($grid-breakpoints, md)) {
65
69
  font-size: $font-size-md;
66
70
  line-height: $lineheight-size-sm;
67
71
  }
@@ -70,7 +74,8 @@ import designsystemtypography from './scss/_typography.scss'
70
74
  .table {
71
75
  font-size: $font-size-sm;
72
76
  line-height: $lineheight-size-sm;
73
- @media (min-width: map-get($grid-breakpoints, md)) {
77
+
78
+ @media (min-width: map.get($grid-breakpoints, md)) {
74
79
  font-size: $font-size-md;
75
80
  }
76
81
  }
@@ -78,7 +83,8 @@ import designsystemtypography from './scss/_typography.scss'
78
83
  .strong {
79
84
  font-size: $font-size-sm;
80
85
  line-height: $lineheight-size-sm;
81
- @media (min-width: map-get($grid-breakpoints, md)) {
86
+
87
+ @media (min-width: map.get($grid-breakpoints, md)) {
82
88
  font-size: $font-size-md;
83
89
  line-height: $lineheight-size-md;
84
90
  }
@@ -87,7 +93,8 @@ import designsystemtypography from './scss/_typography.scss'
87
93
  .form {
88
94
  font-size: $font-size-sm;
89
95
  line-height: $lineheight-size-sm;
90
- @media (min-width: map-get($grid-breakpoints, md)) {
96
+
97
+ @media (min-width: map.get($grid-breakpoints, md)) {
91
98
  font-size: $font-size-md;
92
99
  }
93
100
  }
@@ -110,7 +117,6 @@ import designsystemtypography from './scss/_typography.scss'
110
117
  .anchorlink-wrapper {
111
118
  a {
112
119
  display: inline;
113
- -webkit-box-decoration-break: clone;
114
120
  box-decoration-break: clone;
115
121
  overflow-wrap: break-word;
116
122
  word-break: break-word;
@@ -126,15 +132,16 @@ import designsystemtypography from './scss/_typography.scss'
126
132
  background-color: $blueberry50;
127
133
  border-bottom-color: $blueberry600;
128
134
  }
135
+
129
136
  &:focus {
130
- padding: 0 0 0.15rem 0;
137
+ padding: 0 0 0.15rem;
131
138
  outline: none;
132
139
  border: 0.15rem solid $black;
133
140
  }
134
141
 
135
142
  &[target='_blank'] {
136
- /* external styling legge til icon*/
137
- &:after {
143
+ /* external styling legge til icon */
144
+ &::after {
138
145
  content: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='38px' height='38px' viewBox='0 0 48 48' fill='%2308667c'><polygon points='33.305,14.659,33.305,29.205,32.005,29.205,32.005,16.948,15.804,33.149,14.885,32.229,31.155,15.959,18.761,15.96,18.761,14.659' /></svg>");
139
146
  display: inline-block;
140
147
  vertical-align: bottom;
@@ -1,3 +1,4 @@
1
1
  import React from 'react';
2
2
  export declare const isComponent: <T>(element: {} | null | undefined, type: React.ForwardRefExoticComponent<T> | React.FunctionComponent<T>) => element is React.ReactElement<T, string | React.JSXElementConstructor<any>>;
3
+ export declare const isComponentWithChildren: <T>(element: {} | null | undefined) => element is React.ReactElement<React.PropsWithChildren<T>, string | React.JSXElementConstructor<any>>;
3
4
  //# sourceMappingURL=component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/utils/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,WAAW,eACb,EAAE,GAAG,IAAI,GAAG,SAAS,uJAEwF,CAAC"}
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/utils/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,eAAO,MAAM,WAAW,eACb,EAAE,GAAG,IAAI,GAAG,SAAS,uJAEwF,CAAC;AAEzH,eAAO,MAAM,uBAAuB,eAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,yGAEsC,CAAC"}
@@ -1,2 +1,2 @@
1
- import i from"react";const e=(o,t)=>i.isValidElement(o)&&o.type===t;export{e as isComponent};
1
+ import t from"react";const n=(o,i)=>t.isValidElement(o)&&o.type===i,r=o=>t.isValidElement(o)&&Object.prototype.hasOwnProperty.call(o.props,"children");export{n as isComponent,r as isComponentWithChildren};
2
2
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../src/utils/component.ts"],"sourcesContent":["import React from 'react';\n\nexport const isComponent = <T>(\n element: {} | null | undefined,\n type: React.ForwardRefExoticComponent<T> | React.FunctionComponent<T>\n): element is React.ReactElement<T> => React.isValidElement<T>(element) && (element as React.ReactElement).type === type;\n"],"names":["isComponent","element","type","React"],"mappings":"qBAEa,MAAAA,EAAc,CACzBC,EACAC,IACqCC,EAAM,eAAkBF,CAAO,GAAMA,EAA+B,OAASC"}
1
+ {"version":3,"file":"component.js","sources":["../../src/utils/component.ts"],"sourcesContent":["import React, { PropsWithChildren } from 'react';\n\nexport const isComponent = <T>(\n element: {} | null | undefined,\n type: React.ForwardRefExoticComponent<T> | React.FunctionComponent<T>\n): element is React.ReactElement<T> => React.isValidElement<T>(element) && (element as React.ReactElement).type === type;\n\nexport const isComponentWithChildren = <T>(element: {} | null | undefined): element is React.ReactElement<PropsWithChildren<T>> =>\n React.isValidElement<PropsWithChildren<T>>(element) &&\n Object.prototype.hasOwnProperty.call((element as React.ReactElement<PropsWithChildren<T>>).props, 'children');\n"],"names":["isComponent","element","type","React","isComponentWithChildren"],"mappings":"qBAEa,MAAAA,EAAc,CACzBC,EACAC,IACqCC,EAAM,eAAkBF,CAAO,GAAMA,EAA+B,OAASC,EAEvGE,EAA8BH,GACzCE,EAAM,eAAqCF,CAAO,GAClD,OAAO,UAAU,eAAe,KAAMA,EAAqD,MAAO,UAAU"}
@@ -2,7 +2,6 @@
2
2
  * debounce limits time a function can be executed
3
3
  * @param func function to debounce
4
4
  * @param wait wait for x time
5
- * @param immediate run now
6
5
  */
7
- export declare function debounce(func: Function, wait: number, immediate?: boolean): [() => void, () => void];
6
+ export declare function debounce<A = unknown, R = void>(func: (args?: A) => R, wait: number): [(args?: A) => Promise<R>, () => void];
8
7
  //# sourceMappingURL=debounce.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/utils/debounce.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,IAAI,EAAE,MAAM,IAAI,CAAC,CA0BpG"}
1
+ {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/utils/debounce.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAmB3H"}
package/utils/debounce.js CHANGED
@@ -1,2 +1,2 @@
1
- function s(e,u,n){let t;return[function(){const o=this,c=arguments,l=()=>{t=null,n||e.apply(o,c)},r=n&&!t;t&&clearTimeout(t),t=setTimeout(l,u),r&&e.apply(o,c)},()=>{t&&clearTimeout(t)}]}export{s as debounce};
1
+ function d(o,t){let e;return[n=>new Promise(u=>{e&&clearTimeout(e),e=setTimeout(()=>{u(o(n))},t)}),()=>{e&&clearTimeout(e)}]}export{d as debounce};
2
2
  //# sourceMappingURL=debounce.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"debounce.js","sources":["../../src/utils/debounce.ts"],"sourcesContent":["/**\n * debounce limits time a function can be executed\n * @param func function to debounce\n * @param wait wait for x time\n * @param immediate run now\n */\n\nexport function debounce(func: Function, wait: number, immediate?: boolean): [() => void, () => void] {\n let timeout: ReturnType<typeof setTimeout> | null;\n\n const debouncedFunc = function (this: Function): void {\n const context: Function = this,\n args: IArguments = arguments,\n later: () => void = (): void => {\n timeout = null;\n if (!immediate) {\n func.apply(context, args);\n }\n },\n callNow = immediate && !timeout;\n\n if (timeout) clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) {\n func.apply(context, args);\n }\n };\n\n const teardown = () => {\n timeout && clearTimeout(timeout);\n };\n\n return [debouncedFunc, teardown];\n}\n"],"names":["debounce","func","wait","immediate","timeout","context","args","later","callNow"],"mappings":"AAOgB,SAAAA,EAASC,EAAgBC,EAAcC,EAA+C,CAChG,IAAAC,EAwBG,MAAA,CAtBe,UAAgC,CACpD,MAAMC,EAAoB,KACxBC,EAAmB,UACnBC,EAAoB,IAAY,CACpBH,EAAA,KACLD,GACEF,EAAA,MAAMI,EAASC,CAAI,CAC1B,EAEFE,EAAUL,GAAa,CAACC,EAEtBA,GAAS,aAAaA,CAAO,EACvBA,EAAA,WAAWG,EAAOL,CAAI,EAC5BM,GACGP,EAAA,MAAMI,EAASC,CAAI,CAC1B,EAGe,IAAM,CACrBF,GAAW,aAAaA,CAAO,CAAA,CAGF,CACjC"}
1
+ {"version":3,"file":"debounce.js","sources":["../../src/utils/debounce.ts"],"sourcesContent":["/**\n * debounce limits time a function can be executed\n * @param func function to debounce\n * @param wait wait for x time\n */\n\nexport function debounce<A = unknown, R = void>(func: (args?: A) => R, wait: number): [(args?: A) => Promise<R>, () => void] {\n let timeout: ReturnType<typeof setTimeout> | null;\n\n const debouncedFunc = (args?: A): Promise<R> =>\n new Promise(resolve => {\n if (timeout) {\n clearTimeout(timeout);\n }\n\n timeout = setTimeout((): void => {\n resolve(func(args));\n }, wait);\n });\n\n const teardown = (): void => {\n timeout && clearTimeout(timeout);\n };\n\n return [debouncedFunc, teardown];\n}\n"],"names":["debounce","func","wait","timeout","args","resolve"],"mappings":"AAMgB,SAAAA,EAAgCC,EAAuBC,EAAsD,CACvH,IAAAC,EAiBG,MAAA,CAfgBC,GACrB,IAAI,QAAmBC,GAAA,CACjBF,GACF,aAAaA,CAAO,EAGtBA,EAAU,WAAW,IAAY,CACvBE,EAAAJ,EAAKG,CAAI,CAAC,GACjBF,CAAI,CAAA,CACR,EAEc,IAAY,CAC3BC,GAAW,aAAaA,CAAO,CAAA,CAGF,CACjC"}