free-astro-components 0.0.32 → 0.0.34

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A collection of free Astro components",
4
4
  "author": "Denis Ventura",
5
5
  "type": "module",
6
- "version": "0.0.32",
6
+ "version": "0.0.34",
7
7
  "exports": {
8
8
  ".": {
9
9
  "import": {
@@ -31,7 +31,10 @@ const inputClasses = ['ac-input', statusClasses, className]
31
31
  .join(' ')
32
32
  ---
33
33
 
34
- <label class="ac-input-wrapper">
34
+ <label
35
+ data-input-password-wrapper={props.type === 'password'}
36
+ class="ac-input-wrapper"
37
+ >
35
38
  {label && <span class="ac-input-label">{label}</span>}
36
39
  <div>
37
40
  {
@@ -39,7 +42,11 @@ const inputClasses = ['ac-input', statusClasses, className]
39
42
  <Icon icon="search" class="ac-input-icon ac-input-icon--left" />
40
43
  )
41
44
  }
42
- <input class={inputClasses} {...props} />
45
+ <input
46
+ data-input-password={props.type === 'password'}
47
+ class={inputClasses}
48
+ {...props}
49
+ />
43
50
  {
44
51
  icon && props.type !== 'password' && (
45
52
  <Icon icon={icon} class="ac-input-icon ac-input-icon--right" />
@@ -47,7 +54,11 @@ const inputClasses = ['ac-input', statusClasses, className]
47
54
  }
48
55
  {
49
56
  props && props.type === 'password' && (
50
- <button class="ac-input-password-btn">
57
+ <button
58
+ data-input-password-button
59
+ data-is-visible="false"
60
+ class="ac-input-password-btn"
61
+ >
51
62
  <Icon icon="eye" class="ac-input-eye" />
52
63
  <Icon icon="eye-off" class="ac-input-eye-off" />
53
64
  </button>
@@ -194,17 +205,13 @@ const inputClasses = ['ac-input', statusClasses, className]
194
205
  width: var(--ac-spacing-6);
195
206
  }
196
207
 
197
- .ac-input-eye-off {
208
+ &[data-is-visible='false'] .ac-input-eye-off {
198
209
  display: none;
199
210
  }
200
211
 
201
- &.is-visible .ac-input-eye {
212
+ &[data-is-visible='true'] .ac-input-eye {
202
213
  display: none;
203
214
  }
204
-
205
- &.is-visible .ac-input-eye-off {
206
- display: block;
207
- }
208
215
  }
209
216
  </style>
210
217
 
@@ -214,17 +221,15 @@ const inputClasses = ['ac-input', statusClasses, className]
214
221
 
215
222
  DOMLoaded(() => {
216
223
  const inputPasswordButtons = document.querySelectorAll(
217
- '.ac-input-password-btn'
224
+ '[data-input-password-button]'
218
225
  )
219
226
 
220
227
  inputPasswordButtons.forEach((button) => {
221
228
  button.addEventListener('click', (event) => {
222
229
  event.preventDefault()
223
230
  const input = button
224
- ?.closest('.ac-input-wrapper')
225
- ?.querySelector('input')
226
-
227
- if (!input) return
231
+ ?.closest('[data-input-password-wrapper]')
232
+ ?.querySelector('[data-input-password]') as HTMLInputElement
228
233
 
229
234
  toggleInputPassword(button, input)
230
235
  })
@@ -33,21 +33,22 @@ const statusClasses = {
33
33
  success: 'ac-select--success',
34
34
  }[status]
35
35
 
36
- const selectClasses = [
37
- 'ac-select',
38
- statusClasses,
39
- className,
40
- hasSelectedOption ? 'is-selected' : '',
41
- ]
36
+ const selectClasses = ['ac-select', statusClasses, className]
42
37
  .filter(Boolean)
43
38
  .join(' ')
44
39
  ---
45
40
 
46
- <label class="ac-select-wrapper">
41
+ <label data-select-wrapper class="ac-select-wrapper">
47
42
  {label && <span class="ac-select-label">{label}</span>}
48
43
 
49
44
  <div>
50
- <select class={selectClasses} {...props}>
45
+ <select
46
+ data-select
47
+ aria-expanded="false"
48
+ data-selected={hasSelectedOption ? 'true' : 'false'}
49
+ class={selectClasses}
50
+ {...props}
51
+ >
51
52
  {
52
53
  hasSelectedOption ? (
53
54
  <option disabled hidden>
@@ -71,13 +72,17 @@ const selectClasses = [
71
72
 
72
73
  <Icon icon="chevron-down" class="ac-select-icon" />
73
74
 
74
- <div class="ac-select-popover">
75
+ <div data-select-popover class="ac-select-popover">
75
76
  <div>
76
77
  <ul class="ac-select-list">
77
78
  {
78
79
  options.map((option) => (
79
80
  <li>
80
- <button disabled class={option.selected ? 'is-selected' : ''}>
81
+ <button
82
+ data-select-option
83
+ disabled
84
+ aria-selected={option.selected ? 'true' : 'false'}
85
+ >
81
86
  <span>{option.label}</span>
82
87
  <Icon icon="check" />
83
88
  </button>
@@ -117,11 +122,11 @@ const selectClasses = [
117
122
  position: relative;
118
123
  }
119
124
 
120
- &:has(.ac-select.is-open) .ac-select-icon {
125
+ &:has(.ac-select[aria-expanded='true']) .ac-select-icon {
121
126
  transform: translateY(-50%) rotate(180deg);
122
127
  }
123
128
 
124
- &:has(.ac-select.is-open) .ac-select-popover {
129
+ &:has(.ac-select[aria-expanded='true']) .ac-select-popover {
125
130
  grid-template-rows: 1fr;
126
131
  }
127
132
 
@@ -157,12 +162,12 @@ const selectClasses = [
157
162
  transition: all 0.3s ease-in-out;
158
163
  width: 100%;
159
164
 
160
- &.is-selected {
165
+ &[data-selected='true'] {
161
166
  color: rgb(var(--ac-color-700));
162
167
  }
163
168
 
164
- &.is-open,
165
- &.is-open:hover {
169
+ &[aria-expanded='true'],
170
+ &[aria-expanded='true']:hover {
166
171
  border-color: var(--ac-primary-hover);
167
172
  }
168
173
 
@@ -279,6 +284,7 @@ const selectClasses = [
279
284
 
280
285
  &:hover,
281
286
  &:focus {
287
+ color: var(--ac-primary-hover);
282
288
  background-color: rgba(var(--ac-primary), 0.1);
283
289
  }
284
290
 
@@ -286,7 +292,7 @@ const selectClasses = [
286
292
  outline: none;
287
293
  }
288
294
 
289
- &.is-selected {
295
+ &[aria-selected='true'] {
290
296
  background-color: rgba(var(--ac-primary), 0.1);
291
297
  color: rgb(var(--ac-color-700));
292
298
 
@@ -309,16 +315,16 @@ const selectClasses = [
309
315
  } from '../utils/select.ts'
310
316
 
311
317
  DOMLoaded(() => {
312
- const selects = document.querySelectorAll('.ac-select')
318
+ const selects = document.querySelectorAll('[data-select]')
313
319
 
314
320
  selects.forEach((item) => {
315
321
  const select = item as HTMLSelectElement
316
- const selectWrapper = select.closest('.ac-select-wrapper')
322
+ const selectWrapper = select.closest('[data-select-wrapper]')
317
323
  const popover = selectWrapper?.querySelector(
318
- '.ac-select-popover'
324
+ '[data-select-popover]'
319
325
  ) as HTMLElement
320
326
  const options = popover?.querySelectorAll(
321
- '.ac-select-list li button'
327
+ '[data-select-option]'
322
328
  ) as NodeListOf<HTMLButtonElement>
323
329
 
324
330
  let isOpen = false
@@ -10,14 +10,16 @@ const { tabs = [{ label: 'tab 1', active: true }, { label: 'tab 1' }] } =
10
10
  ---
11
11
 
12
12
  <div data-tab class="ac-tab">
13
- <ul data-tab-header class="ac-tab-header">
13
+ <ul data-tab-header role="tablist" class="ac-tab-header">
14
14
  {
15
15
  tabs.map((tab) => (
16
16
  <li>
17
17
  <button
18
18
  class="ac-tab-button"
19
+ role="tab"
19
20
  data-tab-button
20
- data-active={tab.active}
21
+ aria-selected={tab.active}
22
+ tabindex={tab.active ? 0 : -1}
21
23
  >
22
24
  {tab.label}
23
25
  </button>
@@ -56,7 +58,9 @@ const { tabs = [{ label: 'tab 1', active: true }, { label: 'tab 1' }] } =
56
58
  border-bottom-width: var(--ac-border-2);
57
59
  border-color: var(--ac-transparent);
58
60
  color: rgb(var(--ac-color-500));
61
+ cursor: pointer;
59
62
  display: flex;
63
+ font-family: var(--ac-font-sans);
60
64
  font-size: var(--ac-text-sm);
61
65
  gap: var(--ac-spacing-2);
62
66
  justify-content: center;
@@ -68,10 +72,10 @@ const { tabs = [{ label: 'tab 1', active: true }, { label: 'tab 1' }] } =
68
72
  color: var(--ac-primary-hover);
69
73
  }
70
74
 
71
- &[data-active] {
75
+ &[aria-selected='true'] {
72
76
  border-color: rgb(var(--ac-primary));
73
77
  color: rgb(var(--ac-primary));
74
- font-weight: var(--ac-font-bold);
78
+ font-weight: var(--ac-font-medium);
75
79
  }
76
80
  }
77
81
  </style>
@@ -2,7 +2,12 @@
2
2
  const { active } = Astro.props
3
3
  ---
4
4
 
5
- <div data-tab-pane data-active={active} class="ac-tab-pane">
5
+ <div
6
+ data-tab-pane
7
+ aria-hidden={active ? 'false' : 'true'}
8
+ role="tabpanel"
9
+ class="ac-tab-pane"
10
+ >
6
11
  <slot />
7
12
  </div>
8
13
 
@@ -10,7 +15,7 @@ const { active } = Astro.props
10
15
  .ac-tab-pane {
11
16
  display: none;
12
17
 
13
- &[data-active] {
18
+ &[aria-hidden='false'] {
14
19
  display: block;
15
20
  }
16
21
  }
@@ -1,9 +1,12 @@
1
- export const toggleInputPassword = (button: Element, input: HTMLInputElement) => {
2
- if (button.classList.contains('is-visible')) {
1
+ export const toggleInputPassword = (
2
+ button: Element,
3
+ input: HTMLInputElement,
4
+ ) => {
5
+ if (button.getAttribute('data-is-visible') === 'true') {
3
6
  input.type = 'password'
4
- button.classList.remove('is-visible')
7
+ button.setAttribute('data-is-visible', 'false')
5
8
  } else {
6
9
  input.type = 'text'
7
- button.classList.add('is-visible')
10
+ button.setAttribute('data-is-visible', 'true')
8
11
  }
9
- }
12
+ }
@@ -1,17 +1,17 @@
1
1
  export const openSelect = (
2
2
  event: Event,
3
3
  options: NodeListOf<HTMLButtonElement>,
4
- select: HTMLSelectElement
4
+ select: HTMLSelectElement,
5
5
  ): Promise<void> => {
6
6
  event.preventDefault()
7
- select.classList.add('is-open')
7
+ select.setAttribute('aria-expanded', 'true')
8
8
 
9
9
  return new Promise((resolve) => {
10
10
  let hasSelectedOption = false
11
11
 
12
12
  options.forEach((option: HTMLButtonElement) => {
13
13
  option.removeAttribute('disabled')
14
- if (option.classList.contains('is-selected')) {
14
+ if (option.getAttribute('aria-selected') === 'true') {
15
15
  hasSelectedOption = true
16
16
  option.focus()
17
17
  }
@@ -27,9 +27,9 @@ export const openSelect = (
27
27
 
28
28
  export const closeSelect = (
29
29
  options: NodeListOf<HTMLButtonElement>,
30
- select: HTMLSelectElement
30
+ select: HTMLSelectElement,
31
31
  ) => {
32
- select.classList.remove('is-open')
32
+ select.setAttribute('aria-expanded', 'false')
33
33
  options.forEach((option: HTMLButtonElement) => {
34
34
  option.setAttribute('disabled', 'disabled')
35
35
  })
@@ -39,12 +39,14 @@ export const selectOption = (
39
39
  index: number,
40
40
  options: NodeListOf<HTMLButtonElement>,
41
41
  option: Element,
42
- select: HTMLSelectElement
42
+ select: HTMLSelectElement,
43
43
  ) => {
44
44
  select.selectedIndex = index + 1
45
- select.classList.add('is-selected')
46
- options.forEach((option: Element) => option.classList.remove('is-selected'))
47
- option.classList.add('is-selected')
45
+ select.setAttribute('data-selected', 'true')
46
+ options.forEach((option: Element) => {
47
+ option.setAttribute('aria-selected', 'false')
48
+ })
49
+ option.setAttribute('aria-selected', 'true')
48
50
  }
49
51
 
50
52
  export const handleDocumentMousedown = (
@@ -53,7 +55,7 @@ export const handleDocumentMousedown = (
53
55
  select: HTMLSelectElement,
54
56
  popover: HTMLElement,
55
57
  isOpen: boolean,
56
- setIsOpen: (isOpen: boolean) => void
58
+ setIsOpen: (isOpen: boolean) => void,
57
59
  ) => {
58
60
  if (!isOpen) return
59
61
 
@@ -72,13 +74,13 @@ export const handleDocumentKeydown = (
72
74
  options: NodeListOf<HTMLButtonElement>,
73
75
  select: HTMLSelectElement,
74
76
  isOpen: boolean,
75
- setIsOpen: (isOpen: boolean) => void
77
+ setIsOpen: (isOpen: boolean) => void,
76
78
  ) => {
77
79
  if (!isOpen) return
78
80
 
79
81
  const activeElement = document.activeElement as HTMLElement
80
82
  const focusedOption = Array.from(options).indexOf(
81
- activeElement as HTMLButtonElement
83
+ activeElement as HTMLButtonElement,
82
84
  )
83
85
 
84
86
  if (event.key === 'Escape') {
@@ -99,10 +101,9 @@ export const handleDocumentKeydown = (
99
101
  export const focusNextOption = (
100
102
  currentIndex: number,
101
103
  options: NodeListOf<HTMLButtonElement>,
102
- direction: number
104
+ direction: number,
103
105
  ) => {
104
106
  if (currentIndex === -1) return
105
- const nextIndex =
106
- (currentIndex + direction + options.length) % options.length
107
+ const nextIndex = (currentIndex + direction + options.length) % options.length
107
108
  options[nextIndex].focus()
108
- }
109
+ }
package/src/utils/tab.ts CHANGED
@@ -16,8 +16,12 @@ const desactivateAll = (
16
16
  tabButtons: NodeListOf<HTMLElement>,
17
17
  tabPanes: NodeListOf<HTMLElement>,
18
18
  ) => {
19
- tabButtons.forEach((button) => button.removeAttribute('data-active'))
20
- tabPanes.forEach((pane) => pane.removeAttribute('data-active'))
19
+ tabButtons.forEach((button) => {
20
+ button.setAttribute('aria-selected', 'false')
21
+ })
22
+ tabPanes.forEach((pane) => {
23
+ pane.setAttribute('aria-hidden', 'true')
24
+ })
21
25
  }
22
26
 
23
27
  const activateTab = (
@@ -27,6 +31,8 @@ const activateTab = (
27
31
  ) => {
28
32
  const index = Array.from(tabButtons).indexOf(button)
29
33
 
30
- button.setAttribute('data-active', 'true')
31
- if (tabPanes[index]) tabPanes[index].setAttribute('data-active', 'true')
34
+ button.setAttribute('aria-selected', 'true')
35
+ if (tabPanes[index]) {
36
+ tabPanes[index].setAttribute('aria-hidden', 'false')
37
+ }
32
38
  }
@@ -1,4 +0,0 @@
1
- {
2
- "recommendations": ["astro-build.astro-vscode"],
3
- "unwantedRecommendations": []
4
- }
@@ -1,11 +0,0 @@
1
- {
2
- "version": "0.2.0",
3
- "configurations": [
4
- {
5
- "command": "./node_modules/.bin/astro dev",
6
- "name": "Development server",
7
- "request": "launch",
8
- "type": "node-terminal"
9
- }
10
- ]
11
- }
@@ -1,3 +0,0 @@
1
- {
2
- "liveServer.settings.port": 5501
3
- }
@@ -1,431 +0,0 @@
1
- /*
2
- 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
3
- 2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
4
- */
5
-
6
- *,
7
- ::before,
8
- ::after {
9
- box-sizing: border-box;
10
- /* 1 */
11
- border-width: 0;
12
- /* 2 */
13
- border-style: solid;
14
- /* 2 */
15
- border-color: currentColor;
16
- /* 2 */
17
- }
18
-
19
- ::before,
20
- ::after {
21
- --tw-content: '';
22
- }
23
-
24
- /*
25
- 1. Use a consistent sensible line-height in all browsers.
26
- 2. Prevent adjustments of font size after orientation changes in iOS.
27
- 3. Use a more readable tab size.
28
- 4. Use the user's configured `sans` font-family by default.
29
- 5. Use the user's configured `sans` font-feature-settings by default.
30
- 6. Use the user's configured `sans` font-variation-settings by default.
31
- 7. Disable tap highlights on iOS
32
- */
33
-
34
- html,
35
- :host {
36
- line-height: 1.5;
37
- /* 1 */
38
- -webkit-text-size-adjust: 100%;
39
- /* 2 */
40
- -moz-tab-size: 4;
41
- /* 3 */
42
- tab-size: 4;
43
- /* 3 */
44
- font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
45
- /* 4 */
46
- font-feature-settings: normal;
47
- /* 5 */
48
- font-variation-settings: normal;
49
- /* 6 */
50
- -webkit-tap-highlight-color: transparent;
51
- /* 7 */
52
- }
53
-
54
- /*
55
- 1. Remove the margin in all browsers.
56
- 2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
57
- */
58
-
59
- body {
60
- margin: 0;
61
- /* 1 */
62
- line-height: inherit;
63
- /* 2 */
64
- }
65
-
66
- /*
67
- 1. Add the correct height in Firefox.
68
- 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
69
- 3. Ensure horizontal rules are visible by default.
70
- */
71
-
72
- hr {
73
- height: 0;
74
- /* 1 */
75
- color: inherit;
76
- /* 2 */
77
- border-top-width: 1px;
78
- /* 3 */
79
- }
80
-
81
- /*
82
- Add the correct text decoration in Chrome, Edge, and Safari.
83
- */
84
-
85
- abbr:where([title]) {
86
- text-decoration: underline dotted;
87
- }
88
-
89
- /*
90
- Remove the default font size and weight for headings.
91
- */
92
-
93
- h1,
94
- h2,
95
- h3,
96
- h4,
97
- h5,
98
- h6 {
99
- font-size: inherit;
100
- font-weight: inherit;
101
- }
102
-
103
- /*
104
- Reset links to optimize for opt-in styling instead of opt-out.
105
- */
106
-
107
- a {
108
- color: inherit;
109
- text-decoration: inherit;
110
- }
111
-
112
- /*
113
- Add the correct font weight in Edge and Safari.
114
- */
115
-
116
- b,
117
- strong {
118
- font-weight: bolder;
119
- }
120
-
121
- /*
122
- 1. Use the user's configured `mono` font-family by default.
123
- 2. Use the user's configured `mono` font-feature-settings by default.
124
- 3. Use the user's configured `mono` font-variation-settings by default.
125
- 4. Correct the odd `em` font sizing in all browsers.
126
- */
127
-
128
- code,
129
- kbd,
130
- samp,
131
- pre {
132
- font-family: 'fontFamily.mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
133
- /* 1 */
134
- font-feature-settings: normal;
135
- /* 2 */
136
- font-variation-settings: normal;
137
- /* 3 */
138
- font-size: 1em;
139
- /* 4 */
140
- }
141
-
142
- /*
143
- Add the correct font size in all browsers.
144
- */
145
-
146
- small {
147
- font-size: 80%;
148
- }
149
-
150
- /*
151
- Prevent `sub` and `sup` elements from affecting the line height in all browsers.
152
- */
153
-
154
- sub,
155
- sup {
156
- font-size: 75%;
157
- line-height: 0;
158
- position: relative;
159
- vertical-align: baseline;
160
- }
161
-
162
- sub {
163
- bottom: -0.25em;
164
- }
165
-
166
- sup {
167
- top: -0.5em;
168
- }
169
-
170
- /*
171
- 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
172
- 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
173
- 3. Remove gaps between table borders by default.
174
- */
175
-
176
- table {
177
- text-indent: 0;
178
- /* 1 */
179
- border-color: inherit;
180
- /* 2 */
181
- border-collapse: collapse;
182
- /* 3 */
183
- }
184
-
185
- /*
186
- 1. Change the font styles in all browsers.
187
- 2. Remove the margin in Firefox and Safari.
188
- 3. Remove default padding in all browsers.
189
- */
190
-
191
- button,
192
- input,
193
- optgroup,
194
- select,
195
- textarea {
196
- font-family: inherit;
197
- /* 1 */
198
- font-feature-settings: inherit;
199
- /* 1 */
200
- font-variation-settings: inherit;
201
- /* 1 */
202
- font-size: 100%;
203
- /* 1 */
204
- font-weight: inherit;
205
- /* 1 */
206
- line-height: inherit;
207
- /* 1 */
208
- letter-spacing: inherit;
209
- /* 1 */
210
- color: inherit;
211
- /* 1 */
212
- margin: 0;
213
- /* 2 */
214
- padding: 0;
215
- /* 3 */
216
- }
217
-
218
- /*
219
- Remove the inheritance of text transform in Edge and Firefox.
220
- */
221
-
222
- button,
223
- select {
224
- text-transform: none;
225
- }
226
-
227
- /*
228
- 1. Correct the inability to style clickable types in iOS and Safari.
229
- 2. Remove default button styles.
230
- */
231
-
232
- button,
233
- input:where([type='button']),
234
- input:where([type='reset']),
235
- input:where([type='submit']) {
236
- -webkit-appearance: button;
237
- /* 1 */
238
- background-color: transparent;
239
- /* 2 */
240
- background-image: none;
241
- /* 2 */
242
- }
243
-
244
- /*
245
- Use the modern Firefox focus style for all focusable elements.
246
- */
247
-
248
- :-moz-focusring {
249
- outline: auto;
250
- }
251
-
252
- /*
253
- Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
254
- */
255
-
256
- :-moz-ui-invalid {
257
- box-shadow: none;
258
- }
259
-
260
- /*
261
- Add the correct vertical alignment in Chrome and Firefox.
262
- */
263
-
264
- progress {
265
- vertical-align: baseline;
266
- }
267
-
268
- /*
269
- Correct the cursor style of increment and decrement buttons in Safari.
270
- */
271
-
272
- ::-webkit-inner-spin-button,
273
- ::-webkit-outer-spin-button {
274
- height: auto;
275
- }
276
-
277
- /*
278
- 1. Correct the odd appearance in Chrome and Safari.
279
- 2. Correct the outline style in Safari.
280
- */
281
-
282
- [type='search'] {
283
- -webkit-appearance: textfield;
284
- /* 1 */
285
- outline-offset: -2px;
286
- /* 2 */
287
- }
288
-
289
- /*
290
- Remove the inner padding in Chrome and Safari on macOS.
291
- */
292
-
293
- ::-webkit-search-decoration {
294
- -webkit-appearance: none;
295
- }
296
-
297
- /*
298
- 1. Correct the inability to style clickable types in iOS and Safari.
299
- 2. Change font properties to `inherit` in Safari.
300
- */
301
-
302
- ::-webkit-file-upload-button {
303
- -webkit-appearance: button;
304
- /* 1 */
305
- font: inherit;
306
- /* 2 */
307
- }
308
-
309
- /*
310
- Add the correct display in Chrome and Safari.
311
- */
312
-
313
- summary {
314
- display: list-item;
315
- }
316
-
317
- /*
318
- Removes the default spacing and border for appropriate elements.
319
- */
320
-
321
- blockquote,
322
- dl,
323
- dd,
324
- h1,
325
- h2,
326
- h3,
327
- h4,
328
- h5,
329
- h6,
330
- hr,
331
- figure,
332
- p,
333
- pre {
334
- margin: 0;
335
- }
336
-
337
- fieldset {
338
- margin: 0;
339
- padding: 0;
340
- }
341
-
342
- legend {
343
- padding: 0;
344
- }
345
-
346
- ol,
347
- ul,
348
- menu {
349
- list-style: none;
350
- margin: 0;
351
- padding: 0;
352
- }
353
-
354
- /*
355
- Reset default styling for dialogs.
356
- */
357
- dialog {
358
- padding: 0;
359
- }
360
-
361
- /*
362
- Prevent resizing textareas horizontally by default.
363
- */
364
-
365
- textarea {
366
- resize: vertical;
367
- }
368
-
369
- /*
370
- 1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
371
- 2. Set the default placeholder color to the user's configured gray 400 color.
372
- */
373
-
374
- input::placeholder,
375
- textarea::placeholder {
376
- opacity: 1;
377
- /* 1 */
378
- color: #9ca3af;
379
- /* 2 */
380
- }
381
-
382
- /*
383
- Set the default cursor for buttons.
384
- */
385
-
386
- button,
387
- [role="button"] {
388
- cursor: pointer;
389
- }
390
-
391
- /*
392
- Make sure disabled buttons don't get the pointer cursor.
393
- */
394
- :disabled {
395
- cursor: default;
396
- }
397
-
398
- /*
399
- 1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
400
- 2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
401
- This can trigger a poorly considered lint error in some tools but is included by design.
402
- */
403
-
404
- img,
405
- svg,
406
- video,
407
- canvas,
408
- audio,
409
- iframe,
410
- embed,
411
- object {
412
- display: block;
413
- /* 1 */
414
- vertical-align: middle;
415
- /* 2 */
416
- }
417
-
418
- /*
419
- Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
420
- */
421
-
422
- img,
423
- video {
424
- max-width: 100%;
425
- height: auto;
426
- }
427
-
428
- /* Make elements with the HTML hidden attribute stay hidden by default */
429
- [hidden] {
430
- display: none;
431
- }
@@ -1,52 +0,0 @@
1
- ---
2
- import Tab from '../components/Tab.astro'
3
- import TabItem from '../components/TabItem.astro'
4
- ---
5
-
6
- <!doctype html>
7
- <html lang="en" class="dark">
8
- <head>
9
- <meta charset="UTF-8" />
10
- <meta name="description" content="Astro description" />
11
- <meta name="viewport" content="width=device-width" />
12
- <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
13
- <meta name="generator" content={Astro.generator} />
14
- <title>Free Astro Components</title>
15
- </head>
16
- <body>
17
- <main class="content">
18
- <h1>Tabs</h1>
19
-
20
- <div class="controls-wrapper">
21
- <Tab
22
- tabs={[
23
- { label: 'Tab 1', active: true },
24
- { label: 'Tab 2' },
25
- { label: 'Tab 2' },
26
- ]}
27
- >
28
- <TabItem active> Tab 1 </TabItem>
29
- <TabItem> Tab 2 </TabItem>
30
- <TabItem> Tab 3 </TabItem>
31
- </Tab>
32
- </div>
33
- </main>
34
- </body>
35
- </html>
36
-
37
- <style>
38
- html,
39
- body {
40
- margin: 0;
41
- }
42
-
43
- .content {
44
- padding: var(--ac-spacing-8) var(--ac-spacing-8) 500px;
45
- }
46
-
47
- .controls-wrapper {
48
- display: grid;
49
- grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
50
- gap: var(--ac-spacing-8);
51
- }
52
- </style>