@daryasidorovich/modsen-datepicker 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/.prettierrc +6 -6
  2. package/.storybook/main.js +93 -93
  3. package/.storybook/main.ts +16 -0
  4. package/.storybook/preview.js +26 -26
  5. package/.storybook/preview.tsx +18 -18
  6. package/README.md +5 -5
  7. package/commitlint.config.js +23 -23
  8. package/package.json +1 -1
  9. package/rollup.config.js +65 -65
  10. package/src/components/BaseCalendar/BaseCalendar.stories.tsx +77 -77
  11. package/src/components/BaseCalendar/index.tsx +63 -63
  12. package/src/components/BaseCalendar/styles.module.scss +15 -15
  13. package/src/components/Button/Button.stories.tsx +16 -0
  14. package/src/components/Button/Button.tsx +14 -0
  15. package/src/components/Button/index.ts +1 -0
  16. package/src/components/Button/styles.module.scss +3 -0
  17. package/src/components/CalendarGrid/CalendarGrid.stories.tsx +136 -136
  18. package/src/components/CalendarGrid/CalendarGridWithTasks/Tooltip/index.tsx +27 -27
  19. package/src/components/CalendarGrid/CalendarGridWithTasks/Tooltip/styles.module.scss +9 -9
  20. package/src/components/CalendarGrid/CalendarGridWithTasks/index.tsx +51 -51
  21. package/src/components/CalendarGrid/CalendarGridWithoutTasks/index.tsx +36 -36
  22. package/src/components/CalendarGrid/CalendarGridWithoutTasks/styles.module.scss +11 -11
  23. package/src/components/CalendarGrid/index.tsx +19 -19
  24. package/src/components/CalendarGrid/types.ts +26 -26
  25. package/src/components/Clear/Clear.stories.tsx +16 -16
  26. package/src/components/Clear/index.tsx +12 -12
  27. package/src/components/Clear/styles.module.scss +34 -34
  28. package/src/components/DatePicker/DatePicker.stories.tsx +127 -127
  29. package/src/components/DatePicker/index.tsx +72 -72
  30. package/src/components/DatePicker/styles.module.scss +10 -10
  31. package/src/components/Day/Day.stories.tsx +75 -75
  32. package/src/components/Day/index.tsx +95 -95
  33. package/src/components/Day/styles.module.scss +97 -97
  34. package/src/components/Input/Input.stories.tsx +37 -37
  35. package/src/components/Input/index.tsx +64 -64
  36. package/src/components/Input/styles.module.scss +79 -79
  37. package/src/components/Modal/CrudModal/index.tsx +43 -43
  38. package/src/components/Modal/CrudModal/styles.module.scss +44 -44
  39. package/src/components/Modal/index.tsx +66 -66
  40. package/src/components/Modal/styles.module.scss +40 -40
  41. package/src/components/Modal/types.ts +13 -13
  42. package/src/components/Month/Month.stories.tsx +19 -19
  43. package/src/components/Month/index.tsx +31 -31
  44. package/src/components/Month/styles.module.scss +30 -30
  45. package/src/components/RangePicker/RangePicker.stories.tsx +134 -134
  46. package/src/components/RangePicker/index.tsx +144 -144
  47. package/src/components/RangePicker/styles.module.scss +19 -19
  48. package/src/components/TasksManager/AddModal/index.tsx +62 -62
  49. package/src/components/TasksManager/DeleteModal/index.tsx +22 -22
  50. package/src/components/TasksManager/EditModal/index.tsx +96 -96
  51. package/src/components/TasksManager/index.tsx +112 -112
  52. package/src/components/TasksManager/styles.module.scss +62 -62
  53. package/src/components/Week/Week.stories.tsx +49 -49
  54. package/src/components/Week/index.tsx +68 -68
  55. package/src/components/Week/styles.module.scss +7 -7
  56. package/src/components/WeekDay/WeekDay.stories.tsx +38 -38
  57. package/src/components/WeekDay/index.tsx +35 -35
  58. package/src/components/WeekDay/styles.module.scss +19 -19
  59. package/src/constants/dateMask.ts +23 -23
  60. package/src/constants/firstDayOfWeek.ts +7 -7
  61. package/src/constants/holidays.ts +32 -32
  62. package/src/constants/modes.ts +6 -6
  63. package/src/constants/monthsNames.ts +14 -14
  64. package/src/constants/weekdaysNames.ts +1 -1
  65. package/src/hooks/useCalendar.ts +62 -62
  66. package/src/hooks/useLockBodyScroll.ts +19 -19
  67. package/src/hooks/useModal.ts +45 -45
  68. package/src/hooks/useTooltip.ts +41 -41
  69. package/src/hooks/useValidate.ts +80 -80
  70. package/src/index.ts +15 -15
  71. package/src/services/calendarService.ts +62 -62
  72. package/src/services/decorators/withHolidays.ts +12 -12
  73. package/src/services/decorators/withMinMax.test.ts +77 -77
  74. package/src/services/decorators/withMinMax.ts +19 -19
  75. package/src/services/holidayService.ts +56 -56
  76. package/src/store/localStorage.ts +33 -33
  77. package/src/store/tasksStore.tsx +146 -146
  78. package/src/store/types.ts +22 -22
  79. package/src/stories/Button.stories.ts +54 -0
  80. package/src/stories/Button.tsx +37 -0
  81. package/src/stories/Configure.mdx +388 -0
  82. package/src/stories/Header.stories.ts +34 -0
  83. package/src/stories/Header.tsx +56 -0
  84. package/src/stories/Page.stories.ts +33 -0
  85. package/src/stories/Page.tsx +73 -0
  86. package/src/stories/assets/accessibility.png +0 -0
  87. package/src/stories/assets/accessibility.svg +1 -0
  88. package/src/stories/assets/addon-library.png +0 -0
  89. package/src/stories/assets/assets.png +0 -0
  90. package/src/stories/assets/avif-test-image.avif +0 -0
  91. package/src/stories/assets/context.png +0 -0
  92. package/src/stories/assets/discord.svg +1 -0
  93. package/src/stories/assets/docs.png +0 -0
  94. package/src/stories/assets/figma-plugin.png +0 -0
  95. package/src/stories/assets/github.svg +1 -0
  96. package/src/stories/assets/share.png +0 -0
  97. package/src/stories/assets/styling.png +0 -0
  98. package/src/stories/assets/testing.png +0 -0
  99. package/src/stories/assets/theming.png +0 -0
  100. package/src/stories/assets/tutorials.svg +1 -0
  101. package/src/stories/assets/youtube.svg +1 -0
  102. package/src/stories/button.css +30 -0
  103. package/src/stories/header.css +32 -0
  104. package/src/stories/page.css +68 -0
  105. package/src/styles/_border.scss +9 -9
  106. package/src/styles/_colors.scss +53 -53
  107. package/src/styles/_gap.scss +4 -4
  108. package/src/styles/_globals.scss +61 -61
  109. package/src/styles/_grid.scss +9 -9
  110. package/src/styles/_mixins.scss +6 -6
  111. package/src/styles/_reset.scss +98 -98
  112. package/src/styles/_theme-mixins.scss +51 -51
  113. package/src/styles/_typography.scss +10 -10
  114. package/src/styles/_variables.scss +8 -8
  115. package/src/styles/main.scss +3 -3
  116. package/src/types/types.d.ts +15 -15
  117. package/src/utils/calendar.test.ts +154 -154
  118. package/src/utils/calendar.ts +82 -82
  119. package/src/utils/controlDate.ts +3 -3
  120. package/src/utils/dateChecks.test.ts +216 -216
  121. package/src/utils/dateChecks.ts +75 -75
  122. package/src/utils/formatDate.ts +27 -27
  123. package/src/utils/schema.test.ts +40 -40
  124. package/src/utils/schema.ts +8 -8
  125. package/src/utils/weekdayOrder.test.ts +11 -11
  126. package/src/utils/weekdayOrder.ts +7 -7
  127. package/vitest.config.ts +38 -38
  128. package/vitest.shims.d.ts +1 -1
