Skip to content

Commit bf028a4

Browse files
authored
docs: utilities (#37)
1 parent d179df4 commit bf028a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2158
-231
lines changed

scss/utilities/_background-colors.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
@each $property, $value in $color-variations {
44
.bg-#{"" + $property} {
5-
background-color: var(--#{$prefix}bg-color-#{$property});
5+
color: var(--#{$prefix}#{$property}-text-color);
6+
background-color: var(--#{$prefix}#{$property}-bg-color);
67
}
78
}

scss/utilities/_border.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ $border-properties: "border", "border-top", "border-right", "border-bottom", "bo
2222
}
2323
}
2424

25-
@each $property, $value in $base-colors {
25+
@each $property, $value in $color-variations {
2626
.border-color-#{"" + $property} {
27-
border-color: var(--#{$prefix}color-#{$property}-100);
27+
border-color: var(--#{$prefix}#{$property}-bg-color);
2828
}
2929
}

scss/utilities/_flex.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
@use "../functions/apply-utility" as *;
22

33
$wrap-values: nowrap, wrap, wrap-reverse;
4-
@include apply-utility-classes("flex-wrap", "flex-wrap", $wrap-values);
4+
@include apply-utility-classes("flex", "flex-wrap", $wrap-values);
55

66
$direction-values: row, row-reverse, column, column-reverse;
7-
@include apply-utility-classes("flex-direction", "flex-direction", $direction-values);
7+
@include apply-utility-classes("flex", "flex-direction", $direction-values);
88

99
$justify-content-values: flex-start, flex-end, center, space-between, space-around,
1010
space-evenly;
@@ -31,3 +31,7 @@ $grow-values: 0, 1;
3131

3232
$shrink-values: 0, 1;
3333
@include apply-utility-classes("flex-shrink", "flex-shrink", $shrink-values);
34+
35+
.flex-fill {
36+
flex: 1 1 auto;
37+
}

scss/utilities/_index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
@use "_image";
1313
@use "_radius";
1414
@use "_background-colors";
15+
@use "_interactions";
1516
@use "_flex";
1617
@use "_grid";

scss/utilities/_interactions.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@use "../functions/apply-utility" as *;
2+
3+
$cursor-values: pointer, default, none, move, text, wait, help, progress, not-allowed,
4+
all-scroll, col-resize, row-resize, n-resize, e-resize, s-resize, w-resize, ne-resize,
5+
nw-resize, se-resize, sw-resize;
6+
@include apply-utility-classes("cursor", "cursor", $cursor-values);
7+
8+
$pointer-events-values: auto, none;
9+
@include apply-utility-classes("pe", "pointer-events", $pointer-events-values);
10+
11+
$user-select-values: none, auto, text, all;
12+
@include apply-utility-classes("user-select", "user-select", $user-select-values);

scss/utilities/_text.scss

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1+
@use "sass:map";
2+
@use "sass:list";
3+
14
@use "../variables/global" as *;
25
@use "../functions/apply-utility" as *;
36

4-
$text-align-values: left, right, center, justify;
7+
$text-align-values: start, end, center, justify;
58
@include apply-utility-classes("text", "text-align", $text-align-values);
69

7-
$text-transform-values: none, uppercase, lowercase, capitalize;
8-
@include apply-utility-classes(
9-
"text-transform",
10-
"text-transform",
11-
$text-transform-values
12-
);
10+
$text-transform-values: uppercase, lowercase, capitalize;
11+
@include apply-utility-classes("text", "text-transform", $text-transform-values);
1312

1413
$text-decoration-values: none, underline, overline, line-through;
1514
@include apply-utility-classes(
@@ -48,9 +47,17 @@ $font-style-values: normal, italic, oblique;
4847
$font-weight-values: 100, 200, 300, 400, 500, 600, 700, 800, 900;
4948
@include apply-utility-classes("fw", "font-weight", $font-weight-values, true);
5049

51-
@each $property, $value in $font-sizes {
52-
.fs-#{$property} {
53-
font-size: var(--#{$prefix}font-size-#{$property});
50+
@for $i from 1 through list.length(map.keys($font-sizes)) {
51+
$key: list.nth(map.keys($font-sizes), $i);
52+
53+
.fs-#{$i} {
54+
font-size: var(--#{$prefix}font-size-#{$key});
55+
}
56+
}
57+
58+
@each $property, $value in $line-heights {
59+
.lh-#{$property} {
60+
line-height: var(--#{$prefix}line-height-#{$property});
5461
}
5562
}
5663

@@ -59,3 +66,17 @@ $font-weight-values: 100, 200, 300, 400, 500, 600, 700, 800, 900;
5966
text-overflow: ellipsis;
6067
white-space: nowrap;
6168
}
69+
70+
.text-reset {
71+
color: inherit !important;
72+
}
73+
74+
@each $property, $value in $color-variations {
75+
.text-#{"" + $property} {
76+
color: var(--#{$prefix}#{$property}-bg-color);
77+
}
78+
79+
.text-#{"" + $property}-bg {
80+
color: var(--#{$prefix}#{$property}-text-color);
81+
}
82+
}

scss/variables/_global.scss

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,20 @@ $transitions-duration: 0.3s !default;
66
$transitions: ease-in-out, ease-in, ease-out, linear !default;
77

88
$font-sizes: (
9-
sm: 0.75,
10-
md: 1,
11-
lg: 1.25,
12-
xl: 1.5,
13-
xxl: 2,
149
xxxl: 3,
15-
);
10+
xxl: 2,
11+
xl: 1.5,
12+
lg: 1.25,
13+
md: 1,
14+
sm: 0.75,
15+
) !default;
16+
17+
$line-heights: (
18+
1: 1,
19+
sm: 1.25,
20+
base: 1.5,
21+
lg: 2,
22+
) !default;
1623

1724
$container-padding-x: 1.5rem !default;
1825

scss/variables/_root.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
--#{$prefix}font-size-#{$property}: #{$value}em;
3838
}
3939

40+
@each $property, $value in $line-heights {
41+
--#{$prefix}line-height-#{$property}: #{$value};
42+
}
43+
4044
@each $property, $value in $border-vars {
4145
--#{$prefix}border-#{$property}: #{$value};
4246
}

stories/shared/consts/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./placements";
2+
export * from "./variations";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Placement } from "../interfaces";
2+
3+
export const PLACEMENTS: Placement[] = ["top", "bottom", "left", "right"];

0 commit comments

Comments
 (0)