@wwtdev/bsds-css 1.1.0 → 1.3.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.
@@ -0,0 +1,158 @@
1
+ @mixin tooltip() {
2
+ /* -------------------- BASE STYLES -------------------- */
3
+ .bs-tooltip {
4
+ display: inline-block;
5
+ position: relative;
6
+ }
7
+
8
+ .bs-tooltip :where(.bs-tooltip-text) {
9
+ align-items: center;
10
+ background-color: var(--bs-bg-base);
11
+ border-radius: 4px;
12
+ box-shadow: var(--bs-shadow-contentLowCenter);
13
+ color: var(--bs-violet-400);
14
+ display: flex;
15
+ font-size: var(--bs-text-sm);
16
+ justify-content: center;
17
+ max-width: 16rem;
18
+ min-width: 4rem;
19
+ opacity: 0;
20
+ padding-bottom: 0.25rem;
21
+ padding-left: 0.5rem;
22
+ padding-right: 0.5rem;
23
+ padding-top: 0.25rem;
24
+ position: absolute;
25
+ transform: scale(0);
26
+ transition-duration: 75ms;
27
+ transition-property: opacity, transform;
28
+ transition-timing-function: ease-in-out;
29
+ width: max-content;
30
+ z-index: 999;
31
+ }
32
+
33
+ /* -------------------- POSITION: UNDEFINED / TOP -------------------- */
34
+ .bs-tooltip:where(:not([data-position])) :where(.bs-tooltip-text),
35
+ .bs-tooltip:where([data-position="top"]) :where(.bs-tooltip-text) {
36
+ bottom: calc(100% + 0.5rem);
37
+ left: 50%;
38
+ transform-origin: bottom center;
39
+ transform: translateX(-50%) scale(0);
40
+ }
41
+
42
+ /* Active States */
43
+ :where(.bs-tooltip:not([data-position])):hover :where(.bs-tooltip-text),
44
+ :where(.bs-tooltip[data-position="top"]):hover :where(.bs-tooltip-text),
45
+ :where(.bs-tooltip:not([data-position])):focus-within :where(.bs-tooltip-text),
46
+ :where(.bs-tooltip[data-position="top"]):focus-within :where(.bs-tooltip-text),
47
+ :where(.bs-tooltip:not([data-position]))[data-shown] :where(.bs-tooltip-text),
48
+ :where(.bs-tooltip[data-position="top"])[data-shown] :where(.bs-tooltip-text) {
49
+ opacity: 1;
50
+ transform: translateX(-50%) scale(1);
51
+ }
52
+
53
+ /* -------------------- POSITION: BOTTOM -------------------- */
54
+ .bs-tooltip:where([data-position="bottom"]) :where(.bs-tooltip-text) {
55
+ left: 50%;
56
+ top: calc(100% + 0.5rem);
57
+ transform-origin: top center;
58
+ transform: translateX(-50%) scale(0);
59
+ }
60
+
61
+ /* Active States */
62
+ :where(.bs-tooltip[data-position="bottom"]):hover :where(.bs-tooltip-text),
63
+ :where(.bs-tooltip[data-position="bottom"]):focus-within :where(.bs-tooltip-text),
64
+ :where(.bs-tooltip[data-position="bottom"])[data-shown] :where(.bs-tooltip-text) {
65
+ opacity: 1;
66
+ transform: translateX(-50%) scale(1);
67
+ }
68
+
69
+ /* -------------------- POSITION: LEFT -------------------- */
70
+ .bs-tooltip:where([data-position="left"]) :where(.bs-tooltip-text) {
71
+ right: calc(100% + 0.5rem);
72
+ top: 50%;
73
+ transform-origin: center right;
74
+ transform: translateY(-50%) scale(0);
75
+ }
76
+
77
+ /* Active States */
78
+ :where(.bs-tooltip[data-position="left"]):hover :where(.bs-tooltip-text),
79
+ :where(.bs-tooltip[data-position="left"]):focus-within :where(.bs-tooltip-text),
80
+ :where(.bs-tooltip[data-position="left"])[data-shown] :where(.bs-tooltip-text) {
81
+ opacity: 1;
82
+ transform: translateY(-50%) scale(1);
83
+ }
84
+
85
+ /* -------------------- POSITION: RIGHT -------------------- */
86
+ .bs-tooltip:where([data-position="right"]) :where(.bs-tooltip-text) {
87
+ left: calc(100% + 0.5rem);
88
+ top: 50%;
89
+ transform-origin: center left;
90
+ transform: translateY(-50%) scale(0);
91
+ }
92
+
93
+ :where(.bs-tooltip[data-position="right"]):hover :where(.bs-tooltip-text),
94
+ :where(.bs-tooltip[data-position="right"]):focus-within :where(.bs-tooltip-text),
95
+ :where(.bs-tooltip[data-position="right"])[data-shown] :where(.bs-tooltip-text) {
96
+ opacity: 1;
97
+ transform: translateY(-50%) scale(1);
98
+ }
99
+
100
+ /* -------------------- POSITION: CORNERS -------------------- */
101
+ /* top-left */
102
+ .bs-tooltip:where([data-position="top-left"]) :where(.bs-tooltip-text) {
103
+ bottom: calc(100% + 0.5rem);
104
+ right: calc(100% + 0.5rem);
105
+ transform-origin: bottom right;
106
+ }
107
+
108
+ /* top-right */
109
+ .bs-tooltip:where([data-position="top-right"]) :where(.bs-tooltip-text) {
110
+ bottom: calc(100% + 0.5rem);
111
+ left: calc(100% + 0.5rem);
112
+ transform-origin: bottom left;
113
+ }
114
+
115
+ /* bottom-left */
116
+ .bs-tooltip:where([data-position="bottom-left"]) :where(.bs-tooltip-text) {
117
+ right: calc(100% + 0.5rem);
118
+ top: calc(100% + 0.5rem);
119
+ transform-origin: top right;
120
+ }
121
+
122
+ /* bottom-right */
123
+ .bs-tooltip:where([data-position="bottom-right"]) :where(.bs-tooltip-text) {
124
+ left: calc(100% + 0.5rem);
125
+ top: calc(100% + 0.5rem);
126
+ transform-origin: top left;
127
+ }
128
+
129
+ /* Active States */
130
+ :where(.bs-tooltip[data-position="top-left"]):hover :where(.bs-tooltip-text),
131
+ :where(.bs-tooltip[data-position="top-right"]):hover :where(.bs-tooltip-text),
132
+ :where(.bs-tooltip[data-position="bottom-left"]):hover :where(.bs-tooltip-text),
133
+ :where(.bs-tooltip[data-position="bottom-right"]):hover :where(.bs-tooltip-text),
134
+ :where(.bs-tooltip[data-position="top-left"]):focus-within :where(.bs-tooltip-text),
135
+ :where(.bs-tooltip[data-position="top-right"]):focus-within :where(.bs-tooltip-text),
136
+ :where(.bs-tooltip[data-position="bottom-left"]):focus-within :where(.bs-tooltip-text),
137
+ :where(.bs-tooltip[data-position="bottom-right"]):focus-within :where(.bs-tooltip-text),
138
+ :where(.bs-tooltip[data-position="top-left"])[data-shown] :where(.bs-tooltip-text),
139
+ :where(.bs-tooltip[data-position="top-right"])[data-shown] :where(.bs-tooltip-text),
140
+ :where(.bs-tooltip[data-position="bottom-left"])[data-shown] :where(.bs-tooltip-text),
141
+ :where(.bs-tooltip[data-position="bottom-right"])[data-shown] :where(.bs-tooltip-text) {
142
+ opacity: 1;
143
+ transform: scale(1);
144
+ }
145
+
146
+ /* -------------------- DISABLED -------------------- */
147
+ /*
148
+ Don't display unless data-shown is present
149
+ This must go last to properly override the other classes
150
+ */
151
+ :where(.bs-tooltip[data-disabled]:not([data-shown])):hover :where(.bs-tooltip-text),
152
+ :where(.bs-tooltip[data-disabled]:not([data-shown])):focus-within :where(.bs-tooltip-text) {
153
+ opacity: 0;
154
+ transform: scale(0);
155
+ }
156
+
157
+ }
158
+
@@ -65,18 +65,18 @@
65
65
  transform: rotate(180deg);
