@ezpg/app-ui 0.0.0-stage → 0.1.0
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/CHANGELOG.md +7 -0
- package/LICENSE +20 -0
- package/lib/module/blocks/brand-profile-card/brand-profile-card.js +90 -0
- package/lib/module/blocks/brand-profile-card/brand-profile-card.js.map +1 -0
- package/lib/module/blocks/brand-profile-card/index.js +4 -0
- package/lib/module/blocks/brand-profile-card/index.js.map +1 -0
- package/lib/module/blocks/claim-row/claim-row.js +107 -0
- package/lib/module/blocks/claim-row/claim-row.js.map +1 -0
- package/lib/module/blocks/claim-row/index.js +4 -0
- package/lib/module/blocks/claim-row/index.js.map +1 -0
- package/lib/module/blocks/color-swatch-picker/color-swatch-picker.js +124 -0
- package/lib/module/blocks/color-swatch-picker/color-swatch-picker.js.map +1 -0
- package/lib/module/blocks/color-swatch-picker/index.js +4 -0
- package/lib/module/blocks/color-swatch-picker/index.js.map +1 -0
- package/lib/module/blocks/copy-variant-picker/copy-variant-picker.js +142 -0
- package/lib/module/blocks/copy-variant-picker/copy-variant-picker.js.map +1 -0
- package/lib/module/blocks/copy-variant-picker/index.js +4 -0
- package/lib/module/blocks/copy-variant-picker/index.js.map +1 -0
- package/lib/module/blocks/credit-wallet/credit-wallet.js +123 -0
- package/lib/module/blocks/credit-wallet/credit-wallet.js.map +1 -0
- package/lib/module/blocks/credit-wallet/index.js +4 -0
- package/lib/module/blocks/credit-wallet/index.js.map +1 -0
- package/lib/module/blocks/image-grid/image-grid.js +273 -0
- package/lib/module/blocks/image-grid/image-grid.js.map +1 -0
- package/lib/module/blocks/image-grid/index.js +4 -0
- package/lib/module/blocks/image-grid/index.js.map +1 -0
- package/lib/module/blocks/index.js +22 -0
- package/lib/module/blocks/index.js.map +1 -0
- package/lib/module/blocks/internal/card.js +41 -0
- package/lib/module/blocks/internal/card.js.map +1 -0
- package/lib/module/blocks/internal/format.js +25 -0
- package/lib/module/blocks/internal/format.js.map +1 -0
- package/lib/module/blocks/invoice-row/index.js +4 -0
- package/lib/module/blocks/invoice-row/index.js.map +1 -0
- package/lib/module/blocks/invoice-row/invoice-row.js +101 -0
- package/lib/module/blocks/invoice-row/invoice-row.js.map +1 -0
- package/lib/module/blocks/logo-candidate-grid/index.js +4 -0
- package/lib/module/blocks/logo-candidate-grid/index.js.map +1 -0
- package/lib/module/blocks/logo-candidate-grid/logo-candidate-grid.js +117 -0
- package/lib/module/blocks/logo-candidate-grid/logo-candidate-grid.js.map +1 -0
- package/lib/module/blocks/oauth-buttons/index.js +4 -0
- package/lib/module/blocks/oauth-buttons/index.js.map +1 -0
- package/lib/module/blocks/oauth-buttons/oauth-buttons.js +102 -0
- package/lib/module/blocks/oauth-buttons/oauth-buttons.js.map +1 -0
- package/lib/module/blocks/option-editor/index.js +4 -0
- package/lib/module/blocks/option-editor/index.js.map +1 -0
- package/lib/module/blocks/option-editor/option-editor.js +133 -0
- package/lib/module/blocks/option-editor/option-editor.js.map +1 -0
- package/lib/module/blocks/order-card/index.js +4 -0
- package/lib/module/blocks/order-card/index.js.map +1 -0
- package/lib/module/blocks/order-card/order-card.js +156 -0
- package/lib/module/blocks/order-card/order-card.js.map +1 -0
- package/lib/module/blocks/plan-card/index.js +4 -0
- package/lib/module/blocks/plan-card/index.js.map +1 -0
- package/lib/module/blocks/plan-card/plan-card.js +134 -0
- package/lib/module/blocks/plan-card/plan-card.js.map +1 -0
- package/lib/module/blocks/product-list-empty/index.js +4 -0
- package/lib/module/blocks/product-list-empty/index.js.map +1 -0
- package/lib/module/blocks/product-list-empty/product-list-empty.js +155 -0
- package/lib/module/blocks/product-list-empty/product-list-empty.js.map +1 -0
- package/lib/module/blocks/review-row/index.js +4 -0
- package/lib/module/blocks/review-row/index.js.map +1 -0
- package/lib/module/blocks/review-row/review-row.js +284 -0
- package/lib/module/blocks/review-row/review-row.js.map +1 -0
- package/lib/module/blocks/sales-chart/index.js +4 -0
- package/lib/module/blocks/sales-chart/index.js.map +1 -0
- package/lib/module/blocks/sales-chart/sales-chart.js +126 -0
- package/lib/module/blocks/sales-chart/sales-chart.js.map +1 -0
- package/lib/module/blocks/service-state-banner/index.js +4 -0
- package/lib/module/blocks/service-state-banner/index.js.map +1 -0
- package/lib/module/blocks/service-state-banner/service-state-banner.js +64 -0
- package/lib/module/blocks/service-state-banner/service-state-banner.js.map +1 -0
- package/lib/module/blocks/shipping-tracking-row/index.js +4 -0
- package/lib/module/blocks/shipping-tracking-row/index.js.map +1 -0
- package/lib/module/blocks/shipping-tracking-row/shipping-tracking-row.js +116 -0
- package/lib/module/blocks/shipping-tracking-row/shipping-tracking-row.js.map +1 -0
- package/lib/module/blocks/site-preview-frame/index.js +4 -0
- package/lib/module/blocks/site-preview-frame/index.js.map +1 -0
- package/lib/module/blocks/site-preview-frame/site-preview-frame.js +111 -0
- package/lib/module/blocks/site-preview-frame/site-preview-frame.js.map +1 -0
- package/lib/module/blocks/stat-card/index.js +4 -0
- package/lib/module/blocks/stat-card/index.js.map +1 -0
- package/lib/module/blocks/stat-card/stat-card.js +71 -0
- package/lib/module/blocks/stat-card/stat-card.js.map +1 -0
- package/lib/module/blocks/step-screen/index.js +4 -0
- package/lib/module/blocks/step-screen/index.js.map +1 -0
- package/lib/module/blocks/step-screen/step-screen.js +134 -0
- package/lib/module/blocks/step-screen/step-screen.js.map +1 -0
- package/lib/module/blocks/supply-item-card/index.js +4 -0
- package/lib/module/blocks/supply-item-card/index.js.map +1 -0
- package/lib/module/blocks/supply-item-card/supply-item-card.js +151 -0
- package/lib/module/blocks/supply-item-card/supply-item-card.js.map +1 -0
- package/lib/module/charts/index.js +5 -0
- package/lib/module/charts/index.js.map +1 -0
- package/lib/module/charts/line-chart.js +115 -0
- package/lib/module/charts/line-chart.js.map +1 -0
- package/lib/module/charts/scale.js +45 -0
- package/lib/module/charts/scale.js.map +1 -0
- package/lib/module/charts/sparkline.js +50 -0
- package/lib/module/charts/sparkline.js.map +1 -0
- package/lib/module/charts/summary.js +11 -0
- package/lib/module/charts/summary.js.map +1 -0
- package/lib/module/charts.js +5 -0
- package/lib/module/charts.js.map +1 -0
- package/lib/module/components/button/button.js +122 -0
- package/lib/module/components/button/button.js.map +1 -0
- package/lib/module/components/button/index.js +4 -0
- package/lib/module/components/button/index.js.map +1 -0
- package/lib/module/components/checkbox/checkbox.js +72 -0
- package/lib/module/components/checkbox/checkbox.js.map +1 -0
- package/lib/module/components/checkbox/index.js +4 -0
- package/lib/module/components/checkbox/index.js.map +1 -0
- package/lib/module/components/chip/chip.js +68 -0
- package/lib/module/components/chip/chip.js.map +1 -0
- package/lib/module/components/chip/index.js +4 -0
- package/lib/module/components/chip/index.js.map +1 -0
- package/lib/module/components/chip-group/chip-group.js +55 -0
- package/lib/module/components/chip-group/chip-group.js.map +1 -0
- package/lib/module/components/chip-group/index.js +4 -0
- package/lib/module/components/chip-group/index.js.map +1 -0
- package/lib/module/components/dialog/dialog.js +118 -0
- package/lib/module/components/dialog/dialog.js.map +1 -0
- package/lib/module/components/dialog/index.js +4 -0
- package/lib/module/components/dialog/index.js.map +1 -0
- package/lib/module/components/divider/divider.js +21 -0
- package/lib/module/components/divider/divider.js.map +1 -0
- package/lib/module/components/divider/index.js +4 -0
- package/lib/module/components/divider/index.js.map +1 -0
- package/lib/module/components/empty-state/empty-state.js +126 -0
- package/lib/module/components/empty-state/empty-state.js.map +1 -0
- package/lib/module/components/empty-state/index.js +4 -0
- package/lib/module/components/empty-state/index.js.map +1 -0
- package/lib/module/components/field/field.js +123 -0
- package/lib/module/components/field/field.js.map +1 -0
- package/lib/module/components/field/index.js +4 -0
- package/lib/module/components/field/index.js.map +1 -0
- package/lib/module/components/list-row/index.js +4 -0
- package/lib/module/components/list-row/index.js.map +1 -0
- package/lib/module/components/list-row/list-row.js +97 -0
- package/lib/module/components/list-row/list-row.js.map +1 -0
- package/lib/module/components/photo/index.js +4 -0
- package/lib/module/components/photo/index.js.map +1 -0
- package/lib/module/components/photo/photo.js +68 -0
- package/lib/module/components/photo/photo.js.map +1 -0
- package/lib/module/components/price/index.js +4 -0
- package/lib/module/components/price/index.js.map +1 -0
- package/lib/module/components/price/price.js +72 -0
- package/lib/module/components/price/price.js.map +1 -0
- package/lib/module/components/search-field/index.js +4 -0
- package/lib/module/components/search-field/index.js.map +1 -0
- package/lib/module/components/search-field/search-field.js +35 -0
- package/lib/module/components/search-field/search-field.js.map +1 -0
- package/lib/module/components/segmented-tabs/index.js +4 -0
- package/lib/module/components/segmented-tabs/index.js.map +1 -0
- package/lib/module/components/segmented-tabs/segmented-tabs.js +74 -0
- package/lib/module/components/segmented-tabs/segmented-tabs.js.map +1 -0
- package/lib/module/components/sheet/index.js +4 -0
- package/lib/module/components/sheet/index.js.map +1 -0
- package/lib/module/components/sheet/sheet.js +97 -0
- package/lib/module/components/sheet/sheet.js.map +1 -0
- package/lib/module/components/skeleton/index.js +4 -0
- package/lib/module/components/skeleton/index.js.map +1 -0
- package/lib/module/components/skeleton/skeleton.js +49 -0
- package/lib/module/components/skeleton/skeleton.js.map +1 -0
- package/lib/module/components/status-badge/index.js +4 -0
- package/lib/module/components/status-badge/index.js.map +1 -0
- package/lib/module/components/status-badge/status-badge.js +48 -0
- package/lib/module/components/status-badge/status-badge.js.map +1 -0
- package/lib/module/components/switch/index.js +4 -0
- package/lib/module/components/switch/index.js.map +1 -0
- package/lib/module/components/switch/switch.js +26 -0
- package/lib/module/components/switch/switch.js.map +1 -0
- package/lib/module/components/text/index.js +4 -0
- package/lib/module/components/text/index.js.map +1 -0
- package/lib/module/components/text/text.js +56 -0
- package/lib/module/components/text/text.js.map +1 -0
- package/lib/module/components/toast/index.js +4 -0
- package/lib/module/components/toast/index.js.map +1 -0
- package/lib/module/components/toast/toast.js +203 -0
- package/lib/module/components/toast/toast.js.map +1 -0
- package/lib/module/components/wizard-steps/index.js +4 -0
- package/lib/module/components/wizard-steps/index.js.map +1 -0
- package/lib/module/components/wizard-steps/wizard-steps.js +69 -0
- package/lib/module/components/wizard-steps/wizard-steps.js.map +1 -0
- package/lib/module/index.js +31 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/internal/glyphs.js +200 -0
- package/lib/module/internal/glyphs.js.map +1 -0
- package/lib/module/internal/icon.js +8 -0
- package/lib/module/internal/icon.js.map +1 -0
- package/lib/module/internal/overlay.js +60 -0
- package/lib/module/internal/overlay.js.map +1 -0
- package/lib/module/internal/pressable-base.js +40 -0
- package/lib/module/internal/pressable-base.js.map +1 -0
- package/lib/module/internal/use-reduced-motion.js +31 -0
- package/lib/module/internal/use-reduced-motion.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/sortable/index.js +6 -0
- package/lib/module/sortable/index.js.map +1 -0
- package/lib/module/sortable/move.js +11 -0
- package/lib/module/sortable/move.js.map +1 -0
- package/lib/module/sortable/sortable-grid.js +86 -0
- package/lib/module/sortable/sortable-grid.js.map +1 -0
- package/lib/module/sortable/sortable-list.js +16 -0
- package/lib/module/sortable/sortable-list.js.map +1 -0
- package/lib/module/sortable.js +6 -0
- package/lib/module/sortable.js.map +1 -0
- package/lib/module/theme/create-theme.js +56 -0
- package/lib/module/theme/create-theme.js.map +1 -0
- package/lib/module/theme/theme-provider.js +26 -0
- package/lib/module/theme/theme-provider.js.map +1 -0
- package/lib/module/theme/tokens.js +123 -0
- package/lib/module/theme/tokens.js.map +1 -0
- package/lib/module/types/index.js +4 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/utils/color.js +30 -0
- package/lib/module/utils/color.js.map +1 -0
- package/lib/module/utils/styles.js +22 -0
- package/lib/module/utils/styles.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/blocks/brand-profile-card/brand-profile-card.d.ts +15 -0
- package/lib/typescript/src/blocks/brand-profile-card/brand-profile-card.d.ts.map +1 -0
- package/lib/typescript/src/blocks/brand-profile-card/index.d.ts +2 -0
- package/lib/typescript/src/blocks/brand-profile-card/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/claim-row/claim-row.d.ts +22 -0
- package/lib/typescript/src/blocks/claim-row/claim-row.d.ts.map +1 -0
- package/lib/typescript/src/blocks/claim-row/index.d.ts +2 -0
- package/lib/typescript/src/blocks/claim-row/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/color-swatch-picker/color-swatch-picker.d.ts +16 -0
- package/lib/typescript/src/blocks/color-swatch-picker/color-swatch-picker.d.ts.map +1 -0
- package/lib/typescript/src/blocks/color-swatch-picker/index.d.ts +2 -0
- package/lib/typescript/src/blocks/color-swatch-picker/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/copy-variant-picker/copy-variant-picker.d.ts +22 -0
- package/lib/typescript/src/blocks/copy-variant-picker/copy-variant-picker.d.ts.map +1 -0
- package/lib/typescript/src/blocks/copy-variant-picker/index.d.ts +2 -0
- package/lib/typescript/src/blocks/copy-variant-picker/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/credit-wallet/credit-wallet.d.ts +14 -0
- package/lib/typescript/src/blocks/credit-wallet/credit-wallet.d.ts.map +1 -0
- package/lib/typescript/src/blocks/credit-wallet/index.d.ts +2 -0
- package/lib/typescript/src/blocks/credit-wallet/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/image-grid/image-grid.d.ts +24 -0
- package/lib/typescript/src/blocks/image-grid/image-grid.d.ts.map +1 -0
- package/lib/typescript/src/blocks/image-grid/index.d.ts +2 -0
- package/lib/typescript/src/blocks/image-grid/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/index.d.ts +20 -0
- package/lib/typescript/src/blocks/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/internal/card.d.ts +10 -0
- package/lib/typescript/src/blocks/internal/card.d.ts.map +1 -0
- package/lib/typescript/src/blocks/internal/format.d.ts +7 -0
- package/lib/typescript/src/blocks/internal/format.d.ts.map +1 -0
- package/lib/typescript/src/blocks/invoice-row/index.d.ts +2 -0
- package/lib/typescript/src/blocks/invoice-row/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/invoice-row/invoice-row.d.ts +22 -0
- package/lib/typescript/src/blocks/invoice-row/invoice-row.d.ts.map +1 -0
- package/lib/typescript/src/blocks/logo-candidate-grid/index.d.ts +2 -0
- package/lib/typescript/src/blocks/logo-candidate-grid/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/logo-candidate-grid/logo-candidate-grid.d.ts +17 -0
- package/lib/typescript/src/blocks/logo-candidate-grid/logo-candidate-grid.d.ts.map +1 -0
- package/lib/typescript/src/blocks/oauth-buttons/index.d.ts +2 -0
- package/lib/typescript/src/blocks/oauth-buttons/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/oauth-buttons/oauth-buttons.d.ts +20 -0
- package/lib/typescript/src/blocks/oauth-buttons/oauth-buttons.d.ts.map +1 -0
- package/lib/typescript/src/blocks/option-editor/index.d.ts +2 -0
- package/lib/typescript/src/blocks/option-editor/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/option-editor/option-editor.d.ts +20 -0
- package/lib/typescript/src/blocks/option-editor/option-editor.d.ts.map +1 -0
- package/lib/typescript/src/blocks/order-card/index.d.ts +2 -0
- package/lib/typescript/src/blocks/order-card/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/order-card/order-card.d.ts +44 -0
- package/lib/typescript/src/blocks/order-card/order-card.d.ts.map +1 -0
- package/lib/typescript/src/blocks/plan-card/index.d.ts +2 -0
- package/lib/typescript/src/blocks/plan-card/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/plan-card/plan-card.d.ts +36 -0
- package/lib/typescript/src/blocks/plan-card/plan-card.d.ts.map +1 -0
- package/lib/typescript/src/blocks/product-list-empty/index.d.ts +2 -0
- package/lib/typescript/src/blocks/product-list-empty/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/product-list-empty/product-list-empty.d.ts +21 -0
- package/lib/typescript/src/blocks/product-list-empty/product-list-empty.d.ts.map +1 -0
- package/lib/typescript/src/blocks/review-row/index.d.ts +2 -0
- package/lib/typescript/src/blocks/review-row/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/review-row/review-row.d.ts +34 -0
- package/lib/typescript/src/blocks/review-row/review-row.d.ts.map +1 -0
- package/lib/typescript/src/blocks/sales-chart/index.d.ts +2 -0
- package/lib/typescript/src/blocks/sales-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/sales-chart/sales-chart.d.ts +20 -0
- package/lib/typescript/src/blocks/sales-chart/sales-chart.d.ts.map +1 -0
- package/lib/typescript/src/blocks/service-state-banner/index.d.ts +2 -0
- package/lib/typescript/src/blocks/service-state-banner/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/service-state-banner/service-state-banner.d.ts +13 -0
- package/lib/typescript/src/blocks/service-state-banner/service-state-banner.d.ts.map +1 -0
- package/lib/typescript/src/blocks/shipping-tracking-row/index.d.ts +2 -0
- package/lib/typescript/src/blocks/shipping-tracking-row/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/shipping-tracking-row/shipping-tracking-row.d.ts +12 -0
- package/lib/typescript/src/blocks/shipping-tracking-row/shipping-tracking-row.d.ts.map +1 -0
- package/lib/typescript/src/blocks/site-preview-frame/index.d.ts +2 -0
- package/lib/typescript/src/blocks/site-preview-frame/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/site-preview-frame/site-preview-frame.d.ts +18 -0
- package/lib/typescript/src/blocks/site-preview-frame/site-preview-frame.d.ts.map +1 -0
- package/lib/typescript/src/blocks/stat-card/index.d.ts +2 -0
- package/lib/typescript/src/blocks/stat-card/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/stat-card/stat-card.d.ts +17 -0
- package/lib/typescript/src/blocks/stat-card/stat-card.d.ts.map +1 -0
- package/lib/typescript/src/blocks/step-screen/index.d.ts +2 -0
- package/lib/typescript/src/blocks/step-screen/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/step-screen/step-screen.d.ts +26 -0
- package/lib/typescript/src/blocks/step-screen/step-screen.d.ts.map +1 -0
- package/lib/typescript/src/blocks/supply-item-card/index.d.ts +2 -0
- package/lib/typescript/src/blocks/supply-item-card/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/supply-item-card/supply-item-card.d.ts +30 -0
- package/lib/typescript/src/blocks/supply-item-card/supply-item-card.d.ts.map +1 -0
- package/lib/typescript/src/charts/index.d.ts +3 -0
- package/lib/typescript/src/charts/index.d.ts.map +1 -0
- package/lib/typescript/src/charts/line-chart.d.ts +21 -0
- package/lib/typescript/src/charts/line-chart.d.ts.map +1 -0
- package/lib/typescript/src/charts/scale.d.ts +13 -0
- package/lib/typescript/src/charts/scale.d.ts.map +1 -0
- package/lib/typescript/src/charts/sparkline.d.ts +15 -0
- package/lib/typescript/src/charts/sparkline.d.ts.map +1 -0
- package/lib/typescript/src/charts/summary.d.ts +3 -0
- package/lib/typescript/src/charts/summary.d.ts.map +1 -0
- package/lib/typescript/src/charts.d.ts +3 -0
- package/lib/typescript/src/charts.d.ts.map +1 -0
- package/lib/typescript/src/components/button/button.d.ts +18 -0
- package/lib/typescript/src/components/button/button.d.ts.map +1 -0
- package/lib/typescript/src/components/button/index.d.ts +2 -0
- package/lib/typescript/src/components/button/index.d.ts.map +1 -0
- package/lib/typescript/src/components/checkbox/checkbox.d.ts +8 -0
- package/lib/typescript/src/components/checkbox/checkbox.d.ts.map +1 -0
- package/lib/typescript/src/components/checkbox/index.d.ts +2 -0
- package/lib/typescript/src/components/checkbox/index.d.ts.map +1 -0
- package/lib/typescript/src/components/chip/chip.d.ts +9 -0
- package/lib/typescript/src/components/chip/chip.d.ts.map +1 -0
- package/lib/typescript/src/components/chip/index.d.ts +2 -0
- package/lib/typescript/src/components/chip/index.d.ts.map +1 -0
- package/lib/typescript/src/components/chip-group/chip-group.d.ts +27 -0
- package/lib/typescript/src/components/chip-group/chip-group.d.ts.map +1 -0
- package/lib/typescript/src/components/chip-group/index.d.ts +2 -0
- package/lib/typescript/src/components/chip-group/index.d.ts.map +1 -0
- package/lib/typescript/src/components/dialog/dialog.d.ts +20 -0
- package/lib/typescript/src/components/dialog/dialog.d.ts.map +1 -0
- package/lib/typescript/src/components/dialog/index.d.ts +2 -0
- package/lib/typescript/src/components/dialog/index.d.ts.map +1 -0
- package/lib/typescript/src/components/divider/divider.d.ts +9 -0
- package/lib/typescript/src/components/divider/divider.d.ts.map +1 -0
- package/lib/typescript/src/components/divider/index.d.ts +2 -0
- package/lib/typescript/src/components/divider/index.d.ts.map +1 -0
- package/lib/typescript/src/components/empty-state/empty-state.d.ts +26 -0
- package/lib/typescript/src/components/empty-state/empty-state.d.ts.map +1 -0
- package/lib/typescript/src/components/empty-state/index.d.ts +2 -0
- package/lib/typescript/src/components/empty-state/index.d.ts.map +1 -0
- package/lib/typescript/src/components/field/field.d.ts +15 -0
- package/lib/typescript/src/components/field/field.d.ts.map +1 -0
- package/lib/typescript/src/components/field/index.d.ts +2 -0
- package/lib/typescript/src/components/field/index.d.ts.map +1 -0
- package/lib/typescript/src/components/list-row/index.d.ts +2 -0
- package/lib/typescript/src/components/list-row/index.d.ts.map +1 -0
- package/lib/typescript/src/components/list-row/list-row.d.ts +15 -0
- package/lib/typescript/src/components/list-row/list-row.d.ts.map +1 -0
- package/lib/typescript/src/components/photo/index.d.ts +2 -0
- package/lib/typescript/src/components/photo/index.d.ts.map +1 -0
- package/lib/typescript/src/components/photo/photo.d.ts +15 -0
- package/lib/typescript/src/components/photo/photo.d.ts.map +1 -0
- package/lib/typescript/src/components/price/index.d.ts +2 -0
- package/lib/typescript/src/components/price/index.d.ts.map +1 -0
- package/lib/typescript/src/components/price/price.d.ts +15 -0
- package/lib/typescript/src/components/price/price.d.ts.map +1 -0
- package/lib/typescript/src/components/search-field/index.d.ts +2 -0
- package/lib/typescript/src/components/search-field/index.d.ts.map +1 -0
- package/lib/typescript/src/components/search-field/search-field.d.ts +9 -0
- package/lib/typescript/src/components/search-field/search-field.d.ts.map +1 -0
- package/lib/typescript/src/components/segmented-tabs/index.d.ts +2 -0
- package/lib/typescript/src/components/segmented-tabs/index.d.ts.map +1 -0
- package/lib/typescript/src/components/segmented-tabs/segmented-tabs.d.ts +14 -0
- package/lib/typescript/src/components/segmented-tabs/segmented-tabs.d.ts.map +1 -0
- package/lib/typescript/src/components/sheet/index.d.ts +2 -0
- package/lib/typescript/src/components/sheet/index.d.ts.map +1 -0
- package/lib/typescript/src/components/sheet/sheet.d.ts +17 -0
- package/lib/typescript/src/components/sheet/sheet.d.ts.map +1 -0
- package/lib/typescript/src/components/skeleton/index.d.ts +2 -0
- package/lib/typescript/src/components/skeleton/index.d.ts.map +1 -0
- package/lib/typescript/src/components/skeleton/skeleton.d.ts +13 -0
- package/lib/typescript/src/components/skeleton/skeleton.d.ts.map +1 -0
- package/lib/typescript/src/components/status-badge/index.d.ts +2 -0
- package/lib/typescript/src/components/status-badge/index.d.ts.map +1 -0
- package/lib/typescript/src/components/status-badge/status-badge.d.ts +10 -0
- package/lib/typescript/src/components/status-badge/status-badge.d.ts.map +1 -0
- package/lib/typescript/src/components/switch/index.d.ts +2 -0
- package/lib/typescript/src/components/switch/index.d.ts.map +1 -0
- package/lib/typescript/src/components/switch/switch.d.ts +9 -0
- package/lib/typescript/src/components/switch/switch.d.ts.map +1 -0
- package/lib/typescript/src/components/text/index.d.ts +2 -0
- package/lib/typescript/src/components/text/index.d.ts.map +1 -0
- package/lib/typescript/src/components/text/text.d.ts +16 -0
- package/lib/typescript/src/components/text/text.d.ts.map +1 -0
- package/lib/typescript/src/components/toast/index.d.ts +2 -0
- package/lib/typescript/src/components/toast/index.d.ts.map +1 -0
- package/lib/typescript/src/components/toast/toast.d.ts +30 -0
- package/lib/typescript/src/components/toast/toast.d.ts.map +1 -0
- package/lib/typescript/src/components/wizard-steps/index.d.ts +2 -0
- package/lib/typescript/src/components/wizard-steps/index.d.ts.map +1 -0
- package/lib/typescript/src/components/wizard-steps/wizard-steps.d.ts +11 -0
- package/lib/typescript/src/components/wizard-steps/wizard-steps.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +31 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/internal/glyphs.d.ts +12 -0
- package/lib/typescript/src/internal/glyphs.d.ts.map +1 -0
- package/lib/typescript/src/internal/icon.d.ts +9 -0
- package/lib/typescript/src/internal/icon.d.ts.map +1 -0
- package/lib/typescript/src/internal/overlay.d.ts +16 -0
- package/lib/typescript/src/internal/overlay.d.ts.map +1 -0
- package/lib/typescript/src/internal/pressable-base.d.ts +13 -0
- package/lib/typescript/src/internal/pressable-base.d.ts.map +1 -0
- package/lib/typescript/src/internal/use-reduced-motion.d.ts +3 -0
- package/lib/typescript/src/internal/use-reduced-motion.d.ts.map +1 -0
- package/lib/typescript/src/sortable/index.d.ts +4 -0
- package/lib/typescript/src/sortable/index.d.ts.map +1 -0
- package/lib/typescript/src/sortable/move.d.ts +3 -0
- package/lib/typescript/src/sortable/move.d.ts.map +1 -0
- package/lib/typescript/src/sortable/sortable-grid.d.ts +37 -0
- package/lib/typescript/src/sortable/sortable-grid.d.ts.map +1 -0
- package/lib/typescript/src/sortable/sortable-list.d.ts +5 -0
- package/lib/typescript/src/sortable/sortable-list.d.ts.map +1 -0
- package/lib/typescript/src/sortable.d.ts +4 -0
- package/lib/typescript/src/sortable.d.ts.map +1 -0
- package/lib/typescript/src/theme/create-theme.d.ts +8 -0
- package/lib/typescript/src/theme/create-theme.d.ts.map +1 -0
- package/lib/typescript/src/theme/theme-provider.d.ts +13 -0
- package/lib/typescript/src/theme/theme-provider.d.ts.map +1 -0
- package/lib/typescript/src/theme/tokens.d.ts +4 -0
- package/lib/typescript/src/theme/tokens.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +90 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/lib/typescript/src/utils/color.d.ts +5 -0
- package/lib/typescript/src/utils/color.d.ts.map +1 -0
- package/lib/typescript/src/utils/styles.d.ts +13 -0
- package/lib/typescript/src/utils/styles.d.ts.map +1 -0
- package/package.json +109 -3
- package/src/blocks/brand-profile-card/brand-profile-card.tsx +87 -0
- package/src/blocks/brand-profile-card/index.ts +4 -0
- package/src/blocks/claim-row/claim-row.tsx +112 -0
- package/src/blocks/claim-row/index.ts +6 -0
- package/src/blocks/color-swatch-picker/color-swatch-picker.tsx +119 -0
- package/src/blocks/color-swatch-picker/index.ts +5 -0
- package/src/blocks/copy-variant-picker/copy-variant-picker.tsx +140 -0
- package/src/blocks/copy-variant-picker/index.ts +5 -0
- package/src/blocks/credit-wallet/credit-wallet.tsx +105 -0
- package/src/blocks/credit-wallet/index.ts +1 -0
- package/src/blocks/image-grid/image-grid.tsx +279 -0
- package/src/blocks/image-grid/index.ts +1 -0
- package/src/blocks/index.tsx +19 -0
- package/src/blocks/internal/card.tsx +42 -0
- package/src/blocks/internal/format.ts +22 -0
- package/src/blocks/invoice-row/index.ts +5 -0
- package/src/blocks/invoice-row/invoice-row.tsx +122 -0
- package/src/blocks/logo-candidate-grid/index.ts +5 -0
- package/src/blocks/logo-candidate-grid/logo-candidate-grid.tsx +129 -0
- package/src/blocks/oauth-buttons/index.ts +5 -0
- package/src/blocks/oauth-buttons/oauth-buttons.tsx +109 -0
- package/src/blocks/option-editor/index.ts +5 -0
- package/src/blocks/option-editor/option-editor.tsx +135 -0
- package/src/blocks/order-card/index.ts +11 -0
- package/src/blocks/order-card/order-card.tsx +184 -0
- package/src/blocks/plan-card/index.ts +1 -0
- package/src/blocks/plan-card/plan-card.tsx +147 -0
- package/src/blocks/product-list-empty/index.ts +5 -0
- package/src/blocks/product-list-empty/product-list-empty.tsx +144 -0
- package/src/blocks/review-row/index.ts +8 -0
- package/src/blocks/review-row/review-row.tsx +256 -0
- package/src/blocks/sales-chart/index.ts +5 -0
- package/src/blocks/sales-chart/sales-chart.tsx +120 -0
- package/src/blocks/service-state-banner/index.ts +5 -0
- package/src/blocks/service-state-banner/service-state-banner.tsx +66 -0
- package/src/blocks/shipping-tracking-row/index.ts +5 -0
- package/src/blocks/shipping-tracking-row/shipping-tracking-row.tsx +93 -0
- package/src/blocks/site-preview-frame/index.ts +5 -0
- package/src/blocks/site-preview-frame/site-preview-frame.tsx +121 -0
- package/src/blocks/stat-card/index.ts +1 -0
- package/src/blocks/stat-card/stat-card.tsx +77 -0
- package/src/blocks/step-screen/index.ts +5 -0
- package/src/blocks/step-screen/step-screen.tsx +137 -0
- package/src/blocks/supply-item-card/index.ts +6 -0
- package/src/blocks/supply-item-card/supply-item-card.tsx +145 -0
- package/src/charts/index.ts +2 -0
- package/src/charts/line-chart.tsx +177 -0
- package/src/charts/scale.ts +49 -0
- package/src/charts/sparkline.tsx +64 -0
- package/src/charts/summary.ts +11 -0
- package/src/charts.tsx +2 -0
- package/src/components/button/button.tsx +119 -0
- package/src/components/button/index.ts +6 -0
- package/src/components/checkbox/checkbox.tsx +79 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/chip/chip.tsx +73 -0
- package/src/components/chip/index.ts +1 -0
- package/src/components/chip-group/chip-group.tsx +86 -0
- package/src/components/chip-group/index.ts +5 -0
- package/src/components/dialog/dialog.tsx +131 -0
- package/src/components/dialog/index.ts +1 -0
- package/src/components/divider/divider.tsx +26 -0
- package/src/components/divider/index.ts +1 -0
- package/src/components/empty-state/empty-state.tsx +152 -0
- package/src/components/empty-state/index.ts +5 -0
- package/src/components/field/field.tsx +151 -0
- package/src/components/field/index.ts +1 -0
- package/src/components/list-row/index.ts +1 -0
- package/src/components/list-row/list-row.tsx +115 -0
- package/src/components/photo/index.ts +1 -0
- package/src/components/photo/photo.tsx +87 -0
- package/src/components/price/index.ts +1 -0
- package/src/components/price/price.tsx +84 -0
- package/src/components/search-field/index.ts +1 -0
- package/src/components/search-field/search-field.tsx +46 -0
- package/src/components/segmented-tabs/index.ts +5 -0
- package/src/components/segmented-tabs/segmented-tabs.tsx +81 -0
- package/src/components/sheet/index.ts +1 -0
- package/src/components/sheet/sheet.tsx +121 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/skeleton/skeleton.tsx +73 -0
- package/src/components/status-badge/index.ts +5 -0
- package/src/components/status-badge/status-badge.tsx +54 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/switch/switch.tsx +26 -0
- package/src/components/text/index.ts +1 -0
- package/src/components/text/text.tsx +54 -0
- package/src/components/toast/index.ts +9 -0
- package/src/components/toast/toast.tsx +248 -0
- package/src/components/wizard-steps/index.ts +1 -0
- package/src/components/wizard-steps/wizard-steps.tsx +54 -0
- package/src/index.tsx +56 -0
- package/src/internal/glyphs.tsx +158 -0
- package/src/internal/icon.tsx +10 -0
- package/src/internal/overlay.tsx +59 -0
- package/src/internal/pressable-base.tsx +55 -0
- package/src/internal/use-reduced-motion.ts +32 -0
- package/src/sortable/index.ts +8 -0
- package/src/sortable/move.ts +19 -0
- package/src/sortable/sortable-grid.tsx +97 -0
- package/src/sortable/sortable-list.tsx +11 -0
- package/src/sortable.tsx +3 -0
- package/src/theme/create-theme.ts +67 -0
- package/src/theme/theme-provider.tsx +37 -0
- package/src/theme/tokens.ts +91 -0
- package/src/types/index.ts +80 -0
- package/src/utils/color.ts +47 -0
- package/src/utils/styles.ts +30 -0
- package/README.md +0 -3
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { View, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import Svg, {
|
|
4
|
+
Circle,
|
|
5
|
+
Line,
|
|
6
|
+
Path,
|
|
7
|
+
Rect,
|
|
8
|
+
Text as SvgText,
|
|
9
|
+
} from 'react-native-svg';
|
|
10
|
+
import { formatPrice } from '../components/price/price';
|
|
11
|
+
import { useTheme } from '../theme/theme-provider';
|
|
12
|
+
import { areaPath, labelStep, linearScale, linePath, niceTicks } from './scale';
|
|
13
|
+
import { summarize } from './summary';
|
|
14
|
+
|
|
15
|
+
export type ChartDatum = { label: string; value: number };
|
|
16
|
+
|
|
17
|
+
export type LineChartProps = {
|
|
18
|
+
data: readonly ChartDatum[];
|
|
19
|
+
/** 기본 200 */
|
|
20
|
+
height?: number;
|
|
21
|
+
/** y축 라벨. 기본은 천 단위 쉼표 */
|
|
22
|
+
formatY?: (value: number) => string;
|
|
23
|
+
/** x축 라벨. 기본은 label 그대로 */
|
|
24
|
+
formatX?: (label: string, index: number) => string;
|
|
25
|
+
/** 점을 눌렀을 때. 넘기면 각 구간이 눌린다 */
|
|
26
|
+
onPointPress?: (datum: ChartDatum, index: number) => void;
|
|
27
|
+
/** 기본은 최고 · 최저 · 마지막 값 요약 */
|
|
28
|
+
accessibilityLabel?: string;
|
|
29
|
+
style?: StyleProp<ViewStyle>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const defaultFormat = (v: number) => formatPrice(v, '');
|
|
33
|
+
const PAD = { top: 8, right: 12, bottom: 24, gap: 8 };
|
|
34
|
+
const FONT_SIZE = 11;
|
|
35
|
+
|
|
36
|
+
export function LineChart({
|
|
37
|
+
data,
|
|
38
|
+
height = 200,
|
|
39
|
+
formatY = defaultFormat,
|
|
40
|
+
formatX = (label) => label,
|
|
41
|
+
onPointPress,
|
|
42
|
+
accessibilityLabel,
|
|
43
|
+
style,
|
|
44
|
+
}: LineChartProps) {
|
|
45
|
+
const t = useTheme();
|
|
46
|
+
const [width, setWidth] = useState(0);
|
|
47
|
+
const values = data.map((d) => d.value);
|
|
48
|
+
const ticks = niceTicks(Math.min(0, ...values), Math.max(0, ...values));
|
|
49
|
+
const yLabels = ticks.map(formatY);
|
|
50
|
+
const left =
|
|
51
|
+
Math.max(...yLabels.map((l) => l.length)) * FONT_SIZE * 0.62 + PAD.gap;
|
|
52
|
+
const plot = {
|
|
53
|
+
x0: left,
|
|
54
|
+
x1: width - PAD.right,
|
|
55
|
+
y0: PAD.top,
|
|
56
|
+
y1: height - PAD.bottom,
|
|
57
|
+
};
|
|
58
|
+
const y = linearScale(
|
|
59
|
+
[ticks[0]!, ticks[ticks.length - 1]!],
|
|
60
|
+
[plot.y1, plot.y0]
|
|
61
|
+
);
|
|
62
|
+
const x = linearScale([0, Math.max(1, data.length - 1)], [plot.x0, plot.x1]);
|
|
63
|
+
const points = data.map((d, i) => ({
|
|
64
|
+
x: data.length === 1 ? (plot.x0 + plot.x1) / 2 : x(i),
|
|
65
|
+
y: y(d.value),
|
|
66
|
+
}));
|
|
67
|
+
const step = labelStep(
|
|
68
|
+
data.length,
|
|
69
|
+
Math.max(1, Math.floor((plot.x1 - plot.x0) / 56))
|
|
70
|
+
);
|
|
71
|
+
const last = points[points.length - 1];
|
|
72
|
+
const slot =
|
|
73
|
+
data.length > 1
|
|
74
|
+
? (plot.x1 - plot.x0) / (data.length - 1)
|
|
75
|
+
: plot.x1 - plot.x0;
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<View
|
|
79
|
+
accessible
|
|
80
|
+
accessibilityRole="image"
|
|
81
|
+
accessibilityLabel={accessibilityLabel ?? summarize(values, formatY)}
|
|
82
|
+
onLayout={(e) => setWidth(e.nativeEvent.layout.width)}
|
|
83
|
+
style={[{ height }, style]}
|
|
84
|
+
>
|
|
85
|
+
{width > 0 ? (
|
|
86
|
+
<Svg width={width} height={height}>
|
|
87
|
+
{ticks.map((tick, i) => (
|
|
88
|
+
<Line
|
|
89
|
+
key={`g${tick}`}
|
|
90
|
+
x1={plot.x0}
|
|
91
|
+
x2={plot.x1}
|
|
92
|
+
y1={y(tick)}
|
|
93
|
+
y2={y(tick)}
|
|
94
|
+
stroke={t.colors.border}
|
|
95
|
+
strokeWidth={1}
|
|
96
|
+
strokeDasharray={i === 0 ? undefined : '3 4'}
|
|
97
|
+
/>
|
|
98
|
+
))}
|
|
99
|
+
{ticks.map((tick, i) => (
|
|
100
|
+
<SvgText
|
|
101
|
+
key={`y${tick}`}
|
|
102
|
+
x={plot.x0 - PAD.gap}
|
|
103
|
+
y={y(tick) + FONT_SIZE / 3}
|
|
104
|
+
fontSize={FONT_SIZE}
|
|
105
|
+
fontFamily={t.fontFamily}
|
|
106
|
+
fill={t.colors.mutedForeground}
|
|
107
|
+
textAnchor="end"
|
|
108
|
+
>
|
|
109
|
+
{yLabels[i]}
|
|
110
|
+
</SvgText>
|
|
111
|
+
))}
|
|
112
|
+
{data.map((d, i) =>
|
|
113
|
+
i % step === 0 || i === data.length - 1 ? (
|
|
114
|
+
<SvgText
|
|
115
|
+
key={`x${i}`}
|
|
116
|
+
x={points[i]!.x}
|
|
117
|
+
y={height - 6}
|
|
118
|
+
fontSize={FONT_SIZE}
|
|
119
|
+
fontFamily={t.fontFamily}
|
|
120
|
+
fill={t.colors.mutedForeground}
|
|
121
|
+
textAnchor={
|
|
122
|
+
i === 0 && data.length > 1
|
|
123
|
+
? 'start'
|
|
124
|
+
: i === data.length - 1 && data.length > 1
|
|
125
|
+
? 'end'
|
|
126
|
+
: 'middle'
|
|
127
|
+
}
|
|
128
|
+
>
|
|
129
|
+
{formatX(d.label, i)}
|
|
130
|
+
</SvgText>
|
|
131
|
+
) : null
|
|
132
|
+
)}
|
|
133
|
+
{points.length > 1 ? (
|
|
134
|
+
<>
|
|
135
|
+
<Path
|
|
136
|
+
d={areaPath(points, plot.y1)}
|
|
137
|
+
fill={t.colors.primary}
|
|
138
|
+
fillOpacity={0.12}
|
|
139
|
+
/>
|
|
140
|
+
<Path
|
|
141
|
+
d={linePath(points)}
|
|
142
|
+
fill="none"
|
|
143
|
+
stroke={t.colors.primary}
|
|
144
|
+
strokeWidth={2}
|
|
145
|
+
strokeLinejoin="round"
|
|
146
|
+
strokeLinecap="round"
|
|
147
|
+
/>
|
|
148
|
+
</>
|
|
149
|
+
) : null}
|
|
150
|
+
{last ? (
|
|
151
|
+
<Circle
|
|
152
|
+
cx={last.x}
|
|
153
|
+
cy={last.y}
|
|
154
|
+
r={4}
|
|
155
|
+
fill={t.colors.primary}
|
|
156
|
+
stroke={t.colors.background}
|
|
157
|
+
strokeWidth={2}
|
|
158
|
+
/>
|
|
159
|
+
) : null}
|
|
160
|
+
{onPointPress
|
|
161
|
+
? data.map((d, i) => (
|
|
162
|
+
<Rect
|
|
163
|
+
key={`hit${i}`}
|
|
164
|
+
x={points[i]!.x - slot / 2}
|
|
165
|
+
y={plot.y0}
|
|
166
|
+
width={slot}
|
|
167
|
+
height={plot.y1 - plot.y0}
|
|
168
|
+
fill="transparent"
|
|
169
|
+
onPress={() => onPointPress(d, i)}
|
|
170
|
+
/>
|
|
171
|
+
))
|
|
172
|
+
: null}
|
|
173
|
+
</Svg>
|
|
174
|
+
) : null}
|
|
175
|
+
</View>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type Point = { x: number; y: number };
|
|
2
|
+
|
|
3
|
+
const STEPS = [1, 2, 2.5, 5, 10];
|
|
4
|
+
|
|
5
|
+
/** 보기 좋은 눈금. 값이 하나뿐이거나 모두 같아도 범위를 만든다 */
|
|
6
|
+
export function niceTicks(min: number, max: number, count = 4): number[] {
|
|
7
|
+
let lo = Math.min(min, max);
|
|
8
|
+
let hi = Math.max(min, max);
|
|
9
|
+
if (!Number.isFinite(lo) || !Number.isFinite(hi)) return [0, 1];
|
|
10
|
+
if (lo === hi) {
|
|
11
|
+
if (hi === 0) hi = 1;
|
|
12
|
+
else if (hi > 0) lo = 0;
|
|
13
|
+
else hi = 0;
|
|
14
|
+
}
|
|
15
|
+
const raw = (hi - lo) / Math.max(1, count - 1);
|
|
16
|
+
const magnitude = 10 ** Math.floor(Math.log10(raw));
|
|
17
|
+
const step = (STEPS.find((s) => s * magnitude >= raw) ?? 10) * magnitude;
|
|
18
|
+
const start = Math.floor(lo / step) * step;
|
|
19
|
+
const end = Math.ceil(hi / step) * step;
|
|
20
|
+
const ticks: number[] = [];
|
|
21
|
+
for (let v = start; v <= end + step / 2; v += step) {
|
|
22
|
+
ticks.push(Math.round(v / step) * step);
|
|
23
|
+
}
|
|
24
|
+
return ticks;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** [d0, d1] → [r0, r1] 선형 변환. 범위 폭이 0이면 가운데로 */
|
|
28
|
+
export function linearScale(domain: [number, number], range: [number, number]) {
|
|
29
|
+
const [d0, d1] = domain;
|
|
30
|
+
const [r0, r1] = range;
|
|
31
|
+
return (v: number) =>
|
|
32
|
+
d1 === d0 ? (r0 + r1) / 2 : r0 + ((v - d0) / (d1 - d0)) * (r1 - r0);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function linePath(points: Point[]): string {
|
|
36
|
+
return points.map((p, i) => `${i === 0 ? 'M' : 'L'}${p.x},${p.y}`).join(' ');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function areaPath(points: Point[], baseline: number): string {
|
|
40
|
+
if (points.length === 0) return '';
|
|
41
|
+
const first = points[0]!;
|
|
42
|
+
const last = points[points.length - 1]!;
|
|
43
|
+
return `${linePath(points)} L${last.x},${baseline} L${first.x},${baseline} Z`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** 라벨이 겹치지 않게 최대 maxLabels개만 남길 간격 */
|
|
47
|
+
export function labelStep(count: number, maxLabels: number): number {
|
|
48
|
+
return Math.max(1, Math.ceil(count / Math.max(1, maxLabels)));
|
|
49
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { View, type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import Svg, { Path } from 'react-native-svg';
|
|
3
|
+
import { formatPrice } from '../components/price/price';
|
|
4
|
+
import { useTheme } from '../theme/theme-provider';
|
|
5
|
+
import { linearScale, linePath } from './scale';
|
|
6
|
+
import { summarize } from './summary';
|
|
7
|
+
|
|
8
|
+
export type SparklineProps = {
|
|
9
|
+
data: readonly number[];
|
|
10
|
+
/** 기본 80 */
|
|
11
|
+
width?: number;
|
|
12
|
+
/** 기본 24 */
|
|
13
|
+
height?: number;
|
|
14
|
+
/** 기본 primary */
|
|
15
|
+
color?: string;
|
|
16
|
+
accessibilityLabel?: string;
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** 축 없는 작은 추세선 */
|
|
21
|
+
export function Sparkline({
|
|
22
|
+
data,
|
|
23
|
+
width = 80,
|
|
24
|
+
height = 24,
|
|
25
|
+
color,
|
|
26
|
+
accessibilityLabel,
|
|
27
|
+
style,
|
|
28
|
+
}: SparklineProps) {
|
|
29
|
+
const t = useTheme();
|
|
30
|
+
const values = [...data];
|
|
31
|
+
const stroke = 1.5;
|
|
32
|
+
const y = linearScale(
|
|
33
|
+
[Math.min(...values), Math.max(...values)],
|
|
34
|
+
[height - stroke, stroke]
|
|
35
|
+
);
|
|
36
|
+
const x = linearScale(
|
|
37
|
+
[0, Math.max(1, values.length - 1)],
|
|
38
|
+
[stroke, width - stroke]
|
|
39
|
+
);
|
|
40
|
+
const points = values.map((v, i) => ({ x: x(i), y: y(v) }));
|
|
41
|
+
return (
|
|
42
|
+
<View
|
|
43
|
+
accessible
|
|
44
|
+
accessibilityRole="image"
|
|
45
|
+
accessibilityLabel={
|
|
46
|
+
accessibilityLabel ?? summarize(values, (v) => formatPrice(v, ''))
|
|
47
|
+
}
|
|
48
|
+
style={[{ width, height }, style]}
|
|
49
|
+
>
|
|
50
|
+
{points.length > 1 ? (
|
|
51
|
+
<Svg width={width} height={height}>
|
|
52
|
+
<Path
|
|
53
|
+
d={linePath(points)}
|
|
54
|
+
fill="none"
|
|
55
|
+
stroke={color ?? t.colors.primary}
|
|
56
|
+
strokeWidth={stroke}
|
|
57
|
+
strokeLinejoin="round"
|
|
58
|
+
strokeLinecap="round"
|
|
59
|
+
/>
|
|
60
|
+
</Svg>
|
|
61
|
+
) : null}
|
|
62
|
+
</View>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** 차트 전체를 한 문장으로. 스크린 리더용 */
|
|
2
|
+
export function summarize(
|
|
3
|
+
values: number[],
|
|
4
|
+
format: (v: number) => string
|
|
5
|
+
): string {
|
|
6
|
+
if (values.length === 0) return '데이터 없음';
|
|
7
|
+
const max = Math.max(...values);
|
|
8
|
+
const min = Math.min(...values);
|
|
9
|
+
const last = values[values.length - 1]!;
|
|
10
|
+
return `${values.length}개 구간, 최고 ${format(max)}, 최저 ${format(min)}, 마지막 ${format(last)}`;
|
|
11
|
+
}
|
package/src/charts.tsx
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { ActivityIndicator, Text, View } from 'react-native';
|
|
3
|
+
import { renderIcon, type IconSlot } from '../../internal/icon';
|
|
4
|
+
import {
|
|
5
|
+
PressableBase,
|
|
6
|
+
type PressableBaseProps,
|
|
7
|
+
} from '../../internal/pressable-base';
|
|
8
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
9
|
+
import { makeStyles } from '../../utils/styles';
|
|
10
|
+
|
|
11
|
+
export type ButtonVariant =
|
|
12
|
+
'solid' | 'secondary' | 'outline' | 'ghost' | 'destructive';
|
|
13
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
14
|
+
|
|
15
|
+
export type ButtonProps = Omit<
|
|
16
|
+
PressableBaseProps,
|
|
17
|
+
'children' | 'touchHeight'
|
|
18
|
+
> & {
|
|
19
|
+
/** 기본 'solid' */
|
|
20
|
+
variant?: ButtonVariant;
|
|
21
|
+
/** 기본 'md' */
|
|
22
|
+
size?: ButtonSize;
|
|
23
|
+
/** 스피너를 보여주고 누를 수 없게 한다 */
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
leftIcon?: IconSlot;
|
|
26
|
+
rightIcon?: IconSlot;
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const heights: Record<ButtonSize, number> = { sm: 44, md: 48, lg: 52 };
|
|
31
|
+
|
|
32
|
+
const useStyles = makeStyles((t) => ({
|
|
33
|
+
base: {
|
|
34
|
+
flexDirection: 'row',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
justifyContent: 'center',
|
|
37
|
+
gap: t.space[2],
|
|
38
|
+
borderWidth: 1,
|
|
39
|
+
borderColor: 'transparent',
|
|
40
|
+
},
|
|
41
|
+
sm: {
|
|
42
|
+
height: heights.sm,
|
|
43
|
+
paddingHorizontal: t.space[3],
|
|
44
|
+
borderRadius: t.radius.md,
|
|
45
|
+
},
|
|
46
|
+
md: { height: heights.md, paddingHorizontal: t.space[4], borderRadius: 10 },
|
|
47
|
+
lg: {
|
|
48
|
+
height: heights.lg,
|
|
49
|
+
paddingHorizontal: t.space[5],
|
|
50
|
+
borderRadius: t.radius.lg,
|
|
51
|
+
},
|
|
52
|
+
solid: { backgroundColor: t.colors.primary },
|
|
53
|
+
secondary: { backgroundColor: t.colors.muted },
|
|
54
|
+
outline: {
|
|
55
|
+
backgroundColor: t.colors.background,
|
|
56
|
+
borderColor: t.colors.input,
|
|
57
|
+
},
|
|
58
|
+
ghost: { backgroundColor: 'transparent' },
|
|
59
|
+
destructive: { backgroundColor: t.colors.destructive },
|
|
60
|
+
label: { fontFamily: t.fontFamily, fontWeight: '600' },
|
|
61
|
+
smLabel: { fontSize: 14, lineHeight: 20 },
|
|
62
|
+
mdLabel: {
|
|
63
|
+
fontSize: t.typography.body.fontSize,
|
|
64
|
+
lineHeight: t.typography.body.lineHeight,
|
|
65
|
+
},
|
|
66
|
+
lgLabel: { fontSize: 16, lineHeight: 24 },
|
|
67
|
+
}));
|
|
68
|
+
|
|
69
|
+
export function Button({
|
|
70
|
+
variant = 'solid',
|
|
71
|
+
size = 'md',
|
|
72
|
+
loading = false,
|
|
73
|
+
disabled,
|
|
74
|
+
leftIcon,
|
|
75
|
+
rightIcon,
|
|
76
|
+
children,
|
|
77
|
+
style,
|
|
78
|
+
accessibilityState,
|
|
79
|
+
...rest
|
|
80
|
+
}: ButtonProps) {
|
|
81
|
+
const t = useTheme();
|
|
82
|
+
const s = useStyles();
|
|
83
|
+
const color = {
|
|
84
|
+
solid: t.colors.primaryForeground,
|
|
85
|
+
secondary: t.colors.foreground,
|
|
86
|
+
outline: t.colors.foreground,
|
|
87
|
+
ghost: t.colors.foreground,
|
|
88
|
+
destructive: t.colors.destructiveForeground,
|
|
89
|
+
}[variant];
|
|
90
|
+
const icon = { color, size: size === 'sm' ? t.iconSize.sm : t.iconSize.md };
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<PressableBase
|
|
94
|
+
{...rest}
|
|
95
|
+
disabled={disabled || loading}
|
|
96
|
+
touchHeight={heights[size]}
|
|
97
|
+
accessibilityState={{ ...accessibilityState, busy: loading }}
|
|
98
|
+
style={[s.base, s[size], s[variant], style]}
|
|
99
|
+
>
|
|
100
|
+
{loading ? (
|
|
101
|
+
<ActivityIndicator size="small" color={color} />
|
|
102
|
+
) : leftIcon ? (
|
|
103
|
+
<View>{renderIcon(leftIcon, icon)}</View>
|
|
104
|
+
) : null}
|
|
105
|
+
{typeof children === 'string' ? (
|
|
106
|
+
<Text
|
|
107
|
+
numberOfLines={1}
|
|
108
|
+
maxFontSizeMultiplier={t.maxFontScale}
|
|
109
|
+
style={[s.label, s[`${size}Label`], { color }]}
|
|
110
|
+
>
|
|
111
|
+
{children}
|
|
112
|
+
</Text>
|
|
113
|
+
) : (
|
|
114
|
+
children
|
|
115
|
+
)}
|
|
116
|
+
{rightIcon ? <View>{renderIcon(rightIcon, icon)}</View> : null}
|
|
117
|
+
</PressableBase>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Text, View } from 'react-native';
|
|
2
|
+
import { CheckGlyph } from '../../internal/glyphs';
|
|
3
|
+
import {
|
|
4
|
+
PressableBase,
|
|
5
|
+
type PressableBaseProps,
|
|
6
|
+
} from '../../internal/pressable-base';
|
|
7
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
8
|
+
import { makeStyles } from '../../utils/styles';
|
|
9
|
+
|
|
10
|
+
export type CheckboxProps = Omit<
|
|
11
|
+
PressableBaseProps,
|
|
12
|
+
'children' | 'onPress' | 'touchHeight'
|
|
13
|
+
> & {
|
|
14
|
+
value: boolean;
|
|
15
|
+
onValueChange: (value: boolean) => void;
|
|
16
|
+
label?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const BOX = 20;
|
|
20
|
+
|
|
21
|
+
const useStyles = makeStyles((t) => ({
|
|
22
|
+
row: {
|
|
23
|
+
flexDirection: 'row',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
gap: t.space[2],
|
|
26
|
+
alignSelf: 'flex-start',
|
|
27
|
+
},
|
|
28
|
+
box: {
|
|
29
|
+
width: BOX,
|
|
30
|
+
height: BOX,
|
|
31
|
+
borderRadius: t.radius.sm,
|
|
32
|
+
borderWidth: 1,
|
|
33
|
+
borderColor: t.colors.border,
|
|
34
|
+
backgroundColor: t.colors.background,
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
justifyContent: 'center',
|
|
37
|
+
},
|
|
38
|
+
checked: { backgroundColor: t.colors.primary, borderColor: t.colors.primary },
|
|
39
|
+
label: {
|
|
40
|
+
...t.typography.body,
|
|
41
|
+
fontFamily: t.fontFamily,
|
|
42
|
+
color: t.colors.foreground,
|
|
43
|
+
},
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
export function Checkbox({
|
|
47
|
+
value,
|
|
48
|
+
onValueChange,
|
|
49
|
+
label,
|
|
50
|
+
style,
|
|
51
|
+
accessibilityState,
|
|
52
|
+
...rest
|
|
53
|
+
}: CheckboxProps) {
|
|
54
|
+
const t = useTheme();
|
|
55
|
+
const s = useStyles();
|
|
56
|
+
return (
|
|
57
|
+
<PressableBase
|
|
58
|
+
accessibilityRole="checkbox"
|
|
59
|
+
accessibilityLabel={label}
|
|
60
|
+
{...rest}
|
|
61
|
+
accessibilityState={{ ...accessibilityState, checked: value }}
|
|
62
|
+
touchHeight={label ? t.typography.body.lineHeight : BOX}
|
|
63
|
+
pressedStyle={{}}
|
|
64
|
+
onPress={() => onValueChange(!value)}
|
|
65
|
+
style={[s.row, style]}
|
|
66
|
+
>
|
|
67
|
+
<View style={[s.box, value && s.checked]}>
|
|
68
|
+
{value ? (
|
|
69
|
+
<CheckGlyph color={t.colors.primaryForeground} size={14} />
|
|
70
|
+
) : null}
|
|
71
|
+
</View>
|
|
72
|
+
{label ? (
|
|
73
|
+
<Text maxFontSizeMultiplier={t.maxFontScale} style={s.label}>
|
|
74
|
+
{label}
|
|
75
|
+
</Text>
|
|
76
|
+
) : null}
|
|
77
|
+
</PressableBase>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Checkbox, type CheckboxProps } from './checkbox';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Text, View } from 'react-native';
|
|
2
|
+
import { renderIcon, type IconSlot } from '../../internal/icon';
|
|
3
|
+
import {
|
|
4
|
+
PressableBase,
|
|
5
|
+
type PressableBaseProps,
|
|
6
|
+
} from '../../internal/pressable-base';
|
|
7
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
8
|
+
import { makeStyles } from '../../utils/styles';
|
|
9
|
+
|
|
10
|
+
export type ChipProps = Omit<PressableBaseProps, 'children' | 'touchHeight'> & {
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
leftIcon?: IconSlot;
|
|
13
|
+
children: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const HEIGHT = 32;
|
|
17
|
+
|
|
18
|
+
const useStyles = makeStyles((t) => ({
|
|
19
|
+
base: {
|
|
20
|
+
flexDirection: 'row',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
alignSelf: 'flex-start',
|
|
23
|
+
gap: t.space[1],
|
|
24
|
+
height: HEIGHT,
|
|
25
|
+
paddingHorizontal: t.space[3],
|
|
26
|
+
borderRadius: t.radius.full,
|
|
27
|
+
borderWidth: 1,
|
|
28
|
+
borderColor: t.colors.border,
|
|
29
|
+
backgroundColor: t.colors.background,
|
|
30
|
+
},
|
|
31
|
+
selected: {
|
|
32
|
+
backgroundColor: t.colors.primary,
|
|
33
|
+
borderColor: t.colors.primary,
|
|
34
|
+
},
|
|
35
|
+
label: {
|
|
36
|
+
fontFamily: t.fontFamily,
|
|
37
|
+
fontSize: 14,
|
|
38
|
+
lineHeight: 20,
|
|
39
|
+
fontWeight: '500',
|
|
40
|
+
},
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
export function Chip({
|
|
44
|
+
selected = false,
|
|
45
|
+
leftIcon,
|
|
46
|
+
children,
|
|
47
|
+
style,
|
|
48
|
+
accessibilityState,
|
|
49
|
+
...rest
|
|
50
|
+
}: ChipProps) {
|
|
51
|
+
const t = useTheme();
|
|
52
|
+
const s = useStyles();
|
|
53
|
+
const color = selected ? t.colors.primaryForeground : t.colors.foreground;
|
|
54
|
+
return (
|
|
55
|
+
<PressableBase
|
|
56
|
+
{...rest}
|
|
57
|
+
accessibilityState={{ ...accessibilityState, selected }}
|
|
58
|
+
touchHeight={HEIGHT}
|
|
59
|
+
style={[s.base, selected && s.selected, style]}
|
|
60
|
+
>
|
|
61
|
+
{leftIcon ? (
|
|
62
|
+
<View>{renderIcon(leftIcon, { color, size: t.iconSize.sm })}</View>
|
|
63
|
+
) : null}
|
|
64
|
+
<Text
|
|
65
|
+
numberOfLines={1}
|
|
66
|
+
maxFontSizeMultiplier={t.maxFontScale}
|
|
67
|
+
style={[s.label, { color }]}
|
|
68
|
+
>
|
|
69
|
+
{children}
|
|
70
|
+
</Text>
|
|
71
|
+
</PressableBase>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Chip, type ChipProps } from './chip';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { View, type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import { makeStyles } from '../../utils/styles';
|
|
3
|
+
import { Chip } from '../chip/chip';
|
|
4
|
+
|
|
5
|
+
export type ChipGroupItem<T extends string> = {
|
|
6
|
+
value: T;
|
|
7
|
+
label: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type Single<T extends string> = {
|
|
12
|
+
multiple?: false;
|
|
13
|
+
value: T | null;
|
|
14
|
+
onValueChange: (value: T | null) => void;
|
|
15
|
+
/** 선택된 칩을 다시 누르면 해제. 기본 false */
|
|
16
|
+
deselectable?: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type Multiple<T extends string> = {
|
|
20
|
+
multiple: true;
|
|
21
|
+
value: readonly T[];
|
|
22
|
+
onValueChange: (value: T[]) => void;
|
|
23
|
+
/** 최대 선택 개수 */
|
|
24
|
+
max?: number;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type ChipGroupProps<T extends string> = (Single<T> | Multiple<T>) & {
|
|
28
|
+
items: readonly ChipGroupItem<T>[];
|
|
29
|
+
style?: StyleProp<ViewStyle>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const useStyles = makeStyles((t) => ({
|
|
33
|
+
root: { flexDirection: 'row', flexWrap: 'wrap', gap: t.space[2] },
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
export function ChipGroup<T extends string>(props: ChipGroupProps<T>) {
|
|
37
|
+
const s = useStyles();
|
|
38
|
+
const { items, style } = props;
|
|
39
|
+
|
|
40
|
+
const isSelected = (v: T) =>
|
|
41
|
+
props.multiple ? props.value.includes(v) : props.value === v;
|
|
42
|
+
|
|
43
|
+
const press = (v: T) => {
|
|
44
|
+
if (props.multiple) {
|
|
45
|
+
if (props.value.includes(v)) {
|
|
46
|
+
props.onValueChange(props.value.filter((x) => x !== v));
|
|
47
|
+
} else if (props.max === undefined || props.value.length < props.max) {
|
|
48
|
+
props.onValueChange([...props.value, v]);
|
|
49
|
+
}
|
|
50
|
+
} else if (props.value === v) {
|
|
51
|
+
if (props.deselectable) props.onValueChange(null);
|
|
52
|
+
} else {
|
|
53
|
+
props.onValueChange(v);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const full =
|
|
58
|
+
props.multiple &&
|
|
59
|
+
props.max !== undefined &&
|
|
60
|
+
props.value.length >= props.max;
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<View
|
|
64
|
+
accessibilityRole={props.multiple ? undefined : 'radiogroup'}
|
|
65
|
+
style={[s.root, style]}
|
|
66
|
+
>
|
|
67
|
+
{items.map((item) => {
|
|
68
|
+
const selected = isSelected(item.value);
|
|
69
|
+
return (
|
|
70
|
+
<Chip
|
|
71
|
+
key={item.value}
|
|
72
|
+
selected={selected}
|
|
73
|
+
disabled={item.disabled || (full && !selected)}
|
|
74
|
+
accessibilityRole={props.multiple ? 'checkbox' : 'radio'}
|
|
75
|
+
accessibilityState={
|
|
76
|
+
props.multiple ? { checked: selected } : { selected }
|
|
77
|
+
}
|
|
78
|
+
onPress={() => press(item.value)}
|
|
79
|
+
>
|
|
80
|
+
{item.label}
|
|
81
|
+
</Chip>
|
|
82
|
+
);
|
|
83
|
+
})}
|
|
84
|
+
</View>
|
|
85
|
+
);
|
|
86
|
+
}
|