@hjmds/design-contracts 0.8.2
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 +208 -0
- package/dist/alert-dialog.d.ts +102 -0
- package/dist/alert-dialog.d.ts.map +1 -0
- package/dist/alert-dialog.js +136 -0
- package/dist/alert-dialog.js.map +1 -0
- package/dist/base-recipes.d.ts +184 -0
- package/dist/base-recipes.d.ts.map +1 -0
- package/dist/base-recipes.js +129 -0
- package/dist/base-recipes.js.map +1 -0
- package/dist/behaviors.d.ts +1254 -0
- package/dist/behaviors.d.ts.map +1 -0
- package/dist/behaviors.js +972 -0
- package/dist/behaviors.js.map +1 -0
- package/dist/bottom-navigation-defaults.d.ts +13 -0
- package/dist/bottom-navigation-defaults.d.ts.map +1 -0
- package/dist/bottom-navigation-defaults.js +10 -0
- package/dist/bottom-navigation-defaults.js.map +1 -0
- package/dist/bottom-navigation.d.ts +114 -0
- package/dist/bottom-navigation.d.ts.map +1 -0
- package/dist/bottom-navigation.js +223 -0
- package/dist/bottom-navigation.js.map +1 -0
- package/dist/breadcrumb.d.ts +97 -0
- package/dist/breadcrumb.d.ts.map +1 -0
- package/dist/breadcrumb.js +99 -0
- package/dist/breadcrumb.js.map +1 -0
- package/dist/calendar.d.ts +285 -0
- package/dist/calendar.d.ts.map +1 -0
- package/dist/calendar.js +297 -0
- package/dist/calendar.js.map +1 -0
- package/dist/card.d.ts +39 -0
- package/dist/card.d.ts.map +1 -0
- package/dist/card.js +50 -0
- package/dist/card.js.map +1 -0
- package/dist/carousel.d.ts +180 -0
- package/dist/carousel.d.ts.map +1 -0
- package/dist/carousel.js +172 -0
- package/dist/carousel.js.map +1 -0
- package/dist/catalog.d.ts +7158 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +220 -0
- package/dist/catalog.js.map +1 -0
- package/dist/collection.d.ts +123 -0
- package/dist/collection.d.ts.map +1 -0
- package/dist/collection.js +211 -0
- package/dist/collection.js.map +1 -0
- package/dist/color-references.d.ts +46 -0
- package/dist/color-references.d.ts.map +1 -0
- package/dist/color-references.js +39 -0
- package/dist/color-references.js.map +1 -0
- package/dist/colors.d.ts +56 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/colors.js +90 -0
- package/dist/colors.js.map +1 -0
- package/dist/command-palette.d.ts +240 -0
- package/dist/command-palette.d.ts.map +1 -0
- package/dist/command-palette.js +97 -0
- package/dist/command-palette.js.map +1 -0
- package/dist/component-contracts.d.ts +137 -0
- package/dist/component-contracts.d.ts.map +1 -0
- package/dist/component-contracts.js +53 -0
- package/dist/component-contracts.js.map +1 -0
- package/dist/component-definitions.d.ts +135 -0
- package/dist/component-definitions.d.ts.map +1 -0
- package/dist/component-definitions.js +142 -0
- package/dist/component-definitions.js.map +1 -0
- package/dist/component-recipes.d.ts +3583 -0
- package/dist/component-recipes.d.ts.map +1 -0
- package/dist/component-recipes.js +1503 -0
- package/dist/component-recipes.js.map +1 -0
- package/dist/component-references.d.ts +416 -0
- package/dist/component-references.d.ts.map +1 -0
- package/dist/component-references.js +140 -0
- package/dist/component-references.js.map +1 -0
- package/dist/content-state.d.ts +104 -0
- package/dist/content-state.d.ts.map +1 -0
- package/dist/content-state.js +116 -0
- package/dist/content-state.js.map +1 -0
- package/dist/counter-badge-recipe.d.ts +80 -0
- package/dist/counter-badge-recipe.d.ts.map +1 -0
- package/dist/counter-badge-recipe.js +44 -0
- package/dist/counter-badge-recipe.js.map +1 -0
- package/dist/counter-badge.d.ts +12 -0
- package/dist/counter-badge.d.ts.map +1 -0
- package/dist/counter-badge.js +21 -0
- package/dist/counter-badge.js.map +1 -0
- package/dist/data-table.d.ts +203 -0
- package/dist/data-table.d.ts.map +1 -0
- package/dist/data-table.js +182 -0
- package/dist/data-table.js.map +1 -0
- package/dist/date-picker.d.ts +268 -0
- package/dist/date-picker.d.ts.map +1 -0
- package/dist/date-picker.js +168 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/description-list.d.ts +68 -0
- package/dist/description-list.d.ts.map +1 -0
- package/dist/description-list.js +85 -0
- package/dist/description-list.js.map +1 -0
- package/dist/design-system-provider.d.ts +80 -0
- package/dist/design-system-provider.d.ts.map +1 -0
- package/dist/design-system-provider.js +147 -0
- package/dist/design-system-provider.js.map +1 -0
- package/dist/evidence.d.ts +49 -0
- package/dist/evidence.d.ts.map +1 -0
- package/dist/evidence.js +133 -0
- package/dist/evidence.js.map +1 -0
- package/dist/file-picker.d.ts +183 -0
- package/dist/file-picker.d.ts.map +1 -0
- package/dist/file-picker.js +224 -0
- package/dist/file-picker.js.map +1 -0
- package/dist/floating-action-button.d.ts +143 -0
- package/dist/floating-action-button.d.ts.map +1 -0
- package/dist/floating-action-button.js +149 -0
- package/dist/floating-action-button.js.map +1 -0
- package/dist/form.d.ts +143 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.js +206 -0
- package/dist/form.js.map +1 -0
- package/dist/foundations.d.ts +300 -0
- package/dist/foundations.d.ts.map +1 -0
- package/dist/foundations.js +238 -0
- package/dist/foundations.js.map +1 -0
- package/dist/grid.d.ts +75 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +133 -0
- package/dist/grid.js.map +1 -0
- package/dist/icon-button-recipe.d.ts +99 -0
- package/dist/icon-button-recipe.d.ts.map +1 -0
- package/dist/icon-button-recipe.js +53 -0
- package/dist/icon-button-recipe.js.map +1 -0
- package/dist/icon.d.ts +41 -0
- package/dist/icon.d.ts.map +1 -0
- package/dist/icon.js +147 -0
- package/dist/icon.js.map +1 -0
- package/dist/image.d.ts +82 -0
- package/dist/image.d.ts.map +1 -0
- package/dist/image.js +100 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.d.ts +118 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +118 -0
- package/dist/layout.js.map +1 -0
- package/dist/link.d.ts +57 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +142 -0
- package/dist/link.js.map +1 -0
- package/dist/load-more.d.ts +64 -0
- package/dist/load-more.d.ts.map +1 -0
- package/dist/load-more.js +124 -0
- package/dist/load-more.js.map +1 -0
- package/dist/mentions.d.ts +67 -0
- package/dist/mentions.d.ts.map +1 -0
- package/dist/mentions.js +107 -0
- package/dist/mentions.js.map +1 -0
- package/dist/number-field.d.ts +208 -0
- package/dist/number-field.d.ts.map +1 -0
- package/dist/number-field.js +247 -0
- package/dist/number-field.js.map +1 -0
- package/dist/otp-field.d.ts +152 -0
- package/dist/otp-field.d.ts.map +1 -0
- package/dist/otp-field.js +117 -0
- package/dist/otp-field.js.map +1 -0
- package/dist/pagination.d.ts +181 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +226 -0
- package/dist/pagination.js.map +1 -0
- package/dist/password-field.d.ts +187 -0
- package/dist/password-field.d.ts.map +1 -0
- package/dist/password-field.js +120 -0
- package/dist/password-field.js.map +1 -0
- package/dist/popover.d.ts +152 -0
- package/dist/popover.d.ts.map +1 -0
- package/dist/popover.js +137 -0
- package/dist/popover.js.map +1 -0
- package/dist/progress-recipe.d.ts +43 -0
- package/dist/progress-recipe.d.ts.map +1 -0
- package/dist/progress-recipe.js +16 -0
- package/dist/progress-recipe.js.map +1 -0
- package/dist/recipes.d.ts +31 -0
- package/dist/recipes.d.ts.map +1 -0
- package/dist/recipes.js +46 -0
- package/dist/recipes.js.map +1 -0
- package/dist/responsive.d.ts +27 -0
- package/dist/responsive.d.ts.map +1 -0
- package/dist/responsive.js +66 -0
- package/dist/responsive.js.map +1 -0
- package/dist/result.d.ts +111 -0
- package/dist/result.d.ts.map +1 -0
- package/dist/result.js +97 -0
- package/dist/result.js.map +1 -0
- package/dist/selection-helpers.d.ts +16 -0
- package/dist/selection-helpers.d.ts.map +1 -0
- package/dist/selection-helpers.js +52 -0
- package/dist/selection-helpers.js.map +1 -0
- package/dist/semantic-colors.d.ts +275 -0
- package/dist/semantic-colors.d.ts.map +1 -0
- package/dist/semantic-colors.js +84 -0
- package/dist/semantic-colors.js.map +1 -0
- package/dist/sheet.d.ts +51 -0
- package/dist/sheet.d.ts.map +1 -0
- package/dist/sheet.js +69 -0
- package/dist/sheet.js.map +1 -0
- package/dist/showcase.d.ts +153 -0
- package/dist/showcase.d.ts.map +1 -0
- package/dist/showcase.js +210 -0
- package/dist/showcase.js.map +1 -0
- package/dist/side-panel.d.ts +199 -0
- package/dist/side-panel.d.ts.map +1 -0
- package/dist/side-panel.js +111 -0
- package/dist/side-panel.js.map +1 -0
- package/dist/slider.d.ts +138 -0
- package/dist/slider.d.ts.map +1 -0
- package/dist/slider.js +150 -0
- package/dist/slider.js.map +1 -0
- package/dist/splitter.d.ts +113 -0
- package/dist/splitter.d.ts.map +1 -0
- package/dist/splitter.js +99 -0
- package/dist/splitter.js.map +1 -0
- package/dist/statistic.d.ts +41 -0
- package/dist/statistic.d.ts.map +1 -0
- package/dist/statistic.js +76 -0
- package/dist/statistic.js.map +1 -0
- package/dist/steps.d.ts +196 -0
- package/dist/steps.d.ts.map +1 -0
- package/dist/steps.js +160 -0
- package/dist/steps.js.map +1 -0
- package/dist/tag.d.ts +128 -0
- package/dist/tag.d.ts.map +1 -0
- package/dist/tag.js +93 -0
- package/dist/tag.js.map +1 -0
- package/dist/timeline.d.ts +147 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +127 -0
- package/dist/timeline.js.map +1 -0
- package/dist/toast.d.ts +164 -0
- package/dist/toast.d.ts.map +1 -0
- package/dist/toast.js +529 -0
- package/dist/toast.js.map +1 -0
- package/dist/tokens.d.ts +9 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +9 -0
- package/dist/tokens.js.map +1 -0
- package/dist/tooltip.d.ts +44 -0
- package/dist/tooltip.d.ts.map +1 -0
- package/dist/tooltip.js +88 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/tour.d.ts +218 -0
- package/dist/tour.d.ts.map +1 -0
- package/dist/tour.js +211 -0
- package/dist/tour.js.map +1 -0
- package/dist/transfer-list.d.ts +207 -0
- package/dist/transfer-list.d.ts.map +1 -0
- package/dist/transfer-list.js +193 -0
- package/dist/transfer-list.js.map +1 -0
- package/dist/tree-select.d.ts +78 -0
- package/dist/tree-select.d.ts.map +1 -0
- package/dist/tree-select.js +132 -0
- package/dist/tree-select.js.map +1 -0
- package/dist/tree.d.ts +206 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +223 -0
- package/dist/tree.js.map +1 -0
- package/dist/upload-item.d.ts +173 -0
- package/dist/upload-item.d.ts.map +1 -0
- package/dist/upload-item.js +156 -0
- package/dist/upload-item.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/docs/affix.md +63 -0
- package/docs/anchor.md +59 -0
- package/docs/ant-design-coverage.md +119 -0
- package/docs/app-provider.md +50 -0
- package/docs/app-rn-adoption.md +227 -0
- package/docs/architecture.md +320 -0
- package/docs/authoring-brief.md +87 -0
- package/docs/border-beam.md +66 -0
- package/docs/bottom-navigation.md +127 -0
- package/docs/breadcrumb.md +82 -0
- package/docs/calendar.md +154 -0
- package/docs/carousel.md +130 -0
- package/docs/cascader.md +93 -0
- package/docs/catalog-decision-status.md +306 -0
- package/docs/color-picker.md +72 -0
- package/docs/command-palette.md +116 -0
- package/docs/confirm-popover.md +93 -0
- package/docs/consistency-audit.md +383 -0
- package/docs/consumer-release-gate.md +90 -0
- package/docs/content-state.md +156 -0
- package/docs/context-panel.md +88 -0
- package/docs/cross-platform-core-normalization.md +118 -0
- package/docs/data-table.md +79 -0
- package/docs/date-picker.md +84 -0
- package/docs/description-list.md +75 -0
- package/docs/design-system-provider.md +139 -0
- package/docs/dropdown.md +78 -0
- package/docs/expansion-roadmap.md +285 -0
- package/docs/file-picker.md +59 -0
- package/docs/floating-action-button.md +111 -0
- package/docs/form.md +134 -0
- package/docs/generated/component-maturity.md +103 -0
- package/docs/generated/renderer-evidence.json +5597 -0
- package/docs/generated/renderer-evidence.md +132 -0
- package/docs/generated/showcase-manifest.json +3732 -0
- package/docs/icon.md +22 -0
- package/docs/identity.md +121 -0
- package/docs/image.md +84 -0
- package/docs/implementation-0.5.md +85 -0
- package/docs/layout-primitives.md +107 -0
- package/docs/layout.md +83 -0
- package/docs/library-reference-decisions.md +123 -0
- package/docs/link.md +67 -0
- package/docs/load-more.md +31 -0
- package/docs/mentions.md +82 -0
- package/docs/migration-0.2.md +108 -0
- package/docs/migration-0.3.md +72 -0
- package/docs/migration-0.5.md +82 -0
- package/docs/migration-0.6.md +197 -0
- package/docs/notification.md +54 -0
- package/docs/number-field.md +82 -0
- package/docs/otp-field.md +103 -0
- package/docs/pagination.md +139 -0
- package/docs/password-field.md +98 -0
- package/docs/popover.md +124 -0
- package/docs/promotion-candidates.md +169 -0
- package/docs/qr-code.md +69 -0
- package/docs/rating.md +58 -0
- package/docs/responsive-grid.md +90 -0
- package/docs/result.md +96 -0
- package/docs/showcase.md +97 -0
- package/docs/side-panel.md +71 -0
- package/docs/slider.md +79 -0
- package/docs/splitter.md +55 -0
- package/docs/statistic.md +16 -0
- package/docs/steps.md +115 -0
- package/docs/tag.md +57 -0
- package/docs/time-picker.md +88 -0
- package/docs/timeline.md +146 -0
- package/docs/toast.md +127 -0
- package/docs/tooltip.md +58 -0
- package/docs/tour.md +136 -0
- package/docs/transfer-list.md +94 -0
- package/docs/tree-select.md +101 -0
- package/docs/tree.md +123 -0
- package/docs/upload-item.md +68 -0
- package/docs/utility.md +53 -0
- package/docs/virtual-list.md +70 -0
- package/docs/watermark.md +58 -0
- package/package.json +402 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipes.js","sourceRoot":"","sources":["../src/recipes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,eAAe,EACf,eAAe,EACf,aAAa,GAQd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AAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export {\n buttonRecipe,\n fieldRecipe,\n surfaceDefaults,\n surfaceGeometry,\n surfaceRecipe,\n type ButtonSize,\n type ButtonTone,\n type FieldShape,\n type FieldVariant,\n type SurfacePadding,\n type SurfaceRadius,\n type SurfaceTone,\n} from \"./base-recipes.js\";\n\nexport {\n accordionRecipe,\n alertDialogRecipe,\n avatarRecipe,\n badgeRecipe,\n bottomNavigationRecipe,\n bottomCtaRecipe,\n chipRecipe,\n comboboxRecipe,\n counterBadgeRecipe,\n dialogRecipe,\n dividerRecipe,\n emptyStateRecipe,\n formatCounterBadgeCount,\n iconButtonRecipe,\n iconRecipe,\n linkRecipe,\n listRecipe,\n listRowRecipe,\n loadMoreRecipe,\n menuRecipe,\n noticeRecipe,\n progressRecipe,\n searchFieldRecipe,\n selectRecipe,\n selectionGroupRecipe,\n sectionRecipe,\n segmentedControlRecipe,\n selectionControlRecipe,\n sheetRecipe,\n skeletonRecipe,\n spinnerRecipe,\n stackRecipe,\n statisticRecipe,\n switchRecipe,\n tabsRecipe,\n textRecipe,\n toastRecipe,\n tooltipRecipe,\n topBarRecipe,\n type AccordionDensity,\n type AlertDialogTone,\n type AvatarShape,\n type AvatarSize,\n type BadgeSize,\n type BadgeTone,\n type BadgeVariant,\n type BottomNavigationDensity,\n type BottomNavigationDistribution,\n type BottomNavigationPresentation,\n type ChipSize,\n type SelectDensity,\n type SelectSize,\n type CounterBadgeSize,\n type CounterBadgeTone,\n type CounterBadgeVariant,\n type DialogSize,\n type IconButtonShape,\n type IconButtonSize,\n type IconTone,\n type IconWeight,\n type LinkTone,\n type LinkVariant,\n type LoadMoreDensity,\n type ListRowDensity,\n type MenuDensity,\n type MenuItemTone,\n type NoticeTone,\n type ProgressSize,\n type ProgressTone,\n type SearchFieldSize,\n type SegmentedControlSize,\n type SelectionControlKind,\n type SelectionControlPresentation,\n type SelectionControlSize,\n type SelectionGroupOrientation,\n type SelectionGroupPresentation,\n type SpinnerSize,\n type SpinnerTone,\n type StackAlign,\n type StackAxis,\n type StackGap,\n type StackJustify,\n type StatisticDensity,\n type StatisticPresentation,\n type SwitchSize,\n type TabSize,\n type TabsLayout,\n type TabsOverflow,\n type TextEmphasis,\n type TextTone,\n type ToastPlacement,\n type ToastTone,\n type ToastToneMark,\n} from \"./component-recipes.js\";\n\n/*\n Batch 2 저작 모듈의 시각 recipe.\n\n 각 컴포넌트의 계약·recipe·행동을 한 모듈에 자급자족으로 담고, 여기서는 **경로만**\n 모은다(`docs/authoring-brief.md`). 여러 저작자가 병렬로 작업할 때 공유 레지스트리를\n 각자 고치면 서로의 변경을 덮어쓰므로, 배선은 리드가 한 번에 한다.\n\n recipe 본문을 `component-recipes.ts`로 옮기지 않는 이유: 그 파일은 이미 1,500줄이 넘고,\n 계약(타입·validator·resolver)과 recipe가 **같은 컴포넌트를 두 파일로 갈라** 놓으면\n 둘이 어긋날 자리가 생긴다. 한 컴포넌트는 한 모듈에 둔다.\n*/\nexport { breadcrumbRecipe } from \"./breadcrumb.js\";\nexport { cardRecipe, type CardHeadingLevel } from \"./card.js\";\nexport { calendarRecipe } from \"./calendar.js\";\nexport { carouselRecipe } from \"./carousel.js\";\nexport { commandPaletteRecipe } from \"./command-palette.js\";\nexport { dataTableRecipe } from \"./data-table.js\";\nexport { transferListRecipe } from \"./transfer-list.js\";\n// floatingActionButtonRecipe는 여기서 재수출하지 않는다. 이 모듈이 buttonRecipe를\n// 정의하는데 floating-action-button.ts가 그것을 import하므로, 여기에 `export ... from`을\n// 두면 순환이 된다 — ESM은 재수출을 본문보다 먼저 평가해서 buttonRecipe가 아직\n// undefined인 채로 그 모듈이 실행된다. catalog.ts가 해당 모듈에서 직접 가져간다.\nexport { tourRecipe } from \"./tour.js\";\nexport { layoutRecipe } from \"./layout.js\";\nexport { otpFieldRecipe } from \"./otp-field.js\";\nexport { passwordFieldRecipe } from \"./password-field.js\";\nexport { splitterRecipe } from \"./splitter.js\";\nexport { datePickerRecipe } from \"./date-picker.js\";\nexport { descriptionListRecipe } from \"./description-list.js\";\nexport { filePickerRecipe } from \"./file-picker.js\";\nexport { formRecipe } from \"./form.js\";\nexport { imageRecipe } from \"./image.js\";\nexport { numberFieldRecipe } from \"./number-field.js\";\nexport { paginationRecipe } from \"./pagination.js\";\nexport { popoverRecipe } from \"./popover.js\";\nexport { resultRecipe } from \"./result.js\";\nexport { sliderRecipe } from \"./slider.js\";\nexport { stepsRecipe } from \"./steps.js\";\nexport { tagRecipe } from \"./tag.js\";\nexport { sidePanelRecipe } from \"./side-panel.js\";\nexport { timelineRecipe } from \"./timeline.js\";\nexport { treeRecipe } from \"./tree.js\";\nexport { uploadItemRecipe } from \"./upload-item.js\";\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Width classes are shared semantic names, not device categories. Web uses
|
|
3
|
+
* CSS pixels and Native uses density-independent points for the same numeric
|
|
4
|
+
* thresholds.
|
|
5
|
+
*/
|
|
6
|
+
export declare const windowClassOrder: readonly ["compact", "medium", "expanded", "wide"];
|
|
7
|
+
export type WindowClass = (typeof windowClassOrder)[number];
|
|
8
|
+
/**
|
|
9
|
+
* `compact` is the required baseline. Missing larger classes inherit the
|
|
10
|
+
* closest value declared at a narrower class, so sparse maps stay total.
|
|
11
|
+
*/
|
|
12
|
+
export type ResponsiveValue<Value> = Readonly<{
|
|
13
|
+
compact: Value;
|
|
14
|
+
medium?: Value;
|
|
15
|
+
expanded?: Value;
|
|
16
|
+
wide?: Value;
|
|
17
|
+
}>;
|
|
18
|
+
/** Validates only the responsive map shape; the owning contract validates each value. */
|
|
19
|
+
export declare function validateResponsiveValue<Value>(value: ResponsiveValue<Value>): void;
|
|
20
|
+
/** Resolves the shared width class at the inclusive foundation thresholds. */
|
|
21
|
+
export declare function resolveWindowClass(windowWidth: number): WindowClass;
|
|
22
|
+
/**
|
|
23
|
+
* Resolves an exact class override or walks toward compact until a declared
|
|
24
|
+
* value is found. The required compact baseline makes the result total.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveResponsiveValue<Value>(value: ResponsiveValue<Value>, windowClass: WindowClass): Value;
|
|
27
|
+
//# sourceMappingURL=responsive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responsive.d.ts","sourceRoot":"","sources":["../src/responsive.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,oDAK4B,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,KAAK,IAAI,QAAQ,CAAC;IAC5C,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,CAAC,CAAC;AAQH,yFAAyF;AACzF,wBAAgB,uBAAuB,CAAC,KAAK,EAC3C,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,GAC5B,IAAI,CAYN;AAED,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,CAenE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAC1C,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,EAC7B,WAAW,EAAE,WAAW,GACvB,KAAK,CAgBP"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { breakpoint } from "./foundations.js";
|
|
2
|
+
/**
|
|
3
|
+
* Width classes are shared semantic names, not device categories. Web uses
|
|
4
|
+
* CSS pixels and Native uses density-independent points for the same numeric
|
|
5
|
+
* thresholds.
|
|
6
|
+
*/
|
|
7
|
+
export const windowClassOrder = [
|
|
8
|
+
"compact",
|
|
9
|
+
"medium",
|
|
10
|
+
"expanded",
|
|
11
|
+
"wide",
|
|
12
|
+
];
|
|
13
|
+
const windowClasses = new Set(windowClassOrder);
|
|
14
|
+
function isRecord(value) {
|
|
15
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
16
|
+
}
|
|
17
|
+
/** Validates only the responsive map shape; the owning contract validates each value. */
|
|
18
|
+
export function validateResponsiveValue(value) {
|
|
19
|
+
if (!isRecord(value)) {
|
|
20
|
+
throw new TypeError("ResponsiveValue must be an object");
|
|
21
|
+
}
|
|
22
|
+
for (const key of Object.keys(value)) {
|
|
23
|
+
if (!windowClasses.has(key)) {
|
|
24
|
+
throw new TypeError(`Unsupported ResponsiveValue window class: ${key}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (!Object.hasOwn(value, "compact")) {
|
|
28
|
+
throw new TypeError("ResponsiveValue requires a compact baseline");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Resolves the shared width class at the inclusive foundation thresholds. */
|
|
32
|
+
export function resolveWindowClass(windowWidth) {
|
|
33
|
+
if (typeof windowWidth !== "number" || !Number.isFinite(windowWidth)) {
|
|
34
|
+
throw new TypeError("Window width must be a finite number");
|
|
35
|
+
}
|
|
36
|
+
if (windowWidth < 0) {
|
|
37
|
+
throw new RangeError("Window width must not be negative");
|
|
38
|
+
}
|
|
39
|
+
for (let index = windowClassOrder.length - 1; index >= 0; index -= 1) {
|
|
40
|
+
const windowClass = windowClassOrder[index];
|
|
41
|
+
if (windowWidth >= breakpoint[windowClass])
|
|
42
|
+
return windowClass;
|
|
43
|
+
}
|
|
44
|
+
// `breakpoint.compact` is zero, so every validated width returns above.
|
|
45
|
+
return "compact";
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolves an exact class override or walks toward compact until a declared
|
|
49
|
+
* value is found. The required compact baseline makes the result total.
|
|
50
|
+
*/
|
|
51
|
+
export function resolveResponsiveValue(value, windowClass) {
|
|
52
|
+
validateResponsiveValue(value);
|
|
53
|
+
if (!windowClasses.has(windowClass)) {
|
|
54
|
+
throw new TypeError(`Unsupported window class: ${String(windowClass)}`);
|
|
55
|
+
}
|
|
56
|
+
const activeIndex = windowClassOrder.indexOf(windowClass);
|
|
57
|
+
for (let index = activeIndex; index >= 0; index -= 1) {
|
|
58
|
+
const candidate = windowClassOrder[index];
|
|
59
|
+
if (Object.hasOwn(value, candidate)) {
|
|
60
|
+
return value[candidate];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// `validateResponsiveValue` guarantees the compact property exists.
|
|
64
|
+
return value.compact;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=responsive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responsive.js","sourceRoot":"","sources":["../src/responsive.ts"],"names":[],"mappings":"AAAA,OAAO,EA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,CAAC;IAC5D,CAAC;IAED,KAAK,IAAI,KAAK,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrE,MAAM,WAAW,GAAG,gBAAgB,CAAC,KAAK,CAAE,CAAC;QAC7C,IAAI,WAAW,IAAI,UAAU,CAAC,WAAW,CAAC;YAAE,OAAO,WAAW,CAAC;IACjE,CAAC;IAED,wEAAwE;IACxE,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAA6B,EAC7B,WAAwB;IAExB,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,SAAS,CAAC,6BAA6B,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1D,KAAK,IAAI,KAAK,GAAG,WAAW,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,CAAE,CAAC;QAC3C,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;YACpC,OAAO,KAAK,CAAC,SAAS,CAAU,CAAC;QACnC,CAAC;IACH,CAAC;IAED,oEAAoE;IACpE,OAAO,KAAK,CAAC,OAAO,CAAC;AACvB,CAAC","sourcesContent":["import { breakpoint } from \"./foundations.js\";\n\n/**\n * Width classes are shared semantic names, not device categories. Web uses\n * CSS pixels and Native uses density-independent points for the same numeric\n * thresholds.\n */\nexport const windowClassOrder = [\n \"compact\",\n \"medium\",\n \"expanded\",\n \"wide\",\n] as const satisfies readonly (keyof typeof breakpoint)[];\n\nexport type WindowClass = (typeof windowClassOrder)[number];\n\n/**\n * `compact` is the required baseline. Missing larger classes inherit the\n * closest value declared at a narrower class, so sparse maps stay total.\n */\nexport type ResponsiveValue<Value> = Readonly<{\n compact: Value;\n medium?: Value;\n expanded?: Value;\n wide?: Value;\n}>;\n\nconst windowClasses = new Set<WindowClass>(windowClassOrder);\n\nfunction isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\n/** Validates only the responsive map shape; the owning contract validates each value. */\nexport function validateResponsiveValue<Value>(\n value: ResponsiveValue<Value>,\n): void {\n if (!isRecord(value)) {\n throw new TypeError(\"ResponsiveValue must be an object\");\n }\n for (const key of Object.keys(value)) {\n if (!windowClasses.has(key as WindowClass)) {\n throw new TypeError(`Unsupported ResponsiveValue window class: ${key}`);\n }\n }\n if (!Object.hasOwn(value, \"compact\")) {\n throw new TypeError(\"ResponsiveValue requires a compact baseline\");\n }\n}\n\n/** Resolves the shared width class at the inclusive foundation thresholds. */\nexport function resolveWindowClass(windowWidth: number): WindowClass {\n if (typeof windowWidth !== \"number\" || !Number.isFinite(windowWidth)) {\n throw new TypeError(\"Window width must be a finite number\");\n }\n if (windowWidth < 0) {\n throw new RangeError(\"Window width must not be negative\");\n }\n\n for (let index = windowClassOrder.length - 1; index >= 0; index -= 1) {\n const windowClass = windowClassOrder[index]!;\n if (windowWidth >= breakpoint[windowClass]) return windowClass;\n }\n\n // `breakpoint.compact` is zero, so every validated width returns above.\n return \"compact\";\n}\n\n/**\n * Resolves an exact class override or walks toward compact until a declared\n * value is found. The required compact baseline makes the result total.\n */\nexport function resolveResponsiveValue<Value>(\n value: ResponsiveValue<Value>,\n windowClass: WindowClass,\n): Value {\n validateResponsiveValue(value);\n if (!windowClasses.has(windowClass)) {\n throw new TypeError(`Unsupported window class: ${String(windowClass)}`);\n }\n\n const activeIndex = windowClassOrder.indexOf(windowClass);\n for (let index = activeIndex; index >= 0; index -= 1) {\n const candidate = windowClassOrder[index]!;\n if (Object.hasOwn(value, candidate)) {\n return value[candidate] as Value;\n }\n }\n\n // `validateResponsiveValue` guarantees the compact property exists.\n return value.compact;\n}\n"]}
|
package/dist/result.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web-page HTTP status vocabulary (403/404/500) does not belong in a
|
|
3
|
+
* platform-neutral contract. Products/adapters translate those into
|
|
4
|
+
* `failure` with their own localized copy.
|
|
5
|
+
*/
|
|
6
|
+
export type ResultStatus = "success" | "failure" | "info";
|
|
7
|
+
export declare const resultDefaults: {
|
|
8
|
+
readonly status: "info";
|
|
9
|
+
};
|
|
10
|
+
export type ResultActionDescriptor = Readonly<{
|
|
11
|
+
label: string;
|
|
12
|
+
accessibilityLabel?: string;
|
|
13
|
+
onAction(): void;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* A flow terminus screen (success, failure, 404-equivalent). Unlike
|
|
17
|
+
* `EmptyState`, which describes a place that can still be filled, Result
|
|
18
|
+
* means this flow ends here — there is no pending content to wait for.
|
|
19
|
+
*
|
|
20
|
+
* `actions` holds at most one primary and one optional secondary action;
|
|
21
|
+
* the first entry is the primary. A third action is refused, not silently
|
|
22
|
+
* dropped, so a screen author notices instead of shipping a truncated row.
|
|
23
|
+
*/
|
|
24
|
+
export type ResultDescriptor = Readonly<{
|
|
25
|
+
status: ResultStatus;
|
|
26
|
+
title: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
actions?: readonly ResultActionDescriptor[];
|
|
29
|
+
}>;
|
|
30
|
+
export type ResolvedResultActionDescriptor = Readonly<{
|
|
31
|
+
label: string;
|
|
32
|
+
accessibilityLabel: string;
|
|
33
|
+
onAction(): void;
|
|
34
|
+
}>;
|
|
35
|
+
export type ResolvedResultDescriptor = Readonly<{
|
|
36
|
+
status: ResultStatus;
|
|
37
|
+
title: string;
|
|
38
|
+
description: string | null;
|
|
39
|
+
primaryAction: ResolvedResultActionDescriptor | null;
|
|
40
|
+
secondaryAction: ResolvedResultActionDescriptor | null;
|
|
41
|
+
}>;
|
|
42
|
+
export declare function validateResultAction(action: ResultActionDescriptor, field: string): void;
|
|
43
|
+
export declare function validateResultDescriptor(descriptor: ResultDescriptor): void;
|
|
44
|
+
export declare function resolveResultDescriptor(descriptor: ResultDescriptor): ResolvedResultDescriptor;
|
|
45
|
+
export declare const resultRecipe: {
|
|
46
|
+
readonly slots: readonly ["root", "icon", "title", "description", "primaryAction", "secondaryAction"];
|
|
47
|
+
readonly defaults: {
|
|
48
|
+
readonly status: "info";
|
|
49
|
+
};
|
|
50
|
+
readonly tones: {
|
|
51
|
+
readonly success: {
|
|
52
|
+
readonly icon: Readonly<{
|
|
53
|
+
source: "accent";
|
|
54
|
+
key: "success";
|
|
55
|
+
alpha?: number;
|
|
56
|
+
}>;
|
|
57
|
+
readonly iconBackground: Readonly<{
|
|
58
|
+
source: "accent";
|
|
59
|
+
key: "success";
|
|
60
|
+
alpha?: number;
|
|
61
|
+
}>;
|
|
62
|
+
};
|
|
63
|
+
readonly failure: {
|
|
64
|
+
readonly icon: Readonly<{
|
|
65
|
+
source: "theme";
|
|
66
|
+
key: "danger";
|
|
67
|
+
alpha?: number;
|
|
68
|
+
}>;
|
|
69
|
+
readonly iconBackground: Readonly<{
|
|
70
|
+
source: "theme";
|
|
71
|
+
key: "danger";
|
|
72
|
+
alpha?: number;
|
|
73
|
+
}>;
|
|
74
|
+
};
|
|
75
|
+
readonly info: {
|
|
76
|
+
readonly icon: Readonly<{
|
|
77
|
+
source: "accent";
|
|
78
|
+
key: "info";
|
|
79
|
+
alpha?: number;
|
|
80
|
+
}>;
|
|
81
|
+
readonly iconBackground: Readonly<{
|
|
82
|
+
source: "accent";
|
|
83
|
+
key: "info";
|
|
84
|
+
alpha?: number;
|
|
85
|
+
}>;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
readonly iconSize: "xl";
|
|
89
|
+
readonly paddingVertical: 40;
|
|
90
|
+
readonly paddingHorizontal: 24;
|
|
91
|
+
readonly gap: 12;
|
|
92
|
+
readonly title: {
|
|
93
|
+
readonly textVariant: "titleLarge";
|
|
94
|
+
readonly color: Readonly<{
|
|
95
|
+
source: "theme";
|
|
96
|
+
key: "text";
|
|
97
|
+
alpha?: number;
|
|
98
|
+
}>;
|
|
99
|
+
readonly fontWeight: "700";
|
|
100
|
+
};
|
|
101
|
+
readonly description: {
|
|
102
|
+
readonly textVariant: "body";
|
|
103
|
+
readonly color: Readonly<{
|
|
104
|
+
source: "theme";
|
|
105
|
+
key: "textMuted";
|
|
106
|
+
alpha?: number;
|
|
107
|
+
}>;
|
|
108
|
+
};
|
|
109
|
+
readonly actionsGap: 12;
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1D,eAAO,MAAM,cAAc;;CAE4B,CAAC;AAExD,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,IAAI,IAAI,CAAC;CAClB,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;CAC7C,CAAC,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,QAAQ,CAAC;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,IAAI,IAAI,CAAC;CAClB,CAAC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC9C,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,8BAA8B,GAAG,IAAI,CAAC;IACrD,eAAe,EAAE,8BAA8B,GAAG,IAAI,CAAC;CACxD,CAAC,CAAC;AAQH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,sBAAsB,EAC9B,KAAK,EAAE,MAAM,GACZ,IAAI,CAQN;AAED,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAqB3E;AAaD,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,gBAAgB,GAC3B,wBAAwB,CAU1B;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCf,CAAC"}
|
package/dist/result.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { semanticColors } from "./semantic-colors.js";
|
|
2
|
+
import { fontWeight, spacing } from "./foundations.js";
|
|
3
|
+
export const resultDefaults = {
|
|
4
|
+
status: "info",
|
|
5
|
+
};
|
|
6
|
+
function assertCopy(value, field) {
|
|
7
|
+
if (value.trim().length === 0) {
|
|
8
|
+
throw new TypeError(`Result ${field} must not be empty`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function validateResultAction(action, field) {
|
|
12
|
+
assertCopy(action.label, `${field}.label`);
|
|
13
|
+
if (action.accessibilityLabel !== undefined) {
|
|
14
|
+
assertCopy(action.accessibilityLabel, `${field}.accessibilityLabel`);
|
|
15
|
+
}
|
|
16
|
+
if (typeof action.onAction !== "function") {
|
|
17
|
+
throw new TypeError(`Result ${field}.onAction must be a function`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function validateResultDescriptor(descriptor) {
|
|
21
|
+
if (descriptor.status !== "success" &&
|
|
22
|
+
descriptor.status !== "failure" &&
|
|
23
|
+
descriptor.status !== "info") {
|
|
24
|
+
throw new TypeError(`Unsupported Result status: ${String(descriptor.status)}`);
|
|
25
|
+
}
|
|
26
|
+
assertCopy(descriptor.title, "title");
|
|
27
|
+
if (descriptor.description !== undefined) {
|
|
28
|
+
assertCopy(descriptor.description, "description");
|
|
29
|
+
}
|
|
30
|
+
const actions = descriptor.actions ?? [];
|
|
31
|
+
if (actions.length > 2) {
|
|
32
|
+
throw new RangeError("Result supports at most one primary and one secondary action");
|
|
33
|
+
}
|
|
34
|
+
actions.forEach((action, index) => {
|
|
35
|
+
validateResultAction(action, index === 0 ? "primaryAction" : "secondaryAction");
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function resolveAction(action) {
|
|
39
|
+
if (!action)
|
|
40
|
+
return null;
|
|
41
|
+
return {
|
|
42
|
+
label: action.label,
|
|
43
|
+
accessibilityLabel: action.accessibilityLabel ?? action.label,
|
|
44
|
+
onAction: action.onAction,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function resolveResultDescriptor(descriptor) {
|
|
48
|
+
validateResultDescriptor(descriptor);
|
|
49
|
+
const actions = descriptor.actions ?? [];
|
|
50
|
+
return {
|
|
51
|
+
status: descriptor.status,
|
|
52
|
+
title: descriptor.title,
|
|
53
|
+
description: descriptor.description ?? null,
|
|
54
|
+
primaryAction: resolveAction(actions[0]),
|
|
55
|
+
secondaryAction: resolveAction(actions[1]),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export const resultRecipe = {
|
|
59
|
+
slots: [
|
|
60
|
+
"root",
|
|
61
|
+
"icon",
|
|
62
|
+
"title",
|
|
63
|
+
"description",
|
|
64
|
+
"primaryAction",
|
|
65
|
+
"secondaryAction",
|
|
66
|
+
],
|
|
67
|
+
defaults: resultDefaults,
|
|
68
|
+
tones: {
|
|
69
|
+
success: {
|
|
70
|
+
icon: semanticColors.feedback.success.foreground,
|
|
71
|
+
iconBackground: semanticColors.feedback.success.badgeBackground,
|
|
72
|
+
},
|
|
73
|
+
failure: {
|
|
74
|
+
icon: semanticColors.feedback.danger.foreground,
|
|
75
|
+
iconBackground: semanticColors.feedback.danger.badgeBackground,
|
|
76
|
+
},
|
|
77
|
+
info: {
|
|
78
|
+
icon: semanticColors.feedback.info.foreground,
|
|
79
|
+
iconBackground: semanticColors.feedback.info.badgeBackground,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
iconSize: "xl",
|
|
83
|
+
paddingVertical: spacing.xxxl,
|
|
84
|
+
paddingHorizontal: spacing.xl,
|
|
85
|
+
gap: spacing.sm,
|
|
86
|
+
title: {
|
|
87
|
+
textVariant: "titleLarge",
|
|
88
|
+
color: semanticColors.content.primary,
|
|
89
|
+
fontWeight: fontWeight.bold,
|
|
90
|
+
},
|
|
91
|
+
description: {
|
|
92
|
+
textVariant: "body",
|
|
93
|
+
color: semanticColors.content.secondary,
|
|
94
|
+
},
|
|
95
|
+
actionsGap: spacing.sm,
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AASvD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,MAAM,EAAE,MAAM;CACuC,CAAC;AAsCxD,SAAS,UAAU,CAAC,KAAa,EAAE,KAAa;IAC9C,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,SAAS,CAAC,UAAU,KAAK,oBAAoB,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,MAA8B,EA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C,QAAQ,CAAC,IAAI,CAAC,eAAe;SAC7D;KACF;IACD,QAAQ,EAAE,IAAI;IACd,eAAe,EAAE,OAAO,CAAC,IAAI;IAC7B,iBAAiB,EAAE,OAAO,CAAC,EAAE;IAC7B,GAAG,EAAE,OAAO,CAAC,EAAE;IACf,KAAK,EAAE;QACL,WAAW,EAAE,YAAY;QACzB,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,OAAO;QACrC,UAAU,EAAE,UAAU,CAAC,IAAI;KAC5B;IACD,WAAW,EAAE;QACX,WAAW,EAAE,MAAM;QACnB,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,SAAS;KACxC;IACD,UAAU,EAAE,OAAO,CAAC,EAAE;CACd,CAAC","sourcesContent":["import { semanticColors } from \"./semantic-colors.js\";\nimport { fontWeight, spacing } from \"./foundations.js\";\n\n/**\n * Web-page HTTP status vocabulary (403/404/500) does not belong in a\n * platform-neutral contract. Products/adapters translate those into\n * `failure` with their own localized copy.\n */\nexport type ResultStatus = \"success\" | \"failure\" | \"info\";\n\nexport const resultDefaults = {\n status: \"info\",\n} as const satisfies Readonly<{ status: ResultStatus }>;\n\nexport type ResultActionDescriptor = Readonly<{\n label: string;\n accessibilityLabel?: string;\n onAction(): void;\n}>;\n\n/**\n * A flow terminus screen (success, failure, 404-equivalent). Unlike\n * `EmptyState`, which describes a place that can still be filled, Result\n * means this flow ends here — there is no pending content to wait for.\n *\n * `actions` holds at most one primary and one optional secondary action;\n * the first entry is the primary. A third action is refused, not silently\n * dropped, so a screen author notices instead of shipping a truncated row.\n */\nexport type ResultDescriptor = Readonly<{\n status: ResultStatus;\n title: string;\n description?: string;\n actions?: readonly ResultActionDescriptor[];\n}>;\n\nexport type ResolvedResultActionDescriptor = Readonly<{\n label: string;\n accessibilityLabel: string;\n onAction(): void;\n}>;\n\nexport type ResolvedResultDescriptor = Readonly<{\n status: ResultStatus;\n title: string;\n description: string | null;\n primaryAction: ResolvedResultActionDescriptor | null;\n secondaryAction: ResolvedResultActionDescriptor | null;\n}>;\n\nfunction assertCopy(value: string, field: string): void {\n if (value.trim().length === 0) {\n throw new TypeError(`Result ${field} must not be empty`);\n }\n}\n\nexport function validateResultAction(\n action: ResultActionDescriptor,\n field: string,\n): void {\n assertCopy(action.label, `${field}.label`);\n if (action.accessibilityLabel !== undefined) {\n assertCopy(action.accessibilityLabel, `${field}.accessibilityLabel`);\n }\n if (typeof action.onAction !== \"function\") {\n throw new TypeError(`Result ${field}.onAction must be a function`);\n }\n}\n\nexport function validateResultDescriptor(descriptor: ResultDescriptor): void {\n if (\n descriptor.status !== \"success\" &&\n descriptor.status !== \"failure\" &&\n descriptor.status !== \"info\"\n ) {\n throw new TypeError(`Unsupported Result status: ${String(descriptor.status)}`);\n }\n assertCopy(descriptor.title, \"title\");\n if (descriptor.description !== undefined) {\n assertCopy(descriptor.description, \"description\");\n }\n const actions = descriptor.actions ?? [];\n if (actions.length > 2) {\n throw new RangeError(\n \"Result supports at most one primary and one secondary action\",\n );\n }\n actions.forEach((action, index) => {\n validateResultAction(action, index === 0 ? \"primaryAction\" : \"secondaryAction\");\n });\n}\n\nfunction resolveAction(\n action: ResultActionDescriptor | undefined,\n): ResolvedResultActionDescriptor | null {\n if (!action) return null;\n return {\n label: action.label,\n accessibilityLabel: action.accessibilityLabel ?? action.label,\n onAction: action.onAction,\n };\n}\n\nexport function resolveResultDescriptor(\n descriptor: ResultDescriptor,\n): ResolvedResultDescriptor {\n validateResultDescriptor(descriptor);\n const actions = descriptor.actions ?? [];\n return {\n status: descriptor.status,\n title: descriptor.title,\n description: descriptor.description ?? null,\n primaryAction: resolveAction(actions[0]),\n secondaryAction: resolveAction(actions[1]),\n };\n}\n\nexport const resultRecipe = {\n slots: [\n \"root\",\n \"icon\",\n \"title\",\n \"description\",\n \"primaryAction\",\n \"secondaryAction\",\n ] as const,\n defaults: resultDefaults,\n tones: {\n success: {\n icon: semanticColors.feedback.success.foreground,\n iconBackground: semanticColors.feedback.success.badgeBackground,\n },\n failure: {\n icon: semanticColors.feedback.danger.foreground,\n iconBackground: semanticColors.feedback.danger.badgeBackground,\n },\n info: {\n icon: semanticColors.feedback.info.foreground,\n iconBackground: semanticColors.feedback.info.badgeBackground,\n },\n },\n iconSize: \"xl\",\n paddingVertical: spacing.xxxl,\n paddingHorizontal: spacing.xl,\n gap: spacing.sm,\n title: {\n textVariant: \"titleLarge\",\n color: semanticColors.content.primary,\n fontWeight: fontWeight.bold,\n },\n description: {\n textVariant: \"body\",\n color: semanticColors.content.secondary,\n },\n actionsGap: spacing.sm,\n} as const;\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type CheckboxState = boolean | "mixed";
|
|
2
|
+
export type MixedCheckboxActivation = "check" | "uncheck";
|
|
3
|
+
/** Minimum collection shape needed by checkbox selection algorithms. */
|
|
4
|
+
export type CheckboxSelectionItem<Key extends string = string> = Readonly<{
|
|
5
|
+
id: Key;
|
|
6
|
+
label: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const checkboxBehaviorDefaults: {
|
|
11
|
+
readonly mixedActivation: "check";
|
|
12
|
+
};
|
|
13
|
+
export declare function getCheckboxNextState(current: CheckboxState, mixedActivation?: MixedCheckboxActivation): boolean;
|
|
14
|
+
export declare function toggleCheckboxSelection<Key extends string>(items: readonly CheckboxSelectionItem<Key>[], current: ReadonlySet<Key>, id: Key): ReadonlySet<Key>;
|
|
15
|
+
export declare function reconcileCheckboxSelection<Key extends string>(items: readonly CheckboxSelectionItem<Key>[], current: ReadonlySet<Key>): ReadonlySet<Key>;
|
|
16
|
+
//# sourceMappingURL=selection-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-helpers.d.ts","sourceRoot":"","sources":["../src/selection-helpers.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;AAC9C,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,SAAS,CAAC;AAE1D,wEAAwE;AACxE,MAAM,MAAM,qBAAqB,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IACxE,EAAE,EAAE,GAAG,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;CAEsC,CAAC;AA4B5E,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,aAAa,EACtB,eAAe,GAAE,uBAAkE,GAClF,OAAO,CAET;AAED,wBAAgB,uBAAuB,CAAC,GAAG,SAAS,MAAM,EACxD,KAAK,EAAE,SAAS,qBAAqB,CAAC,GAAG,CAAC,EAAE,EAC5C,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,EACzB,EAAE,EAAE,GAAG,GACN,WAAW,CAAC,GAAG,CAAC,CAgBlB;AAED,wBAAgB,0BAA0B,CAAC,GAAG,SAAS,MAAM,EAC3D,KAAK,EAAE,SAAS,qBAAqB,CAAC,GAAG,CAAC,EAAE,EAC5C,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,GACxB,WAAW,CAAC,GAAG,CAAC,CAKlB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const checkboxBehaviorDefaults = {
|
|
2
|
+
mixedActivation: "check",
|
|
3
|
+
};
|
|
4
|
+
function validateCheckboxSelectionItems(items) {
|
|
5
|
+
const ids = new Set();
|
|
6
|
+
for (const item of items) {
|
|
7
|
+
if (typeof item.id !== "string" || item.id.trim().length === 0) {
|
|
8
|
+
throw new TypeError("Selection item id must not be empty");
|
|
9
|
+
}
|
|
10
|
+
if (typeof item.label !== "string" || item.label.trim().length === 0) {
|
|
11
|
+
throw new TypeError(`Selection item ${item.id} label must not be empty`);
|
|
12
|
+
}
|
|
13
|
+
if (item.description !== undefined &&
|
|
14
|
+
(typeof item.description !== "string" || item.description.trim().length === 0)) {
|
|
15
|
+
throw new TypeError(`Selection item ${item.id} description must not be empty when provided`);
|
|
16
|
+
}
|
|
17
|
+
if (ids.has(item.id)) {
|
|
18
|
+
throw new TypeError(`Duplicate selection item id: ${item.id}`);
|
|
19
|
+
}
|
|
20
|
+
ids.add(item.id);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function getCheckboxNextState(current, mixedActivation = checkboxBehaviorDefaults.mixedActivation) {
|
|
24
|
+
return current === "mixed" ? mixedActivation === "check" : !current;
|
|
25
|
+
}
|
|
26
|
+
export function toggleCheckboxSelection(items, current, id) {
|
|
27
|
+
validateCheckboxSelectionItems(items);
|
|
28
|
+
const knownIds = new Set(items.map((item) => item.id));
|
|
29
|
+
for (const selectedId of current) {
|
|
30
|
+
if (!knownIds.has(selectedId)) {
|
|
31
|
+
throw new RangeError(`Selected checkbox must exist: ${selectedId}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const item = items.find((candidate) => candidate.id === id);
|
|
35
|
+
if (!item)
|
|
36
|
+
throw new RangeError(`Checkbox must exist: ${id}`);
|
|
37
|
+
const next = new Set(current);
|
|
38
|
+
if (item.disabled)
|
|
39
|
+
return next;
|
|
40
|
+
if (next.has(id))
|
|
41
|
+
next.delete(id);
|
|
42
|
+
else
|
|
43
|
+
next.add(id);
|
|
44
|
+
return next;
|
|
45
|
+
}
|
|
46
|
+
export function reconcileCheckboxSelection(items, current) {
|
|
47
|
+
validateCheckboxSelectionItems(items);
|
|
48
|
+
const knownIds = new Set(items.map((item) => item.id));
|
|
49
|
+
const reconciled = [...current].filter((id) => knownIds.has(id));
|
|
50
|
+
return reconciled.length === current.size ? current : new Set(reconciled);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=selection-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-helpers.js","sourceRoot":"","sources":["../src/selection-helpers.ts"],"names":[],"mappings":"AA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AC,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACjE,OAAO,UAAU,CAAC,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["export type CheckboxState = boolean | \"mixed\";\nexport type MixedCheckboxActivation = \"check\" | \"uncheck\";\n\n/** Minimum collection shape needed by checkbox selection algorithms. */\nexport type CheckboxSelectionItem<Key extends string = string> = Readonly<{\n id: Key;\n label: string;\n description?: string;\n disabled?: boolean;\n}>;\n\nexport const checkboxBehaviorDefaults = {\n mixedActivation: \"check\",\n} as const satisfies Readonly<{ mixedActivation: MixedCheckboxActivation }>;\n\nfunction validateCheckboxSelectionItems<Key extends string>(\n items: readonly CheckboxSelectionItem<Key>[],\n): void {\n const ids = new Set<Key>();\n for (const item of items) {\n if (typeof item.id !== \"string\" || item.id.trim().length === 0) {\n throw new TypeError(\"Selection item id must not be empty\");\n }\n if (typeof item.label !== \"string\" || item.label.trim().length === 0) {\n throw new TypeError(`Selection item ${item.id} label must not be empty`);\n }\n if (\n item.description !== undefined &&\n (typeof item.description !== \"string\" || item.description.trim().length === 0)\n ) {\n throw new TypeError(\n `Selection item ${item.id} description must not be empty when provided`,\n );\n }\n if (ids.has(item.id)) {\n throw new TypeError(`Duplicate selection item id: ${item.id}`);\n }\n ids.add(item.id);\n }\n}\n\nexport function getCheckboxNextState(\n current: CheckboxState,\n mixedActivation: MixedCheckboxActivation = checkboxBehaviorDefaults.mixedActivation,\n): boolean {\n return current === \"mixed\" ? mixedActivation === \"check\" : !current;\n}\n\nexport function toggleCheckboxSelection<Key extends string>(\n items: readonly CheckboxSelectionItem<Key>[],\n current: ReadonlySet<Key>,\n id: Key,\n): ReadonlySet<Key> {\n validateCheckboxSelectionItems(items);\n const knownIds = new Set(items.map((item) => item.id));\n for (const selectedId of current) {\n if (!knownIds.has(selectedId)) {\n throw new RangeError(`Selected checkbox must exist: ${selectedId}`);\n }\n }\n const item = items.find((candidate) => candidate.id === id);\n if (!item) throw new RangeError(`Checkbox must exist: ${id}`);\n\n const next = new Set(current);\n if (item.disabled) return next;\n if (next.has(id)) next.delete(id);\n else next.add(id);\n return next;\n}\n\nexport function reconcileCheckboxSelection<Key extends string>(\n items: readonly CheckboxSelectionItem<Key>[],\n current: ReadonlySet<Key>,\n): ReadonlySet<Key> {\n validateCheckboxSelectionItems(items);\n const knownIds = new Set(items.map((item) => item.id));\n const reconciled = [...current].filter((id) => knownIds.has(id));\n return reconciled.length === current.size ? current : new Set(reconciled);\n}\n"]}
|