tyrell-components 1.0.0-RC18 → 1.0.0-RC19
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/dist/tyrell.js +1 -1
- package/lib/components/modal.d.ts +3 -0
- package/lib/components/modal.js +7 -1
- package/lib/styles/modal.d.ts +1 -1
- package/lib/styles/modal.js +56 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
|
@@ -52,6 +52,9 @@ export declare class TyModal extends HTMLElement {
|
|
|
52
52
|
set open(v: boolean);
|
|
53
53
|
get noBackdrop(): boolean;
|
|
54
54
|
set noBackdrop(v: boolean);
|
|
55
|
+
/** Full screen on phones (below 768px), sliding up from the bottom. */
|
|
56
|
+
get sheet(): boolean;
|
|
57
|
+
set sheet(v: boolean);
|
|
55
58
|
get noZoom(): boolean;
|
|
56
59
|
set noZoom(v: boolean);
|
|
57
60
|
get preventOutsideClick(): boolean;
|
package/lib/components/modal.js
CHANGED
|
@@ -65,6 +65,7 @@ const closeButton = document.createElement('button');
|
|
|
65
65
|
const contentDiv = document.createElement('div');
|
|
66
66
|
const slot = document.createElement('slot');
|
|
67
67
|
dialog.className = 'ty-modal-dialog';
|
|
68
|
+
dialog.setAttribute('part', 'dialog');
|
|
68
69
|
closeButton.className = 'close-button';
|
|
69
70
|
closeButton.type = 'button';
|
|
70
71
|
closeButton.setAttribute('aria-label', 'Close modal');
|
|
@@ -288,6 +289,7 @@ dialog.setAttribute('data-backdrop', 'true');
|
|
|
288
289
|
else {
|
|
289
290
|
dialog.removeAttribute('data-backdrop');
|
|
290
291
|
}
|
|
292
|
+
dialog.toggleAttribute('data-sheet', parseBoolAttr(el, 'sheet'));
|
|
291
293
|
const label = el.getAttribute('label');
|
|
292
294
|
if (label) {
|
|
293
295
|
dialog.setAttribute('aria-label', label);
|
|
@@ -400,7 +402,7 @@ hoverLeaveHandlers.delete(el);
|
|
|
400
402
|
}
|
|
401
403
|
export class TyModal extends HTMLElement {
|
|
402
404
|
static get observedAttributes() {
|
|
403
|
-
return ['open', 'no-backdrop', 'no-zoom', 'prevent-outside-click', 'prevent-escape', 'label'];
|
|
405
|
+
return ['open', 'no-backdrop', 'no-zoom', 'sheet', 'prevent-outside-click', 'prevent-escape', 'label'];
|
|
404
406
|
}
|
|
405
407
|
get open() { return parseBoolAttr(this, 'open'); }
|
|
406
408
|
set open(v) { coerceBoolean(v) ? this.setAttribute('open', 'true') : this.removeAttribute('open'); }
|
|
@@ -408,6 +410,10 @@ get noBackdrop() { return parseBoolAttr(this, 'no-backdrop'); }
|
|
|
408
410
|
set noBackdrop(v) {
|
|
409
411
|
coerceBoolean(v) ? this.setAttribute('no-backdrop', '') : this.removeAttribute('no-backdrop');
|
|
410
412
|
}
|
|
413
|
+
get sheet() { return parseBoolAttr(this, 'sheet'); }
|
|
414
|
+
set sheet(v) {
|
|
415
|
+
coerceBoolean(v) ? this.setAttribute('sheet', '') : this.removeAttribute('sheet');
|
|
416
|
+
}
|
|
411
417
|
get noZoom() { return parseBoolAttr(this, 'no-zoom'); }
|
|
412
418
|
set noZoom(v) {
|
|
413
419
|
coerceBoolean(v) ? this.setAttribute('no-zoom', '') : this.removeAttribute('no-zoom');
|
package/lib/styles/modal.d.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* CSS for the modal component wrapper.
|
|
5
5
|
* The modal is a pure wrapper - all content styling is user-defined.
|
|
6
6
|
*/
|
|
7
|
-
export declare const modalStyles = "\n:host {\n display: contents;\n /* Don't interfere with layout */\n}\n\n/* Part of the modal wrapper functionality, not user content styling */\n.close-button {\n position: absolute;\n top: -8px;\n right: -8px;\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: var(--ty-transition-colors);\n z-index: 1;\n color: #d8d8d8;\n\n /* Remove all default browser styling that could cause outlines/borders */\n outline: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n\n /* Remove mobile tap highlights and focus rings */\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.close-button:hover {\n color: white;\n}\n\n/* Explicitly remove focus and active states for all interaction modes */\n.close-button:focus,\n.close-button:focus-visible,\n.close-button:focus-within,\n.close-button:active {\n outline: none !important;\n box-shadow: none !important;\n border: none !important;\n background: transparent !important;\n}\n\n/* Override hover color even in focus/active states */\n.close-button:hover,\n.close-button:focus:hover,\n.close-button:active:hover {\n color: white;\n}\n\n.close-button.hide {\n visibility: hidden;\n}\n\n/* Pure wrapper: only essential modal functionality, no styling of user content */\n.ty-modal-dialog {\n /* Reset default dialog styles */\n padding: 18px;\n border: none;\n margin: 0;\n background: transparent;\n\n /* Centered */\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n\n z-index: 1000;\n overflow: hidden;\n\n /* No sizing - let user content determine size */\n max-width: 85vw;\n max-height: 90vh;\n\n outline: none;\n}\n\n/* Panel zoom-in synced with the backdrop fade (shadcn-style zoom-in-95).\n Enter-only: animating exit on a native <dialog> means delaying close(). */\n.ty-modal-dialog[open] {\n animation: ty-modal-enter var(--ty-modal-duration, 200ms) ease-out;\n}\n\n@keyframes ty-modal-enter {\n from {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.93);\n }\n\n to {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n}\n\n/* Backdrop is part of modal functionality, not user content */\n.ty-modal-dialog::backdrop {\n background: var(--ty-modal-backdrop, rgba(0, 0, 0, 0.5));\n backdrop-filter: var(--ty-modal-backdrop-blur, blur(2px));\n animation: ty-modal-backdrop-enter var(--ty-modal-duration, 200ms) ease-out;\n}\n\n/* When backdrop is disabled */\n.ty-modal-dialog:not([data-backdrop])::backdrop {\n background: transparent;\n backdrop-filter: none;\n}\n\n/* Minimal container - no styling imposed on user content */\n.modal-content {\n color: var(--ty-text);\n}\n\n@keyframes ty-modal-backdrop-enter {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n";
|
|
7
|
+
export declare const modalStyles = "\n:host {\n display: contents;\n /* Don't interfere with layout */\n}\n\n/* Part of the modal wrapper functionality, not user content styling */\n.close-button {\n position: absolute;\n top: -8px;\n right: -8px;\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: var(--ty-transition-colors);\n z-index: 1;\n color: #d8d8d8;\n\n /* Remove all default browser styling that could cause outlines/borders */\n outline: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n\n /* Remove mobile tap highlights and focus rings */\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.close-button:hover {\n color: white;\n}\n\n/* Explicitly remove focus and active states for all interaction modes */\n.close-button:focus,\n.close-button:focus-visible,\n.close-button:focus-within,\n.close-button:active {\n outline: none !important;\n box-shadow: none !important;\n border: none !important;\n background: transparent !important;\n}\n\n/* Override hover color even in focus/active states */\n.close-button:hover,\n.close-button:focus:hover,\n.close-button:active:hover {\n color: white;\n}\n\n.close-button.hide {\n visibility: hidden;\n}\n\n/* Pure wrapper: only essential modal functionality, no styling of user content */\n.ty-modal-dialog {\n /* Reset default dialog styles */\n padding: 18px;\n border: none;\n margin: 0;\n background: transparent;\n\n /* Centered */\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n\n z-index: 1000;\n overflow: hidden;\n\n /* No sizing - let user content determine size */\n max-width: 85vw;\n max-height: 90vh;\n\n outline: none;\n}\n\n/* Panel zoom-in synced with the backdrop fade (shadcn-style zoom-in-95).\n Enter-only: animating exit on a native <dialog> means delaying close(). */\n.ty-modal-dialog[open] {\n animation: ty-modal-enter var(--ty-modal-duration, 200ms) ease-out;\n}\n\n@keyframes ty-modal-enter {\n from {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.93);\n }\n\n to {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n}\n\n/* Backdrop is part of modal functionality, not user content */\n.ty-modal-dialog::backdrop {\n background: var(--ty-modal-backdrop, rgba(0, 0, 0, 0.5));\n backdrop-filter: var(--ty-modal-backdrop-blur, blur(2px));\n animation: ty-modal-backdrop-enter var(--ty-modal-duration, 200ms) ease-out;\n}\n\n/* When backdrop is disabled */\n.ty-modal-dialog:not([data-backdrop])::backdrop {\n background: transparent;\n backdrop-filter: none;\n}\n\n/* sheet: full screen on phones, sliding up from the bottom. Opt-in, and only\n below 768px (the select's mobile line); wider screens keep the centered dialog. The panel is forced to\n fill the sheet (!important beats its own width, inline style included),\n since a sheet that leaves page showing around the panel isn't one. */\n@media (max-width: 768px) {\n .ty-modal-dialog[data-sheet] {\n inset: 0;\n transform: none;\n width: 100%;\n height: 100dvh;\n max-width: none;\n max-height: none;\n padding: env(safe-area-inset-top) env(safe-area-inset-right)\n env(safe-area-inset-bottom) env(safe-area-inset-left);\n background: var(--ty-surface-floating);\n box-sizing: border-box;\n }\n\n .ty-modal-dialog[data-sheet][open] {\n animation-name: ty-modal-sheet-enter;\n }\n\n .ty-modal-dialog[data-sheet] .modal-content {\n height: 100%;\n overflow-y: auto;\n overscroll-behavior: contain;\n }\n\n .ty-modal-dialog[data-sheet] ::slotted(*) {\n box-sizing: border-box !important;\n width: 100% !important;\n max-width: none !important;\n min-height: 100% !important;\n margin: 0 !important;\n border: none !important;\n border-radius: 0 !important;\n }\n\n /* On the panel, not out on the backdrop */\n .ty-modal-dialog[data-sheet] .close-button {\n top: calc(env(safe-area-inset-top) + 8px);\n right: calc(env(safe-area-inset-right) + 8px);\n color: var(--ty-text-soft);\n }\n\n .ty-modal-dialog[data-sheet] .close-button:hover,\n .ty-modal-dialog[data-sheet] .close-button:focus:hover,\n .ty-modal-dialog[data-sheet] .close-button:active:hover {\n color: var(--ty-text);\n }\n}\n\n@keyframes ty-modal-sheet-enter {\n from {\n transform: translateY(100%);\n }\n\n to {\n transform: none;\n }\n}\n\n/* Minimal container - no styling imposed on user content */\n.modal-content {\n color: var(--ty-text);\n}\n\n@keyframes ty-modal-backdrop-enter {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .ty-modal-dialog[open],\n .ty-modal-dialog[data-sheet][open],\n .ty-modal-dialog::backdrop {\n animation: none;\n }\n}\n";
|
package/lib/styles/modal.js
CHANGED
|
@@ -83,6 +83,55 @@ animation: ty-modal-backdrop-enter var(--ty-modal-duration, 200ms) ease-out;
|
|
|
83
83
|
background: transparent;
|
|
84
84
|
backdrop-filter: none;
|
|
85
85
|
}
|
|
86
|
+
@media (max-width: 768px) {
|
|
87
|
+
.ty-modal-dialog[data-sheet] {
|
|
88
|
+
inset: 0;
|
|
89
|
+
transform: none;
|
|
90
|
+
width: 100%;
|
|
91
|
+
height: 100dvh;
|
|
92
|
+
max-width: none;
|
|
93
|
+
max-height: none;
|
|
94
|
+
padding: env(safe-area-inset-top) env(safe-area-inset-right)
|
|
95
|
+
env(safe-area-inset-bottom) env(safe-area-inset-left);
|
|
96
|
+
background: var(--ty-surface-floating);
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
}
|
|
99
|
+
.ty-modal-dialog[data-sheet][open] {
|
|
100
|
+
animation-name: ty-modal-sheet-enter;
|
|
101
|
+
}
|
|
102
|
+
.ty-modal-dialog[data-sheet] .modal-content {
|
|
103
|
+
height: 100%;
|
|
104
|
+
overflow-y: auto;
|
|
105
|
+
overscroll-behavior: contain;
|
|
106
|
+
}
|
|
107
|
+
.ty-modal-dialog[data-sheet] ::slotted(*) {
|
|
108
|
+
box-sizing: border-box !important;
|
|
109
|
+
width: 100% !important;
|
|
110
|
+
max-width: none !important;
|
|
111
|
+
min-height: 100% !important;
|
|
112
|
+
margin: 0 !important;
|
|
113
|
+
border: none !important;
|
|
114
|
+
border-radius: 0 !important;
|
|
115
|
+
}
|
|
116
|
+
.ty-modal-dialog[data-sheet] .close-button {
|
|
117
|
+
top: calc(env(safe-area-inset-top) + 8px);
|
|
118
|
+
right: calc(env(safe-area-inset-right) + 8px);
|
|
119
|
+
color: var(--ty-text-soft);
|
|
120
|
+
}
|
|
121
|
+
.ty-modal-dialog[data-sheet] .close-button:hover,
|
|
122
|
+
.ty-modal-dialog[data-sheet] .close-button:focus:hover,
|
|
123
|
+
.ty-modal-dialog[data-sheet] .close-button:active:hover {
|
|
124
|
+
color: var(--ty-text);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
@keyframes ty-modal-sheet-enter {
|
|
128
|
+
from {
|
|
129
|
+
transform: translateY(100%);
|
|
130
|
+
}
|
|
131
|
+
to {
|
|
132
|
+
transform: none;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
86
135
|
.modal-content {
|
|
87
136
|
color: var(--ty-text);
|
|
88
137
|
}
|
|
@@ -94,4 +143,11 @@ to {
|
|
|
94
143
|
opacity: 1;
|
|
95
144
|
}
|
|
96
145
|
}
|
|
146
|
+
@media (prefers-reduced-motion: reduce) {
|
|
147
|
+
.ty-modal-dialog[open],
|
|
148
|
+
.ty-modal-dialog[data-sheet][open],
|
|
149
|
+
.ty-modal-dialog::backdrop {
|
|
150
|
+
animation: none;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
97
153
|
`;
|
package/lib/version.d.ts
CHANGED
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '1.0.0-
|
|
1
|
+
export const VERSION = '1.0.0-RC19';
|