@fundamental-styles/common-css 0.41.5-rc.2 → 0.41.6-rc.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 +8 -0
- package/README.md +287 -213
- package/dist/common-css.css +1 -1
- package/dist/js/common-css.mjs +1 -1
- package/dist/js/sap-border-radius.mjs +1 -1
- package/dist/js/sap-border.mjs +1 -1
- package/dist/js/sap-busy-indicator.mjs +1 -1
- package/dist/js/sap-colors.mjs +1 -1
- package/dist/js/sap-container-type.mjs +1 -1
- package/dist/js/sap-content-paddings.mjs +1 -1
- package/dist/js/sap-display.mjs +1 -1
- package/dist/js/sap-elevation.mjs +1 -1
- package/dist/js/sap-flex.mjs +1 -1
- package/dist/js/sap-heading.mjs +1 -1
- package/dist/js/sap-label.mjs +1 -1
- package/dist/js/sap-main-colors.mjs +1 -1
- package/dist/js/sap-margin.mjs +1 -1
- package/dist/js/sap-normalize.mjs +1 -1
- package/dist/js/sap-overflow.mjs +1 -1
- package/dist/js/sap-padding.mjs +1 -1
- package/dist/js/sap-position.mjs +1 -1
- package/dist/js/sap-shadow.mjs +1 -1
- package/dist/js/sap-sr-only.mjs +1 -1
- package/dist/js/sap-text.mjs +1 -1
- package/dist/js/sap-title.mjs +1 -1
- package/dist/js/sap-typography.mjs +1 -1
- package/dist/sap-border-radius.css +1 -1
- package/dist/sap-border.css +1 -1
- package/dist/sap-busy-indicator.css +1 -1
- package/dist/sap-colors.css +1 -1
- package/dist/sap-container-type.css +1 -1
- package/dist/sap-content-paddings.css +1 -1
- package/dist/sap-display.css +1 -1
- package/dist/sap-elevation.css +1 -1
- package/dist/sap-flex.css +1 -1
- package/dist/sap-heading.css +1 -1
- package/dist/sap-label.css +1 -1
- package/dist/sap-main-colors.css +1 -1
- package/dist/sap-margin.css +1 -1
- package/dist/sap-normalize.css +1 -1
- package/dist/sap-overflow.css +1 -1
- package/dist/sap-padding.css +1 -1
- package/dist/sap-position.css +1 -1
- package/dist/sap-shadow.css +1 -1
- package/dist/sap-sr-only.css +1 -1
- package/dist/sap-text.css +1 -1
- package/dist/sap-title.css +1 -1
- package/dist/sap-typography.css +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [0.41.6-rc.0](https://github.com/SAP/fundamental-styles/compare/v0.41.5...v0.41.6-rc.0) (2026-05-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @fundamental-styles/common-css
|
|
9
|
+
|
|
10
|
+
## [0.41.5](https://github.com/SAP/fundamental-styles/compare/v0.41.5-rc.2...v0.41.5) (2026-04-29)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @fundamental-styles/common-css
|
|
13
|
+
|
|
6
14
|
## [0.41.5-rc.2](https://github.com/SAP/fundamental-styles/compare/v0.41.5-rc.1...v0.41.5-rc.2) (2026-04-29)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @fundamental-styles/common-css
|
package/README.md
CHANGED
|
@@ -1,280 +1,354 @@
|
|
|
1
|
-
|
|
1
|
+
# Common CSS
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A collection of utility CSS classes and SCSS mixins for styling SAP applications. Common CSS provides ready-to-use classes for spacing, layout, typography, colors, and more, eliminating the need to write custom CSS for common styling patterns.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Built to align with the SAP Design System, Common CSS supports responsive design, accessibility standards, and automatic right-to-left (RTL) layout.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- ✅ **SCSS Mixins & Variables** – Build custom, reusable styles with parameters for maximum flexibility
|
|
9
|
-
- ✅ **SAP Design System Aligned** – All values and patterns align with SAP theming standards
|
|
10
|
-
- ✅ **BEM Naming Convention** – Clear and predictable class names (e.g., `sap-margin-small`, `sap-padding-inline-tiny`)
|
|
11
|
-
- ✅ **Full and Modular Builds** – Use the entire library or import only what you need (e.g., colors, borders, spacing)
|
|
12
|
-
- ✅ **Responsive & Container Queries** – Built-in support for responsive design and modern container queries
|
|
13
|
-
- ✅ **RTL Support** – Automatic right-to-left layout support for international applications
|
|
14
|
-
- ✅ **Theming Integration** – Works seamlessly with SAP theming variables via @sap-theming/theming-base-content
|
|
7
|
+
## ✨ Features
|
|
15
8
|
|
|
9
|
+
- **Utility-first CSS** — Ready-to-use classes for rapid prototyping
|
|
10
|
+
- **80+ SCSS mixins** — Build custom components with flexible mixins
|
|
11
|
+
- **BEM naming** — Clear and predictable class names
|
|
12
|
+
- **Logical properties** — Automatic RTL support for international apps
|
|
13
|
+
- **Container queries** — Modern responsive design support
|
|
14
|
+
- **Modular imports** — Optimize bundle size by importing only what you need
|
|
15
|
+
- **Theme-aware** — Seamlessly integrates with SAP Design System variables
|
|
16
|
+
- **Accessibility-first** — Built with semantic utilities and ARIA support
|
|
16
17
|
|
|
18
|
+
## 🚀 Quick Start
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
SAP UI Common CSS Package is part of the Fundamental Styles. If you have installed the Fundamental Styles in your project, you automatically get the SAP UI Common CSS Package.
|
|
21
|
-
|
|
22
|
-
Learn more at [http://sap.github.io/fundamental-styles/](http://sap.github.io/fundamental-styles/)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## SAP UI Common CSS Package on its own
|
|
26
|
-
|
|
27
|
-
SAP UI Common CSS Package can stand on its own. To install the package:
|
|
20
|
+
### 📦 Installation
|
|
28
21
|
|
|
29
22
|
```bash
|
|
30
|
-
npm
|
|
23
|
+
npm install @fundamental-styles/common-css
|
|
31
24
|
```
|
|
32
25
|
|
|
33
|
-
|
|
34
|
-
The package uses SAP theming variables for colors, sizes, and spacing.
|
|
26
|
+
**💡 Already using fundamental-styles?** Common CSS is included automatically.
|
|
35
27
|
|
|
36
|
-
|
|
28
|
+
### 🎨 Theming Requirements
|
|
37
29
|
|
|
38
|
-
|
|
39
|
-
- Ensure your build includes the theming styles (usually provided by SAP Fundamental Styles or your SAP UI library)
|
|
30
|
+
**Required dependency:** Common CSS needs SAP theming variables to work properly.
|
|
40
31
|
|
|
41
32
|
```bash
|
|
42
33
|
npm install @sap-theming/theming-base-content
|
|
43
34
|
```
|
|
44
|
-
Links:
|
|
45
|
-
- [@sap-theming/theming-base-content on NPM](https://www.npmjs.com/package/@sap-theming/theming-base-content)
|
|
46
|
-
- [Theming Base Content on GitHub](https://github.com/SAP/theming-base-content)
|
|
47
35
|
|
|
36
|
+
### ⚙️ Basic Usage
|
|
48
37
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
### 1. Use Precompiled CSS
|
|
52
|
-
Include the compiled CSS file from the dist folder.
|
|
53
|
-
Full build:
|
|
54
|
-
```bash
|
|
55
|
-
<link rel="stylesheet" href="node_modules/@fundamental-styles/common-css/dist/common-css.css" />
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Modular imports (e.g., only colors or borders):
|
|
38
|
+
**Load order matters:** Always load theme variables before Common CSS:
|
|
59
39
|
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
<link
|
|
40
|
+
```html
|
|
41
|
+
<!-- 1. Theme variables first -->
|
|
42
|
+
<link href="https://unpkg.com/@sap-theming/theming-base-content/content/Base/baseLib/sap_horizon/css_variables.css" rel="stylesheet">
|
|
63
43
|
|
|
44
|
+
<!-- 2. Then Common CSS -->
|
|
45
|
+
<link href="https://unpkg.com/@fundamental-styles/common-css@latest/dist/common-css.css" rel="stylesheet">
|
|
64
46
|
```
|
|
65
47
|
|
|
66
|
-
###
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
48
|
+
### 📦 Modular Imports
|
|
49
|
+
|
|
50
|
+
Import only what you need to reduce bundle size:
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
// Import all utilities
|
|
54
|
+
import '@fundamental-styles/common-css/dist/common-css.css';
|
|
55
|
+
|
|
56
|
+
// Or import specific modules only
|
|
57
|
+
import '@fundamental-styles/common-css/dist/sap-margin.css';
|
|
58
|
+
import '@fundamental-styles/common-css/dist/sap-padding.css';
|
|
59
|
+
import '@fundamental-styles/common-css/dist/sap-flex.css';
|
|
60
|
+
import '@fundamental-styles/common-css/dist/sap-display.css';
|
|
61
|
+
import '@fundamental-styles/common-css/dist/sap-shadow.css';
|
|
62
|
+
import '@fundamental-styles/common-css/dist/sap-border.css';
|
|
63
|
+
import '@fundamental-styles/common-css/dist/sap-border-radius.css';
|
|
64
|
+
import '@fundamental-styles/common-css/dist/sap-colors.css';
|
|
65
|
+
import '@fundamental-styles/common-css/dist/sap-typography.css';
|
|
66
|
+
import '@fundamental-styles/common-css/dist/sap-heading.css';
|
|
77
67
|
```
|
|
78
68
|
|
|
79
|
-
### 3. Use SCSS Mixins for Customization
|
|
80
|
-
If your project uses SCSS, you can leverage the provided mixins and variables for custom values and consistent design.
|
|
81
69
|
|
|
82
|
-
|
|
83
|
-
- _common-mixins.scss
|
|
84
|
-
- _common-variables.scss
|
|
85
|
-
- _common-settings.scss
|
|
70
|
+
## 👋 Hello World Example
|
|
86
71
|
|
|
87
|
-
|
|
88
|
-
@import "~@fundamental-styles/common-css/sass/_common-variables.scss";
|
|
89
|
-
@import "~@fundamental-styles/common-css/sass/_common-mixins.scss";
|
|
72
|
+
Copy this HTML file and open it in your browser to see Common CSS in action:
|
|
90
73
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.card {
|
|
96
|
-
@include sap-border-radius(0.5rem);
|
|
97
|
-
}
|
|
74
|
+
<details>
|
|
75
|
+
<summary><strong>📄 View Complete Example</strong></summary>
|
|
98
76
|
|
|
77
|
+
```html
|
|
78
|
+
<!doctype html>
|
|
79
|
+
<html lang="en">
|
|
80
|
+
<head>
|
|
81
|
+
<meta charset="UTF-8" />
|
|
82
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
83
|
+
<title>Common CSS - Hello World</title>
|
|
84
|
+
|
|
85
|
+
<!-- Theme base variables (required for colors and spacing) -->
|
|
86
|
+
<link
|
|
87
|
+
href="https://unpkg.com/@sap-theming/theming-base-content/content/Base/baseLib/sap_horizon/css_variables.css"
|
|
88
|
+
rel="stylesheet" />
|
|
89
|
+
|
|
90
|
+
<!-- Common CSS utilities -->
|
|
91
|
+
<link
|
|
92
|
+
href="https://unpkg.com/@fundamental-styles/common-css@latest/dist/common-css.css"
|
|
93
|
+
rel="stylesheet" />
|
|
94
|
+
|
|
95
|
+
<style>
|
|
96
|
+
body {
|
|
97
|
+
font-family:
|
|
98
|
+
"72",
|
|
99
|
+
-apple-system,
|
|
100
|
+
BlinkMacSystemFont,
|
|
101
|
+
"Segoe UI",
|
|
102
|
+
Arial,
|
|
103
|
+
sans-serif;
|
|
104
|
+
line-height: 1.6;
|
|
105
|
+
background-color: var(--sapBackgroundColor, #f5f5f5);
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
108
|
+
</head>
|
|
109
|
+
<body class="sap-margin-medium">
|
|
110
|
+
<h1
|
|
111
|
+
class="sap-heading-h1 sap-margin-bottom-medium sap-color-indicationColor_1">
|
|
112
|
+
Common CSS Utilities Demo
|
|
113
|
+
</h1>
|
|
114
|
+
|
|
115
|
+
<!-- Card with spacing, border, shadow -->
|
|
116
|
+
<div
|
|
117
|
+
class="sap-bg-color-tile_Background sap-has-shadow-level-0 sap-border-radius-element sap-padding sap-margin-block-end-medium">
|
|
118
|
+
<h2
|
|
119
|
+
class="sap-heading-h3 sap-margin-bottom-small sap-color-indicationColor_2">
|
|
120
|
+
Spacing & Layout
|
|
121
|
+
</h2>
|
|
122
|
+
|
|
123
|
+
<p class="sap-margin-bottom-small">
|
|
124
|
+
This card demonstrates utility classes for <strong>padding</strong>,
|
|
125
|
+
<strong>margin</strong>, <strong>border-radius</strong>, and
|
|
126
|
+
<strong>shadows</strong>.
|
|
127
|
+
</p>
|
|
128
|
+
|
|
129
|
+
<p>Notice the consistent spacing and elevated shadow effect.</p>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<!-- Flexbox layout -->
|
|
133
|
+
<div
|
|
134
|
+
class="sap-flex sap-flex--row sap-flex--gap-small sap-flex--wrap sap-margin-bottom-large">
|
|
135
|
+
<div
|
|
136
|
+
class="sap-padding-inline-medium sap-border-radius-button sap-bg-color-avatar_2_Background sap-color-legendColor4">
|
|
137
|
+
Tag 1
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<div
|
|
141
|
+
class="sap-padding-inline-medium sap-border-radius-button sap-bg-color-avatar_3_Background sap-color-legendColor5">
|
|
142
|
+
Tag 2
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
<div
|
|
146
|
+
class="sap-padding-inline-medium sap-border-radius-button sap-bg-color-avatar_6_Background sap-color-legendColor6">
|
|
147
|
+
Tag 3
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
|
|
151
|
+
<!-- Different spacing sizes -->
|
|
152
|
+
<div
|
|
153
|
+
class="sap-flex sap-flex--column sap-flex--gap-small sap-border-radius-element sap-margin-block-end-large">
|
|
154
|
+
<div class="sap-padding-inline-tiny sap-bg-color-avatar_5_Background">
|
|
155
|
+
<strong>Tiny Padding</strong>
|
|
156
|
+
</div>
|
|
157
|
+
<div class="sap-padding-inline-small sap-bg-color-avatar_6_Background">
|
|
158
|
+
<strong>Small Padding</strong>
|
|
159
|
+
</div>
|
|
160
|
+
<div class="sap-padding-inline-medium sap-bg-color-avatar_7_Background">
|
|
161
|
+
<strong>Medium Padding</strong>
|
|
162
|
+
</div>
|
|
163
|
+
<div class="sap-padding-inline-large sap-bg-color-avatar_8_Background">
|
|
164
|
+
<strong>Large Padding</strong>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
<!-- Shadows demonstration -->
|
|
169
|
+
<div
|
|
170
|
+
class="sap-flex sap-flex--row sap-flex--gap-medium sap-flex--wrap sap-margin-bottom-large">
|
|
171
|
+
<div class="sap-padding sap-border-radius-element sap-has-shadow-level-0">
|
|
172
|
+
Level 0 Shadow
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<div class="sap-padding sap-border-radius-element sap-has-shadow-level-1">
|
|
176
|
+
Level 1 Shadow
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
<div class="sap-padding sap-border-radius-element sap-has-shadow-level-2">
|
|
180
|
+
Level 2 Shadow
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
|
|
184
|
+
<!-- Typography -->
|
|
185
|
+
<div
|
|
186
|
+
class="sap-padding sap-border-radius-element sap-has-shadow-critical sap-bg-color-legendBackgroundColor8">
|
|
187
|
+
<h3
|
|
188
|
+
class="sap-heading-h4 sap-margin-block-tiny sap-border-block-end-style-double sap-border-block-end-color-assistant">
|
|
189
|
+
Typography Utilities
|
|
190
|
+
</h3>
|
|
191
|
+
|
|
192
|
+
<p
|
|
193
|
+
class="sap-font-size-small sap-margin-bottom-tiny sap-color-indicationColor_3">
|
|
194
|
+
Small text size (sap-font-size-small)
|
|
195
|
+
</p>
|
|
196
|
+
|
|
197
|
+
<p
|
|
198
|
+
class="sap-font-size-medium sap-margin-bottom-tiny sap-color-indicationColor_4">
|
|
199
|
+
Medium text size (sap-font-size-medium)
|
|
200
|
+
</p>
|
|
201
|
+
|
|
202
|
+
<p class="sap-font-size-large sap-color-legendColor1">
|
|
203
|
+
Large text size (sap-font-size-large)
|
|
204
|
+
</p>
|
|
205
|
+
</div>
|
|
206
|
+
</body>
|
|
207
|
+
</html>
|
|
99
208
|
```
|
|
100
209
|
|
|
101
|
-
|
|
210
|
+
</details>
|
|
102
211
|
|
|
103
|
-
```bash
|
|
104
|
-
@fundamental-styles/common-css/
|
|
105
|
-
│
|
|
106
|
-
├── dist/
|
|
107
|
-
│ ├── common-css.css // Full build with all utilities
|
|
108
|
-
│ ├── sap-colors.css // Color utilities
|
|
109
|
-
│ ├── sap-main-colors.css // Main color palette
|
|
110
|
-
│ ├── sap-border.css // Border utilities
|
|
111
|
-
│ ├── sap-border-radius.css // Border radius utilities
|
|
112
|
-
│ ├── sap-margin.css // Margin spacing utilities
|
|
113
|
-
│ ├── sap-padding.css // Padding spacing utilities
|
|
114
|
-
│ ├── sap-content-paddings.css // Responsive content padding utilities
|
|
115
|
-
│ ├── sap-shadow.css // Shadow utilities
|
|
116
|
-
│ ├── sap-elevation.css // Z-index elevation utilities
|
|
117
|
-
│ ├── sap-typography.css // Font family and size utilities
|
|
118
|
-
│ ├── sap-text.css // Text utilities
|
|
119
|
-
│ ├── sap-heading.css // Heading utilities
|
|
120
|
-
│ ├── sap-label.css // Label utilities
|
|
121
|
-
│ ├── sap-title.css // Title utilities
|
|
122
|
-
│ ├── sap-flex.css // Flexbox utilities
|
|
123
|
-
│ ├── sap-display.css // Display utilities
|
|
124
|
-
│ ├── sap-position.css // Position utilities
|
|
125
|
-
│ ├── sap-overflow.css // Overflow utilities
|
|
126
|
-
│ ├── sap-container-type.css // Container query utilities
|
|
127
|
-
│ ├── sap-busy-indicator.css // Busy indicator utilities
|
|
128
|
-
│ ├── sap-normalize.css // Normalize/reset styles
|
|
129
|
-
│ └── sap-sr-only.css // Screen reader utilities
|
|
130
|
-
│
|
|
131
|
-
├── sass/
|
|
132
|
-
│ ├── _common-mixins.scss // 80+ utility mixins
|
|
133
|
-
│ ├── _common-variables.scss // Design tokens and variables
|
|
134
|
-
│ └── _common-settings.scss // Default configuration
|
|
135
212
|
|
|
136
|
-
|
|
213
|
+
## 📖 Core Concepts
|
|
214
|
+
|
|
215
|
+
### 📝 Naming Convention
|
|
137
216
|
|
|
138
|
-
|
|
217
|
+
Common CSS uses **BEM notation** for complex utilities:
|
|
139
218
|
|
|
140
|
-
|
|
219
|
+
| Type | Pattern | Example |
|
|
220
|
+
|------|---------|---------|
|
|
221
|
+
| **Simple utilities** | `sap-{property}-{value}` | `sap-padding-medium` |
|
|
222
|
+
| **With modifiers** | `sap-{block} sap-{block}--{modifier}` | `sap-flex sap-flex--row` |
|
|
223
|
+
| **With states** | `sap-has-{state}-{value}` | `sap-has-shadow-level-1` |
|
|
141
224
|
|
|
142
|
-
|
|
143
|
-
- Margin utilities: `sap-margin-{tiny|small|medium|large}`, `sap-margin-{side}-{size}`, `sap-margin-responsive`
|
|
144
|
-
- Padding utilities: `sap-padding-{tiny|small|medium|large}`, `sap-padding-{side}-{size}`, `sap-padding-responsive`
|
|
145
|
-
- Content padding utilities with responsive container queries
|
|
225
|
+
**⚠️ Important:** Flex utilities require both base class and modifier:
|
|
146
226
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
-
|
|
150
|
-
- Position utilities: `sap-position-{absolute|relative|fixed|sticky}`
|
|
151
|
-
- Overflow utilities: `sap-overflow-{auto|hidden|scroll|visible}`
|
|
152
|
-
- Elevation utilities: `sap-elevation-{0-20}`
|
|
227
|
+
```html
|
|
228
|
+
<!-- ✅ Correct -->
|
|
229
|
+
<div class="sap-flex sap-flex--row">...</div>
|
|
153
230
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
- Shadow utilities: `sap-shadow-{level-0|level-1|level-2|level-3|header|shell}`
|
|
231
|
+
<!-- ❌ Wrong -->
|
|
232
|
+
<div class="sap-flex-row">...</div>
|
|
233
|
+
```
|
|
158
234
|
|
|
159
|
-
**Typography:**
|
|
160
|
-
- Font family: `sap-font-family-{regular|light|bold|semibold|monospaced-regular|monospaced-bold|black|header}`
|
|
161
|
-
- Font size: `sap-font-size-{small|medium|large|header-1|header-2|header-3|header-4|header-5|header-6}`
|
|
162
|
-
- Heading utilities: `sap-heading-{h1|h2|h3|h4|h5|h6}`
|
|
163
|
-
- Text utilities with line clamping, hyphenation, and wrapping support
|
|
164
|
-
- Label utilities with required/colon indicators
|
|
165
235
|
|
|
166
|
-
|
|
167
|
-
- Screen reader only: `sap-sr-only`
|
|
168
|
-
- Normalize/reset styles
|
|
236
|
+
## 📘 Usage Guide
|
|
169
237
|
|
|
170
|
-
|
|
171
|
-
- Container query utilities: `sap-container-type-{inline-size|size|normal}`
|
|
172
|
-
- Busy indicator utilities
|
|
173
|
-
- Responsive design with media query support
|
|
238
|
+
Common CSS provides two ways to apply styles to your application:
|
|
174
239
|
|
|
175
|
-
###
|
|
240
|
+
### CSS Utility Classes
|
|
176
241
|
|
|
177
|
-
|
|
242
|
+
**Use when:** You need quick, consistent styling that follows SAP Design System patterns. Perfect for rapid prototyping and standard layouts.
|
|
178
243
|
|
|
179
|
-
**
|
|
180
|
-
- `sap-hover`, `sap-active`, `sap-focus`, `sap-disabled`, `sap-selected`, `sap-readonly`, `sap-pressed`
|
|
244
|
+
**How it works:** Add predefined classes directly to your HTML elements. Each class applies specific styling that aligns with SAP design guidelines.
|
|
181
245
|
|
|
182
|
-
**
|
|
183
|
-
- `sap-flex($direction)`, `sap-flex-center`, `sap-flex-vertical-center`
|
|
184
|
-
- `sap-position($type, $top, $right, $bottom, $left)`, `sap-position-absolute-center`
|
|
185
|
-
- `sap-display($type)`
|
|
246
|
+
**Example:** `<div class="sap-margin-medium sap-padding-small">Content</div>`
|
|
186
247
|
|
|
187
|
-
|
|
188
|
-
- `sap-padding($value, $side)`, `sap-padding-responsive`
|
|
189
|
-
- `sap-margin($value, $side)`, `sap-margin-responsive`
|
|
190
|
-
- `sap-content-paddings($type, $size)` with container query support
|
|
248
|
+
### SCSS Mixins
|
|
191
249
|
|
|
192
|
-
**
|
|
193
|
-
- `sap-border($width, $style, $color, $pos)`, `sap-set-border-radius($value)`
|
|
194
|
-
- `sap-shadow($type)`, `sap-elevation($index)`
|
|
195
|
-
- `sap-color($color)`, `sap-bg-color($color)`
|
|
250
|
+
**Use when:** You're building custom components that need more flexibility or need to integrate spacing into your own CSS classes. Mixins allow you to customize parameters and create variations beyond the predefined utility classes.
|
|
196
251
|
|
|
197
|
-
**
|
|
198
|
-
- `sap-font-family($type)`, `sap-font-size($size)`, `sap-font($type)`
|
|
199
|
-
- `sap-heading($size)`, `sap-label($required, $colon)`, `sap-text($modifier)`
|
|
200
|
-
- `sap-ellipsis`
|
|
252
|
+
**How it works:** Import mixins into your SCSS files and include them in your custom classes with optional parameters for fine-grained control.
|
|
201
253
|
|
|
202
|
-
**
|
|
203
|
-
- `sap-media-sm`, `sap-media-md`, `sap-media-lg`, `sap-media-xl`
|
|
204
|
-
- `sap-container-query-sm`, `sap-container-query-md`, `sap-container-query-lg`, `sap-container-query-xl`
|
|
254
|
+
**Example:** `@include sap-padding(medium); @include sap-margin(custom-value, block-end);`
|
|
205
255
|
|
|
206
|
-
**Focus & Accessibility:**
|
|
207
|
-
- `sap-fiori-focus($offset, $alternative)`, `sap-fake-fiori-focus($offset, $radius, $alternative)`
|
|
208
|
-
- `sap-sr-only`
|
|
209
256
|
|
|
210
|
-
|
|
211
|
-
- `sap-rtl` for automatic right-to-left layout handling
|
|
212
|
-
- RTL-aware padding, margin, and position mixins
|
|
257
|
+
### Spacing
|
|
213
258
|
|
|
214
|
-
|
|
259
|
+
#### CSS Utility Classes
|
|
215
260
|
|
|
216
|
-
|
|
261
|
+
<details>
|
|
262
|
+
<summary><strong>📄 Spacing Example</strong></summary>
|
|
217
263
|
|
|
218
264
|
```html
|
|
219
|
-
|
|
220
|
-
<
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
265
|
+
<!doctype html>
|
|
266
|
+
<html lang="en">
|
|
267
|
+
<head>
|
|
268
|
+
<meta charset="UTF-8" />
|
|
269
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
270
|
+
<title>Spacing Utilities</title>
|
|
271
|
+
|
|
272
|
+
<!-- Theme variables (required) -->
|
|
273
|
+
<link
|
|
274
|
+
href="https://unpkg.com/@sap-theming/theming-base-content/content/Base/baseLib/sap_horizon/css_variables.css"
|
|
275
|
+
rel="stylesheet" />
|
|
276
|
+
|
|
277
|
+
<!-- Modular imports - only spacing utilities -->
|
|
278
|
+
<link
|
|
279
|
+
href="https://unpkg.com/@fundamental-styles/common-css@latest/dist/sap-margin.css"
|
|
280
|
+
rel="stylesheet" />
|
|
281
|
+
<link
|
|
282
|
+
href="https://unpkg.com/@fundamental-styles/common-css@latest/dist/sap-padding.css"
|
|
283
|
+
rel="stylesheet" />
|
|
284
|
+
|
|
285
|
+
<link
|
|
286
|
+
href="https://unpkg.com/@fundamental-styles/common-css@latest/dist/sap-colors.css"
|
|
287
|
+
rel="stylesheet" />
|
|
288
|
+
|
|
289
|
+
<style>
|
|
290
|
+
body {
|
|
291
|
+
font-family: "72", Arial, sans-serif;
|
|
292
|
+
background: var(--sapBackgroundColor);
|
|
293
|
+
padding: 20px;
|
|
294
|
+
}
|
|
295
|
+
</style>
|
|
296
|
+
</head>
|
|
297
|
+
<body>
|
|
298
|
+
<h2>Spacing Utilities Demo</h2>
|
|
299
|
+
|
|
300
|
+
<div
|
|
301
|
+
class="sap-bg-color-legendBackgroundColor1 sap-margin-small sap-padding">
|
|
302
|
+
<strong>Margin and padding on all sides</strong>
|
|
303
|
+
</div>
|
|
304
|
+
|
|
305
|
+
<div
|
|
306
|
+
class="sap-bg-color-legendBackgroundColor2 sap-margin-block-medium sap-padding-inline-medium">
|
|
307
|
+
<strong>Medium vertical margin and medium horizontal padding</strong>
|
|
308
|
+
</div>
|
|
309
|
+
|
|
310
|
+
<div
|
|
311
|
+
class="sap-bg-color-legendBackgroundColor5 sap-margin-responsive sap-padding-responsive">
|
|
312
|
+
<strong>Responsive margin and padding</strong> - Adjusts based on screen
|
|
313
|
+
size
|
|
314
|
+
</div>
|
|
315
|
+
</body>
|
|
316
|
+
</html>
|
|
237
317
|
```
|
|
238
318
|
|
|
239
|
-
|
|
319
|
+
</details>
|
|
320
|
+
|
|
321
|
+
#### SCSS Mixins
|
|
240
322
|
|
|
241
323
|
```scss
|
|
242
|
-
|
|
324
|
+
@import "@fundamental-styles/common-css/sass/common-mixins";
|
|
325
|
+
|
|
243
326
|
.my-card {
|
|
244
327
|
@include sap-padding(medium);
|
|
245
|
-
@include sap-margin(large,
|
|
246
|
-
@include sap-shadow(level-2);
|
|
247
|
-
@include sap-set-border-radius(element);
|
|
328
|
+
@include sap-margin(large, block-end);
|
|
248
329
|
}
|
|
249
330
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
@include sap-
|
|
253
|
-
@include sap-flex-align-items(center);
|
|
331
|
+
.custom-spacing {
|
|
332
|
+
@include sap-padding-responsive();
|
|
333
|
+
@include sap-margin(small, x);
|
|
254
334
|
}
|
|
335
|
+
```
|
|
255
336
|
|
|
256
|
-
|
|
257
|
-
.responsive-container {
|
|
258
|
-
@include sap-container-type(inline-size);
|
|
259
|
-
@include sap-padding-container-responsive();
|
|
260
|
-
}
|
|
337
|
+
## ⚡ Quick Reference
|
|
261
338
|
|
|
262
|
-
|
|
263
|
-
.custom-heading {
|
|
264
|
-
@include sap-heading(h2);
|
|
265
|
-
|
|
266
|
-
@include sap-fiori-focus(-0.1875rem) {
|
|
267
|
-
// Focus styles automatically applied
|
|
268
|
-
}
|
|
269
|
-
}
|
|
339
|
+
### 📋 Most Common Classes
|
|
270
340
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
341
|
+
| Need | Class | Example |
|
|
342
|
+
|------|-------|---------|
|
|
343
|
+
| **Spacing** | `sap-padding`, `sap-margin-*` | `sap-margin-bottom-medium` |
|
|
344
|
+
| **Flexbox** | `sap-flex sap-flex--*` | `sap-flex sap-flex--row sap-flex--gap-small` |
|
|
345
|
+
| **Shadows** | `sap-has-shadow-*` | `sap-has-shadow-level-1` |
|
|
346
|
+
| **Radius** | `sap-border-radius-*` | `sap-border-radius-element` |
|
|
347
|
+
| **Typography** | `sap-heading-*`, `sap-font-size-*` | `sap-heading-h2` |
|
|
348
|
+
| **Display** | `sap-display-*` | `sap-display-none` |
|
|
349
|
+
| **Hide text** | `sap-sr-only` | `sap-sr-only` |
|
|
350
|
+
|
|
351
|
+
## 📚 Resources
|
|
277
352
|
|
|
278
|
-
|
|
279
|
-
- [
|
|
280
|
-
- [Theming Base Content on GitHub](https://github.com/SAP/theming-base-content)
|
|
353
|
+
- 📚 [Full Documentation](https://sap.github.io/fundamental-styles/)
|
|
354
|
+
- 🎨 [Theming Base Content](https://github.com/SAP/theming-base-content)
|