@kupola/kupola 2.0.0-beta.1 → 2.0.0-beta.10
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 +1 -1
- package/dist/css/components.min.css +1 -0
- package/dist/css/index.css +1 -0
- package/dist/css/index.min.css +1 -0
- package/dist/css/responsive.css +153 -0
- package/dist/css/responsive.min.css +1 -0
- package/dist/css/tokens.css +9 -0
- package/dist/css/tokens.min.css +1 -0
- package/dist/kupola-core-datepicker.cjs +28 -0
- package/dist/kupola-core-datepicker.esm.js +9 -9
- package/dist/kupola-core-dialog.cjs +13 -0
- package/dist/kupola-core-dialog.esm.js +8 -8
- package/dist/kupola-core-drawer.cjs +15 -0
- package/dist/kupola-core-drawer.esm.js +5 -5
- package/dist/kupola-core-dropdown.cjs +11 -0
- package/dist/kupola-core-dropdown.esm.js +4 -4
- package/dist/kupola-core-i18n.cjs +1 -0
- package/dist/kupola-core-i18n.esm.js +1 -1
- package/dist/{kupola-core-modal.cjs.js → kupola-core-modal.cjs} +2 -2
- package/dist/kupola-core-modal.esm.js +2 -2
- package/dist/kupola-core-notification.cjs +1 -0
- package/dist/kupola-core-notification.esm.js +1 -1
- package/dist/{kupola-core-numberinput.cjs.js → kupola-core-numberinput.cjs} +6 -5
- package/dist/kupola-core-numberinput.esm.js +6 -5
- package/dist/kupola-core-select.cjs +16 -0
- package/dist/kupola-core-select.esm.js +8 -7
- package/dist/kupola-core-table.cjs +1 -0
- package/dist/kupola-core-table.esm.js +1 -1
- package/dist/kupola-core-timepicker.cjs +22 -0
- package/dist/kupola-core-timepicker.esm.js +3 -3
- package/dist/kupola-core.cjs +1 -0
- package/dist/kupola-core.esm.js +1 -1
- package/package.json +63 -54
- package/packages/core/package.json +52 -52
- package/packages/core/src/components/datepicker.js +11 -6
- package/packages/core/src/components/dialog.js +14 -7
- package/packages/core/src/components/drawer.js +5 -3
- package/packages/core/src/components/dropdown.js +15 -3
- package/packages/core/src/components/modal.js +20 -1
- package/packages/core/src/components/notification.js +9 -2
- package/packages/core/src/components/numberinput.js +12 -3
- package/packages/core/src/components/select.js +22 -5
- package/packages/core/src/components/table.js +3 -1
- package/packages/core/src/components/timepicker.js +2 -1
- package/packages/core/src/devtools.js +303 -0
- package/packages/core/src/effect.js +6 -1
- package/packages/core/src/errors.js +80 -0
- package/packages/core/src/i18n.js +5 -0
- package/packages/core/src/index.js +12 -0
- package/packages/core/src/lazy.js +128 -0
- package/packages/core/src/signal.js +3 -0
- package/packages/core/src/theme.js +173 -0
- package/packages/css/index.css +1 -0
- package/packages/css/responsive.css +153 -0
- package/packages/css/tokens.css +9 -0
- package/dist/kupola-core-datepicker.cjs.js +0 -28
- package/dist/kupola-core-dialog.cjs.js +0 -13
- package/dist/kupola-core-drawer.cjs.js +0 -15
- package/dist/kupola-core-dropdown.cjs.js +0 -11
- package/dist/kupola-core-i18n.cjs.js +0 -1
- package/dist/kupola-core-notification.cjs.js +0 -1
- package/dist/kupola-core-select.cjs.js +0 -15
- package/dist/kupola-core-table.cjs.js +0 -1
- package/dist/kupola-core-timepicker.cjs.js +0 -22
- package/dist/kupola-core.cjs.js +0 -1
- /package/dist/{kupola-core-alert.cjs.js → kupola-core-alert.cjs} +0 -0
- /package/dist/{kupola-core-avatar.cjs.js → kupola-core-avatar.cjs} +0 -0
- /package/dist/{kupola-core-badge.cjs.js → kupola-core-badge.cjs} +0 -0
- /package/dist/{kupola-core-breadcrumb.cjs.js → kupola-core-breadcrumb.cjs} +0 -0
- /package/dist/{kupola-core-calendar.cjs.js → kupola-core-calendar.cjs} +0 -0
- /package/dist/{kupola-core-carousel.cjs.js → kupola-core-carousel.cjs} +0 -0
- /package/dist/{kupola-core-checkbox.cjs.js → kupola-core-checkbox.cjs} +0 -0
- /package/dist/{kupola-core-collapse.cjs.js → kupola-core-collapse.cjs} +0 -0
- /package/dist/{kupola-core-colorpicker.cjs.js → kupola-core-colorpicker.cjs} +0 -0
- /package/dist/{kupola-core-countdown.cjs.js → kupola-core-countdown.cjs} +0 -0
- /package/dist/{kupola-core-directives.cjs.js → kupola-core-directives.cjs} +0 -0
- /package/dist/{kupola-core-divider.cjs.js → kupola-core-divider.cjs} +0 -0
- /package/dist/{kupola-core-dynamictags.cjs.js → kupola-core-dynamictags.cjs} +0 -0
- /package/dist/{kupola-core-empty.cjs.js → kupola-core-empty.cjs} +0 -0
- /package/dist/{kupola-core-fileupload.cjs.js → kupola-core-fileupload.cjs} +0 -0
- /package/dist/{kupola-core-form.cjs.js → kupola-core-form.cjs} +0 -0
- /package/dist/{kupola-core-heatmap.cjs.js → kupola-core-heatmap.cjs} +0 -0
- /package/dist/{kupola-core-icons.cjs.js → kupola-core-icons.cjs} +0 -0
- /package/dist/{kupola-core-imagepreview.cjs.js → kupola-core-imagepreview.cjs} +0 -0
- /package/dist/{kupola-core-input.cjs.js → kupola-core-input.cjs} +0 -0
- /package/dist/{kupola-core-kbd.cjs.js → kupola-core-kbd.cjs} +0 -0
- /package/dist/{kupola-core-menu.cjs.js → kupola-core-menu.cjs} +0 -0
- /package/dist/{kupola-core-message.cjs.js → kupola-core-message.cjs} +0 -0
- /package/dist/{kupola-core-pagination.cjs.js → kupola-core-pagination.cjs} +0 -0
- /package/dist/{kupola-core-progress.cjs.js → kupola-core-progress.cjs} +0 -0
- /package/dist/{kupola-core-radio.cjs.js → kupola-core-radio.cjs} +0 -0
- /package/dist/{kupola-core-server.cjs.js → kupola-core-server.cjs} +0 -0
- /package/dist/{kupola-core-skeleton.cjs.js → kupola-core-skeleton.cjs} +0 -0
- /package/dist/{kupola-core-slider.cjs.js → kupola-core-slider.cjs} +0 -0
- /package/dist/{kupola-core-spin.cjs.js → kupola-core-spin.cjs} +0 -0
- /package/dist/{kupola-core-statcard.cjs.js → kupola-core-statcard.cjs} +0 -0
- /package/dist/{kupola-core-switch.cjs.js → kupola-core-switch.cjs} +0 -0
- /package/dist/{kupola-core-tabs.cjs.js → kupola-core-tabs.cjs} +0 -0
- /package/dist/{kupola-core-tag.cjs.js → kupola-core-tag.cjs} +0 -0
- /package/dist/{kupola-core-textarea.cjs.js → kupola-core-textarea.cjs} +0 -0
- /package/dist/{kupola-core-timeline.cjs.js → kupola-core-timeline.cjs} +0 -0
- /package/dist/{kupola-core-tooltip.cjs.js → kupola-core-tooltip.cjs} +0 -0
- /package/dist/{kupola-core-tree.cjs.js → kupola-core-tree.cjs} +0 -0
- /package/dist/{kupola-core-validation.cjs.js → kupola-core-validation.cjs} +0 -0
- /package/dist/{kupola-core-virtuallist.cjs.js → kupola-core-virtuallist.cjs} +0 -0
package/README.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,::after,::before{box-sizing:border-box}body{margin:0;background:var(--color-background);color:var(--color-foreground);font-family:var(--font-family-default);font-size:var(--body-base-font-size);line-height:var(--body-base-line-height)}.ds-btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--spacer-6);padding:0 var(--spacer-12);height:28px;border-radius:var(--radius-4);border:1px solid transparent;cursor:pointer;user-select:none;white-space:nowrap;font-size:var(--body-sm-font-size);font-weight:var(--font-weight-medium);transition:background var(--transition-fast),color var(--transition-fast),border-color var(--transition-fast)}.ds-btn--sm{height:24px;padding:0 var(--spacer-8);font-size:var(--body-xs-font-size)}.ds-btn--lg{height:32px;padding:0 var(--spacer-16);font-size:var(--body-base-font-size)}.ds-btn--primary{background:var(--bg-brand);color:var(--text-onbrand);border-color:var(--bg-brand)}.ds-btn--primary:hover{background:var(--bg-brand-hover)}.ds-btn--secondary{background:var(--bg-overlay-l2);color:var(--text-default);border-color:var(--border-neutral-l1)}.ds-btn--secondary:hover{background:var(--bg-overlay-l3)}.ds-btn--tertiary{background:0 0;color:var(--text-default)}.ds-btn--tertiary:hover{background:var(--bg-overlay-l2)}.ds-btn--danger{background:var(--status-error-default);color:#fff}.ds-btn[disabled]{opacity:.5;cursor:not-allowed}.ds-input{display:flex;align-items:center;gap:var(--spacer-8);padding:0 var(--spacer-12);height:28px;background:var(--bg-overlay-l1);border:1px solid var(--border-neutral-l1);border-radius:var(--radius-4);color:var(--text-default);width:100%;font-size:var(--body-sm-font-size)}.ds-input:focus-within{border-color:var(--bg-brand)}.ds-input input{flex:1;background:0 0;border:none;outline:0;color:inherit;font:inherit}.ds-input input::placeholder{color:var(--text-tertiary)}.ds-input.is-error{border-color:var(--status-error-default)}.ds-modal-mask{position:fixed;inset:0;z-index:var(--z-index-modal);background:rgba(0,0,0,.5);display:none;align-items:center;justify-content:center}.ds-modal-mask.is-visible{display:flex}.ds-modal{background:var(--bg-base-secondary);border:1px solid var(--border-neutral-l1);border-radius:var(--radius-8);width:100%;max-width:480px;outline:0}.ds-modal__header{display:flex;align-items:center;justify-content:space-between;padding:var(--spacer-16) var(--spacer-24);border-bottom:1px solid var(--border-neutral-l1)}.ds-modal__title{font-size:var(--heading-sm-font-size);font-weight:var(--font-weight-strong)}.ds-modal__close{width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;background:0 0;border:none;color:var(--icon-secondary);cursor:pointer;border-radius:var(--radius-4)}.ds-modal__close:hover{background:var(--bg-overlay-l2)}.ds-modal__body{padding:var(--spacer-16) var(--spacer-24)}.ds-modal__footer{display:flex;justify-content:flex-end;gap:var(--spacer-8);padding:var(--spacer-12) var(--spacer-24);border-top:1px solid var(--border-neutral-l1)}.ds-drawer-mask{position:fixed;inset:0;z-index:var(--z-index-drawer);background:rgba(0,0,0,.5);display:none}.ds-drawer-mask.is-visible{display:block}.ds-drawer{position:fixed;top:0;right:0;bottom:0;z-index:var(--z-index-drawer);width:360px;max-width:100vw;background:var(--bg-base-secondary);border-left:1px solid var(--border-neutral-l1);display:flex;flex-direction:column;transform:translateX(100%);transition:transform var(--transition-slow)}.ds-drawer.is-visible{transform:translateX(0)}.ds-drawer__header{display:flex;align-items:center;justify-content:space-between;padding:var(--spacer-16) var(--spacer-24);border-bottom:1px solid var(--border-neutral-l1)}.ds-drawer__body{padding:var(--spacer-16) var(--spacer-24);flex:1;overflow-y:auto}.ds-dropdown{position:relative;display:inline-block}.ds-dropdown__menu{position:absolute;top:calc(100% + 4px);left:0;min-width:160px;background:var(--bg-base-secondary);border:1px solid var(--border-neutral-l2);border-radius:var(--radius-4);box-shadow:0 4px 16px rgba(0,0,0,.2);z-index:var(--z-index-dropdown);display:none;padding:var(--spacer-4)}.ds-dropdown__menu.is-open{display:block}.ds-dropdown__item{display:flex;align-items:center;padding:var(--spacer-6) var(--spacer-8);border-radius:var(--radius-2);color:var(--text-default);font-size:var(--body-sm-font-size);cursor:pointer}.ds-dropdown__item:hover{background:var(--bg-overlay-l1)}.ds-tooltip{position:fixed;z-index:var(--z-index-tooltip);padding:var(--spacer-4) var(--spacer-8);background:var(--bg-base-tertiary);border:1px solid var(--border-neutral-l1);border-radius:var(--radius-4);font-size:var(--body-xs-font-size);color:var(--text-default);pointer-events:none;max-width:280px;white-space:pre-wrap}.ds-table{width:100%;border-collapse:collapse}.ds-table td,.ds-table th{text-align:left;padding:var(--spacer-12) var(--spacer-8);border-bottom:1px solid var(--border-neutral-l1);font-size:var(--body-sm-font-size)}.ds-table th{color:var(--text-tertiary);font-weight:var(--font-weight-default);font-size:var(--body-xs-font-size);text-transform:uppercase;letter-spacing:.04em}.ds-table td{color:var(--text-default)}.ds-table--striped tbody tr:nth-child(2n){background:var(--bg-base-secondary)}.ds-table--hover tbody tr:hover{background:var(--bg-overlay-l1)}.ds-form{display:flex;flex-direction:column;gap:var(--spacer-16)}.ds-form__group{display:flex;flex-direction:column;gap:var(--spacer-6)}.ds-form__label{font-size:var(--body-sm-font-size);font-weight:var(--font-weight-medium);color:var(--text-default)}.ds-form__error{font-size:var(--body-xs-font-size);color:var(--status-error-default)}.ds-form__actions{display:flex;justify-content:flex-end;gap:var(--spacer-8);margin-top:var(--spacer-16)}.ds-alert{display:flex;gap:var(--spacer-12);padding:var(--spacer-12) var(--spacer-16);background:var(--bg-base-secondary);border:1px solid var(--border-neutral-l1);border-radius:var(--radius-4);color:var(--text-default)}.ds-alert--success{background:var(--status-success-surface-l1);border-color:var(--status-success-default)}.ds-alert--warning{background:var(--status-warning-surface-l1);border-color:var(--status-warning-default)}.ds-alert--error{background:var(--status-error-surface-l1);border-color:var(--status-error-default)}.ds-alert--info{background:var(--status-info-surface-l1);border-color:var(--status-info-default)}.ds-tag{display:inline-flex;align-items:center;padding:0 var(--spacer-6);height:18px;border-radius:var(--radius-2);font-size:var(--body-xs-font-size);background:var(--bg-overlay-l2);color:var(--text-secondary);border:1px solid var(--border-neutral-l1)}.ds-tag--success{background:var(--status-success-surface-l1);color:var(--status-success-default)}.ds-tag--warning{background:var(--status-warning-surface-l1);color:var(--status-warning-default)}.ds-tag--error{background:var(--status-error-surface-l1);color:var(--status-error-default)}.ds-tabs{display:flex;gap:var(--spacer-24);border-bottom:1px solid var(--border-neutral-l1)}.ds-tab{padding:var(--spacer-12) 0;background:0 0;border:none;color:var(--text-tertiary);cursor:pointer;font:inherit;font-size:var(--body-sm-font-size);position:relative}.ds-tab.is-active,.ds-tab:hover{color:var(--text-default)}.ds-tab.is-active::after{content:'';position:absolute;left:0;right:0;bottom:-1px;height:2px;background:var(--icon-default)}.ds-message{position:fixed;top:var(--spacer-24);left:50%;transform:translateX(-50%);z-index:var(--z-index-notification);padding:var(--spacer-8) var(--spacer-16);background:var(--bg-base-secondary);border:1px solid var(--border-neutral-l1);border-radius:var(--radius-4);box-shadow:0 4px 12px rgba(0,0,0,.15);font-size:var(--body-sm-font-size);color:var(--text-default)}.ds-progress{width:100%;height:4px;background:var(--bg-overlay-l2);border-radius:var(--radius-full);overflow:hidden}.ds-progress__bar{height:100%;background:var(--bg-brand);border-radius:var(--radius-full);transition:width var(--transition-normal)}.ds-switch{position:relative;width:36px;height:20px;background:var(--bg-overlay-l3);border-radius:var(--radius-full);cursor:pointer;transition:background var(--transition-fast)}.ds-switch.is-active{background:var(--bg-brand)}.ds-switch::after{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform var(--transition-fast)}.ds-switch.is-active::after{transform:translateX(16px)}.ds-card{background:var(--bg-base-secondary);border:1px solid var(--border-neutral-l1);border-radius:var(--radius-4);padding:var(--spacer-24)}.ds-skeleton{background:var(--bg-overlay-l2);border-radius:var(--radius-4);animation:1.5s ease-in-out infinite ds-skeleton-pulse}@keyframes ds-skeleton-pulse{0%,100%{opacity:1}50%{opacity:.4}}.ds-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:var(--spacer-40);color:var(--text-tertiary);font-size:var(--body-sm-font-size)}.ds-divider{height:1px;background:var(--border-neutral-l1)}.ds-avatar{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;background:var(--bg-overlay-l3);color:var(--text-default);font-size:var(--body-sm-font-size);font-weight:var(--font-weight-strong)}.ds-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 var(--spacer-4);border-radius:var(--radius-full);font-size:11px;font-weight:600;background:var(--status-error-default);color:#fff}.ds-collapse__header{display:flex;align-items:center;justify-content:space-between;padding:var(--spacer-12) var(--spacer-16);cursor:pointer;color:var(--text-default);font-weight:var(--font-weight-medium)}.ds-collapse__body{padding:0 var(--spacer-16) var(--spacer-16)}.ds-spin{display:inline-block;width:24px;height:24px;border:2px solid var(--bg-overlay-l3);border-top-color:var(--bg-brand);border-radius:50%;animation:.8s linear infinite ds-spin-rotate}@keyframes ds-spin-rotate{to{transform:rotate(360deg)}}
|
package/dist/css/index.css
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'Cascadia Code','Fira Code','Segoe UI',-apple-system,[data-theme=dark]{color-scheme:dark;--bg-base-default:#0C0C0D;--bg-base-secondary:#1A1B1D;--bg-base-tertiary:#222427;--bg-overlay-l1:rgba(255, 255, 255, 0.04);--bg-overlay-l2:rgba(255, 255, 255, 0.06);--bg-overlay-l3:rgba(255, 255, 255, 0.08);--bg-overlay-l4:rgba(255, 255, 255, 0.12);--text-default:#E5E7EB;--text-secondary:#B8BDCA;--text-tertiary:#9CA3AF;--text-disabled:#8B93A1;--text-onbrand:#FFFFFF;--icon-default:#E5E7EB;--icon-secondary:#B8BDCA;--icon-tertiary:#9CA3AF;--icon-disabled:#8B93A1;--border-neutral-l1:rgba(255, 255, 255, 0.12);--border-neutral-l2:rgba(255, 255, 255, 0.18);--border-neutral-l3:rgba(255, 255, 255, 0.25);--bg-brand:#32F08C;--bg-brand-hover:#53F4A2;--bg-brand-disabled:rgba(50, 240, 140, 0.3);--status-success-default:#32F08C;--status-warning-default:#FFAD5B;--status-error-default:#FF9CA8;--status-info-default:#79B8FF;--status-success-surface-l1:rgba(50, 240, 140, 0.12);--status-warning-surface-l1:rgba(255, 173, 91, 0.12);--status-error-surface-l1:rgba(255, 156, 168, 0.12);--status-info-surface-l1:rgba(121, 184, 255, 0.12);--color-background:var(--bg-base-default);--color-surface:var(--bg-base-secondary);--color-foreground:var(--text-default);--color-border:var(--border-neutral-l1)}[data-theme=light]{color-scheme:light;--bg-base-default:#FFFFFF;--bg-base-secondary:#F5F6F8;--bg-base-tertiary:#EDF0F5;--bg-overlay-l1:rgba(0, 0, 0, 0.04);--bg-overlay-l2:rgba(0, 0, 0, 0.06);--bg-overlay-l3:rgba(0, 0, 0, 0.08);--bg-overlay-l4:rgba(0, 0, 0, 0.12);--text-default:#0F1117;--text-secondary:#4B5563;--text-tertiary:#5B6370;--text-disabled:#525A68;--text-onbrand:#FFFFFF;--icon-default:#0F1117;--icon-secondary:#4B5563;--icon-tertiary:#5B6370;--icon-disabled:#525A68;--border-neutral-l1:rgba(0, 0, 0, 0.12);--border-neutral-l2:rgba(0, 0, 0, 0.18);--border-neutral-l3:rgba(0, 0, 0, 0.25);--bg-brand:#22C55E;--bg-brand-hover:#16A34A;--bg-brand-disabled:rgba(34, 197, 94, 0.3);--status-success-default:#16A34A;--status-warning-default:#CA8A04;--status-error-default:#DC2626;--status-info-default:#2E69FF;--status-success-surface-l1:rgba(22, 163, 74, 0.08);--status-warning-surface-l1:rgba(202, 138, 4, 0.08);--status-error-surface-l1:rgba(220, 38, 38, 0.08);--status-info-surface-l1:rgba(46, 105, 255, 0.08);--color-background:var(--bg-base-default);--color-surface:var(--bg-base-secondary);--color-foreground:var(--text-default);--color-border:var(--border-neutral-l1)}*,::after,::before{box-sizing:border-box}body{margin:0;background:var(--color-background);color:var(--color-foreground);font-family:var(--font-family-default);font-size:var(--body-base-font-size);line-height:var(--body-base-line-height)}.ds-btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--spacer-6);padding:0 var(--spacer-12);height:28px;border-radius:var(--radius-4);border:1px solid transparent;cursor:pointer;user-select:none;white-space:nowrap;font-size:var(--body-sm-font-size);font-weight:var(--font-weight-medium);transition:background var(--transition-fast),color var(--transition-fast),border-color var(--transition-fast)}.ds-btn--sm{height:24px;padding:0 var(--spacer-8);font-size:var(--body-xs-font-size)}.ds-btn--lg{height:32px;padding:0 var(--spacer-16);font-size:var(--body-base-font-size)}.ds-btn--primary{background:var(--bg-brand);color:var(--text-onbrand);border-color:var(--bg-brand)}.ds-btn--primary:hover{background:var(--bg-brand-hover)}.ds-btn--secondary{background:var(--bg-overlay-l2);color:var(--text-default);border-color:var(--border-neutral-l1)}.ds-btn--secondary:hover{background:var(--bg-overlay-l3)}.ds-btn--tertiary{background:0 0;color:var(--text-default)}.ds-btn--tertiary:hover{background:var(--bg-overlay-l2)}.ds-btn--danger{background:var(--status-error-default);color:#fff}.ds-btn[disabled]{opacity:.5;cursor:not-allowed}.ds-input{display:flex;align-items:center;gap:var(--spacer-8);padding:0 var(--spacer-12);height:28px;background:var(--bg-overlay-l1);border:1px solid var(--border-neutral-l1);border-radius:var(--radius-4);color:var(--text-default);width:100%;font-size:var(--body-sm-font-size)}.ds-input:focus-within{border-color:var(--bg-brand)}.ds-input input{flex:1;background:0 0;border:none;outline:0;color:inherit;font:inherit}.ds-input input::placeholder{color:var(--text-tertiary)}.ds-input.is-error{border-color:var(--status-error-default)}.ds-modal-mask{position:fixed;inset:0;z-index:var(--z-index-modal);background:rgba(0,0,0,.5);display:none;align-items:center;justify-content:center}.ds-modal-mask.is-visible{display:flex}.ds-modal{background:var(--bg-base-secondary);border:1px solid var(--border-neutral-l1);border-radius:var(--radius-8);width:100%;max-width:480px;outline:0}.ds-modal__header{display:flex;align-items:center;justify-content:space-between;padding:var(--spacer-16) var(--spacer-24);border-bottom:1px solid var(--border-neutral-l1)}.ds-modal__title{font-size:var(--heading-sm-font-size);font-weight:var(--font-weight-strong)}.ds-modal__close{width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;background:0 0;border:none;color:var(--icon-secondary);cursor:pointer;border-radius:var(--radius-4)}.ds-modal__close:hover{background:var(--bg-overlay-l2)}.ds-modal__body{padding:var(--spacer-16) var(--spacer-24)}.ds-modal__footer{display:flex;justify-content:flex-end;gap:var(--spacer-8);padding:var(--spacer-12) var(--spacer-24);border-top:1px solid var(--border-neutral-l1)}.ds-drawer-mask{position:fixed;inset:0;z-index:var(--z-index-drawer);background:rgba(0,0,0,.5);display:none}.ds-drawer-mask.is-visible{display:block}.ds-drawer{position:fixed;top:0;right:0;bottom:0;z-index:var(--z-index-drawer);width:360px;max-width:100vw;background:var(--bg-base-secondary);border-left:1px solid var(--border-neutral-l1);display:flex;flex-direction:column;transform:translateX(100%);transition:transform var(--transition-slow)}.ds-drawer.is-visible{transform:translateX(0)}.ds-drawer__header{display:flex;align-items:center;justify-content:space-between;padding:var(--spacer-16) var(--spacer-24);border-bottom:1px solid var(--border-neutral-l1)}.ds-drawer__body{padding:var(--spacer-16) var(--spacer-24);flex:1;overflow-y:auto}.ds-dropdown{position:relative;display:inline-block}.ds-dropdown__menu{position:absolute;top:calc(100% + 4px);left:0;min-width:160px;background:var(--bg-base-secondary);border:1px solid var(--border-neutral-l2);border-radius:var(--radius-4);box-shadow:0 4px 16px rgba(0,0,0,.2);z-index:var(--z-index-dropdown);display:none;padding:var(--spacer-4)}.ds-dropdown__menu.is-open{display:block}.ds-dropdown__item{display:flex;align-items:center;padding:var(--spacer-6) var(--spacer-8);border-radius:var(--radius-2);color:var(--text-default);font-size:var(--body-sm-font-size);cursor:pointer}.ds-dropdown__item:hover{background:var(--bg-overlay-l1)}.ds-tooltip{position:fixed;z-index:var(--z-index-tooltip);padding:var(--spacer-4) var(--spacer-8);background:var(--bg-base-tertiary);border:1px solid var(--border-neutral-l1);border-radius:var(--radius-4);font-size:var(--body-xs-font-size);color:var(--text-default);pointer-events:none;max-width:280px;white-space:pre-wrap}.ds-table{width:100%;border-collapse:collapse}.ds-table td,.ds-table th{text-align:left;padding:var(--spacer-12) var(--spacer-8);border-bottom:1px solid var(--border-neutral-l1);font-size:var(--body-sm-font-size)}.ds-table th{color:var(--text-tertiary);font-weight:var(--font-weight-default);font-size:var(--body-xs-font-size);text-transform:uppercase;letter-spacing:.04em}.ds-table td{color:var(--text-default)}.ds-table--striped tbody tr:nth-child(2n){background:var(--bg-base-secondary)}.ds-table--hover tbody tr:hover{background:var(--bg-overlay-l1)}.ds-form{display:flex;flex-direction:column;gap:var(--spacer-16)}.ds-form__group{display:flex;flex-direction:column;gap:var(--spacer-6)}.ds-form__label{font-size:var(--body-sm-font-size);font-weight:var(--font-weight-medium);color:var(--text-default)}.ds-form__error{font-size:var(--body-xs-font-size);color:var(--status-error-default)}.ds-form__actions{display:flex;justify-content:flex-end;gap:var(--spacer-8);margin-top:var(--spacer-16)}.ds-alert{display:flex;gap:var(--spacer-12);padding:var(--spacer-12) var(--spacer-16);background:var(--bg-base-secondary);border:1px solid var(--border-neutral-l1);border-radius:var(--radius-4);color:var(--text-default)}.ds-alert--success{background:var(--status-success-surface-l1);border-color:var(--status-success-default)}.ds-alert--warning{background:var(--status-warning-surface-l1);border-color:var(--status-warning-default)}.ds-alert--error{background:var(--status-error-surface-l1);border-color:var(--status-error-default)}.ds-alert--info{background:var(--status-info-surface-l1);border-color:var(--status-info-default)}.ds-tag{display:inline-flex;align-items:center;padding:0 var(--spacer-6);height:18px;border-radius:var(--radius-2);font-size:var(--body-xs-font-size);background:var(--bg-overlay-l2);color:var(--text-secondary);border:1px solid var(--border-neutral-l1)}.ds-tag--success{background:var(--status-success-surface-l1);color:var(--status-success-default)}.ds-tag--warning{background:var(--status-warning-surface-l1);color:var(--status-warning-default)}.ds-tag--error{background:var(--status-error-surface-l1);color:var(--status-error-default)}.ds-tabs{display:flex;gap:var(--spacer-24);border-bottom:1px solid var(--border-neutral-l1)}.ds-tab{padding:var(--spacer-12) 0;background:0 0;border:none;color:var(--text-tertiary);cursor:pointer;font:inherit;font-size:var(--body-sm-font-size);position:relative}.ds-tab.is-active,.ds-tab:hover{color:var(--text-default)}.ds-tab.is-active::after{content:'';position:absolute;left:0;right:0;bottom:-1px;height:2px;background:var(--icon-default)}.ds-message{position:fixed;top:var(--spacer-24);left:50%;transform:translateX(-50%);z-index:var(--z-index-notification);padding:var(--spacer-8) var(--spacer-16);background:var(--bg-base-secondary);border:1px solid var(--border-neutral-l1);border-radius:var(--radius-4);box-shadow:0 4px 12px rgba(0,0,0,.15);font-size:var(--body-sm-font-size);color:var(--text-default)}.ds-progress{width:100%;height:4px;background:var(--bg-overlay-l2);border-radius:var(--radius-full);overflow:hidden}.ds-progress__bar{height:100%;background:var(--bg-brand);border-radius:var(--radius-full);transition:width var(--transition-normal)}.ds-switch{position:relative;width:36px;height:20px;background:var(--bg-overlay-l3);border-radius:var(--radius-full);cursor:pointer;transition:background var(--transition-fast)}.ds-switch.is-active{background:var(--bg-brand)}.ds-switch::after{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform var(--transition-fast)}.ds-switch.is-active::after{transform:translateX(16px)}.ds-card{background:var(--bg-base-secondary);border:1px solid var(--border-neutral-l1);border-radius:var(--radius-4);padding:var(--spacer-24)}.ds-skeleton{background:var(--bg-overlay-l2);border-radius:var(--radius-4);animation:1.5s ease-in-out infinite ds-skeleton-pulse}@keyframes ds-skeleton-pulse{0%,100%{opacity:1}50%{opacity:.4}}.ds-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:var(--spacer-40);color:var(--text-tertiary);font-size:var(--body-sm-font-size)}.ds-divider{height:1px;background:var(--border-neutral-l1)}.ds-avatar{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;background:var(--bg-overlay-l3);color:var(--text-default);font-size:var(--body-sm-font-size);font-weight:var(--font-weight-strong)}.ds-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 var(--spacer-4);border-radius:var(--radius-full);font-size:11px;font-weight:600;background:var(--status-error-default);color:#fff}.ds-collapse__header{display:flex;align-items:center;justify-content:space-between;padding:var(--spacer-12) var(--spacer-16);cursor:pointer;color:var(--text-default);font-weight:var(--font-weight-medium)}.ds-collapse__body{padding:0 var(--spacer-16) var(--spacer-16)}.ds-spin{display:inline-block;width:24px;height:24px;border:2px solid var(--bg-overlay-l3);border-top-color:var(--bg-brand);border-radius:50%;animation:.8s linear infinite ds-spin-rotate}@keyframes ds-spin-rotate{to{transform:rotate(360deg)}}@media (min-width:576px){.ds-show-sm{display:none!important}}@media (min-width:768px){.ds-show-md{display:none!important}}@media (max-width:1023.98px){.ds-hide-below-lg,.ds-hide-lg{display:none!important}}@media (min-width:1024px){.ds-show-lg{display:none!important}}@media (max-width:1279.98px){.ds-hide-below-xl,.ds-hide-xl{display:none!important}}@media (min-width:1280px){.ds-show-xl{display:none!important}}@media (max-width:767.98px){.ds-hide-below-md,.ds-hide-md{display:none!important}.ds-padding-responsive{padding:var(--spacing-3,12px)!important}.ds-margin-responsive{margin:var(--spacing-3,12px)!important}.ds-text-responsive{font-size:var(--font-size-sm, 13px)!important}.ds-table-wrapper{overflow-x:auto;-webkit-overflow-scrolling:touch}.ds-table{min-width:600px}.ds-table td,.ds-table th{white-space:nowrap;padding:var(--spacing-2,8px) var(--spacing-3,12px);font-size:var(--font-size-sm, 13px)}}@media (max-width:575.98px){.ds-hide-below-sm,.ds-hide-sm{display:none!important}.ds-modal-content{width:100%!important;max-width:100%!important;min-height:100vh!important;border-radius:0!important;margin:0!important}.ds-modal-mask{padding:0!important}.ds-drawer-left,.ds-drawer-right{width:100%!important;max-width:100%!important}.ds-drawer-bottom,.ds-drawer-top{height:90vh!important;max-height:90vh!important}.ds-dialog{width:calc(100% - 32px)!important;max-width:100%!important;margin:16px!important}.ds-select-dropdown{position:fixed!important;bottom:0;left:0;right:0;max-height:50vh;border-radius:12px 12px 0 0;z-index:var(--z-index-modal,3000)}.ds-datepicker-panel{width:calc(100vw - 32px)!important;max-width:100%!important}.ds-notification{width:calc(100% - 24px)!important;max-width:100%!important;right:12px!important;left:12px!important}}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kupola CSS — Responsive utilities & component adaptations.
|
|
3
|
+
*
|
|
4
|
+
* Breakpoints:
|
|
5
|
+
* sm: 576px (phones landscape)
|
|
6
|
+
* md: 768px (tablets)
|
|
7
|
+
* lg: 1024px (laptops)
|
|
8
|
+
* xl: 1280px (desktops)
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* <div class="ds-hide-sm">Hidden on phones</div>
|
|
12
|
+
* <div class="ds-show-md">Only visible on tablets+</div>
|
|
13
|
+
* <div class="ds-hide-lg">Hidden below laptops</div>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/* ═══════════════════════════════════════════════════════════
|
|
17
|
+
Responsive display utilities
|
|
18
|
+
═══════════════════════════════════════════════════════════ */
|
|
19
|
+
|
|
20
|
+
/* ── sm: < 576px (phones) ─────────────────────────────── */
|
|
21
|
+
@media (max-width: 575.98px) {
|
|
22
|
+
.ds-hide-sm { display: none !important; }
|
|
23
|
+
.ds-hide-below-sm { display: none !important; }
|
|
24
|
+
}
|
|
25
|
+
@media (min-width: 576px) {
|
|
26
|
+
.ds-show-sm { display: none !important; }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* ── md: < 768px (below tablets) ──────────────────────── */
|
|
30
|
+
@media (max-width: 767.98px) {
|
|
31
|
+
.ds-hide-md { display: none !important; }
|
|
32
|
+
.ds-hide-below-md { display: none !important; }
|
|
33
|
+
}
|
|
34
|
+
@media (min-width: 768px) {
|
|
35
|
+
.ds-show-md { display: none !important; }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* ── lg: < 1024px (below laptops) ─────────────────────── */
|
|
39
|
+
@media (max-width: 1023.98px) {
|
|
40
|
+
.ds-hide-lg { display: none !important; }
|
|
41
|
+
.ds-hide-below-lg { display: none !important; }
|
|
42
|
+
}
|
|
43
|
+
@media (min-width: 1024px) {
|
|
44
|
+
.ds-show-lg { display: none !important; }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* ── xl: < 1280px (below desktops) ────────────────────── */
|
|
48
|
+
@media (max-width: 1279.98px) {
|
|
49
|
+
.ds-hide-xl { display: none !important; }
|
|
50
|
+
.ds-hide-below-xl { display: none !important; }
|
|
51
|
+
}
|
|
52
|
+
@media (min-width: 1280px) {
|
|
53
|
+
.ds-show-xl { display: none !important; }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* ═══════════════════════════════════════════════════════════
|
|
57
|
+
Responsive spacing utilities
|
|
58
|
+
═══════════════════════════════════════════════════════════ */
|
|
59
|
+
|
|
60
|
+
@media (max-width: 767.98px) {
|
|
61
|
+
.ds-padding-responsive { padding: var(--spacing-3, 12px) !important; }
|
|
62
|
+
.ds-margin-responsive { margin: var(--spacing-3, 12px) !important; }
|
|
63
|
+
.ds-text-responsive { font-size: var(--font-size-sm, 13px) !important; }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* ═══════════════════════════════════════════════════════════
|
|
67
|
+
Component responsive adaptations
|
|
68
|
+
═══════════════════════════════════════════════════════════ */
|
|
69
|
+
|
|
70
|
+
/* ── Modal: full-screen on phones ─────────────────────────── */
|
|
71
|
+
@media (max-width: 575.98px) {
|
|
72
|
+
.ds-modal-content {
|
|
73
|
+
width: 100% !important;
|
|
74
|
+
max-width: 100% !important;
|
|
75
|
+
min-height: 100vh !important;
|
|
76
|
+
border-radius: 0 !important;
|
|
77
|
+
margin: 0 !important;
|
|
78
|
+
}
|
|
79
|
+
.ds-modal-mask {
|
|
80
|
+
padding: 0 !important;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* ── Drawer: full-width/height on phones ──────────────────── */
|
|
85
|
+
@media (max-width: 575.98px) {
|
|
86
|
+
.ds-drawer-right,
|
|
87
|
+
.ds-drawer-left {
|
|
88
|
+
width: 100% !important;
|
|
89
|
+
max-width: 100% !important;
|
|
90
|
+
}
|
|
91
|
+
.ds-drawer-bottom,
|
|
92
|
+
.ds-drawer-top {
|
|
93
|
+
height: 90vh !important;
|
|
94
|
+
max-height: 90vh !important;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* ── Dialog: full-width on phones ─────────────────────────── */
|
|
99
|
+
@media (max-width: 575.98px) {
|
|
100
|
+
.ds-dialog {
|
|
101
|
+
width: calc(100% - 32px) !important;
|
|
102
|
+
max-width: 100% !important;
|
|
103
|
+
margin: 16px !important;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* ── Table: horizontal scroll on small screens ────────────── */
|
|
108
|
+
@media (max-width: 767.98px) {
|
|
109
|
+
.ds-table-wrapper {
|
|
110
|
+
overflow-x: auto;
|
|
111
|
+
-webkit-overflow-scrolling: touch;
|
|
112
|
+
}
|
|
113
|
+
.ds-table {
|
|
114
|
+
min-width: 600px;
|
|
115
|
+
}
|
|
116
|
+
.ds-table th,
|
|
117
|
+
.ds-table td {
|
|
118
|
+
white-space: nowrap;
|
|
119
|
+
padding: var(--spacing-2, 8px) var(--spacing-3, 12px);
|
|
120
|
+
font-size: var(--font-size-sm, 13px);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* ── Select: full-width on phones ─────────────────────────── */
|
|
125
|
+
@media (max-width: 575.98px) {
|
|
126
|
+
.ds-select-dropdown {
|
|
127
|
+
position: fixed !important;
|
|
128
|
+
bottom: 0;
|
|
129
|
+
left: 0;
|
|
130
|
+
right: 0;
|
|
131
|
+
max-height: 50vh;
|
|
132
|
+
border-radius: 12px 12px 0 0;
|
|
133
|
+
z-index: var(--z-index-modal, 3000);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* ── DatePicker: full-width on phones ─────────────────────── */
|
|
138
|
+
@media (max-width: 575.98px) {
|
|
139
|
+
.ds-datepicker-panel {
|
|
140
|
+
width: calc(100vw - 32px) !important;
|
|
141
|
+
max-width: 100% !important;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* ── Notification: stack full-width on phones ─────────────── */
|
|
146
|
+
@media (max-width: 575.98px) {
|
|
147
|
+
.ds-notification {
|
|
148
|
+
width: calc(100% - 24px) !important;
|
|
149
|
+
max-width: 100% !important;
|
|
150
|
+
right: 12px !important;
|
|
151
|
+
left: 12px !important;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@media (min-width:576px){.ds-show-sm{display:none!important}}@media (min-width:768px){.ds-show-md{display:none!important}}@media (max-width:1023.98px){.ds-hide-below-lg,.ds-hide-lg{display:none!important}}@media (min-width:1024px){.ds-show-lg{display:none!important}}@media (max-width:1279.98px){.ds-hide-below-xl,.ds-hide-xl{display:none!important}}@media (min-width:1280px){.ds-show-xl{display:none!important}}@media (max-width:767.98px){.ds-hide-below-md,.ds-hide-md{display:none!important}.ds-padding-responsive{padding:var(--spacing-3,12px)!important}.ds-margin-responsive{margin:var(--spacing-3,12px)!important}.ds-text-responsive{font-size:var(--font-size-sm, 13px)!important}.ds-table-wrapper{overflow-x:auto;-webkit-overflow-scrolling:touch}.ds-table{min-width:600px}.ds-table td,.ds-table th{white-space:nowrap;padding:var(--spacing-2,8px) var(--spacing-3,12px);font-size:var(--font-size-sm, 13px)}}@media (max-width:575.98px){.ds-hide-below-sm,.ds-hide-sm{display:none!important}.ds-modal-content{width:100%!important;max-width:100%!important;min-height:100vh!important;border-radius:0!important;margin:0!important}.ds-modal-mask{padding:0!important}.ds-drawer-left,.ds-drawer-right{width:100%!important;max-width:100%!important}.ds-drawer-bottom,.ds-drawer-top{height:90vh!important;max-height:90vh!important}.ds-dialog{width:calc(100% - 32px)!important;max-width:100%!important;margin:16px!important}.ds-select-dropdown{position:fixed!important;bottom:0;left:0;right:0;max-height:50vh;border-radius:12px 12px 0 0;z-index:var(--z-index-modal,3000)}.ds-datepicker-panel{width:calc(100vw - 32px)!important;max-width:100%!important}.ds-notification{width:calc(100% - 24px)!important;max-width:100%!important;right:12px!important;left:12px!important}}
|
package/dist/css/tokens.css
CHANGED
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
:root {
|
|
11
|
+
|
|
12
|
+
/* ── Anti-FOUC: hide elements until JS removes [k-cloak] ── */
|
|
13
|
+
[k-cloak] { display: none !important; }
|
|
11
14
|
/* ── Primitives: Radius ─────────────────────────────────── */
|
|
12
15
|
--radius-2: 2px;
|
|
13
16
|
--radius-4: 4px;
|
|
@@ -75,6 +78,12 @@
|
|
|
75
78
|
--transition-fast: 0.12s ease;
|
|
76
79
|
--transition-normal: 0.2s ease;
|
|
77
80
|
--transition-slow: 0.3s ease;
|
|
81
|
+
|
|
82
|
+
/* ── Breakpoints ────────────────────────────────────────── */
|
|
83
|
+
--breakpoint-sm: 576px;
|
|
84
|
+
--breakpoint-md: 768px;
|
|
85
|
+
--breakpoint-lg: 1024px;
|
|
86
|
+
--breakpoint-xl: 1280px;
|
|
78
87
|
}
|
|
79
88
|
|
|
80
89
|
/* ═══════════════════════════════════════════════════════════
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'Cascadia Code','Fira Code','Segoe UI',-apple-system,[data-theme=dark]{color-scheme:dark;--bg-base-default:#0C0C0D;--bg-base-secondary:#1A1B1D;--bg-base-tertiary:#222427;--bg-overlay-l1:rgba(255, 255, 255, 0.04);--bg-overlay-l2:rgba(255, 255, 255, 0.06);--bg-overlay-l3:rgba(255, 255, 255, 0.08);--bg-overlay-l4:rgba(255, 255, 255, 0.12);--text-default:#E5E7EB;--text-secondary:#B8BDCA;--text-tertiary:#9CA3AF;--text-disabled:#8B93A1;--text-onbrand:#FFFFFF;--icon-default:#E5E7EB;--icon-secondary:#B8BDCA;--icon-tertiary:#9CA3AF;--icon-disabled:#8B93A1;--border-neutral-l1:rgba(255, 255, 255, 0.12);--border-neutral-l2:rgba(255, 255, 255, 0.18);--border-neutral-l3:rgba(255, 255, 255, 0.25);--bg-brand:#32F08C;--bg-brand-hover:#53F4A2;--bg-brand-disabled:rgba(50, 240, 140, 0.3);--status-success-default:#32F08C;--status-warning-default:#FFAD5B;--status-error-default:#FF9CA8;--status-info-default:#79B8FF;--status-success-surface-l1:rgba(50, 240, 140, 0.12);--status-warning-surface-l1:rgba(255, 173, 91, 0.12);--status-error-surface-l1:rgba(255, 156, 168, 0.12);--status-info-surface-l1:rgba(121, 184, 255, 0.12);--color-background:var(--bg-base-default);--color-surface:var(--bg-base-secondary);--color-foreground:var(--text-default);--color-border:var(--border-neutral-l1)}[data-theme=light]{color-scheme:light;--bg-base-default:#FFFFFF;--bg-base-secondary:#F5F6F8;--bg-base-tertiary:#EDF0F5;--bg-overlay-l1:rgba(0, 0, 0, 0.04);--bg-overlay-l2:rgba(0, 0, 0, 0.06);--bg-overlay-l3:rgba(0, 0, 0, 0.08);--bg-overlay-l4:rgba(0, 0, 0, 0.12);--text-default:#0F1117;--text-secondary:#4B5563;--text-tertiary:#5B6370;--text-disabled:#525A68;--text-onbrand:#FFFFFF;--icon-default:#0F1117;--icon-secondary:#4B5563;--icon-tertiary:#5B6370;--icon-disabled:#525A68;--border-neutral-l1:rgba(0, 0, 0, 0.12);--border-neutral-l2:rgba(0, 0, 0, 0.18);--border-neutral-l3:rgba(0, 0, 0, 0.25);--bg-brand:#22C55E;--bg-brand-hover:#16A34A;--bg-brand-disabled:rgba(34, 197, 94, 0.3);--status-success-default:#16A34A;--status-warning-default:#CA8A04;--status-error-default:#DC2626;--status-info-default:#2E69FF;--status-success-surface-l1:rgba(22, 163, 74, 0.08);--status-warning-surface-l1:rgba(202, 138, 4, 0.08);--status-error-surface-l1:rgba(220, 38, 38, 0.08);--status-info-surface-l1:rgba(46, 105, 255, 0.08);--color-background:var(--bg-base-default);--color-surface:var(--bg-base-secondary);--color-foreground:var(--text-default);--color-border:var(--border-neutral-l1)}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";class t{constructor(t,e){this.strings=t,this.values=e}}function e(e,...n){return new t(e,n)}function n(t){const e={t:t,o:new Set,i:null,l:!1};return e.i=()=>{e.l||o(e)},o(e),()=>function(t){if(t.l)return;t.l=!0,i(t)}(e)}function o(t){i(t);try{t.t()}finally{}}function i(t){for(const e of t.o)e.u.delete(t);t.o.clear()}function s(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function c(t){if(null==t||"object"!=typeof t)return!1;const e=Object.getOwnPropertyDescriptor(t,"value");if(e&&"function"==typeof e.get)return!0;const n=Object.getPrototypeOf(t);if(n){const t=Object.getOwnPropertyDescriptor(n,"value");if(t&&"function"==typeof t.get)return!0}return!1}const r=t=>`${t}`;function l(e){const n=[];for(let o=0;o<e.strings.length;o++)if(n.push(e.strings[o]),o<e.values.length){const i=e.values[o];i instanceof t?n.push(l(i)):Array.isArray(i)&&i.length>0&&i[0]instanceof t?n.push(i.map(l).join("")):c(i)?n.push(s(i.value)):"function"!=typeof i&&n.push(s(i??""))}return n.join("")}function a(t,e){const n=t.indexOf(e);if(-1===n)return{type:"text"};const o=t.substring(0,n).lastIndexOf("<");if(-1===o)return{type:"text"};if(t.substring(o,n).includes(">"))return{type:"text"};const i=t.substring(o+1,n).match(/([\w\-@:.]+)\s*=\s*(?:"[^"]*|'[^']*|[^\s>]*?)$/);if(!i)return{type:"text"};const s=i[1];return s.startsWith("on")&&s.length>2?{type:"event",attrName:s}:{type:"attr",attrName:s}}class u{constructor(t,e){this.container=t,this.rawValue=e,this.node=null,this.h=null}mount(){const e=document.createTextNode("");if(this.p?this.container.insertBefore(e,this.p):this.container.appendChild(e),this.node=e,c(this.rawValue)){const t=this.rawValue;this.h=n(()=>{this.node.textContent=null!=t.value?String(t.value):""})}else this.rawValue instanceof t?this.node.textContent=l(this.rawValue):this.node.textContent=null!=this.rawValue?String(this.rawValue):""}destroy(){this.h?.(),this.node?.remove()}}class d{constructor(t,e,n){this.element=t,this.attrName=e,this.rawValue=n,this.h=null}mount(){if(c(this.rawValue)){const t=this.rawValue;this.h=n(()=>{const e=t.value;null==e||!1===e?this.element.removeAttribute(this.attrName):this.element.setAttribute(this.attrName,String(e))})}else null!=this.rawValue&&!1!==this.rawValue&&this.element.setAttribute(this.attrName,String(this.rawValue))}destroy(){this.h?.()}}class f{constructor(t,e,n){this.element=t,this.eventName=e.slice(2).toLowerCase(),this.handler=n,this.k=null}mount(){"function"==typeof this.handler&&(this.k=t=>this.handler(t),this.element.addEventListener(this.eventName,this.k))}destroy(){this.k&&(this.element.removeEventListener(this.eventName,this.k),this.k=null)}}class h{constructor(){this.parts=[],this.fragment=null}destroy(){for(const t of this.parts)t.destroy();this.parts.length=0}}function p(e,n){const o=new h,i=function(e){const n=[];for(let o=0;o<e.strings.length;o++)if(n.push(e.strings[o]),o<e.values.length){const i=e.values[o];i instanceof t?n.push(l(i)):Array.isArray(i)&&i.length>0&&i[0]instanceof t?n.push(i.map(l).join("")):"function"==typeof i||c(i)?n.push(r(o)):n.push(s(i??""))}return n.join("")}(e),a=function(t){const e=document.createElement("template");return e.innerHTML=t,e.content}(i);o.fragment=a,k(a,e.values,i,o);for(const t of o.parts)t.mount();return n.appendChild(a),o}function k(t,e,n,o){const i=[...t.childNodes];for(const s of i)3===s.nodeType?y(s,e,n,o,t):1===s.nodeType&&g(s,e,n,o)}function y(t,e,n,o,i){const s=t.textContent||"";for(let c=0;c<e.length;c++){const l=r(c),d=s.indexOf(l);if(-1===d)continue;if("text"!==a(n,l).type)continue;const f=s.substring(0,d),h=s.substring(d+l.length);f&&i.insertBefore(document.createTextNode(f),t);const p=new u(i,e[c]);o.parts.push(p);let k=t;return h&&(k=document.createTextNode(h),i.insertBefore(k,t)),i.removeChild(t),p.p=k!==t?k:null,void(h&&y(k,e,n,o,i))}}function g(t,e,n,o){const i=[...t.attributes];for(const s of i)for(let i=0;i<e.length;i++){const c=r(i);if(!s.value.includes(c))continue;const l=a(n,c);if("event"===l.type&&l.attrName===s.name){t.removeAttribute(s.name);const n=new f(t,s.name,e[i]);o.parts.push(n)}else if("attr"===l.type&&l.attrName===s.name){const n=s.value.replace(c,"");n?t.setAttribute(s.name,n):t.removeAttribute(s.name);const r=new d(t,s.name,e[i]);o.parts.push(r)}}k(t,e,n,o)}const w={"en-US":{"modal.close":"Close","dialog.ok":"OK","dialog.cancel":"Cancel","table.empty":"No data","pagination.page":"Page","pagination.of":"of","select.placeholder":"Select...","datepicker.placeholder":"Select date","timepicker.placeholder":"Select time","fileupload.drag":"Drag files here or","fileupload.browse":"Browse","empty.text":"No data","datepicker.months":"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec","datepicker.weekdays":"Mo,Tu,We,Th,Fr,Sa,Su","timepicker.placeholder":"Select time"},"zh-CN":{"modal.close":"关闭","dialog.ok":"确定","dialog.cancel":"取消","table.empty":"暂无数据","pagination.page":"页","pagination.of":"/","select.placeholder":"请选择","datepicker.placeholder":"选择日期","datepicker.months":"1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月","datepicker.weekdays":"一,二,三,四,五,六,日","timepicker.placeholder":"选择时间","fileupload.drag":"拖拽文件到此处或","fileupload.browse":"浏览","empty.text":"暂无数据"}};function m(t,e={}){let n=(w["en-US"]||w["en-US"])[t]||t;for(const[t,o]of Object.entries(e))n=n.replace(`{${t}}`,o);return n}exports.Datepicker=function(t={}){const{placeholder:n=null,format:o="YYYY-MM-DD",value:i="",weekStart:s=1,minDate:c=null,maxDate:r=null,onChange:l=null}=t,a=n||m("datepicker.placeholder"),u=m("datepicker.months").split(","),d=m("datepicker.weekdays").split(",");let f=!1,h=(new Date).getFullYear(),k=(new Date).getMonth(),y=null,g=null;i&&(y=v(i),y&&(h=y.getFullYear(),k=y.getMonth()));const w=c?v(c):null,_=r?v(r):null;function v(t){if(!t)return null;let e=t.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);return e?new Date(+e[1],+e[2]-1,+e[3]):(e=t.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/),e?new Date(+e[3],+e[1]-1,+e[2]):(e=t.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/),e?new Date(+e[3],+e[2]-1,+e[1]):null))}function $(t){if(!t)return"";const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");switch(o){case"MM/DD/YYYY":return`${n}/${i}/${e}`;case"DD/MM/YYYY":return`${i}.${n}.${e}`;default:return`${e}-${n}-${i}`}}function x(t){return!!(w&&t<w)||!!(_&&t>_)}function D(t,e){return new Date(t,e+1,0).getDate()}function b(){if(f)return;f=!0;const t=B?B.querySelector(".ds-datepicker__calendar"):null;t&&(t.style.display="block")}function S(){if(!f)return;f=!1;const t=B?B.querySelector(".ds-datepicker__calendar"):null;t&&(t.style.display="none")}function Y(){f?S():b()}function M(){const t=B?B.querySelector(".ds-datepicker__input"):null;t&&(t.value=y?$(y):"")}function C(){const t=B?B.querySelector(".ds-datepicker__calendar"):null;if(!t)return;const e=t.querySelector(".ds-datepicker__title");e&&(e.textContent=`${u[k]} ${h}`);const n=t.querySelector(".ds-datepicker__days");if(!n)return;n.innerHTML="";(function(){const t=D(h,k);let e=new Date(h,k,1).getDay();1===s&&(e=0===e?6:e-1);const n=[],o=0===k?11:k-1,i=0===k?h-1:h,c=D(i,o);for(let t=e-1;t>=0;t--)n.push({date:new Date(i,o,c-t),outside:!0});for(let e=1;e<=t;e++)n.push({date:new Date(h,k,e),outside:!1});const r=7-n.length%7;if(r<7){const t=11===k?0:k+1,e=11===k?h+1:h;for(let o=1;o<=r;o++)n.push({date:new Date(e,t,o),outside:!0})}return n})().forEach(({date:t,outside:e})=>{const o=document.createElement("button");o.textContent=t.getDate(),e&&o.classList.add("is-outside"),function(t){const e=new Date;return t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}(t)&&o.classList.add("is-today"),function(t){return!!y&&t.getFullYear()===y.getFullYear()&&t.getMonth()===y.getMonth()&&t.getDate()===y.getDate()}(t)&&o.classList.add("is-selected"),x(t)&&(o.disabled=!0,o.style.opacity="0.3",o.style.cursor="not-allowed"),o.addEventListener("click",e=>{e.stopPropagation(),function(t){x(t)||(y=t,h=t.getFullYear(),k=t.getMonth(),M(),C(),S(),l&&l($(t),t))}(t)}),n.appendChild(o)})}const N=t=>{f&&B&&!B.contains(t.target)&&S()};document.addEventListener("click",N);const O=t=>{"Escape"===t.key&&f&&S()};document.addEventListener("keydown",O);const j=e`
|
|
2
|
+
<div class="ds-datepicker">
|
|
3
|
+
<div class="ds-datepicker__input-wrap" onclick="${t=>{t.stopPropagation(),Y()}}">
|
|
4
|
+
<input class="ds-datepicker__input" type="text" readonly placeholder="${a}" value="${y?$(y):""}" />
|
|
5
|
+
<button class="ds-datepicker__icon" onclick="${t=>{t.stopPropagation(),Y()}}">
|
|
6
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
7
|
+
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"/>
|
|
8
|
+
<line x1="16" y1="2" x2="16" y2="6"/>
|
|
9
|
+
<line x1="8" y1="2" x2="8" y2="6"/>
|
|
10
|
+
<line x1="3" y1="10" x2="21" y2="10"/>
|
|
11
|
+
</svg>
|
|
12
|
+
</button>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="ds-datepicker__calendar" style="display:none">
|
|
15
|
+
<div class="ds-datepicker__header">
|
|
16
|
+
<button class="ds-datepicker__nav" onclick="${function(){0===k?(k=11,h--):k--,C()}}" aria-label="Previous month">
|
|
17
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 18 9 12 15 6"/></svg>
|
|
18
|
+
</button>
|
|
19
|
+
<span class="ds-datepicker__title">${`${u[k]} ${h}`}</span>
|
|
20
|
+
<button class="ds-datepicker__nav" onclick="${function(){11===k?(k=0,h++):k++,C()}}" aria-label="Next month">
|
|
21
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
|
|
22
|
+
</button>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="ds-datepicker__weekdays">${(1===s?d:[d[6],...d.slice(0,6)]).map(t=>e`<span>${t}</span>`)}</div>
|
|
25
|
+
<div class="ds-datepicker__days"></div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
`,A=document.createDocumentFragment();g=p(j,A);const B=A.querySelector(".ds-datepicker");return C(),{get element(){return A},open:b,close:S,toggle:Y,getValue:function(){return y?$(y):""},setValue:function(t){y=v(t),y&&(h=y.getFullYear(),k=y.getMonth()),M(),C()},destroy(){document.removeEventListener("click",N),document.removeEventListener("keydown",O),g&&g.destroy()}}};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
class t{constructor(t,
|
|
1
|
+
class t{constructor(t,e){this.strings=t,this.values=e}}function e(e,...n){return new t(e,n)}function n(t){const e={t:t,o:new Set,i:null,l:!1};return e.i=()=>{e.l||o(e)},o(e),()=>function(t){if(t.l)return;t.l=!0,i(t)}(e)}function o(t){i(t);try{t.t()}finally{}}function i(t){for(const e of t.o)e.u.delete(t);t.o.clear()}function s(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function c(t){if(null==t||"object"!=typeof t)return!1;const e=Object.getOwnPropertyDescriptor(t,"value");if(e&&"function"==typeof e.get)return!0;const n=Object.getPrototypeOf(t);if(n){const t=Object.getOwnPropertyDescriptor(n,"value");if(t&&"function"==typeof t.get)return!0}return!1}const r=t=>`${t}`;function l(e){const n=[];for(let o=0;o<e.strings.length;o++)if(n.push(e.strings[o]),o<e.values.length){const i=e.values[o];i instanceof t?n.push(l(i)):Array.isArray(i)&&i.length>0&&i[0]instanceof t?n.push(i.map(l).join("")):c(i)?n.push(s(i.value)):"function"!=typeof i&&n.push(s(i??""))}return n.join("")}function a(t,e){const n=t.indexOf(e);if(-1===n)return{type:"text"};const o=t.substring(0,n).lastIndexOf("<");if(-1===o)return{type:"text"};if(t.substring(o,n).includes(">"))return{type:"text"};const i=t.substring(o+1,n).match(/([\w\-@:.]+)\s*=\s*(?:"[^"]*|'[^']*|[^\s>]*?)$/);if(!i)return{type:"text"};const s=i[1];return s.startsWith("on")&&s.length>2?{type:"event",attrName:s}:{type:"attr",attrName:s}}class u{constructor(t,e){this.container=t,this.rawValue=e,this.node=null,this.h=null}mount(){const e=document.createTextNode("");if(this.p?this.container.insertBefore(e,this.p):this.container.appendChild(e),this.node=e,c(this.rawValue)){const t=this.rawValue;this.h=n(()=>{this.node.textContent=null!=t.value?String(t.value):""})}else this.rawValue instanceof t?this.node.textContent=l(this.rawValue):this.node.textContent=null!=this.rawValue?String(this.rawValue):""}destroy(){this.h?.(),this.node?.remove()}}class d{constructor(t,e,n){this.element=t,this.attrName=e,this.rawValue=n,this.h=null}mount(){if(c(this.rawValue)){const t=this.rawValue;this.h=n(()=>{const e=t.value;null==e||!1===e?this.element.removeAttribute(this.attrName):this.element.setAttribute(this.attrName,String(e))})}else null!=this.rawValue&&!1!==this.rawValue&&this.element.setAttribute(this.attrName,String(this.rawValue))}destroy(){this.h?.()}}class f{constructor(t,e,n){this.element=t,this.eventName=e.slice(2).toLowerCase(),this.handler=n,this.k=null}mount(){"function"==typeof this.handler&&(this.k=t=>this.handler(t),this.element.addEventListener(this.eventName,this.k))}destroy(){this.k&&(this.element.removeEventListener(this.eventName,this.k),this.k=null)}}class h{constructor(){this.parts=[],this.fragment=null}destroy(){for(const t of this.parts)t.destroy();this.parts.length=0}}function p(e,n){const o=new h,i=function(e){const n=[];for(let o=0;o<e.strings.length;o++)if(n.push(e.strings[o]),o<e.values.length){const i=e.values[o];i instanceof t?n.push(l(i)):Array.isArray(i)&&i.length>0&&i[0]instanceof t?n.push(i.map(l).join("")):"function"==typeof i||c(i)?n.push(r(o)):n.push(s(i??""))}return n.join("")}(e),a=function(t){const e=document.createElement("template");return e.innerHTML=t,e.content}(i);o.fragment=a,k(a,e.values,i,o);for(const t of o.parts)t.mount();return n.appendChild(a),o}function k(t,e,n,o){const i=[...t.childNodes];for(const s of i)3===s.nodeType?y(s,e,n,o,t):1===s.nodeType&&g(s,e,n,o)}function y(t,e,n,o,i){const s=t.textContent||"";for(let c=0;c<e.length;c++){const l=r(c),d=s.indexOf(l);if(-1===d)continue;if("text"!==a(n,l).type)continue;const f=s.substring(0,d),h=s.substring(d+l.length);f&&i.insertBefore(document.createTextNode(f),t);const p=new u(i,e[c]);o.parts.push(p);let k=t;return h&&(k=document.createTextNode(h),i.insertBefore(k,t)),i.removeChild(t),p.p=k!==t?k:null,void(h&&y(k,e,n,o,i))}}function g(t,e,n,o){const i=[...t.attributes];for(const s of i)for(let i=0;i<e.length;i++){const c=r(i);if(!s.value.includes(c))continue;const l=a(n,c);if("event"===l.type&&l.attrName===s.name){t.removeAttribute(s.name);const n=new f(t,s.name,e[i]);o.parts.push(n)}else if("attr"===l.type&&l.attrName===s.name){const n=s.value.replace(c,"");n?t.setAttribute(s.name,n):t.removeAttribute(s.name);const r=new d(t,s.name,e[i]);o.parts.push(r)}}k(t,e,n,o)}const w={"en-US":{"modal.close":"Close","dialog.ok":"OK","dialog.cancel":"Cancel","table.empty":"No data","pagination.page":"Page","pagination.of":"of","select.placeholder":"Select...","datepicker.placeholder":"Select date","timepicker.placeholder":"Select time","fileupload.drag":"Drag files here or","fileupload.browse":"Browse","empty.text":"No data","datepicker.months":"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec","datepicker.weekdays":"Mo,Tu,We,Th,Fr,Sa,Su","timepicker.placeholder":"Select time"},"zh-CN":{"modal.close":"关闭","dialog.ok":"确定","dialog.cancel":"取消","table.empty":"暂无数据","pagination.page":"页","pagination.of":"/","select.placeholder":"请选择","datepicker.placeholder":"选择日期","datepicker.months":"1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月","datepicker.weekdays":"一,二,三,四,五,六,日","timepicker.placeholder":"选择时间","fileupload.drag":"拖拽文件到此处或","fileupload.browse":"浏览","empty.text":"暂无数据"}};function m(t,e={}){let n=(w["en-US"]||w["en-US"])[t]||t;for(const[t,o]of Object.entries(e))n=n.replace(`{${t}}`,o);return n}function _(t={}){const{placeholder:n=null,format:o="YYYY-MM-DD",value:i="",weekStart:s=1,minDate:c=null,maxDate:r=null,onChange:l=null}=t,a=n||m("datepicker.placeholder"),u=m("datepicker.months").split(","),d=m("datepicker.weekdays").split(",");let f=!1,h=(new Date).getFullYear(),k=(new Date).getMonth(),y=null,g=null;i&&(y=v(i),y&&(h=y.getFullYear(),k=y.getMonth()));const w=c?v(c):null,_=r?v(r):null;function v(t){if(!t)return null;let e=t.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);return e?new Date(+e[1],+e[2]-1,+e[3]):(e=t.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/),e?new Date(+e[3],+e[1]-1,+e[2]):(e=t.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/),e?new Date(+e[3],+e[2]-1,+e[1]):null))}function $(t){if(!t)return"";const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");switch(o){case"MM/DD/YYYY":return`${n}/${i}/${e}`;case"DD/MM/YYYY":return`${i}.${n}.${e}`;default:return`${e}-${n}-${i}`}}function x(t){return!!(w&&t<w)||!!(_&&t>_)}function D(t,e){return new Date(t,e+1,0).getDate()}function b(){if(f)return;f=!0;const t=B?B.querySelector(".ds-datepicker__calendar"):null;t&&(t.style.display="block")}function S(){if(!f)return;f=!1;const t=B?B.querySelector(".ds-datepicker__calendar"):null;t&&(t.style.display="none")}function Y(){f?S():b()}function M(){const t=B?B.querySelector(".ds-datepicker__input"):null;t&&(t.value=y?$(y):"")}function C(){const t=B?B.querySelector(".ds-datepicker__calendar"):null;if(!t)return;const e=t.querySelector(".ds-datepicker__title");e&&(e.textContent=`${u[k]} ${h}`);const n=t.querySelector(".ds-datepicker__days");if(!n)return;n.innerHTML="";(function(){const t=D(h,k);let e=new Date(h,k,1).getDay();1===s&&(e=0===e?6:e-1);const n=[],o=0===k?11:k-1,i=0===k?h-1:h,c=D(i,o);for(let t=e-1;t>=0;t--)n.push({date:new Date(i,o,c-t),outside:!0});for(let e=1;e<=t;e++)n.push({date:new Date(h,k,e),outside:!1});const r=7-n.length%7;if(r<7){const t=11===k?0:k+1,e=11===k?h+1:h;for(let o=1;o<=r;o++)n.push({date:new Date(e,t,o),outside:!0})}return n})().forEach(({date:t,outside:e})=>{const o=document.createElement("button");o.textContent=t.getDate(),e&&o.classList.add("is-outside"),function(t){const e=new Date;return t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}(t)&&o.classList.add("is-today"),function(t){return!!y&&t.getFullYear()===y.getFullYear()&&t.getMonth()===y.getMonth()&&t.getDate()===y.getDate()}(t)&&o.classList.add("is-selected"),x(t)&&(o.disabled=!0,o.style.opacity="0.3",o.style.cursor="not-allowed"),o.addEventListener("click",e=>{e.stopPropagation(),function(t){x(t)||(y=t,h=t.getFullYear(),k=t.getMonth(),M(),C(),S(),l&&l($(t),t))}(t)}),n.appendChild(o)})}const N=t=>{f&&B&&!B.contains(t.target)&&S()};document.addEventListener("click",N);const O=t=>{"Escape"===t.key&&f&&S()};document.addEventListener("keydown",O);const j=e`
|
|
2
2
|
<div class="ds-datepicker">
|
|
3
|
-
<div class="ds-datepicker__input-wrap" onclick="${t=>{t.stopPropagation(),
|
|
4
|
-
<input class="ds-datepicker__input" type="text" readonly placeholder="${
|
|
5
|
-
<button class="ds-datepicker__icon" onclick="${t=>{t.stopPropagation(),
|
|
3
|
+
<div class="ds-datepicker__input-wrap" onclick="${t=>{t.stopPropagation(),Y()}}">
|
|
4
|
+
<input class="ds-datepicker__input" type="text" readonly placeholder="${a}" value="${y?$(y):""}" />
|
|
5
|
+
<button class="ds-datepicker__icon" onclick="${t=>{t.stopPropagation(),Y()}}">
|
|
6
6
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
7
7
|
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"/>
|
|
8
8
|
<line x1="16" y1="2" x2="16" y2="6"/>
|
|
@@ -13,16 +13,16 @@ class t{constructor(t,n){this.strings=t,this.values=n}}function n(n,...e){return
|
|
|
13
13
|
</div>
|
|
14
14
|
<div class="ds-datepicker__calendar" style="display:none">
|
|
15
15
|
<div class="ds-datepicker__header">
|
|
16
|
-
<button class="ds-datepicker__nav" onclick="${function(){0===
|
|
16
|
+
<button class="ds-datepicker__nav" onclick="${function(){0===k?(k=11,h--):k--,C()}}" aria-label="Previous month">
|
|
17
17
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 18 9 12 15 6"/></svg>
|
|
18
18
|
</button>
|
|
19
|
-
<span class="ds-datepicker__title">${`${
|
|
20
|
-
<button class="ds-datepicker__nav" onclick="${function(){11===
|
|
19
|
+
<span class="ds-datepicker__title">${`${u[k]} ${h}`}</span>
|
|
20
|
+
<button class="ds-datepicker__nav" onclick="${function(){11===k?(k=0,h++):k++,C()}}" aria-label="Next month">
|
|
21
21
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
|
|
22
22
|
</button>
|
|
23
23
|
</div>
|
|
24
|
-
<div class="ds-datepicker__weekdays">${(1===
|
|
24
|
+
<div class="ds-datepicker__weekdays">${(1===s?d:[d[6],...d.slice(0,6)]).map(t=>e`<span>${t}</span>`)}</div>
|
|
25
25
|
<div class="ds-datepicker__days"></div>
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
28
|
-
`,A=document.createDocumentFragment();
|
|
28
|
+
`,A=document.createDocumentFragment();g=p(j,A);const B=A.querySelector(".ds-datepicker");return C(),{get element(){return A},open:b,close:S,toggle:Y,getValue:function(){return y?$(y):""},setValue:function(t){y=v(t),y&&(h=y.getFullYear(),k=y.getMonth()),M(),C()},destroy(){document.removeEventListener("click",N),document.removeEventListener("keydown",O),g&&g.destroy()}}}export{_ as Datepicker};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";class t{constructor(t,n){this.strings=t,this.values=n}}function n(n,...e){return new t(n,e)}function e(t){const n={t:t,o:new Set,i:null,l:!1};return n.i=()=>{n.l||o(n)},o(n),()=>function(t){if(t.l)return;t.l=!0,i(t)}(n)}function o(t){i(t);try{t.t()}finally{}}function i(t){for(const n of t.o)n.u.delete(t);t.o.clear()}function s(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function c(t){if(null==t||"object"!=typeof t)return!1;const n=Object.getOwnPropertyDescriptor(t,"value");if(n&&"function"==typeof n.get)return!0;const e=Object.getPrototypeOf(t);if(e){const t=Object.getOwnPropertyDescriptor(e,"value");if(t&&"function"==typeof t.get)return!0}return!1}const l=t=>`${t}`;function r(n){const e=[];for(let o=0;o<n.strings.length;o++)if(e.push(n.strings[o]),o<n.values.length){const i=n.values[o];i instanceof t?e.push(r(i)):Array.isArray(i)&&i.length>0&&i[0]instanceof t?e.push(i.map(r).join("")):c(i)?e.push(s(i.value)):"function"!=typeof i&&e.push(s(i??""))}return e.join("")}function a(t,n){const e=t.indexOf(n);if(-1===e)return{type:"text"};const o=t.substring(0,e).lastIndexOf("<");if(-1===o)return{type:"text"};if(t.substring(o,e).includes(">"))return{type:"text"};const i=t.substring(o+1,e).match(/([\w\-@:.]+)\s*=\s*(?:"[^"]*|'[^']*|[^\s>]*?)$/);if(!i)return{type:"text"};const s=i[1];return s.startsWith("on")&&s.length>2?{type:"event",attrName:s}:{type:"attr",attrName:s}}class d{constructor(t,n){this.container=t,this.rawValue=n,this.node=null,this.h=null}mount(){const n=document.createTextNode("");if(this.p?this.container.insertBefore(n,this.p):this.container.appendChild(n),this.node=n,c(this.rawValue)){const t=this.rawValue;this.h=e(()=>{this.node.textContent=null!=t.value?String(t.value):""})}else this.rawValue instanceof t?this.node.textContent=r(this.rawValue):this.node.textContent=null!=this.rawValue?String(this.rawValue):""}destroy(){this.h?.(),this.node?.remove()}}class u{constructor(t,n,e){this.element=t,this.attrName=n,this.rawValue=e,this.h=null}mount(){if(c(this.rawValue)){const t=this.rawValue;this.h=e(()=>{const n=t.value;null==n||!1===n?this.element.removeAttribute(this.attrName):this.element.setAttribute(this.attrName,String(n))})}else null!=this.rawValue&&!1!==this.rawValue&&this.element.setAttribute(this.attrName,String(this.rawValue))}destroy(){this.h?.()}}class h{constructor(t,n,e){this.element=t,this.eventName=n.slice(2).toLowerCase(),this.handler=e,this.m=null}mount(){"function"==typeof this.handler&&(this.m=t=>this.handler(t),this.element.addEventListener(this.eventName,this.m))}destroy(){this.m&&(this.element.removeEventListener(this.eventName,this.m),this.m=null)}}class f{constructor(){this.parts=[],this.fragment=null}destroy(){for(const t of this.parts)t.destroy();this.parts.length=0}}function p(n,e){const o=new f,i=function(n){const e=[];for(let o=0;o<n.strings.length;o++)if(e.push(n.strings[o]),o<n.values.length){const i=n.values[o];i instanceof t?e.push(r(i)):Array.isArray(i)&&i.length>0&&i[0]instanceof t?e.push(i.map(r).join("")):"function"==typeof i||c(i)?e.push(l(o)):e.push(s(i??""))}return e.join("")}(n),a=function(t){const n=document.createElement("template");return n.innerHTML=t,n.content}(i);o.fragment=a,g(a,n.values,i,o);for(const t of o.parts)t.mount();return e.appendChild(a),o}function g(t,n,e,o){const i=[...t.childNodes];for(const s of i)3===s.nodeType?y(s,n,e,o,t):1===s.nodeType&&m(s,n,e,o)}function y(t,n,e,o,i){const s=t.textContent||"";for(let c=0;c<n.length;c++){const r=l(c),u=s.indexOf(r);if(-1===u)continue;if("text"!==a(e,r).type)continue;const h=s.substring(0,u),f=s.substring(u+r.length);h&&i.insertBefore(document.createTextNode(h),t);const p=new d(i,n[c]);o.parts.push(p);let g=t;return f&&(g=document.createTextNode(f),i.insertBefore(g,t)),i.removeChild(t),p.p=g!==t?g:null,void(f&&y(g,n,e,o,i))}}function m(t,n,e,o){const i=[...t.attributes];for(const s of i)for(let i=0;i<n.length;i++){const c=l(i);if(!s.value.includes(c))continue;const r=a(e,c);if("event"===r.type&&r.attrName===s.name){t.removeAttribute(s.name);const e=new h(t,s.name,n[i]);o.parts.push(e)}else if("attr"===r.type&&r.attrName===s.name){const e=s.value.replace(c,"");e?t.setAttribute(s.name,e):t.removeAttribute(s.name);const l=new u(t,s.name,n[i]);o.parts.push(l)}}g(t,n,e,o)}const v={"en-US":{"modal.close":"Close","dialog.ok":"OK","dialog.cancel":"Cancel","table.empty":"No data","pagination.page":"Page","pagination.of":"of","select.placeholder":"Select...","datepicker.placeholder":"Select date","timepicker.placeholder":"Select time","fileupload.drag":"Drag files here or","fileupload.browse":"Browse","empty.text":"No data","datepicker.months":"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec","datepicker.weekdays":"Mo,Tu,We,Th,Fr,Sa,Su","timepicker.placeholder":"Select time"},"zh-CN":{"modal.close":"关闭","dialog.ok":"确定","dialog.cancel":"取消","table.empty":"暂无数据","pagination.page":"页","pagination.of":"/","select.placeholder":"请选择","datepicker.placeholder":"选择日期","datepicker.months":"1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月","datepicker.weekdays":"一,二,三,四,五,六,日","timepicker.placeholder":"选择时间","fileupload.drag":"拖拽文件到此处或","fileupload.browse":"浏览","empty.text":"暂无数据"}};function x(t,n={}){let e=(v["en-US"]||v["en-US"])[t]||t;for(const[t,o]of Object.entries(n))e=e.replace(`{${t}}`,o);return e}const w={success:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg>',warning:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>',error:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',info:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',normal:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>'};function k(t={}){const{title:e="",content:o="",type:i="normal",confirmText:s=null,cancelText:c=null,showCancel:l=!0}=t,r=s||x("dialog.ok"),a=c||x("dialog.cancel");return new Promise(t=>{const s=()=>{k(),t(!0)},c=()=>{k(),t(!1)},d=t=>{t.target===t.currentTarget&&c()},u=t=>{"Escape"===t.key&&c(),"Enter"===t.key&&s()},h=n`
|
|
2
|
+
<div class="ds-modal-mask">
|
|
3
|
+
<div class="ds-dialog" role="alertdialog" aria-modal="true" aria-labelledby="dialog-title" aria-describedby="dialog-content" tabindex="-1">
|
|
4
|
+
<div class="ds-dialog__icon ds-dialog__icon--${i}">${w[i]||w.normal}</div>
|
|
5
|
+
<div class="ds-dialog__title" id="dialog-title">${e}</div>
|
|
6
|
+
<div class="ds-dialog__content" id="dialog-content">${o}</div>
|
|
7
|
+
<div class="ds-dialog__actions">
|
|
8
|
+
${l?n`<button class="ds-btn ds-btn--ghost" data-action="cancel" type="button">${a}</button>`:""}
|
|
9
|
+
<button class="ds-btn ds-btn--primary" data-action="confirm" type="button">${r}</button>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
`,f=document.createDocumentFragment(),g=p(h,f);document.body.appendChild(f);const y=document.body.querySelector(".ds-modal-mask:last-of-type")||document.body.lastElementChild;y&&y.classList.add("is-visible"),document.body.style.overflow="hidden";const m=y?.querySelector(".ds-dialog");m&&m.focus();const v=y.querySelector('[data-action="confirm"]'),x=y.querySelector('[data-action="cancel"]');function k(){document.removeEventListener("keydown",u),document.body.style.overflow="",y&&y.classList.remove("is-visible"),setTimeout(()=>{g.destroy(),y&&y.parentNode&&y.parentNode.removeChild(y)},50)}v&&v.addEventListener("click",s),x&&x.addEventListener("click",c),y&&y.addEventListener("click",d),document.addEventListener("keydown",u)})}const b={confirm:k,alert:function(t={}){return k({...t,showCancel:!1}).then(()=>{})}};exports.Dialog=b;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
class t{constructor(t,n){this.strings=t,this.values=n}}function n(n,...
|
|
1
|
+
class t{constructor(t,n){this.strings=t,this.values=n}}function n(n,...e){return new t(n,e)}function e(t){const n={t:t,o:new Set,i:null,l:!1};return n.i=()=>{n.l||o(n)},o(n),()=>function(t){if(t.l)return;t.l=!0,i(t)}(n)}function o(t){i(t);try{t.t()}finally{}}function i(t){for(const n of t.o)n.u.delete(t);t.o.clear()}function s(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function c(t){if(null==t||"object"!=typeof t)return!1;const n=Object.getOwnPropertyDescriptor(t,"value");if(n&&"function"==typeof n.get)return!0;const e=Object.getPrototypeOf(t);if(e){const t=Object.getOwnPropertyDescriptor(e,"value");if(t&&"function"==typeof t.get)return!0}return!1}const l=t=>`${t}`;function r(n){const e=[];for(let o=0;o<n.strings.length;o++)if(e.push(n.strings[o]),o<n.values.length){const i=n.values[o];i instanceof t?e.push(r(i)):Array.isArray(i)&&i.length>0&&i[0]instanceof t?e.push(i.map(r).join("")):c(i)?e.push(s(i.value)):"function"!=typeof i&&e.push(s(i??""))}return e.join("")}function a(t,n){const e=t.indexOf(n);if(-1===e)return{type:"text"};const o=t.substring(0,e).lastIndexOf("<");if(-1===o)return{type:"text"};if(t.substring(o,e).includes(">"))return{type:"text"};const i=t.substring(o+1,e).match(/([\w\-@:.]+)\s*=\s*(?:"[^"]*|'[^']*|[^\s>]*?)$/);if(!i)return{type:"text"};const s=i[1];return s.startsWith("on")&&s.length>2?{type:"event",attrName:s}:{type:"attr",attrName:s}}class d{constructor(t,n){this.container=t,this.rawValue=n,this.node=null,this.h=null}mount(){const n=document.createTextNode("");if(this.p?this.container.insertBefore(n,this.p):this.container.appendChild(n),this.node=n,c(this.rawValue)){const t=this.rawValue;this.h=e(()=>{this.node.textContent=null!=t.value?String(t.value):""})}else this.rawValue instanceof t?this.node.textContent=r(this.rawValue):this.node.textContent=null!=this.rawValue?String(this.rawValue):""}destroy(){this.h?.(),this.node?.remove()}}class u{constructor(t,n,e){this.element=t,this.attrName=n,this.rawValue=e,this.h=null}mount(){if(c(this.rawValue)){const t=this.rawValue;this.h=e(()=>{const n=t.value;null==n||!1===n?this.element.removeAttribute(this.attrName):this.element.setAttribute(this.attrName,String(n))})}else null!=this.rawValue&&!1!==this.rawValue&&this.element.setAttribute(this.attrName,String(this.rawValue))}destroy(){this.h?.()}}class h{constructor(t,n,e){this.element=t,this.eventName=n.slice(2).toLowerCase(),this.handler=e,this.m=null}mount(){"function"==typeof this.handler&&(this.m=t=>this.handler(t),this.element.addEventListener(this.eventName,this.m))}destroy(){this.m&&(this.element.removeEventListener(this.eventName,this.m),this.m=null)}}class f{constructor(){this.parts=[],this.fragment=null}destroy(){for(const t of this.parts)t.destroy();this.parts.length=0}}function p(n,e){const o=new f,i=function(n){const e=[];for(let o=0;o<n.strings.length;o++)if(e.push(n.strings[o]),o<n.values.length){const i=n.values[o];i instanceof t?e.push(r(i)):Array.isArray(i)&&i.length>0&&i[0]instanceof t?e.push(i.map(r).join("")):"function"==typeof i||c(i)?e.push(l(o)):e.push(s(i??""))}return e.join("")}(n),a=function(t){const n=document.createElement("template");return n.innerHTML=t,n.content}(i);o.fragment=a,g(a,n.values,i,o);for(const t of o.parts)t.mount();return e.appendChild(a),o}function g(t,n,e,o){const i=[...t.childNodes];for(const s of i)3===s.nodeType?y(s,n,e,o,t):1===s.nodeType&&m(s,n,e,o)}function y(t,n,e,o,i){const s=t.textContent||"";for(let c=0;c<n.length;c++){const r=l(c),u=s.indexOf(r);if(-1===u)continue;if("text"!==a(e,r).type)continue;const h=s.substring(0,u),f=s.substring(u+r.length);h&&i.insertBefore(document.createTextNode(h),t);const p=new d(i,n[c]);o.parts.push(p);let g=t;return f&&(g=document.createTextNode(f),i.insertBefore(g,t)),i.removeChild(t),p.p=g!==t?g:null,void(f&&y(g,n,e,o,i))}}function m(t,n,e,o){const i=[...t.attributes];for(const s of i)for(let i=0;i<n.length;i++){const c=l(i);if(!s.value.includes(c))continue;const r=a(e,c);if("event"===r.type&&r.attrName===s.name){t.removeAttribute(s.name);const e=new h(t,s.name,n[i]);o.parts.push(e)}else if("attr"===r.type&&r.attrName===s.name){const e=s.value.replace(c,"");e?t.setAttribute(s.name,e):t.removeAttribute(s.name);const l=new u(t,s.name,n[i]);o.parts.push(l)}}g(t,n,e,o)}const v={"en-US":{"modal.close":"Close","dialog.ok":"OK","dialog.cancel":"Cancel","table.empty":"No data","pagination.page":"Page","pagination.of":"of","select.placeholder":"Select...","datepicker.placeholder":"Select date","timepicker.placeholder":"Select time","fileupload.drag":"Drag files here or","fileupload.browse":"Browse","empty.text":"No data","datepicker.months":"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec","datepicker.weekdays":"Mo,Tu,We,Th,Fr,Sa,Su","timepicker.placeholder":"Select time"},"zh-CN":{"modal.close":"关闭","dialog.ok":"确定","dialog.cancel":"取消","table.empty":"暂无数据","pagination.page":"页","pagination.of":"/","select.placeholder":"请选择","datepicker.placeholder":"选择日期","datepicker.months":"1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月","datepicker.weekdays":"一,二,三,四,五,六,日","timepicker.placeholder":"选择时间","fileupload.drag":"拖拽文件到此处或","fileupload.browse":"浏览","empty.text":"暂无数据"}};function x(t,n={}){let e=(v["en-US"]||v["en-US"])[t]||t;for(const[t,o]of Object.entries(n))e=e.replace(`{${t}}`,o);return e}const w={success:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg>',warning:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>',error:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',info:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',normal:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>'};function k(t={}){const{title:e="",content:o="",type:i="normal",confirmText:s=null,cancelText:c=null,showCancel:l=!0}=t,r=s||x("dialog.ok"),a=c||x("dialog.cancel");return new Promise(t=>{const s=()=>{k(),t(!0)},c=()=>{k(),t(!1)},d=t=>{t.target===t.currentTarget&&c()},u=t=>{"Escape"===t.key&&c(),"Enter"===t.key&&s()},h=n`
|
|
2
2
|
<div class="ds-modal-mask">
|
|
3
|
-
<div class="ds-dialog">
|
|
4
|
-
<div class="ds-dialog__icon ds-dialog__icon--${
|
|
5
|
-
<div class="ds-dialog__title">${
|
|
6
|
-
<div class="ds-dialog__content">${
|
|
3
|
+
<div class="ds-dialog" role="alertdialog" aria-modal="true" aria-labelledby="dialog-title" aria-describedby="dialog-content" tabindex="-1">
|
|
4
|
+
<div class="ds-dialog__icon ds-dialog__icon--${i}">${w[i]||w.normal}</div>
|
|
5
|
+
<div class="ds-dialog__title" id="dialog-title">${e}</div>
|
|
6
|
+
<div class="ds-dialog__content" id="dialog-content">${o}</div>
|
|
7
7
|
<div class="ds-dialog__actions">
|
|
8
|
-
${
|
|
9
|
-
<button class="ds-btn ds-btn--primary" data-action="confirm">${
|
|
8
|
+
${l?n`<button class="ds-btn ds-btn--ghost" data-action="cancel" type="button">${a}</button>`:""}
|
|
9
|
+
<button class="ds-btn ds-btn--primary" data-action="confirm" type="button">${r}</button>
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
13
|
-
`,
|
|
13
|
+
`,f=document.createDocumentFragment(),g=p(h,f);document.body.appendChild(f);const y=document.body.querySelector(".ds-modal-mask:last-of-type")||document.body.lastElementChild;y&&y.classList.add("is-visible"),document.body.style.overflow="hidden";const m=y?.querySelector(".ds-dialog");m&&m.focus();const v=y.querySelector('[data-action="confirm"]'),x=y.querySelector('[data-action="cancel"]');function k(){document.removeEventListener("keydown",u),document.body.style.overflow="",y&&y.classList.remove("is-visible"),setTimeout(()=>{g.destroy(),y&&y.parentNode&&y.parentNode.removeChild(y)},50)}v&&v.addEventListener("click",s),x&&x.addEventListener("click",c),y&&y.addEventListener("click",d),document.addEventListener("keydown",u)})}const b={confirm:k,alert:function(t={}){return k({...t,showCancel:!1}).then(()=>{})}};export{b as Dialog};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";class t{constructor(t,n){this.strings=t,this.values=n}}function n(n,...s){return new t(n,s)}function s(t){const n={t:t,i:new Set,o:null,u:!1};return n.o=()=>{n.u||i(n)},i(n),()=>function(t){if(t.u)return;t.u=!0,e(t)}(n)}function i(t){e(t);try{t.t()}finally{}}function e(t){for(const n of t.i)n.l.delete(t);t.i.clear()}function o(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function r(t){if(null==t||"object"!=typeof t)return!1;const n=Object.getOwnPropertyDescriptor(t,"value");if(n&&"function"==typeof n.get)return!0;const s=Object.getPrototypeOf(t);if(s){const t=Object.getOwnPropertyDescriptor(s,"value");if(t&&"function"==typeof t.get)return!0}return!1}const c=t=>`${t}`;function u(n){const s=[];for(let i=0;i<n.strings.length;i++)if(s.push(n.strings[i]),i<n.values.length){const e=n.values[i];e instanceof t?s.push(u(e)):Array.isArray(e)&&e.length>0&&e[0]instanceof t?s.push(e.map(u).join("")):r(e)?s.push(o(e.value)):"function"!=typeof e&&s.push(o(e??""))}return s.join("")}function l(t,n){const s=t.indexOf(n);if(-1===s)return{type:"text"};const i=t.substring(0,s).lastIndexOf("<");if(-1===i)return{type:"text"};if(t.substring(i,s).includes(">"))return{type:"text"};const e=t.substring(i+1,s).match(/([\w\-@:.]+)\s*=\s*(?:"[^"]*|'[^']*|[^\s>]*?)$/);if(!e)return{type:"text"};const o=e[1];return o.startsWith("on")&&o.length>2?{type:"event",attrName:o}:{type:"attr",attrName:o}}class f{constructor(t,n){this.container=t,this.rawValue=n,this.node=null,this.h=null}mount(){const n=document.createTextNode("");if(this.p?this.container.insertBefore(n,this.p):this.container.appendChild(n),this.node=n,r(this.rawValue)){const t=this.rawValue;this.h=s(()=>{this.node.textContent=null!=t.value?String(t.value):""})}else this.rawValue instanceof t?this.node.textContent=u(this.rawValue):this.node.textContent=null!=this.rawValue?String(this.rawValue):""}destroy(){this.h?.(),this.node?.remove()}}class h{constructor(t,n,s){this.element=t,this.attrName=n,this.rawValue=s,this.h=null}mount(){if(r(this.rawValue)){const t=this.rawValue;this.h=s(()=>{const n=t.value;null==n||!1===n?this.element.removeAttribute(this.attrName):this.element.setAttribute(this.attrName,String(n))})}else null!=this.rawValue&&!1!==this.rawValue&&this.element.setAttribute(this.attrName,String(this.rawValue))}destroy(){this.h?.()}}class d{constructor(t,n,s){this.element=t,this.eventName=n.slice(2).toLowerCase(),this.handler=s,this.m=null}mount(){"function"==typeof this.handler&&(this.m=t=>this.handler(t),this.element.addEventListener(this.eventName,this.m))}destroy(){this.m&&(this.element.removeEventListener(this.eventName,this.m),this.m=null)}}class a{constructor(){this.parts=[],this.fragment=null}destroy(){for(const t of this.parts)t.destroy();this.parts.length=0}}function y(n,s){const i=new a,e=function(n){const s=[];for(let i=0;i<n.strings.length;i++)if(s.push(n.strings[i]),i<n.values.length){const e=n.values[i];e instanceof t?s.push(u(e)):Array.isArray(e)&&e.length>0&&e[0]instanceof t?s.push(e.map(u).join("")):"function"==typeof e||r(e)?s.push(c(i)):s.push(o(e??""))}return s.join("")}(n),l=function(t){const n=document.createElement("template");return n.innerHTML=t,n.content}(e);i.fragment=l,w(l,n.values,e,i);for(const t of i.parts)t.mount();return s.appendChild(l),i}function w(t,n,s,i){const e=[...t.childNodes];for(const o of e)3===o.nodeType?p(o,n,s,i,t):1===o.nodeType&&m(o,n,s,i)}function p(t,n,s,i,e){const o=t.textContent||"";for(let r=0;r<n.length;r++){const u=c(r),h=o.indexOf(u);if(-1===h)continue;if("text"!==l(s,u).type)continue;const d=o.substring(0,h),a=o.substring(h+u.length);d&&e.insertBefore(document.createTextNode(d),t);const y=new f(e,n[r]);i.parts.push(y);let w=t;return a&&(w=document.createTextNode(a),e.insertBefore(w,t)),e.removeChild(t),y.p=w!==t?w:null,void(a&&p(w,n,s,i,e))}}function m(t,n,s,i){const e=[...t.attributes];for(const o of e)for(let e=0;e<n.length;e++){const r=c(e);if(!o.value.includes(r))continue;const u=l(s,r);if("event"===u.type&&u.attrName===o.name){t.removeAttribute(o.name);const s=new d(t,o.name,n[e]);i.parts.push(s)}else if("attr"===u.type&&u.attrName===o.name){const s=o.value.replace(r,"");s?t.setAttribute(o.name,s):t.removeAttribute(o.name);const c=new h(t,o.name,n[e]);i.parts.push(c)}}w(t,n,s,i)}exports.Drawer=function(t={},s=null){const{title:i="",placement:e="left",width:o="",closableOnMask:r=!0,escClose:c=!0}=t;let u=!1;function l(){u||(u=!0,p&&p.classList.add("is-visible"),m&&m.classList.add("is-visible"),document.body.style.overflow="hidden",m&&m.focus())}function f(){u&&(u=!1,p&&p.classList.remove("is-visible"),m&&m.classList.remove("is-visible"),document.body.style.overflow="")}const h=t=>{c&&"Escape"===t.key&&u&&f()};document.addEventListener("keydown",h);const d=n`
|
|
2
|
+
<div class="ds-drawer-mask" onclick="${t=>{r&&t.target===t.currentTarget&&f()}}">
|
|
3
|
+
<div class="${"right"===e?"ds-drawer ds-drawer--right":"ds-drawer"}" style="${o?`width: ${o}`:""}" role="dialog" aria-modal="true" aria-labelledby="drawer-title" tabindex="-1">
|
|
4
|
+
<div class="ds-drawer__header">
|
|
5
|
+
<span class="ds-drawer__title" id="drawer-title">${i}</span>
|
|
6
|
+
<button class="ds-drawer__close" onclick="${f}" aria-label="Close" type="button">
|
|
7
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
8
|
+
<path d="M18 6L6 18M6 6l12 12"/>
|
|
9
|
+
</svg>
|
|
10
|
+
</button>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="ds-drawer__body">${s}</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
`,a=document.createDocumentFragment(),w=y(d,a),p=a.querySelector(".ds-drawer-mask"),m=a.querySelector(".ds-drawer");return{get element(){return a},open:l,close:f,toggle:function(){u?f():l()},destroy(){document.removeEventListener("keydown",h),document.body.style.overflow="",w.destroy()}}};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
class t{constructor(t,n){this.strings=t,this.values=n}}function n(n,...s){return new t(n,s)}function s(t){const n={t:t,i:new Set,o:null,u:!1};return n.o=()=>{n.u||i(n)},i(n),()=>function(t){if(t.u)return;t.u=!0,
|
|
2
|
-
<div class="ds-drawer-mask" onclick="${t=>{
|
|
3
|
-
<div class="${"right"===
|
|
1
|
+
class t{constructor(t,n){this.strings=t,this.values=n}}function n(n,...s){return new t(n,s)}function s(t){const n={t:t,i:new Set,o:null,u:!1};return n.o=()=>{n.u||i(n)},i(n),()=>function(t){if(t.u)return;t.u=!0,e(t)}(n)}function i(t){e(t);try{t.t()}finally{}}function e(t){for(const n of t.i)n.l.delete(t);t.i.clear()}function o(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function r(t){if(null==t||"object"!=typeof t)return!1;const n=Object.getOwnPropertyDescriptor(t,"value");if(n&&"function"==typeof n.get)return!0;const s=Object.getPrototypeOf(t);if(s){const t=Object.getOwnPropertyDescriptor(s,"value");if(t&&"function"==typeof t.get)return!0}return!1}const c=t=>`${t}`;function u(n){const s=[];for(let i=0;i<n.strings.length;i++)if(s.push(n.strings[i]),i<n.values.length){const e=n.values[i];e instanceof t?s.push(u(e)):Array.isArray(e)&&e.length>0&&e[0]instanceof t?s.push(e.map(u).join("")):r(e)?s.push(o(e.value)):"function"!=typeof e&&s.push(o(e??""))}return s.join("")}function l(t,n){const s=t.indexOf(n);if(-1===s)return{type:"text"};const i=t.substring(0,s).lastIndexOf("<");if(-1===i)return{type:"text"};if(t.substring(i,s).includes(">"))return{type:"text"};const e=t.substring(i+1,s).match(/([\w\-@:.]+)\s*=\s*(?:"[^"]*|'[^']*|[^\s>]*?)$/);if(!e)return{type:"text"};const o=e[1];return o.startsWith("on")&&o.length>2?{type:"event",attrName:o}:{type:"attr",attrName:o}}class f{constructor(t,n){this.container=t,this.rawValue=n,this.node=null,this.h=null}mount(){const n=document.createTextNode("");if(this.p?this.container.insertBefore(n,this.p):this.container.appendChild(n),this.node=n,r(this.rawValue)){const t=this.rawValue;this.h=s(()=>{this.node.textContent=null!=t.value?String(t.value):""})}else this.rawValue instanceof t?this.node.textContent=u(this.rawValue):this.node.textContent=null!=this.rawValue?String(this.rawValue):""}destroy(){this.h?.(),this.node?.remove()}}class h{constructor(t,n,s){this.element=t,this.attrName=n,this.rawValue=s,this.h=null}mount(){if(r(this.rawValue)){const t=this.rawValue;this.h=s(()=>{const n=t.value;null==n||!1===n?this.element.removeAttribute(this.attrName):this.element.setAttribute(this.attrName,String(n))})}else null!=this.rawValue&&!1!==this.rawValue&&this.element.setAttribute(this.attrName,String(this.rawValue))}destroy(){this.h?.()}}class d{constructor(t,n,s){this.element=t,this.eventName=n.slice(2).toLowerCase(),this.handler=s,this.m=null}mount(){"function"==typeof this.handler&&(this.m=t=>this.handler(t),this.element.addEventListener(this.eventName,this.m))}destroy(){this.m&&(this.element.removeEventListener(this.eventName,this.m),this.m=null)}}class a{constructor(){this.parts=[],this.fragment=null}destroy(){for(const t of this.parts)t.destroy();this.parts.length=0}}function y(n,s){const i=new a,e=function(n){const s=[];for(let i=0;i<n.strings.length;i++)if(s.push(n.strings[i]),i<n.values.length){const e=n.values[i];e instanceof t?s.push(u(e)):Array.isArray(e)&&e.length>0&&e[0]instanceof t?s.push(e.map(u).join("")):"function"==typeof e||r(e)?s.push(c(i)):s.push(o(e??""))}return s.join("")}(n),l=function(t){const n=document.createElement("template");return n.innerHTML=t,n.content}(e);i.fragment=l,w(l,n.values,e,i);for(const t of i.parts)t.mount();return s.appendChild(l),i}function w(t,n,s,i){const e=[...t.childNodes];for(const o of e)3===o.nodeType?p(o,n,s,i,t):1===o.nodeType&&m(o,n,s,i)}function p(t,n,s,i,e){const o=t.textContent||"";for(let r=0;r<n.length;r++){const u=c(r),h=o.indexOf(u);if(-1===h)continue;if("text"!==l(s,u).type)continue;const d=o.substring(0,h),a=o.substring(h+u.length);d&&e.insertBefore(document.createTextNode(d),t);const y=new f(e,n[r]);i.parts.push(y);let w=t;return a&&(w=document.createTextNode(a),e.insertBefore(w,t)),e.removeChild(t),y.p=w!==t?w:null,void(a&&p(w,n,s,i,e))}}function m(t,n,s,i){const e=[...t.attributes];for(const o of e)for(let e=0;e<n.length;e++){const r=c(e);if(!o.value.includes(r))continue;const u=l(s,r);if("event"===u.type&&u.attrName===o.name){t.removeAttribute(o.name);const s=new d(t,o.name,n[e]);i.parts.push(s)}else if("attr"===u.type&&u.attrName===o.name){const s=o.value.replace(r,"");s?t.setAttribute(o.name,s):t.removeAttribute(o.name);const c=new h(t,o.name,n[e]);i.parts.push(c)}}w(t,n,s,i)}function v(t={},s=null){const{title:i="",placement:e="left",width:o="",closableOnMask:r=!0,escClose:c=!0}=t;let u=!1;function l(){u||(u=!0,p&&p.classList.add("is-visible"),m&&m.classList.add("is-visible"),document.body.style.overflow="hidden",m&&m.focus())}function f(){u&&(u=!1,p&&p.classList.remove("is-visible"),m&&m.classList.remove("is-visible"),document.body.style.overflow="")}const h=t=>{c&&"Escape"===t.key&&u&&f()};document.addEventListener("keydown",h);const d=n`
|
|
2
|
+
<div class="ds-drawer-mask" onclick="${t=>{r&&t.target===t.currentTarget&&f()}}">
|
|
3
|
+
<div class="${"right"===e?"ds-drawer ds-drawer--right":"ds-drawer"}" style="${o?`width: ${o}`:""}" role="dialog" aria-modal="true" aria-labelledby="drawer-title" tabindex="-1">
|
|
4
4
|
<div class="ds-drawer__header">
|
|
5
|
-
<span class="ds-drawer__title">${i}</span>
|
|
6
|
-
<button class="ds-drawer__close" onclick="${f}" aria-label="Close">
|
|
5
|
+
<span class="ds-drawer__title" id="drawer-title">${i}</span>
|
|
6
|
+
<button class="ds-drawer__close" onclick="${f}" aria-label="Close" type="button">
|
|
7
7
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
8
8
|
<path d="M18 6L6 18M6 6l12 12"/>
|
|
9
9
|
</svg>
|