@central-design-system/components 2.30.0 → 3.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/dist/cds.css +1 -111
  2. package/dist/cds.d.ts +31 -0
  3. package/dist/cds.es.js +2159 -0
  4. package/dist/cds.umd.js +1 -0
  5. package/dist/components/CdsBadge/CdsBadge.vue.d.ts +32 -0
  6. package/dist/components/CdsButton/CdsButton.vue.d.ts +140 -0
  7. package/dist/components/CdsDrawer/CdsDrawer.vue.d.ts +179 -0
  8. package/dist/components/CdsGrid/CdsCol.vue.d.ts +73 -0
  9. package/dist/components/CdsGrid/CdsGrid.vue.d.ts +55 -0
  10. package/dist/components/CdsGrid/CdsRow.vue.d.ts +37 -0
  11. package/dist/components/CdsGrid/composable/column.d.ts +84 -0
  12. package/dist/components/CdsGrid/composable/grid.d.ts +24 -0
  13. package/dist/components/CdsGrid/composable/index.d.ts +4 -0
  14. package/dist/components/CdsGrid/composable/subgrid.d.ts +20 -0
  15. package/dist/components/CdsGrid/composable/wide.d.ts +12 -0
  16. package/dist/components/CdsGrid/mode/CSSGrid.d.ts +5 -0
  17. package/dist/components/CdsGrid/mode/FlexGrid.d.ts +5 -0
  18. package/dist/components/CdsGrid/types.d.ts +27 -0
  19. package/dist/components/CdsIcon/CdsIcon.vue.d.ts +44 -0
  20. package/dist/components/CdsIcon/index.d.ts +1 -0
  21. package/dist/components/CdsLink/CdsLink.vue.d.ts +50 -0
  22. package/dist/components/CdsList/CdsList.vue.d.ts +170 -0
  23. package/dist/components/CdsList/CdsListGroup.vue.d.ts +125 -0
  24. package/dist/components/CdsList/CdsListItem.vue.d.ts +172 -0
  25. package/dist/components/CdsList/composable/depth.d.ts +3 -0
  26. package/dist/components/CdsList/composable/index.d.ts +2 -0
  27. package/dist/components/CdsList/composable/list.d.ts +19 -0
  28. package/dist/components/CdsList/index.d.ts +3 -0
  29. package/dist/components/CdsLoader/CdsLoader.vue.d.ts +62 -0
  30. package/dist/components/CdsLoader/index.d.ts +1 -0
  31. package/dist/components/CdsStatus/CdsStatus.vue.d.ts +46 -0
  32. package/dist/components/CdsTag/CdsTag.vue.d.ts +96 -0
  33. package/dist/components/index.d.ts +18 -0
  34. package/dist/composable/appearance.d.ts +24 -0
  35. package/dist/composable/color.d.ts +21 -0
  36. package/dist/composable/dark.d.ts +19 -0
  37. package/dist/composable/disabled.d.ts +19 -0
  38. package/dist/composable/focus.d.ts +12 -0
  39. package/dist/composable/icon.d.ts +32 -0
  40. package/dist/composable/index.d.ts +17 -0
  41. package/dist/composable/items.d.ts +78 -0
  42. package/dist/composable/link.d.ts +36 -0
  43. package/dist/composable/loading.d.ts +19 -0
  44. package/dist/composable/nested/nested.d.ts +85 -0
  45. package/dist/composable/nested/openStrategies.d.ts +25 -0
  46. package/dist/composable/nested/selectStrategies.d.ts +21 -0
  47. package/dist/composable/proxyModel.d.ts +8 -0
  48. package/dist/composable/render.d.ts +2 -0
  49. package/dist/composable/size.d.ts +24 -0
  50. package/dist/composable/status.d.ts +21 -0
  51. package/dist/composable/tag.d.ts +16 -0
  52. package/dist/composable/text.d.ts +17 -0
  53. package/dist/composable/toggleScope.d.ts +2 -0
  54. package/dist/directives/index.d.ts +2 -0
  55. package/dist/plugins/index.d.ts +2 -0
  56. package/dist/shims-vue.d.ts +24 -0
  57. package/dist/transitions/createTransition.d.ts +9 -0
  58. package/dist/transitions/expandTransition.d.ts +19 -0
  59. package/dist/transitions/index.d.ts +14 -0
  60. package/dist/types/CdsOptions.d.ts +3 -0
  61. package/dist/utils/changeCase/lowerCase.d.ts +8 -0
  62. package/dist/utils/changeCase/noCase.d.ts +10 -0
  63. package/dist/utils/changeCase/paramCase.d.ts +3 -0
  64. package/dist/utils/changeCase/pascalCase.d.ts +5 -0
  65. package/dist/utils/getCurrentInstance.d.ts +13 -0
  66. package/dist/utils/helpers.d.ts +49 -0
  67. package/dist/utils/index.d.ts +7 -0
  68. package/dist/utils/propsFactory.d.ts +52 -0
  69. package/nuxt.js +13 -0
  70. package/package.json +37 -80
  71. package/src/scss/index.scss +10 -0
  72. package/{dist/mixins/scss → src/scss/mixins}/layout/_convert.scss +4 -2
  73. package/{dist/mixins/scss → src/scss/mixins}/layout/_layout.scss +0 -0
  74. package/{dist/mixins/scss → src/scss/mixins}/layout/_mini-unit.scss +0 -0
  75. package/{dist/mixins/scss → src/scss/mixins}/layout/_spacing.scss +0 -0
  76. package/src/scss/mixins/layout/exports/_mini-unit.module.scss +5 -0
  77. package/src/scss/mixins/layout/exports/_spacing-all.module.scss +3 -0
  78. package/src/scss/mixins/layout/exports/_spacing-fluid.module.scss +8 -0
  79. package/src/scss/mixins/layout/exports/_spacing-layout.module.scss +11 -0
  80. package/src/scss/mixins/layout/exports/_spacing.module.scss +16 -0
  81. package/{dist/mixins/scss → src/scss/mixins}/layout/index.scss +0 -2
  82. package/{dist/mixins/scss → src/scss/mixins}/motion.scss +0 -0
  83. package/{dist/mixins/scss → src/scss/mixins}/typo.scss +0 -67
  84. package/src/scss/modules/_reset.scss +113 -0
  85. package/src/scss/modules/_transition.scss +26 -0
  86. package/src/scss/modules/_typography.scss +36 -0
  87. package/src/scss/modules/_variables.scss +9 -0
  88. package/src/scss/modules/grid/_aspect-ratio.scss +62 -0
  89. package/src/scss/modules/grid/_breakpoint.scss +195 -0
  90. package/src/scss/modules/grid/_config.scss +88 -0
  91. package/src/scss/modules/grid/_css-grid.scss +445 -0
  92. package/src/scss/modules/grid/_flex-grid.scss +39 -0
  93. package/src/scss/modules/grid/_mixins.scss +307 -0
  94. package/src/scss/modules/grid/exports/_config.module.scss +9 -0
  95. package/src/scss/modules/grid/index.scss +5 -0
  96. package/src/scss/themes/b2b/tokens-map.scss +139 -0
  97. package/src/scss/themes/b2b/tokens.json +2190 -0
  98. package/{dist/tokens → src/scss/themes}/b2b/variables.css +0 -0
  99. package/src/scss/themes/cds/tokens-map.scss +138 -0
  100. package/src/scss/themes/cds/tokens.json +2184 -0
  101. package/{dist/tokens → src/scss/themes}/cds/variables.css +0 -1
  102. package/src/scss/themes/index.ts +43 -0
  103. package/src/scss/utility/display.scss +13 -0
  104. package/src/scss/utility/flexbox.scss +37 -0
  105. package/src/scss/utility/generatedFiles/generatedStyles.json +1 -0
  106. package/src/scss/utility/generatedFiles/generatedStyles.scss +300 -0
  107. package/src/scss/utility/index.scss +7 -0
  108. package/src/scss/utility/layout.scss +11 -0
  109. package/src/scss/utility/lists.scss +76 -0
  110. package/src/scss/utility/spacing.scss +89 -0
  111. package/src/scss/utility/typography.scss +16 -0
  112. package/src/scss/utility/variables.scss +116 -0
  113. package/README.md +0 -87
  114. package/build/utils/postInstall.js +0 -20
  115. package/build/utils/print.js +0 -38
  116. package/dist/CdsAccordion/index.js +0 -8
  117. package/dist/CdsAccordion/styles.css +0 -11
  118. package/dist/CdsBadge/index.js +0 -8
  119. package/dist/CdsBadge/styles.css +0 -9
  120. package/dist/CdsBreadcrumbs/index.js +0 -8
  121. package/dist/CdsBreadcrumbs/styles.css +0 -11
  122. package/dist/CdsButton/index.js +0 -8
  123. package/dist/CdsButton/styles.css +0 -11
  124. package/dist/CdsCheckbox/index.js +0 -8
  125. package/dist/CdsCheckbox/styles.css +0 -15
  126. package/dist/CdsCombobox/index.js +0 -8
  127. package/dist/CdsCombobox/styles.css +0 -15
  128. package/dist/CdsContainer/index.js +0 -8
  129. package/dist/CdsContainer/styles.css +0 -11
  130. package/dist/CdsContentSwitcher/index.js +0 -8
  131. package/dist/CdsContentSwitcher/styles.css +0 -15
  132. package/dist/CdsDataTable/index.js +0 -8
  133. package/dist/CdsDataTable/styles.css +0 -21
  134. package/dist/CdsDatePicker/index.js +0 -24
  135. package/dist/CdsDatePicker/styles.css +0 -15
  136. package/dist/CdsDrawer/index.js +0 -8
  137. package/dist/CdsDrawer/styles.css +0 -17
  138. package/dist/CdsDropdown/index.js +0 -8
  139. package/dist/CdsDropdown/styles.css +0 -15
  140. package/dist/CdsEmptyState/index.js +0 -8
  141. package/dist/CdsEmptyState/styles.css +0 -9
  142. package/dist/CdsFooter/index.js +0 -8
  143. package/dist/CdsFooter/styles.css +0 -17
  144. package/dist/CdsForm/index.js +0 -8
  145. package/dist/CdsForm/styles.css +0 -15
  146. package/dist/CdsGrid/index.js +0 -8
  147. package/dist/CdsGrid/styles.css +0 -9
  148. package/dist/CdsHeader/index.js +0 -8
  149. package/dist/CdsHeader/styles.css +0 -11
  150. package/dist/CdsIcon/index.js +0 -8
  151. package/dist/CdsIcon/styles.css +0 -9
  152. package/dist/CdsImage/index.js +0 -8
  153. package/dist/CdsImage/styles.css +0 -9
  154. package/dist/CdsInput/index.js +0 -8
  155. package/dist/CdsInput/styles.css +0 -13
  156. package/dist/CdsLink/index.js +0 -8
  157. package/dist/CdsLink/styles.css +0 -9
  158. package/dist/CdsList/index.js +0 -8
  159. package/dist/CdsList/styles.css +0 -9
  160. package/dist/CdsLoading/index.js +0 -8
  161. package/dist/CdsLoading/styles.css +0 -9
  162. package/dist/CdsModal/index.js +0 -8
  163. package/dist/CdsModal/styles.css +0 -15
  164. package/dist/CdsMultiselect/index.js +0 -8
  165. package/dist/CdsMultiselect/styles.css +0 -17
  166. package/dist/CdsNotification/index.js +0 -8
  167. package/dist/CdsNotification/styles.css +0 -21
  168. package/dist/CdsOverflowMenu/index.js +0 -8
  169. package/dist/CdsOverflowMenu/styles.css +0 -21
  170. package/dist/CdsPagination/index.js +0 -8
  171. package/dist/CdsPagination/styles.css +0 -13
  172. package/dist/CdsRadioButton/index.js +0 -8
  173. package/dist/CdsRadioButton/styles.css +0 -15
  174. package/dist/CdsSearch/index.js +0 -8
  175. package/dist/CdsSearch/styles.css +0 -19
  176. package/dist/CdsSelect/index.js +0 -8
  177. package/dist/CdsSelect/styles.css +0 -15
  178. package/dist/CdsSidebar/index.js +0 -8
  179. package/dist/CdsSidebar/styles.css +0 -15
  180. package/dist/CdsSkeleton/index.js +0 -8
  181. package/dist/CdsSkeleton/styles.css +0 -9
  182. package/dist/CdsStages/index.js +0 -8
  183. package/dist/CdsStages/styles.css +0 -9
  184. package/dist/CdsStatus/index.js +0 -8
  185. package/dist/CdsStatus/styles.css +0 -15
  186. package/dist/CdsSteps/index.js +0 -8
  187. package/dist/CdsSteps/styles.css +0 -19
  188. package/dist/CdsTable/index.js +0 -16
  189. package/dist/CdsTable/styles.css +0 -21
  190. package/dist/CdsTabs/index.js +0 -8
  191. package/dist/CdsTabs/styles.css +0 -9
  192. package/dist/CdsTag/index.js +0 -8
  193. package/dist/CdsTag/styles.css +0 -11
  194. package/dist/CdsTextArea/index.js +0 -8
  195. package/dist/CdsTextArea/styles.css +0 -17
  196. package/dist/CdsTextInput/index.js +0 -8
  197. package/dist/CdsTextInput/styles.css +0 -15
  198. package/dist/CdsToggle/index.js +0 -8
  199. package/dist/CdsToggle/styles.css +0 -9
  200. package/dist/CdsTooltip/index.js +0 -8
  201. package/dist/CdsTooltip/styles.css +0 -13
  202. package/dist/CdsUploader/index.js +0 -14
  203. package/dist/CdsUploader/styles.css +0 -25
  204. package/dist/cds.js +0 -38
  205. package/dist/cds.min.css +0 -7
  206. package/dist/cds.min.js +0 -38
  207. package/dist/index.html +0 -60
  208. package/dist/mixins/scss/layout/_breakpoint.scss +0 -237
  209. package/dist/mixins/scss/layout/_key-height.scss +0 -90
  210. package/dist/mixins/scss/layout/_spacing-export.scss +0 -34
  211. package/dist/mixins/scss/layout/_utilities.scss +0 -33
  212. package/dist/types/CdsAccordion.ts +0 -4
  213. package/dist/types/CdsAccordionItem.ts +0 -10
  214. package/dist/types/CdsBreadcrumbs.ts +0 -11
  215. package/dist/types/CdsBreadcrumbsItem.ts +0 -12
  216. package/dist/types/CdsButton.ts +0 -30
  217. package/dist/types/CdsCheckbox.ts +0 -20
  218. package/dist/types/CdsCheckboxGroup.ts +0 -14
  219. package/dist/types/CdsCol.ts +0 -38
  220. package/dist/types/CdsCombobox.ts +0 -42
  221. package/dist/types/CdsContainer.ts +0 -32
  222. package/dist/types/CdsContentSwitcher.ts +0 -4
  223. package/dist/types/CdsContentSwitcherButton.ts +0 -21
  224. package/dist/types/CdsDataTable.ts +0 -48
  225. package/dist/types/CdsDatePicker.ts +0 -40
  226. package/dist/types/CdsDrawer.ts +0 -25
  227. package/dist/types/CdsDrawerGroup.ts +0 -8
  228. package/dist/types/CdsDrawerItem.ts +0 -12
  229. package/dist/types/CdsDrawerLabel.ts +0 -4
  230. package/dist/types/CdsDropdown.ts +0 -14
  231. package/dist/types/CdsEmptyState.ts +0 -10
  232. package/dist/types/CdsFooter.ts +0 -17
  233. package/dist/types/CdsFooterService.ts +0 -16
  234. package/dist/types/CdsForm.ts +0 -4
  235. package/dist/types/CdsFormGroup.ts +0 -8
  236. package/dist/types/CdsFormItem.ts +0 -4
  237. package/dist/types/CdsGrid.ts +0 -16
  238. package/dist/types/CdsHeader.ts +0 -27
  239. package/dist/types/CdsHeaderService.ts +0 -4
  240. package/dist/types/CdsIcon.ts +0 -6
  241. package/dist/types/CdsLink.ts +0 -22
  242. package/dist/types/CdsList.ts +0 -6
  243. package/dist/types/CdsLoading.ts +0 -14
  244. package/dist/types/CdsModal.ts +0 -17
  245. package/dist/types/CdsMultiselect.ts +0 -33
  246. package/dist/types/CdsNotification.ts +0 -22
  247. package/dist/types/CdsOverflowMenu.ts +0 -16
  248. package/dist/types/CdsPagination.ts +0 -12
  249. package/dist/types/CdsRadioButton.ts +0 -29
  250. package/dist/types/CdsRow.ts +0 -18
  251. package/dist/types/CdsSearch.ts +0 -24
  252. package/dist/types/CdsSelect.ts +0 -37
  253. package/dist/types/CdsSkeleton.ts +0 -14
  254. package/dist/types/CdsStages.ts +0 -10
  255. package/dist/types/CdsStatus.ts +0 -22
  256. package/dist/types/CdsSteps.ts +0 -22
  257. package/dist/types/CdsStepsItem.ts +0 -12
  258. package/dist/types/CdsTable.ts +0 -46
  259. package/dist/types/CdsTabs.ts +0 -19
  260. package/dist/types/CdsTabsItem.ts +0 -18
  261. package/dist/types/CdsTag.ts +0 -20
  262. package/dist/types/CdsTextArea.ts +0 -26
  263. package/dist/types/CdsTextInput.ts +0 -32
  264. package/dist/types/CdsToggle.ts +0 -18
  265. package/dist/types/CdsTooltip.ts +0 -18
  266. package/dist/types/CdsTooltipDefinition.ts +0 -16
  267. package/dist/types/CdsTooltipInteractive.ts +0 -11
  268. package/dist/types/CdsUploader.ts +0 -44
  269. package/dist/types/Sidebar.ts +0 -17
  270. package/dist/types/types.ts +0 -2
  271. package/dist/utils/convertRemToPx.js +0 -9
  272. package/dist/utils/deepFind.js +0 -14
  273. package/dist/utils/expiringStorage.js +0 -28
  274. package/dist/utils/helpers.js +0 -33
  275. package/dist/utils/index.js +0 -1
  276. package/dist/utils/isCorrectTag.js +0 -5
  277. package/dist/utils/isRightProps.js +0 -5
  278. package/dist/utils/memoize.js +0 -8
  279. package/dist/utils/suffixPropName.js +0 -12
  280. package/dist/utils/test/deepFind.test.js +0 -18
  281. package/dist/utils/test/isCorrectTag.test.js +0 -9
  282. package/dist/utils/test/isCorrectTagDataSet.js +0 -51
  283. package/dist/utils/validationProps.js +0 -7
