@cloud-ru/uikit-product-utils 8.0.2 → 8.1.1-preview-b95fca4e.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +86 -75
- package/dist/cjs/components/ForThemeMode/hooks.js +2 -2
- package/dist/cjs/constants/environment.js +1 -1
- package/dist/cjs/hooks/index.d.ts +1 -0
- package/dist/cjs/hooks/index.js +1 -0
- package/dist/cjs/hooks/useConfig.js +11 -19
- package/dist/cjs/hooks/useLocalStorage.d.ts +1 -0
- package/dist/cjs/hooks/useLocalStorage.js +16 -0
- package/dist/cjs/types/theme.d.ts +0 -6
- package/dist/cjs/types/theme.js +0 -6
- package/dist/esm/components/ForThemeMode/hooks.js +2 -2
- package/dist/esm/constants/environment.js +1 -1
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/useConfig.js +3 -11
- package/dist/esm/hooks/useLocalStorage.d.ts +1 -0
- package/dist/esm/hooks/useLocalStorage.js +13 -0
- package/dist/esm/types/theme.d.ts +0 -6
- package/dist/esm/types/theme.js +0 -6
- package/package.json +8 -16
- package/src/components/ForThemeMode/hooks.ts +2 -2
- package/src/constants/environment.ts +1 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useConfig.ts +3 -11
- package/src/hooks/useLocalStorage.ts +19 -0
- package/src/types/theme.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 8.1.0 (2025-12-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **DOCDEV-2456:** moved useLocalStorage to utils pckg ([9809058](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/98090588fc37da109dd01b9f2b89f0fe776df565))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 8.0.2 (2025-12-08)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -249,7 +260,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
249
260
|
|
|
250
261
|
### Features
|
|
251
262
|
|
|
252
|
-
* **
|
|
263
|
+
* **FF-5836:** support cjs syntax ([d44abd0](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/d44abd0ddbbea0cd2bf0e1b99442cdb83b87df48))
|
|
253
264
|
|
|
254
265
|
|
|
255
266
|
|
|
@@ -260,7 +271,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
260
271
|
|
|
261
272
|
### Bug Fixes
|
|
262
273
|
|
|
263
|
-
* **
|
|
274
|
+
* **FF-5846:** getting rid of circular import ([f78432a](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/f78432a0c63bb6f33e1d586fb183dcddc068f5d0))
|
|
264
275
|
|
|
265
276
|
|
|
266
277
|
### Features
|
|
@@ -276,7 +287,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
276
287
|
|
|
277
288
|
### Dependencies
|
|
278
289
|
|
|
279
|
-
* **
|
|
290
|
+
* **PDS-611:** up deps ([c30ac4c](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/c30ac4c2adb7c00e84fbe557d85314add6b6977a))
|
|
280
291
|
|
|
281
292
|
|
|
282
293
|
|
|
@@ -287,7 +298,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
287
298
|
|
|
288
299
|
### Features
|
|
289
300
|
|
|
290
|
-
* **
|
|
301
|
+
* **FF-5375:** add hooks/utils for adaptiveness ([2c5a3cc](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/2c5a3cc2bec030525f81dd5b02c1b7aee653bb32))
|
|
291
302
|
|
|
292
303
|
|
|
293
304
|
|
|
@@ -298,7 +309,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
298
309
|
|
|
299
310
|
### Features
|
|
300
311
|
|
|
301
|
-
* **
|
|
312
|
+
* **FF-5392:** css optimization ([79cc390](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/79cc390d1d49b0434b75f8e1ae893e7c7f9f450b))
|
|
302
313
|
|
|
303
314
|
|
|
304
315
|
|
|
@@ -309,7 +320,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
309
320
|
|
|
310
321
|
### Bug Fixes
|
|
311
322
|
|
|
312
|
-
* **
|
|
323
|
+
* **FF-3789:** updated typescript to v5 ([1e50951](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/1e50951d88db18b69a760d38a6a8bf93335dcd1c))
|
|
313
324
|
|
|
314
325
|
|
|
315
326
|
|
|
@@ -320,12 +331,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
320
331
|
|
|
321
332
|
### Dependencies
|
|
322
333
|
|
|
323
|
-
* **
|
|
334
|
+
* **FF-4699:** change product -> snack divider ([bd49fc6](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/bd49fc619626923b0278b7b72221ad1aca7800f8))
|
|
324
335
|
|
|
325
336
|
|
|
326
337
|
### Features
|
|
327
338
|
|
|
328
|
-
* **
|
|
339
|
+
* **FF-5149:** add ForThemeMode component and useForThemeMode hook ([4d88452](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/4d88452e8142e1359dc702e048586ac1f5d8e5b5))
|
|
329
340
|
|
|
330
341
|
|
|
331
342
|
|
|
@@ -347,7 +358,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
347
358
|
|
|
348
359
|
### Features
|
|
349
360
|
|
|
350
|
-
* **
|
|
361
|
+
* **FF-3478:** add deps graph addon ([0f59586](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/0f5958674746342fe3ed3005da67905c0920f907))
|
|
351
362
|
|
|
352
363
|
|
|
353
364
|
|
|
@@ -358,7 +369,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
358
369
|
|
|
359
370
|
### Bug Fixes
|
|
360
371
|
|
|
361
|
-
* **
|
|
372
|
+
* **FF-2821:** added stylelint config and refactored styles ([f201954](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/f201954303601b6dc5873b2ce2ee0928bc84a253))
|
|
362
373
|
|
|
363
374
|
|
|
364
375
|
|
|
@@ -396,7 +407,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
396
407
|
|
|
397
408
|
### Bug Fixes
|
|
398
409
|
|
|
399
|
-
* **
|
|
410
|
+
* **FF-2270:** update types ([cd843f1](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/cd843f1db5c1aac401a27c2d67b314e81f5ddda3))
|
|
400
411
|
|
|
401
412
|
|
|
402
413
|
|
|
@@ -407,8 +418,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
407
418
|
|
|
408
419
|
### Features
|
|
409
420
|
|
|
410
|
-
* **
|
|
411
|
-
* **
|
|
421
|
+
* **FF-1803:** add support for tokens from new uikit ([6683f17](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/6683f176f80aceadf8458af10d21b3fd55a7f4eb))
|
|
422
|
+
* **FF-1803:** extract useConfig hook ([adc776e](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/adc776e078ea234d26639b4aef3d59d6e1d21e0f))
|
|
412
423
|
|
|
413
424
|
|
|
414
425
|
|
|
@@ -460,11 +471,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
460
471
|
|
|
461
472
|
### Features
|
|
462
473
|
|
|
463
|
-
- remove logMode handling, now it uses '@
|
|
474
|
+
- remove logMode handling, now it uses '@cloud-ru/ft-debug-mode' ([5b28fe0](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/5b28fe0c91961a0d20f54295daaa699b1f7c4970))
|
|
464
475
|
|
|
465
476
|
### BREAKING CHANGES
|
|
466
477
|
|
|
467
|
-
- remove logMode handling, now it uses '@
|
|
478
|
+
- remove logMode handling, now it uses '@cloud-ru/ft-debug-mode'
|
|
468
479
|
|
|
469
480
|
# [2.10.0](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@cloud-ru/uikit-product-utils@2.9.0...@cloud-ru/uikit-product-utils@2.10.0) (2022-07-13)
|
|
470
481
|
|
|
@@ -503,64 +514,64 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
503
514
|
- change page grouping strategy ([ef61e36](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/ef61e36cdb1dc03c6c43c0e84472552706999a17))
|
|
504
515
|
- renaming packages ([6c4e34d](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/6c4e34d4b5b8aa4a3386187b996f4856e642d0b5))
|
|
505
516
|
|
|
506
|
-
# [2.6.0](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@
|
|
517
|
+
# [2.6.0](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@cloud-ru/uikit-utils@2.5.0...@cloud-ru/uikit-utils@2.6.0) (2022-04-18)
|
|
507
518
|
|
|
508
519
|
### Features
|
|
509
520
|
|
|
510
|
-
-
|
|
521
|
+
- **AICE-5510** add shadow styles ([b3c8d9e](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/b3c8d9e356ace8d91cd1976c864ff20abda855c6))
|
|
511
522
|
|
|
512
|
-
# [2.5.0](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@
|
|
523
|
+
# [2.5.0](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@cloud-ru/uikit-utils@2.4.0...@cloud-ru/uikit-utils@2.5.0) (2022-04-13)
|
|
513
524
|
|
|
514
525
|
### Features
|
|
515
526
|
|
|
516
527
|
- add breakpoints constants to utils ([83a90e8](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/83a90e8a917e8cdaa11bfd5295410e88f09f93e4))
|
|
517
528
|
|
|
518
|
-
# [2.4.0](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@
|
|
529
|
+
# [2.4.0](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@cloud-ru/uikit-utils@2.3.0...@cloud-ru/uikit-utils@2.4.0) (2022-04-01)
|
|
519
530
|
|
|
520
531
|
### Features
|
|
521
532
|
|
|
522
533
|
- `keyboardSelectHandler` utility ([7423696](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/742369639c5d24a7ea1ba0a37312a5ed033102e1))
|
|
523
534
|
- `useForceUpdate` and `useForceUpdateOnPageLoadedCompletely` hooks ([5523c0a](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/5523c0a4db6e39678659742d6c95ee033392412e))
|
|
524
535
|
|
|
525
|
-
# [2.3.0](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@
|
|
536
|
+
# [2.3.0](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@cloud-ru/uikit-utils@2.2.4...@cloud-ru/uikit-utils@2.3.0) (2022-03-29)
|
|
526
537
|
|
|
527
538
|
### Features
|
|
528
539
|
|
|
529
540
|
- introduce `LOADING_WHEEL` animation ([4931f85](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/4931f85b0df1fc3e450cc03f91597d9e68720f3c))
|
|
530
541
|
|
|
531
|
-
## [2.2.4](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@
|
|
542
|
+
## [2.2.4](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@cloud-ru/uikit-utils@2.2.3...@cloud-ru/uikit-utils@2.2.4) (2022-03-25)
|
|
532
543
|
|
|
533
|
-
**Note:** Version bump only for package @
|
|
544
|
+
**Note:** Version bump only for package @cloud-ru/uikit-utils
|
|
534
545
|
|
|
535
|
-
## [2.2.3](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@
|
|
546
|
+
## [2.2.3](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@cloud-ru/uikit-utils@2.2.2...@cloud-ru/uikit-utils@2.2.3) (2022-03-23)
|
|
536
547
|
|
|
537
|
-
**Note:** Version bump only for package @
|
|
548
|
+
**Note:** Version bump only for package @cloud-ru/uikit-utils
|
|
538
549
|
|
|
539
|
-
## [2.2.2](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@
|
|
550
|
+
## [2.2.2](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@cloud-ru/uikit-utils@2.2.1...@cloud-ru/uikit-utils@2.2.2) (2022-03-22)
|
|
540
551
|
|
|
541
|
-
**Note:** Version bump only for package @
|
|
552
|
+
**Note:** Version bump only for package @cloud-ru/uikit-utils
|
|
542
553
|
|
|
543
554
|
## 2.2.1 (2022-03-22)
|
|
544
555
|
|
|
545
|
-
**Note:** Version bump only for package @
|
|
556
|
+
**Note:** Version bump only for package @cloud-ru/uikit-utils
|
|
546
557
|
|
|
547
|
-
# [2.2.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
558
|
+
# [2.2.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@2.1.3...@cloud-ru/uikit-utils@2.2.0) (2022-03-02)
|
|
548
559
|
|
|
549
560
|
### Features
|
|
550
561
|
|
|
551
|
-
-
|
|
562
|
+
- **AICE-4932** add reset default styles ([f0195ff](https://gitverse.ru/cloud-ru-tech/uikit-product/-/commit/f0195ffa2e281fc6b47247fc5fd8a39e9c293fb2))
|
|
552
563
|
|
|
553
|
-
## [2.1.3](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
564
|
+
## [2.1.3](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@2.1.2...@cloud-ru/uikit-utils@2.1.3) (2022-02-25)
|
|
554
565
|
|
|
555
|
-
**Note:** Version bump only for package @
|
|
566
|
+
**Note:** Version bump only for package @cloud-ru/uikit-utils
|
|
556
567
|
|
|
557
|
-
## [2.1.2](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
568
|
+
## [2.1.2](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@2.1.1...@cloud-ru/uikit-utils@2.1.2) (2022-02-16)
|
|
558
569
|
|
|
559
570
|
### Bug Fixes
|
|
560
571
|
|
|
561
572
|
- got rid of the typography deprecated usages ([98a9e66](https://gitverse.ru/cloud-ru-tech/uikit-product/-/commit/98a9e66aafaaf5e9a9663dc9a73d82572b90fb93))
|
|
562
573
|
|
|
563
|
-
## [2.1.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
574
|
+
## [2.1.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@2.1.0...@cloud-ru/uikit-utils@2.1.1) (2022-01-21)
|
|
564
575
|
|
|
565
576
|
### Bug Fixes
|
|
566
577
|
|
|
@@ -576,29 +587,29 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
576
587
|
|
|
577
588
|
- adds createTextProvider utility ([1595d05](https://gitverse.ru/cloud-ru-tech/uikit-product/-/commit/1595d054b975e1196259b23329daae89d838db66))
|
|
578
589
|
|
|
579
|
-
## [2.0.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
590
|
+
## [2.0.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@2.0.0...@cloud-ru/uikit-utils@2.0.1) (2021-12-02)
|
|
580
591
|
|
|
581
|
-
**Note:** Version bump only for package @
|
|
592
|
+
**Note:** Version bump only for package @cloud-ru/uikit-utils
|
|
582
593
|
|
|
583
|
-
# [2.0.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
594
|
+
# [2.0.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@1.2.2...@cloud-ru/uikit-utils@2.0.0) (2021-12-01)
|
|
584
595
|
|
|
585
596
|
### Features
|
|
586
597
|
|
|
587
|
-
- packages moved to
|
|
598
|
+
- packages moved to frontend-tools 6930cbe
|
|
588
599
|
|
|
589
600
|
### BREAKING CHANGES
|
|
590
601
|
|
|
591
|
-
- packages moved to
|
|
602
|
+
- packages moved to frontend-tools
|
|
592
603
|
|
|
593
|
-
## [1.2.2](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
604
|
+
## [1.2.2](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@1.2.1...@cloud-ru/uikit-utils@1.2.2) (2021-11-17)
|
|
594
605
|
|
|
595
606
|
### Bug Fixes
|
|
596
607
|
|
|
597
608
|
- repository.directory field has been added ([82e2345](https://gitverse.ru/cloud-ru-tech/uikit-product/-/commit/82e2345880c4011971b193ebd87eedbb1c804ea6))
|
|
598
609
|
|
|
599
|
-
## [1.2.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
610
|
+
## [1.2.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@1.2.0...@cloud-ru/uikit-utils@1.2.1) (2021-11-11)
|
|
600
611
|
|
|
601
|
-
**Note:** Version bump only for package @
|
|
612
|
+
**Note:** Version bump only for package @cloud-ru/uikit-utils
|
|
602
613
|
|
|
603
614
|
# 1.2.0 (2021-11-02)
|
|
604
615
|
|
|
@@ -606,70 +617,70 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
606
617
|
|
|
607
618
|
- added useComponentSize hook ([2bf57bf](https://gitverse.ru/cloud-ru-tech/uikit-product/-/commit/2bf57bfc8797ab775c5196a83254ffd09ecdef04))
|
|
608
619
|
|
|
609
|
-
# [1.1.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
620
|
+
# [1.1.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@1.0.4...@cloud-ru/uikit-utils@1.1.0) (2021-10-13)
|
|
610
621
|
|
|
611
622
|
### Features
|
|
612
623
|
|
|
613
|
-
- added extractDataProps function (
|
|
624
|
+
- added extractDataProps function (AICDC-4028) ([917d1bb](https://gitverse.ru/cloud-ru-tech/uikit-product/-/commit/917d1bb05304db1d7a7f4ba7f32e5523a9a6e655))
|
|
614
625
|
|
|
615
|
-
## [1.0.4](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
626
|
+
## [1.0.4](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@1.0.3...@cloud-ru/uikit-utils@1.0.4) (2021-10-11)
|
|
616
627
|
|
|
617
628
|
### Bug Fixes
|
|
618
629
|
|
|
619
630
|
- republish all packages ([b7ce3da](https://gitverse.ru/cloud-ru-tech/uikit-product/-/commit/b7ce3da1966f2f099d5d47aa13d62058cfa6fc98))
|
|
620
631
|
|
|
621
|
-
## [1.0.3](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
632
|
+
## [1.0.3](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@1.0.2...@cloud-ru/uikit-utils@1.0.3) (2021-10-08)
|
|
622
633
|
|
|
623
634
|
### Bug Fixes
|
|
624
635
|
|
|
625
636
|
- window custom store decorated via react hook ([8ac326d](https://gitverse.ru/cloud-ru-tech/uikit-product/-/commit/8ac326dccdbd8a0cf02a4cea49c1c36a904a47fa))
|
|
626
637
|
|
|
627
|
-
## [1.0.2](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
638
|
+
## [1.0.2](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@1.0.1...@cloud-ru/uikit-utils@1.0.2) (2021-10-07)
|
|
628
639
|
|
|
629
|
-
**Note:** Version bump only for package @
|
|
640
|
+
**Note:** Version bump only for package @cloud-ru/uikit-utils
|
|
630
641
|
|
|
631
|
-
## [1.0.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
642
|
+
## [1.0.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@1.0.0...@cloud-ru/uikit-utils@1.0.1) (2021-09-30)
|
|
632
643
|
|
|
633
644
|
### Bug Fixes
|
|
634
645
|
|
|
635
646
|
- improved type declarations, linaria core/react peerDeps version is ^3.0.0-beta.13 ([942799a](https://gitverse.ru/cloud-ru-tech/uikit-product/-/commit/942799aa59ae420fb90d00b0d379f30af3d01394))
|
|
636
647
|
|
|
637
|
-
# [1.0.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
648
|
+
# [1.0.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@0.8.1...@cloud-ru/uikit-utils@1.0.0) (2021-09-29)
|
|
638
649
|
|
|
639
650
|
### Features
|
|
640
651
|
|
|
641
|
-
- utils first stable version (
|
|
652
|
+
- utils first stable version (AICD-1813) ([ed13c42](https://gitverse.ru/cloud-ru-tech/uikit-product/-/commit/ed13c421ac564f6a5b155780ce473c78eb94aacc))
|
|
642
653
|
|
|
643
654
|
### BREAKING CHANGE
|
|
644
655
|
|
|
645
656
|
- useLanguage and useTheme return types were changed
|
|
646
657
|
- ConfigProvider no longer extends html tag by color classes, but extends body tag
|
|
647
658
|
|
|
648
|
-
## [0.8.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
659
|
+
## [0.8.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@0.8.0...@cloud-ru/uikit-utils@0.8.1) (2021-09-14)
|
|
649
660
|
|
|
650
|
-
**Note:** Version bump only for package @
|
|
661
|
+
**Note:** Version bump only for package @cloud-ru/uikit-utils
|
|
651
662
|
|
|
652
|
-
# [0.8.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
663
|
+
# [0.8.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@0.7.1...@cloud-ru/uikit-utils@0.8.0) (2021-09-08)
|
|
653
664
|
|
|
654
665
|
### Features
|
|
655
666
|
|
|
656
667
|
- extracting copy-to-clipboard functionality into utils ([3a9b50f](https://gitverse.ru/cloud-ru-tech/uikit-product/-/commit/3a9b50f8384279beb0cc27c79441e346f697bee1))
|
|
657
668
|
|
|
658
|
-
## [0.7.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
669
|
+
## [0.7.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@0.7.0...@cloud-ru/uikit-utils@0.7.1) (2021-09-07)
|
|
659
670
|
|
|
660
|
-
**Note:** Version bump only for package @
|
|
671
|
+
**Note:** Version bump only for package @cloud-ru/uikit-utils
|
|
661
672
|
|
|
662
|
-
# [0.7.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
673
|
+
# [0.7.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@0.6.1...@cloud-ru/uikit-utils@0.7.0) (2021-09-03)
|
|
663
674
|
|
|
664
675
|
### Features
|
|
665
676
|
|
|
666
677
|
- downloadFile util function ([6c543dc](https://gitverse.ru/cloud-ru-tech/uikit-product/-/commit/6c543dc3e17267e6e0c1c80071d39e2403d8f0f5))
|
|
667
678
|
|
|
668
|
-
## [0.6.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
679
|
+
## [0.6.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@0.6.0...@cloud-ru/uikit-utils@0.6.1) (2021-08-25)
|
|
669
680
|
|
|
670
|
-
**Note:** Version bump only for package @
|
|
681
|
+
**Note:** Version bump only for package @cloud-ru/uikit-utils
|
|
671
682
|
|
|
672
|
-
# [0.6.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@
|
|
683
|
+
# [0.6.0](https://gitverse.ru/cloud-ru-tech/uikit-product/-/compare/@cloud-ru/uikit-utils@0.5.0...@cloud-ru/uikit-utils@0.6.0) (2021-08-20)
|
|
673
684
|
|
|
674
685
|
### Bug Fixes
|
|
675
686
|
|
|
@@ -683,53 +694,53 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
683
694
|
|
|
684
695
|
- button has been implemented according to design system
|
|
685
696
|
|
|
686
|
-
#
|
|
697
|
+
# 0.5.0 (2021-08-19)
|
|
687
698
|
|
|
688
699
|
### Features
|
|
689
700
|
|
|
690
|
-
- truncate string tool (
|
|
701
|
+
- truncate string tool (75112c2)
|
|
691
702
|
|
|
692
|
-
##
|
|
703
|
+
## 0.4.1 (2021-08-12)
|
|
693
704
|
|
|
694
705
|
### Bug Fixes
|
|
695
706
|
|
|
696
|
-
- get rid of window.navigator (
|
|
707
|
+
- get rid of window.navigator (0a8381f)
|
|
697
708
|
|
|
698
|
-
#
|
|
709
|
+
# 0.4.0 (2021-08-12)
|
|
699
710
|
|
|
700
711
|
### Features
|
|
701
712
|
|
|
702
|
-
- exclude props util (
|
|
713
|
+
- exclude props util (b043bee)
|
|
703
714
|
|
|
704
|
-
##
|
|
715
|
+
## 0.3.1 (2021-08-10)
|
|
705
716
|
|
|
706
|
-
**Note:** Version bump only for package @
|
|
717
|
+
**Note:** Version bump only for package @cloud-ru/uikit-utils
|
|
707
718
|
|
|
708
|
-
#
|
|
719
|
+
# 0.3.0 (2021-08-03)
|
|
709
720
|
|
|
710
721
|
### Features
|
|
711
722
|
|
|
712
|
-
- data-test-\* props extractor (
|
|
723
|
+
- data-test-\* props extractor (3f53737)
|
|
713
724
|
|
|
714
|
-
##
|
|
725
|
+
## 0.2.1 (2021-07-26)
|
|
715
726
|
|
|
716
727
|
### Bug Fixes
|
|
717
728
|
|
|
718
|
-
- fix console errors on JSON.parse failures (
|
|
729
|
+
- fix console errors on JSON.parse failures (dc9ff96)
|
|
719
730
|
|
|
720
731
|
# 0.2.0 (2021-07-26)
|
|
721
732
|
|
|
722
733
|
### Features
|
|
723
734
|
|
|
724
|
-
- button icon
|
|
725
|
-
- create ConfigProvider
|
|
726
|
-
- create ConfigProvider
|
|
735
|
+
- button icon 22d9559
|
|
736
|
+
- create ConfigProvider 26d5984
|
|
737
|
+
- create ConfigProvider 24c5cef
|
|
727
738
|
|
|
728
739
|
# 0.1.0 (2021-07-22)
|
|
729
740
|
|
|
730
741
|
### Features
|
|
731
742
|
|
|
732
|
-
- create ConfigProvider
|
|
743
|
+
- create ConfigProvider 24c5cef
|
|
733
744
|
|
|
734
745
|
## CHANGELOG
|
|
735
746
|
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useForThemeMode = useForThemeMode;
|
|
4
4
|
const hooks_1 = require("../../hooks");
|
|
5
5
|
const theme_1 = require("../../types/theme");
|
|
6
|
-
const DARK_THEMES = [theme_1.Themes.GreenDark
|
|
7
|
-
const DARK_BRANDS = [theme_1.Brand.CloudDark, theme_1.Brand.
|
|
6
|
+
const DARK_THEMES = [theme_1.Themes.GreenDark];
|
|
7
|
+
const DARK_BRANDS = [theme_1.Brand.CloudDark, theme_1.Brand.SiteDark, theme_1.Brand.GigaIdDark];
|
|
8
8
|
function useForThemeMode({ light, dark }) {
|
|
9
9
|
const { theme } = (0, hooks_1.useTheme)();
|
|
10
10
|
const { brand } = (0, hooks_1.useBrand)();
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -5,33 +5,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useConfig = useConfig;
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
-
const brand_module_css_1 = __importDefault(require("@
|
|
9
|
-
const brand_module_css_2 = __importDefault(require("@
|
|
10
|
-
const brand_module_css_3 = __importDefault(require("@
|
|
11
|
-
const brand_module_css_4 = __importDefault(require("@sbercloud/figma-tokens-mlspace/build/css/brand.module.css"));
|
|
12
|
-
const brand_module_css_5 = __importDefault(require("@sbercloud/figma-tokens-web/build/css/brand.module.css"));
|
|
8
|
+
const brand_module_css_1 = __importDefault(require("@cloud-ru/figma-tokens-cloud-platform/build/css/brand.module.css"));
|
|
9
|
+
const brand_module_css_2 = __importDefault(require("@cloud-ru/figma-tokens-giga-id/build/css/brand.module.css"));
|
|
10
|
+
const brand_module_css_3 = __importDefault(require("@cloud-ru/figma-tokens-web/build/css/brand.module.css"));
|
|
13
11
|
const utils_1 = require("@snack-uikit/utils");
|
|
14
12
|
const environment_1 = require("../constants/environment");
|
|
15
13
|
const tryParseJson_1 = require("../helpers/tryParseJson");
|
|
16
14
|
const types_1 = require("../types");
|
|
17
15
|
const getCustomStore_1 = require("./private/getCustomStore");
|
|
18
16
|
const themeMap = {
|
|
19
|
-
[types_1.Themes.Green]:
|
|
20
|
-
[types_1.Themes.GreenDark]:
|
|
21
|
-
[types_1.Themes.Purple]: brand_module_css_4.default.light,
|
|
22
|
-
[types_1.Themes.PurpleDark]: brand_module_css_4.default.dark,
|
|
17
|
+
[types_1.Themes.Green]: brand_module_css_1.default.light,
|
|
18
|
+
[types_1.Themes.GreenDark]: brand_module_css_1.default.dark,
|
|
23
19
|
};
|
|
24
20
|
const brandMap = {
|
|
25
|
-
[types_1.Brand.Cloud]:
|
|
26
|
-
[types_1.Brand.CloudDark]:
|
|
27
|
-
[types_1.Brand.
|
|
28
|
-
[types_1.Brand.
|
|
29
|
-
[types_1.Brand.
|
|
30
|
-
[types_1.Brand.
|
|
31
|
-
[types_1.Brand.Site]: brand_module_css_5.default.light,
|
|
32
|
-
[types_1.Brand.SiteDark]: brand_module_css_5.default.dark,
|
|
33
|
-
[types_1.Brand.GigaId]: brand_module_css_3.default.light,
|
|
34
|
-
[types_1.Brand.GigaIdDark]: brand_module_css_3.default.dark,
|
|
21
|
+
[types_1.Brand.Cloud]: brand_module_css_1.default.light,
|
|
22
|
+
[types_1.Brand.CloudDark]: brand_module_css_1.default.dark,
|
|
23
|
+
[types_1.Brand.Site]: brand_module_css_3.default.light,
|
|
24
|
+
[types_1.Brand.SiteDark]: brand_module_css_3.default.dark,
|
|
25
|
+
[types_1.Brand.GigaId]: brand_module_css_2.default.light,
|
|
26
|
+
[types_1.Brand.GigaIdDark]: brand_module_css_2.default.dark,
|
|
35
27
|
};
|
|
36
28
|
function useConfig({ languageCode, theme, brand }) {
|
|
37
29
|
const store = (0, getCustomStore_1.getCustomStore)({ brand, theme, languageCode });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useLocalStorage<T extends string = string>(key: string, defaultValue: T): [T, (newValue: T) => void];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLocalStorage = useLocalStorage;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const utils_1 = require("@snack-uikit/utils");
|
|
6
|
+
function useLocalStorage(key, defaultValue) {
|
|
7
|
+
var _a;
|
|
8
|
+
const [value, setValueState] = (0, react_1.useState)(((_a = ((0, utils_1.isBrowser)() ? localStorage.getItem(key) : null)) !== null && _a !== void 0 ? _a : defaultValue));
|
|
9
|
+
const setValue = (0, react_1.useCallback)((newValue) => {
|
|
10
|
+
if ((0, utils_1.isBrowser)()) {
|
|
11
|
+
localStorage.setItem(key, newValue);
|
|
12
|
+
}
|
|
13
|
+
setValueState(newValue);
|
|
14
|
+
}, [key]);
|
|
15
|
+
return [value, setValue];
|
|
16
|
+
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
export declare enum Themes {
|
|
2
|
-
Purple = "purple",
|
|
3
|
-
PurpleDark = "purpleDark",
|
|
4
2
|
Green = "green",
|
|
5
3
|
GreenDark = "greenDark"
|
|
6
4
|
}
|
|
7
5
|
export declare enum Brand {
|
|
8
6
|
Cloud = "Cloud",
|
|
9
7
|
CloudDark = "CloudDark",
|
|
10
|
-
MLSpace = "MLSpace",
|
|
11
|
-
MLSpaceDark = "MLSpaceDark",
|
|
12
8
|
Site = "Site",
|
|
13
9
|
SiteDark = "SiteDark",
|
|
14
|
-
Admin = "Admin",
|
|
15
|
-
AdminDark = "AdminDark",
|
|
16
10
|
GigaId = "GigaId",
|
|
17
11
|
GigaIdDark = "GigaIdDark"
|
|
18
12
|
}
|
package/dist/cjs/types/theme.js
CHANGED
|
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Brand = exports.Themes = void 0;
|
|
4
4
|
var Themes;
|
|
5
5
|
(function (Themes) {
|
|
6
|
-
Themes["Purple"] = "purple";
|
|
7
|
-
Themes["PurpleDark"] = "purpleDark";
|
|
8
6
|
Themes["Green"] = "green";
|
|
9
7
|
Themes["GreenDark"] = "greenDark";
|
|
10
8
|
})(Themes || (exports.Themes = Themes = {}));
|
|
@@ -12,12 +10,8 @@ var Brand;
|
|
|
12
10
|
(function (Brand) {
|
|
13
11
|
Brand["Cloud"] = "Cloud";
|
|
14
12
|
Brand["CloudDark"] = "CloudDark";
|
|
15
|
-
Brand["MLSpace"] = "MLSpace";
|
|
16
|
-
Brand["MLSpaceDark"] = "MLSpaceDark";
|
|
17
13
|
Brand["Site"] = "Site";
|
|
18
14
|
Brand["SiteDark"] = "SiteDark";
|
|
19
|
-
Brand["Admin"] = "Admin";
|
|
20
|
-
Brand["AdminDark"] = "AdminDark";
|
|
21
15
|
Brand["GigaId"] = "GigaId";
|
|
22
16
|
Brand["GigaIdDark"] = "GigaIdDark";
|
|
23
17
|
})(Brand || (exports.Brand = Brand = {}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useBrand, useTheme } from '../../hooks';
|
|
2
2
|
import { Brand, Themes } from '../../types/theme';
|
|
3
|
-
const DARK_THEMES = [Themes.GreenDark
|
|
4
|
-
const DARK_BRANDS = [Brand.CloudDark, Brand.
|
|
3
|
+
const DARK_THEMES = [Themes.GreenDark];
|
|
4
|
+
const DARK_BRANDS = [Brand.CloudDark, Brand.SiteDark, Brand.GigaIdDark];
|
|
5
5
|
export function useForThemeMode({ light, dark }) {
|
|
6
6
|
const { theme } = useTheme();
|
|
7
7
|
const { brand } = useBrand();
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import MLSpaceBrandThemes from '@sbercloud/figma-tokens-mlspace/build/css/brand.module.css';
|
|
6
|
-
import SiteBrandThemes from '@sbercloud/figma-tokens-web/build/css/brand.module.css';
|
|
2
|
+
import CloudBrandThemes from '@cloud-ru/figma-tokens-cloud-platform/build/css/brand.module.css';
|
|
3
|
+
import GigaIdBrandThemes from '@cloud-ru/figma-tokens-giga-id/build/css/brand.module.css';
|
|
4
|
+
import SiteBrandThemes from '@cloud-ru/figma-tokens-web/build/css/brand.module.css';
|
|
7
5
|
import { isBrowser, useLayoutEffect } from '@snack-uikit/utils';
|
|
8
6
|
import { POST_MESSAGE_KEY } from '../constants/environment';
|
|
9
7
|
import { tryParseJson } from '../helpers/tryParseJson';
|
|
@@ -12,16 +10,10 @@ import { getCustomStore } from './private/getCustomStore';
|
|
|
12
10
|
const themeMap = {
|
|
13
11
|
[Themes.Green]: CloudBrandThemes.light,
|
|
14
12
|
[Themes.GreenDark]: CloudBrandThemes.dark,
|
|
15
|
-
[Themes.Purple]: MLSpaceBrandThemes.light,
|
|
16
|
-
[Themes.PurpleDark]: MLSpaceBrandThemes.dark,
|
|
17
13
|
};
|
|
18
14
|
const brandMap = {
|
|
19
15
|
[Brand.Cloud]: CloudBrandThemes.light,
|
|
20
16
|
[Brand.CloudDark]: CloudBrandThemes.dark,
|
|
21
|
-
[Brand.MLSpace]: MLSpaceBrandThemes.light,
|
|
22
|
-
[Brand.MLSpaceDark]: MLSpaceBrandThemes.dark,
|
|
23
|
-
[Brand.Admin]: AdminBrandThemes.light,
|
|
24
|
-
[Brand.AdminDark]: AdminBrandThemes.dark,
|
|
25
17
|
[Brand.Site]: SiteBrandThemes.light,
|
|
26
18
|
[Brand.SiteDark]: SiteBrandThemes.dark,
|
|
27
19
|
[Brand.GigaId]: GigaIdBrandThemes.light,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useLocalStorage<T extends string = string>(key: string, defaultValue: T): [T, (newValue: T) => void];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
import { isBrowser } from '@snack-uikit/utils';
|
|
3
|
+
export function useLocalStorage(key, defaultValue) {
|
|
4
|
+
var _a;
|
|
5
|
+
const [value, setValueState] = useState(((_a = (isBrowser() ? localStorage.getItem(key) : null)) !== null && _a !== void 0 ? _a : defaultValue));
|
|
6
|
+
const setValue = useCallback((newValue) => {
|
|
7
|
+
if (isBrowser()) {
|
|
8
|
+
localStorage.setItem(key, newValue);
|
|
9
|
+
}
|
|
10
|
+
setValueState(newValue);
|
|
11
|
+
}, [key]);
|
|
12
|
+
return [value, setValue];
|
|
13
|
+
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
export declare enum Themes {
|
|
2
|
-
Purple = "purple",
|
|
3
|
-
PurpleDark = "purpleDark",
|
|
4
2
|
Green = "green",
|
|
5
3
|
GreenDark = "greenDark"
|
|
6
4
|
}
|
|
7
5
|
export declare enum Brand {
|
|
8
6
|
Cloud = "Cloud",
|
|
9
7
|
CloudDark = "CloudDark",
|
|
10
|
-
MLSpace = "MLSpace",
|
|
11
|
-
MLSpaceDark = "MLSpaceDark",
|
|
12
8
|
Site = "Site",
|
|
13
9
|
SiteDark = "SiteDark",
|
|
14
|
-
Admin = "Admin",
|
|
15
|
-
AdminDark = "AdminDark",
|
|
16
10
|
GigaId = "GigaId",
|
|
17
11
|
GigaIdDark = "GigaIdDark"
|
|
18
12
|
}
|
package/dist/esm/types/theme.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export var Themes;
|
|
2
2
|
(function (Themes) {
|
|
3
|
-
Themes["Purple"] = "purple";
|
|
4
|
-
Themes["PurpleDark"] = "purpleDark";
|
|
5
3
|
Themes["Green"] = "green";
|
|
6
4
|
Themes["GreenDark"] = "greenDark";
|
|
7
5
|
})(Themes || (Themes = {}));
|
|
@@ -9,12 +7,8 @@ export var Brand;
|
|
|
9
7
|
(function (Brand) {
|
|
10
8
|
Brand["Cloud"] = "Cloud";
|
|
11
9
|
Brand["CloudDark"] = "CloudDark";
|
|
12
|
-
Brand["MLSpace"] = "MLSpace";
|
|
13
|
-
Brand["MLSpaceDark"] = "MLSpaceDark";
|
|
14
10
|
Brand["Site"] = "Site";
|
|
15
11
|
Brand["SiteDark"] = "SiteDark";
|
|
16
|
-
Brand["Admin"] = "Admin";
|
|
17
|
-
Brand["AdminDark"] = "AdminDark";
|
|
18
12
|
Brand["GigaId"] = "GigaId";
|
|
19
13
|
Brand["GigaIdDark"] = "GigaIdDark";
|
|
20
14
|
})(Brand || (Brand = {}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/uikit-product-utils",
|
|
3
3
|
"title": "Utils",
|
|
4
|
-
"version": "8.0
|
|
4
|
+
"version": "8.1.1-preview-b95fca4e.0",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css",
|
|
7
7
|
"*.woff",
|
|
@@ -60,29 +60,21 @@
|
|
|
60
60
|
"@types/ua-parser-js": "0.7.39"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"@sbercloud/figma-tokens-mlspace": "*",
|
|
67
|
-
"@sbercloud/figma-tokens-web": "*",
|
|
63
|
+
"@cloud-ru/figma-tokens-cloud-platform": "*",
|
|
64
|
+
"@cloud-ru/figma-tokens-giga-id": "*",
|
|
65
|
+
"@cloud-ru/figma-tokens-web": "*",
|
|
68
66
|
"@snack-uikit/figma-tokens": "*"
|
|
69
67
|
},
|
|
70
68
|
"peerDependenciesMeta": {
|
|
71
|
-
"@
|
|
69
|
+
"@cloud-ru/figma-tokens-cloud-platform": {
|
|
72
70
|
"optional": true
|
|
73
71
|
},
|
|
74
|
-
"@
|
|
72
|
+
"@cloud-ru/figma-tokens-giga-id": {
|
|
75
73
|
"optional": true
|
|
76
74
|
},
|
|
77
|
-
"@
|
|
78
|
-
"optional": true
|
|
79
|
-
},
|
|
80
|
-
"@sbercloud/figma-tokens-mlspace": {
|
|
81
|
-
"optional": true
|
|
82
|
-
},
|
|
83
|
-
"@sbercloud/figma-tokens-web": {
|
|
75
|
+
"@cloud-ru/figma-tokens-web": {
|
|
84
76
|
"optional": true
|
|
85
77
|
}
|
|
86
78
|
},
|
|
87
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "5e59d6341e92ce7320739df54ab7e6f6d0a7aa26"
|
|
88
80
|
}
|
|
@@ -6,8 +6,8 @@ type UseForThemeModeParams<L, D> = {
|
|
|
6
6
|
dark: D;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const DARK_THEMES = [Themes.GreenDark
|
|
10
|
-
const DARK_BRANDS = [Brand.CloudDark, Brand.
|
|
9
|
+
const DARK_THEMES = [Themes.GreenDark];
|
|
10
|
+
const DARK_BRANDS = [Brand.CloudDark, Brand.SiteDark, Brand.GigaIdDark];
|
|
11
11
|
|
|
12
12
|
export function useForThemeMode<L, D>({ light, dark }: UseForThemeModeParams<L, D>): L | D {
|
|
13
13
|
const { theme } = useTheme();
|
package/src/hooks/index.ts
CHANGED
package/src/hooks/useConfig.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import MLSpaceBrandThemes from '@sbercloud/figma-tokens-mlspace/build/css/brand.module.css';
|
|
7
|
-
import SiteBrandThemes from '@sbercloud/figma-tokens-web/build/css/brand.module.css';
|
|
3
|
+
import CloudBrandThemes from '@cloud-ru/figma-tokens-cloud-platform/build/css/brand.module.css';
|
|
4
|
+
import GigaIdBrandThemes from '@cloud-ru/figma-tokens-giga-id/build/css/brand.module.css';
|
|
5
|
+
import SiteBrandThemes from '@cloud-ru/figma-tokens-web/build/css/brand.module.css';
|
|
8
6
|
import { isBrowser, useLayoutEffect } from '@snack-uikit/utils';
|
|
9
7
|
|
|
10
8
|
import { POST_MESSAGE_KEY } from '../constants/environment';
|
|
@@ -21,17 +19,11 @@ type UseConfigProps = {
|
|
|
21
19
|
const themeMap = {
|
|
22
20
|
[Themes.Green]: CloudBrandThemes.light,
|
|
23
21
|
[Themes.GreenDark]: CloudBrandThemes.dark,
|
|
24
|
-
[Themes.Purple]: MLSpaceBrandThemes.light,
|
|
25
|
-
[Themes.PurpleDark]: MLSpaceBrandThemes.dark,
|
|
26
22
|
};
|
|
27
23
|
|
|
28
24
|
const brandMap = {
|
|
29
25
|
[Brand.Cloud]: CloudBrandThemes.light,
|
|
30
26
|
[Brand.CloudDark]: CloudBrandThemes.dark,
|
|
31
|
-
[Brand.MLSpace]: MLSpaceBrandThemes.light,
|
|
32
|
-
[Brand.MLSpaceDark]: MLSpaceBrandThemes.dark,
|
|
33
|
-
[Brand.Admin]: AdminBrandThemes.light,
|
|
34
|
-
[Brand.AdminDark]: AdminBrandThemes.dark,
|
|
35
27
|
[Brand.Site]: SiteBrandThemes.light,
|
|
36
28
|
[Brand.SiteDark]: SiteBrandThemes.dark,
|
|
37
29
|
[Brand.GigaId]: GigaIdBrandThemes.light,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { isBrowser } from '@snack-uikit/utils';
|
|
4
|
+
|
|
5
|
+
export function useLocalStorage<T extends string = string>(key: string, defaultValue: T): [T, (newValue: T) => void] {
|
|
6
|
+
const [value, setValueState] = useState<T>(((isBrowser() ? localStorage.getItem(key) : null) ?? defaultValue) as T);
|
|
7
|
+
|
|
8
|
+
const setValue = useCallback(
|
|
9
|
+
(newValue: T) => {
|
|
10
|
+
if (isBrowser()) {
|
|
11
|
+
localStorage.setItem(key, newValue);
|
|
12
|
+
}
|
|
13
|
+
setValueState(newValue);
|
|
14
|
+
},
|
|
15
|
+
[key],
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return [value, setValue];
|
|
19
|
+
}
|
package/src/types/theme.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export enum Themes {
|
|
2
|
-
Purple = 'purple',
|
|
3
|
-
PurpleDark = 'purpleDark',
|
|
4
2
|
Green = 'green',
|
|
5
3
|
GreenDark = 'greenDark',
|
|
6
4
|
}
|
|
@@ -8,12 +6,8 @@ export enum Themes {
|
|
|
8
6
|
export enum Brand {
|
|
9
7
|
Cloud = 'Cloud',
|
|
10
8
|
CloudDark = 'CloudDark',
|
|
11
|
-
MLSpace = 'MLSpace',
|
|
12
|
-
MLSpaceDark = 'MLSpaceDark',
|
|
13
9
|
Site = 'Site',
|
|
14
10
|
SiteDark = 'SiteDark',
|
|
15
|
-
Admin = 'Admin',
|
|
16
|
-
AdminDark = 'AdminDark',
|
|
17
11
|
GigaId = 'GigaId',
|
|
18
12
|
GigaIdDark = 'GigaIdDark',
|
|
19
13
|
}
|