@oruga-ui/theme-oruga 0.7.1 → 0.8.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 (45) hide show
  1. package/README.md +4 -4
  2. package/dist/scss/components/_autocomplete.scss +3 -12
  3. package/dist/scss/components/_breadcrumb.scss +122 -103
  4. package/dist/scss/components/_button.scss +228 -173
  5. package/dist/scss/components/_carousel.scss +164 -142
  6. package/dist/scss/components/_checkbox.scss +118 -118
  7. package/dist/scss/components/_collapse.scss +1 -1
  8. package/dist/scss/components/_datepicker.scss +228 -290
  9. package/dist/scss/components/_datetimepicker.scss +8 -2
  10. package/dist/scss/components/_dropdown.scss +191 -164
  11. package/dist/scss/components/_field.scss +68 -39
  12. package/dist/scss/components/_icon.scss +24 -29
  13. package/dist/scss/components/_input.scss +112 -97
  14. package/dist/scss/components/_loading.scss +35 -15
  15. package/dist/scss/components/_menu.scss +113 -109
  16. package/dist/scss/components/_modal.scss +112 -50
  17. package/dist/scss/components/_notification.scss +113 -97
  18. package/dist/scss/components/_pagination.scss +173 -106
  19. package/dist/scss/components/_radio.scss +91 -84
  20. package/dist/scss/components/_select.scss +108 -115
  21. package/dist/scss/components/_sidebar.scss +102 -101
  22. package/dist/scss/components/_skeleton.scss +50 -39
  23. package/dist/scss/components/_slider.scss +221 -159
  24. package/dist/scss/components/_steps.scss +223 -261
  25. package/dist/scss/components/_switch.scss +126 -90
  26. package/dist/scss/components/_table.scss +307 -251
  27. package/dist/scss/components/_tabs.scss +360 -247
  28. package/dist/scss/components/_tag.scss +95 -39
  29. package/dist/scss/components/_taginput.scss +48 -36
  30. package/dist/scss/components/_timepicker.scss +61 -62
  31. package/dist/scss/components/_tooltip.scss +129 -254
  32. package/dist/scss/components/_upload.scss +83 -35
  33. package/dist/scss/theme-build.scss +9 -0
  34. package/dist/scss/theme.scss +42 -0
  35. package/dist/scss/utils/_animations.scss +30 -9
  36. package/dist/scss/utils/_base.scss +6 -4
  37. package/dist/scss/utils/_helpers.scss +84 -22
  38. package/dist/scss/utils/_root.scss +82 -29
  39. package/dist/scss/utils/_variables.scss +64 -42
  40. package/dist/theme.css +2 -0
  41. package/dist/theme.js +1 -1
  42. package/package.json +26 -19
  43. package/dist/oruga.css +0 -2
  44. package/dist/scss/oruga-build.scss +0 -9
  45. package/dist/scss/oruga.scss +0 -42
@@ -1,104 +1,130 @@
1
1
  @use "sass:list";
2
2
  @use "sass:color";
3
+ @use "../utils/helpers" as h;
4
+ @use "../utils/variables" as vars;
3
5
 
4
6
  /* @docs */
5
- $switch-spacer: 0.5em !default;
7
+ $switch-spacer: h.useVar("control-spacer") !default;
6
8
  $switch-width: 2.75em !default;
7
9
  $switch-height: 1.5em !default;
