tyrell-components 1.0.0-RC14 → 1.0.0-RC16
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/README.md +53 -53
- package/css/tyrell-theme.css +32 -4
- package/css/tyrell.css +10 -15
- package/dist/tyrell-colors-static.css +1 -316
- package/dist/tyrell-theme.css +1 -1443
- package/dist/tyrell.css +1 -1390
- package/dist/tyrell.js +1 -1
- package/lib/base/ty-component.d.ts +14 -0
- package/lib/base/ty-component.d.ts.map +1 -0
- package/lib/base/ty-component.js +223 -196
- package/lib/base/ty-component.js.map +1 -0
- package/lib/components/button.d.ts +1 -1
- package/lib/components/button.d.ts.map +1 -0
- package/lib/components/button.js +267 -259
- package/lib/components/button.js.map +1 -0
- package/lib/components/calendar-month.d.ts +2 -2
- package/lib/components/calendar-month.d.ts.map +1 -0
- package/lib/components/calendar-month.js +440 -416
- package/lib/components/calendar-month.js.map +1 -0
- package/lib/components/calendar-navigation.d.ts +11 -0
- package/lib/components/calendar-navigation.d.ts.map +1 -0
- package/lib/components/calendar-navigation.js +272 -261
- package/lib/components/calendar-navigation.js.map +1 -0
- package/lib/components/calendar.d.ts +31 -3
- package/lib/components/calendar.d.ts.map +1 -0
- package/lib/components/calendar.js +785 -603
- package/lib/components/calendar.js.map +1 -0
- package/lib/components/checkbox.d.ts +1 -1
- package/lib/components/checkbox.d.ts.map +1 -0
- package/lib/components/checkbox.js +273 -272
- package/lib/components/checkbox.js.map +1 -0
- package/lib/components/copy.d.ts +1 -1
- package/lib/components/copy.d.ts.map +1 -0
- package/lib/components/copy.js +287 -278
- package/lib/components/copy.js.map +1 -0
- package/lib/components/date-picker.d.ts +16 -10
- package/lib/components/date-picker.d.ts.map +1 -0
- package/lib/components/date-picker.js +1068 -1122
- package/lib/components/date-picker.js.map +1 -0
- package/lib/components/dropdown.d.ts +403 -0
- package/lib/components/dropdown.d.ts.map +1 -0
- package/lib/components/dropdown.js +1315 -0
- package/lib/components/dropdown.js.map +1 -0
- package/lib/components/file-upload.d.ts +4 -0
- package/lib/components/file-upload.js +418 -404
- package/lib/components/icon.d.ts.map +1 -0
- package/lib/components/icon.js +141 -141
- package/lib/components/icon.js.map +1 -0
- package/lib/components/input.d.ts +1 -1
- package/lib/components/input.d.ts.map +1 -0
- package/lib/components/input.js +593 -596
- package/lib/components/input.js.map +1 -0
- package/lib/components/modal.d.ts +2 -8
- package/lib/components/modal.d.ts.map +1 -0
- package/lib/components/modal.js +309 -319
- package/lib/components/modal.js.map +1 -0
- package/lib/components/multiselect.d.ts +389 -0
- package/lib/components/multiselect.d.ts.map +1 -0
- package/lib/components/multiselect.js +1301 -0
- package/lib/components/multiselect.js.map +1 -0
- package/lib/components/option.d.ts.map +1 -0
- package/lib/components/option.js +167 -167
- package/lib/components/option.js.map +1 -0
- package/lib/components/popup.d.ts.map +1 -0
- package/lib/components/popup.js +236 -233
- package/lib/components/popup.js.map +1 -0
- package/lib/components/radio.d.ts +17 -2
- package/lib/components/radio.js +437 -406
- package/lib/components/resize-observer.d.ts.map +1 -0
- package/lib/components/resize-observer.js +67 -67
- package/lib/components/resize-observer.js.map +1 -0
- package/lib/components/scroll-container.d.ts +3 -2
- package/lib/components/scroll-container.d.ts.map +1 -0
- package/lib/components/scroll-container.js +289 -294
- package/lib/components/scroll-container.js.map +1 -0
- package/lib/components/select.d.ts +85 -18
- package/lib/components/select.js +1647 -1529
- package/lib/components/selected-tags.d.ts +1 -1
- package/lib/components/selected-tags.js +188 -182
- package/lib/components/step.d.ts.map +1 -0
- package/lib/components/step.js +62 -62
- package/lib/components/step.js.map +1 -0
- package/lib/components/switch.d.ts +1 -1
- package/lib/components/switch.js +214 -213
- package/lib/components/tab.d.ts +49 -1
- package/lib/components/tab.d.ts.map +1 -0
- package/lib/components/tab.js +203 -62
- package/lib/components/tab.js.map +1 -0
- package/lib/components/tabs.d.ts +15 -2
- package/lib/components/tabs.d.ts.map +1 -0
- package/lib/components/tabs.js +576 -496
- package/lib/components/tabs.js.map +1 -0
- package/lib/components/tag.d.ts +5 -8
- package/lib/components/tag.d.ts.map +1 -0
- package/lib/components/tag.js +235 -235
- package/lib/components/tag.js.map +1 -0
- package/lib/components/textarea.d.ts +5 -4
- package/lib/components/textarea.d.ts.map +1 -0
- package/lib/components/textarea.js +458 -456
- package/lib/components/textarea.js.map +1 -0
- package/lib/components/tooltip.d.ts +4 -3
- package/lib/components/tooltip.d.ts.map +1 -0
- package/lib/components/tooltip.js +293 -283
- package/lib/components/tooltip.js.map +1 -0
- package/lib/components/wizard.d.ts +5 -4
- package/lib/components/wizard.d.ts.map +1 -0
- package/lib/components/wizard.js +359 -395
- package/lib/components/wizard.js.map +1 -0
- package/lib/icons/fontawesome/brands.d.ts.map +1 -0
- package/lib/icons/fontawesome/brands.js.map +1 -0
- package/lib/icons/fontawesome/regular.d.ts.map +1 -0
- package/lib/icons/fontawesome/regular.js.map +1 -0
- package/lib/icons/fontawesome/solid.d.ts.map +1 -0
- package/lib/icons/fontawesome/solid.js.map +1 -0
- package/lib/icons/heroicons/micro.d.ts.map +1 -0
- package/lib/icons/heroicons/micro.js +392 -392
- package/lib/icons/heroicons/micro.js.map +1 -0
- package/lib/icons/heroicons/mini.d.ts.map +1 -0
- package/lib/icons/heroicons/mini.js +382 -382
- package/lib/icons/heroicons/mini.js.map +1 -0
- package/lib/icons/heroicons/outline.d.ts.map +1 -0
- package/lib/icons/heroicons/outline.js +337 -337
- package/lib/icons/heroicons/outline.js.map +1 -0
- package/lib/icons/heroicons/solid.d.ts.map +1 -0
- package/lib/icons/heroicons/solid.js +407 -407
- package/lib/icons/heroicons/solid.js.map +1 -0
- package/lib/icons/lucide.d.ts.map +1 -0
- package/lib/icons/lucide.js +22843 -22843
- package/lib/icons/lucide.js.map +1 -0
- package/lib/icons/material/filled.d.ts.map +1 -0
- package/lib/icons/material/filled.js +9653 -9653
- package/lib/icons/material/filled.js.map +1 -0
- package/lib/icons/material/outlined.d.ts.map +1 -0
- package/lib/icons/material/outlined.js +10271 -10271
- package/lib/icons/material/outlined.js.map +1 -0
- package/lib/icons/material/round.d.ts.map +1 -0
- package/lib/icons/material/round.js +10495 -10495
- package/lib/icons/material/round.js.map +1 -0
- package/lib/icons/material/sharp.d.ts.map +1 -0
- package/lib/icons/material/sharp.js +9905 -9905
- package/lib/icons/material/sharp.js.map +1 -0
- package/lib/icons/material/two-tone.d.ts.map +1 -0
- package/lib/icons/material/two-tone.js +12792 -12792
- package/lib/icons/material/two-tone.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +21 -21
- package/lib/index.js.map +1 -0
- package/lib/styles/button.d.ts.map +1 -0
- package/lib/styles/button.js +200 -302
- package/lib/styles/button.js.map +1 -0
- package/lib/styles/calendar-month.d.ts +3 -0
- package/lib/styles/calendar-month.d.ts.map +1 -0
- package/lib/styles/calendar-month.js +141 -185
- package/lib/styles/calendar-month.js.map +1 -0
- package/lib/styles/calendar-navigation.d.ts +1 -1
- package/lib/styles/calendar-navigation.d.ts.map +1 -0
- package/lib/styles/calendar-navigation.js +100 -86
- package/lib/styles/calendar-navigation.js.map +1 -0
- package/lib/styles/calendar.d.ts +3 -2
- package/lib/styles/calendar.d.ts.map +1 -0
- package/lib/styles/calendar.js +83 -9
- package/lib/styles/calendar.js.map +1 -0
- package/lib/styles/checkbox.js +62 -77
- package/lib/styles/copy.d.ts.map +1 -0
- package/lib/styles/copy.js +71 -91
- package/lib/styles/copy.js.map +1 -0
- package/lib/styles/custom-scrollbar.js +80 -100
- package/lib/styles/date-picker.d.ts.map +1 -0
- package/lib/styles/date-picker.js +295 -335
- package/lib/styles/date-picker.js.map +1 -0
- package/lib/styles/dropdown.d.ts +12 -0
- package/lib/styles/dropdown.d.ts.map +1 -0
- package/lib/styles/dropdown.js +725 -0
- package/lib/styles/dropdown.js.map +1 -0
- package/lib/styles/field-size.d.ts +6 -0
- package/lib/styles/field-size.js +91 -0
- package/lib/styles/file-upload.js +139 -169
- package/lib/styles/icon.d.ts.map +1 -0
- package/lib/styles/icon.js +92 -156
- package/lib/styles/icon.js.map +1 -0
- package/lib/styles/input.d.ts.map +1 -0
- package/lib/styles/input.js +125 -241
- package/lib/styles/input.js.map +1 -0
- package/lib/styles/modal.d.ts.map +1 -0
- package/lib/styles/modal.js +67 -102
- package/lib/styles/modal.js.map +1 -0
- package/lib/styles/multiselect.d.ts +6 -0
- package/lib/styles/multiselect.d.ts.map +1 -0
- package/lib/styles/multiselect.js +568 -0
- package/lib/styles/multiselect.js.map +1 -0
- package/lib/styles/option.d.ts +1 -1
- package/lib/styles/option.d.ts.map +1 -0
- package/lib/styles/option.js +47 -67
- package/lib/styles/option.js.map +1 -0
- package/lib/styles/popup.d.ts +1 -1
- package/lib/styles/popup.d.ts.map +1 -0
- package/lib/styles/popup.js +37 -65
- package/lib/styles/popup.js.map +1 -0
- package/lib/styles/radio.js +75 -96
- package/lib/styles/resize-observer.d.ts.map +1 -0
- package/lib/styles/resize-observer.js +2 -5
- package/lib/styles/resize-observer.js.map +1 -0
- package/lib/styles/scroll-container.d.ts +1 -1
- package/lib/styles/scroll-container.d.ts.map +1 -0
- package/lib/styles/scroll-container.js +101 -131
- package/lib/styles/scroll-container.js.map +1 -0
- package/lib/styles/select-base.js +596 -773
- package/lib/styles/select.d.ts +1 -1
- package/lib/styles/select.js +146 -228
- package/lib/styles/step.d.ts +1 -1
- package/lib/styles/step.d.ts.map +1 -0
- package/lib/styles/step.js +15 -30
- package/lib/styles/step.js.map +1 -0
- package/lib/styles/switch.js +37 -55
- package/lib/styles/tab.d.ts +1 -1
- package/lib/styles/tab.d.ts.map +1 -0
- package/lib/styles/tab.js +86 -29
- package/lib/styles/tab.js.map +1 -0
- package/lib/styles/tabs.d.ts +1 -1
- package/lib/styles/tabs.d.ts.map +1 -0
- package/lib/styles/tabs.js +190 -180
- package/lib/styles/tabs.js.map +1 -0
- package/lib/styles/tag.d.ts.map +1 -0
- package/lib/styles/tag.js +137 -191
- package/lib/styles/tag.js.map +1 -0
- package/lib/styles/textarea.d.ts +1 -1
- package/lib/styles/textarea.d.ts.map +1 -0
- package/lib/styles/textarea.js +205 -271
- package/lib/styles/textarea.js.map +1 -0
- package/lib/styles/tooltip.d.ts.map +1 -0
- package/lib/styles/tooltip.js +3 -3
- package/lib/styles/tooltip.js.map +1 -0
- package/lib/styles/wizard.d.ts +9 -5
- package/lib/styles/wizard.d.ts.map +1 -0
- package/lib/styles/wizard.js +301 -245
- package/lib/styles/wizard.js.map +1 -0
- package/lib/types/common.d.ts +4 -2
- package/lib/types/common.d.ts.map +1 -0
- package/lib/types/common.js +6 -5
- package/lib/types/common.js.map +1 -0
- package/lib/utils/calendar-utils.d.ts.map +1 -0
- package/lib/utils/calendar-utils.js +100 -100
- package/lib/utils/calendar-utils.js.map +1 -0
- package/lib/utils/custom-scrollbar.js +272 -272
- package/lib/utils/flavor-sheet.js +14 -14
- package/lib/utils/icon-registry.d.ts.map +1 -0
- package/lib/utils/icon-registry.js +127 -127
- package/lib/utils/icon-registry.js.map +1 -0
- package/lib/utils/loader-registry.js +3 -3
- package/lib/utils/locale.d.ts.map +1 -0
- package/lib/utils/locale.js +34 -34
- package/lib/utils/locale.js.map +1 -0
- package/lib/utils/mobile.js +1 -1
- package/lib/utils/number-format.d.ts.map +1 -0
- package/lib/utils/number-format.js +54 -54
- package/lib/utils/number-format.js.map +1 -0
- package/lib/utils/parse-boolean.d.ts +39 -0
- package/lib/utils/parse-boolean.d.ts.map +1 -0
- package/lib/utils/parse-boolean.js +23 -0
- package/lib/utils/parse-boolean.js.map +1 -0
- package/lib/utils/positioning.d.ts.map +1 -0
- package/lib/utils/positioning.js +212 -212
- package/lib/utils/positioning.js.map +1 -0
- package/lib/utils/property-capture.d.ts.map +1 -0
- package/lib/utils/property-capture.js +36 -36
- package/lib/utils/property-capture.js.map +1 -0
- package/lib/utils/property-manager.d.ts +1 -1
- package/lib/utils/property-manager.d.ts.map +1 -0
- package/lib/utils/property-manager.js +127 -125
- package/lib/utils/property-manager.js.map +1 -0
- package/lib/utils/resize-observer.d.ts.map +1 -0
- package/lib/utils/resize-observer.js +23 -23
- package/lib/utils/resize-observer.js.map +1 -0
- package/lib/utils/scroll-lock.d.ts.map +1 -0
- package/lib/utils/scroll-lock.js +57 -57
- package/lib/utils/scroll-lock.js.map +1 -0
- package/lib/utils/styles.d.ts.map +1 -0
- package/lib/utils/styles.js +17 -17
- package/lib/utils/styles.js.map +1 -0
- package/lib/utils/validity.d.ts +26 -0
- package/lib/utils/validity.js +53 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -0
- package/package.json +28 -7
package/lib/styles/switch.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FLAVORS } from "../types/common.js";
|
|
2
2
|
import { inputStyles } from "./input.js";
|
|
3
3
|
const switchFlavor = (f, fb) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const tok = (s) => fb
|
|
5
|
+
? `var(--ty-color-${f}${s}, var(--ty-color-${fb}${s}))`
|
|
6
|
+
: `var(--ty-color-${f}${s})`;
|
|
7
|
+
return `
|
|
8
8
|
:host([flavor="${f}"]) { --switch-track: ${tok("")}; }
|
|
9
9
|
:host([flavor="${f}+"]) { --switch-track: ${tok("-strong")}; }
|
|
10
10
|
:host([flavor="${f}-"]) { --switch-track: ${tok("-soft")}; }
|
|
@@ -13,85 +13,67 @@ const switchFlavor = (f, fb) => {
|
|
|
13
13
|
export const switchCustomFlavorCss = (base) => switchFlavor(base, "neutral");
|
|
14
14
|
export const switchStyles = `
|
|
15
15
|
${inputStyles}
|
|
16
|
-
|
|
17
|
-
/* Override input's :host so the switch sizes to its visual */
|
|
18
16
|
:host {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
width: auto;
|
|
19
|
+
vertical-align: middle;
|
|
22
20
|
}
|
|
23
|
-
|
|
24
|
-
/* The switch container is just the visual */
|
|
25
21
|
.switch-container {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
min-height: 1.25em;
|
|
25
|
+
min-height: 1lh;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
user-select: none;
|
|
28
|
+
outline: none;
|
|
29
|
+
vertical-align: middle;
|
|
31
30
|
}
|
|
32
|
-
|
|
33
31
|
.switch-container.disabled {
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
cursor: not-allowed;
|
|
33
|
+
opacity: 0.55;
|
|
36
34
|
}
|
|
37
|
-
|
|
38
35
|
.switch-container:focus-visible .switch-track,
|
|
39
36
|
.switch-container.focused .switch-track {
|
|
40
|
-
|
|
37
|
+
box-shadow: 0 0 0 3px var(--ty-input-shadow-focus);
|
|
41
38
|
}
|
|
42
|
-
|
|
43
39
|
.switch-track {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
position: relative;
|
|
41
|
+
flex-shrink: 0;
|
|
42
|
+
width: 36px;
|
|
43
|
+
height: 20px;
|
|
44
|
+
border-radius: var(--ty-radius-full, 999px);
|
|
45
|
+
background: var(--ty-color-neutral-soft, var(--ty-input-border));
|
|
46
|
+
transition: var(--ty-local-transition, background-color 0.18s ease-in-out);
|
|
47
|
+
box-sizing: border-box;
|
|
52
48
|
}
|
|
53
|
-
|
|
54
49
|
.switch-thumb {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
position: absolute;
|
|
51
|
+
top: 2px;
|
|
52
|
+
left: 2px;
|
|
53
|
+
width: 16px;
|
|
54
|
+
height: 16px;
|
|
55
|
+
border-radius: min(50%, var(--ty-radius-full, 50%));
|
|
56
|
+
background: white;
|
|
57
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
58
|
+
transition: var(--ty-local-transition, transform 0.18s ease-in-out, background-color 0.18s ease-in-out);
|
|
64
59
|
}
|
|
65
|
-
|
|
66
|
-
/* Default (no flavor attribute) is primary — defaults don't reflect to the
|
|
67
|
-
host attribute, so the base rule's fallback carries the default look. */
|
|
68
60
|
.switch-container[aria-checked="true"] .switch-track {
|
|
69
|
-
|
|
61
|
+
background: var(--switch-track, var(--ty-color-primary));
|
|
70
62
|
}
|
|
71
|
-
|
|
72
63
|
.switch-container[aria-checked="true"] .switch-thumb {
|
|
73
|
-
|
|
64
|
+
transform: translateX(16px);
|
|
74
65
|
}
|
|
75
|
-
|
|
76
66
|
.switch-container.xs .switch-track { width: 26px; height: 14px; }
|
|
77
67
|
.switch-container.xs .switch-thumb { width: 10px; height: 10px; }
|
|
78
68
|
.switch-container.xs[aria-checked="true"] .switch-thumb { transform: translateX(12px); }
|
|
79
|
-
|
|
80
69
|
.switch-container.sm .switch-track { width: 30px; height: 16px; }
|
|
81
70
|
.switch-container.sm .switch-thumb { width: 12px; height: 12px; }
|
|
82
71
|
.switch-container.sm[aria-checked="true"] .switch-thumb { transform: translateX(14px); }
|
|
83
|
-
|
|
84
|
-
/* md is default — already set above */
|
|
85
|
-
|
|
86
72
|
.switch-container.lg .switch-track { width: 44px; height: 24px; }
|
|
87
73
|
.switch-container.lg .switch-thumb { width: 20px; height: 20px; }
|
|
88
74
|
.switch-container.lg[aria-checked="true"] .switch-thumb { transform: translateX(20px); }
|
|
89
|
-
|
|
90
75
|
.switch-container.xl .switch-track { width: 52px; height: 28px; }
|
|
91
76
|
.switch-container.xl .switch-thumb { width: 24px; height: 24px; }
|
|
92
77
|
.switch-container.xl[aria-checked="true"] .switch-thumb { transform: translateX(24px); }
|
|
93
|
-
|
|
94
|
-
/* Flavor variants set --switch-track, consumed above */
|
|
95
78
|
${FLAVORS.map((f) => switchFlavor(f)).join("")}
|
|
96
|
-
|
|
97
79
|
`;
|
package/lib/styles/tab.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tab Component Styles
|
|
3
3
|
*/
|
|
4
|
-
export declare const tabStyles = "\n:host {\n width:
|
|
4
|
+
export declare const tabStyles = "\n:host {\n width: 100%;\n height: 100%;\n display: block;\n box-sizing: border-box;\n flex-shrink: 0;\n /* ty-tabs hides inactive panels with opacity + visibility. visibility\n transitions as \"visible until the fade ends\", so a panel leaving fades out\n and only then drops out of the tab order. */\n transition:\n opacity var(--ty-tabs-transition-duration, 400ms) var(--ty-tabs-transition-easing, ease-in-out),\n visibility var(--ty-tabs-transition-duration, 400ms);\n}\n\n@media (prefers-reduced-motion: reduce) {\n :host {\n transition-duration: 0ms !important;\n }\n}\n\n.tab-wrapper {\n width: 100%;\n height: 100%;\n position: relative;\n overflow: hidden;\n}\n\n.tab-panel {\n width: 100%;\n height: 100%;\n overflow: auto;\n box-sizing: border-box;\n}\n\n/* Lazy tabs: placeholder while loading, message + Retry when it failed. */\n.tab-loading,\n.tab-error {\n display: none;\n box-sizing: border-box;\n min-height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n padding: 24px;\n text-align: center;\n}\n\n.tab-panel[data-load=\"loading\"] .tab-loading,\n.tab-panel[data-load=\"failed\"] .tab-error {\n display: flex;\n}\n\n/* Fades in late, so a fast load never flashes it. */\n.tab-panel[data-load=\"loading\"] .tab-loading {\n animation: ty-tab-status-in 200ms ease-out 150ms both;\n}\n\n@keyframes ty-tab-status-in {\n from { opacity: 0; }\n}\n\n.tab-spinner {\n display: inline-flex;\n width: 20px;\n height: 20px;\n color: var(--ty-text-soft);\n animation: var(--ty-loader-animation, ty-tab-spin 0.7s linear infinite);\n}\n\n.tab-spinner svg {\n width: 100%;\n height: 100%;\n}\n\n@keyframes ty-tab-spin {\n to { transform: rotate(360deg); }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tab-spinner {\n animation-duration: 1.6s;\n }\n}\n\n.tab-error {\n color: var(--ty-text-soft);\n font-size: 14px;\n}\n\n.tab-retry {\n font: inherit;\n font-size: 13px;\n padding: 4px 14px;\n border: 1px solid var(--ty-border);\n border-radius: 9999px;\n background: transparent;\n color: var(--ty-text-strong);\n cursor: pointer;\n}\n\n.tab-retry:hover {\n border-color: var(--ty-text-soft);\n}\n\n.tab-retry:focus-visible {\n outline: 2px solid var(--ty-color-primary);\n outline-offset: 2px;\n}\n\n.tab-panel.ty-custom-scroll {\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n.tab-panel.ty-custom-scroll::-webkit-scrollbar {\n display: none;\n}\n\n.tab-wrapper:hover .ty-scrollbar-track-y.has-overflow {\n opacity: 1;\n}\n\n\n/* Vertical track */\n.ty-scrollbar-track-y {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n width: var(--ty-scrollbar-width, 8px);\n z-index: 3;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.25s ease-out;\n cursor: pointer;\n}\n\n.ty-scrollbar-track-y.has-overflow {\n pointer-events: auto;\n}\n\n.ty-scrollbar-track-y.has-overflow:hover,\n.ty-scrollbar-track-y.has-overflow.scrolling,\n.ty-scrollbar-track-y.dragging {\n opacity: 1;\n}\n\n.ty-scrollbar-track-y::before {\n content: '';\n position: absolute;\n inset: 0;\n background: var(--ty-scrollbar-track, transparent);\n border-radius: var(--ty-scrollbar-radius, 4px);\n opacity: 0;\n transition: opacity 0.15s ease-out;\n}\n\n.ty-scrollbar-track-y:hover::before,\n.ty-scrollbar-track-y.dragging::before {\n opacity: 1;\n background: var(--ty-scrollbar-track-hover, color-mix(in oklab, var(--ty-color-neutral-bold) 8%, transparent));\n}\n\n.ty-scrollbar-thumb-y {\n position: absolute;\n right: 0;\n width: 100%;\n min-height: var(--ty-scrollbar-thumb-min-height, 30px);\n background: var(--ty-scrollbar-thumb, color-mix(in oklab, var(--ty-color-neutral-bold) 40%, transparent));\n border-radius: var(--ty-scrollbar-radius, 4px);\n transition: var(--ty-local-transition, background 0.15s ease-out);\n box-sizing: border-box;\n border: 1px solid transparent;\n}\n\n.ty-scrollbar-thumb-y:hover,\n.ty-scrollbar-track-y.dragging .ty-scrollbar-thumb-y {\n background: var(--ty-scrollbar-thumb-hover, color-mix(in oklab, var(--ty-color-neutral-bold) 55%, transparent));\n}\n\n.ty-scrollbar-thumb-y:active,\n.ty-scrollbar-track-y.dragging .ty-scrollbar-thumb-y {\n background: var(--ty-scrollbar-thumb-active, color-mix(in oklab, var(--ty-color-neutral-bold) 70%, transparent));\n}\n\n/* Horizontal track */\n.ty-scrollbar-track-x {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: var(--ty-scrollbar-width, 8px);\n z-index: 3;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.25s ease-out;\n cursor: pointer;\n}\n\n.ty-scrollbar-track-x.has-overflow {\n pointer-events: auto;\n}\n\n.ty-scrollbar-track-x.has-overflow:hover,\n.ty-scrollbar-track-x.has-overflow.scrolling,\n.ty-scrollbar-track-x.dragging {\n opacity: 1;\n}\n\n.ty-scrollbar-track-x::before {\n content: '';\n position: absolute;\n inset: 0;\n background: var(--ty-scrollbar-track, transparent);\n border-radius: var(--ty-scrollbar-radius, 4px);\n opacity: 0;\n transition: opacity 0.15s ease-out;\n}\n\n.ty-scrollbar-track-x:hover::before,\n.ty-scrollbar-track-x.dragging::before {\n opacity: 1;\n background: var(--ty-scrollbar-track-hover, color-mix(in oklab, var(--ty-color-neutral-bold) 8%, transparent));\n}\n\n.ty-scrollbar-thumb-x {\n position: absolute;\n bottom: 0;\n height: 100%;\n min-width: var(--ty-scrollbar-thumb-min-height, 30px);\n background: var(--ty-scrollbar-thumb, color-mix(in oklab, var(--ty-color-neutral-bold) 40%, transparent));\n border-radius: var(--ty-scrollbar-radius, 4px);\n transition: var(--ty-local-transition, background 0.15s ease-out);\n box-sizing: border-box;\n border: 1px solid transparent;\n}\n\n.ty-scrollbar-thumb-x:hover,\n.ty-scrollbar-track-x.dragging .ty-scrollbar-thumb-x {\n background: var(--ty-scrollbar-thumb-hover, color-mix(in oklab, var(--ty-color-neutral-bold) 55%, transparent));\n}\n\n.ty-scrollbar-thumb-x:active,\n.ty-scrollbar-track-x.dragging .ty-scrollbar-thumb-x {\n background: var(--ty-scrollbar-thumb-active, color-mix(in oklab, var(--ty-color-neutral-bold) 70%, transparent));\n}\n\n/* Touch devices: hide the custom scrollbar */\n@media (pointer: coarse) and (hover: none) {\n .ty-scrollbar-track-y,\n .ty-scrollbar-track-x {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .ty-scrollbar-track-y,\n .ty-scrollbar-track-x,\n .ty-scrollbar-thumb-y,\n .ty-scrollbar-thumb-x {\n transition-duration: 0ms !important;\n }\n}\n\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../src/styles/tab.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,SAAS,g8CAsDrB,CAAC"}
|
package/lib/styles/tab.js
CHANGED
|
@@ -1,46 +1,103 @@
|
|
|
1
1
|
import { customScrollbarStyles } from './custom-scrollbar.js';
|
|
2
2
|
export const tabStyles = `
|
|
3
3
|
:host {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
display: block;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
flex-shrink: 0;
|
|
9
|
+
transition:
|
|
10
|
+
opacity var(--ty-tabs-transition-duration, 400ms) var(--ty-tabs-transition-easing, ease-in-out),
|
|
11
|
+
visibility var(--ty-tabs-transition-duration, 400ms);
|
|
12
|
+
}
|
|
12
13
|
@media (prefers-reduced-motion: reduce) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
:host {
|
|
15
|
+
transition-duration: 0ms !important;
|
|
16
|
+
}
|
|
16
17
|
}
|
|
17
|
-
|
|
18
18
|
.tab-wrapper {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
position: relative;
|
|
22
|
+
overflow: hidden;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
24
|
.tab-panel {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
overflow: auto;
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
}
|
|
30
|
+
.tab-loading,
|
|
31
|
+
.tab-error {
|
|
32
|
+
display: none;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
min-height: 100%;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
gap: 12px;
|
|
39
|
+
padding: 24px;
|
|
40
|
+
text-align: center;
|
|
41
|
+
}
|
|
42
|
+
.tab-panel[data-load="loading"] .tab-loading,
|
|
43
|
+
.tab-panel[data-load="failed"] .tab-error {
|
|
44
|
+
display: flex;
|
|
45
|
+
}
|
|
46
|
+
.tab-panel[data-load="loading"] .tab-loading {
|
|
47
|
+
animation: ty-tab-status-in 200ms ease-out 150ms both;
|
|
48
|
+
}
|
|
49
|
+
@keyframes ty-tab-status-in {
|
|
50
|
+
from { opacity: 0; }
|
|
51
|
+
}
|
|
52
|
+
.tab-spinner {
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
width: 20px;
|
|
55
|
+
height: 20px;
|
|
56
|
+
color: var(--ty-text-soft);
|
|
57
|
+
animation: var(--ty-loader-animation, ty-tab-spin 0.7s linear infinite);
|
|
58
|
+
}
|
|
59
|
+
.tab-spinner svg {
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: 100%;
|
|
62
|
+
}
|
|
63
|
+
@keyframes ty-tab-spin {
|
|
64
|
+
to { transform: rotate(360deg); }
|
|
65
|
+
}
|
|
66
|
+
@media (prefers-reduced-motion: reduce) {
|
|
67
|
+
.tab-spinner {
|
|
68
|
+
animation-duration: 1.6s;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
.tab-error {
|
|
72
|
+
color: var(--ty-text-soft);
|
|
73
|
+
font-size: 14px;
|
|
74
|
+
}
|
|
75
|
+
.tab-retry {
|
|
76
|
+
font: inherit;
|
|
77
|
+
font-size: 13px;
|
|
78
|
+
padding: 4px 14px;
|
|
79
|
+
border: 1px solid var(--ty-border);
|
|
80
|
+
border-radius: 9999px;
|
|
81
|
+
background: transparent;
|
|
82
|
+
color: var(--ty-text-strong);
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
}
|
|
85
|
+
.tab-retry:hover {
|
|
86
|
+
border-color: var(--ty-text-soft);
|
|
87
|
+
}
|
|
88
|
+
.tab-retry:focus-visible {
|
|
89
|
+
outline: 2px solid var(--ty-color-primary);
|
|
90
|
+
outline-offset: 2px;
|
|
30
91
|
}
|
|
31
|
-
|
|
32
92
|
.tab-panel.ty-custom-scroll {
|
|
33
|
-
|
|
34
|
-
|
|
93
|
+
scrollbar-width: none;
|
|
94
|
+
-ms-overflow-style: none;
|
|
35
95
|
}
|
|
36
|
-
|
|
37
96
|
.tab-panel.ty-custom-scroll::-webkit-scrollbar {
|
|
38
|
-
|
|
97
|
+
display: none;
|
|
39
98
|
}
|
|
40
|
-
|
|
41
99
|
.tab-wrapper:hover .ty-scrollbar-track-y.has-overflow {
|
|
42
|
-
|
|
100
|
+
opacity: 1;
|
|
43
101
|
}
|
|
44
|
-
|
|
45
102
|
${customScrollbarStyles}
|
|
46
103
|
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab.js","sourceRoot":"","sources":["../../src/styles/tab.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDxB,CAAC"}
|
package/lib/styles/tabs.d.ts
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Tabs Component Styles — ty-tabs container: top/bottom placement, animated
|
|
3
3
|
* active marker, carousel viewport. Customizable via CSS Parts (::part).
|
|
4
4
|
*/
|
|
5
|
-
export declare const tabsStyles = "\n:host {\n display: block;\n width
|
|
5
|
+
export declare const tabsStyles = "\n:host {\n display: block;\n /* Defaults. The width/height attributes override these (and page CSS)\n through the per-instance sheet. */\n width: 100%;\n height: 400px;\n box-sizing: border-box;\n}\n\n.tabs-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n box-sizing: border-box;\n}\n\n.tabs-container[data-placement=\"bottom\"] {\n flex-direction: column-reverse;\n}\n\n/* Tab buttons container \u2014 exposed as a CSS Part for full styling control */\n.tab-buttons {\n display: flex;\n gap: 0;\n flex-shrink: 0;\n position: relative;\n\n /* Default minimal styling - customize via ::part(buttons-container) */\n background: transparent;\n}\n\n/* Separator drawn as a pseudo-element, not a border: a border sits OUTSIDE the\n strip's box, so the marker (absolutely positioned inside the strip) could only\n ever stop just above it, reading as two stacked lines. As an overlaid line it\n lands inside the marker's range, and .tab-strip's z-index lets the marker\n cover it. */\n.tab-buttons::after {\n content: \"\";\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n height: 1px;\n /* --ty-tabs-separator: transparent removes the line (e.g. with a pill marker) */\n background: var(--ty-tabs-separator, var(--ty-border));\n pointer-events: none;\n}\n\n.tabs-container[data-placement=\"bottom\"] .tab-buttons::after {\n bottom: auto;\n top: 0;\n}\n\n/* Scrollable strip holding the buttons + marker. Tabs never collapse \u2014 the\n strip scrolls (scrollbar hidden; touch/wheel still work) and activation\n glides the active tab into view. The \"\u2026\" trigger sits OUTSIDE this strip,\n pinned at the edge. position:relative makes it the offsetParent for the\n marker, so the marker scrolls with the buttons and can't desync. */\n.tab-strip {\n display: flex;\n flex: 1 1 auto;\n min-width: 0;\n position: relative;\n /* Paints the marker + buttons over .tab-buttons::after (the separator line) */\n z-index: 1;\n overflow-x: auto;\n scrollbar-width: none;\n /* Edge fades \u2014 a mask, not overlays, so it works over any background.\n --fade-left/right are set from the scroll listener: 0px at a hard edge,\n 28px when more tabs continue past that side. */\n --fade-left: 0px;\n --fade-right: 0px;\n -webkit-mask-image: linear-gradient(to right,\n transparent, black var(--fade-left),\n black calc(100% - var(--fade-right)), transparent);\n mask-image: linear-gradient(to right,\n transparent, black var(--fade-left),\n black calc(100% - var(--fade-right)), transparent);\n}\n\n.tab-strip::-webkit-scrollbar {\n display: none;\n}\n\n/* When every tab fits there is nothing to scroll, so drop the clipping \u2014\n both overflow and the mask cut a custom marker's box-shadow off at the\n strip edge. Set by updateOverflow(); clipping stays the pre-measurement\n default so overflowing tabs can't spill for a frame on first render. */\n.tab-strip.unclipped {\n overflow: visible;\n -webkit-mask-image: none;\n mask-image: none;\n}\n\n/* Marker wrapper \u2014 exposed as a CSS Part for custom marker styling */\n.marker-wrapper {\n position: absolute;\n z-index: 0;\n /* Behind buttons */\n pointer-events: none;\n /* Don't block clicks */\n transition: left var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out),\n width var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out),\n height var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out),\n top var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out);\n}\n\n.default-marker {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 3px;\n width: 100%;\n background: var(--ty-color-primary);\n pointer-events: none;\n}\n\n/* Bottom placement: marker rides the top edge, next to the content it marks */\n.tabs-container[data-placement=\"bottom\"] .default-marker {\n bottom: auto;\n top: 0;\n}\n\n::slotted([slot=\"marker\"]) {\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n}\n\n.tab-button {\n /* Material's floor for SCROLLABLE tabs. 120px is the fixed-tab number and it\n manufactured overflow: five short labels claimed 600px whether they needed\n it or not. Equal-width rhythm is what the \"fixed\" attribute is for. */\n min-width: var(--ty-tab-min-width, 72px);\n /* Scrollable tabs keep their natural width and let the strip scroll \u2014 that is\n the whole contract. Without this they are flex items with the default\n shrink of 1, so they squeeze toward the floor and their labels ellipsize\n before the strip ever overflows. Squeezing is what \"fixed\" is for. */\n flex-shrink: 0;\n padding: 6px 12px;\n border: none;\n background: transparent;\n cursor: pointer;\n font: inherit;\n color: var(--ty-text-soft);\n transition: var(--ty-local-transition, color 200ms, background-color 200ms);\n white-space: nowrap;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n font-weight: var(--ty-font-bold);\n font-size: var(--ty-font-sm);\n position: relative;\n /* Establish stacking context */\n z-index: 10;\n /* Above marker */\n}\n\n/* Fixed tabs: the bar is divided between them instead of scrolling. Material\n calls this \"fixed tabs\" \u2014 for a small, known set of short labels. No\n min-width floor, no overflow, no \"\u2026\". */\n.tabs-container[data-fixed] .tab-button {\n flex: 1 1 0;\n min-width: 0;\n}\n\n/* Fixed tabs only. A scrollable tab is never narrower than its label, so\n ellipsizing there would hide text the user could simply scroll to. */\n.tabs-container[data-fixed] .tab-label {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.tab-button[aria-selected=true] {\n color: var(--ty-text-strong);\n}\n\n.tab-button[disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.tab-button:focus-visible {\n outline: 2px solid var(--ty-color-primary);\n outline-offset: -2px;\n}\n\n/* Overflow \"more\" trigger (pill) + menu */\n.tab-overflow-trigger {\n flex-shrink: 0;\n align-self: center;\n min-width: 36px;\n height: 24px;\n margin: 0 8px;\n padding: 0 10px;\n border: 1px solid var(--ty-border);\n border-radius: 9999px;\n background: transparent;\n cursor: pointer;\n color: var(--ty-text-soft);\n font-size: 16px;\n line-height: 1;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: relative;\n z-index: 10;\n transition: color 200ms, border-color 200ms;\n}\n\n.tab-overflow-trigger:hover {\n color: var(--ty-text-strong);\n border-color: var(--ty-text-soft);\n}\n\n.tab-overflow-trigger:focus-visible {\n outline: 2px solid var(--ty-color-primary);\n outline-offset: -2px;\n}\n\n.tab-overflow-menu {\n display: flex;\n flex-direction: column;\n min-width: 160px;\n max-height: 300px;\n overflow-y: auto;\n padding: var(--ty-spacing-2, 4px);\n background: var(--ty-surface-floating);\n border-radius: var(--ty-radius-md);\n box-shadow: var(--ty-shadow-md, 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1));\n}\n\n.tab-overflow-item {\n padding: var(--ty-spacing-2, 6px) var(--ty-spacing-3, 12px);\n border: none;\n background: transparent;\n text-align: left;\n cursor: pointer;\n border-radius: var(--ty-radius-md);\n color: var(--ty-text);\n font: inherit;\n font-size: var(--ty-font-sm);\n white-space: nowrap;\n}\n\n.tab-overflow-item:hover {\n background: var(--ty-bg-neutral-soft);\n color: var(--ty-text-strong);\n}\n\n.tab-overflow-item[data-active=\"true\"] {\n color: var(--ty-color-primary);\n font-weight: var(--ty-font-bold);\n}\n\n.tab-overflow-item[disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n/* Panels viewport \u2014 exposed as a CSS Part */\n.panels-viewport {\n position: relative;\n flex: 1;\n overflow: hidden;\n /* Critical: hides off-screen panels */\n min-height: 0;\n /* Allows flex child to shrink */\n}\n\n/* Panels wrapper slides horizontally */\n.panels-wrapper {\n display: flex;\n height: 100%;\n transition: transform var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .panels-wrapper {\n transition-duration: 0ms !important;\n }\n\n .marker-wrapper {\n transition-duration: 0ms !important;\n }\n}\n\n::slotted(ty-tab) {\n /* One carousel page: the viewport's width. */\n width: 100%;\n height: 100%;\n flex-shrink: 0;\n}\n\n/* Snap: an early `active` correction lands without sliding or fading. */\n.tabs-container[data-snap] .panels-wrapper,\n.tabs-container[data-snap] ::slotted(ty-tab) {\n transition: none;\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/styles/tabs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,UAAU,2mIA2KtB,CAAC"}
|