@@ -0,0 +1,32 @@
1
+ .storybook-header {
2
+ display: flex;
3
+ justify-content: space-between;
4
+ align-items: center;
5
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
6
+ padding: 15px 20px;
7
+ font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
8
+ }
9
+
10
+ .storybook-header svg {
11
+ display: inline-block;
12
+ vertical-align: top;
13
+ }
14
+
15
+ .storybook-header h1 {
16
+ display: inline-block;
17
+ vertical-align: top;
18
+ margin: 6px 0 6px 10px;
19
+ font-weight: 700;
20
+ font-size: 20px;
21
+ line-height: 1;
22
+ }
23
+
24
+ .storybook-header button + button {
25
+ margin-left: 10px;
26
+ }
27
+
28
+ .storybook-header .welcome {
29
+ margin-right: 10px;
30
+ color: #333;
31
+ font-size: 14px;
32
+ }
@@ -0,0 +1,68 @@
1
+ .storybook-page {
2
+ margin: 0 auto;
3
+ padding: 48px 20px;
4
+ max-width: 600px;
5
+ color: #333;
6
+ font-size: 14px;
7
+ line-height: 24px;
8
+ font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
9
+ }
10
+
11
+ .storybook-page h2 {
12
+ display: inline-block;
13
+ vertical-align: top;
14
+ margin: 0 0 4px;
15
+ font-weight: 700;
16
+ font-size: 32px;
17
+ line-height: 1;
18
+ }
19
+
20
+ .storybook-page p {
21
+ margin: 1em 0;
22
+ }
23
+
24
+ .storybook-page a {
25
+ color: inherit;
26
+ }
27
+
28
+ .storybook-page ul {
29
+ margin: 1em 0;
30
+ padding-left: 30px;
31
+ }
32
+
33
+ .storybook-page li {
34
+ margin-bottom: 8px;
35
+ }
36
+
37
+ .storybook-page .tip {
38
+ display: inline-block;
39
+ vertical-align: top;
40
+ margin-right: 10px;
41
+ border-radius: 1em;
42
+ background: #e7fdd8;
43
+ padding: 4px 12px;
44
+ color: #357a14;
45
+ font-weight: 700;
46
+ font-size: 11px;
47
+ line-height: 12px;
48
+ }
49
+
50
+ .storybook-page .tip-wrapper {
51
+ margin-top: 40px;
52
+ margin-bottom: 40px;
53
+ font-size: 13px;
54
+ line-height: 20px;
55
+ }
56
+
57
+ .storybook-page .tip-wrapper svg {
58
+ display: inline-block;
59
+ vertical-align: top;
60
+ margin-top: 3px;
61
+ margin-right: 4px;
62
+ width: 12px;
63
+ height: 12px;
64
+ }
65
+
66
+ .storybook-page .tip-wrapper svg path {
67
+ fill: #1ea7fd;
68
+ }
@@ -1,9 +1,9 @@
1
- $radius-8: 8px;
2
-
3
- $border-width: 1px;
4
- $border-solid: solid;
5
-
6
- @mixin border {
7
- border-style: $border-solid;
8
- border-width: $border-width;
9
- }
1
+ $radius-8: 8px;
2
+
3
+ $border-width: 1px;
4
+ $border-solid: solid;
5
+
6
+ @mixin border {
7
+ border-style: $border-solid;
8
+ border-width: $border-width;
9
+ }
@@ -1,53 +1,53 @@
1
- @use 'sass:map';
2
-
3
- $colors: (
4
- color-blue: #2f80ed,
5
- color-blue-60: #2f81ed93,
6
- color-blue-10: #2f81ed2a,
7
-
8
- color-white: #ffffff,
9
- color-black: #333333,
10
-
11
- color-red: #ff383c,
12
- color-green: #62d0a2,
13
- color-light-gray: #e1e1e1,
14
- color-gray: #aaaaaa,
15
- color-dark-gray: #2c314466,
16
- );
17
-
18
- @function color($key) {
19
- @return map.get($colors, $key);
20
- }
21
-
22
- $themes: (
23
- light: (
24
- border: color(color-light-gray),
25
- background: color(color-white),
26
- text: color(color-black),
27
- middle-blue: color(color-blue-60),
28
- light-blue: color(color-blue-10),
29
- blue: color(color-blue),
30
- disabled: color(color-gray),
31
- selected: color(color-blue),
32
- accent: color(color-red),
33
- marker: color(color-green),
34
- white-color: color(color-white),
35
- button-hover: color(color-blue-60),
36
- overlay: color(color-dark-gray),
37
- ),
38
- dark: (
39
- border: color(color-gray),
40
- background: color(color-black),
41
- text: color(color-white),
42
- middle-blue: color(color-blue-60),
43
- light-blue: color(color-blue-10),
44
- blue: color(color-blue),
45
- disabled: color(color-gray),
46
- selected: color(color-blue),
47
- accent: color(color-red),
48
- marker: color(color-green),
49
- white-color: color(color-light-gray),
50
- button-hover: color(color-gray),
51
- overlay: color(color-dark-gray),
52
- ),
53
- );
1
+ @use 'sass:map';
2
+
3
+ $colors: (
4
+ color-blue: #2f80ed,
5
+ color-blue-60: #2f81ed93,
6
+ color-blue-10: #2f81ed2a,
7
+
8
+ color-white: #ffffff,
9
+ color-black: #333333,
10
+
11
+ color-red: #ff383c,
12
+ color-green: #62d0a2,
13
+ color-light-gray: #e1e1e1,
14
+ color-gray: #aaaaaa,
15
+ color-dark-gray: #2c314466,
16
+ );
17
+
18
+ @function color($key) {
19
+ @return map.get($colors, $key);
20
+ }
21
+
22
+ $themes: (
23
+ light: (
24
+ border: color(color-light-gray),
25
+ background: color(color-white),
26
+ text: color(color-black),
27
+ middle-blue: color(color-blue-60),
28
+ light-blue: color(color-blue-10),
29
+ blue: color(color-blue),
30
+ disabled: color(color-gray),
31
+ selected: color(color-blue),
32
+ accent: color(color-red),
33
+ marker: color(color-green),
34
+ white-color: color(color-white),
35
+ button-hover: color(color-blue-60),
36
+ overlay: color(color-dark-gray),
37
+ ),
38
+ dark: (
39
+ border: color(color-gray),
40
+ background: color(color-black),
41
+ text: color(color-white),
42
+ middle-blue: color(color-blue-60),
43
+ light-blue: color(color-blue-10),
44
+ blue: color(color-blue),
45
+ disabled: color(color-gray),
46
+ selected: color(color-blue),
47
+ accent: color(color-red),
48
+ marker: color(color-green),
49
+ white-color: color(color-light-gray),
50
+ button-hover: color(color-gray),
51
+ overlay: color(color-dark-gray),
52
+ ),
53
+ );
@@ -1,4 +1,4 @@
1
- $gap-5: 5px;
2
- $gap-8: 8px;
3
- $gap-10: 10px;
4
- $gap-24: 24px;
1
+ $gap-5: 5px;
2
+ $gap-8: 8px;
3
+ $gap-10: 10px;
4
+ $gap-24: 24px;
@@ -1,61 +1,61 @@
1
- @use './colors' as *;
2
- @use './typography' as *;
3
- @use './border' as *;
4
- @use './variables' as *;
5
- @use './mixins' as *;
6
- @use './theme-mixins' as *;
7
-
8
- html {
9
- &.is-lock {
10
- overflow: hidden;
11
- }
12
- }
13
-
14
- body {
15
- font-weight: $font-weight-regular;
16
- font-family: $font-family-base;
17
- font-size: $font-size-14;
18
-
19
- @include themify($themes) {
20
- color: themed('text');
21
- background: themed('gradient');
22
- }
23
- }
24
-
25
- h1,
26
- h2 {
27
- margin: 0;
28
- }
29
-
30
- h1 {
31
- font-size: $font-size-15;
32
- font-weight: $font-weight-semibold;
33
- }
34
-
35
- h2 {
36
- font-weight: $font-weight-bold;
37
- }
38
-
39
- a,
40
- button,
41
- label,
42
- input,
43
- textarea,
44
- select,
45
- svg * {
46
- transition:
47
- color $transition-duration $easing,
48
- background-color $transition-duration $easing,
49
- border-color $transition-duration $easing,
50
- fill $transition-duration $easing,
51
- opacity $transition-duration $easing;
52
- }
53
-
54
- a,
55
- button {
56
- &:has(svg) {
57
- display: flex;
58
- justify-content: center;
59
- align-items: center;
60
- }
61
- }
1
+ @use './colors' as *;
2
+ @use './typography' as *;
3
+ @use './border' as *;
4
+ @use './variables' as *;
5
+ @use './mixins' as *;
6
+ @use './theme-mixins' as *;
7
+
8
+ html {
9
+ &.is-lock {
10
+ overflow: hidden;
11
+ }
12
+ }
13
+
14
+ body {
15
+ font-weight: $font-weight-regular;
16
+ font-family: $font-family-base;
17
+ font-size: $font-size-14;
18
+
19
+ @include themify($themes) {
20
+ color: themed('text');
21
+ background: themed('gradient');
22
+ }
23
+ }
24
+
25
+ h1,
26
+ h2 {
27
+ margin: 0;
28
+ }
29
+
30
+ h1 {
31
+ font-size: $font-size-15;
32
+ font-weight: $font-weight-semibold;
33
+ }
34
+
35
+ h2 {
36
+ font-weight: $font-weight-bold;
37
+ }
38
+
39
+ a,
40
+ button,
41
+ label,
42
+ input,
43
+ textarea,
44
+ select,
45
+ svg * {
46
+ transition:
47
+ color $transition-duration $easing,
48
+ background-color $transition-duration $easing,
49
+ border-color $transition-duration $easing,
50
+ fill $transition-duration $easing,
51
+ opacity $transition-duration $easing;
52
+ }
53
+
54
+ a,
55
+ button {
56
+ &:has(svg) {
57
+ display: flex;
58
+ justify-content: center;
59
+ align-items: center;
60
+ }
61
+ }
@@ -1,9 +1,9 @@
1
- @use './mixins' as *;
2
- @use './gap' as *;
3
-
4
- .grid {
5
- display: grid;
6
- width: 100%;
7
-
8
- grid-template-columns: repeat(7, 1fr);
9
- }
1
+ @use './mixins' as *;
2
+ @use './gap' as *;
3
+
4
+ .grid {
5
+ display: grid;
6
+ width: 100%;
7
+
8
+ grid-template-columns: repeat(7, 1fr);
9
+ }
@@ -1,6 +1,6 @@
1
- @use 'sass:map';
2
-
3
- @mixin square($size) {
4
- width: $size;
5
- height: $size;
6
- }
1
+ @use 'sass:map';
2
+
3
+ @mixin square($size) {
4
+ width: $size;
5
+ height: $size;
6
+ }
@@ -1,98 +1,98 @@
1
- *,
2
- ::before,
3
- ::after {
4
- box-sizing: border-box;
5
- }
6
-
7
- :where(ul, ol):where([class]) {
8
- padding-left: 0;
9
- }
10
-
11
- body,
12
- :where(blockquote, figure):where([class]) {
13
- margin: 0;
14
- }
15
-
16
- :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl):where([class]) {
17
- margin-block: 0;
18
- }
19
-
20
- :where(dd[class]) {
21
- margin-left: 0;
22
- }
23
-
24
- :where(fieldset[class]) {
25
- margin-left: 0;
26
- padding: 0;
27
- border: none;
28
- }
29
-
30
- :where(ul[class]) {
31
- list-style: none;
32
- }
33
-
34
- :where(address[class]) {
35
- font-style: normal;
36
- }
37
-
38
- p {
39
- margin-block: 0;
40
- }
41
-
42
- img,
43
- video {
44
- display: block;
45
- max-width: 100%;
46
- height: auto;
47
- }
48
-
49
- input,
50
- textarea,
51
- select,
52
- button {
53
- font: inherit;
54
- }
55
-
56
- html {
57
- height: 100%;
58
-
59
- scrollbar-gutter: stable;
60
- }
61
-
62
- html,
63
- :has(:target) {
64
- scroll-behavior: smooth;
65
- }
66
-
67
- body {
68
- min-height: 100%;
69
-
70
- line-height: 1.5;
71
- }
72
-
73
- a:where([class]) {
74
- display: inline-flex;
75
- }
76
-
77
- button,
78
- label {
79
- cursor: pointer;
80
- }
81
-
82
- [stroke] {
83
- stroke: currentColor;
84
- }
85
-
86
- svg * {
87
- transition-property: fill, stroke;
88
- }
89
-
90
- @media (prefers-reduced-motion: reduce) {
91
- *,
92
- ::before,
93
- ::after {
94
- animation-duration: 0.01ms !important;
95
- animation-iteration-count: 1 !important;
96
- scroll-behavior: auto !important;
97
- }
98
- }
1
+ *,
2
+ ::before,
3
+ ::after {
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ :where(ul, ol):where([class]) {
8
+ padding-left: 0;
9
+ }
10
+
11
+ body,
12
+ :where(blockquote, figure):where([class]) {
13
+ margin: 0;
14
+ }
15
+
16
+ :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl):where([class]) {
17
+ margin-block: 0;
18
+ }
19
+
20
+ :where(dd[class]) {
21
+ margin-left: 0;
22
+ }
23
+
24
+ :where(fieldset[class]) {
25
+ margin-left: 0;
26
+ padding: 0;
27
+ border: none;
28
+ }
29
+
30
+ :where(ul[class]) {
31
+ list-style: none;
32
+ }
33
+
34
+ :where(address[class]) {
35
+ font-style: normal;
36
+ }
37
+
38
+ p {
39
+ margin-block: 0;
40
+ }
41
+
42
+ img,
43
+ video {
44
+ display: block;
45
+ max-width: 100%;
46
+ height: auto;
47
+ }
48
+
49
+ input,
50
+ textarea,
51
+ select,
52
+ button {
53
+ font: inherit;
54
+ }
55
+
56
+ html {
57
+ height: 100%;
58
+
59
+ scrollbar-gutter: stable;
60
+ }
61
+
62
+ html,
63
+ :has(:target) {
64
+ scroll-behavior: smooth;
65
+ }
66
+
67
+ body {
68
+ min-height: 100%;
69
+
70
+ line-height: 1.5;
71
+ }
72
+
73
+ a:where([class]) {
74
+ display: inline-flex;
75
+ }
76
+
77
+ button,
78
+ label {
79
+ cursor: pointer;
80
+ }
81
+
82
+ [stroke] {
83
+ stroke: currentColor;
84
+ }
85
+
86
+ svg * {
87
+ transition-property: fill, stroke;
88
+ }
89
+
90
+ @media (prefers-reduced-motion: reduce) {
91
+ *,
92
+ ::before,
93
+ ::after {
94
+ animation-duration: 0.01ms !important;
95
+ animation-iteration-count: 1 !important;
96
+ scroll-behavior: auto !important;
97
+ }
98
+ }
@@ -1,51 +1,51 @@
1
- @use 'sass:map';
2
- @use './colors' as *;
3
-
4
- $theme-map: null;
5
-
6
- @mixin themify-modules($themes) {
7
- @each $theme, $map in $themes {
8
- :global(.theme-#{$theme}) & {
9
- $theme-map: () !global;
10
-
11
- @each $key, $value in $map {
12
- $theme-map: map.merge(
13
- $theme-map,
14
- (
15
- $key: $value,
16
- )
17
- ) !global;
18
- }
19
-
20
- @content;
21
-
22
- $theme-map: null !global;
23
- }
24
- }
25
- }
26
-
27
- @mixin themify($themes) {
28
- @each $theme, $map in $themes {
29
- .theme-#{$theme} & {
30
- $theme-map: () !global;
31
-
32
- @each $key, $submap in $map {
33
- $value: map.get(map.get($themes, $theme), $key);
34
- $theme-map: map.merge(
35
- $theme-map,
36
- (
37
- $key: $value,
38
- )
39
- ) !global;
40
- }
41
-
42
- @content;
43
-
44
- $theme-map: null !global;
45
- }
46
- }
47
- }
48
-
49
- @function themed($key) {
50
- @return map.get($theme-map, $key);
51
- }
1
+ @use 'sass:map';
2
+ @use './colors' as *;
3
+
4
+ $theme-map: null;
5
+
6
+ @mixin themify-modules($themes) {
7
+ @each $theme, $map in $themes {
8
+ :global(.theme-#{$theme}) & {
9
+ $theme-map: () !global;
10
+
11
+ @each $key, $value in $map {
12
+ $theme-map: map.merge(
13
+ $theme-map,
14
+ (
15
+ $key: $value,
16
+ )
17
+ ) !global;
18
+ }
19
+
20
+ @content;
21
+
22
+ $theme-map: null !global;
23
+ }
24
+ }
25
+ }
26
+
27
+ @mixin themify($themes) {
28
+ @each $theme, $map in $themes {
29
+ .theme-#{$theme} & {
30
+ $theme-map: () !global;
31
+
32
+ @each $key, $submap in $map {
33
+ $value: map.get(map.get($themes, $theme), $key);
34
+ $theme-map: map.merge(
35
+ $theme-map,
36
+ (
37
+ $key: $value,
38
+ )
39
+ ) !global;
40
+ }
41
+
42
+ @content;
43
+
44
+ $theme-map: null !global;
45
+ }
46
+ }
47
+ }
48
+
49
+ @function themed($key) {
50
+ @return map.get($theme-map, $key);
51
+ }