@splendidlabz/styles 2.2.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/.stylelintrc.js +3 -0
- package/.turbo/turbo-lint.log +4 -0
- package/Base/_Accessibility.scss +32 -0
- package/Base/_Base.scss +57 -0
- package/Base/_Focus.scss +38 -0
- package/Base/_Transition.scss +8 -0
- package/Base/_index.scss +4 -0
- package/CHANGELOG.md +56 -0
- package/Components/_Box.scss +9 -0
- package/Components/_BrowserFrame.scss +89 -0
- package/Components/_Figure.scss +5 -0
- package/Components/_List.scss +19 -0
- package/Components/_Prose.scss +82 -0
- package/Components/_Scrollbars.scss +40 -0
- package/Components/_SimpleSVG.scss +9 -0
- package/Components/_index.scss +12 -0
- package/Effects/_Backdrop.scss +4 -0
- package/Effects/_Elevation.scss +92 -0
- package/Effects/_Glow.scss +51 -0
- package/Effects/_Gradients.scss +88 -0
- package/Effects/_Shadows.scss +51 -0
- package/Effects/_SpecialShadows.scss +45 -0
- package/Effects/_Text-Outline.scss +25 -0
- package/Effects/_index.scss +12 -0
- package/Experimental/_SimplePricingPlan.scss +141 -0
- package/Forms/_Button.scss +106 -0
- package/Forms/_Combobox.scss +49 -0
- package/Forms/_FormBase.scss +43 -0
- package/Forms/_FormControls.scss +95 -0
- package/Forms/_Range.scss +101 -0
- package/Forms/_Select.scss +114 -0
- package/Forms/_Switch.scss +66 -0
- package/Forms/_TextField.scss +116 -0
- package/Forms/_Textarea.scss +41 -0
- package/Forms/_index.scss +10 -0
- package/Typography/_WritingMode.scss +33 -0
- package/Typography/_index.scss +1 -0
- package/UI/Codepen.scss +11 -0
- package/UI/Tweet.scss +5 -0
- package/UI/Youtube.scss +13 -0
- package/UI/_Accordion.scss +33 -0
- package/UI/_Breadcrumbs.scss +24 -0
- package/UI/_CQChecker.scss +16 -0
- package/UI/_Callout.scss +31 -0
- package/UI/_Drawer.scss +28 -0
- package/UI/_Dropdown.scss +14 -0
- package/UI/_FancyList.scss +30 -0
- package/UI/_PerspectiveHover.scss +9 -0
- package/UI/_Popover.scss +25 -0
- package/UI/_Resizer.scss +43 -0
- package/UI/_Spotlight.scss +42 -0
- package/UI/_Status.scss +33 -0
- package/UI/_Tabs.scss +112 -0
- package/UI/_Textwall.scss +22 -0
- package/UI/_index.scss +17 -0
- package/Utilities/_Shapes.scss +20 -0
- package/Utilities/_index.scss +1 -0
- package/Variables/_Globals.scss +33 -0
- package/Variables/_index.scss +1 -0
- package/_Animations.scss +18 -0
- package/_Fill.scss +314 -0
- package/package.json +18 -0
- package/styles.scss +12 -0
- package/utils/_index.scss +3 -0
- package/utils/_mixins.scss +6 -0
- package/utils/functions/_fns.scss +77 -0
- package/utils/functions/_fonts.scss +114 -0
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@splendidlabz/styles",
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"author": "Zell Liew <zellwk@gmail.com>",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./styles.scss"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"lint": "stylelint '**/*.{css,scss}' --fix"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@splendidlabz/layouts": "*"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@splendidlabz/stylelint-config": "*"
|
|
17
|
+
}
|
|
18
|
+
}
|
package/styles.scss
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@use 'sass:string';
|
|
3
|
+
|
|
4
|
+
/// Remove the unit of a length
|
|
5
|
+
/// @param {Number} $number - Number to remove unit from
|
|
6
|
+
/// @return {Number} - Unitless number
|
|
7
|
+
@function stripUnit($number) {
|
|
8
|
+
@if type-of($number) == 'number' and not unitless($number) {
|
|
9
|
+
@return math.div($number, ($number * 0 + 1));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@return $number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/// toUppercase
|
|
16
|
+
/// @param [string] $string
|
|
17
|
+
/// @return [string]
|
|
18
|
+
@function toUppercase($string) {
|
|
19
|
+
@return string.to-upper-case(str-slice($string, 1, 1)) + str-slice($string, 2);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/// toLowercase
|
|
23
|
+
/// @param [string] $string
|
|
24
|
+
/// @return [string]
|
|
25
|
+
@function toLowercase($string) {
|
|
26
|
+
@return string.to-lower-case(str-slice($string, 1, 1)) + str-slice($string, 2);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/// Capitalize each word in string
|
|
30
|
+
/// @param [string] $string
|
|
31
|
+
/// @return [string]
|
|
32
|
+
@function str-ucwords($string) {
|
|
33
|
+
$progress: $string;
|
|
34
|
+
$result: '';
|
|
35
|
+
$running: true;
|
|
36
|
+
|
|
37
|
+
@while $running {
|
|
38
|
+
$index: str-index($progress, ' ');
|
|
39
|
+
|
|
40
|
+
@if $index {
|
|
41
|
+
$result: $result + capitalize(str-slice($progress, 1, $index));
|
|
42
|
+
$progress: str-slice($progress, ($index + 1));
|
|
43
|
+
} @else {
|
|
44
|
+
$running: false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@return capitalize($result) + capitalize($progress);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/// toCamel
|
|
52
|
+
/// @param [string] $string
|
|
53
|
+
/// @return [string]
|
|
54
|
+
@function toCamel($string) {
|
|
55
|
+
$progress: $string;
|
|
56
|
+
$result: '';
|
|
57
|
+
$exclude: ' ', '-', '–', '—', '_', ',', ';', ':', '.';
|
|
58
|
+
|
|
59
|
+
@while str-length($progress) > 0 {
|
|
60
|
+
$char: str-slice($progress, 1, 1);
|
|
61
|
+
|
|
62
|
+
@if contain($exclude, $char) {
|
|
63
|
+
$progress: capitalize(str-slice($progress, 2, 2)) +
|
|
64
|
+
str-slice($progress, 3);
|
|
65
|
+
} @else {
|
|
66
|
+
$result: $result + $char;
|
|
67
|
+
$progress: str-slice($progress, 2);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@return $result;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/// toSeconds (for transitions and animations)
|
|
75
|
+
@function toSeconds($value) {
|
|
76
|
+
@return calc(stripUnit($value) * 1s);
|
|
77
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'fns';
|
|
3
|
+
|
|
4
|
+
/// Convert a pixel value to rem
|
|
5
|
+
/// @param {Number} $value - Pixel value
|
|
6
|
+
/// @return {String} - Rem value
|
|
7
|
+
@function toRem($value) {
|
|
8
|
+
$value: fns.stripUnit($value);
|
|
9
|
+
|
|
10
|
+
@return calc($value / 16) * 1rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/// Fluid type function
|
|
14
|
+
/// @param {Number} $minBp - Minimum breakpoint
|
|
15
|
+
/// @param {Number} $maxBp - Maximum breakpoint
|
|
16
|
+
/// @param {Number} $minFontSize - Minimum font size
|
|
17
|
+
/// @param {Number} $maxFontSize - Maximum font size
|
|
18
|
+
/// @return {String} - Fluid type CSS
|
|
19
|
+
@function fluidType(
|
|
20
|
+
$minBp: 400px,
|
|
21
|
+
$maxBp: 1200px,
|
|
22
|
+
$minFontSize: 16px,
|
|
23
|
+
$maxFontSize: 20px
|
|
24
|
+
) {
|
|
25
|
+
$min: toRem($minFontSize);
|
|
26
|
+
$max: toRem($maxFontSize);
|
|
27
|
+
$fontSizeDifference: fns.stripUnit($maxFontSize - $minFontSize);
|
|
28
|
+
$bpDifference: fns.stripUnit($maxBp - $minBp);
|
|
29
|
+
|
|
30
|
+
// https://css-tricks.com/snippets/css/fluid-typography/
|
|
31
|
+
$fluid: calc(
|
|
32
|
+
$min + $fontSizeDifference * ((100vw - #{$minBp}) / $bpDifference)
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
@return clamp($min, calc(#{$fluid}), $max);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// $fontSizeMap: (
|
|
39
|
+
// 1: 10,
|
|
40
|
+
// 2: 11,
|
|
41
|
+
// 3: 12,
|
|
42
|
+
// 4: 14,
|
|
43
|
+
// 5: 16,
|
|
44
|
+
// 6: 18,
|
|
45
|
+
// 7: 21,
|
|
46
|
+
// 8: 24,
|
|
47
|
+
// 9: 28,
|
|
48
|
+
// 10: 36,
|
|
49
|
+
// 11: 42,
|
|
50
|
+
// 12: 48,
|
|
51
|
+
// 13: 54,
|
|
52
|
+
// 14: 60,
|
|
53
|
+
// 15: 72,
|
|
54
|
+
// );
|
|
55
|
+
// $baseStep: 7 !default;
|
|
56
|
+
// $fontMap: (
|
|
57
|
+
// primary: (
|
|
58
|
+
// font: (
|
|
59
|
+
// sans-serif,
|
|
60
|
+
// ),
|
|
61
|
+
// ),
|
|
62
|
+
// text: (
|
|
63
|
+
// font: (
|
|
64
|
+
// serif,
|
|
65
|
+
// ),
|
|
66
|
+
// ),
|
|
67
|
+
// code: (
|
|
68
|
+
// font: (
|
|
69
|
+
// 'Fira Mono',
|
|
70
|
+
// monospace,
|
|
71
|
+
// ),
|
|
72
|
+
// ),
|
|
73
|
+
// stylish: (
|
|
74
|
+
// font: 'Boston Skyline',
|
|
75
|
+
// sizedifference: calc(1 / 1.333),
|
|
76
|
+
// ),
|
|
77
|
+
// );
|
|
78
|
+
|
|
79
|
+
// /// Get a font size
|
|
80
|
+
// /// @param {Number} $step - Font size step
|
|
81
|
+
// /// @param {String} $font - Font name
|
|
82
|
+
// /// @return {String} - Font size
|
|
83
|
+
// /// @require {Map} $fontSizeMap - Map of font size steps to font sizes
|
|
84
|
+
// /// @require {Map} $fontMap - Map of font names to font families
|
|
85
|
+
// @function fontStep($step, $font: 'primary') {
|
|
86
|
+
// $desiredSize: map.get($fontSizeMap, $step);
|
|
87
|
+
// $baseSize: map.get($fontSizeMap, $baseStep);
|
|
88
|
+
// $value: calc($desiredSize / $baseSize);
|
|
89
|
+
|
|
90
|
+
// @if $font == 'primary' {
|
|
91
|
+
// @return $value * 1rem;
|
|
92
|
+
// }
|
|
93
|
+
|
|
94
|
+
// $sizeDifference: map.get($fontMap, $font, 'sizeDifference');
|
|
95
|
+
|
|
96
|
+
// @return $value * $sizeDifference * 1rem;
|
|
97
|
+
// }
|
|
98
|
+
|
|
99
|
+
// /// Get a font family
|
|
100
|
+
// /// @param {String} $font - Font name
|
|
101
|
+
// /// @return {String} - Font family
|
|
102
|
+
// /// @require {Map} $fontMap - Map of font names to font families
|
|
103
|
+
// @function fontFamily($font) {
|
|
104
|
+
// @return map.get($fontMap, $font, 'font');
|
|
105
|
+
// }
|
|
106
|
+
|
|
107
|
+
// /// Calculates the rhythm value
|
|
108
|
+
// /// @param {Number} $multiple - Multiple of the rhythm unit
|
|
109
|
+
// /// @return {String} - Rhythm value
|
|
110
|
+
// @function rhythm($multiple) {
|
|
111
|
+
// $rhythmUnit: var(--rhythmUnit, 1);
|
|
112
|
+
|
|
113
|
+
// @return calc($multiple * $rhythmUnit * 1rem);
|
|
114
|
+
// }
|