@underlayerdev/ui 0.6.2 → 0.6.4

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.
@@ -0,0 +1,169 @@
1
+ @use './values' as *;
2
+
3
+ /// Creates a mobile-first media query that applies styles from the specified breakpoint and up
4
+ /// @param {String} $breakpoint - Breakpoint name: 'xs', 'sm', 'md', 'lg', or 'xl'
5
+ /// @example
6
+ /// @include up('md') {
7
+ /// // styles for medium screens and larger
8
+ /// }
9
+ @mixin up($breakpoint) {
10
+ @if $breakpoint == 'xs' {
11
+ @media (min-width: $breakpoint-xs) {
12
+ @content;
13
+ }
14
+ } @else if $breakpoint == 'sm' {
15
+ @media (min-width: $breakpoint-sm) {
16
+ @content;
17
+ }
18
+ } @else if $breakpoint == 'md' {
19
+ @media (min-width: $breakpoint-md) {
20
+ @content;
21
+ }
22
+ } @else if $breakpoint == 'lg' {
23
+ @media (min-width: $breakpoint-lg) {
24
+ @content;
25
+ }
26
+ } @else if $breakpoint == 'xl' {
27
+ @media (min-width: $breakpoint-xl) {
28
+ @content;
29
+ }
30
+ }
31
+ }
32
+
33
+ /// Creates a desktop-first media query covering the named tier *and everything
34
+ /// below it* — `down('md')` includes the md tier itself, so it ends at
35
+ /// `$breakpoint-lg - 1`, not `$breakpoint-md - 1`.
36
+ ///
37
+ /// IMPORTANT: `down($bp)` is therefore NOT the complement of `up($bp)` — both
38
+ /// include the $bp tier, so they overlap. Pairing them on one property means
39
+ /// the result is decided by source order, which is almost never intended.
40
+ /// When you want "the part `up($bp)` does not cover", use `below($bp)`.
41
+ ///
42
+ /// @param {String} $breakpoint - Breakpoint name: 'xs', 'sm', 'md', or 'lg'
43
+ /// @example
44
+ /// @include down('lg') {
45
+ /// // styles for large screens and smaller
46
+ /// }
47
+ @mixin down($breakpoint) {
48
+ @if $breakpoint == 'xs' {
49
+ @media (max-width: ($breakpoint-sm - 1)) {
50
+ @content;
51
+ }
52
+ } @else if $breakpoint == 'sm' {
53
+ @media (max-width: ($breakpoint-md - 1)) {
54
+ @content;
55
+ }
56
+ } @else if $breakpoint == 'md' {
57
+ @media (max-width: ($breakpoint-lg - 1)) {
58
+ @content;
59
+ }
60
+ } @else if $breakpoint == 'lg' {
61
+ @media (max-width: ($breakpoint-xl - 1)) {
62
+ @content;
63
+ }
64
+ }
65
+ }
66
+
67
+ /// Creates a media query for everything strictly *below* the named tier — the
68
+ /// exact complement of `up($breakpoint)`, so the two never overlap. Use this
69
+ /// (not `down()`) to split one property into a mobile and a desktop value.
70
+ /// @param {String} $breakpoint - Breakpoint name: 'sm', 'md', 'lg', or 'xl'
71
+ /// @example
72
+ /// // ul-dock: visible only where the desktop navbar is not
73
+ /// @include below('md') {
74
+ /// display: flex;
75
+ /// }
76
+ @mixin below($breakpoint) {
77
+ @if $breakpoint == 'sm' {
78
+ @media (max-width: ($breakpoint-sm - 1)) {
79
+ @content;
80
+ }
81
+ } @else if $breakpoint == 'md' {
82
+ @media (max-width: ($breakpoint-md - 1)) {
83
+ @content;
84
+ }
85
+ } @else if $breakpoint == 'lg' {
86
+ @media (max-width: ($breakpoint-lg - 1)) {
87
+ @content;
88
+ }
89
+ } @else if $breakpoint == 'xl' {
90
+ @media (max-width: ($breakpoint-xl - 1)) {
91
+ @content;
92
+ }
93
+ } @else {
94
+ @error "below() expects 'sm', 'md', 'lg', or 'xl' — got '#{$breakpoint}'. "
95
+ + "There is nothing below 'xs' (it starts at 0).";
96
+ }
97
+ }
98
+
99
+ /// Creates a media query that applies styles between two breakpoints
100
+ /// @param {String} $lower - Lower breakpoint name: 'xs', 'sm', 'md', 'lg', or 'xl'
101
+ /// @param {String} $upper - Upper breakpoint name: 'sm', 'md', 'lg', or 'xl'
102
+ /// @example
103
+ /// @include between('sm', 'lg') {
104
+ /// // styles that apply only between small and large screens
105
+ /// }
106
+ @mixin between($lower, $upper) {
107
+ $min: null;
108
+ $max: null;
109
+
110
+ // Set minimum breakpoint
111
+ @if $lower == 'xs' {
112
+ $min: $breakpoint-xs;
113
+ } @else if $lower == 'sm' {
114
+ $min: $breakpoint-sm;
115
+ } @else if $lower == 'md' {
116
+ $min: $breakpoint-md;
117
+ } @else if $lower == 'lg' {
118
+ $min: $breakpoint-lg;
119
+ } @else if $lower == 'xl' {
120
+ $min: $breakpoint-xl;
121
+ }
122
+
123
+ // Set maximum breakpoint
124
+ @if $upper == 'sm' {
125
+ $max: ($breakpoint-sm - 1);
126
+ } @else if $upper == 'md' {
127
+ $max: ($breakpoint-md - 1);
128
+ } @else if $upper == 'lg' {
129
+ $max: ($breakpoint-lg - 1);
130
+ } @else if $upper == 'xl' {
131
+ $max: ($breakpoint-xl - 1);
132
+ }
133
+
134
+ @if $min != null and $max != null {
135
+ @media (min-width: $min) and (max-width: $max) {
136
+ @content;
137
+ }
138
+ }
139
+ }
140
+
141
+ /// Creates a media query that applies styles only at a specific breakpoint range
142
+ /// @param {String} $breakpoint - Breakpoint name: 'xs', 'sm', 'md', 'lg', or 'xl'
143
+ /// @example
144
+ /// @include only('md') {
145
+ /// // styles that apply only to medium screens
146
+ /// }
147
+ @mixin only($breakpoint) {
148
+ @if $breakpoint == 'xs' {
149
+ @include between('xs', 'sm') {
150
+ @content;
151
+ }
152
+ } @else if $breakpoint == 'sm' {
153
+ @include between('sm', 'md') {
154
+ @content;
155
+ }
156
+ } @else if $breakpoint == 'md' {
157
+ @include between('md', 'lg') {
158
+ @content;
159
+ }
160
+ } @else if $breakpoint == 'lg' {
161
+ @include between('lg', 'xl') {
162
+ @content;
163
+ }
164
+ } @else if $breakpoint == 'xl' {
165
+ @media (min-width: $breakpoint-xl) {
166
+ @content;
167
+ }
168
+ }
169
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Public Sass entry point for @underlayerdev/ui breakpoint media queries.
3
+ *
4
+ * Consuming apps can import this via the `pkg:` importer:
5
+ *
6
+ * @use 'pkg:@underlayerdev/ui/breakpoints' as bp;
7
+ *
8
+ * .my-component {
9
+ * @include bp.up('md') {
10
+ * display: flex;
11
+ * }
12
+ * }
13
+ *
14
+ * Requires Dart Sass with the Node package importer enabled (supported by
15
+ * @angular/build out of the box since Angular CLI 20+).
16
+ */
17
+ @forward './breakpoints';
@@ -0,0 +1,12 @@
1
+ // Keep in sync with design-tokens/_variables.scss $breakpoint-*.
2
+ //
3
+ // Duplicated (not imported from ../core / ../design-tokens) so the
4
+ // published `./breakpoints` package export stays self-contained: Node's
5
+ // package "exports" boundaries block relative imports that cross from one
6
+ // exported subpath into a different one, so this file can't reach outside
7
+ // its own foundations/breakpoints/ directory once published.
8
+ $breakpoint-xs: 0px !default;
9
+ $breakpoint-sm: 768px !default;
10
+ $breakpoint-md: 1024px !default;
11
+ $breakpoint-lg: 1280px !default;
12
+ $breakpoint-xl: 1600px !default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@underlayerdev/ui",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "peerDependencies": {
5
5
  "@angular/cdk": "^22.0.0",
6
6
  "@angular/common": "^22.0.0",
@@ -21,7 +21,8 @@
21
21
  "types": "./types/underlayerdev-ui.d.ts",
22
22
  "default": "./fesm2022/underlayerdev-ui.mjs"
23
23
  },
24
- "./design-tokens/*": "./design-tokens/*"
24
+ "./design-tokens/*": "./design-tokens/*",
25
+ "./breakpoints/*": "./breakpoints/*"
25
26
  },
26
27
  "type": "module"
27
28
  }
@@ -15,6 +15,22 @@
15
15
  * - modal: dialogs
16
16
  * - toast: notifications
17
17
  */
18
+ /**
19
+ * Public Sass entry point for @underlayerdev/ui breakpoint media queries.
20
+ *
21
+ * Consuming apps can import this via the `pkg:` importer:
22
+ *
23
+ * @use 'pkg:@underlayerdev/ui/breakpoints' as bp;
24
+ *
25
+ * .my-component {
26
+ * @include bp.up('md') {
27
+ * display: flex;
28
+ * }
29
+ * }
30
+ *
31
+ * Requires Dart Sass with the Node package importer enabled (supported by
32
+ * @angular/build out of the box since Angular CLI 20+).
33
+ */
18
34
  .ul-rich-text {
19
35
  font-family: Ultra Nunito Sans;
20
36
  line-height: 28px;