@@ -0,0 +1,195 @@
1
+ @use 'sass:list';
2
+ @use 'sass:map';
3
+ @use 'sass:meta';
4
+ @use 'config' as *;
5
+ @use '../../mixins/layout/convert';
6
+
7
+ /// Generate a media query from the width of the given breakpoint to infinity
8
+ /// @param {String | Number} $name
9
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
10
+ /// @content
11
+ /// @access public
12
+ /// @group @cds/layout
13
+ @mixin cds-breakpoint-up($name, $breakpoints: $grid-breakpoints) {
14
+ @if meta.type-of($name) == 'number' {
15
+ @media (min-width: $name) {
16
+ @content;
17
+ }
18
+ } @else if map.has-key($breakpoints, $name) {
19
+ $breakpoint: map.get($breakpoints, $name);
20
+ $width: map.get($breakpoint, width);
21
+
22
+ @if is-smallest-breakpoint($name, $breakpoints) {
23
+ @content;
24
+ } @else {
25
+ @media (min-width: $width) {
26
+ @content;
27
+ }
28
+ }
29
+ } @else {
30
+ @error 'Unable to find a breakpoint with name `#{$name}`. Expected one of: (#{map.keys($breakpoints)})';
31
+ }
32
+ }
33
+
34
+ /// Generate a media query for the maximum width of the given styles
35
+ /// @param {String | Number} $name
36
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
37
+ /// @content
38
+ /// @access public
39
+ /// @group @cds/layout
40
+ @mixin cds-breakpoint-down($name, $breakpoints: $grid-breakpoints) {
41
+ @if meta.type-of($name) == 'number' {
42
+ @media (max-width: $name) {
43
+ @content;
44
+ }
45
+ } @else if map.has-key($breakpoints, $name) {
46
+ // We borrow this logic from bootstrap for specifying the value of the
47
+ // max-width. The maximum width is calculated by finding the breakpoint and
48
+ // subtracting .02 from its value. This value is used instead of .01 to
49
+ // avoid rounding issues in Safari
50
+ // https://github.com/twbs/bootstrap/blob/c5b1919deaf5393fcca9e9b9d7ce9c338160d99d/scss/mixins/_breakpoints.scss#L34-L46
51
+ $breakpoint: map.get($breakpoints, $name);
52
+ $width: map.get($breakpoint, width) - 0.02;
53
+
54
+ @media (max-width: $width) {
55
+ @content;
56
+ }
57
+ } @else {
58
+ @error 'Unable to find a breakpoint with name `#{$name}`. Expected one of: (#{map.keys($breakpoints)})';
59
+ }
60
+ }
61
+
62
+ /// Generate a media query for the range between the lower and upper breakpoints
63
+ /// @param {String | Number} $lower
64
+ /// @param {String | Number} $upper
65
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
66
+ /// @content
67
+ /// @access public
68
+ /// @group @cds/layout
69
+ @mixin cds-breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {
70
+ $is-number-lower: meta.type-of($lower) == 'number';
71
+ $is-number-upper: meta.type-of($upper) == 'number';
72
+ $min: if($is-number-lower, $lower, map.get($breakpoints, $lower));
73
+ $max: if($is-number-upper, $upper, map.get($breakpoints, $upper));
74
+
75
+ @if $min and $max {
76
+ $min-width: if(not $is-number-lower and $min, map.get($min, width), $min);
77
+ $max-width: if(not $is-number-upper and $max, map.get($max, width), $max);
78
+
79
+ @media (min-width: $min-width) and (max-width: $max-width) {
80
+ @content;
81
+ }
82
+ } @else if $min != null and $max == null {
83
+ @include cds-breakpoint-up($lower, $breakpoints) {
84
+ @content;
85
+ }
86
+ } @else if $min == null and $max != null {
87
+ @include cds-breakpoint-down($upper, $breakpoints) {
88
+ @content;
89
+ }
90
+ } @else {
91
+ @error 'Unable to find a breakpoint to satisfy: (#{$lower},#{$upper}). Expected both to be one of (#{map.keys($breakpoints)}).';
92
+ }
93
+ }
94
+
95
+ /// Generate a media query for a given breakpoint
96
+ /// @param {String | Number} $name
97
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
98
+ /// @content
99
+ /// @access public
100
+ /// @group @cds/layout
101
+ @mixin cds-breakpoint($name, $breakpoints: $grid-breakpoints) {
102
+ @include cds-breakpoint-up($name, $breakpoints) {
103
+ @content;
104
+ }
105
+ }
106
+
107
+ /// Generate media query for the largest breakpoint
108
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
109
+ /// @content
110
+ /// @access public
111
+ /// @group @cds/layout
112
+ @mixin cds-largest-breakpoint($breakpoints: $grid-breakpoints) {
113
+ @include cds-breakpoint(largest-breakpoint-name()) {
114
+ @content;
115
+ }
116
+ }
117
+
118
+ /// Provide a map and index, and get back the relevant key value
119
+ /// @access private
120
+ /// @param {Map} $map - Map
121
+ /// @param {Integer} $index - Key chain
122
+ /// @return {String} Desired value
123
+ /// @group @cds/layout
124
+ @function -key-by-index($map, $index) {
125
+ $keys: map.keys($map);
126
+ @return nth($keys, $index);
127
+ }
128
+
129
+ /// Get the value of the next breakpoint, or null for the last breakpoint
130
+ /// @param {String} $name - The name of the breakpoint
131
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name of the breakpoint and the value is the values for the breakpoint
132
+ /// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
133
+ /// @return {String}
134
+ /// @access public
135
+ /// @group @cds/layout
136
+ @function breakpoint-next(
137
+ $name,
138
+ $breakpoints: $grid-breakpoints,
139
+ $breakpoint-names: map.keys($breakpoints)
140
+ ) {
141
+ $n: list.index($breakpoint-names, $name);
142
+ @if $n != null and $n < list.length($breakpoint-names) {
143
+ @return list.nth($breakpoint-names, $n + 1);
144
+ }
145
+ @return null;
146
+ }
147
+
148
+ /// Get the value of the previous breakpoint, or null for the first breakpoint
149
+ /// @param {String} $name - The name of the breakpoint
150
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name of the breakpoint and the value is the values for the breakpoint
151
+ /// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
152
+ /// @return {String}
153
+ /// @access public
154
+ /// @group @cds/layout
155
+ @function breakpoint-prev(
156
+ $name,
157
+ $breakpoints: $grid-breakpoints,
158
+ $breakpoint-names: map.keys($breakpoints)
159
+ ) {
160
+ $n: list.index($breakpoint-names, $name);
161
+ @if $n != null and $n > 1 {
162
+ @return list.nth($breakpoint-names, $n - 1);
163
+ }
164
+ @return null;
165
+ }
166
+
167
+ /// Check to see if the given breakpoint name
168
+ /// @param {String} $name - The name of the breakpoint
169
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name of the breakpoint and the value is the values for the breakpoint
170
+ /// @return {Bool}
171
+ /// @access public
172
+ /// @group @cds/layout
173
+ @function is-smallest-breakpoint($name, $breakpoints: $grid-breakpoints) {
174
+ $n: list.index(map.keys($breakpoints), $name);
175
+ @return $n == 1;
176
+ }
177
+
178
+ /// Returns the largest breakpoint name
179
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
180
+ /// @return {String}
181
+ /// @access public
182
+ /// @group @cds/layout
183
+ @function largest-breakpoint-name($breakpoints: $grid-breakpoints) {
184
+ $total-breakpoints: list.length($breakpoints);
185
+ @return -key-by-index($breakpoints, $total-breakpoints);
186
+ }
187
+
188
+ /// Get the infix for a given breakpoint in a list of breakpoints. Useful for generating the size part in a selector, for example: `.prefix--col-sm-2`.
189
+ /// @param {String} $name - The name of the breakpoint
190
+ /// @return {String}
191
+ /// @access public
192
+ /// @group @cds/layout
193
+ @function breakpoint-infix($name) {
194
+ @return '-#{$name}';
195
+ }
@@ -0,0 +1,88 @@
1
+ @use 'sass:map';
2
+ @use '../../mixins/layout/convert';
3
+
4
+ /// Namespace prefix
5
+ /// @type String
6
+ /// @access public
7
+ /// @group @cds/grid
8
+ $prefix: 'cds' !default;
9
+
10
+ /// Total columns used in the flex grid
11
+ /// @type Number
12
+ /// @access public
13
+ /// @group @cds/grid
14
+ $flex-grid-columns: 16 !default;
15
+
16
+ /// Gutter size in rem
17
+ /// @type Number
18
+ /// @access public
19
+ /// @group @cds/layout
20
+ $grid-gutter: convert.toRem(32px) !default;
21
+
22
+ /// Condensed gutter size in rem
23
+ /// @type Number
24
+ /// @access public
25
+ /// @group @cds/layout
26
+ $grid-gutter-condensed: convert.toRem(1px) !default;
27
+
28
+ // Initial map of our breakpoints and their values
29
+ /// @type Map
30
+ /// @access public
31
+ /// @group @cds/layout
32
+ $grid-breakpoints: (
33
+ xs: (
34
+ columns: 4,
35
+ margin: 0,
36
+ width: convert.toRem(320px),
37
+ ),
38
+ sm: (
39
+ columns: 8,
40
+ margin: convert.toRem(16px),
41
+ width: convert.toRem(672px),
42
+ ),
43
+ md: (
44
+ columns: 16,
45
+ margin: convert.toRem(16px),
46
+ width: convert.toRem(1056px),
47
+ ),
48
+ lg: (
49
+ columns: 16,
50
+ margin: convert.toRem(16px),
51
+ width: convert.toRem(1312px),
52
+ ),
53
+ xl: (
54
+ columns: 16,
55
+ margin: convert.toRem(24px),
56
+ width: convert.toRem(1584px),
57
+ ),
58
+ ) !default;
59
+
60
+ @if $flex-grid-columns == 12 {
61
+ $grid-breakpoints: map.merge(
62
+ $grid-breakpoints,
63
+ (
64
+ md: map.merge(
65
+ map.get($grid-breakpoints, md),
66
+ (
67
+ columns: 12,
68
+ )
69
+ )
70
+ ),
71
+ (
72
+ lg: map.merge(
73
+ map.get($grid-breakpoints, lg),
74
+ (
75
+ columns: 12,
76
+ )
77
+ )
78
+ ),
79
+ (
80
+ xl: map.merge(
81
+ map.get($grid-breakpoints, xl),
82
+ (
83
+ columns: 12,
84
+ )
85
+ )
86
+ )
87
+ );
88
+ }