@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.
- package/dist/cds.css +1 -111
- package/dist/cds.d.ts +31 -0
- package/dist/cds.es.js +2159 -0
- package/dist/cds.umd.js +1 -0
- package/dist/components/CdsBadge/CdsBadge.vue.d.ts +32 -0
- package/dist/components/CdsButton/CdsButton.vue.d.ts +140 -0
- package/dist/components/CdsDrawer/CdsDrawer.vue.d.ts +179 -0
- package/dist/components/CdsGrid/CdsCol.vue.d.ts +73 -0
- package/dist/components/CdsGrid/CdsGrid.vue.d.ts +55 -0
- package/dist/components/CdsGrid/CdsRow.vue.d.ts +37 -0
- package/dist/components/CdsGrid/composable/column.d.ts +84 -0
- package/dist/components/CdsGrid/composable/grid.d.ts +24 -0
- package/dist/components/CdsGrid/composable/index.d.ts +4 -0
- package/dist/components/CdsGrid/composable/subgrid.d.ts +20 -0
- package/dist/components/CdsGrid/composable/wide.d.ts +12 -0
- package/dist/components/CdsGrid/mode/CSSGrid.d.ts +5 -0
- package/dist/components/CdsGrid/mode/FlexGrid.d.ts +5 -0
- package/dist/components/CdsGrid/types.d.ts +27 -0
- package/dist/components/CdsIcon/CdsIcon.vue.d.ts +44 -0
- package/dist/components/CdsIcon/index.d.ts +1 -0
- package/dist/components/CdsLink/CdsLink.vue.d.ts +50 -0
- package/dist/components/CdsList/CdsList.vue.d.ts +170 -0
- package/dist/components/CdsList/CdsListGroup.vue.d.ts +125 -0
- package/dist/components/CdsList/CdsListItem.vue.d.ts +172 -0
- package/dist/components/CdsList/composable/depth.d.ts +3 -0
- package/dist/components/CdsList/composable/index.d.ts +2 -0
- package/dist/components/CdsList/composable/list.d.ts +19 -0
- package/dist/components/CdsList/index.d.ts +3 -0
- package/dist/components/CdsLoader/CdsLoader.vue.d.ts +62 -0
- package/dist/components/CdsLoader/index.d.ts +1 -0
- package/dist/components/CdsStatus/CdsStatus.vue.d.ts +46 -0
- package/dist/components/CdsTag/CdsTag.vue.d.ts +96 -0
- package/dist/components/index.d.ts +18 -0
- package/dist/composable/appearance.d.ts +24 -0
- package/dist/composable/color.d.ts +21 -0
- package/dist/composable/dark.d.ts +19 -0
- package/dist/composable/disabled.d.ts +19 -0
- package/dist/composable/focus.d.ts +12 -0
- package/dist/composable/icon.d.ts +32 -0
- package/dist/composable/index.d.ts +17 -0
- package/dist/composable/items.d.ts +78 -0
- package/dist/composable/link.d.ts +36 -0
- package/dist/composable/loading.d.ts +19 -0
- package/dist/composable/nested/nested.d.ts +85 -0
- package/dist/composable/nested/openStrategies.d.ts +25 -0
- package/dist/composable/nested/selectStrategies.d.ts +21 -0
- package/dist/composable/proxyModel.d.ts +8 -0
- package/dist/composable/render.d.ts +2 -0
- package/dist/composable/size.d.ts +24 -0
- package/dist/composable/status.d.ts +21 -0
- package/dist/composable/tag.d.ts +16 -0
- package/dist/composable/text.d.ts +17 -0
- package/dist/composable/toggleScope.d.ts +2 -0
- package/dist/directives/index.d.ts +2 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/shims-vue.d.ts +24 -0
- package/dist/transitions/createTransition.d.ts +9 -0
- package/dist/transitions/expandTransition.d.ts +19 -0
- package/dist/transitions/index.d.ts +14 -0
- package/dist/types/CdsOptions.d.ts +3 -0
- package/dist/utils/changeCase/lowerCase.d.ts +8 -0
- package/dist/utils/changeCase/noCase.d.ts +10 -0
- package/dist/utils/changeCase/paramCase.d.ts +3 -0
- package/dist/utils/changeCase/pascalCase.d.ts +5 -0
- package/dist/utils/getCurrentInstance.d.ts +13 -0
- package/dist/utils/helpers.d.ts +49 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/propsFactory.d.ts +52 -0
- package/nuxt.js +13 -0
- package/package.json +37 -80
- package/src/scss/index.scss +10 -0
- package/{dist/mixins/scss → src/scss/mixins}/layout/_convert.scss +4 -2
- package/{dist/mixins/scss → src/scss/mixins}/layout/_layout.scss +0 -0
- package/{dist/mixins/scss → src/scss/mixins}/layout/_mini-unit.scss +0 -0
- package/{dist/mixins/scss → src/scss/mixins}/layout/_spacing.scss +0 -0
- package/src/scss/mixins/layout/exports/_mini-unit.module.scss +5 -0
- package/src/scss/mixins/layout/exports/_spacing-all.module.scss +3 -0
- package/src/scss/mixins/layout/exports/_spacing-fluid.module.scss +8 -0
- package/src/scss/mixins/layout/exports/_spacing-layout.module.scss +11 -0
- package/src/scss/mixins/layout/exports/_spacing.module.scss +16 -0
- package/{dist/mixins/scss → src/scss/mixins}/layout/index.scss +0 -2
- package/{dist/mixins/scss → src/scss/mixins}/motion.scss +0 -0
- package/{dist/mixins/scss → src/scss/mixins}/typo.scss +0 -67
- package/src/scss/modules/_reset.scss +113 -0
- package/src/scss/modules/_transition.scss +26 -0
- package/src/scss/modules/_typography.scss +36 -0
- package/src/scss/modules/_variables.scss +9 -0
- package/src/scss/modules/grid/_aspect-ratio.scss +62 -0
- package/src/scss/modules/grid/_breakpoint.scss +195 -0
- package/src/scss/modules/grid/_config.scss +88 -0
- package/src/scss/modules/grid/_css-grid.scss +445 -0
- package/src/scss/modules/grid/_flex-grid.scss +39 -0
- package/src/scss/modules/grid/_mixins.scss +307 -0
- package/src/scss/modules/grid/exports/_config.module.scss +9 -0
- package/src/scss/modules/grid/index.scss +5 -0
- package/src/scss/themes/b2b/tokens-map.scss +139 -0
- package/src/scss/themes/b2b/tokens.json +2190 -0
- package/{dist/tokens → src/scss/themes}/b2b/variables.css +0 -0
- package/src/scss/themes/cds/tokens-map.scss +138 -0
- package/src/scss/themes/cds/tokens.json +2184 -0
- package/{dist/tokens → src/scss/themes}/cds/variables.css +0 -1
- package/src/scss/themes/index.ts +43 -0
- package/src/scss/utility/display.scss +13 -0
- package/src/scss/utility/flexbox.scss +37 -0
- package/src/scss/utility/generatedFiles/generatedStyles.json +1 -0
- package/src/scss/utility/generatedFiles/generatedStyles.scss +300 -0
- package/src/scss/utility/index.scss +7 -0
- package/src/scss/utility/layout.scss +11 -0
- package/src/scss/utility/lists.scss +76 -0
- package/src/scss/utility/spacing.scss +89 -0
- package/src/scss/utility/typography.scss +16 -0
- package/src/scss/utility/variables.scss +116 -0
- package/README.md +0 -87
- package/build/utils/postInstall.js +0 -20
- package/build/utils/print.js +0 -38
- package/dist/CdsAccordion/index.js +0 -8
- package/dist/CdsAccordion/styles.css +0 -11
- package/dist/CdsBadge/index.js +0 -8
- package/dist/CdsBadge/styles.css +0 -9
- package/dist/CdsBreadcrumbs/index.js +0 -8
- package/dist/CdsBreadcrumbs/styles.css +0 -11
- package/dist/CdsButton/index.js +0 -8
- package/dist/CdsButton/styles.css +0 -11
- package/dist/CdsCheckbox/index.js +0 -8
- package/dist/CdsCheckbox/styles.css +0 -15
- package/dist/CdsCombobox/index.js +0 -8
- package/dist/CdsCombobox/styles.css +0 -15
- package/dist/CdsContainer/index.js +0 -8
- package/dist/CdsContainer/styles.css +0 -11
- package/dist/CdsContentSwitcher/index.js +0 -8
- package/dist/CdsContentSwitcher/styles.css +0 -15
- package/dist/CdsDataTable/index.js +0 -8
- package/dist/CdsDataTable/styles.css +0 -21
- package/dist/CdsDatePicker/index.js +0 -24
- package/dist/CdsDatePicker/styles.css +0 -15
- package/dist/CdsDrawer/index.js +0 -8
- package/dist/CdsDrawer/styles.css +0 -17
- package/dist/CdsDropdown/index.js +0 -8
- package/dist/CdsDropdown/styles.css +0 -15
- package/dist/CdsEmptyState/index.js +0 -8
- package/dist/CdsEmptyState/styles.css +0 -9
- package/dist/CdsFooter/index.js +0 -8
- package/dist/CdsFooter/styles.css +0 -17
- package/dist/CdsForm/index.js +0 -8
- package/dist/CdsForm/styles.css +0 -15
- package/dist/CdsGrid/index.js +0 -8
- package/dist/CdsGrid/styles.css +0 -9
- package/dist/CdsHeader/index.js +0 -8
- package/dist/CdsHeader/styles.css +0 -11
- package/dist/CdsIcon/index.js +0 -8
- package/dist/CdsIcon/styles.css +0 -9
- package/dist/CdsImage/index.js +0 -8
- package/dist/CdsImage/styles.css +0 -9
- package/dist/CdsInput/index.js +0 -8
- package/dist/CdsInput/styles.css +0 -13
- package/dist/CdsLink/index.js +0 -8
- package/dist/CdsLink/styles.css +0 -9
- package/dist/CdsList/index.js +0 -8
- package/dist/CdsList/styles.css +0 -9
- package/dist/CdsLoading/index.js +0 -8
- package/dist/CdsLoading/styles.css +0 -9
- package/dist/CdsModal/index.js +0 -8
- package/dist/CdsModal/styles.css +0 -15
- package/dist/CdsMultiselect/index.js +0 -8
- package/dist/CdsMultiselect/styles.css +0 -17
- package/dist/CdsNotification/index.js +0 -8
- package/dist/CdsNotification/styles.css +0 -21
- package/dist/CdsOverflowMenu/index.js +0 -8
- package/dist/CdsOverflowMenu/styles.css +0 -21
- package/dist/CdsPagination/index.js +0 -8
- package/dist/CdsPagination/styles.css +0 -13
- package/dist/CdsRadioButton/index.js +0 -8
- package/dist/CdsRadioButton/styles.css +0 -15
- package/dist/CdsSearch/index.js +0 -8
- package/dist/CdsSearch/styles.css +0 -19
- package/dist/CdsSelect/index.js +0 -8
- package/dist/CdsSelect/styles.css +0 -15
- package/dist/CdsSidebar/index.js +0 -8
- package/dist/CdsSidebar/styles.css +0 -15
- package/dist/CdsSkeleton/index.js +0 -8
- package/dist/CdsSkeleton/styles.css +0 -9
- package/dist/CdsStages/index.js +0 -8
- package/dist/CdsStages/styles.css +0 -9
- package/dist/CdsStatus/index.js +0 -8
- package/dist/CdsStatus/styles.css +0 -15
- package/dist/CdsSteps/index.js +0 -8
- package/dist/CdsSteps/styles.css +0 -19
- package/dist/CdsTable/index.js +0 -16
- package/dist/CdsTable/styles.css +0 -21
- package/dist/CdsTabs/index.js +0 -8
- package/dist/CdsTabs/styles.css +0 -9
- package/dist/CdsTag/index.js +0 -8
- package/dist/CdsTag/styles.css +0 -11
- package/dist/CdsTextArea/index.js +0 -8
- package/dist/CdsTextArea/styles.css +0 -17
- package/dist/CdsTextInput/index.js +0 -8
- package/dist/CdsTextInput/styles.css +0 -15
- package/dist/CdsToggle/index.js +0 -8
- package/dist/CdsToggle/styles.css +0 -9
- package/dist/CdsTooltip/index.js +0 -8
- package/dist/CdsTooltip/styles.css +0 -13
- package/dist/CdsUploader/index.js +0 -14
- package/dist/CdsUploader/styles.css +0 -25
- package/dist/cds.js +0 -38
- package/dist/cds.min.css +0 -7
- package/dist/cds.min.js +0 -38
- package/dist/index.html +0 -60
- package/dist/mixins/scss/layout/_breakpoint.scss +0 -237
- package/dist/mixins/scss/layout/_key-height.scss +0 -90
- package/dist/mixins/scss/layout/_spacing-export.scss +0 -34
- package/dist/mixins/scss/layout/_utilities.scss +0 -33
- package/dist/types/CdsAccordion.ts +0 -4
- package/dist/types/CdsAccordionItem.ts +0 -10
- package/dist/types/CdsBreadcrumbs.ts +0 -11
- package/dist/types/CdsBreadcrumbsItem.ts +0 -12
- package/dist/types/CdsButton.ts +0 -30
- package/dist/types/CdsCheckbox.ts +0 -20
- package/dist/types/CdsCheckboxGroup.ts +0 -14
- package/dist/types/CdsCol.ts +0 -38
- package/dist/types/CdsCombobox.ts +0 -42
- package/dist/types/CdsContainer.ts +0 -32
- package/dist/types/CdsContentSwitcher.ts +0 -4
- package/dist/types/CdsContentSwitcherButton.ts +0 -21
- package/dist/types/CdsDataTable.ts +0 -48
- package/dist/types/CdsDatePicker.ts +0 -40
- package/dist/types/CdsDrawer.ts +0 -25
- package/dist/types/CdsDrawerGroup.ts +0 -8
- package/dist/types/CdsDrawerItem.ts +0 -12
- package/dist/types/CdsDrawerLabel.ts +0 -4
- package/dist/types/CdsDropdown.ts +0 -14
- package/dist/types/CdsEmptyState.ts +0 -10
- package/dist/types/CdsFooter.ts +0 -17
- package/dist/types/CdsFooterService.ts +0 -16
- package/dist/types/CdsForm.ts +0 -4
- package/dist/types/CdsFormGroup.ts +0 -8
- package/dist/types/CdsFormItem.ts +0 -4
- package/dist/types/CdsGrid.ts +0 -16
- package/dist/types/CdsHeader.ts +0 -27
- package/dist/types/CdsHeaderService.ts +0 -4
- package/dist/types/CdsIcon.ts +0 -6
- package/dist/types/CdsLink.ts +0 -22
- package/dist/types/CdsList.ts +0 -6
- package/dist/types/CdsLoading.ts +0 -14
- package/dist/types/CdsModal.ts +0 -17
- package/dist/types/CdsMultiselect.ts +0 -33
- package/dist/types/CdsNotification.ts +0 -22
- package/dist/types/CdsOverflowMenu.ts +0 -16
- package/dist/types/CdsPagination.ts +0 -12
- package/dist/types/CdsRadioButton.ts +0 -29
- package/dist/types/CdsRow.ts +0 -18
- package/dist/types/CdsSearch.ts +0 -24
- package/dist/types/CdsSelect.ts +0 -37
- package/dist/types/CdsSkeleton.ts +0 -14
- package/dist/types/CdsStages.ts +0 -10
- package/dist/types/CdsStatus.ts +0 -22
- package/dist/types/CdsSteps.ts +0 -22
- package/dist/types/CdsStepsItem.ts +0 -12
- package/dist/types/CdsTable.ts +0 -46
- package/dist/types/CdsTabs.ts +0 -19
- package/dist/types/CdsTabsItem.ts +0 -18
- package/dist/types/CdsTag.ts +0 -20
- package/dist/types/CdsTextArea.ts +0 -26
- package/dist/types/CdsTextInput.ts +0 -32
- package/dist/types/CdsToggle.ts +0 -18
- package/dist/types/CdsTooltip.ts +0 -18
- package/dist/types/CdsTooltipDefinition.ts +0 -16
- package/dist/types/CdsTooltipInteractive.ts +0 -11
- package/dist/types/CdsUploader.ts +0 -44
- package/dist/types/Sidebar.ts +0 -17
- package/dist/types/types.ts +0 -2
- package/dist/utils/convertRemToPx.js +0 -9
- package/dist/utils/deepFind.js +0 -14
- package/dist/utils/expiringStorage.js +0 -28
- package/dist/utils/helpers.js +0 -33
- package/dist/utils/index.js +0 -1
- package/dist/utils/isCorrectTag.js +0 -5
- package/dist/utils/isRightProps.js +0 -5
- package/dist/utils/memoize.js +0 -8
- package/dist/utils/suffixPropName.js +0 -12
- package/dist/utils/test/deepFind.test.js +0 -18
- package/dist/utils/test/isCorrectTag.test.js +0 -9
- package/dist/utils/test/isCorrectTagDataSet.js +0 -51
- 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
|
+
}
|