66
66
  }
67
67
 
68
- .bs-accordion :where(header button) > :where(h2, h3, h4, h5) {
68
+ .bs-accordion :where(header button) > :where(span) {
69
69
  grid-area: main;
70
70
  margin-right: var(--bs-space-2);
71
71
  text-align: left;
72
72
  }
73
73
 
74
- .bs-accordion :where(header button) > :where(h2, h3, h4, h5) :where(*) {
74
+ .bs-accordion :where(header button) > :where(span) {
75
75
  vertical-align: middle;
76
76
  }
77
77
 
78
78
  @media (min-width: 957px) {
79
- .bs-accordion :where(header button) > :where(h2, h3, h4, h5) {
79
+ .bs-accordion :where(header button) > :where(span) {
80
80
  margin-right: var(--bs-space-3);
81
81
  }
82
82
  }
@@ -0,0 +1,189 @@
1
+ /* Positioning the parent */
2
+ .bs-dropdown {
3
+ display: inline-block;
4
+ position: relative;
5
+ }
6
+
7
+ /* Option list */
8
+ .bs-dropdown :where(ul) {
9
+ background-color: var(--bs-white);
10
+ border-radius: 4px;
11
+ bottom: auto;
12
+ box-shadow: var(--bs-shadow-contentMedium);
13
+ line-height: 1.5rem;
14
+ list-style: none;
15
+ margin: 0;
16
+ max-height: 0;
17
+ max-width: 16.875rem;
18
+ opacity: 0;
19
+ overflow-y: auto;
20
+ padding: 0;
21
+ position: absolute;
22
+ top: calc(100% + 0.5rem);
23
+ transition-duration: 75ms;
24
+ transition-property: opacity, max-height;
25
+ transition-timing-function: ease-in-out;
26
+ z-index: 999;
27
+ }
28
+
29
+ /* (not) data-variant="fit" */
30
+ .bs-dropdown:not([data-variant="fit"]) :where(ul) {
31
+ width: 16.875rem;
32
+ }
33
+
34
+ /* data-shown */
35
+ .bs-dropdown:where([data-shown]) :where(ul) {
36
+ max-height: 20rem;
37
+ opacity: 1;
38
+ padding-top: 0.75rem;
39
+ }
40
+
41
+ /* data-position="top" */
42
+ .bs-dropdown:where([data-position="top"]) :where(ul) {
43
+ bottom: calc(100% + 0.5rem);
44
+ top: auto;
45
+ }
46
+
47
+ /* data-justify="center" */
48
+ .bs-dropdown:where([data-justify="center"]) :where(ul) {
49
+ left: 50%;
50
+ transform: translateX(-50%);
51
+ }
52
+
53
+ /* Option list item */
54
+ .bs-dropdown :where(ul li) {
55
+ align-items: center;
56
+ border-bottom: 2px solid transparent;
57
+ border-left: 4px solid transparent;
58
+ border-radius: 3px;
59
+ border-right: 2px solid transparent;
60
+ border-top: 2px solid transparent;
61
+ color: var(--bs-ink-base);
62
+ column-gap: 0.5rem;
63
+ cursor: pointer;
64
+ display: grid;
65
+ margin-bottom: 0.5rem;
66
+ padding-bottom: 0.25rem;
67
+ padding-left: 0.5rem;
68
+ padding-right: 0.75rem;
69
+ padding-top: 0.25rem;
70
+ row-gap: 0.125rem;
71
+ }
72
+
73
+ /* data-variant="search" (search input) */
74
+ .bs-dropdown :where(ul li[data-variant~="search"]) {
75
+ border-left: none;
76
+ cursor: default;
77
+ display: block;
78
+ }
79
+
80
+ /* data-variant="break" (list item) */
81
+ .bs-dropdown :where(ul li[data-variant~="break"]) {
82
+ border-left: none;
83
+ cursor: default;
84
+ display: block;
85
+ padding: 0;
86
+ }
87
+
88
+ /* data-variant="break" (actual line break) */
89
+ .bs-dropdown :where(ul li[data-variant~="break"] hr) {
90
+ background: var(--bs-navy-200);
91
+ }
92
+
93
+ /* data-variant="2-col" */
94
+ .bs-dropdown :where(ul li[data-variant~="2-col"]) {
95
+ grid-template-columns: min-content 1fr;
96
+ }
97
+
98
+ /* data-variant="description" */
99
+ /* Description will be the 2nd child in a 1-column item */
100
+ .bs-dropdown :where(ul li:not([data-variant~="2-col"])[data-variant~="description"] :nth-child(2)) {
101
+ color: var(--bs-ink-light);
102
+ font-size: var(--bs-text-xs);
103
+ height: 1.125rem;
104
+ line-height: 1.125rem;
105
+ }
106
+
107
+ /* data-variant="2-col description" */
108
+ /* Description will be the 3rd child in a 2-column item */
109
+ .bs-dropdown :where(ul li[data-variant~="2-col"][data-variant~="description"] :nth-child(3)) {
110
+ color: var(--bs-ink-light);
111
+ font-size: var(--bs-text-xs);
112
+ grid-column-start: 2;
113
+ height: 1.125rem;
114
+ line-height: 1.125rem;
115
+ }
116
+
117
+ /* List item hover or data-selected */
118
+ .bs-dropdown :where(ul li:hover),
119
+ .bs-dropdown :where(ul li[data-selected]) {
120
+ background-color: var(--bs-bg-subtle);
121
+ border-left: 4px solid var(--bs-blue-400);
122
+ color: var(--bs-blue-400);
123
+ outline: none;
124
+ }
125
+
126
+ /* data-variant="search" or data-variant="break" hover */
127
+ .bs-dropdown :where(ul li[data-variant~="search"]:hover),
128
+ .bs-dropdown :where(ul li[data-variant~="break"]:hover) {
129
+ background-color: transparent;
130
+ border-left: none;
131
+ color: var(--bs-ink-base);
132
+ }
133
+
134
+ /* data-variant="negative" hover, data-selected, and both */
135
+ .bs-dropdown :where(ul li[data-variant~="negative"]:hover),
136
+ .bs-dropdown :where(ul li[data-variant~="negative"][data-selected]),
137
+ .bs-dropdown :where(ul li[data-variant~="negative"][data-selected]:hover) {
138
+ /* 25% alpha version of --bs-red-400 */
139
+ background-color: rgba(248, 169, 170, 0.25);
140
+ border-left: 4px solid var(--bs-red-500);
141
+ color: var(--bs-red-500);
142
+ }
143
+
144
+ /* data-variant="description" or data-variant="2-col description" hover or data-selected */
145
+ .bs-dropdown :where(ul li:not([data-variant~="2-col"])[data-variant~="description"]:hover :nth-child(2)),
146
+ .bs-dropdown :where(ul li[data-variant~="2-col"][data-variant~="description"]:hover :nth-child(3)),
147
+ .bs-dropdown :where(ul li:not([data-variant~="2-col"])[data-variant~="description"][data-selected] :nth-child(2)),
148
+ .bs-dropdown :where(ul li[data-variant~="2-col"][data-variant~="description"][data-selected] :nth-child(3)) {
149
+ color: var(--bs-blue-400);
150
+ }
151
+
152
+ /* data-variant="negative description" or data-variant="2-col negative description" hover or data-selected */
153
+ .bs-dropdown :where(ul li[data-variant~="negative"]:not([data-variant~="2-col"])[data-variant~="description"]:hover :nth-child(2)),
154
+ .bs-dropdown :where(ul li[data-variant~="negative"][data-variant~="2-col"][data-variant~="description"]:hover :nth-child(3)),
155
+ .bs-dropdown :where(ul li[data-variant~="negative"]:not([data-variant~="2-col"])[data-variant~="description"][data-selected] :nth-child(2)),
156
+ .bs-dropdown :where(ul li[data-variant~="negative"][data-variant~="2-col"][data-variant~="description"][data-selected] :nth-child(3)) {
157
+ color: var(--bs-red-500);
158
+ }
159
+
160
+ /* List option mouse click focus (do not show) */
161
+ .bs-dropdown :where(ul li:focus:not(:focus-visible)){
162
+ outline: none;
163
+ }
164
+
165
+ /* data-variant="negative" list option mouse click focus (do not show) */
166
+ li[data-variant~="negative"]:focus:not(:focus-visible) {
167
+ outline: none;
168
+ }
169
+
170
+ /* List option keyboard navigation focus */
171
+ .bs-dropdown :where(ul li:focus-visible) {
172
+ --focus-border-color: var(--bs-blue-400);
173
+ border: 2px solid var(--focus-border-color);
174
+ outline: none;
175
+ padding-left: 0.625rem;
176
+ }
177
+
178
+ /* Navigation focus on a selected element should preserve 4px left border */
179
+ .bs-dropdown :where(ul li[data-selected]:focus-visible) {
180
+ border-left: 4px solid var(--focus-border-color);
181
+ padding-left: 0.5rem;
182
+ }
183
+
184
+ /* data-variant="negative" list option keyboard navigation focus */
185
+ .bs-dropdown :where(ul li[data-variant~="negative"]:focus-visible) {
186
+ --focus-border-color: var(--bs-red-200);
187
+ }
188
+
189
+
@@ -42,6 +42,7 @@
42
42
  appearance: none;
43
43
  background-color: var(--bg-base);
44
44
  box-shadow: inset 0 0 0 0.125rem var(--box-shadow);
45
+ cursor: pointer;
45
46
  display: grid;
46
47
  height: 1rem;
47
48
  margin: 0;
@@ -160,6 +161,7 @@ input:where([type='checkbox']:checked, [type='checkbox']:indeterminate, [type='r
160
161
  input:where([type='checkbox'], [type='radio']):disabled {
161
162
  --box-shadow: var(--bs-gray-400);
162
163
  background-color: transparent;
164
+ cursor: default;
163
165
  }
164
166
 
165
167
  input:where([type='checkbox']):checked:disabled::before,
@@ -175,5 +177,6 @@ input:where([type='radio']):checked:disabled::before {
175
177
  /* Error state */
176
178
 
177
179
  input:where([type='checkbox'], [type='radio'])[data-error] {
178
- --box-shadow: var(--bs-red-400);
180
+ --box-shadow: var(--bs-red-500);
181
+ --outline-color: var(--bs-red-200);
179
182
  }
@@ -1,3 +1,4 @@
1
+ /* Generally applicable (all input types) */
1
2
  :where([data-required]) {
2
3
  color: var(--bs-red-500);
3
4
  font-weight: var(--bs-font-bold, 600);
@@ -7,106 +8,16 @@
7
8
  color: var(--bs-gray-400);
8
9
  }
9
10
 
10
- :where(label + input, label > input):where(:not([type='checkbox'], [type='radio'])),
11
- :where(label + textarea, label > textarea),
12
- :where(label + select, label > select) {
13
- margin-top: 0.25rem;
14
- }
15
-
16
- input:where(:not([type='checkbox'], [type='radio'], [type='file'], [type='range'])),
17
- textarea, select {
18
- appearance: none;
19
- background-color: var(--input-bg, var(--bs-bg-base));
20
- border: 1px solid var(--input-border, var(--bs-violet-300));
21
- border-radius: 0.25rem;
22
- color: var(--bs-ink-base);
23
- font-size: var(--bs-text-base);
24
- font-weight: 400;
25
- height: 2.5rem;
26
- line-height: var(--bs-leading-base);
27
- min-height: 2.5rem;
28
- padding-inline: 0.75rem;
29
- width: 100%;
30
- }
31
-
32
- textarea {
33
- height: auto;
34
- padding-block: 0.5rem;
35
- resize: vertical;
36
- }
37
-
38
- /* Generally applicable (all input types) */
39
- :is(input, textarea, select)::placeholder {
40
- color: var(--bs-violet-200);
41
- opacity: 1;
42
- }
43
-
44
-
45
- :is(input:where(:not([type='checkbox'], [type='radio']), textarea, select):where(:focus)) {
46
- box-shadow: 0 0 0 2px var(--offset-color, var(--bs-bg-base)),
47
- 0 0 0 4px var(--outline-color, var(--bs-blue-400));
48
- outline: 2px solid transparent;
49
- }
50
- :where(.box) :is(input, textarea, select):where(:focus) {
11
+ :where(.box) :is(input, textarea, select):where(:focus-visible) {
51
12
  --offset-color: var(--bs-bg-subtle);
52
13
  }
53
- :where(.box[data-invert]) :is(input, textarea, select):where(:focus) {
14
+ :where(.box[data-invert]) :is(input, textarea, select):where(:focus-visible) {
54
15
  --offset-color: var(--bs-bg-invert);
55
16
  }
56
17
 
57
- :is(input, textarea, select):where([data-error]) {
58
- --outline-color: var(--bs-red-200);
59
- }
60
-
61
- :is(input:where(:not([type='checkbox'],[type='radio'])), textarea, select):where(:disabled) {
62
- background-color: var(--bs-gray-200);
63
- border-color: var(--bs-gray-400);
64
- color: var(--bs-gray-400);
65
- }
66
-
67
- /*
68
- Removes the built-in 'margin' on bottom of textarea
69
- see https://bugs.chromium.org/p/chromium/issues/detail?id=89530
70
- :has not fully supported yet but will work for most
71
- */
72
- :has(> textarea:only-child) {
73
- display: block;
74
- line-height: 0;
75
- }
76
-
77
- /* chrome user agent styling was applying opacity: 0.7 */
78
- :where(select:disabled) {
79
- opacity: 1;
80
- }
81
-
82
- :is(input, textarea, select):disabled::placeholder,
83
- :is(input, textarea, select)[disabled]::placeholder {
84
- color: var(--bs-gray-400);
85
- opacity: 1;
86
- }
87
-
88
- /* Select */
89
-
90
- select {
91
- /* URL Encoded SVG dropdown caret so there is something there */
92
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath fill='%230A0B19' d='M8.048 13.375a.745.745 0 0 1-.526-.217L0 5.686l1.053-1.061 6.995 6.95 6.897-6.85 1.053 1.06-7.423 7.373a.745.745 0 0 1-.527.217Z'/%3E%3C/svg%3E");
93
- background-position: right 0.75rem center;
94
- background-repeat: no-repeat;
95
- background-size: 1em 1em;
96
- }
97
- .dark select {
98
- /* URL Encoded SVG dropdown caret so there is something there */
99
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath fill='%23ffffff' d='M8.048 13.375a.745.745 0 0 1-.526-.217L0 5.686l1.053-1.061 6.995 6.95 6.897-6.85 1.053 1.06-7.423 7.373a.745.745 0 0 1-.527.217Z'/%3E%3C/svg%3E");
100
- }
101
-
102
- .dark select:disabled {
103
- /* URL Encoded SVG dropdown caret so there is something there */
104
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath fill='%23555775' d='M8.048 13.375a.745.745 0 0 1-.526-.217L0 5.686l1.053-1.061 6.995 6.95 6.897-6.85 1.053 1.06-7.423 7.373a.745.745 0 0 1-.527.217Z'/%3E%3C/svg%3E");
105
- }
106
-
107
18
  /* Errors and Messages */
108
19
  :is(input, select, textarea):where([data-error]) {
109
- --input-border: var(--bs-red-400);
20
+ --input-border: var(--bs-red-500);
110
21
  }
111
22
 
112
23
  /* Fieldset */
@@ -1,10 +1,13 @@
1
1
  .bs-hint {
2
+ min-width: 0;
2
3
  color: var(--bs-ink-light);
3
4
  font-size: var(--bs-text-xs);
4
5
  padding: 0;
5
6
  margin: 0;
6
7
  list-style: none;
8
+ overflow-wrap: break-word;
7
9
  }
10
+
8
11
  .bs-hint:where([data-error]) {
9
12
  color: var(--bs-red-400);
10
13
  }