@0001-labs/design-system-1 0.0.0-stage → 0.3.0-alpha.13
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/DS1/0-face/control.ts +99 -0
- package/DS1/0-face/define.ts +5 -0
- package/DS1/0-face/device.ts +414 -0
- package/DS1/0-face/grid-fit.ts +63 -0
- package/DS1/0-face/grid.ts +144 -0
- package/DS1/0-face/i18n.ts +1023 -0
- package/DS1/0-face/language-routing.ts +135 -0
- package/DS1/0-face/language-validator.ts +46 -0
- package/DS1/0-face/languages.ts +242 -0
- package/DS1/0-face/layout-inspector.ts +184 -0
- package/DS1/0-face/preferences.ts +39 -0
- package/DS1/0-face/pricing.ts +57 -0
- package/DS1/0-face/scaling.ts +25 -0
- package/DS1/0-face/shared-words.ts +45 -0
- package/DS1/0-face/theme.ts +58 -0
- package/DS1/0-face/tooltips.ts +82 -0
- package/DS1/0-face/translations/da.json +63 -0
- package/DS1/0-face/translations/de.json +63 -0
- package/DS1/0-face/translations/en.json +63 -0
- package/DS1/0-face/translations/es.json +63 -0
- package/DS1/0-face/translations/fi.json +63 -0
- package/DS1/0-face/translations/fr.json +63 -0
- package/DS1/0-face/translations/is.json +56 -0
- package/DS1/0-face/translations/it.json +63 -0
- package/DS1/0-face/translations/ja.json +63 -0
- package/DS1/0-face/translations/ko.json +63 -0
- package/DS1/0-face/translations/nb.json +63 -0
- package/DS1/0-face/translations/pt-BR.json +63 -0
- package/DS1/0-face/translations/pt.json +63 -0
- package/DS1/0-face/translations/sv.json +63 -0
- package/DS1/0-face/translations/zh.json +63 -0
- package/DS1/0-face/translations-format.ts +216 -0
- package/DS1/1-root/component-appearance.css +32 -0
- package/DS1/1-root/component-metrics.css +21 -0
- package/DS1/1-root/component-tokens.css +90 -0
- package/DS1/1-root/controls.css +261 -0
- package/DS1/1-root/fonts/GT-America-Compressed-Regular.woff2 +0 -0
- package/DS1/1-root/fonts/GT-America-Standard-Medium.woff2 +0 -0
- package/DS1/1-root/fonts/GT-America-Standard-Regular.woff2 +0 -0
- package/DS1/1-root/fonts/GT-Canon-M-Standard-Medium-Trial.woff2 +0 -0
- package/DS1/1-root/fonts/Inter-Arrows.woff2 +0 -0
- package/DS1/1-root/fonts/Inter-LICENSE.md +7 -0
- package/DS1/1-root/fonts/Iosevka-LICENSE.md +7 -0
- package/DS1/1-root/fonts/Iosevka-Regular.woff2 +0 -0
- package/DS1/1-root/grid.css +31 -0
- package/DS1/1-root/one.css +602 -0
- package/DS1/1-root/one.semantic.css +683 -0
- package/DS1/1-root/palette.ts +91 -0
- package/DS1/2-core/ds-avatar.ts +130 -0
- package/DS1/2-core/ds-badge.ts +77 -0
- package/DS1/2-core/ds-banner.ts +122 -0
- package/DS1/2-core/ds-button.ts +163 -0
- package/DS1/2-core/ds-card.ts +137 -0
- package/DS1/2-core/ds-checkbox.ts +14 -0
- package/DS1/2-core/ds-color.ts +32 -0
- package/DS1/2-core/ds-composer.ts +182 -0
- package/DS1/2-core/ds-cycle.ts +628 -0
- package/DS1/2-core/ds-date.ts +24 -0
- package/DS1/2-core/ds-file-picker.ts +83 -0
- package/DS1/2-core/ds-gap.ts +34 -0
- package/DS1/2-core/ds-icon.ts +161 -0
- package/DS1/2-core/ds-input.ts +518 -0
- package/DS1/2-core/ds-language.ts +94 -0
- package/DS1/2-core/ds-pagedots.ts +52 -0
- package/DS1/2-core/ds-radio.ts +25 -0
- package/DS1/2-core/ds-select.ts +44 -0
- package/DS1/2-core/ds-split.ts +122 -0
- package/DS1/2-core/ds-swatch.ts +20 -0
- package/DS1/2-core/ds-switch.ts +13 -0
- package/DS1/2-core/ds-text.ts +190 -0
- package/DS1/2-core/ds-textarea.ts +136 -0
- package/DS1/2-core/ds-token.ts +40 -0
- package/DS1/2-core/ds-tooltip.ts +115 -0
- package/DS1/2-core/generated/ds-icon-map.ts +583 -0
- package/DS1/2-core/generated/icons-extra.ts +243 -0
- package/DS1/2-core/generated/icons-immediate.ts +49 -0
- package/DS1/2-core/styles/ds-avatar.css +125 -0
- package/DS1/2-core/styles/ds-badge.css +26 -0
- package/DS1/2-core/styles/ds-banner.css +77 -0
- package/DS1/2-core/styles/ds-button-host.css +214 -0
- package/DS1/2-core/styles/ds-button.css +131 -0
- package/DS1/2-core/styles/ds-checkbox.css +48 -0
- package/DS1/2-core/styles/ds-color.css +24 -0
- package/DS1/2-core/styles/ds-composer-frame.css +11 -0
- package/DS1/2-core/styles/ds-composer.css +55 -0
- package/DS1/2-core/styles/ds-cycle.css +18 -0
- package/DS1/2-core/styles/ds-date.css +9 -0
- package/DS1/2-core/styles/ds-file-picker.css +66 -0
- package/DS1/2-core/styles/ds-gap.css +71 -0
- package/DS1/2-core/styles/ds-icon.css +44 -0
- package/DS1/2-core/styles/ds-input.css +233 -0
- package/DS1/2-core/styles/ds-language.css +78 -0
- package/DS1/2-core/styles/ds-pagedots.css +31 -0
- package/DS1/2-core/styles/ds-radio.css +83 -0
- package/DS1/2-core/styles/ds-select.css +95 -0
- package/DS1/2-core/styles/ds-split.css +62 -0
- package/DS1/2-core/styles/ds-switch.css +50 -0
- package/DS1/2-core/styles/ds-text.css +87 -0
- package/DS1/2-core/styles/ds-textarea.css +27 -0
- package/DS1/2-core/styles/ds-token.css +9 -0
- package/DS1/2-core/styles/ds-tooltip.css +37 -0
- package/DS1/3-unit/context-trigger.ts +104 -0
- package/DS1/3-unit/ds-accordion.ts +120 -0
- package/DS1/3-unit/ds-avatar-group.ts +99 -0
- package/DS1/3-unit/ds-form.ts +304 -0
- package/DS1/3-unit/ds-list.ts +36 -0
- package/DS1/3-unit/ds-menu.ts +482 -0
- package/DS1/3-unit/ds-row.ts +48 -0
- package/DS1/3-unit/ds-table.ts +68 -0
- package/DS1/3-unit/ds-tabs.ts +77 -0
- package/DS1/3-unit/ds-token-field.ts +127 -0
- package/DS1/3-unit/styles/context-trigger.css +6 -0
- package/DS1/3-unit/styles/ds-accordion.css +64 -0
- package/DS1/3-unit/styles/ds-avatar-group.css +51 -0
- package/DS1/3-unit/styles/ds-list.css +26 -0
- package/DS1/3-unit/styles/ds-menu.css +97 -0
- package/DS1/3-unit/styles/ds-row.css +37 -0
- package/DS1/3-unit/styles/ds-table.css +80 -0
- package/DS1/3-unit/styles/ds-tabs.css +44 -0
- package/DS1/3-unit/styles/ds-token-field.css +11 -0
- package/DS1/4-page/ds-container.ts +28 -0
- package/DS1/4-page/ds-dialog.ts +331 -0
- package/DS1/4-page/ds-grid.ts +74 -0
- package/DS1/4-page/ds-layout.ts +949 -0
- package/DS1/4-page/ds-panel.ts +38 -0
- package/DS1/4-page/email.ts +170 -0
- package/DS1/4-page/styles/ds-container.css +35 -0
- package/DS1/4-page/styles/ds-dialog.css +94 -0
- package/DS1/4-page/styles/ds-grid.css +95 -0
- package/DS1/4-page/styles/ds-layout.css +246 -0
- package/DS1/4-page/styles/ds-panel.css +31 -0
- package/DS1/components.ts +13 -0
- package/DS1/index.ts +86 -0
- package/DS1/react/accordion.ts +33 -0
- package/DS1/react/avatar-group.ts +11 -0
- package/DS1/react/avatar.ts +42 -0
- package/DS1/react/badge.ts +7 -0
- package/DS1/react/button.ts +63 -0
- package/DS1/react/choice.ts +64 -0
- package/DS1/react/composer.ts +18 -0
- package/DS1/react/context-menu.ts +167 -0
- package/DS1/react/dialog.ts +102 -0
- package/DS1/react/file-picker.ts +34 -0
- package/DS1/react/input.ts +184 -0
- package/DS1/react/menu.ts +28 -0
- package/DS1/react/split.ts +42 -0
- package/DS1/react/token-field.ts +32 -0
- package/DS1/vite-env.d.ts +13 -0
- package/DS1/x-icon/1x.svg +4 -0
- package/DS1/x-icon/1xdots.svg +11 -0
- package/DS1/x-icon/1xgrid.svg +8 -0
- package/DS1/x-icon/1xlines.svg +5 -0
- package/DS1/x-icon/2x.svg +4 -0
- package/DS1/x-icon/2xdots.svg +18 -0
- package/DS1/x-icon/2xgrid-alt-2.svg +9 -0
- package/DS1/x-icon/2xgrid-alt-3.svg +8 -0
- package/DS1/x-icon/2xgrid-alt.svg +15 -0
- package/DS1/x-icon/2xgrid.svg +6 -0
- package/DS1/x-icon/2xlines.svg +6 -0
- package/DS1/x-icon/4x4.svg +18 -0
- package/DS1/x-icon/app.svg +4 -0
- package/DS1/x-icon/apple.svg +3 -0
- package/DS1/x-icon/archive-alt.svg +4 -0
- package/DS1/x-icon/archive.svg +4 -0
- package/DS1/x-icon/arrange-archive.svg +1 -0
- package/DS1/x-icon/arrange-check.svg +1 -0
- package/DS1/x-icon/arrange-chevron.svg +1 -0
- package/DS1/x-icon/arrange-connect.svg +1 -0
- package/DS1/x-icon/arrange-draft.svg +1 -0
- package/DS1/x-icon/arrange-dropdown.svg +1 -0
- package/DS1/x-icon/arrange-home.svg +1 -0
- package/DS1/x-icon/arrange-link.svg +1 -0
- package/DS1/x-icon/arrange-menu.svg +1 -0
- package/DS1/x-icon/arrange-more.svg +1 -0
- package/DS1/x-icon/arrange-page.svg +1 -0
- package/DS1/x-icon/arrange-plus.svg +1 -0
- package/DS1/x-icon/arrange-site.svg +1 -0
- package/DS1/x-icon/avatar.svg +4 -0
- package/DS1/x-icon/badge-bands-3d.svg +1 -0
- package/DS1/x-icon/badge-bands.svg +1 -0
- package/DS1/x-icon/badge-blue-fan-3d.svg +1 -0
- package/DS1/x-icon/badge-blue-fan.svg +1 -0
- package/DS1/x-icon/badge-bricks-3d.svg +1 -0
- package/DS1/x-icon/badge-bricks.svg +1 -0
- package/DS1/x-icon/badge-broken-stripes-3d.svg +1 -0
- package/DS1/x-icon/badge-broken-stripes.svg +1 -0
- package/DS1/x-icon/badge-checker-3d.svg +1 -0
- package/DS1/x-icon/badge-checker.svg +1 -0
- package/DS1/x-icon/badge-diamond-3d.svg +1 -0
- package/DS1/x-icon/badge-diamond.svg +1 -0
- package/DS1/x-icon/badge-fan-3d.svg +1 -0
- package/DS1/x-icon/badge-fan-dark-3d.svg +1 -0
- package/DS1/x-icon/badge-fan-dark.svg +1 -0
- package/DS1/x-icon/badge-fan.svg +1 -0
- package/DS1/x-icon/badge-halves-3d.svg +1 -0
- package/DS1/x-icon/badge-halves-green-3d.svg +1 -0
- package/DS1/x-icon/badge-halves-green.svg +1 -0
- package/DS1/x-icon/badge-halves.svg +1 -0
- package/DS1/x-icon/badge-red-3d.svg +1 -0
- package/DS1/x-icon/badge-red-blue-bricks-3d.svg +1 -0
- package/DS1/x-icon/badge-red-blue-bricks.svg +1 -0
- package/DS1/x-icon/badge-red.svg +1 -0
- package/DS1/x-icon/badge-round-fan-3d.svg +1 -0
- package/DS1/x-icon/badge-round-fan.svg +1 -0
- package/DS1/x-icon/badge-shard-3d.svg +1 -0
- package/DS1/x-icon/badge-shard.svg +1 -0
- package/DS1/x-icon/badge-split-circle-3d.svg +1 -0
- package/DS1/x-icon/badge-split-circle.svg +1 -0
- package/DS1/x-icon/badge-tall-bricks-3d.svg +1 -0
- package/DS1/x-icon/badge-tall-bricks.svg +1 -0
- package/DS1/x-icon/badge-weave-3d.svg +1 -0
- package/DS1/x-icon/badge-weave.svg +1 -0
- package/DS1/x-icon/bag.svg +4 -0
- package/DS1/x-icon/block-accordion.svg +1 -0
- package/DS1/x-icon/block-banner.svg +1 -0
- package/DS1/x-icon/block-breadcrumbs.svg +1 -0
- package/DS1/x-icon/block-button.svg +1 -0
- package/DS1/x-icon/block-divider.svg +1 -0
- package/DS1/x-icon/block-forms.svg +1 -0
- package/DS1/x-icon/block-group.svg +1 -0
- package/DS1/x-icon/block-heading.svg +1 -0
- package/DS1/x-icon/block-image.svg +1 -0
- package/DS1/x-icon/block-logo-marquee.svg +1 -0
- package/DS1/x-icon/block-page-progress.svg +1 -0
- package/DS1/x-icon/block-section.svg +1 -0
- package/DS1/x-icon/block-table.svg +1 -0
- package/DS1/x-icon/block-tabs.svg +1 -0
- package/DS1/x-icon/block-text.svg +1 -0
- package/DS1/x-icon/bold.svg +3 -0
- package/DS1/x-icon/bullet.svg +5 -0
- package/DS1/x-icon/calendar.svg +6 -0
- package/DS1/x-icon/callout.svg +5 -0
- package/DS1/x-icon/camera.svg +5 -0
- package/DS1/x-icon/categories.svg +12 -0
- package/DS1/x-icon/check-alt.svg +3 -0
- package/DS1/x-icon/check.svg +3 -0
- package/DS1/x-icon/close.svg +3 -0
- package/DS1/x-icon/code-block.svg +4 -0
- package/DS1/x-icon/code.svg +3 -0
- package/DS1/x-icon/collapse.svg +3 -0
- package/DS1/x-icon/color.svg +4 -0
- package/DS1/x-icon/column.svg +3 -0
- package/DS1/x-icon/comment.svg +3 -0
- package/DS1/x-icon/compose.svg +4 -0
- package/DS1/x-icon/connect.svg +5 -0
- package/DS1/x-icon/content.svg +6 -0
- package/DS1/x-icon/default.svg +4 -0
- package/DS1/x-icon/delete.svg +5 -0
- package/DS1/x-icon/dictate.svg +6 -0
- package/DS1/x-icon/divider.svg +3 -0
- package/DS1/x-icon/down.svg +3 -0
- package/DS1/x-icon/duplicate.svg +8 -0
- package/DS1/x-icon/email.svg +3 -0
- package/DS1/x-icon/equation.svg +3 -0
- package/DS1/x-icon/exercise.svg +3 -0
- package/DS1/x-icon/expand.svg +3 -0
- package/DS1/x-icon/ezo-accordion-chevron.svg +11 -0
- package/DS1/x-icon/ezo-account-close.svg +1 -0
- package/DS1/x-icon/ezo-android-screen-archive.svg +4 -0
- package/DS1/x-icon/ezo-android-screen-calendar.svg +6 -0
- package/DS1/x-icon/ezo-android-screen-camera.svg +5 -0
- package/DS1/x-icon/ezo-android-screen-check.svg +3 -0
- package/DS1/x-icon/ezo-android-screen-compose.svg +4 -0
- package/DS1/x-icon/ezo-android-screen-globe.svg +1 -0
- package/DS1/x-icon/ezo-android-screen-lists.svg +3 -0
- package/DS1/x-icon/ezo-android-screen-shared.svg +5 -0
- package/DS1/x-icon/ezo-android-screen-stats.svg +3 -0
- package/DS1/x-icon/ezo-android-screen-store.svg +4 -0
- package/DS1/x-icon/ezo-android-screen-views.svg +4 -0
- package/DS1/x-icon/ezo-android-screen-work.svg +3 -0
- package/DS1/x-icon/ezo-arrow-cursor.svg +8 -0
- package/DS1/x-icon/ezo-block-accordion.svg +1 -0
- package/DS1/x-icon/ezo-block-divider.svg +1 -0
- package/DS1/x-icon/ezo-block-group.svg +1 -0
- package/DS1/x-icon/ezo-block-image.svg +1 -0
- package/DS1/x-icon/ezo-block-section.svg +1 -0
- package/DS1/x-icon/ezo-block-table.svg +1 -0
- package/DS1/x-icon/ezo-code.svg +14 -0
- package/DS1/x-icon/ezo-down.svg +3 -0
- package/DS1/x-icon/ezo-figma-premium-star.svg +5 -0
- package/DS1/x-icon/ezo-item-button-complete.svg +4 -0
- package/DS1/x-icon/ezo-item-button-header.svg +3 -0
- package/DS1/x-icon/ezo-item-button-open.svg +3 -0
- package/DS1/x-icon/ezo-item-button-reopen.svg +3 -0
- package/DS1/x-icon/ezo-item-button-star.svg +3 -0
- package/DS1/x-icon/ezo-item-button-start.svg +3 -0
- package/DS1/x-icon/ezo-item-button-unheader.svg +7 -0
- package/DS1/x-icon/ezo-item-button-unstar.svg +5 -0
- package/DS1/x-icon/ezo-item-star.svg +5 -0
- package/DS1/x-icon/ezo-left.svg +3 -0
- package/DS1/x-icon/ezo-logo.svg +1 -0
- package/DS1/x-icon/ezo-mic.svg +8 -0
- package/DS1/x-icon/ezo-move-column.svg +14 -0
- package/DS1/x-icon/ezo-move-row.svg +18 -0
- package/DS1/x-icon/ezo-navigation-check.svg +1 -0
- package/DS1/x-icon/ezo-note-back.svg +5 -0
- package/DS1/x-icon/ezo-note-menu-complete.svg +11 -0
- package/DS1/x-icon/ezo-note-menu-delete.svg +4 -0
- package/DS1/x-icon/ezo-note-menu-duplicate.svg +8 -0
- package/DS1/x-icon/ezo-note-menu-note.svg +5 -0
- package/DS1/x-icon/ezo-note-menu-page.svg +3 -0
- package/DS1/x-icon/ezo-note-menu-star.svg +5 -0
- package/DS1/x-icon/ezo-note-menu-start.svg +6 -0
- package/DS1/x-icon/ezo-note-menu-stop.svg +6 -0
- package/DS1/x-icon/ezo-note-more.svg +7 -0
- package/DS1/x-icon/ezo-note-star.svg +5 -0
- package/DS1/x-icon/ezo-password-visibility-see.svg +6 -0
- package/DS1/x-icon/ezo-password-visibility-unsee.svg +9 -0
- package/DS1/x-icon/ezo-pattern-call-to-action.svg +1 -0
- package/DS1/x-icon/ezo-play.svg +5 -0
- package/DS1/x-icon/ezo-premium-star.svg +5 -0
- package/DS1/x-icon/ezo-setting-1xdots.svg +13 -0
- package/DS1/x-icon/ezo-setting-1xgrid.svg +10 -0
- package/DS1/x-icon/ezo-setting-1xlines.svg +7 -0
- package/DS1/x-icon/ezo-setting-2xdots.svg +8 -0
- package/DS1/x-icon/ezo-setting-2xgrid.svg +8 -0
- package/DS1/x-icon/ezo-setting-2xlines.svg +6 -0
- package/DS1/x-icon/ezo-setting-blank.svg +5 -0
- package/DS1/x-icon/ezo-store-chevron.svg +1 -0
- package/DS1/x-icon/ezo-upgrade-close.svg +5 -0
- package/DS1/x-icon/folder.svg +3 -0
- package/DS1/x-icon/form.svg +5 -0
- package/DS1/x-icon/gallery.svg +3 -0
- package/DS1/x-icon/globe.svg +1 -0
- package/DS1/x-icon/google.svg +6 -0
- package/DS1/x-icon/group-alt-2.svg +3 -0
- package/DS1/x-icon/group-alt.svg +7 -0
- package/DS1/x-icon/group.svg +3 -0
- package/DS1/x-icon/h1.svg +3 -0
- package/DS1/x-icon/h2.svg +3 -0
- package/DS1/x-icon/h3.svg +3 -0
- package/DS1/x-icon/handle.svg +8 -0
- package/DS1/x-icon/head.svg +3 -0
- package/DS1/x-icon/help-alt.svg +3 -0
- package/DS1/x-icon/help.svg +5 -0
- package/DS1/x-icon/home.svg +3 -0
- package/DS1/x-icon/icon.svg +4 -0
- package/DS1/x-icon/image.svg +5 -0
- package/DS1/x-icon/in.svg +4 -0
- package/DS1/x-icon/indent.svg +4 -0
- package/DS1/x-icon/italic.svg +3 -0
- package/DS1/x-icon/item.svg +3 -0
- package/DS1/x-icon/left.svg +4 -0
- package/DS1/x-icon/life.svg +8 -0
- package/DS1/x-icon/link.svg +3 -0
- package/DS1/x-icon/list-line.svg +3 -0
- package/DS1/x-icon/lists.svg +3 -0
- package/DS1/x-icon/lock-filled.svg +3 -0
- package/DS1/x-icon/lock.svg +3 -0
- package/DS1/x-icon/logo-marquee.svg +5 -0
- package/DS1/x-icon/loop.svg +6 -0
- package/DS1/x-icon/mention.svg +4 -0
- package/DS1/x-icon/menu.svg +3 -0
- package/DS1/x-icon/mic.svg +5 -0
- package/DS1/x-icon/minimize-alt.svg +4 -0
- package/DS1/x-icon/minimize.svg +4 -0
- package/DS1/x-icon/money.svg +6 -0
- package/DS1/x-icon/more.svg +5 -0
- package/DS1/x-icon/navigation-check.svg +1 -0
- package/DS1/x-icon/note-alt-2.svg +6 -0
- package/DS1/x-icon/note-alt.svg +4 -0
- package/DS1/x-icon/note-lines.svg +6 -0
- package/DS1/x-icon/note.svg +4 -0
- package/DS1/x-icon/notifications.svg +3 -0
- package/DS1/x-icon/numbered.svg +4 -0
- package/DS1/x-icon/open-alt.svg +3 -0
- package/DS1/x-icon/open-source.svg +3 -0
- package/DS1/x-icon/open.svg +3 -0
- package/DS1/x-icon/outdent.svg +4 -0
- package/DS1/x-icon/pad.svg +8 -0
- package/DS1/x-icon/page-18.svg +3 -0
- package/DS1/x-icon/page-alt.svg +3 -0
- package/DS1/x-icon/page-note.svg +1 -0
- package/DS1/x-icon/page.svg +3 -0
- package/DS1/x-icon/panel.svg +4 -0
- package/DS1/x-icon/pattern-call-to-action.svg +1 -0
- package/DS1/x-icon/pattern-card.svg +1 -0
- package/DS1/x-icon/pattern-feature.svg +1 -0
- package/DS1/x-icon/pattern-hero.svg +1 -0
- package/DS1/x-icon/pen.svg +4 -0
- package/DS1/x-icon/play-alt.svg +3 -0
- package/DS1/x-icon/plus.svg +3 -0
- package/DS1/x-icon/product-sources.json +2557 -0
- package/DS1/x-icon/quote.svg +3 -0
- package/DS1/x-icon/redo.svg +3 -0
- package/DS1/x-icon/relationships.svg +3 -0
- package/DS1/x-icon/rewind-30-alt.svg +4 -0
- package/DS1/x-icon/rewind-30.svg +5 -0
- package/DS1/x-icon/rewind.svg +5 -0
- package/DS1/x-icon/right.svg +3 -0
- package/DS1/x-icon/row.svg +3 -0
- package/DS1/x-icon/school.svg +4 -0
- package/DS1/x-icon/sdown.svg +3 -0
- package/DS1/x-icon/search-30.svg +4 -0
- package/DS1/x-icon/search.svg +3 -0
- package/DS1/x-icon/see-30.svg +4 -0
- package/DS1/x-icon/see.svg +4 -0
- package/DS1/x-icon/settings.svg +8 -0
- package/DS1/x-icon/shared.svg +5 -0
- package/DS1/x-icon/slash.svg +3 -0
- package/DS1/x-icon/star-alt-2.svg +3 -0
- package/DS1/x-icon/star-alt.svg +3 -0
- package/DS1/x-icon/star.svg +3 -0
- package/DS1/x-icon/stats.svg +3 -0
- package/DS1/x-icon/status-alt.svg +11 -0
- package/DS1/x-icon/status-filled.svg +26 -0
- package/DS1/x-icon/status.svg +10 -0
- package/DS1/x-icon/store.svg +4 -0
- package/DS1/x-icon/strike.svg +3 -0
- package/DS1/x-icon/sup.svg +3 -0
- package/DS1/x-icon/table.svg +4 -0
- package/DS1/x-icon/template.svg +4 -0
- package/DS1/x-icon/templates.svg +4 -0
- package/DS1/x-icon/text.svg +3 -0
- package/DS1/x-icon/title.svg +3 -0
- package/DS1/x-icon/titlestyle.svg +11 -0
- package/DS1/x-icon/todo.svg +5 -0
- package/DS1/x-icon/toggle.svg +4 -0
- package/DS1/x-icon/triangle.svg +3 -0
- package/DS1/x-icon/underline.svg +3 -0
- package/DS1/x-icon/undo.svg +3 -0
- package/DS1/x-icon/ungroup.svg +4 -0
- package/DS1/x-icon/unhead.svg +7 -0
- package/DS1/x-icon/unicon.svg +6 -0
- package/DS1/x-icon/unlock.svg +3 -0
- package/DS1/x-icon/unmic.svg +6 -0
- package/DS1/x-icon/unsee.svg +5 -0
- package/DS1/x-icon/unstar.svg +5 -0
- package/DS1/x-icon/untitle.svg +7 -0
- package/DS1/x-icon/up-right.svg +3 -0
- package/DS1/x-icon/up.svg +3 -0
- package/DS1/x-icon/views.svg +4 -0
- package/DS1/x-icon/warning.svg +3 -0
- package/DS1/x-icon/work.svg +3 -0
- package/LICENSE +21 -0
- package/README.md +240 -2
- package/dist/0-face/control.d.ts +24 -0
- package/dist/0-face/control.d.ts.map +1 -0
- package/dist/0-face/control.js +117 -0
- package/dist/0-face/define.d.ts +3 -0
- package/dist/0-face/define.d.ts.map +1 -0
- package/dist/0-face/define.js +7 -0
- package/dist/0-face/device.d.ts +71 -0
- package/dist/0-face/device.d.ts.map +1 -0
- package/dist/0-face/device.js +318 -0
- package/dist/0-face/grid-fit.d.ts +3 -0
- package/dist/0-face/grid-fit.d.ts.map +1 -0
- package/dist/0-face/grid-fit.js +73 -0
- package/dist/0-face/grid.d.ts +3 -0
- package/dist/0-face/grid.d.ts.map +1 -0
- package/dist/0-face/grid.js +144 -0
- package/dist/0-face/i18n.d.ts +138 -0
- package/dist/0-face/i18n.d.ts.map +1 -0
- package/dist/0-face/i18n.js +725 -0
- package/dist/0-face/language-routing.d.ts +47 -0
- package/dist/0-face/language-routing.d.ts.map +1 -0
- package/dist/0-face/language-routing.js +91 -0
- package/dist/0-face/language-validator.d.ts +11 -0
- package/dist/0-face/language-validator.d.ts.map +1 -0
- package/dist/0-face/language-validator.js +31 -0
- package/dist/0-face/languages.d.ts +53 -0
- package/dist/0-face/languages.d.ts.map +1 -0
- package/dist/0-face/languages.js +192 -0
- package/dist/0-face/layout-inspector.d.ts +6 -0
- package/dist/0-face/layout-inspector.d.ts.map +1 -0
- package/dist/0-face/layout-inspector.js +197 -0
- package/dist/0-face/preferences.d.ts +20 -0
- package/dist/0-face/preferences.d.ts.map +1 -0
- package/dist/0-face/preferences.js +19 -0
- package/dist/0-face/pricing.d.ts +15 -0
- package/dist/0-face/pricing.d.ts.map +1 -0
- package/dist/0-face/pricing.js +46 -0
- package/dist/0-face/scaling.d.ts +10 -0
- package/dist/0-face/scaling.d.ts.map +1 -0
- package/dist/0-face/scaling.js +14 -0
- package/dist/0-face/shared-words.d.ts +14 -0
- package/dist/0-face/shared-words.d.ts.map +1 -0
- package/dist/0-face/shared-words.js +32 -0
- package/dist/0-face/theme.d.ts +4 -0
- package/dist/0-face/theme.d.ts.map +1 -0
- package/dist/0-face/theme.js +48 -0
- package/dist/0-face/tooltips.d.ts +8 -0
- package/dist/0-face/tooltips.d.ts.map +1 -0
- package/dist/0-face/tooltips.js +90 -0
- package/dist/0-face/translations/da.json +63 -0
- package/dist/0-face/translations/de.json +63 -0
- package/dist/0-face/translations/en.json +63 -0
- package/dist/0-face/translations/es.json +63 -0
- package/dist/0-face/translations/fi.json +63 -0
- package/dist/0-face/translations/fr.json +63 -0
- package/dist/0-face/translations/is.json +56 -0
- package/dist/0-face/translations/it.json +63 -0
- package/dist/0-face/translations/ja.json +63 -0
- package/dist/0-face/translations/ko.json +63 -0
- package/dist/0-face/translations/nb.json +63 -0
- package/dist/0-face/translations/pt-BR.json +63 -0
- package/dist/0-face/translations/pt.json +63 -0
- package/dist/0-face/translations/sv.json +63 -0
- package/dist/0-face/translations/zh.json +63 -0
- package/dist/0-face/translations-format.d.ts +62 -0
- package/dist/0-face/translations-format.d.ts.map +1 -0
- package/dist/0-face/translations-format.js +159 -0
- package/dist/1-root/palette.d.ts +31 -0
- package/dist/1-root/palette.d.ts.map +1 -0
- package/dist/1-root/palette.js +83 -0
- package/dist/2-core/ds-avatar.d.ts +82 -0
- package/dist/2-core/ds-avatar.d.ts.map +1 -0
- package/dist/2-core/ds-avatar.js +102 -0
- package/dist/2-core/ds-badge.d.ts +33 -0
- package/dist/2-core/ds-badge.d.ts.map +1 -0
- package/dist/2-core/ds-badge.js +77 -0
- package/dist/2-core/ds-banner.d.ts +68 -0
- package/dist/2-core/ds-banner.d.ts.map +1 -0
- package/dist/2-core/ds-banner.js +98 -0
- package/dist/2-core/ds-button.d.ts +102 -0
- package/dist/2-core/ds-button.d.ts.map +1 -0
- package/dist/2-core/ds-button.js +133 -0
- package/dist/2-core/ds-card.d.ts +39 -0
- package/dist/2-core/ds-card.d.ts.map +1 -0
- package/dist/2-core/ds-card.js +119 -0
- package/dist/2-core/ds-checkbox.d.ts +13 -0
- package/dist/2-core/ds-checkbox.d.ts.map +1 -0
- package/dist/2-core/ds-checkbox.js +11 -0
- package/dist/2-core/ds-color.d.ts +15 -0
- package/dist/2-core/ds-color.d.ts.map +1 -0
- package/dist/2-core/ds-color.js +30 -0
- package/dist/2-core/ds-composer.d.ts +69 -0
- package/dist/2-core/ds-composer.d.ts.map +1 -0
- package/dist/2-core/ds-composer.js +183 -0
- package/dist/2-core/ds-cycle.d.ts +85 -0
- package/dist/2-core/ds-cycle.d.ts.map +1 -0
- package/dist/2-core/ds-cycle.js +497 -0
- package/dist/2-core/ds-date.d.ts +16 -0
- package/dist/2-core/ds-date.d.ts.map +1 -0
- package/dist/2-core/ds-date.js +15 -0
- package/dist/2-core/ds-file-picker.d.ts +65 -0
- package/dist/2-core/ds-file-picker.d.ts.map +1 -0
- package/dist/2-core/ds-file-picker.js +80 -0
- package/dist/2-core/ds-gap.d.ts +27 -0
- package/dist/2-core/ds-gap.d.ts.map +1 -0
- package/dist/2-core/ds-gap.js +22 -0
- package/dist/2-core/ds-icon.d.ts +58 -0
- package/dist/2-core/ds-icon.d.ts.map +1 -0
- package/dist/2-core/ds-icon.js +128 -0
- package/dist/2-core/ds-input.d.ts +97 -0
- package/dist/2-core/ds-input.d.ts.map +1 -0
- package/dist/2-core/ds-input.js +429 -0
- package/dist/2-core/ds-language.d.ts +75 -0
- package/dist/2-core/ds-language.d.ts.map +1 -0
- package/dist/2-core/ds-language.js +74 -0
- package/dist/2-core/ds-pagedots.d.ts +32 -0
- package/dist/2-core/ds-pagedots.d.ts.map +1 -0
- package/dist/2-core/ds-pagedots.js +36 -0
- package/dist/2-core/ds-radio.d.ts +35 -0
- package/dist/2-core/ds-radio.d.ts.map +1 -0
- package/dist/2-core/ds-radio.js +19 -0
- package/dist/2-core/ds-select.d.ts +30 -0
- package/dist/2-core/ds-select.d.ts.map +1 -0
- package/dist/2-core/ds-select.js +45 -0
- package/dist/2-core/ds-split.d.ts +75 -0
- package/dist/2-core/ds-split.d.ts.map +1 -0
- package/dist/2-core/ds-split.js +101 -0
- package/dist/2-core/ds-swatch.d.ts +24 -0
- package/dist/2-core/ds-swatch.d.ts.map +1 -0
- package/dist/2-core/ds-swatch.js +16 -0
- package/dist/2-core/ds-switch.d.ts +13 -0
- package/dist/2-core/ds-switch.d.ts.map +1 -0
- package/dist/2-core/ds-switch.js +10 -0
- package/dist/2-core/ds-text.d.ts +75 -0
- package/dist/2-core/ds-text.d.ts.map +1 -0
- package/dist/2-core/ds-text.js +142 -0
- package/dist/2-core/ds-textarea.d.ts +46 -0
- package/dist/2-core/ds-textarea.d.ts.map +1 -0
- package/dist/2-core/ds-textarea.js +121 -0
- package/dist/2-core/ds-token.d.ts +48 -0
- package/dist/2-core/ds-token.d.ts.map +1 -0
- package/dist/2-core/ds-token.js +44 -0
- package/dist/2-core/ds-tooltip.d.ts +48 -0
- package/dist/2-core/ds-tooltip.d.ts.map +1 -0
- package/dist/2-core/ds-tooltip.js +99 -0
- package/dist/2-core/generated/ds-icon-map.d.ts +295 -0
- package/dist/2-core/generated/ds-icon-map.d.ts.map +1 -0
- package/dist/2-core/generated/ds-icon-map.js +579 -0
- package/dist/2-core/generated/icons-extra.d.ts +2 -0
- package/dist/2-core/generated/icons-extra.d.ts.map +1 -0
- package/dist/2-core/generated/icons-extra.js +243 -0
- package/dist/2-core/generated/icons-immediate.d.ts +3 -0
- package/dist/2-core/generated/icons-immediate.d.ts.map +1 -0
- package/dist/2-core/generated/icons-immediate.js +49 -0
- package/dist/3-unit/context-trigger.d.ts +22 -0
- package/dist/3-unit/context-trigger.d.ts.map +1 -0
- package/dist/3-unit/context-trigger.js +130 -0
- package/dist/3-unit/ds-accordion.d.ts +55 -0
- package/dist/3-unit/ds-accordion.d.ts.map +1 -0
- package/dist/3-unit/ds-accordion.js +105 -0
- package/dist/3-unit/ds-avatar-group.d.ts +40 -0
- package/dist/3-unit/ds-avatar-group.d.ts.map +1 -0
- package/dist/3-unit/ds-avatar-group.js +84 -0
- package/dist/3-unit/ds-form.d.ts +70 -0
- package/dist/3-unit/ds-form.d.ts.map +1 -0
- package/dist/3-unit/ds-form.js +232 -0
- package/dist/3-unit/ds-list.d.ts +25 -0
- package/dist/3-unit/ds-list.d.ts.map +1 -0
- package/dist/3-unit/ds-list.js +25 -0
- package/dist/3-unit/ds-menu.d.ts +162 -0
- package/dist/3-unit/ds-menu.d.ts.map +1 -0
- package/dist/3-unit/ds-menu.js +607 -0
- package/dist/3-unit/ds-row.d.ts +43 -0
- package/dist/3-unit/ds-row.d.ts.map +1 -0
- package/dist/3-unit/ds-row.js +32 -0
- package/dist/3-unit/ds-table.d.ts +33 -0
- package/dist/3-unit/ds-table.d.ts.map +1 -0
- package/dist/3-unit/ds-table.js +43 -0
- package/dist/3-unit/ds-tabs.d.ts +50 -0
- package/dist/3-unit/ds-tabs.d.ts.map +1 -0
- package/dist/3-unit/ds-tabs.js +64 -0
- package/dist/3-unit/ds-token-field.d.ts +64 -0
- package/dist/3-unit/ds-token-field.d.ts.map +1 -0
- package/dist/3-unit/ds-token-field.js +184 -0
- package/dist/4-page/ds-container.d.ts +17 -0
- package/dist/4-page/ds-container.d.ts.map +1 -0
- package/dist/4-page/ds-container.js +11 -0
- package/dist/4-page/ds-dialog.d.ts +105 -0
- package/dist/4-page/ds-dialog.d.ts.map +1 -0
- package/dist/4-page/ds-dialog.js +358 -0
- package/dist/4-page/ds-grid.d.ts +28 -0
- package/dist/4-page/ds-grid.d.ts.map +1 -0
- package/dist/4-page/ds-grid.js +49 -0
- package/dist/4-page/ds-layout.d.ts +31 -0
- package/dist/4-page/ds-layout.d.ts.map +1 -0
- package/dist/4-page/ds-layout.js +930 -0
- package/dist/4-page/ds-panel.d.ts +26 -0
- package/dist/4-page/ds-panel.d.ts.map +1 -0
- package/dist/4-page/ds-panel.js +29 -0
- package/dist/4-page/email.d.ts +49 -0
- package/dist/4-page/email.d.ts.map +1 -0
- package/dist/4-page/email.js +134 -0
- package/dist/components.d.ts +14 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/components.js +13 -0
- package/dist/design-system-1.bundle.js +9115 -0
- package/dist/design-system-1.bundle.js.map +1 -0
- package/dist/design-system-1.bundle.min.js +6879 -0
- package/dist/design-system-1.bundle.min.js.map +1 -0
- package/dist/design-system-1.css +2 -0
- package/dist/icons-extra-BoAACA4X.js +944 -0
- package/dist/icons-extra-BoAACA4X.js.map +1 -0
- package/dist/icons-extra-DlxTo_Y4.js +247 -0
- package/dist/icons-extra-DlxTo_Y4.js.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/react/accordion.d.ts +21 -0
- package/dist/react/accordion.d.ts.map +1 -0
- package/dist/react/accordion.js +30 -0
- package/dist/react/avatar-group.d.ts +6 -0
- package/dist/react/avatar-group.d.ts.map +1 -0
- package/dist/react/avatar-group.js +5 -0
- package/dist/react/avatar.d.ts +13 -0
- package/dist/react/avatar.d.ts.map +1 -0
- package/dist/react/avatar.js +18 -0
- package/dist/react/badge.d.ts +11 -0
- package/dist/react/badge.d.ts.map +1 -0
- package/dist/react/badge.js +4 -0
- package/dist/react/button.d.ts +13 -0
- package/dist/react/button.d.ts.map +1 -0
- package/dist/react/button.js +37 -0
- package/dist/react/choice.d.ts +43 -0
- package/dist/react/choice.d.ts.map +1 -0
- package/dist/react/choice.js +32 -0
- package/dist/react/composer.d.ts +17 -0
- package/dist/react/composer.d.ts.map +1 -0
- package/dist/react/composer.js +8 -0
- package/dist/react/context-menu.d.ts +657 -0
- package/dist/react/context-menu.d.ts.map +1 -0
- package/dist/react/context-menu.js +133 -0
- package/dist/react/dialog.d.ts +1173 -0
- package/dist/react/dialog.d.ts.map +1 -0
- package/dist/react/dialog.js +79 -0
- package/dist/react/file-picker.d.ts +29 -0
- package/dist/react/file-picker.d.ts.map +1 -0
- package/dist/react/file-picker.js +17 -0
- package/dist/react/input.d.ts +35 -0
- package/dist/react/input.d.ts.map +1 -0
- package/dist/react/input.js +128 -0
- package/dist/react/menu.d.ts +37 -0
- package/dist/react/menu.d.ts.map +1 -0
- package/dist/react/menu.js +31 -0
- package/dist/react/split.d.ts +15 -0
- package/dist/react/split.d.ts.map +1 -0
- package/dist/react/split.js +32 -0
- package/dist/react/token-field.d.ts +36 -0
- package/dist/react/token-field.d.ts.map +1 -0
- package/dist/react/token-field.js +33 -0
- package/dist/shared-words-Cg6Phtx0.js +915 -0
- package/dist/shared-words-Cg6Phtx0.js.map +1 -0
- package/dist/shared-words-Ddz0yUEF.js +933 -0
- package/dist/shared-words-Ddz0yUEF.js.map +1 -0
- package/package.json +149 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@import "../../1-root/component-metrics.css";
|
|
2
|
+
|
|
3
|
+
/* ds-panel.css */
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
min-height: 0;
|
|
11
|
+
background: var(--ds-paper);
|
|
12
|
+
color: var(--ds-text-color);
|
|
13
|
+
font-family: var(--ds-typeface-regular);
|
|
14
|
+
font-feature-settings: var(--ds-font-features);
|
|
15
|
+
font-size: var(--ds-type-size-default);
|
|
16
|
+
line-height: var(--ds-type-lineheight-default);
|
|
17
|
+
letter-spacing: var(--ds-type-letterspacing-default);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
slot[name="header"],
|
|
21
|
+
slot[name="footer"] {
|
|
22
|
+
display: block;
|
|
23
|
+
flex: 0 0 auto;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.body {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex: 1 1 auto;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
min-height: 0;
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Shared Lit components. Import the scoped component tokens separately. */
|
|
2
|
+
export * from "./2-core/ds-button";
|
|
3
|
+
export * from "./2-core/ds-text";
|
|
4
|
+
export * from "./2-core/ds-input";
|
|
5
|
+
export * from "./2-core/ds-textarea";
|
|
6
|
+
export * from "./2-core/ds-gap";
|
|
7
|
+
export * from "./2-core/ds-icon";
|
|
8
|
+
export * from "./2-core/ds-tooltip";
|
|
9
|
+
export * from "./3-unit/ds-row";
|
|
10
|
+
export * from "./3-unit/ds-list";
|
|
11
|
+
export * from "./3-unit/ds-menu";
|
|
12
|
+
export * from "./3-unit/ds-tabs";
|
|
13
|
+
export * from "./4-page/ds-panel";
|
package/DS1/index.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design system 1 - Main entry point for all components
|
|
3
|
+
*
|
|
4
|
+
* This module initializes core utilities and exports all design system components
|
|
5
|
+
* organized by layer: 0-face (foundation), 2-core (components), 3-unit (composites), 4-page (layouts)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Initialization (side-effect imports)
|
|
10
|
+
// ============================================================================
|
|
11
|
+
|
|
12
|
+
// Initialize device detection (will auto-detect and log on load)
|
|
13
|
+
import "./0-face/device";
|
|
14
|
+
|
|
15
|
+
// Initialize language utilities (will auto-load external translations if available)
|
|
16
|
+
import "./0-face/i18n";
|
|
17
|
+
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// 0-face: Foundation & Utilities
|
|
20
|
+
// ============================================================================
|
|
21
|
+
|
|
22
|
+
export * from "./0-face/device";
|
|
23
|
+
export * from "./0-face/grid";
|
|
24
|
+
export * from "./0-face/tooltips";
|
|
25
|
+
export * from "./0-face/i18n";
|
|
26
|
+
export * from "./0-face/languages";
|
|
27
|
+
export * from "./0-face/language-routing";
|
|
28
|
+
export * from "./0-face/translations-format";
|
|
29
|
+
export * from "./0-face/preferences";
|
|
30
|
+
export * from "./0-face/pricing";
|
|
31
|
+
export * from "./0-face/theme";
|
|
32
|
+
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// 2-core: Core Components
|
|
35
|
+
// ============================================================================
|
|
36
|
+
|
|
37
|
+
export * from "./2-core/ds-banner";
|
|
38
|
+
export * from "./2-core/ds-badge";
|
|
39
|
+
export * from "./2-core/ds-button";
|
|
40
|
+
export * from "./2-core/ds-checkbox";
|
|
41
|
+
export * from "./2-core/ds-radio";
|
|
42
|
+
export * from "./2-core/ds-switch";
|
|
43
|
+
export * from "./2-core/ds-split";
|
|
44
|
+
export * from "./2-core/ds-select";
|
|
45
|
+
export * from "./2-core/ds-color";
|
|
46
|
+
export * from "./2-core/ds-swatch";
|
|
47
|
+
export * from "./2-core/ds-card";
|
|
48
|
+
export * from "./2-core/ds-cycle";
|
|
49
|
+
export * from "./2-core/ds-date";
|
|
50
|
+
export * from "./2-core/ds-gap";
|
|
51
|
+
export * from "./2-core/ds-icon";
|
|
52
|
+
export * from "./2-core/ds-input";
|
|
53
|
+
export * from "./2-core/ds-file-picker";
|
|
54
|
+
export * from "./2-core/ds-textarea";
|
|
55
|
+
export * from "./2-core/ds-composer";
|
|
56
|
+
export * from "./2-core/ds-language";
|
|
57
|
+
export * from "./2-core/ds-text";
|
|
58
|
+
export * from "./2-core/ds-tooltip";
|
|
59
|
+
|
|
60
|
+
// ============================================================================
|
|
61
|
+
// 3-unit: Composite Components
|
|
62
|
+
// ============================================================================
|
|
63
|
+
|
|
64
|
+
export * from "./3-unit/ds-accordion";
|
|
65
|
+
export * from "./2-core/ds-avatar";
|
|
66
|
+
export * from "./3-unit/ds-avatar-group";
|
|
67
|
+
export * from "./3-unit/ds-form";
|
|
68
|
+
export * from "./3-unit/ds-list";
|
|
69
|
+
export * from "./3-unit/ds-row";
|
|
70
|
+
export * from "./3-unit/ds-table";
|
|
71
|
+
|
|
72
|
+
// ============================================================================
|
|
73
|
+
// 4-page: Layout Components
|
|
74
|
+
// ============================================================================
|
|
75
|
+
|
|
76
|
+
export * from "./4-page/ds-container";
|
|
77
|
+
export * from "./4-page/ds-grid";
|
|
78
|
+
export * from "./4-page/ds-layout";
|
|
79
|
+
|
|
80
|
+
export * from "./3-unit/ds-menu";
|
|
81
|
+
export * from "./3-unit/ds-tabs";
|
|
82
|
+
export * from "./4-page/ds-panel";
|
|
83
|
+
export * from "./4-page/ds-dialog";
|
|
84
|
+
|
|
85
|
+
export * from "./2-core/ds-token";
|
|
86
|
+
export * from "./3-unit/ds-token-field";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createElement as h, forwardRef, useEffect, useId, useLayoutEffect, useRef, useState, type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import type { Accordion as AccordionElement } from "../3-unit/ds-accordion";
|
|
3
|
+
|
|
4
|
+
export type AccordionProps = Omit<HTMLAttributes<AccordionElement>, "onToggle"> & {
|
|
5
|
+
summary: ReactNode; actions?: ReactNode; open?: boolean; defaultOpen?: boolean; disabled?: boolean;
|
|
6
|
+
triggerRole?: string; onOpenChange?: (open: boolean) => void;
|
|
7
|
+
};
|
|
8
|
+
const useCommitEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
9
|
+
export const Accordion = forwardRef<AccordionElement, AccordionProps>(function Accordion(
|
|
10
|
+
{summary, actions, open, defaultOpen = false, disabled, triggerRole, onOpenChange, children, ...props}, ref,
|
|
11
|
+
) {
|
|
12
|
+
const host = useRef<AccordionElement>(null), id = useId();
|
|
13
|
+
const [localOpen, setLocalOpen] = useState(defaultOpen), expanded = open ?? localOpen;
|
|
14
|
+
useCommitEffect(() => {
|
|
15
|
+
const element = host.current; if (!element) return;
|
|
16
|
+
const toggle = (event: Event) => {
|
|
17
|
+
if (event.target !== element) return;
|
|
18
|
+
event.preventDefault(); if (disabled) return;
|
|
19
|
+
const next = (event as CustomEvent<{open: boolean}>).detail.open;
|
|
20
|
+
if (open === undefined) setLocalOpen(next);
|
|
21
|
+
onOpenChange?.(next);
|
|
22
|
+
};
|
|
23
|
+
element.addEventListener("ds-accordion-toggle", toggle);
|
|
24
|
+
return () => element.removeEventListener("ds-accordion-toggle", toggle);
|
|
25
|
+
});
|
|
26
|
+
return h("ds-accordion", {...props, control: "slotted", open: expanded,
|
|
27
|
+
ref: (element: AccordionElement | null) => {host.current = element; if (typeof ref === "function") ref(element); else if (ref) ref.current = element;},
|
|
28
|
+
}, h("ds-button", {slot: "trigger", control: "slotted", choice: true, disabled},
|
|
29
|
+
h("button", {type: "button", role: triggerRole, disabled, "aria-expanded": expanded, "aria-controls": id}, summary,
|
|
30
|
+
h("ds-icon", {type: expanded ? "up" : "down", "aria-hidden": "true", style: {marginInlineStart: "auto", flex: "0 0 auto"}}))),
|
|
31
|
+
actions == null ? null : h("div", {slot: "actions"}, actions),
|
|
32
|
+
h("div", {slot: "details", id, hidden: !expanded}, children));
|
|
33
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createElement, forwardRef, type HTMLAttributes } from "react";
|
|
2
|
+
import type { AvatarGroup as AvatarGroupElement } from "../3-unit/ds-avatar-group";
|
|
3
|
+
|
|
4
|
+
export type AvatarGroupProps = HTMLAttributes<AvatarGroupElement> &
|
|
5
|
+
Partial<Pick<AvatarGroupElement, "size" | "vertical">>;
|
|
6
|
+
/** Registration belongs to the browser runtime; React keeps identity children. */
|
|
7
|
+
export const AvatarGroup = forwardRef<AvatarGroupElement, AvatarGroupProps>(
|
|
8
|
+
function AvatarGroup(props, ref) {
|
|
9
|
+
return createElement("ds-avatar-group", { ...props, ref });
|
|
10
|
+
},
|
|
11
|
+
);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createElement, forwardRef, type HTMLAttributes } from "react";
|
|
2
|
+
import type { Avatar as AvatarElement } from "../2-core/ds-avatar";
|
|
3
|
+
|
|
4
|
+
export type AvatarProps = Omit<HTMLAttributes<AvatarElement>, "children"> &
|
|
5
|
+
Partial<
|
|
6
|
+
Pick<
|
|
7
|
+
AvatarElement,
|
|
8
|
+
| "label"
|
|
9
|
+
| "initial"
|
|
10
|
+
| "src"
|
|
11
|
+
| "icon"
|
|
12
|
+
| "shape"
|
|
13
|
+
| "size"
|
|
14
|
+
| "fit"
|
|
15
|
+
| "mask"
|
|
16
|
+
| "outlined"
|
|
17
|
+
| "pending"
|
|
18
|
+
| "plain"
|
|
19
|
+
| "color"
|
|
20
|
+
>
|
|
21
|
+
>;
|
|
22
|
+
/** Browser-only registration stays in the product's runtime entry for SSR. */
|
|
23
|
+
export const Avatar = forwardRef<AvatarElement, AvatarProps>(function Avatar(props, ref) {
|
|
24
|
+
return createElement("ds-avatar", { ...props, ref });
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export type LogoProps = Omit<AvatarProps, "shape" | "size" | "fit" | "mask" | "plain"> & {
|
|
28
|
+
src: string;
|
|
29
|
+
};
|
|
30
|
+
/** A monochrome brand mark fitted into the page's image area. */
|
|
31
|
+
export const Logo = forwardRef<AvatarElement, LogoProps>(function Logo(props, ref) {
|
|
32
|
+
return createElement("ds-avatar", {
|
|
33
|
+
size: "fill",
|
|
34
|
+
shape: "square",
|
|
35
|
+
fit: "contain",
|
|
36
|
+
mask: true,
|
|
37
|
+
plain: true,
|
|
38
|
+
initial: "",
|
|
39
|
+
...props,
|
|
40
|
+
ref,
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createElement, forwardRef, type HTMLAttributes } from "react";
|
|
2
|
+
import type { Badge as BadgeElement } from "../2-core/ds-badge";
|
|
3
|
+
|
|
4
|
+
export type BadgeProps = HTMLAttributes<BadgeElement> & { icon?: string; iconOnly?: boolean };
|
|
5
|
+
export const Badge = forwardRef<BadgeElement, BadgeProps>(function Badge(props, ref) {
|
|
6
|
+
return createElement("ds-badge", {...props, ref});
|
|
7
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Native semantics and React events; the shared Lit element owns the face. */
|
|
2
|
+
import { createElement, forwardRef, type AnchorHTMLAttributes, type ButtonHTMLAttributes } from "react";
|
|
3
|
+
import type { Button as ButtonElement } from "../2-core/ds-button";
|
|
4
|
+
|
|
5
|
+
export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &
|
|
6
|
+
Partial<Pick<ButtonElement, "primary" | "secondary" | "active" | "choice" | "icon" | "wide" | "fit" | "danger" | "menuItem">>;
|
|
7
|
+
|
|
8
|
+
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(
|
|
9
|
+
{
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
style,
|
|
13
|
+
primary,
|
|
14
|
+
secondary,
|
|
15
|
+
active,
|
|
16
|
+
choice,
|
|
17
|
+
icon,
|
|
18
|
+
wide,
|
|
19
|
+
fit,
|
|
20
|
+
danger,
|
|
21
|
+
menuItem,
|
|
22
|
+
disabled,
|
|
23
|
+
hidden,
|
|
24
|
+
type = "button",
|
|
25
|
+
...props
|
|
26
|
+
},
|
|
27
|
+
ref,
|
|
28
|
+
) {
|
|
29
|
+
return createElement(
|
|
30
|
+
"ds-button",
|
|
31
|
+
{
|
|
32
|
+
control: "slotted",
|
|
33
|
+
primary,
|
|
34
|
+
secondary,
|
|
35
|
+
active,
|
|
36
|
+
choice,
|
|
37
|
+
icon,
|
|
38
|
+
wide,
|
|
39
|
+
fit,
|
|
40
|
+
danger,
|
|
41
|
+
menuItem,
|
|
42
|
+
disabled,
|
|
43
|
+
hidden,
|
|
44
|
+
className,
|
|
45
|
+
style,
|
|
46
|
+
},
|
|
47
|
+
createElement("button", { ...props, ref, type, disabled, hidden }, children),
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
/** A real link: browser navigation, context menus and modifier clicks survive. */
|
|
52
|
+
export type ButtonLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> &
|
|
53
|
+
Partial<Pick<ButtonElement, "primary" | "secondary" | "active" | "choice" | "icon" | "wide" | "fit" | "danger" | "menuItem">> & {disabled?: boolean};
|
|
54
|
+
export const ButtonLink = forwardRef<HTMLAnchorElement, ButtonLinkProps>(function ButtonLink(
|
|
55
|
+
{children, className, style, primary, secondary, active, choice, icon, wide, fit, danger, menuItem, disabled, hidden, href, onClick, onAuxClick, tabIndex, ...props}, ref,
|
|
56
|
+
) {
|
|
57
|
+
return createElement("ds-button", {control: "slotted", primary, secondary, active, choice, icon, wide, fit, danger, menuItem, disabled, hidden, className, style},
|
|
58
|
+
createElement("a", {...props, ref, href: disabled ? undefined : href, hidden,
|
|
59
|
+
"aria-disabled": disabled || undefined, tabIndex: disabled ? -1 : tabIndex,
|
|
60
|
+
onClick: event => { if (disabled) { event.preventDefault(); event.stopPropagation(); } else onClick?.(event); },
|
|
61
|
+
onAuxClick: event => { if (disabled) { event.preventDefault(); event.stopPropagation(); } else onAuxClick?.(event); },
|
|
62
|
+
}, children));
|
|
63
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** Native controls retain labels, forms and events. Shared Lit elements own their faces. */
|
|
2
|
+
import { createElement, forwardRef, useCallback, type ButtonHTMLAttributes, type InputHTMLAttributes, type SelectHTMLAttributes, type MouseEvent, type ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
export type ColorInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type">;
|
|
5
|
+
export const ColorInput = forwardRef<HTMLInputElement, ColorInputProps>(function ColorInput(
|
|
6
|
+
{ className, style, hidden, ...props }, ref,
|
|
7
|
+
) {
|
|
8
|
+
return createElement("ds-color", { className, style, hidden }, createElement("input", { ...props, type: "color", hidden, ref }));
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type SelectProps = SelectHTMLAttributes<HTMLSelectElement> & {
|
|
12
|
+
fit?: boolean;
|
|
13
|
+
chip?: boolean;
|
|
14
|
+
primary?: boolean;
|
|
15
|
+
swatch?: string;
|
|
16
|
+
};
|
|
17
|
+
export const Select = forwardRef<HTMLSelectElement, SelectProps>(function Select(
|
|
18
|
+
{ className, style, hidden, children, fit, chip, primary, swatch, ...props }, ref,
|
|
19
|
+
) {
|
|
20
|
+
return createElement("ds-select", { className, style, hidden, fit: fit ? "" : undefined, chip: chip ? "" : undefined, primary: primary ? "" : undefined, swatch }, createElement("select", { ...props, hidden, ref }, children));
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type"> & { indeterminate?: boolean };
|
|
24
|
+
export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(
|
|
25
|
+
{ className, style, hidden, indeterminate = false, ...props }, ref,
|
|
26
|
+
) {
|
|
27
|
+
const controlRef = useCallback((input: HTMLInputElement | null) => {
|
|
28
|
+
if (input) input.indeterminate = indeterminate;
|
|
29
|
+
if (typeof ref === "function") return ref(input);
|
|
30
|
+
if (ref) ref.current = input;
|
|
31
|
+
}, [ref, indeterminate]);
|
|
32
|
+
return createElement("ds-checkbox", { className, style, hidden }, createElement("input", { ...props, type: "checkbox", hidden, ref: controlRef }));
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export type RadioProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "children"> & {
|
|
36
|
+
choice?: boolean;
|
|
37
|
+
compact?: boolean;
|
|
38
|
+
label?: string;
|
|
39
|
+
preview?: ReactNode;
|
|
40
|
+
};
|
|
41
|
+
export const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(
|
|
42
|
+
{ className, style, hidden, choice, compact, label, preview, ...props }, ref,
|
|
43
|
+
) {
|
|
44
|
+
return createElement("ds-radio", { className, style, hidden, label, choice: Boolean(choice), compact: Boolean(compact), preview: preview != null },
|
|
45
|
+
createElement("input", { ...props, "aria-label": props["aria-label"] ?? label, type: "radio", hidden, ref }),
|
|
46
|
+
preview != null ? createElement("span", { slot: "preview", "aria-hidden": true }, preview) : null,
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export type SwitchProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "role" | "aria-checked" | "onChange" | "type"> & {
|
|
51
|
+
checked: boolean;
|
|
52
|
+
onCheckedChange?: (checked: boolean, event: MouseEvent<HTMLButtonElement>) => void;
|
|
53
|
+
};
|
|
54
|
+
export const Switch = forwardRef<HTMLButtonElement, SwitchProps>(function Switch(
|
|
55
|
+
{ checked, onCheckedChange, onClick, className, style, hidden, ...props }, ref,
|
|
56
|
+
) {
|
|
57
|
+
return createElement("ds-switch", { className, style, hidden }, createElement("button", {
|
|
58
|
+
...props, ref, hidden, type: "button", role: "switch", "aria-checked": checked,
|
|
59
|
+
onClick: (event: MouseEvent<HTMLButtonElement>) => {
|
|
60
|
+
onClick?.(event);
|
|
61
|
+
if (!event.defaultPrevented) onCheckedChange?.(!checked, event);
|
|
62
|
+
},
|
|
63
|
+
}));
|
|
64
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createElement, forwardRef, useEffect, useLayoutEffect, useRef, type TextareaHTMLAttributes } from "react";
|
|
2
|
+
import type { Composer as ComposerElement, TextHighlight } from "../2-core/ds-composer";
|
|
3
|
+
export type { TextHighlight };
|
|
4
|
+
export type ComposerProps = TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
5
|
+
highlights?: TextHighlight[];
|
|
6
|
+
autoGrow?: boolean;
|
|
7
|
+
maxRows?: number;
|
|
8
|
+
variant?: "field" | "plain";
|
|
9
|
+
};
|
|
10
|
+
const useCommitEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
11
|
+
/** Native React values, events, refs and forms; DS1 owns the entire visual. */
|
|
12
|
+
export const Composer = forwardRef<HTMLTextAreaElement, ComposerProps>(function Composer(
|
|
13
|
+
{ highlights = [], autoGrow, maxRows = 12, variant = "field", className, style, ...props }, ref,
|
|
14
|
+
) {
|
|
15
|
+
const host = useRef<ComposerElement>(null);
|
|
16
|
+
useCommitEffect(() => { host.current?.refresh(); });
|
|
17
|
+
return createElement("ds-composer", { ref: host, highlights, "auto-grow": autoGrow, "max-rows": maxRows, variant, className, style }, createElement("textarea", { ...props, ref }));
|
|
18
|
+
});
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/** React state and native events for the shared Lit menu. No positioning or gesture code. */
|
|
2
|
+
import {
|
|
3
|
+
Children, cloneElement, createContext, createElement as h, forwardRef,
|
|
4
|
+
useCallback, useContext, useEffect, useId, useLayoutEffect, useRef, useState,
|
|
5
|
+
type CSSProperties, type HTMLAttributes, type ReactElement, type ReactNode, type Ref,
|
|
6
|
+
} from "react";
|
|
7
|
+
import { Menu, type MenuProps } from "./menu";
|
|
8
|
+
import { Button, type ButtonProps } from "./button";
|
|
9
|
+
import { FilePicker, type FilePickerProps } from "./file-picker";
|
|
10
|
+
import type { Menu as MenuElement, MenuCloseReason } from "../3-unit/ds-menu";
|
|
11
|
+
|
|
12
|
+
const useCommitEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
13
|
+
type State = {
|
|
14
|
+
open: boolean;
|
|
15
|
+
change: (open: boolean, reason?: MenuCloseReason | "trigger") => void;
|
|
16
|
+
trigger: HTMLElement | null;
|
|
17
|
+
setTrigger: (element: HTMLElement | null) => void;
|
|
18
|
+
menu: { current: MenuElement | null };
|
|
19
|
+
id: string;
|
|
20
|
+
nested: boolean;
|
|
21
|
+
};
|
|
22
|
+
const Context = createContext<State | null>(null);
|
|
23
|
+
const useMenu = () => {
|
|
24
|
+
const state = useContext(Context);
|
|
25
|
+
if (!state) throw new Error("Menu controls must be inside ContextMenu or ContextMenuSub.");
|
|
26
|
+
return state;
|
|
27
|
+
};
|
|
28
|
+
export interface ContextMenuProps {
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
open?: boolean;
|
|
31
|
+
defaultOpen?: boolean;
|
|
32
|
+
onOpenChange?: (open: boolean) => void;
|
|
33
|
+
}
|
|
34
|
+
function Scope({ children, open, defaultOpen = false, onOpenChange, nested = false }: ContextMenuProps & { nested?: boolean }) {
|
|
35
|
+
const [internal, setInternal] = useState(defaultOpen);
|
|
36
|
+
const [trigger, setTrigger] = useState<HTMLElement | null>(null);
|
|
37
|
+
const menu = useRef<MenuElement>(null), id = useId();
|
|
38
|
+
return h(Context.Provider, { value: {
|
|
39
|
+
open: open ?? internal, trigger, setTrigger, menu, id, nested,
|
|
40
|
+
change: next => { if (open === undefined) setInternal(next); onOpenChange?.(next); },
|
|
41
|
+
} }, children);
|
|
42
|
+
}
|
|
43
|
+
export function ContextMenu(props: ContextMenuProps) { return h(Scope, props); }
|
|
44
|
+
export function ContextMenuSub(props: ContextMenuProps) { return h(Scope, { ...props, nested: true }); }
|
|
45
|
+
|
|
46
|
+
function setRef<T>(ref: Ref<T> | undefined, value: T | null) {
|
|
47
|
+
if (typeof ref === "function") ref(value); else if (ref) ref.current = value;
|
|
48
|
+
}
|
|
49
|
+
export type ContextMenuTriggerProps = HTMLAttributes<HTMLElement> & { asChild?: boolean; disabled?: boolean };
|
|
50
|
+
export const ContextMenuTrigger = forwardRef<HTMLElement, ContextMenuTriggerProps>(function ContextMenuTrigger(
|
|
51
|
+
{ asChild, disabled = false, children, ...props }, ref,
|
|
52
|
+
) {
|
|
53
|
+
const state = useMenu();
|
|
54
|
+
const child = asChild ? Children.only(children) as ReactElement<HTMLAttributes<HTMLElement> & { ref?: Ref<HTMLElement> }> : null;
|
|
55
|
+
const childRef = child?.props.ref;
|
|
56
|
+
const bind = useCallback((element: HTMLElement | null) => {
|
|
57
|
+
setRef(ref, element); setRef(childRef, element);
|
|
58
|
+
state.setTrigger(disabled ? null : element);
|
|
59
|
+
}, [ref, childRef, state.setTrigger, disabled]);
|
|
60
|
+
const attributes = { ...props, ref: bind, "data-state": state.open ? "open" : "closed", "data-slot": "context-menu-trigger" };
|
|
61
|
+
if (child) {
|
|
62
|
+
// The child keeps its product handlers. A supplied trigger handler runs
|
|
63
|
+
// afterwards, unless the child deliberately consumed the event.
|
|
64
|
+
const merged: Record<string, unknown> = { ...child.props, ...attributes };
|
|
65
|
+
for (const [key, value] of Object.entries(props)) {
|
|
66
|
+
const first = (child.props as Record<string, unknown>)[key];
|
|
67
|
+
if (/^on[A-Z]/.test(key) && typeof first === "function" && typeof value === "function") {
|
|
68
|
+
merged[key] = (event: { defaultPrevented: boolean }) => { first(event); if (!event.defaultPrevented) value(event); };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return cloneElement(child, merged);
|
|
72
|
+
}
|
|
73
|
+
return h("span", { ...attributes, tabIndex: disabled ? -1 : 0 }, children);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export type ContextMenuContentProps = Omit<MenuProps, "open" | "trigger" | "anchor" | "triggerMode" | "onOpenChange">;
|
|
77
|
+
export const ContextMenuContent = forwardRef<MenuElement, ContextMenuContentProps>(function ContextMenuContent(
|
|
78
|
+
{ children, placement, ...props }, ref,
|
|
79
|
+
) {
|
|
80
|
+
const state = useMenu();
|
|
81
|
+
useCommitEffect(() => { state.menu.current?.renderNow(); });
|
|
82
|
+
// Render the closed host so the source can continue listening to its trigger.
|
|
83
|
+
// Open descendants unmount together, including nested menu state.
|
|
84
|
+
return h(Menu, { ...props, id: props.id ?? state.id, role: "menu", hidden: !state.open,
|
|
85
|
+
"data-slot": state.nested ? "context-menu-sub-content" : "context-menu-content",
|
|
86
|
+
open: state.open, trigger: state.trigger, anchor: state.trigger,
|
|
87
|
+
triggerMode: state.nested ? "submenu" : "context", placement: placement ?? (state.nested ? "right" : "bottom"),
|
|
88
|
+
ref: (element: MenuElement | null) => { state.menu.current = element; setRef(ref, element); },
|
|
89
|
+
onOpenChange: state.change,
|
|
90
|
+
} as MenuProps, state.open ? children : null);
|
|
91
|
+
});
|
|
92
|
+
export const ContextMenuSubContent = ContextMenuContent;
|
|
93
|
+
|
|
94
|
+
export type ContextMenuItemProps = Omit<ButtonProps, "onSelect"> & {
|
|
95
|
+
inset?: boolean;
|
|
96
|
+
variant?: "default" | "destructive";
|
|
97
|
+
textValue?: string;
|
|
98
|
+
onSelect?: (event: Event) => void;
|
|
99
|
+
};
|
|
100
|
+
export const ContextMenuItem = forwardRef<HTMLButtonElement, ContextMenuItemProps>(function ContextMenuItem(
|
|
101
|
+
{ inset, variant, textValue, onClick, onSelect, children, style, ...props }, ref,
|
|
102
|
+
) {
|
|
103
|
+
const state = useMenu();
|
|
104
|
+
return h(Button, { ...props, ref, menuItem: true, danger: variant === "destructive" || props.danger,
|
|
105
|
+
role: props.role ?? "menuitem", "data-text-value": textValue,
|
|
106
|
+
style: { ...style, ...(inset ? { "--ds-button-padding": "0 calc(4px * var(--ds-sf)) 0 var(--ds-unit)" } : {}) } as CSSProperties,
|
|
107
|
+
onClick: event => {
|
|
108
|
+
if (props.disabled) return;
|
|
109
|
+
onClick?.(event);
|
|
110
|
+
if (event.defaultPrevented) return;
|
|
111
|
+
const select = new Event("ds-menu-select", { cancelable: true });
|
|
112
|
+
onSelect?.(select);
|
|
113
|
+
if (!select.defaultPrevented) state.menu.current?.select();
|
|
114
|
+
},
|
|
115
|
+
} as ButtonProps, children);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const indicatorStyle: CSSProperties = { display: "inline-flex", flex: "0 0 var(--ds-unit)", alignItems: "center" };
|
|
119
|
+
function mark(checked: boolean | "indeterminate") {
|
|
120
|
+
return h("span", { "aria-hidden": true, style: indicatorStyle }, checked ? h("ds-icon", { type: checked === "indeterminate" ? "minus" : "check" }) : null);
|
|
121
|
+
}
|
|
122
|
+
export const ContextMenuCheckboxItem = forwardRef<HTMLButtonElement, ContextMenuItemProps & {
|
|
123
|
+
checked?: boolean | "indeterminate"; onCheckedChange?: (checked: boolean) => void;
|
|
124
|
+
}>(function ContextMenuCheckboxItem({ checked = false, onCheckedChange, onSelect, children, ...props }, ref) {
|
|
125
|
+
return h(ContextMenuItem, { ...props, ref, role: "menuitemcheckbox", "aria-checked": checked === "indeterminate" ? "mixed" : checked,
|
|
126
|
+
onSelect: event => { onSelect?.(event); if (!event.defaultPrevented) onCheckedChange?.(checked !== true); },
|
|
127
|
+
}, mark(checked), children);
|
|
128
|
+
});
|
|
129
|
+
const Radio = createContext<{ value?: string; change?: (value: string) => void }>({});
|
|
130
|
+
export function ContextMenuRadioGroup({ value, onValueChange, children, ...props }: HTMLAttributes<HTMLDivElement> & { value?: string; onValueChange?: (value: string) => void }) {
|
|
131
|
+
return h(Radio.Provider, { value: { value, change: onValueChange } }, h(ContextMenuGroup, props, children));
|
|
132
|
+
}
|
|
133
|
+
export const ContextMenuRadioItem = forwardRef<HTMLButtonElement, ContextMenuItemProps & { value: string }>(function ContextMenuRadioItem(
|
|
134
|
+
{ value, onSelect, children, ...props }, ref,
|
|
135
|
+
) {
|
|
136
|
+
const radio = useContext(Radio), checked = radio.value === value;
|
|
137
|
+
return h(ContextMenuItem, { ...props, ref, role: "menuitemradio", "aria-checked": checked,
|
|
138
|
+
onSelect: event => { onSelect?.(event); if (!event.defaultPrevented) radio.change?.(value); },
|
|
139
|
+
}, mark(checked), children);
|
|
140
|
+
});
|
|
141
|
+
export const ContextMenuSubTrigger = forwardRef<HTMLButtonElement, ContextMenuItemProps>(function ContextMenuSubTrigger(
|
|
142
|
+
{ children, inset, variant, textValue, onSelect: _onSelect, ...props }, ref,
|
|
143
|
+
) {
|
|
144
|
+
const state = useMenu();
|
|
145
|
+
const bind = useCallback((element: HTMLButtonElement | null) => { state.setTrigger(element); setRef(ref, element); }, [ref, state.setTrigger]);
|
|
146
|
+
return h(Button, { ...props, ref: bind, role: "menuitem", menuItem: true, active: state.open,
|
|
147
|
+
danger: variant === "destructive", "data-text-value": textValue,
|
|
148
|
+
"data-state": state.open ? "open" : "closed",
|
|
149
|
+
} as ButtonProps, inset ? mark(false) : null, children,
|
|
150
|
+
h("ds-icon", { type: "right", "aria-hidden": true, style: { marginInlineStart: "auto", flex: "none" } }));
|
|
151
|
+
});
|
|
152
|
+
export function ContextMenuFilePicker({ onFiles, ...props }: Omit<FilePickerProps, "onChange"> & { onFiles: (files: File[]) => void }) {
|
|
153
|
+
return h(FilePicker, { ...props, role: "menuitem", onChange: event => {
|
|
154
|
+
const files = Array.from(event.currentTarget.files ?? []); event.currentTarget.value = "";
|
|
155
|
+
if (!props.disabled && files.length) onFiles(files);
|
|
156
|
+
} });
|
|
157
|
+
}
|
|
158
|
+
export function ContextMenuGroup(props: HTMLAttributes<HTMLDivElement>): ReactElement {
|
|
159
|
+
return h("div", { ...props, role: "group", style: { ...props.style, display: "contents" } });
|
|
160
|
+
}
|
|
161
|
+
export function ContextMenuLabel({ inset, children, ...props }: HTMLAttributes<HTMLElement> & { inset?: boolean }) {
|
|
162
|
+
return h("ds-text", { ...props, literal: true, tone: "muted", "data-ds-menu-label": "" }, inset ? mark(false) : null, children);
|
|
163
|
+
}
|
|
164
|
+
export function ContextMenuSeparator(props: HTMLAttributes<HTMLHRElement>) { return h("hr", { ...props, "data-ds-menu-separator": "" }); }
|
|
165
|
+
export function ContextMenuShortcut(props: HTMLAttributes<HTMLSpanElement>): ReactElement {
|
|
166
|
+
return h("span", { ...props, style: { marginInlineStart: "auto", color: "var(--ds-text-color-muted)", ...props.style } });
|
|
167
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/** Optional React composition; behavior and appearance belong to ds-dialog. */
|
|
2
|
+
import { createContext, createElement, useContext, useId, useLayoutEffect, useRef, useState, type HTMLAttributes, type ReactNode, type Ref } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import type { Dialog as DialogElement, DialogCloseReason } from "../4-page/ds-dialog";
|
|
5
|
+
|
|
6
|
+
const DialogContext = createContext<{ open: boolean; change: (open: boolean, reason?: DialogCloseReason) => void; title: string; description: string } | null>(null);
|
|
7
|
+
const useDialog = () => {
|
|
8
|
+
const context = useContext(DialogContext);
|
|
9
|
+
if (!context) throw new Error("Dialog content must be inside Dialog.");
|
|
10
|
+
return context;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export interface DialogProps { open?: boolean; defaultOpen?: boolean; onOpenChange?: (open: boolean, reason?: DialogCloseReason) => void; children: ReactNode }
|
|
14
|
+
export function Dialog({ open, defaultOpen = false, onOpenChange, children }: DialogProps) {
|
|
15
|
+
const [internal, setInternal] = useState(defaultOpen);
|
|
16
|
+
const id = useId();
|
|
17
|
+
return createElement(DialogContext.Provider, { value: {
|
|
18
|
+
open: open ?? internal, title: `${id}-title`, description: `${id}-description`,
|
|
19
|
+
change: (next, reason) => { if (open === undefined) setInternal(next); onOpenChange?.(next, reason); },
|
|
20
|
+
} }, children);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface DialogContentProps extends HTMLAttributes<HTMLDialogElement> {
|
|
24
|
+
ref?: Ref<HTMLDialogElement>;
|
|
25
|
+
/** Keep floating panels within their product layout or containing modal. */
|
|
26
|
+
portal?: boolean;
|
|
27
|
+
nonModal?: boolean;
|
|
28
|
+
closeOnOutside?: boolean;
|
|
29
|
+
blockOutside?: boolean;
|
|
30
|
+
holdScroll?: boolean;
|
|
31
|
+
anchor?: { x: number; y: number } | null;
|
|
32
|
+
returnFocus?: (() => HTMLElement | null) | null;
|
|
33
|
+
closeLabel?: string;
|
|
34
|
+
showClose?: boolean;
|
|
35
|
+
closeOnEscape?: boolean;
|
|
36
|
+
closeOnBackdrop?: boolean;
|
|
37
|
+
/** Fill the viewport for document viewers; this is not the Fullscreen API. */
|
|
38
|
+
fullScreen?: boolean;
|
|
39
|
+
/** Content supplies its own internal spacing. The shared frame stays intact. */
|
|
40
|
+
flush?: boolean;
|
|
41
|
+
/** Rotate a document frame while keeping it within the viewport. */
|
|
42
|
+
rotated?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export function DialogContent({ children, portal = true, nonModal = false, closeOnOutside = false, blockOutside = false, holdScroll = false, anchor = null, returnFocus = null, closeLabel = "Close", showClose = true, closeOnEscape = true, closeOnBackdrop = true, fullScreen = false, flush = false, rotated = false, ...props }: DialogContentProps) {
|
|
45
|
+
const context = useDialog();
|
|
46
|
+
const host = useRef<DialogElement>(null);
|
|
47
|
+
const [mounted, setMounted] = useState(false);
|
|
48
|
+
// A portal has no server location. Keep the server and first client render
|
|
49
|
+
// identical, including when the application initially requests an open modal.
|
|
50
|
+
useLayoutEffect(() => { setMounted(true); }, []);
|
|
51
|
+
// Install the request handler before opening, and keep the app's decision authoritative.
|
|
52
|
+
useLayoutEffect(() => {
|
|
53
|
+
const element = host.current;
|
|
54
|
+
if (!element) return;
|
|
55
|
+
const close = (event: Event) => {
|
|
56
|
+
if (event.target !== element) return;
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
context.change(false, (event as CustomEvent<{ reason: DialogCloseReason }>).detail.reason);
|
|
59
|
+
};
|
|
60
|
+
element.addEventListener("ds-close-request", close);
|
|
61
|
+
const native = element.querySelector("dialog")!;
|
|
62
|
+
if (!("aria-labelledby" in props) && !props["aria-label"]) {
|
|
63
|
+
const title = native.querySelector('[data-ds-dialog="title"]');
|
|
64
|
+
if (title) native.setAttribute("aria-labelledby", title.id);
|
|
65
|
+
else native.removeAttribute("aria-labelledby");
|
|
66
|
+
}
|
|
67
|
+
if (!("aria-describedby" in props)) {
|
|
68
|
+
const description = native.querySelector('[data-ds-dialog="description"]');
|
|
69
|
+
if (description) native.setAttribute("aria-describedby", description.id);
|
|
70
|
+
else native.removeAttribute("aria-describedby");
|
|
71
|
+
}
|
|
72
|
+
element.closeOnEscape = closeOnEscape;
|
|
73
|
+
element.closeOnBackdrop = closeOnBackdrop;
|
|
74
|
+
element.nonModal = nonModal;
|
|
75
|
+
element.closeOnOutside = closeOnOutside;
|
|
76
|
+
element.blockOutside = blockOutside;
|
|
77
|
+
element.holdScroll = holdScroll;
|
|
78
|
+
element.anchor = anchor;
|
|
79
|
+
element.returnFocus = returnFocus;
|
|
80
|
+
element.open = context.open;
|
|
81
|
+
return () => element.removeEventListener("ds-close-request", close);
|
|
82
|
+
});
|
|
83
|
+
if (!mounted || !context.open) return null;
|
|
84
|
+
const content = createElement("ds-dialog", { ref: host },
|
|
85
|
+
createElement("dialog", { ...props, "data-ds-dialog-fullscreen": fullScreen || undefined, "data-ds-dialog-flush": flush || undefined, "data-ds-dialog-rotated": rotated || undefined }, children,
|
|
86
|
+
showClose && createElement("ds-button", { control: "slotted", icon: true, "data-ds-dialog": "close" },
|
|
87
|
+
createElement("button", { type: "button", "aria-label": closeLabel, "data-ds-dialog-dismiss": "" },
|
|
88
|
+
createElement("ds-icon", { type: "close", "aria-hidden": true }))),
|
|
89
|
+
));
|
|
90
|
+
return portal ? createPortal(content, document.body) : content;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function DialogHeader(props: HTMLAttributes<HTMLDivElement>) { return createElement("div", { ...props, "data-ds-dialog": "header" }); }
|
|
94
|
+
export function DialogFooter(props: HTMLAttributes<HTMLDivElement>) { return createElement("div", { ...props, "data-ds-dialog": "footer" }); }
|
|
95
|
+
export function DialogTitle(props: HTMLAttributes<HTMLHeadingElement>) {
|
|
96
|
+
const context = useDialog();
|
|
97
|
+
return createElement("h2", { id: context.title, ...props, "data-ds-dialog": "title" });
|
|
98
|
+
}
|
|
99
|
+
export function DialogDescription(props: HTMLAttributes<HTMLParagraphElement>) {
|
|
100
|
+
const context = useDialog();
|
|
101
|
+
return createElement("p", { id: context.description, ...props, "data-ds-dialog": "description" });
|
|
102
|
+
}
|