8
- $switch-background: var(--#{$prefix}grey-light) !default;
9
- $switch-toggle-background: $control-brackground-color !default;
10
- $switch-border: $control-border-width solid var(--#{$prefix}grey-lighter) !default;
11
- $switch-border-radius: var(--#{$prefix}base-border-radius) !default;
12
- $switch-border-radius-rounded: var(
13
- --#{$prefix}base-border-radius-rounded
14
- ) !default;
15
- $switch-checked-background: var(--#{$prefix}primary) !default;
16
- $switch-disabled-opacity: var(--#{$prefix}base-disabled-opacity) !default;
10
+
11
+ $switch-color: h.useVar("font-color") !default;
12
+ $switch-font-size: h.useVar("font-size") !default;
13
+ $switch-font-weight: h.useVar("font-weight") !default;
14
+ $switch-line-height: h.useVar("line-height") !default;
15
+
16
+ $switch-box-shadow: h.useVar("control-box-shadow-inset") !default;
17
+ $switch-border-color: h.useVar("grey-lighter") !default;
18
+ $switch-border-style: solid !default;
19
+ $switch-border-width: h.useVar("control-border-width") !default;
20
+ $switch-border-radius: h.useVar("border-radius") !default;
21
+ $switch-border-radius-rounded: h.useVar("border-radius-rounded") !default;
22
+ $switch-background-color: h.useVar("grey-light") !default;
23
+ $switch-toggle-background-color: vars.$control-brackground-color !default;
24
+
25
+ $switch-checked-background-color: h.useVar("primary") !default;
26
+ $switch-checked-border-color: h.useVar("primary") !default;
27
+ $switch-disabled-opacity: h.useVar("control-disabled-opacity") !default;
17
28
  /* @docs */
18
29
 
19
30
  @function switchSVG($color) {
20
- $svg: "<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='#{$color}'/></svg>";
31
+ $start: "<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'>";
32
+ $content: "<circle r='3' fill='#{$color}'/>";
33
+ $end: "</svg>";
21
34
 
22
- @return svg-encode($svg);
35
+ @return h.svg-encode("#{$start}#{$content}#{$end}");
23
36
  }
24
37
 
25
38
  .o-switch {
26
- @include unselectable;
27
-
28
- cursor: pointer;
29
- display: block;
39
+ @include h.defineVar("switch-spacer", $switch-spacer);
40
+ @include h.defineVar("switch-width", $switch-width);
41
+ @include h.defineVar("switch-height", $switch-height);
42
+ @include h.defineVar("switch-color", $switch-color);
43
+ @include h.defineVar("switch-font-size", $switch-font-size);
44
+ @include h.defineVar("switch-font-weight", $switch-font-weight);
45
+ @include h.defineVar("switch-line-height", $switch-line-height);
46
+ @include h.defineVar("switch-background-color", $switch-background-color);
47
+ @include h.defineVar(
48
+ "switch-background-image",
49
+ url(switchSVG($switch-toggle-background-color))
50
+ );
51
+ @include h.defineVar(
52
+ "switch-checked-background-color",
53
+ $switch-checked-background-color
54
+ );
55
+ @include h.defineVar(
56
+ "switch-checked-border-color",
57
+ $switch-checked-border-color
58
+ );
59
+ @include h.defineVar("switch-box-shadow", $switch-box-shadow);
60
+ @include h.defineVar("switch-border-color", $switch-border-color);
61
+ @include h.defineVar("switch-border-style", $switch-border-style);
62
+ @include h.defineVar("switch-border-width", $switch-border-width);
63
+ @include h.defineVar("switch-border-radius", $switch-border-radius);
64
+ @include h.defineVar(
65
+ "switch-border-radius-rounded",
66
+ $switch-border-radius-rounded
67
+ );
68
+
69
+ // define focus shadow effect
70
+ @include h.focusable(".o-switch__input");
71
+
72
+ // add clickable cursor
73
+ @include h.clickable;
74
+
75
+ display: inline-flex;
30
76
  align-items: center;
31
77
  position: relative;
32
78
 
79
+ color: h.useVar("switch-color");
80
+ font-size: h.useVar("switch-font-size");
81
+ font-weight: h.useVar("switch-font-weight");
82
+ line-height: h.useVar("switch-line-height");
83
+
33
84
  &__input {
34
- flex-shrink: 0;
35
- width: var(--#{$prefix}switch-width, $switch-width);
36
- height: var(--#{$prefix}switch-height, $switch-height);
37
- margin-top: 0.25em;
38
- vertical-align: top;
39
- cursor: pointer;
40
- -webkit-appearance: none;
41
- -moz-appearance: none;
42
- appearance: none;
43
- background-color: var(
44
- --#{$prefix}switch-background,
45
- $switch-background
46
- );
47
- background-image: url(switchSVG($switch-toggle-background));
48
- background-position: left center;
49
- background-repeat: no-repeat;
50
- background-size: contain;
51
- border: var(--#{$prefix}switch-border, $switch-border);
52
- border-radius: var(
53
- --#{$prefix}switch-border-radius,
54
- $switch-border-radius
55
- );
85
+ // add clickable cursor
86
+ @include h.clickable;
87
+
88
+ // remove default appearance
89
+ @include h.removeAppearance;
56
90
  -webkit-print-color-adjust: exact;
57
91
  print-color-adjust: exact;
58
- transition: background-position var(--#{$prefix}transition-duration)
59
- var(--#{$prefix}transition-timing);
60
92
 
61
- &:checked {
62
- background-position: right center;
63
- background-color: var(
64
- --#{$prefix}switch-checked-background,
65
- $switch-checked-background
66
- );
67
- }
68
- }
93
+ font-size: inherit;
94
+ outline: none;
95
+ vertical-align: top;
96
+ width: h.useVar("switch-width");
97
+ height: h.useVar("switch-height");
69
98
 
70
- // size variants
71
- @each $name, $value in $sizes {
72
- &--#{$name} {
73
- font-size: var(--#{$prefix}font-size-#{name}, $value);
74
- }
75
- }
99
+ transition: background-position h.useVar("transition-duration")
100
+ h.useVar("transition-timing");
76
101
 
77
- // color variants
78
- @each $name, $pair in $colors {
79
- $color: list.nth($pair, 1);
80
- &--#{$name} {
81
- --#{$prefix}focus: #{createFocus($color)};
102
+ box-shadow: h.useVar("switch-box-shadow");
82
103
 
83
- input:checked {
84
- border-color: var(--#{$prefix}#{$name});
85
- background-color: var(--#{$prefix}variant-#{$name}, $color);
86
- }
87
- }
104
+ background-color: h.useVar("switch-background-color");
105
+ background-image: h.useVar("switch-background-image");
106
+ background-position: left center;
107
+ background-repeat: no-repeat;
108
+ background-size: contain;
88
109
 
89
- // possive variant
90
- &--#{$name}-passive {
91
- --#{$prefix}focus: #{createFocus($color)};
110
+ border-radius: h.useVar("switch-border-radius");
111
+ border-width: h.useVar("switch-border-width");
112
+ border-color: h.useVar("switch-border-color");
113
+ border-style: h.useVar("switch-border-style");
92
114
 
93
- input {
94
- background-color: var(--#{$prefix}#{$name});
95
- border-color: var(--#{$prefix}#{$name});
96
- }
115
+ &:checked {
116
+ background-position: right center;
117
+ background-color: h.useVar("switch-checked-background-color");
118
+ border-color: h.useVar("switch-checked-border-color");
97
119
  }
98
120
  }
99
121
 
100
122
  &__label {
101
- margin-left: var(--#{$prefix}switch-spacer, $switch-spacer);
123
+ padding: 0 0 0 h.useVar("switch-spacer");
124
+ }
125
+
126
+ &--disabled {
127
+ @include h.disabled(h.useVar("switch-disabled-opacity"));
102
128
  }
103
129
 
104
130
  &--left {
@@ -106,32 +132,42 @@ $switch-disabled-opacity: var(--#{$prefix}base-disabled-opacity) !default;
106
132
  flex-direction: row-reverse;
107
133
 
108
134
  .o-switch__label {
109
- margin-left: 0;
110
- margin-right: var(--#{$prefix}switch-spacer, $switch-spacer);
135
+ padding: 0 h.useVar("switch-spacer") 0 0;
111
136
  }
112
137
  }
113
138
 
114
- &--rounded .o-switch__input {
115
- border-radius: var(
116
- --#{$prefix}switch-border-radius-rounded,
117
- $switch-border-radius-rounded
139
+ &--rounded {
140
+ @include h.defineVar(
141
+ "switch-border-radius",
142
+ h.useVar("switch-border-radius-rounded")
118
143
  );
119
144
  }
120
145
 
121
- &--disabled {
122
- opacity: var(
123
- --#{$prefix}switch-disabled-opacity,
124
- $switch-disabled-opacity
125
- );
146
+ // size variants
147
+ @each $name, $value in vars.$sizes {
148
+ &--#{$name} {
149
+ @include h.defineVar("switch-font-size", h.useVar("size-#{$name}"));
150
+ }
126
151
  }
127
152
 
128
- // focus effect
129
- &:focus,
130
- &:focus-visible,
131
- &:focus-within {
132
- .o-switch__input {
133
- box-shadow: 0 0 0 0.25rem var(--#{$prefix}focus);
134
- outline: none;
153
+ // color variants
154
+ @each $name, $pair in vars.$colors {
155
+ // checked variant
156
+ &--#{$name} {
157
+ @include h.defineVar(
158
+ "switch-checked-border-color",
159
+ h.useVar($name)
160
+ );
161
+ @include h.defineVar(
162
+ "switch-checked-background-color",
163
+ h.useVar($name)
164
+ );
165
+ }
166
+
167
+ // possive variant
168
+ &--#{$name}-passive {
169
+ @include h.defineVar("switch-border-color", h.useVar($name));
170
+ @include h.defineVar("switch-background-color", h.useVar($name));
135
171
  }
136
172
  }
137
173
  }