@entur/chip 0.6.14 → 0.6.15

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/CHANGELOG.md ADDED
@@ -0,0 +1,500 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [0.6.15](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.12...@entur/chip@0.6.15) (2022-12-09)
7
+
8
+ **Note:** Version bump only for package @entur/chip
9
+
10
+ ## [0.6.14](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.13...@entur/chip@0.6.14) (2022-11-24)
11
+
12
+ **Note:** Version bump only for package @entur/chip
13
+
14
+ ## [0.6.13](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.12...@entur/chip@0.6.13) (2022-10-31)
15
+
16
+ **Note:** Version bump only for package @entur/chip
17
+
18
+ ## [0.6.12](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.11...@entur/chip@0.6.12) (2022-10-31)
19
+
20
+ **Note:** Version bump only for package @entur/chip
21
+
22
+ ## [0.6.11](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.10...@entur/chip@0.6.11) (2022-10-31)
23
+
24
+ **Note:** Version bump only for package @entur/chip
25
+
26
+ ## [0.6.10](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.9...@entur/chip@0.6.10) (2022-10-20)
27
+
28
+ **Note:** Version bump only for package @entur/chip
29
+
30
+ ## [0.6.9](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.8...@entur/chip@0.6.9) (2022-10-20)
31
+
32
+ **Note:** Version bump only for package @entur/chip
33
+
34
+ ## [0.6.8](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.7...@entur/chip@0.6.8) (2022-10-12)
35
+
36
+ **Note:** Version bump only for package @entur/chip
37
+
38
+ ## [0.6.6](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.5...@entur/chip@0.6.6) (2022-08-31)
39
+
40
+ **Note:** Version bump only for package @entur/chip
41
+
42
+ ## [0.6.5](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.4...@entur/chip@0.6.5) (2022-08-24)
43
+
44
+ **Note:** Version bump only for package @entur/chip
45
+
46
+ ## [0.6.4](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.3...@entur/chip@0.6.4) (2022-08-12)
47
+
48
+ ### Bug Fixes
49
+
50
+ - **choice chip:** remove opacitiy when chip is disabled ([7412724](https://bitbucket.org/enturas/design-system/commits/741272400dda7ff77aa58b5032dd91f91d3a0393))
51
+
52
+ ## [0.6.3](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.2...@entur/chip@0.6.3) (2022-08-09)
53
+
54
+ **Note:** Version bump only for package @entur/chip
55
+
56
+ ## [0.6.2](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.1...@entur/chip@0.6.2) (2022-08-09)
57
+
58
+ **Note:** Version bump only for package @entur/chip
59
+
60
+ ## [0.6.1](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.0...@entur/chip@0.6.1) (2022-07-05)
61
+
62
+ **Note:** Version bump only for package @entur/chip
63
+
64
+ # [0.6.0](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.8...@entur/chip@0.6.0) (2022-06-28)
65
+
66
+ ### Features
67
+
68
+ - **action chip:** add aria-loading and aria-label text to action chip when loading ([2eaadbe](https://bitbucket.org/enturas/design-system/commits/2eaadbe743049a57613d0c89cb17fab8128da915))
69
+ - **action chip:** add visual disabled indicator to actionChip ([15edd0d](https://bitbucket.org/enturas/design-system/commits/15edd0da4111c79465f620dd008b7047fbf9cee7))
70
+ - **tag chip:** add autogenerated aria-label for tag close/remove button ([9e63b0a](https://bitbucket.org/enturas/design-system/commits/9e63b0af9dfb618caa301aab3c954974aecb9bb0))
71
+
72
+ ### BREAKING CHANGES
73
+
74
+ - **tag chip:** This change will add aria-label to all tag chip close buttons. If you already use this component,
75
+ you should check that the accessible text makes sense and if it doesn't, change the text using the
76
+ closeButtonAriaLabel prop
77
+
78
+ ## [0.5.8](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.7...@entur/chip@0.5.8) (2022-06-24)
79
+
80
+ **Note:** Version bump only for package @entur/chip
81
+
82
+ ## [0.5.7](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.6...@entur/chip@0.5.7) (2022-06-02)
83
+
84
+ **Note:** Version bump only for package @entur/chip
85
+
86
+ ## [0.5.6](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.5...@entur/chip@0.5.6) (2022-05-13)
87
+
88
+ **Note:** Version bump only for package @entur/chip
89
+
90
+ ## [0.5.5](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.4...@entur/chip@0.5.5) (2022-05-04)
91
+
92
+ **Note:** Version bump only for package @entur/chip
93
+
94
+ ## [0.5.4](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.3...@entur/chip@0.5.4) (2022-04-27)
95
+
96
+ **Note:** Version bump only for package @entur/chip
97
+
98
+ ## [0.5.3](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.2...@entur/chip@0.5.3) (2022-04-20)
99
+
100
+ **Note:** Version bump only for package @entur/chip
101
+
102
+ ## [0.5.2](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.1...@entur/chip@0.5.2) (2022-04-19)
103
+
104
+ **Note:** Version bump only for package @entur/chip
105
+
106
+ ## [0.5.1](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.0...@entur/chip@0.5.1) (2022-03-17)
107
+
108
+ ### Bug Fixes
109
+
110
+ - **ChoiceChip:** add -webkit fallback for Safari ([d19f8c3](https://bitbucket.org/enturas/design-system/commits/d19f8c34b401676283ff5fbc3b10ec0a1f04d3b8))
111
+
112
+ # [0.5.0](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.24...@entur/chip@0.5.0) (2022-03-14)
113
+
114
+ ### Features
115
+
116
+ - **action chip:** add loading state to action chip ([290e709](https://bitbucket.org/enturas/design-system/commits/290e709baef2c7513fc3b85e834fabb34697842e))
117
+
118
+ ## [0.4.24](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.23...@entur/chip@0.4.24) (2022-03-01)
119
+
120
+ **Note:** Version bump only for package @entur/chip
121
+
122
+ ## [0.4.23](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.22...@entur/chip@0.4.23) (2022-02-09)
123
+
124
+ **Note:** Version bump only for package @entur/chip
125
+
126
+ ## [0.4.22](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.21...@entur/chip@0.4.22) (2022-01-21)
127
+
128
+ **Note:** Version bump only for package @entur/chip
129
+
130
+ ## [0.4.21](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.20...@entur/chip@0.4.21) (2022-01-05)
131
+
132
+ **Note:** Version bump only for package @entur/chip
133
+
134
+ ## [0.4.20](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.19...@entur/chip@0.4.20) (2021-12-10)
135
+
136
+ **Note:** Version bump only for package @entur/chip
137
+
138
+ ## [0.4.19](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.18...@entur/chip@0.4.19) (2021-11-17)
139
+
140
+ **Note:** Version bump only for package @entur/chip
141
+
142
+ ## [0.4.18](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.17...@entur/chip@0.4.18) (2021-10-25)
143
+
144
+ **Note:** Version bump only for package @entur/chip
145
+
146
+ ## [0.4.17](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.16...@entur/chip@0.4.17) (2021-10-18)
147
+
148
+ **Note:** Version bump only for package @entur/chip
149
+
150
+ ## [0.4.16](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.15...@entur/chip@0.4.16) (2021-09-23)
151
+
152
+ **Note:** Version bump only for package @entur/chip
153
+
154
+ ## [0.4.15](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.14...@entur/chip@0.4.15) (2021-09-13)
155
+
156
+ **Note:** Version bump only for package @entur/chip
157
+
158
+ ## [0.4.14](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.13...@entur/chip@0.4.14) (2021-09-07)
159
+
160
+ ### Bug Fixes
161
+
162
+ - improve typings ([423e06a](https://bitbucket.org/enturas/design-system/commits/423e06a1048731509fe0d3d6606e3fe390a868e1))
163
+ - utilize reworked focus token ([586758f](https://bitbucket.org/enturas/design-system/commits/586758fc86eb5aa52116c63c14ef033eb2e8b12f))
164
+
165
+ ## [0.4.13](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.12...@entur/chip@0.4.13) (2021-08-13)
166
+
167
+ **Note:** Version bump only for package @entur/chip
168
+
169
+ ## [0.4.12](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.11...@entur/chip@0.4.12) (2021-07-16)
170
+
171
+ **Note:** Version bump only for package @entur/chip
172
+
173
+ ## [0.4.11](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.10...@entur/chip@0.4.11) (2021-06-25)
174
+
175
+ ### Bug Fixes
176
+
177
+ - update dependencies ([b7f5e2d](https://bitbucket.org/enturas/design-system/commits/b7f5e2dd6ccfd066d61fdda5d1892994ea5b28dd))
178
+
179
+ ## [0.4.10](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.9...@entur/chip@0.4.10) (2021-06-04)
180
+
181
+ **Note:** Version bump only for package @entur/chip
182
+
183
+ ## [0.4.9](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.8...@entur/chip@0.4.9) (2021-05-19)
184
+
185
+ **Note:** Version bump only for package @entur/chip
186
+
187
+ ## [0.4.8](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.7...@entur/chip@0.4.8) (2021-05-05)
188
+
189
+ **Note:** Version bump only for package @entur/chip
190
+
191
+ ## [0.4.7](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.6...@entur/chip@0.4.7) (2021-04-23)
192
+
193
+ ### Bug Fixes
194
+
195
+ - utilize new focus tokens ([17113ef](https://bitbucket.org/enturas/design-system/commits/17113ef3f791c86fa6e19e71680fd5acdbae4990))
196
+
197
+ ## [0.4.6](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.5...@entur/chip@0.4.6) (2021-04-09)
198
+
199
+ **Note:** Version bump only for package @entur/chip
200
+
201
+ ## [0.4.5](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.4...@entur/chip@0.4.5) (2021-03-02)
202
+
203
+ **Note:** Version bump only for package @entur/chip
204
+
205
+ ## [0.4.4](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.3...@entur/chip@0.4.4) (2021-02-17)
206
+
207
+ **Note:** Version bump only for package @entur/chip
208
+
209
+ ## [0.4.3](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.2...@entur/chip@0.4.3) (2021-02-05)
210
+
211
+ **Note:** Version bump only for package @entur/chip
212
+
213
+ ## [0.4.2](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.1...@entur/chip@0.4.2) (2021-01-29)
214
+
215
+ **Note:** Version bump only for package @entur/chip
216
+
217
+ ## [0.4.1](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.0...@entur/chip@0.4.1) (2021-01-20)
218
+
219
+ ### Bug Fixes
220
+
221
+ - **choicechipgroup:** add label prop explicitly to typings ([eace8d6](https://bitbucket.org/enturas/design-system/commits/eace8d6cd2a91dc79003b9a54042d007d8cd5a8c))
222
+
223
+ # [0.4.0](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.41...@entur/chip@0.4.0) (2021-01-13)
224
+
225
+ ### Features
226
+
227
+ - **choicechip:** update value type with support for null ([0311c32](https://bitbucket.org/enturas/design-system/commits/0311c329f9a35a8d150c48e26d53bb902e4b3787))
228
+
229
+ ## [0.3.41](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.40...@entur/chip@0.3.41) (2021-01-05)
230
+
231
+ ### Bug Fixes
232
+
233
+ - **actionchip:** improved typings ([66b3acc](https://bitbucket.org/enturas/design-system/commits/66b3accad09a69a2c9cd0f8cd1221f2b32931489))
234
+ - **choicechip:** improve typings ([c839400](https://bitbucket.org/enturas/design-system/commits/c839400ca651020bc685840d7a18a5d382d907b0))
235
+
236
+ ## [0.3.40](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.39...@entur/chip@0.3.40) (2020-12-04)
237
+
238
+ ### Bug Fixes
239
+
240
+ - **actionchip:** improve typings ([3999811](https://bitbucket.org/enturas/design-system/commits/399981153891f5131bd7af1e28bb5fc7f8fdf874))
241
+ - **choicechip:** improve typings ([17b93c1](https://bitbucket.org/enturas/design-system/commits/17b93c197b05c277cec1b9bc28b0106b7e244be0))
242
+ - **filterchip:** improve typings ([c9ad609](https://bitbucket.org/enturas/design-system/commits/c9ad6099243911b427885382dc0f5c1001cdee1d))
243
+ - **tagchip:** improve typings ([33b4310](https://bitbucket.org/enturas/design-system/commits/33b431078ac73cde364a40dd27a44c4497f58d89))
244
+
245
+ ## [0.3.39](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.38...@entur/chip@0.3.39) (2020-11-26)
246
+
247
+ **Note:** Version bump only for package @entur/chip
248
+
249
+ ## [0.3.38](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.37...@entur/chip@0.3.38) (2020-11-10)
250
+
251
+ ### Bug Fixes
252
+
253
+ - **choice chip:** improve typing of onchange prop ([e790234](https://bitbucket.org/enturas/design-system/commits/e79023473e27c2c21016cb6394070a2ce8cd6f89))
254
+
255
+ ## [0.3.37](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.36...@entur/chip@0.3.37) (2020-11-05)
256
+
257
+ **Note:** Version bump only for package @entur/chip
258
+
259
+ ## [0.3.36](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.35...@entur/chip@0.3.36) (2020-10-28)
260
+
261
+ **Note:** Version bump only for package @entur/chip
262
+
263
+ ## [0.3.35](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.34...@entur/chip@0.3.35) (2020-10-23)
264
+
265
+ **Note:** Version bump only for package @entur/chip
266
+
267
+ ## [0.3.34](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.33...@entur/chip@0.3.34) (2020-10-16)
268
+
269
+ **Note:** Version bump only for package @entur/chip
270
+
271
+ ## [0.3.33](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.32...@entur/chip@0.3.33) (2020-10-09)
272
+
273
+ **Note:** Version bump only for package @entur/chip
274
+
275
+ ## [0.3.32](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.31...@entur/chip@0.3.32) (2020-10-09)
276
+
277
+ **Note:** Version bump only for package @entur/chip
278
+
279
+ ## [0.3.31](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.30...@entur/chip@0.3.31) (2020-09-25)
280
+
281
+ **Note:** Version bump only for package @entur/chip
282
+
283
+ ## [0.3.30](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.29...@entur/chip@0.3.30) (2020-09-14)
284
+
285
+ **Note:** Version bump only for package @entur/chip
286
+
287
+ ## [0.3.29](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.28...@entur/chip@0.3.29) (2020-09-10)
288
+
289
+ **Note:** Version bump only for package @entur/chip
290
+
291
+ ## [0.3.28](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.27...@entur/chip@0.3.28) (2020-09-02)
292
+
293
+ **Note:** Version bump only for package @entur/chip
294
+
295
+ ## [0.3.27](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.26...@entur/chip@0.3.27) (2020-08-26)
296
+
297
+ **Note:** Version bump only for package @entur/chip
298
+
299
+ ## [0.3.26](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.25...@entur/chip@0.3.26) (2020-08-20)
300
+
301
+ **Note:** Version bump only for package @entur/chip
302
+
303
+ ## [0.3.25](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.24...@entur/chip@0.3.25) (2020-08-19)
304
+
305
+ **Note:** Version bump only for package @entur/chip
306
+
307
+ ## [0.3.24](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.23...@entur/chip@0.3.24) (2020-08-14)
308
+
309
+ **Note:** Version bump only for package @entur/chip
310
+
311
+ ## [0.3.23](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.22...@entur/chip@0.3.23) (2020-08-11)
312
+
313
+ ### Bug Fixes
314
+
315
+ - adjust disabled choicechip styling ([713a2ab](https://bitbucket.org/enturas/design-system/commits/713a2abfc0285f0d78ee4c990e6bd2ee0c2b5e08))
316
+
317
+ ## [0.3.22](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.21...@entur/chip@0.3.22) (2020-07-24)
318
+
319
+ **Note:** Version bump only for package @entur/chip
320
+
321
+ ## [0.3.21](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.20...@entur/chip@0.3.21) (2020-07-22)
322
+
323
+ **Note:** Version bump only for package @entur/chip
324
+
325
+ ## [0.3.20](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.19...@entur/chip@0.3.20) (2020-07-16)
326
+
327
+ **Note:** Version bump only for package @entur/chip
328
+
329
+ ## [0.3.19](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.18...@entur/chip@0.3.19) (2020-07-13)
330
+
331
+ **Note:** Version bump only for package @entur/chip
332
+
333
+ ## [0.3.18](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.17...@entur/chip@0.3.18) (2020-07-09)
334
+
335
+ ### Bug Fixes
336
+
337
+ - adjust choice chip background color ([0097236](https://bitbucket.org/enturas/design-system/commits/009723686e9ff61e1fe9a24dee8e2c7a38cecb81))
338
+
339
+ ## [0.3.17](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.16...@entur/chip@0.3.17) (2020-07-03)
340
+
341
+ **Note:** Version bump only for package @entur/chip
342
+
343
+ ## [0.3.16](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.15...@entur/chip@0.3.16) (2020-06-17)
344
+
345
+ ### Bug Fixes
346
+
347
+ - fix wrong definition of forward referencing ([e5cad92](https://bitbucket.org/enturas/design-system/commits/e5cad92c59bc6453ab4dbe9a18c4c7e42dd7e00d))
348
+
349
+ ## [0.3.15](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.14...@entur/chip@0.3.15) (2020-05-27)
350
+
351
+ **Note:** Version bump only for package @entur/chip
352
+
353
+ ## [0.3.14](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.13...@entur/chip@0.3.14) (2020-05-26)
354
+
355
+ **Note:** Version bump only for package @entur/chip
356
+
357
+ ## [0.3.13](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.12...@entur/chip@0.3.13) (2020-05-20)
358
+
359
+ ### Bug Fixes
360
+
361
+ - add forward referencing to TagChip ([08d0a57](https://bitbucket.org/enturas/design-system/commits/08d0a579469ce615e2dfbe63d8ddc20e56b490a2))
362
+
363
+ ## [0.3.12](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.11...@entur/chip@0.3.12) (2020-04-27)
364
+
365
+ **Note:** Version bump only for package @entur/chip
366
+
367
+ ## [0.3.11](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.10...@entur/chip@0.3.11) (2020-04-23)
368
+
369
+ ### Bug Fixes
370
+
371
+ - updated to use new focus styling where applicable ([d0a52c0](https://bitbucket.org/enturas/design-system/commits/d0a52c096b673c6647070a90dd79bef9003ee0ad))
372
+
373
+ ## [0.3.10](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.9...@entur/chip@0.3.10) (2020-04-08)
374
+
375
+ **Note:** Version bump only for package @entur/chip
376
+
377
+ ## [0.3.9](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.7...@entur/chip@0.3.9) (2020-03-25)
378
+
379
+ **Note:** Version bump only for package @entur/chip
380
+
381
+ ## [0.3.8](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.7...@entur/chip@0.3.8) (2020-03-25)
382
+
383
+ **Note:** Version bump only for package @entur/chip
384
+
385
+ ## [0.3.7](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.6...@entur/chip@0.3.7) (2020-03-20)
386
+
387
+ **Note:** Version bump only for package @entur/chip
388
+
389
+ ## [0.3.6](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.5...@entur/chip@0.3.6) (2020-03-18)
390
+
391
+ **Note:** Version bump only for package @entur/chip
392
+
393
+ ## [0.3.5](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.4...@entur/chip@0.3.5) (2020-03-05)
394
+
395
+ **Note:** Version bump only for package @entur/chip
396
+
397
+ ## [0.3.4](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.3...@entur/chip@0.3.4) (2020-02-26)
398
+
399
+ **Note:** Version bump only for package @entur/chip
400
+
401
+ ## [0.3.3](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.2...@entur/chip@0.3.3) (2020-02-20)
402
+
403
+ **Note:** Version bump only for package @entur/chip
404
+
405
+ ## [0.3.2](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.1...@entur/chip@0.3.2) (2020-02-14)
406
+
407
+ **Note:** Version bump only for package @entur/chip
408
+
409
+ ## [0.3.1](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.0...@entur/chip@0.3.1) (2020-02-12)
410
+
411
+ **Note:** Version bump only for package @entur/chip
412
+
413
+ # [0.3.0](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.14...@entur/chip@0.3.0) (2020-02-10)
414
+
415
+ ### Features
416
+
417
+ - add new components: tagchip and filterchip ([9363b20](https://bitbucket.org/enturas/design-system/commits/9363b204f04c8d10a2cee3a8076313b0800e027e))
418
+
419
+ ## [0.2.14](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.13...@entur/chip@0.2.14) (2020-02-05)
420
+
421
+ ### Bug Fixes
422
+
423
+ - remove test-files from build process ([e0b24af](https://bitbucket.org/enturas/design-system/commits/e0b24af05d5c2ad8de4ae587d83c389495235890))
424
+
425
+ ## [0.2.13](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.12...@entur/chip@0.2.13) (2020-01-31)
426
+
427
+ **Note:** Version bump only for package @entur/chip
428
+
429
+ ## [0.2.12](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.11...@entur/chip@0.2.12) (2020-01-28)
430
+
431
+ **Note:** Version bump only for package @entur/chip
432
+
433
+ ## [0.2.11](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.10...@entur/chip@0.2.11) (2020-01-27)
434
+
435
+ ### Bug Fixes
436
+
437
+ - **types:** place types in the correct place ([acace09](https://bitbucket.org/enturas/design-system/commits/acace09ec0e258c5cff3a65e13ab29d6603780d9))
438
+
439
+ ## [0.2.10](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.9...@entur/chip@0.2.10) (2020-01-20)
440
+
441
+ **Note:** Version bump only for package @entur/chip
442
+
443
+ ## [0.2.9](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.8...@entur/chip@0.2.9) (2020-01-14)
444
+
445
+ **Note:** Version bump only for package @entur/chip
446
+
447
+ ## [0.2.8](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.7...@entur/chip@0.2.8) (2020-01-13)
448
+
449
+ **Note:** Version bump only for package @entur/chip
450
+
451
+ ## [0.2.7](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.6...@entur/chip@0.2.7) (2020-01-10)
452
+
453
+ **Note:** Version bump only for package @entur/chip
454
+
455
+ ## [0.2.6](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.5...@entur/chip@0.2.6) (2020-01-08)
456
+
457
+ ### Bug Fixes
458
+
459
+ - warn in development if the developer have forgotten the CSS ([e5c30fc](https://bitbucket.org/enturas/design-system/commits/e5c30fc08624ef22c02773892778abd92205c6b0))
460
+
461
+ ## [0.2.5](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.4...@entur/chip@0.2.5) (2020-01-06)
462
+
463
+ **Note:** Version bump only for package @entur/chip
464
+
465
+ ## [0.2.4](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.3...@entur/chip@0.2.4) (2019-12-17)
466
+
467
+ **Note:** Version bump only for package @entur/chip
468
+
469
+ ## [0.2.3](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.2...@entur/chip@0.2.3) (2019-12-10)
470
+
471
+ ### Bug Fixes
472
+
473
+ - decreasing min-width for chips to 48px ([fe273db](https://bitbucket.org/enturas/design-system/commits/fe273dbd587a31514d852e743da564c2402ef13a))
474
+ - fixing label support for choice chips group ([8bebf95](https://bitbucket.org/enturas/design-system/commits/8bebf9503ccb7dadd100fbd177b3da31a9375483))
475
+
476
+ ## [0.2.2](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.1...@entur/chip@0.2.2) (2019-12-10)
477
+
478
+ ### Bug Fixes
479
+
480
+ - spreading styles on ChoiceChip-components ([4bdfef8](https://bitbucket.org/enturas/design-system/commits/4bdfef86acdc29e3620a9b20792812672b58bfa6))
481
+ - **icon position:** consistent spacing for icons in chips ([f8ab91f](https://bitbucket.org/enturas/design-system/commits/f8ab91f255e70f1945d7145e6aef7c5136232bc1))
482
+ - adding default prop as part of documentation ([1ef7510](https://bitbucket.org/enturas/design-system/commits/1ef75107362f6262429d7fe31519b4353eccc8de))
483
+
484
+ ## [0.2.1](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.0...@entur/chip@0.2.1) (2019-11-29)
485
+
486
+ ### Bug Fixes
487
+
488
+ - using new box shadow tokens ([9ff30bd](https://bitbucket.org/enturas/design-system/commits/9ff30bd52ad2b6e6d770565684a05e15f0b0ba9a))
489
+
490
+ # [0.2.0](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.1.1...@entur/chip@0.2.0) (2019-11-22)
491
+
492
+ ### Features
493
+
494
+ - **types:** exporting all public types for public components ([4a277ab](https://bitbucket.org/enturas/design-system/commits/4a277ab266fdb32a6760821a07b1c6cc716bac85))
495
+
496
+ ## 0.1.1 (2019-11-18)
497
+
498
+ ### Bug Fixes
499
+
500
+ - fixing improper styling of chips ([eb48017](https://bitbucket.org/enturas/design-system/commits/eb48017876785665900062461470b35ef05a1e9f))
@@ -18,26 +18,32 @@ function _extends() {
18
18
  _extends = Object.assign || function (target) {
19
19
  for (var i = 1; i < arguments.length; i++) {
20
20
  var source = arguments[i];
21
+
21
22
  for (var key in source) {
22
23
  if (Object.prototype.hasOwnProperty.call(source, key)) {
23
24
  target[key] = source[key];
24
25
  }
25
26
  }
26
27
  }
28
+
27
29
  return target;
28
30
  };
31
+
29
32
  return _extends.apply(this, arguments);
30
33
  }
34
+
31
35
  function _objectWithoutPropertiesLoose(source, excluded) {
32
36
  if (source == null) return {};
33
37
  var target = {};
34
38
  var sourceKeys = Object.keys(source);
35
39
  var key, i;
40
+
36
41
  for (i = 0; i < sourceKeys.length; i++) {
37
42
  key = sourceKeys[i];
38
43
  if (excluded.indexOf(key) >= 0) continue;
39
44
  target[key] = source[key];
40
45
  }
46
+
41
47
  return target;
42
48
  }
43
49
 
@@ -45,21 +51,24 @@ var ChoiceChipGroupContext = /*#__PURE__*/React__default["default"].createContex
45
51
  var ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;
46
52
  var useChoiceChipGroupContext = function useChoiceChipGroupContext() {
47
53
  var context = React__default["default"].useContext(ChoiceChipGroupContext);
54
+
48
55
  if (!context) {
49
56
  throw new Error('You need to wrap your ChoiceChips in a ChoiceChipGroup-component');
50
57
  }
58
+
51
59
  return context;
52
60
  };
53
61
 
54
62
  var _excluded$4 = ["className", "children", "value", "disabled", "style"];
55
63
  var ChoiceChip = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
56
64
  var className = _ref.className,
57
- children = _ref.children,
58
- value = _ref.value,
59
- _ref$disabled = _ref.disabled,
60
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
61
- style = _ref.style,
62
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
65
+ children = _ref.children,
66
+ value = _ref.value,
67
+ _ref$disabled = _ref.disabled,
68
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
69
+ style = _ref.style,
70
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
71
+
63
72
  var childrenArray = React__default["default"].Children.toArray(children);
64
73
  var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
65
74
  var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string';
@@ -68,10 +77,12 @@ var ChoiceChip = /*#__PURE__*/React__default["default"].forwardRef(function (_re
68
77
  'eds-chip--leading-icon': hasLeadingIcon,
69
78
  'eds-chip--trailing-icon': hasTrailingIcon
70
79
  });
80
+
71
81
  var _useChoiceChipGroupCo = useChoiceChipGroupContext(),
72
- name = _useChoiceChipGroupCo.name,
73
- selectedValue = _useChoiceChipGroupCo.value,
74
- onChange = _useChoiceChipGroupCo.onChange;
82
+ name = _useChoiceChipGroupCo.name,
83
+ selectedValue = _useChoiceChipGroupCo.value,
84
+ onChange = _useChoiceChipGroupCo.onChange;
85
+
75
86
  return React__default["default"].createElement("label", {
76
87
  className: "eds-choice-chip",
77
88
  style: style
@@ -92,18 +103,21 @@ var ChoiceChip = /*#__PURE__*/React__default["default"].forwardRef(function (_re
92
103
  var _excluded$3 = ["children", "className", "loading"];
93
104
  var ActionChip = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
94
105
  var children = _ref.children,
95
- className = _ref.className,
96
- _ref$loading = _ref.loading,
97
- loading = _ref$loading === void 0 ? false : _ref$loading,
98
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
106
+ className = _ref.className,
107
+ _ref$loading = _ref.loading,
108
+ loading = _ref$loading === void 0 ? false : _ref$loading,
109
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
110
+
99
111
  var childrenArray = React__default["default"].Children.toArray(children);
100
112
  var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
101
113
  var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string';
114
+
102
115
  var ariaLabelValue = function ariaLabelValue() {
103
116
  if (rest['aria-label']) return rest['aria-label'];
104
117
  if (loading) return ariaLabelWhenLoading;
105
118
  return undefined;
106
119
  };
120
+
107
121
  var ariaLabelWhenLoading = childrenArray.filter(function (child) {
108
122
  return typeof child === 'string';
109
123
  }).join(' ');
@@ -120,21 +134,24 @@ var ActionChip = /*#__PURE__*/React__default["default"].forwardRef(function (_re
120
134
  }, rest), loading ? React__default["default"].createElement(loader.LoadingDots, {
121
135
  className: "eds-action-chip__loading-dots"
122
136
  }) : children);
137
+
123
138
  if (rest.disabled) {
124
139
  return React__default["default"].createElement("div", {
125
140
  className: "eds-action-chip--disabled__wrapper"
126
141
  }, actionChip);
127
142
  }
143
+
128
144
  return React__default["default"].createElement(React__default["default"].Fragment, null, actionChip);
129
145
  });
130
146
 
131
147
  var _excluded$2 = ["children", "className", "onClose", "closeButtonAriaLabel"];
132
148
  var TagChip = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
133
149
  var children = _ref.children,
134
- className = _ref.className,
135
- onClose = _ref.onClose,
136
- closeButtonAriaLabel = _ref.closeButtonAriaLabel,
137
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
150
+ className = _ref.className,
151
+ onClose = _ref.onClose,
152
+ closeButtonAriaLabel = _ref.closeButtonAriaLabel,
153
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
154
+
138
155
  var selectedCloseLabel = closeButtonAriaLabel != null ? closeButtonAriaLabel : 'Fjern ' + (children == null ? void 0 : children.toString());
139
156
  return React__default["default"].createElement("div", _extends({
140
157
  className: classNames__default["default"]('eds-chip', 'eds-tag-chip', className)
@@ -150,13 +167,14 @@ var TagChip = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
150
167
  var _excluded$1 = ["className", "children", "value", "disabled", "name", "style"];
151
168
  var FilterChip = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
152
169
  var className = _ref.className,
153
- children = _ref.children,
154
- value = _ref.value,
155
- _ref$disabled = _ref.disabled,
156
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
157
- name = _ref.name,
158
- style = _ref.style,
159
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
170
+ children = _ref.children,
171
+ value = _ref.value,
172
+ _ref$disabled = _ref.disabled,
173
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
174
+ name = _ref.name,
175
+ style = _ref.style,
176
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
177
+
160
178
  var classList = classNames__default["default"](className, 'eds-chip', 'eds-filter-chip');
161
179
  return React__default["default"].createElement("label", {
162
180
  className: classList,
@@ -172,6 +190,7 @@ var FilterChip = /*#__PURE__*/React__default["default"].forwardRef(function (_re
172
190
  className: "eds-filter-chip__icon"
173
191
  }, React__default["default"].createElement(CheckboxIcon, null)), children);
174
192
  });
193
+
175
194
  var CheckboxIcon = function CheckboxIcon() {
176
195
  return React__default["default"].createElement("svg", {
177
196
  className: "eds-filter-chip-icon",
@@ -188,11 +207,12 @@ var CheckboxIcon = function CheckboxIcon() {
188
207
  var _excluded = ["name", "value", "children", "onChange", "label"];
189
208
  var ChoiceChipGroup = function ChoiceChipGroup(_ref) {
190
209
  var name = _ref.name,
191
- value = _ref.value,
192
- children = _ref.children,
193
- onChange = _ref.onChange,
194
- label = _ref.label,
195
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
210
+ value = _ref.value,
211
+ children = _ref.children,
212
+ onChange = _ref.onChange,
213
+ label = _ref.label,
214
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
215
+
196
216
  var contextValue = React__default["default"].useMemo(function () {
197
217
  return {
198
218
  name: name,
@@ -1 +1 @@
1
- {"version":3,"file":"chip.cjs.development.js","sources":["../src/ChoiceChipGroupContext.tsx","../src/ChoiceChip.tsx","../src/ActionChip.tsx","../src/TagChip.tsx","../src/FilterChip.tsx","../src/ChoiceChipGroup.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\ntype ChoiceChipGroupContextProps = {\n name: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n value: string | null;\n};\n\nconst ChoiceChipGroupContext =\n React.createContext<ChoiceChipGroupContextProps | null>(null);\n\nexport const ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;\n\nexport const useChoiceChipGroupContext: () => ChoiceChipGroupContextProps =\n () => {\n const context = React.useContext(ChoiceChipGroupContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your ChoiceChips in a ChoiceChipGroup-component',\n );\n }\n return context;\n };\n","import React from 'react';\nimport cx from 'classnames';\nimport { useChoiceChipGroupContext } from './ChoiceChipGroupContext';\nimport './BaseChip.scss';\nimport './ChoiceChip.scss';\n\nexport type ChoiceChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om Choicechip er deaktivert eller ikke\n * @default false\n */\n disabled?: boolean;\n /** Label til ChoiceChip */\n children?: React.ReactNode;\n /** Verdien til ChoiceChip */\n value: string;\n} & Omit<\n React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >,\n 'value'\n>;\n\nexport const ChoiceChip = React.forwardRef<HTMLInputElement, ChoiceChipProps>(\n (\n { className, children, value, disabled = false, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const classList = cx(className, 'eds-chip', {\n 'eds-chip--disabled': disabled,\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n });\n const {\n name,\n value: selectedValue,\n onChange,\n } = useChoiceChipGroupContext();\n return (\n <label className=\"eds-choice-chip\" style={style}>\n <input\n className=\"eds-choice-chip__input\"\n type=\"radio\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n checked={selectedValue === value}\n onChange={onChange}\n {...rest}\n />\n <div className={classList}>{children}</div>\n </label>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseChip.scss';\nimport './ActionChip.scss';\n\nexport type ActionChipProps = {\n /** Teksten som vises i ActionChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Om chip-en er opptatt, f.eks med å oppdatere informasjon\n * @default false\n */\n loading?: boolean;\n} & React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nexport const ActionChip = React.forwardRef<HTMLButtonElement, ActionChipProps>(\n (\n { children, className, loading = false, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelValue = () => {\n if (rest['aria-label']) return rest['aria-label'];\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const actionChip = (\n <button\n className={classNames(\n 'eds-chip',\n 'eds-action-chip',\n {\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n 'eds-action-chip--disabled': rest.disabled,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n aria-label={ariaLabelValue()}\n type=\"button\"\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-action-chip__loading-dots\" />\n ) : (\n children\n )}\n </button>\n );\n\n if (rest.disabled) {\n return (\n <div className=\"eds-action-chip--disabled__wrapper\">{actionChip}</div>\n );\n }\n return <>{actionChip}</>;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { CloseIcon } from '@entur/icons';\nimport './BaseChip.scss';\nimport './TagChip.scss';\n\nexport type TagChipProps = {\n /** Teksten som vises i TagChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback for når man klikker på krysset */\n onClose: () => void;\n /** Skjermlesertekst for X-knappen */\n closeButtonAriaLabel?: string;\n};\n\nexport const TagChip = React.forwardRef<HTMLButtonElement, TagChipProps>(\n (\n { children, className, onClose, closeButtonAriaLabel, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const selectedCloseLabel =\n closeButtonAriaLabel ?? 'Fjern ' + children?.toString();\n\n return (\n <div\n className={classNames('eds-chip', 'eds-tag-chip', className)}\n {...rest}\n >\n {children}\n <button\n className=\"eds-tag-chip__close-button\"\n type=\"button\"\n onClick={onClose}\n aria-label={selectedCloseLabel}\n ref={ref}\n >\n <CloseIcon />\n </button>\n </div>\n );\n },\n);\n","import React from 'react';\nimport cx from 'classnames';\nimport './BaseChip.scss';\nimport './FilterChip.scss';\n\nexport type FilterChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Label til FilterChip */\n children?: React.ReactNode;\n /** Verdien til FilterChip */\n value: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\nexport const FilterChip = React.forwardRef<HTMLInputElement, FilterChipProps>(\n (\n { className, children, value, disabled = false, name, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const classList = cx(className, 'eds-chip', 'eds-filter-chip');\n\n return (\n <label className={classList} style={style}>\n <input\n className=\"eds-filter-chip__input\"\n type=\"checkbox\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n {...rest}\n />\n <span className=\"eds-filter-chip__icon\">\n <CheckboxIcon />\n </span>\n {children}\n </label>\n );\n },\n);\n\nconst CheckboxIcon: React.FC = () => {\n return (\n <svg\n className=\"eds-filter-chip-icon\"\n width=\"11px\"\n height=\"9px\"\n viewBox=\"6 11 37 33\"\n >\n <path\n className=\"eds-filter-chip-icon__path\"\n d=\"M14.1 27.2l7.1 7.2 14.6-14.8\"\n fill=\"none\"\n />\n </svg>\n );\n};\n","import React from 'react';\nimport { ChoiceChipGroupContextProvider } from './ChoiceChipGroupContext';\nimport { Fieldset } from '@entur/form';\nexport type ChoiceChipGroupProps = {\n /** Navnet til ChoiceChipsGroup */\n name: string;\n /** Verdien til den valgte ChoiceChipen */\n value: string | null;\n /** ChoiceChip-komponentene sendes inn som children */\n children: React.ReactNode;\n /** En callback som blir kalles hver gang en ChoiceChip klikkes på */\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Labelen til ChoiceChip-gruppen. */\n label?: React.ReactNode;\n [key: string]: any;\n};\n\nexport const ChoiceChipGroup: React.FC<ChoiceChipGroupProps> = ({\n name,\n value,\n children,\n onChange,\n label,\n ...rest\n}) => {\n const contextValue = React.useMemo(\n () => ({ name, value, onChange }),\n [name, value, onChange],\n );\n return (\n <ChoiceChipGroupContextProvider value={contextValue}>\n <Fieldset className=\"eds-choice-chips-group\" label={label} {...rest}>\n {children}\n </Fieldset>\n </ChoiceChipGroupContextProvider>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('chip', 'form');\n\nexport * from './ChoiceChip';\nexport * from './ActionChip';\nexport * from './TagChip';\nexport * from './FilterChip';\nexport * from './ChoiceChipGroup';\n"],"names":["ChoiceChipGroupContext","React","createContext","ChoiceChipGroupContextProvider","Provider","useChoiceChipGroupContext","context","useContext","Error","ChoiceChip","forwardRef","ref","className","children","value","disabled","style","rest","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","classList","cx","name","selectedValue","onChange","type","checked","ActionChip","loading","ariaLabelValue","ariaLabelWhenLoading","undefined","filter","child","join","actionChip","classNames","LoadingDots","TagChip","onClose","closeButtonAriaLabel","selectedCloseLabel","toString","onClick","CloseIcon","FilterChip","CheckboxIcon","width","height","viewBox","d","fill","ChoiceChipGroup","label","contextValue","useMemo","Fieldset","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAMA,sBAAsB,gBAC1BC,yBAAK,CAACC,aAAa,CAAqC,IAAI,CAAC;AAExD,IAAMC,8BAA8B,GAAGH,sBAAsB,CAACI,QAAQ;AAEtE,IAAMC,yBAAyB,GACpC,SADWA,yBAAyB;EAElC,IAAMC,OAAO,GAAGL,yBAAK,CAACM,UAAU,CAACP,sBAAsB,CAAC;EACxD,IAAI,CAACM,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CACb,kEAAkE,CACnE;;EAEH,OAAOF,OAAO;AAChB,CAAC;;;ICGUG,UAAU,gBAAGR,yBAAK,CAACS,UAAU,CACxC,gBAEEC,GAAgC;MAD9BC,SAAS,QAATA,SAAS;IAAEC,QAAQ,QAARA,QAAQ;IAAEC,KAAK,QAALA,KAAK;IAAA,qBAAEC,QAAQ;IAARA,QAAQ,8BAAG,KAAK;IAAEC,KAAK,QAALA,KAAK;IAAKC,IAAI;EAG9D,IAAMC,aAAa,GAAGjB,yBAAK,CAACkB,QAAQ,CAACC,OAAO,CAACP,QAAQ,CAAC;EACtD,IAAMQ,cAAc,GAClBH,aAAa,CAACI,MAAM,GAAG,CAAC,IAAI,OAAOJ,aAAa,CAAC,CAAC,CAAC,KAAK,QAAQ;EAClE,IAAMK,eAAe,GACnBL,aAAa,CAACI,MAAM,GAAG,CAAC,IACxB,OAAOJ,aAAa,CAACA,aAAa,CAACI,MAAM,GAAG,CAAC,CAAC,KAAK,QAAQ;EAE7D,IAAME,SAAS,GAAGC,8BAAE,CAACb,SAAS,EAAE,UAAU,EAAE;IAC1C,oBAAoB,EAAEG,QAAQ;IAC9B,wBAAwB,EAAEM,cAAc;IACxC,yBAAyB,EAAEE;GAC5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C,EACjC,CAACF,IAAI,EAAEZ,KAAK,EAAEc,QAAQ,CAAC,CACxB;EACD,OACE3B,wCAACE,8BAA8B;IAACW,KAAK,EAAE4C;KACrCzD,wCAAC2D,aAAQ;IAAChD,SAAS,EAAC,wBAAwB;IAAC6C,KAAK,EAAEA;KAAWxC,IAAI,GAChEJ,QAAQ,CACA,CACoB;AAErC;;ACjCAgD,4BAAsB,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;;;"}
1
+ {"version":3,"file":"chip.cjs.development.js","sources":["../src/ChoiceChipGroupContext.tsx","../src/ChoiceChip.tsx","../src/ActionChip.tsx","../src/TagChip.tsx","../src/FilterChip.tsx","../src/ChoiceChipGroup.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\ntype ChoiceChipGroupContextProps = {\n name: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n value: string | null;\n};\n\nconst ChoiceChipGroupContext =\n React.createContext<ChoiceChipGroupContextProps | null>(null);\n\nexport const ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;\n\nexport const useChoiceChipGroupContext: () => ChoiceChipGroupContextProps =\n () => {\n const context = React.useContext(ChoiceChipGroupContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your ChoiceChips in a ChoiceChipGroup-component',\n );\n }\n return context;\n };\n","import React from 'react';\nimport cx from 'classnames';\nimport { useChoiceChipGroupContext } from './ChoiceChipGroupContext';\nimport './BaseChip.scss';\nimport './ChoiceChip.scss';\n\nexport type ChoiceChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om Choicechip er deaktivert eller ikke\n * @default false\n */\n disabled?: boolean;\n /** Label til ChoiceChip */\n children?: React.ReactNode;\n /** Verdien til ChoiceChip */\n value: string;\n} & Omit<\n React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >,\n 'value'\n>;\n\nexport const ChoiceChip = React.forwardRef<HTMLInputElement, ChoiceChipProps>(\n (\n { className, children, value, disabled = false, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const classList = cx(className, 'eds-chip', {\n 'eds-chip--disabled': disabled,\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n });\n const {\n name,\n value: selectedValue,\n onChange,\n } = useChoiceChipGroupContext();\n return (\n <label className=\"eds-choice-chip\" style={style}>\n <input\n className=\"eds-choice-chip__input\"\n type=\"radio\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n checked={selectedValue === value}\n onChange={onChange}\n {...rest}\n />\n <div className={classList}>{children}</div>\n </label>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseChip.scss';\nimport './ActionChip.scss';\n\nexport type ActionChipProps = {\n /** Teksten som vises i ActionChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Om chip-en er opptatt, f.eks med å oppdatere informasjon\n * @default false\n */\n loading?: boolean;\n} & React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nexport const ActionChip = React.forwardRef<HTMLButtonElement, ActionChipProps>(\n (\n { children, className, loading = false, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelValue = () => {\n if (rest['aria-label']) return rest['aria-label'];\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const actionChip = (\n <button\n className={classNames(\n 'eds-chip',\n 'eds-action-chip',\n {\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n 'eds-action-chip--disabled': rest.disabled,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n aria-label={ariaLabelValue()}\n type=\"button\"\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-action-chip__loading-dots\" />\n ) : (\n children\n )}\n </button>\n );\n\n if (rest.disabled) {\n return (\n <div className=\"eds-action-chip--disabled__wrapper\">{actionChip}</div>\n );\n }\n return <>{actionChip}</>;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { CloseIcon } from '@entur/icons';\nimport './BaseChip.scss';\nimport './TagChip.scss';\n\nexport type TagChipProps = {\n /** Teksten som vises i TagChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback for når man klikker på krysset */\n onClose: () => void;\n /** Skjermlesertekst for X-knappen */\n closeButtonAriaLabel?: string;\n};\n\nexport const TagChip = React.forwardRef<HTMLButtonElement, TagChipProps>(\n (\n { children, className, onClose, closeButtonAriaLabel, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const selectedCloseLabel =\n closeButtonAriaLabel ?? 'Fjern ' + children?.toString();\n\n return (\n <div\n className={classNames('eds-chip', 'eds-tag-chip', className)}\n {...rest}\n >\n {children}\n <button\n className=\"eds-tag-chip__close-button\"\n type=\"button\"\n onClick={onClose}\n aria-label={selectedCloseLabel}\n ref={ref}\n >\n <CloseIcon />\n </button>\n </div>\n );\n },\n);\n","import React from 'react';\nimport cx from 'classnames';\nimport './BaseChip.scss';\nimport './FilterChip.scss';\n\nexport type FilterChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Label til FilterChip */\n children?: React.ReactNode;\n /** Verdien til FilterChip */\n value: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\nexport const FilterChip = React.forwardRef<HTMLInputElement, FilterChipProps>(\n (\n { className, children, value, disabled = false, name, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const classList = cx(className, 'eds-chip', 'eds-filter-chip');\n\n return (\n <label className={classList} style={style}>\n <input\n className=\"eds-filter-chip__input\"\n type=\"checkbox\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n {...rest}\n />\n <span className=\"eds-filter-chip__icon\">\n <CheckboxIcon />\n </span>\n {children}\n </label>\n );\n },\n);\n\nconst CheckboxIcon: React.FC = () => {\n return (\n <svg\n className=\"eds-filter-chip-icon\"\n width=\"11px\"\n height=\"9px\"\n viewBox=\"6 11 37 33\"\n >\n <path\n className=\"eds-filter-chip-icon__path\"\n d=\"M14.1 27.2l7.1 7.2 14.6-14.8\"\n fill=\"none\"\n />\n </svg>\n );\n};\n","import React from 'react';\nimport { ChoiceChipGroupContextProvider } from './ChoiceChipGroupContext';\nimport { Fieldset } from '@entur/form';\nexport type ChoiceChipGroupProps = {\n /** Navnet til ChoiceChipsGroup */\n name: string;\n /** Verdien til den valgte ChoiceChipen */\n value: string | null;\n /** ChoiceChip-komponentene sendes inn som children */\n children: React.ReactNode;\n /** En callback som blir kalles hver gang en ChoiceChip klikkes på */\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Labelen til ChoiceChip-gruppen. */\n label?: React.ReactNode;\n [key: string]: any;\n};\n\nexport const ChoiceChipGroup: React.FC<ChoiceChipGroupProps> = ({\n name,\n value,\n children,\n onChange,\n label,\n ...rest\n}) => {\n const contextValue = React.useMemo(\n () => ({ name, value, onChange }),\n [name, value, onChange],\n );\n return (\n <ChoiceChipGroupContextProvider value={contextValue}>\n <Fieldset className=\"eds-choice-chips-group\" label={label} {...rest}>\n {children}\n </Fieldset>\n </ChoiceChipGroupContextProvider>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('chip', 'form');\n\nexport * from './ChoiceChip';\nexport * from './ActionChip';\nexport * from './TagChip';\nexport * from './FilterChip';\nexport * from './ChoiceChipGroup';\n"],"names":["ChoiceChipGroupContext","React","createContext","ChoiceChipGroupContextProvider","Provider","useChoiceChipGroupContext","context","useContext","Error","ChoiceChip","forwardRef","ref","className","children","value","disabled","style","rest","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","classList","cx","name","selectedValue","onChange","type","checked","ActionChip","loading","ariaLabelValue","ariaLabelWhenLoading","undefined","filter","child","join","actionChip","classNames","LoadingDots","TagChip","onClose","closeButtonAriaLabel","selectedCloseLabel","toString","onClick","CloseIcon","FilterChip","CheckboxIcon","width","height","viewBox","d","fill","ChoiceChipGroup","label","contextValue","useMemo","Fieldset","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAMA,sBAAsB,gBAC1BC,yBAAK,CAACC,aAAN,CAAwD,IAAxD,CADF;AAGO,IAAMC,8BAA8B,GAAGH,sBAAsB,CAACI,QAA9D;AAEA,IAAMC,yBAAyB,GACpC,SADWA,yBACX;AACE,MAAMC,OAAO,GAAGL,yBAAK,CAACM,UAAN,CAAiBP,sBAAjB,CAAhB;;AACA,MAAI,CAACM,OAAL,EAAc;AACZ,UAAM,IAAIE,KAAJ,CACJ,kEADI,CAAN;AAGD;;AACD,SAAOF,OAAP;AACD,CATI;;;ICYMG,UAAU,gBAAGR,yBAAK,CAACS,UAAN,CACxB,gBAEEC,GAFF;MACIC,iBAAAA;MAAWC,gBAAAA;MAAUC,aAAAA;2BAAOC;MAAAA,sCAAW;MAAOC,aAAAA;MAAUC;;AAG1D,MAAMC,aAAa,GAAGjB,yBAAK,CAACkB,QAAN,CAAeC,OAAf,CAAuBP,QAAvB,CAAtB;AACA,MAAMQ,cAAc,GAClBH,aAAa,CAACI,MAAd,GAAuB,CAAvB,IAA4B,OAAOJ,aAAa,CAAC,CAAD,CAApB,KAA4B,QAD1D;AAEA,MAAMK,eAAe,GACnBL,aAAa,CA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A,MAAA;AACEW,IAAAA,SAAS,EAAC;AACVuC,IAAAA,KAAK,EAAC;AACNC,IAAAA,MAAM,EAAC;AACPC,IAAAA,OAAO,EAAC;GAJV,EAMEpD,uCAAA,OAAA;AACEW,IAAAA,SAAS,EAAC;AACV0C,IAAAA,CAAC,EAAC;AACFC,IAAAA,IAAI,EAAC;GAHP,CANF,CADF;AAcD,CAfD;;;ICxBaC,eAAe,GAAmC,SAAlDA,eAAkD;MAC7D9B,YAAAA;MACAZ,aAAAA;MACAD,gBAAAA;MACAe,gBAAAA;MACA6B,aAAAA;MACGxC;;AAEH,MAAMyC,YAAY,GAAGzD,yBAAK,CAAC0D,OAAN,CACnB;AAAA,WAAO;AAAEjC,MAAAA,IAAI,EAAJA,IAAF;AAAQZ,MAAAA,KAAK,EAALA,KAAR;AAAec,MAAAA,QAAQ,EAARA;AAAf,KAAP;AAAA,GADmB,EAEnB,CAACF,IAAD,EAAOZ,KAAP,EAAcc,QAAd,CAFmB,CAArB;AAIA,SACE3B,uCAAA,CAACE,8BAAD;AAAgCW,IAAAA,KAAK,EAAE4C;GAAvC,EACEzD,uCAAA,CAAC2D,aAAD;AAAUhD,IAAAA,SAAS,EAAC,wBAApB;AAA6C6C,IAAAA,KAAK,EAAEA;AAApD,KAA+DxC,IAA/D,GACGJ,QADH,CADF,CADF;AAOD;;ACjCDgD,4BAAsB,CAAC,MAAD,EAAS,MAAT,CAAtB;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"chip.cjs.production.min.js","sources":["../src/ChoiceChipGroupContext.tsx","../src/ChoiceChip.tsx","../src/ActionChip.tsx","../src/TagChip.tsx","../src/FilterChip.tsx","../src/index.tsx","../src/ChoiceChipGroup.tsx"],"sourcesContent":["import React from 'react';\n\ntype ChoiceChipGroupContextProps = {\n name: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n value: string | null;\n};\n\nconst ChoiceChipGroupContext =\n React.createContext<ChoiceChipGroupContextProps | null>(null);\n\nexport const ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;\n\nexport const useChoiceChipGroupContext: () => ChoiceChipGroupContextProps =\n () => {\n const context = React.useContext(ChoiceChipGroupContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your ChoiceChips in a ChoiceChipGroup-component',\n );\n }\n return context;\n };\n","import React from 'react';\nimport cx from 'classnames';\nimport { useChoiceChipGroupContext } from './ChoiceChipGroupContext';\nimport './BaseChip.scss';\nimport './ChoiceChip.scss';\n\nexport type ChoiceChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om Choicechip er deaktivert eller ikke\n * @default false\n */\n disabled?: boolean;\n /** Label til ChoiceChip */\n children?: React.ReactNode;\n /** Verdien til ChoiceChip */\n value: string;\n} & Omit<\n React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >,\n 'value'\n>;\n\nexport const ChoiceChip = React.forwardRef<HTMLInputElement, ChoiceChipProps>(\n (\n { className, children, value, disabled = false, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const classList = cx(className, 'eds-chip', {\n 'eds-chip--disabled': disabled,\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n });\n const {\n name,\n value: selectedValue,\n onChange,\n } = useChoiceChipGroupContext();\n return (\n <label className=\"eds-choice-chip\" style={style}>\n <input\n className=\"eds-choice-chip__input\"\n type=\"radio\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n checked={selectedValue === value}\n onChange={onChange}\n {...rest}\n />\n <div className={classList}>{children}</div>\n </label>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseChip.scss';\nimport './ActionChip.scss';\n\nexport type ActionChipProps = {\n /** Teksten som vises i ActionChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Om chip-en er opptatt, f.eks med å oppdatere informasjon\n * @default false\n */\n loading?: boolean;\n} & React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nexport const ActionChip = React.forwardRef<HTMLButtonElement, ActionChipProps>(\n (\n { children, className, loading = false, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelValue = () => {\n if (rest['aria-label']) return rest['aria-label'];\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const actionChip = (\n <button\n className={classNames(\n 'eds-chip',\n 'eds-action-chip',\n {\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n 'eds-action-chip--disabled': rest.disabled,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n aria-label={ariaLabelValue()}\n type=\"button\"\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-action-chip__loading-dots\" />\n ) : (\n children\n )}\n </button>\n );\n\n if (rest.disabled) {\n return (\n <div className=\"eds-action-chip--disabled__wrapper\">{actionChip}</div>\n );\n }\n return <>{actionChip}</>;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { CloseIcon } from '@entur/icons';\nimport './BaseChip.scss';\nimport './TagChip.scss';\n\nexport type TagChipProps = {\n /** Teksten som vises i TagChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback for når man klikker på krysset */\n onClose: () => void;\n /** Skjermlesertekst for X-knappen */\n closeButtonAriaLabel?: string;\n};\n\nexport const TagChip = React.forwardRef<HTMLButtonElement, TagChipProps>(\n (\n { children, className, onClose, closeButtonAriaLabel, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const selectedCloseLabel =\n closeButtonAriaLabel ?? 'Fjern ' + children?.toString();\n\n return (\n <div\n className={classNames('eds-chip', 'eds-tag-chip', className)}\n {...rest}\n >\n {children}\n <button\n className=\"eds-tag-chip__close-button\"\n type=\"button\"\n onClick={onClose}\n aria-label={selectedCloseLabel}\n ref={ref}\n >\n <CloseIcon />\n </button>\n </div>\n );\n },\n);\n","import React from 'react';\nimport cx from 'classnames';\nimport './BaseChip.scss';\nimport './FilterChip.scss';\n\nexport type FilterChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Label til FilterChip */\n children?: React.ReactNode;\n /** Verdien til FilterChip */\n value: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\nexport const FilterChip = React.forwardRef<HTMLInputElement, FilterChipProps>(\n (\n { className, children, value, disabled = false, name, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const classList = cx(className, 'eds-chip', 'eds-filter-chip');\n\n return (\n <label className={classList} style={style}>\n <input\n className=\"eds-filter-chip__input\"\n type=\"checkbox\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n {...rest}\n />\n <span className=\"eds-filter-chip__icon\">\n <CheckboxIcon />\n </span>\n {children}\n </label>\n );\n },\n);\n\nconst CheckboxIcon: React.FC = () => {\n return (\n <svg\n className=\"eds-filter-chip-icon\"\n width=\"11px\"\n height=\"9px\"\n viewBox=\"6 11 37 33\"\n >\n <path\n className=\"eds-filter-chip-icon__path\"\n d=\"M14.1 27.2l7.1 7.2 14.6-14.8\"\n fill=\"none\"\n />\n </svg>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('chip', 'form');\n\nexport * from './ChoiceChip';\nexport * from './ActionChip';\nexport * from './TagChip';\nexport * from './FilterChip';\nexport * from './ChoiceChipGroup';\n","import React from 'react';\nimport { ChoiceChipGroupContextProvider } from './ChoiceChipGroupContext';\nimport { Fieldset } from '@entur/form';\nexport type ChoiceChipGroupProps = {\n /** Navnet til ChoiceChipsGroup */\n name: string;\n /** Verdien til den valgte ChoiceChipen */\n value: string | null;\n /** ChoiceChip-komponentene sendes inn som children */\n children: React.ReactNode;\n /** En callback som blir kalles hver gang en ChoiceChip klikkes på */\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Labelen til ChoiceChip-gruppen. */\n label?: React.ReactNode;\n [key: string]: any;\n};\n\nexport const ChoiceChipGroup: React.FC<ChoiceChipGroupProps> = ({\n name,\n value,\n children,\n onChange,\n label,\n ...rest\n}) => {\n const contextValue = React.useMemo(\n () => ({ name, value, onChange }),\n [name, value, onChange],\n );\n return (\n <ChoiceChipGroupContextProvider value={contextValue}>\n <Fieldset className=\"eds-choice-chips-group\" label={label} {...rest}>\n {children}\n </Fieldset>\n </ChoiceChipGroupContextProvider>\n );\n};\n"],"names":["ChoiceChipGroupContext","React","createContext","ChoiceChipGroupContextProvider","Provider","ChoiceChip","forwardRef","ref","className","children","value","_ref$disabled","disabled","style","rest","childrenArray","Children","toArray","classList","cx","length","context","useContext","Error","useChoiceChipGroupContext","type","name","checked","onChange","ActionChip","_ref$loading","loading","hasLeadingIcon","hasTrailingIcon","ariaLabelWhenLoading","filter","child","join","actionChip","classNames","LoadingDots","TagChip","onClose","closeButtonAriaLabel","selectedCloseLabel","toString","onClick","CloseIcon","FilterChip","CheckboxIcon","width","height","viewBox","d","fill","warnAboutMissingStyles","label","contextValue","useMemo","Fieldset"],"mappings":"yoBAQA,IAAMA,EACJC,UAAMC,cAAkD,MAE7CC,EAAiCH,EAAuBI,+DCcxDC,EAAaJ,UAAMK,YAC9B,WAEEC,OADEC,IAAAA,UAAWC,IAAAA,SAAUC,IAAAA,MAAKC,IAAEC,SAAAA,gBAAkBC,IAAAA,MAAU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AAUD,IAAAA,UAAWkC,IAAAA,QAASC,IAAAA,qBAAyB7B,SAGnD8B,QACJD,EAAAA,EAAwB,gBAAWlC,SAAAA,EAAUoC,YAE/C,OACE5C,iCACEO,UAAW+B,UAAW,WAAY,eAAgB/B,IAC9CM,GAEHL,EACDR,kCACEO,UAAU,6BACViB,KAAK,SACLqB,QAASJ,eACGE,EACZrC,IAAKA,GAELN,wBAAC8C,oFCxBEC,EAAa/C,UAAMK,YAC9B,WAEEC,OADEC,IAAAA,UAAWC,IAAAA,SAAUC,IAAAA,MAAKC,IAAEC,SAAAA,gBAAkBc,IAAAA,KAAMb,IAAAA,MAAUC,SAG1DI,EAAYC,UAAGX,EAAW,WAAY,mBAE5C,OACEP,iCAAOO,UAAWU,EAAWL,MAAOA,GAClCZ,mCACEO,UAAU,yBACViB,KAAK,WACLC,KAAMA,EACNnB,IAAKA,EACLG,MAAOA,EACPE,SAAUA,GACNE,IAENb,gCAAMO,UAAU,yBACdP,wBAACgD,SAEFxC,MAMHwC,EAAyB,WAC7B,OACEhD,+BACEO,UAAU,uBACV0C,MAAM,OACNC,OAAO,MACPC,QAAQ,cAERnD,gCACEO,UAAU,6BACV6C,EAAE,+BACFC,KAAK,4DCjDbC,yBAAuB,OAAQ,0ECcgC,gBAC7D7B,IAAAA,KACAhB,IAAAA,MACAD,IAAAA,SACAmB,IAAAA,SACA4B,IAAAA,MACG1C,SAEG2C,EAAexD,UAAMyD,SACzB,WAAA,MAAO,CAAEhC,KAAAA,EAAMhB,MAAAA,EAAOkB,SAAAA,KACtB,CAACF,EAAMhB,EAAOkB,IAEhB,OACE3B,wBAACE,GAA+BO,MAAO+C,GACrCxD,wBAAC0D,cAASnD,UAAU,yBAAyBgD,MAAOA,GAAW1C,GAC5DL"}
1
+ {"version":3,"file":"chip.cjs.production.min.js","sources":["../src/ChoiceChipGroupContext.tsx","../src/ChoiceChip.tsx","../src/ActionChip.tsx","../src/TagChip.tsx","../src/FilterChip.tsx","../src/index.tsx","../src/ChoiceChipGroup.tsx"],"sourcesContent":["import React from 'react';\n\ntype ChoiceChipGroupContextProps = {\n name: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n value: string | null;\n};\n\nconst ChoiceChipGroupContext =\n React.createContext<ChoiceChipGroupContextProps | null>(null);\n\nexport const ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;\n\nexport const useChoiceChipGroupContext: () => ChoiceChipGroupContextProps =\n () => {\n const context = React.useContext(ChoiceChipGroupContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your ChoiceChips in a ChoiceChipGroup-component',\n );\n }\n return context;\n };\n","import React from 'react';\nimport cx from 'classnames';\nimport { useChoiceChipGroupContext } from './ChoiceChipGroupContext';\nimport './BaseChip.scss';\nimport './ChoiceChip.scss';\n\nexport type ChoiceChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om Choicechip er deaktivert eller ikke\n * @default false\n */\n disabled?: boolean;\n /** Label til ChoiceChip */\n children?: React.ReactNode;\n /** Verdien til ChoiceChip */\n value: string;\n} & Omit<\n React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >,\n 'value'\n>;\n\nexport const ChoiceChip = React.forwardRef<HTMLInputElement, ChoiceChipProps>(\n (\n { className, children, value, disabled = false, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const classList = cx(className, 'eds-chip', {\n 'eds-chip--disabled': disabled,\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n });\n const {\n name,\n value: selectedValue,\n onChange,\n } = useChoiceChipGroupContext();\n return (\n <label className=\"eds-choice-chip\" style={style}>\n <input\n className=\"eds-choice-chip__input\"\n type=\"radio\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n checked={selectedValue === value}\n onChange={onChange}\n {...rest}\n />\n <div className={classList}>{children}</div>\n </label>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseChip.scss';\nimport './ActionChip.scss';\n\nexport type ActionChipProps = {\n /** Teksten som vises i ActionChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Om chip-en er opptatt, f.eks med å oppdatere informasjon\n * @default false\n */\n loading?: boolean;\n} & React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nexport const ActionChip = React.forwardRef<HTMLButtonElement, ActionChipProps>(\n (\n { children, className, loading = false, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelValue = () => {\n if (rest['aria-label']) return rest['aria-label'];\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const actionChip = (\n <button\n className={classNames(\n 'eds-chip',\n 'eds-action-chip',\n {\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n 'eds-action-chip--disabled': rest.disabled,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n aria-label={ariaLabelValue()}\n type=\"button\"\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-action-chip__loading-dots\" />\n ) : (\n children\n )}\n </button>\n );\n\n if (rest.disabled) {\n return (\n <div className=\"eds-action-chip--disabled__wrapper\">{actionChip}</div>\n );\n }\n return <>{actionChip}</>;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { CloseIcon } from '@entur/icons';\nimport './BaseChip.scss';\nimport './TagChip.scss';\n\nexport type TagChipProps = {\n /** Teksten som vises i TagChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback for når man klikker på krysset */\n onClose: () => void;\n /** Skjermlesertekst for X-knappen */\n closeButtonAriaLabel?: string;\n};\n\nexport const TagChip = React.forwardRef<HTMLButtonElement, TagChipProps>(\n (\n { children, className, onClose, closeButtonAriaLabel, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const selectedCloseLabel =\n closeButtonAriaLabel ?? 'Fjern ' + children?.toString();\n\n return (\n <div\n className={classNames('eds-chip', 'eds-tag-chip', className)}\n {...rest}\n >\n {children}\n <button\n className=\"eds-tag-chip__close-button\"\n type=\"button\"\n onClick={onClose}\n aria-label={selectedCloseLabel}\n ref={ref}\n >\n <CloseIcon />\n </button>\n </div>\n );\n },\n);\n","import React from 'react';\nimport cx from 'classnames';\nimport './BaseChip.scss';\nimport './FilterChip.scss';\n\nexport type FilterChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Label til FilterChip */\n children?: React.ReactNode;\n /** Verdien til FilterChip */\n value: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\nexport const FilterChip = React.forwardRef<HTMLInputElement, FilterChipProps>(\n (\n { className, children, value, disabled = false, name, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const classList = cx(className, 'eds-chip', 'eds-filter-chip');\n\n return (\n <label className={classList} style={style}>\n <input\n className=\"eds-filter-chip__input\"\n type=\"checkbox\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n {...rest}\n />\n <span className=\"eds-filter-chip__icon\">\n <CheckboxIcon />\n </span>\n {children}\n </label>\n );\n },\n);\n\nconst CheckboxIcon: React.FC = () => {\n return (\n <svg\n className=\"eds-filter-chip-icon\"\n width=\"11px\"\n height=\"9px\"\n viewBox=\"6 11 37 33\"\n >\n <path\n className=\"eds-filter-chip-icon__path\"\n d=\"M14.1 27.2l7.1 7.2 14.6-14.8\"\n fill=\"none\"\n />\n </svg>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('chip', 'form');\n\nexport * from './ChoiceChip';\nexport * from './ActionChip';\nexport * from './TagChip';\nexport * from './FilterChip';\nexport * from './ChoiceChipGroup';\n","import React from 'react';\nimport { ChoiceChipGroupContextProvider } from './ChoiceChipGroupContext';\nimport { Fieldset } from '@entur/form';\nexport type ChoiceChipGroupProps = {\n /** Navnet til ChoiceChipsGroup */\n name: string;\n /** Verdien til den valgte ChoiceChipen */\n value: string | null;\n /** ChoiceChip-komponentene sendes inn som children */\n children: React.ReactNode;\n /** En callback som blir kalles hver gang en ChoiceChip klikkes på */\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Labelen til ChoiceChip-gruppen. */\n label?: React.ReactNode;\n [key: string]: any;\n};\n\nexport const ChoiceChipGroup: React.FC<ChoiceChipGroupProps> = ({\n name,\n value,\n children,\n onChange,\n label,\n ...rest\n}) => {\n const contextValue = React.useMemo(\n () => ({ name, value, onChange }),\n [name, value, onChange],\n );\n return (\n <ChoiceChipGroupContextProvider value={contextValue}>\n <Fieldset className=\"eds-choice-chips-group\" label={label} {...rest}>\n {children}\n </Fieldset>\n </ChoiceChipGroupContextProvider>\n );\n};\n"],"names":["ChoiceChipGroupContext","React","createContext","ChoiceChipGroupContextProvider","Provider","ChoiceChip","forwardRef","ref","className","children","value","disabled","style","rest","childrenArray","Children","toArray","classList","cx","length","context","useContext","Error","useChoiceChipGroupContext","type","name","checked","onChange","ActionChip","loading","hasLeadingIcon","hasTrailingIcon","ariaLabelWhenLoading","filter","child","join","actionChip","classNames","LoadingDots","TagChip","onClose","closeButtonAriaLabel","selectedCloseLabel","toString","onClick","CloseIcon","FilterChip","CheckboxIcon","width","height","viewBox","d","fill","warnAboutMissingStyles","label","contextValue","useMemo","Fieldset"],"mappings":"yoBAQA,IAAMA,EAC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DnC,gDAAGmC,kECxDDG,EAAUtC,UAAMK,YAC3B,WAEEC,OADEE,IAAAA,SAAUD,IAAAA,UAAWgC,IAAAA,QAASC,IAAAA,qBAAyB5B,SAGnD6B,QACJD,EAAAA,EAAwB,gBAAWhC,SAAAA,EAAUkC,mBAG7C1C,iCACEO,UAAW6B,UAAW,WAAY,eAAgB7B,IAC9CK,GAEHJ,EACDR,kCACEO,UAAU,6BACVgB,KAAK,SACLoB,QAASJ,eACGE,EACZnC,IAAKA,GAELN,wBAAC4C,oFCxBEC,EAAa7C,UAAMK,YAC9B,WAEEC,OADEC,IAAAA,UAAWC,IAAAA,SAAUC,IAAAA,UAAOC,SAAAA,gBAAkBc,IAAAA,KAAMb,IAAAA,MAAUC,SAG1DI,EAAYC,UAAGV,EAAW,WAAY,0BAG1CP,iCAAOO,UAAWS,EAAWL,MAAOA,GAClCX,mCACEO,UAAU,yBACVgB,KAAK,WACLC,KAAMA,EACNlB,IAAKA,EACLG,MAAOA,EACPC,SAAUA,GACNE,IAENZ,gCAAMO,UAAU,yBACdP,wBAAC8C,SAEFtC,MAMHsC,EAAyB,kBAE3B9C,+BACEO,UAAU,uBACVwC,MAAM,OACNC,OAAO,MACPC,QAAQ,cAERjD,gCACEO,UAAU,6BACV2C,EAAE,+BACFC,KAAK,4DCjDbC,yBAAuB,OAAQ,0ECcgC,gBAC7D5B,IAAAA,KACAf,IAAAA,MACAD,IAAAA,SACAkB,IAAAA,SACA2B,IAAAA,MACGzC,SAEG0C,EAAetD,UAAMuD,SACzB,iBAAO,CAAE/B,KAAAA,EAAMf,MAAAA,EAAOiB,SAAAA,KACtB,CAACF,EAAMf,EAAOiB,WAGd1B,wBAACE,GAA+BO,MAAO6C,GACrCtD,wBAACwD,cAASjD,UAAU,yBAAyB8C,MAAOA,GAAWzC,GAC5DJ"}
package/dist/chip.esm.js CHANGED
@@ -9,26 +9,32 @@ function _extends() {
9
9
  _extends = Object.assign || function (target) {
10
10
  for (var i = 1; i < arguments.length; i++) {
11
11
  var source = arguments[i];
12
+
12
13
  for (var key in source) {
13
14
  if (Object.prototype.hasOwnProperty.call(source, key)) {
14
15
  target[key] = source[key];
15
16
  }
16
17
  }
17
18
  }
19
+
18
20
  return target;
19
21
  };
22
+
20
23
  return _extends.apply(this, arguments);
21
24
  }
25
+
22
26
  function _objectWithoutPropertiesLoose(source, excluded) {
23
27
  if (source == null) return {};
24
28
  var target = {};
25
29
  var sourceKeys = Object.keys(source);
26
30
  var key, i;
31
+
27
32
  for (i = 0; i < sourceKeys.length; i++) {
28
33
  key = sourceKeys[i];
29
34
  if (excluded.indexOf(key) >= 0) continue;
30
35
  target[key] = source[key];
31
36
  }
37
+
32
38
  return target;
33
39
  }
34
40
 
@@ -36,21 +42,24 @@ var ChoiceChipGroupContext = /*#__PURE__*/React.createContext(null);
36
42
  var ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;
37
43
  var useChoiceChipGroupContext = function useChoiceChipGroupContext() {
38
44
  var context = React.useContext(ChoiceChipGroupContext);
45
+
39
46
  if (!context) {
40
47
  throw new Error('You need to wrap your ChoiceChips in a ChoiceChipGroup-component');
41
48
  }
49
+
42
50
  return context;
43
51
  };
44
52
 
45
53
  var _excluded$4 = ["className", "children", "value", "disabled", "style"];
46
54
  var ChoiceChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
47
55
  var className = _ref.className,
48
- children = _ref.children,
49
- value = _ref.value,
50
- _ref$disabled = _ref.disabled,
51
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
52
- style = _ref.style,
53
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
56
+ children = _ref.children,
57
+ value = _ref.value,
58
+ _ref$disabled = _ref.disabled,
59
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
60
+ style = _ref.style,
61
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
62
+
54
63
  var childrenArray = React.Children.toArray(children);
55
64
  var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
56
65
  var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string';
@@ -59,10 +68,12 @@ var ChoiceChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
59
68
  'eds-chip--leading-icon': hasLeadingIcon,
60
69
  'eds-chip--trailing-icon': hasTrailingIcon
61
70
  });
71
+
62
72
  var _useChoiceChipGroupCo = useChoiceChipGroupContext(),
63
- name = _useChoiceChipGroupCo.name,
64
- selectedValue = _useChoiceChipGroupCo.value,
65
- onChange = _useChoiceChipGroupCo.onChange;
73
+ name = _useChoiceChipGroupCo.name,
74
+ selectedValue = _useChoiceChipGroupCo.value,
75
+ onChange = _useChoiceChipGroupCo.onChange;
76
+
66
77
  return React.createElement("label", {
67
78
  className: "eds-choice-chip",
68
79
  style: style
@@ -83,18 +94,21 @@ var ChoiceChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
83
94
  var _excluded$3 = ["children", "className", "loading"];
84
95
  var ActionChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
85
96
  var children = _ref.children,
86
- className = _ref.className,
87
- _ref$loading = _ref.loading,
88
- loading = _ref$loading === void 0 ? false : _ref$loading,
89
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
97
+ className = _ref.className,
98
+ _ref$loading = _ref.loading,
99
+ loading = _ref$loading === void 0 ? false : _ref$loading,
100
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
101
+
90
102
  var childrenArray = React.Children.toArray(children);
91
103
  var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
92
104
  var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string';
105
+
93
106
  var ariaLabelValue = function ariaLabelValue() {
94
107
  if (rest['aria-label']) return rest['aria-label'];
95
108
  if (loading) return ariaLabelWhenLoading;
96
109
  return undefined;
97
110
  };
111
+
98
112
  var ariaLabelWhenLoading = childrenArray.filter(function (child) {
99
113
  return typeof child === 'string';
100
114
  }).join(' ');
@@ -111,21 +125,24 @@ var ActionChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
111
125
  }, rest), loading ? React.createElement(LoadingDots, {
112
126
  className: "eds-action-chip__loading-dots"
113
127
  }) : children);
128
+
114
129
  if (rest.disabled) {
115
130
  return React.createElement("div", {
116
131
  className: "eds-action-chip--disabled__wrapper"
117
132
  }, actionChip);
118
133
  }
134
+
119
135
  return React.createElement(React.Fragment, null, actionChip);
120
136
  });
121
137
 
122
138
  var _excluded$2 = ["children", "className", "onClose", "closeButtonAriaLabel"];
123
139
  var TagChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
124
140
  var children = _ref.children,
125
- className = _ref.className,
126
- onClose = _ref.onClose,
127
- closeButtonAriaLabel = _ref.closeButtonAriaLabel,
128
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
141
+ className = _ref.className,
142
+ onClose = _ref.onClose,
143
+ closeButtonAriaLabel = _ref.closeButtonAriaLabel,
144
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
145
+
129
146
  var selectedCloseLabel = closeButtonAriaLabel != null ? closeButtonAriaLabel : 'Fjern ' + (children == null ? void 0 : children.toString());
130
147
  return React.createElement("div", _extends({
131
148
  className: classNames('eds-chip', 'eds-tag-chip', className)
@@ -141,13 +158,14 @@ var TagChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
141
158
  var _excluded$1 = ["className", "children", "value", "disabled", "name", "style"];
142
159
  var FilterChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
143
160
  var className = _ref.className,
144
- children = _ref.children,
145
- value = _ref.value,
146
- _ref$disabled = _ref.disabled,
147
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
148
- name = _ref.name,
149
- style = _ref.style,
150
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
161
+ children = _ref.children,
162
+ value = _ref.value,
163
+ _ref$disabled = _ref.disabled,
164
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
165
+ name = _ref.name,
166
+ style = _ref.style,
167
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
168
+
151
169
  var classList = classNames(className, 'eds-chip', 'eds-filter-chip');
152
170
  return React.createElement("label", {
153
171
  className: classList,
@@ -163,6 +181,7 @@ var FilterChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
163
181
  className: "eds-filter-chip__icon"
164
182
  }, React.createElement(CheckboxIcon, null)), children);
165
183
  });
184
+
166
185
  var CheckboxIcon = function CheckboxIcon() {
167
186
  return React.createElement("svg", {
168
187
  className: "eds-filter-chip-icon",
@@ -179,11 +198,12 @@ var CheckboxIcon = function CheckboxIcon() {
179
198
  var _excluded = ["name", "value", "children", "onChange", "label"];
180
199
  var ChoiceChipGroup = function ChoiceChipGroup(_ref) {
181
200
  var name = _ref.name,
182
- value = _ref.value,
183
- children = _ref.children,
184
- onChange = _ref.onChange,
185
- label = _ref.label,
186
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
201
+ value = _ref.value,
202
+ children = _ref.children,
203
+ onChange = _ref.onChange,
204
+ label = _ref.label,
205
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
206
+
187
207
  var contextValue = React.useMemo(function () {
188
208
  return {
189
209
  name: name,
@@ -1 +1 @@
1
- {"version":3,"file":"chip.esm.js","sources":["../src/ChoiceChipGroupContext.tsx","../src/ChoiceChip.tsx","../src/ActionChip.tsx","../src/TagChip.tsx","../src/FilterChip.tsx","../src/ChoiceChipGroup.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\ntype ChoiceChipGroupContextProps = {\n name: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n value: string | null;\n};\n\nconst ChoiceChipGroupContext =\n React.createContext<ChoiceChipGroupContextProps | null>(null);\n\nexport const ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;\n\nexport const useChoiceChipGroupContext: () => ChoiceChipGroupContextProps =\n () => {\n const context = React.useContext(ChoiceChipGroupContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your ChoiceChips in a ChoiceChipGroup-component',\n );\n }\n return context;\n };\n","import React from 'react';\nimport cx from 'classnames';\nimport { useChoiceChipGroupContext } from './ChoiceChipGroupContext';\nimport './BaseChip.scss';\nimport './ChoiceChip.scss';\n\nexport type ChoiceChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om Choicechip er deaktivert eller ikke\n * @default false\n */\n disabled?: boolean;\n /** Label til ChoiceChip */\n children?: React.ReactNode;\n /** Verdien til ChoiceChip */\n value: string;\n} & Omit<\n React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >,\n 'value'\n>;\n\nexport const ChoiceChip = React.forwardRef<HTMLInputElement, ChoiceChipProps>(\n (\n { className, children, value, disabled = false, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const classList = cx(className, 'eds-chip', {\n 'eds-chip--disabled': disabled,\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n });\n const {\n name,\n value: selectedValue,\n onChange,\n } = useChoiceChipGroupContext();\n return (\n <label className=\"eds-choice-chip\" style={style}>\n <input\n className=\"eds-choice-chip__input\"\n type=\"radio\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n checked={selectedValue === value}\n onChange={onChange}\n {...rest}\n />\n <div className={classList}>{children}</div>\n </label>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseChip.scss';\nimport './ActionChip.scss';\n\nexport type ActionChipProps = {\n /** Teksten som vises i ActionChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Om chip-en er opptatt, f.eks med å oppdatere informasjon\n * @default false\n */\n loading?: boolean;\n} & React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nexport const ActionChip = React.forwardRef<HTMLButtonElement, ActionChipProps>(\n (\n { children, className, loading = false, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelValue = () => {\n if (rest['aria-label']) return rest['aria-label'];\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const actionChip = (\n <button\n className={classNames(\n 'eds-chip',\n 'eds-action-chip',\n {\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n 'eds-action-chip--disabled': rest.disabled,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n aria-label={ariaLabelValue()}\n type=\"button\"\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-action-chip__loading-dots\" />\n ) : (\n children\n )}\n </button>\n );\n\n if (rest.disabled) {\n return (\n <div className=\"eds-action-chip--disabled__wrapper\">{actionChip}</div>\n );\n }\n return <>{actionChip}</>;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { CloseIcon } from '@entur/icons';\nimport './BaseChip.scss';\nimport './TagChip.scss';\n\nexport type TagChipProps = {\n /** Teksten som vises i TagChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback for når man klikker på krysset */\n onClose: () => void;\n /** Skjermlesertekst for X-knappen */\n closeButtonAriaLabel?: string;\n};\n\nexport const TagChip = React.forwardRef<HTMLButtonElement, TagChipProps>(\n (\n { children, className, onClose, closeButtonAriaLabel, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const selectedCloseLabel =\n closeButtonAriaLabel ?? 'Fjern ' + children?.toString();\n\n return (\n <div\n className={classNames('eds-chip', 'eds-tag-chip', className)}\n {...rest}\n >\n {children}\n <button\n className=\"eds-tag-chip__close-button\"\n type=\"button\"\n onClick={onClose}\n aria-label={selectedCloseLabel}\n ref={ref}\n >\n <CloseIcon />\n </button>\n </div>\n );\n },\n);\n","import React from 'react';\nimport cx from 'classnames';\nimport './BaseChip.scss';\nimport './FilterChip.scss';\n\nexport type FilterChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Label til FilterChip */\n children?: React.ReactNode;\n /** Verdien til FilterChip */\n value: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\nexport const FilterChip = React.forwardRef<HTMLInputElement, FilterChipProps>(\n (\n { className, children, value, disabled = false, name, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const classList = cx(className, 'eds-chip', 'eds-filter-chip');\n\n return (\n <label className={classList} style={style}>\n <input\n className=\"eds-filter-chip__input\"\n type=\"checkbox\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n {...rest}\n />\n <span className=\"eds-filter-chip__icon\">\n <CheckboxIcon />\n </span>\n {children}\n </label>\n );\n },\n);\n\nconst CheckboxIcon: React.FC = () => {\n return (\n <svg\n className=\"eds-filter-chip-icon\"\n width=\"11px\"\n height=\"9px\"\n viewBox=\"6 11 37 33\"\n >\n <path\n className=\"eds-filter-chip-icon__path\"\n d=\"M14.1 27.2l7.1 7.2 14.6-14.8\"\n fill=\"none\"\n />\n </svg>\n );\n};\n","import React from 'react';\nimport { ChoiceChipGroupContextProvider } from './ChoiceChipGroupContext';\nimport { Fieldset } from '@entur/form';\nexport type ChoiceChipGroupProps = {\n /** Navnet til ChoiceChipsGroup */\n name: string;\n /** Verdien til den valgte ChoiceChipen */\n value: string | null;\n /** ChoiceChip-komponentene sendes inn som children */\n children: React.ReactNode;\n /** En callback som blir kalles hver gang en ChoiceChip klikkes på */\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Labelen til ChoiceChip-gruppen. */\n label?: React.ReactNode;\n [key: string]: any;\n};\n\nexport const ChoiceChipGroup: React.FC<ChoiceChipGroupProps> = ({\n name,\n value,\n children,\n onChange,\n label,\n ...rest\n}) => {\n const contextValue = React.useMemo(\n () => ({ name, value, onChange }),\n [name, value, onChange],\n );\n return (\n <ChoiceChipGroupContextProvider value={contextValue}>\n <Fieldset className=\"eds-choice-chips-group\" label={label} {...rest}>\n {children}\n </Fieldset>\n </ChoiceChipGroupContextProvider>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('chip', 'form');\n\nexport * from './ChoiceChip';\nexport * from './ActionChip';\nexport * from './TagChip';\nexport * from './FilterChip';\nexport * from './ChoiceChipGroup';\n"],"names":["ChoiceChipGroupContext","React","createContext","ChoiceChipGroupContextProvider","Provider","useChoiceChipGroupContext","context","useContext","Error","ChoiceChip","forwardRef","ref","className","children","value","disabled","style","rest","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","classList","cx","name","selectedValue","onChange","type","checked","ActionChip","loading","ariaLabelValue","ariaLabelWhenLoading","undefined","filter","child","join","actionChip","classNames","LoadingDots","TagChip","onClose","closeButtonAriaLabel","selectedCloseLabel","toString","onClick","CloseIcon","FilterChip","CheckboxIcon","width","height","viewBox","d","fill","ChoiceChipGroup","label","contextValue","useMemo","Fieldset","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAMA,sBAAsB,gBAC1BC,KAAK,CAACC,aAAa,CAAqC,IAAI,CAAC;AAExD,IAAMC,8BAA8B,GAAGH,sBAAsB,CAACI,QAAQ;AAEtE,IAAMC,yBAAyB,GACpC,SADWA,yBAAyB;EAElC,IAAMC,OAAO,GAAGL,KAAK,CAACM,UAAU,CAACP,sBAAsB,CAAC;EACxD,IAAI,CAACM,OAAO,E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AAI;IACVf,GAAG,EAAEA,GAAG;IACRG,KAAK,EAAEA,KAAK;IACZC,QAAQ,EAAEA;KACNE,IAAI,EACR,EACFhB;IAAMW,SAAS,EAAC;KACdX,oBAACiD,YAAY,OAAG,CACX,EACNrC,QAAQ,CACH;AAEZ,CAAC;AAGH,IAAMqC,YAAY,GAAa,SAAzBA,YAAY;EAChB,OACEjD;IACEW,SAAS,EAAC,sBAAsB;IAChCuC,KAAK,EAAC,MAAM;IACZC,MAAM,EAAC,KAAK;IACZC,OAAO,EAAC;KAERpD;IACEW,SAAS,EAAC,4BAA4B;IACtC0C,CAAC,EAAC,8BAA8B;IAChCC,IAAI,EAAC;IACL,CACE;AAEV,CAAC;;;ICvCYC,eAAe,GAAmC,SAAlDA,eAAe;MAC1B9B,IAAI,QAAJA,IAAI;IACJZ,KAAK,QAALA,KAAK;IACLD,QAAQ,QAARA,QAAQ;IACRe,QAAQ,QAARA,QAAQ;IACR6B,KAAK,QAALA,KAAK;IACFxC,IAAI;EAEP,IAAMyC,YAAY,GAAGzD,KAAK,CAAC0D,OAAO,CAChC;IAAA,OAAO;MAAEjC,IAAI,EAAJA,IAAI;MAAEZ,KAAK,EAALA,KAAK;MAAEc,QAAQ,EAARA;KAAU;GAAC,EACjC,CAACF,IAAI,EAAEZ,KAAK,EAAEc,QAAQ,CAAC,CACxB;EACD,OACE3B,oBAACE,8BAA8B;IAACW,KAAK,EAAE4C;KACrCzD,oBAAC2D,QAAQ;IAAChD,SAAS,EAAC,wBAAwB;IAAC6C,KAAK,EAAEA;KAAWxC,IAAI,GAChEJ,QAAQ,CACA,CACoB;AAErC;;ACjCAgD,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC;;;;"}
1
+ {"version":3,"file":"chip.esm.js","sources":["../src/ChoiceChipGroupContext.tsx","../src/ChoiceChip.tsx","../src/ActionChip.tsx","../src/TagChip.tsx","../src/FilterChip.tsx","../src/ChoiceChipGroup.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\ntype ChoiceChipGroupContextProps = {\n name: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n value: string | null;\n};\n\nconst ChoiceChipGroupContext =\n React.createContext<ChoiceChipGroupContextProps | null>(null);\n\nexport const ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;\n\nexport const useChoiceChipGroupContext: () => ChoiceChipGroupContextProps =\n () => {\n const context = React.useContext(ChoiceChipGroupContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your ChoiceChips in a ChoiceChipGroup-component',\n );\n }\n return context;\n };\n","import React from 'react';\nimport cx from 'classnames';\nimport { useChoiceChipGroupContext } from './ChoiceChipGroupContext';\nimport './BaseChip.scss';\nimport './ChoiceChip.scss';\n\nexport type ChoiceChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om Choicechip er deaktivert eller ikke\n * @default false\n */\n disabled?: boolean;\n /** Label til ChoiceChip */\n children?: React.ReactNode;\n /** Verdien til ChoiceChip */\n value: string;\n} & Omit<\n React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >,\n 'value'\n>;\n\nexport const ChoiceChip = React.forwardRef<HTMLInputElement, ChoiceChipProps>(\n (\n { className, children, value, disabled = false, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const classList = cx(className, 'eds-chip', {\n 'eds-chip--disabled': disabled,\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n });\n const {\n name,\n value: selectedValue,\n onChange,\n } = useChoiceChipGroupContext();\n return (\n <label className=\"eds-choice-chip\" style={style}>\n <input\n className=\"eds-choice-chip__input\"\n type=\"radio\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n checked={selectedValue === value}\n onChange={onChange}\n {...rest}\n />\n <div className={classList}>{children}</div>\n </label>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseChip.scss';\nimport './ActionChip.scss';\n\nexport type ActionChipProps = {\n /** Teksten som vises i ActionChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Om chip-en er opptatt, f.eks med å oppdatere informasjon\n * @default false\n */\n loading?: boolean;\n} & React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nexport const ActionChip = React.forwardRef<HTMLButtonElement, ActionChipProps>(\n (\n { children, className, loading = false, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelValue = () => {\n if (rest['aria-label']) return rest['aria-label'];\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const actionChip = (\n <button\n className={classNames(\n 'eds-chip',\n 'eds-action-chip',\n {\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n 'eds-action-chip--disabled': rest.disabled,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n aria-label={ariaLabelValue()}\n type=\"button\"\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-action-chip__loading-dots\" />\n ) : (\n children\n )}\n </button>\n );\n\n if (rest.disabled) {\n return (\n <div className=\"eds-action-chip--disabled__wrapper\">{actionChip}</div>\n );\n }\n return <>{actionChip}</>;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { CloseIcon } from '@entur/icons';\nimport './BaseChip.scss';\nimport './TagChip.scss';\n\nexport type TagChipProps = {\n /** Teksten som vises i TagChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback for når man klikker på krysset */\n onClose: () => void;\n /** Skjermlesertekst for X-knappen */\n closeButtonAriaLabel?: string;\n};\n\nexport const TagChip = React.forwardRef<HTMLButtonElement, TagChipProps>(\n (\n { children, className, onClose, closeButtonAriaLabel, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const selectedCloseLabel =\n closeButtonAriaLabel ?? 'Fjern ' + children?.toString();\n\n return (\n <div\n className={classNames('eds-chip', 'eds-tag-chip', className)}\n {...rest}\n >\n {children}\n <button\n className=\"eds-tag-chip__close-button\"\n type=\"button\"\n onClick={onClose}\n aria-label={selectedCloseLabel}\n ref={ref}\n >\n <CloseIcon />\n </button>\n </div>\n );\n },\n);\n","import React from 'react';\nimport cx from 'classnames';\nimport './BaseChip.scss';\nimport './FilterChip.scss';\n\nexport type FilterChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Label til FilterChip */\n children?: React.ReactNode;\n /** Verdien til FilterChip */\n value: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\nexport const FilterChip = React.forwardRef<HTMLInputElement, FilterChipProps>(\n (\n { className, children, value, disabled = false, name, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const classList = cx(className, 'eds-chip', 'eds-filter-chip');\n\n return (\n <label className={classList} style={style}>\n <input\n className=\"eds-filter-chip__input\"\n type=\"checkbox\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n {...rest}\n />\n <span className=\"eds-filter-chip__icon\">\n <CheckboxIcon />\n </span>\n {children}\n </label>\n );\n },\n);\n\nconst CheckboxIcon: React.FC = () => {\n return (\n <svg\n className=\"eds-filter-chip-icon\"\n width=\"11px\"\n height=\"9px\"\n viewBox=\"6 11 37 33\"\n >\n <path\n className=\"eds-filter-chip-icon__path\"\n d=\"M14.1 27.2l7.1 7.2 14.6-14.8\"\n fill=\"none\"\n />\n </svg>\n );\n};\n","import React from 'react';\nimport { ChoiceChipGroupContextProvider } from './ChoiceChipGroupContext';\nimport { Fieldset } from '@entur/form';\nexport type ChoiceChipGroupProps = {\n /** Navnet til ChoiceChipsGroup */\n name: string;\n /** Verdien til den valgte ChoiceChipen */\n value: string | null;\n /** ChoiceChip-komponentene sendes inn som children */\n children: React.ReactNode;\n /** En callback som blir kalles hver gang en ChoiceChip klikkes på */\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Labelen til ChoiceChip-gruppen. */\n label?: React.ReactNode;\n [key: string]: any;\n};\n\nexport const ChoiceChipGroup: React.FC<ChoiceChipGroupProps> = ({\n name,\n value,\n children,\n onChange,\n label,\n ...rest\n}) => {\n const contextValue = React.useMemo(\n () => ({ name, value, onChange }),\n [name, value, onChange],\n );\n return (\n <ChoiceChipGroupContextProvider value={contextValue}>\n <Fieldset className=\"eds-choice-chips-group\" label={label} {...rest}>\n {children}\n </Fieldset>\n </ChoiceChipGroupContextProvider>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('chip', 'form');\n\nexport * from './ChoiceChip';\nexport * from './ActionChip';\nexport * from './TagChip';\nexport * from './FilterChip';\nexport * from './ChoiceChipGroup';\n"],"names":["ChoiceChipGroupContext","React","createContext","ChoiceChipGroupContextProvider","Provider","useChoiceChipGroupContext","context","useContext","Error","ChoiceChip","forwardRef","ref","className","children","value","disabled","style","rest","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","classList","cx","name","selectedValue","onChange","type","checked","ActionChip","loading","ariaLabelValue","ariaLabelWhenLoading","undefined","filter","child","join","actionChip","classNames","LoadingDots","TagChip","onClose","closeButtonAriaLabel","selectedCloseLabel","toString","onClick","CloseIcon","FilterChip","CheckboxIcon","width","height","viewBox","d","fill","ChoiceChipGroup","label","contextValue","useMemo","Fieldset","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;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AAR;AAAec,MAAAA,QAAQ,EAARA;AAAf,KAAP;AAAA,GADmB,EAEnB,CAACF,IAAD,EAAOZ,KAAP,EAAcc,QAAd,CAFmB,CAArB;AAIA,SACE3B,mBAAA,CAACE,8BAAD;AAAgCW,IAAAA,KAAK,EAAE4C;GAAvC,EACEzD,mBAAA,CAAC2D,QAAD;AAAUhD,IAAAA,SAAS,EAAC,wBAApB;AAA6C6C,IAAAA,KAAK,EAAEA;AAApD,KAA+DxC,IAA/D,GACGJ,QADH,CADF,CADF;AAOD;;ACjCDgD,sBAAsB,CAAC,MAAD,EAAS,MAAT,CAAtB;;;;"}
package/dist/styles.css CHANGED
@@ -33,6 +33,7 @@
33
33
  }
34
34
  .eds-action-chip--disabled__wrapper {
35
35
  cursor: not-allowed;
36
+ width: -webkit-fit-content;
36
37
  width: -moz-fit-content;
37
38
  width: fit-content;
38
39
  }
@@ -69,6 +70,46 @@
69
70
  margin-left: 0.5rem;
70
71
  }/* DO NOT CHANGE!*/
71
72
  /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
73
+ .eds-tag-chip {
74
+ cursor: default;
75
+ padding-right: 0.25rem;
76
+ width: -webkit-fit-content;
77
+ width: -moz-fit-content;
78
+ width: fit-content;
79
+ }
80
+ .eds-tag-chip__close-button {
81
+ -webkit-appearance: none;
82
+ -moz-appearance: none;
83
+ appearance: none;
84
+ background: none;
85
+ border: none;
86
+ border-radius: 50%;
87
+ color: #181c56;
88
+ cursor: pointer;
89
+ display: flex;
90
+ font-size: 0.875rem;
91
+ padding: 0.25rem;
92
+ margin-left: 0.25rem;
93
+ transition: box-shadow 0.1s ease-in-out, background 0.1s ease-in-out;
94
+ }
95
+ .eds-contrast .eds-tag-chip__close-button {
96
+ color: #ffffff;
97
+ }
98
+ .eds-tag-chip__close-button:hover {
99
+ background: #babbcf;
100
+ }
101
+ .eds-contrast .eds-tag-chip__close-button:hover {
102
+ background: #54568c;
103
+ }
104
+ .eds-tag-chip__close-button:focus {
105
+ outline-offset: 0.125rem;
106
+ outline: none;
107
+ box-shadow: 0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #181c56;
108
+ }
109
+ .eds-contrast .eds-tag-chip__close-button:focus {
110
+ box-shadow: 0 0 0 0.125rem #181c56, 0 0 0 0.25rem #ffffff;
111
+ }/* DO NOT CHANGE!*/
112
+ /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
72
113
  .eds-choice-chip {
73
114
  cursor: pointer;
74
115
  display: inline-block;
@@ -140,51 +181,14 @@
140
181
  color: #babbcf;
141
182
  }/* DO NOT CHANGE!*/
142
183
  /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
143
- .eds-tag-chip {
144
- cursor: default;
145
- padding-right: 0.25rem;
146
- width: -moz-fit-content;
147
- width: fit-content;
148
- }
149
- .eds-tag-chip__close-button {
150
- -webkit-appearance: none;
151
- -moz-appearance: none;
152
- appearance: none;
153
- background: none;
154
- border: none;
155
- border-radius: 50%;
156
- color: #181c56;
157
- cursor: pointer;
158
- display: flex;
159
- font-size: 0.875rem;
160
- padding: 0.25rem;
161
- margin-left: 0.25rem;
162
- transition: box-shadow 0.1s ease-in-out, background 0.1s ease-in-out;
163
- }
164
- .eds-contrast .eds-tag-chip__close-button {
165
- color: #ffffff;
166
- }
167
- .eds-tag-chip__close-button:hover {
168
- background: #babbcf;
169
- }
170
- .eds-contrast .eds-tag-chip__close-button:hover {
171
- background: #54568c;
172
- }
173
- .eds-tag-chip__close-button:focus {
174
- outline-offset: 0.125rem;
175
- outline: none;
176
- box-shadow: 0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #181c56;
177
- }
178
- .eds-contrast .eds-tag-chip__close-button:focus {
179
- box-shadow: 0 0 0 0.125rem #181c56, 0 0 0 0.25rem #ffffff;
180
- }/* DO NOT CHANGE!*/
181
- /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
182
184
  .eds-filter-chip {
183
185
  cursor: pointer;
184
186
  -webkit-user-select: none;
185
187
  -moz-user-select: none;
188
+ -ms-user-select: none;
186
189
  user-select: none;
187
190
  padding-left: 0.25rem;
191
+ width: -webkit-fit-content;
188
192
  width: -moz-fit-content;
189
193
  width: fit-content;
190
194
  }
@@ -199,7 +203,8 @@
199
203
  }
200
204
  .eds-filter-chip__input:checked + .eds-filter-chip__icon .eds-filter-chip-icon__path {
201
205
  stroke: #181c56;
202
- animation: stroke ease-in-out 0.2s 0.1s forwards;
206
+ -webkit-animation: stroke ease-in-out 0.2s 0.1s forwards;
207
+ animation: stroke ease-in-out 0.2s 0.1s forwards;
203
208
  }
204
209
  .eds-contrast .eds-filter-chip__input:checked + .eds-filter-chip__icon .eds-filter-chip-icon__path {
205
210
  stroke: #5ac39a;
@@ -258,6 +263,12 @@
258
263
  stroke-width: 0.375rem;
259
264
  }
260
265
 
266
+ @-webkit-keyframes stroke {
267
+ 100% {
268
+ stroke-dashoffset: 0;
269
+ }
270
+ }
271
+
261
272
  @keyframes stroke {
262
273
  100% {
263
274
  stroke-dashoffset: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entur/chip",
3
- "version": "0.6.14",
3
+ "version": "0.6.15",
4
4
  "license": "EUPL-1.2",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/chip.esm.js",
@@ -17,27 +17,20 @@
17
17
  "access": "public"
18
18
  },
19
19
  "scripts": {
20
- "start": "yarn run dts watch --noClean",
21
- "build": "yarn run dts build",
22
- "test": "yarn run dts test --env=jsdom",
23
- "lint": "yarn run dts lint"
20
+ "start": "dts watch --noClean",
21
+ "build": "dts build",
22
+ "test": "dts test --env=jsdom",
23
+ "lint": "dts lint"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": ">=16.8.0",
27
27
  "react-dom": ">=16.8.0"
28
28
  },
29
29
  "dependencies": {
30
- "@entur/form": "^5.4.11",
31
- "@entur/tokens": "^3.4.2",
32
- "@entur/utils": "^0.4.7",
30
+ "@entur/form": "^5.4.12",
31
+ "@entur/tokens": "^3.4.3",
32
+ "@entur/utils": "^0.4.8",
33
33
  "classnames": "^2.3.1"
34
34
  },
35
- "devDependencies": {
36
- "dts-cli": "^1.1.6",
37
- "jest": "^27.0.0",
38
- "jest-watch-typeahead": "^2.2.0",
39
- "ts-jest": "^27.0.0",
40
- "typescript": "^4.8.0"
41
- },
42
- "gitHead": "8915b1630bd936740ba9a4a88883f3432948a80e"
35
+ "gitHead": "103844c30bdc32296f3998a360cf6066492173e9"
43
36
  }