@objectifthunes/limestone-sdk 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animations/confetti/confetti.d.ts +4 -0
- package/dist/animations/confetti/confetti.d.ts.map +1 -0
- package/dist/animations/confetti/confetti.js +10 -0
- package/dist/animations/confetti/confetti.js.map +1 -0
- package/dist/animations/confetti/index.d.ts +4 -0
- package/dist/animations/confetti/index.d.ts.map +1 -0
- package/dist/animations/confetti/index.js +3 -0
- package/dist/animations/confetti/index.js.map +1 -0
- package/dist/animations/confetti/types.d.ts +24 -0
- package/dist/animations/confetti/types.d.ts.map +1 -0
- package/dist/animations/confetti/types.js +2 -0
- package/dist/animations/confetti/types.js.map +1 -0
- package/dist/animations/confetti/use-confetti.d.ts +4 -0
- package/dist/animations/confetti/use-confetti.d.ts.map +1 -0
- package/dist/animations/confetti/use-confetti.js +35 -0
- package/dist/animations/confetti/use-confetti.js.map +1 -0
- package/dist/animations/error-shake/error-shake.d.ts +4 -0
- package/dist/animations/error-shake/error-shake.d.ts.map +1 -0
- package/dist/animations/error-shake/error-shake.js +10 -0
- package/dist/animations/error-shake/error-shake.js.map +1 -0
- package/dist/animations/error-shake/index.d.ts +4 -0
- package/dist/animations/error-shake/index.d.ts.map +1 -0
- package/dist/animations/error-shake/index.js +3 -0
- package/dist/animations/error-shake/index.js.map +1 -0
- package/dist/animations/error-shake/types.d.ts +14 -0
- package/dist/animations/error-shake/types.d.ts.map +1 -0
- package/dist/animations/error-shake/types.js +2 -0
- package/dist/animations/error-shake/types.js.map +1 -0
- package/dist/animations/error-shake/use-error-shake.d.ts +4 -0
- package/dist/animations/error-shake/use-error-shake.d.ts.map +1 -0
- package/dist/animations/error-shake/use-error-shake.js +15 -0
- package/dist/animations/error-shake/use-error-shake.js.map +1 -0
- package/dist/animations/index.d.ts +4 -0
- package/dist/animations/index.d.ts.map +1 -1
- package/dist/animations/index.js +2 -0
- package/dist/animations/index.js.map +1 -1
- package/dist/components/data-display/activity-ring/activity-ring.d.ts +4 -0
- package/dist/components/data-display/activity-ring/activity-ring.d.ts.map +1 -0
- package/dist/components/data-display/activity-ring/activity-ring.js +10 -0
- package/dist/components/data-display/activity-ring/activity-ring.js.map +1 -0
- package/dist/components/data-display/activity-ring/index.d.ts +4 -0
- package/dist/components/data-display/activity-ring/index.d.ts.map +1 -0
- package/dist/components/data-display/activity-ring/index.js +3 -0
- package/dist/components/data-display/activity-ring/index.js.map +1 -0
- package/dist/components/data-display/activity-ring/types.d.ts +35 -0
- package/dist/components/data-display/activity-ring/types.d.ts.map +1 -0
- package/dist/components/data-display/activity-ring/types.js +2 -0
- package/dist/components/data-display/activity-ring/types.js.map +1 -0
- package/dist/components/data-display/activity-ring/use-activity-ring.d.ts +4 -0
- package/dist/components/data-display/activity-ring/use-activity-ring.d.ts.map +1 -0
- package/dist/components/data-display/activity-ring/use-activity-ring.js +61 -0
- package/dist/components/data-display/activity-ring/use-activity-ring.js.map +1 -0
- package/dist/components/data-display/chart/chart.d.ts +4 -0
- package/dist/components/data-display/chart/chart.d.ts.map +1 -0
- package/dist/components/data-display/chart/chart.js +10 -0
- package/dist/components/data-display/chart/chart.js.map +1 -0
- package/dist/components/data-display/chart/index.d.ts +4 -0
- package/dist/components/data-display/chart/index.d.ts.map +1 -0
- package/dist/components/data-display/chart/index.js +3 -0
- package/dist/components/data-display/chart/index.js.map +1 -0
- package/dist/components/data-display/chart/types.d.ts +86 -0
- package/dist/components/data-display/chart/types.d.ts.map +1 -0
- package/dist/components/data-display/chart/types.js +2 -0
- package/dist/components/data-display/chart/types.js.map +1 -0
- package/dist/components/data-display/chart/use-chart.d.ts +4 -0
- package/dist/components/data-display/chart/use-chart.d.ts.map +1 -0
- package/dist/components/data-display/chart/use-chart.js +172 -0
- package/dist/components/data-display/chart/use-chart.js.map +1 -0
- package/dist/components/data-display/countdown-timer/countdown-timer.d.ts +4 -0
- package/dist/components/data-display/countdown-timer/countdown-timer.d.ts.map +1 -0
- package/dist/components/data-display/countdown-timer/countdown-timer.js +10 -0
- package/dist/components/data-display/countdown-timer/countdown-timer.js.map +1 -0
- package/dist/components/data-display/countdown-timer/index.d.ts +4 -0
- package/dist/components/data-display/countdown-timer/index.d.ts.map +1 -0
- package/dist/components/data-display/countdown-timer/index.js +3 -0
- package/dist/components/data-display/countdown-timer/index.js.map +1 -0
- package/dist/components/data-display/countdown-timer/types.d.ts +37 -0
- package/dist/components/data-display/countdown-timer/types.d.ts.map +1 -0
- package/dist/components/data-display/countdown-timer/types.js +2 -0
- package/dist/components/data-display/countdown-timer/types.js.map +1 -0
- package/dist/components/data-display/countdown-timer/use-countdown-timer.d.ts +4 -0
- package/dist/components/data-display/countdown-timer/use-countdown-timer.d.ts.map +1 -0
- package/dist/components/data-display/countdown-timer/use-countdown-timer.js +81 -0
- package/dist/components/data-display/countdown-timer/use-countdown-timer.js.map +1 -0
- package/dist/components/data-display/credit-card-display/credit-card-display.d.ts +4 -0
- package/dist/components/data-display/credit-card-display/credit-card-display.d.ts.map +1 -0
- package/dist/components/data-display/credit-card-display/credit-card-display.js +10 -0
- package/dist/components/data-display/credit-card-display/credit-card-display.js.map +1 -0
- package/dist/components/data-display/credit-card-display/index.d.ts +4 -0
- package/dist/components/data-display/credit-card-display/index.d.ts.map +1 -0
- package/dist/components/data-display/credit-card-display/index.js +3 -0
- package/dist/components/data-display/credit-card-display/index.js.map +1 -0
- package/dist/components/data-display/credit-card-display/types.d.ts +41 -0
- package/dist/components/data-display/credit-card-display/types.d.ts.map +1 -0
- package/dist/components/data-display/credit-card-display/types.js +2 -0
- package/dist/components/data-display/credit-card-display/types.js.map +1 -0
- package/dist/components/data-display/credit-card-display/use-credit-card-display.d.ts +4 -0
- package/dist/components/data-display/credit-card-display/use-credit-card-display.d.ts.map +1 -0
- package/dist/components/data-display/credit-card-display/use-credit-card-display.js +72 -0
- package/dist/components/data-display/credit-card-display/use-credit-card-display.js.map +1 -0
- package/dist/components/data-display/data-table/data-table.d.ts +4 -0
- package/dist/components/data-display/data-table/data-table.d.ts.map +1 -0
- package/dist/components/data-display/data-table/data-table.js +10 -0
- package/dist/components/data-display/data-table/data-table.js.map +1 -0
- package/dist/components/data-display/data-table/index.d.ts +4 -0
- package/dist/components/data-display/data-table/index.d.ts.map +1 -0
- package/dist/components/data-display/data-table/index.js +3 -0
- package/dist/components/data-display/data-table/index.js.map +1 -0
- package/dist/components/data-display/data-table/types.d.ts +51 -0
- package/dist/components/data-display/data-table/types.d.ts.map +1 -0
- package/dist/components/data-display/data-table/types.js +2 -0
- package/dist/components/data-display/data-table/types.js.map +1 -0
- package/dist/components/data-display/data-table/use-data-table.d.ts +4 -0
- package/dist/components/data-display/data-table/use-data-table.d.ts.map +1 -0
- package/dist/components/data-display/data-table/use-data-table.js +75 -0
- package/dist/components/data-display/data-table/use-data-table.js.map +1 -0
- package/dist/components/data-display/index.d.ts +10 -0
- package/dist/components/data-display/index.d.ts.map +1 -1
- package/dist/components/data-display/index.js +5 -0
- package/dist/components/data-display/index.js.map +1 -1
- package/dist/components/index.d.ts +15 -4
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +9 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/inputs/calendar/calendar.d.ts +4 -0
- package/dist/components/inputs/calendar/calendar.d.ts.map +1 -0
- package/dist/components/inputs/calendar/calendar.js +10 -0
- package/dist/components/inputs/calendar/calendar.js.map +1 -0
- package/dist/components/inputs/calendar/index.d.ts +4 -0
- package/dist/components/inputs/calendar/index.d.ts.map +1 -0
- package/dist/components/inputs/calendar/index.js +3 -0
- package/dist/components/inputs/calendar/index.js.map +1 -0
- package/dist/components/inputs/calendar/types.d.ts +52 -0
- package/dist/components/inputs/calendar/types.d.ts.map +1 -0
- package/dist/components/inputs/calendar/types.js +2 -0
- package/dist/components/inputs/calendar/types.js.map +1 -0
- package/dist/components/inputs/calendar/use-calendar.d.ts +4 -0
- package/dist/components/inputs/calendar/use-calendar.d.ts.map +1 -0
- package/dist/components/inputs/calendar/use-calendar.js +192 -0
- package/dist/components/inputs/calendar/use-calendar.js.map +1 -0
- package/dist/components/inputs/index.d.ts +4 -0
- package/dist/components/inputs/index.d.ts.map +1 -1
- package/dist/components/inputs/index.js +2 -0
- package/dist/components/inputs/index.js.map +1 -1
- package/dist/components/inputs/signature-pad/index.d.ts +4 -0
- package/dist/components/inputs/signature-pad/index.d.ts.map +1 -0
- package/dist/components/inputs/signature-pad/index.js +3 -0
- package/dist/components/inputs/signature-pad/index.js.map +1 -0
- package/dist/components/inputs/signature-pad/signature-pad.d.ts +4 -0
- package/dist/components/inputs/signature-pad/signature-pad.d.ts.map +1 -0
- package/dist/components/inputs/signature-pad/signature-pad.js +10 -0
- package/dist/components/inputs/signature-pad/signature-pad.js.map +1 -0
- package/dist/components/inputs/signature-pad/types.d.ts +47 -0
- package/dist/components/inputs/signature-pad/types.d.ts.map +1 -0
- package/dist/components/inputs/signature-pad/types.js +2 -0
- package/dist/components/inputs/signature-pad/types.js.map +1 -0
- package/dist/components/inputs/signature-pad/use-signature-pad.d.ts +4 -0
- package/dist/components/inputs/signature-pad/use-signature-pad.d.ts.map +1 -0
- package/dist/components/inputs/signature-pad/use-signature-pad.js +60 -0
- package/dist/components/inputs/signature-pad/use-signature-pad.js.map +1 -0
- package/dist/components/interactive/drag-to-reorder/drag-to-reorder.d.ts +4 -0
- package/dist/components/interactive/drag-to-reorder/drag-to-reorder.d.ts.map +1 -0
- package/dist/components/interactive/drag-to-reorder/drag-to-reorder.js +10 -0
- package/dist/components/interactive/drag-to-reorder/drag-to-reorder.js.map +1 -0
- package/dist/components/interactive/drag-to-reorder/index.d.ts +4 -0
- package/dist/components/interactive/drag-to-reorder/index.d.ts.map +1 -0
- package/dist/components/interactive/drag-to-reorder/index.js +3 -0
- package/dist/components/interactive/drag-to-reorder/index.js.map +1 -0
- package/dist/components/interactive/drag-to-reorder/types.d.ts +24 -0
- package/dist/components/interactive/drag-to-reorder/types.d.ts.map +1 -0
- package/dist/components/interactive/drag-to-reorder/types.js +2 -0
- package/dist/components/interactive/drag-to-reorder/types.js.map +1 -0
- package/dist/components/interactive/drag-to-reorder/use-drag-to-reorder.d.ts +4 -0
- package/dist/components/interactive/drag-to-reorder/use-drag-to-reorder.d.ts.map +1 -0
- package/dist/components/interactive/drag-to-reorder/use-drag-to-reorder.js +44 -0
- package/dist/components/interactive/drag-to-reorder/use-drag-to-reorder.js.map +1 -0
- package/dist/components/interactive/index.d.ts +10 -0
- package/dist/components/interactive/index.d.ts.map +1 -1
- package/dist/components/interactive/index.js +5 -0
- package/dist/components/interactive/index.js.map +1 -1
- package/dist/components/interactive/page-view/index.d.ts +4 -0
- package/dist/components/interactive/page-view/index.d.ts.map +1 -0
- package/dist/components/interactive/page-view/index.js +3 -0
- package/dist/components/interactive/page-view/index.js.map +1 -0
- package/dist/components/interactive/page-view/page-view.d.ts +4 -0
- package/dist/components/interactive/page-view/page-view.d.ts.map +1 -0
- package/dist/components/interactive/page-view/page-view.js +10 -0
- package/dist/components/interactive/page-view/page-view.js.map +1 -0
- package/dist/components/interactive/page-view/types.d.ts +24 -0
- package/dist/components/interactive/page-view/types.d.ts.map +1 -0
- package/dist/components/interactive/page-view/types.js +2 -0
- package/dist/components/interactive/page-view/types.js.map +1 -0
- package/dist/components/interactive/page-view/use-page-view.d.ts +4 -0
- package/dist/components/interactive/page-view/use-page-view.d.ts.map +1 -0
- package/dist/components/interactive/page-view/use-page-view.js +45 -0
- package/dist/components/interactive/page-view/use-page-view.js.map +1 -0
- package/dist/components/interactive/parallax-header/index.d.ts +4 -0
- package/dist/components/interactive/parallax-header/index.d.ts.map +1 -0
- package/dist/components/interactive/parallax-header/index.js +3 -0
- package/dist/components/interactive/parallax-header/index.js.map +1 -0
- package/dist/components/interactive/parallax-header/parallax-header.d.ts +4 -0
- package/dist/components/interactive/parallax-header/parallax-header.d.ts.map +1 -0
- package/dist/components/interactive/parallax-header/parallax-header.js +10 -0
- package/dist/components/interactive/parallax-header/parallax-header.js.map +1 -0
- package/dist/components/interactive/parallax-header/types.d.ts +16 -0
- package/dist/components/interactive/parallax-header/types.d.ts.map +1 -0
- package/dist/components/interactive/parallax-header/types.js +2 -0
- package/dist/components/interactive/parallax-header/types.js.map +1 -0
- package/dist/components/interactive/parallax-header/use-parallax-header.d.ts +4 -0
- package/dist/components/interactive/parallax-header/use-parallax-header.d.ts.map +1 -0
- package/dist/components/interactive/parallax-header/use-parallax-header.js +24 -0
- package/dist/components/interactive/parallax-header/use-parallax-header.js.map +1 -0
- package/dist/components/interactive/pinch-to-zoom/index.d.ts +4 -0
- package/dist/components/interactive/pinch-to-zoom/index.d.ts.map +1 -0
- package/dist/components/interactive/pinch-to-zoom/index.js +3 -0
- package/dist/components/interactive/pinch-to-zoom/index.js.map +1 -0
- package/dist/components/interactive/pinch-to-zoom/pinch-to-zoom.d.ts +4 -0
- package/dist/components/interactive/pinch-to-zoom/pinch-to-zoom.d.ts.map +1 -0
- package/dist/components/interactive/pinch-to-zoom/pinch-to-zoom.js +10 -0
- package/dist/components/interactive/pinch-to-zoom/pinch-to-zoom.js.map +1 -0
- package/dist/components/interactive/pinch-to-zoom/types.d.ts +25 -0
- package/dist/components/interactive/pinch-to-zoom/types.d.ts.map +1 -0
- package/dist/components/interactive/pinch-to-zoom/types.js +2 -0
- package/dist/components/interactive/pinch-to-zoom/types.js.map +1 -0
- package/dist/components/interactive/pinch-to-zoom/use-pinch-to-zoom.d.ts +4 -0
- package/dist/components/interactive/pinch-to-zoom/use-pinch-to-zoom.d.ts.map +1 -0
- package/dist/components/interactive/pinch-to-zoom/use-pinch-to-zoom.js +38 -0
- package/dist/components/interactive/pinch-to-zoom/use-pinch-to-zoom.js.map +1 -0
- package/dist/components/interactive/pull-to-refresh/index.d.ts +4 -0
- package/dist/components/interactive/pull-to-refresh/index.d.ts.map +1 -0
- package/dist/components/interactive/pull-to-refresh/index.js +3 -0
- package/dist/components/interactive/pull-to-refresh/index.js.map +1 -0
- package/dist/components/interactive/pull-to-refresh/pull-to-refresh.d.ts +4 -0
- package/dist/components/interactive/pull-to-refresh/pull-to-refresh.d.ts.map +1 -0
- package/dist/components/interactive/pull-to-refresh/pull-to-refresh.js +10 -0
- package/dist/components/interactive/pull-to-refresh/pull-to-refresh.js.map +1 -0
- package/dist/components/interactive/pull-to-refresh/types.d.ts +21 -0
- package/dist/components/interactive/pull-to-refresh/types.d.ts.map +1 -0
- package/dist/components/interactive/pull-to-refresh/types.js +2 -0
- package/dist/components/interactive/pull-to-refresh/types.js.map +1 -0
- package/dist/components/interactive/pull-to-refresh/use-pull-to-refresh.d.ts +4 -0
- package/dist/components/interactive/pull-to-refresh/use-pull-to-refresh.d.ts.map +1 -0
- package/dist/components/interactive/pull-to-refresh/use-pull-to-refresh.js +28 -0
- package/dist/components/interactive/pull-to-refresh/use-pull-to-refresh.js.map +1 -0
- package/dist/components/social/comment-thread/comment-thread.d.ts +3 -0
- package/dist/components/social/comment-thread/comment-thread.d.ts.map +1 -0
- package/dist/components/social/comment-thread/comment-thread.js +88 -0
- package/dist/components/social/comment-thread/comment-thread.js.map +1 -0
- package/dist/components/social/comment-thread/index.d.ts +4 -0
- package/dist/components/social/comment-thread/index.d.ts.map +1 -0
- package/dist/components/social/comment-thread/index.js +3 -0
- package/dist/components/social/comment-thread/index.js.map +1 -0
- package/dist/components/social/comment-thread/types.d.ts +47 -0
- package/dist/components/social/comment-thread/types.d.ts.map +1 -0
- package/dist/components/social/comment-thread/types.js +2 -0
- package/dist/components/social/comment-thread/types.js.map +1 -0
- package/dist/components/social/comment-thread/use-comment-thread.d.ts +4 -0
- package/dist/components/social/comment-thread/use-comment-thread.d.ts.map +1 -0
- package/dist/components/social/comment-thread/use-comment-thread.js +100 -0
- package/dist/components/social/comment-thread/use-comment-thread.js.map +1 -0
- package/dist/components/social/index.d.ts +11 -0
- package/dist/components/social/index.d.ts.map +1 -0
- package/dist/components/social/index.js +6 -0
- package/dist/components/social/index.js.map +1 -0
- package/dist/components/social/mention-input/index.d.ts +4 -0
- package/dist/components/social/mention-input/index.d.ts.map +1 -0
- package/dist/components/social/mention-input/index.js +3 -0
- package/dist/components/social/mention-input/index.js.map +1 -0
- package/dist/components/social/mention-input/mention-input.d.ts +3 -0
- package/dist/components/social/mention-input/mention-input.d.ts.map +1 -0
- package/dist/components/social/mention-input/mention-input.js +50 -0
- package/dist/components/social/mention-input/mention-input.js.map +1 -0
- package/dist/components/social/mention-input/types.d.ts +46 -0
- package/dist/components/social/mention-input/types.d.ts.map +1 -0
- package/dist/components/social/mention-input/types.js +2 -0
- package/dist/components/social/mention-input/types.js.map +1 -0
- package/dist/components/social/mention-input/use-mention-input.d.ts +4 -0
- package/dist/components/social/mention-input/use-mention-input.d.ts.map +1 -0
- package/dist/components/social/mention-input/use-mention-input.js +124 -0
- package/dist/components/social/mention-input/use-mention-input.js.map +1 -0
- package/dist/components/social/presence-indicator/index.d.ts +4 -0
- package/dist/components/social/presence-indicator/index.d.ts.map +1 -0
- package/dist/components/social/presence-indicator/index.js +3 -0
- package/dist/components/social/presence-indicator/index.js.map +1 -0
- package/dist/components/social/presence-indicator/presence-indicator.d.ts +3 -0
- package/dist/components/social/presence-indicator/presence-indicator.d.ts.map +1 -0
- package/dist/components/social/presence-indicator/presence-indicator.js +17 -0
- package/dist/components/social/presence-indicator/presence-indicator.js.map +1 -0
- package/dist/components/social/presence-indicator/types.d.ts +24 -0
- package/dist/components/social/presence-indicator/types.d.ts.map +1 -0
- package/dist/components/social/presence-indicator/types.js +2 -0
- package/dist/components/social/presence-indicator/types.js.map +1 -0
- package/dist/components/social/presence-indicator/use-presence-indicator.d.ts +4 -0
- package/dist/components/social/presence-indicator/use-presence-indicator.d.ts.map +1 -0
- package/dist/components/social/presence-indicator/use-presence-indicator.js +60 -0
- package/dist/components/social/presence-indicator/use-presence-indicator.js.map +1 -0
- package/dist/components/social/reaction-picker/index.d.ts +4 -0
- package/dist/components/social/reaction-picker/index.d.ts.map +1 -0
- package/dist/components/social/reaction-picker/index.js +3 -0
- package/dist/components/social/reaction-picker/index.js.map +1 -0
- package/dist/components/social/reaction-picker/reaction-picker.d.ts +11 -0
- package/dist/components/social/reaction-picker/reaction-picker.d.ts.map +1 -0
- package/dist/components/social/reaction-picker/reaction-picker.js +25 -0
- package/dist/components/social/reaction-picker/reaction-picker.js.map +1 -0
- package/dist/components/social/reaction-picker/types.d.ts +41 -0
- package/dist/components/social/reaction-picker/types.d.ts.map +1 -0
- package/dist/components/social/reaction-picker/types.js +2 -0
- package/dist/components/social/reaction-picker/types.js.map +1 -0
- package/dist/components/social/reaction-picker/use-reaction-picker.d.ts +4 -0
- package/dist/components/social/reaction-picker/use-reaction-picker.d.ts.map +1 -0
- package/dist/components/social/reaction-picker/use-reaction-picker.js +93 -0
- package/dist/components/social/reaction-picker/use-reaction-picker.js.map +1 -0
- package/dist/components/social/story-row/index.d.ts +4 -0
- package/dist/components/social/story-row/index.d.ts.map +1 -0
- package/dist/components/social/story-row/index.js +3 -0
- package/dist/components/social/story-row/index.js.map +1 -0
- package/dist/components/social/story-row/story-row.d.ts +13 -0
- package/dist/components/social/story-row/story-row.d.ts.map +1 -0
- package/dist/components/social/story-row/story-row.js +29 -0
- package/dist/components/social/story-row/story-row.js.map +1 -0
- package/dist/components/social/story-row/types.d.ts +37 -0
- package/dist/components/social/story-row/types.d.ts.map +1 -0
- package/dist/components/social/story-row/types.js +2 -0
- package/dist/components/social/story-row/types.js.map +1 -0
- package/dist/components/social/story-row/use-story-row.d.ts +4 -0
- package/dist/components/social/story-row/use-story-row.d.ts.map +1 -0
- package/dist/components/social/story-row/use-story-row.js +71 -0
- package/dist/components/social/story-row/use-story-row.js.map +1 -0
- package/dist/index.d.ts +16 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
const DEFAULT_PADDING = { top: 20, right: 20, bottom: 30, left: 40 };
|
|
2
|
+
const COLOR_CYCLE = ['#22c55e', '#eab308', '#ef4444', '#8b5cf6', '#06b6d4'];
|
|
3
|
+
function formatLabel(value) {
|
|
4
|
+
return Number.isInteger(value) ? String(value) : value.toFixed(1);
|
|
5
|
+
}
|
|
6
|
+
export function useChart(tokens, props) {
|
|
7
|
+
const { type, data, width, height, showGrid = true, showLabels = true, padding = DEFAULT_PADDING, } = props;
|
|
8
|
+
const colorCycle = [tokens.colors.primary, tokens.colors.accent, ...COLOR_CYCLE];
|
|
9
|
+
const chartAreaWidth = width - padding.left - padding.right;
|
|
10
|
+
const chartAreaHeight = height - padding.top - padding.bottom;
|
|
11
|
+
const containerStyle = { width, height };
|
|
12
|
+
const chartAreaStyle = {
|
|
13
|
+
position: 'absolute',
|
|
14
|
+
top: padding.top,
|
|
15
|
+
left: padding.left,
|
|
16
|
+
width: chartAreaWidth,
|
|
17
|
+
height: chartAreaHeight,
|
|
18
|
+
};
|
|
19
|
+
const gridLineStyle = {
|
|
20
|
+
stroke: tokens.colors.muted,
|
|
21
|
+
strokeWidth: 1,
|
|
22
|
+
strokeDasharray: '4 4',
|
|
23
|
+
};
|
|
24
|
+
const labelStyle = {
|
|
25
|
+
fontSize: tokens.typography.sizes.xs,
|
|
26
|
+
color: tokens.colors.mutedForeground,
|
|
27
|
+
};
|
|
28
|
+
// Build grid lines (shared for line and bar)
|
|
29
|
+
const buildGridLines = () => {
|
|
30
|
+
if (!showGrid)
|
|
31
|
+
return [];
|
|
32
|
+
return Array.from({ length: 5 }, (_, i) => {
|
|
33
|
+
const y = chartAreaHeight * (i / 4);
|
|
34
|
+
return { x1: 0, y1: y, x2: chartAreaWidth, y2: y };
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
if (type === 'pie') {
|
|
38
|
+
const total = data.reduce((sum, d) => sum + d.value, 0);
|
|
39
|
+
const bounds = { minX: 0, maxX: width, minY: 0, maxY: height };
|
|
40
|
+
const cx = width / 2;
|
|
41
|
+
const cy = height / 2;
|
|
42
|
+
const maxPad = Math.max(padding.top, padding.right, padding.bottom, padding.left);
|
|
43
|
+
const radius = Math.min(width, height) / 2 - maxPad;
|
|
44
|
+
let currentAngle = -Math.PI / 2;
|
|
45
|
+
const slices = data.map((d, i) => {
|
|
46
|
+
const sliceAngle = total > 0 ? (d.value / total) * 2 * Math.PI : 0;
|
|
47
|
+
const startAngle = currentAngle;
|
|
48
|
+
const endAngle = currentAngle + sliceAngle;
|
|
49
|
+
currentAngle = endAngle;
|
|
50
|
+
const midAngle = startAngle + sliceAngle / 2;
|
|
51
|
+
const labelPosition = {
|
|
52
|
+
x: cx + Math.cos(midAngle) * radius * 0.6,
|
|
53
|
+
y: cy + Math.sin(midAngle) * radius * 0.6,
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
startAngle,
|
|
57
|
+
endAngle,
|
|
58
|
+
color: d.color ?? colorCycle[i % colorCycle.length],
|
|
59
|
+
value: d.value,
|
|
60
|
+
percentage: total > 0 ? (d.value / total) * 100 : 0,
|
|
61
|
+
labelPosition,
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
points: undefined,
|
|
66
|
+
pathData: undefined,
|
|
67
|
+
bars: undefined,
|
|
68
|
+
slices,
|
|
69
|
+
gridLines: [],
|
|
70
|
+
xLabels: [],
|
|
71
|
+
yLabels: [],
|
|
72
|
+
bounds,
|
|
73
|
+
containerStyle,
|
|
74
|
+
gridLineStyle,
|
|
75
|
+
labelStyle,
|
|
76
|
+
chartAreaStyle,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const values = data.map((d) => d.value);
|
|
80
|
+
const minValue = values.length > 0 ? Math.min(...values) : 0;
|
|
81
|
+
const maxValue = values.length > 0 ? Math.max(...values) : 0;
|
|
82
|
+
const range = maxValue - minValue || 1;
|
|
83
|
+
const bounds = {
|
|
84
|
+
minX: 0,
|
|
85
|
+
maxX: chartAreaWidth,
|
|
86
|
+
minY: minValue,
|
|
87
|
+
maxY: maxValue,
|
|
88
|
+
};
|
|
89
|
+
const gridLines = buildGridLines();
|
|
90
|
+
const yLabels = showLabels
|
|
91
|
+
? Array.from({ length: 5 }, (_, i) => {
|
|
92
|
+
const y = chartAreaHeight * (i / 4);
|
|
93
|
+
const value = minValue + range * (1 - i / 4);
|
|
94
|
+
return { x: -padding.left / 2, y, label: formatLabel(value) };
|
|
95
|
+
})
|
|
96
|
+
: [];
|
|
97
|
+
if (type === 'line') {
|
|
98
|
+
const xStep = data.length > 1 ? chartAreaWidth / (data.length - 1) : 0;
|
|
99
|
+
const points = data.map((d, i) => ({
|
|
100
|
+
x: i * xStep,
|
|
101
|
+
y: chartAreaHeight - ((d.value - minValue) / range) * chartAreaHeight,
|
|
102
|
+
value: d.value,
|
|
103
|
+
}));
|
|
104
|
+
let pathData;
|
|
105
|
+
if (points.length > 0) {
|
|
106
|
+
const first = points[0];
|
|
107
|
+
pathData = `M ${first.x} ${first.y}`;
|
|
108
|
+
for (let i = 1; i < points.length; i++) {
|
|
109
|
+
const p = points[i];
|
|
110
|
+
pathData += ` L ${p.x} ${p.y}`;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const xLabels = showLabels
|
|
114
|
+
? points.map((p, i) => ({
|
|
115
|
+
x: p.x,
|
|
116
|
+
y: chartAreaHeight + 16,
|
|
117
|
+
label: data[i].label,
|
|
118
|
+
}))
|
|
119
|
+
: [];
|
|
120
|
+
return {
|
|
121
|
+
points,
|
|
122
|
+
pathData,
|
|
123
|
+
bars: undefined,
|
|
124
|
+
slices: undefined,
|
|
125
|
+
gridLines,
|
|
126
|
+
xLabels,
|
|
127
|
+
yLabels,
|
|
128
|
+
bounds,
|
|
129
|
+
containerStyle,
|
|
130
|
+
gridLineStyle,
|
|
131
|
+
labelStyle,
|
|
132
|
+
chartAreaStyle,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
// bar chart
|
|
136
|
+
const barSlotWidth = chartAreaWidth / data.length;
|
|
137
|
+
const barWidth = barSlotWidth * 0.7;
|
|
138
|
+
const barGap = barSlotWidth * 0.3 / 2;
|
|
139
|
+
const bars = data.map((d, i) => {
|
|
140
|
+
const barHeight = Math.max(2, ((d.value - minValue) / range) * chartAreaHeight);
|
|
141
|
+
return {
|
|
142
|
+
x: i * barSlotWidth + barGap,
|
|
143
|
+
y: chartAreaHeight - barHeight,
|
|
144
|
+
width: barWidth,
|
|
145
|
+
height: barHeight,
|
|
146
|
+
value: d.value,
|
|
147
|
+
color: d.color ?? colorCycle[i % colorCycle.length],
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
const xLabels = showLabels
|
|
151
|
+
? bars.map((b, i) => ({
|
|
152
|
+
x: b.x + b.width / 2,
|
|
153
|
+
y: chartAreaHeight + 16,
|
|
154
|
+
label: data[i].label,
|
|
155
|
+
}))
|
|
156
|
+
: [];
|
|
157
|
+
return {
|
|
158
|
+
points: undefined,
|
|
159
|
+
pathData: undefined,
|
|
160
|
+
bars,
|
|
161
|
+
slices: undefined,
|
|
162
|
+
gridLines,
|
|
163
|
+
xLabels,
|
|
164
|
+
yLabels,
|
|
165
|
+
bounds,
|
|
166
|
+
containerStyle,
|
|
167
|
+
gridLineStyle,
|
|
168
|
+
labelStyle,
|
|
169
|
+
chartAreaStyle,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=use-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-chart.js","sourceRoot":"","sources":["../../../../src/components/data-display/chart/use-chart.ts"],"names":[],"mappings":"AAaA,MAAM,eAAe,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AACrE,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAE5E,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,MAAM,CA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N,cAAc;QACd,aAAa;QACb,UAAU;QACV,cAAc;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countdown-timer.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/countdown-timer/countdown-timer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAK3F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../../theme/context.js';
|
|
4
|
+
import { useCountdownTimer } from './use-countdown-timer.js';
|
|
5
|
+
export function CountdownTimer(props) {
|
|
6
|
+
const { tokens } = useTheme();
|
|
7
|
+
const { containerStyle } = useCountdownTimer(tokens, props);
|
|
8
|
+
return createElement(View, { style: containerStyle, testID: props.testID });
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=countdown-timer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countdown-timer.js","sourceRoot":"","sources":["../../../../src/components/data-display/countdown-timer/countdown-timer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC9B,MAAM,EAAE,cAAc,EAAE,GAAG,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAE5D,OAAO,aAAa,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/countdown-timer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/data-display/countdown-timer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ResolvedBoxStyle } from '../../use-component-style.js';
|
|
2
|
+
export type CountdownFormat = 'hh:mm:ss' | 'dd:hh:mm:ss' | 'mm:ss';
|
|
3
|
+
export interface CountdownTimerProps {
|
|
4
|
+
targetDate?: Date;
|
|
5
|
+
durationMs?: number;
|
|
6
|
+
format?: CountdownFormat;
|
|
7
|
+
onComplete?: () => void;
|
|
8
|
+
testID?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CountdownSegment {
|
|
11
|
+
value: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}
|
|
14
|
+
export interface UseCountdownTimerResult {
|
|
15
|
+
containerStyle: ResolvedBoxStyle;
|
|
16
|
+
getSegmentStyle: (index: number) => ResolvedBoxStyle;
|
|
17
|
+
segmentValueStyle: {
|
|
18
|
+
fontSize: number;
|
|
19
|
+
fontWeight: string;
|
|
20
|
+
fontFamily: string;
|
|
21
|
+
color: string;
|
|
22
|
+
};
|
|
23
|
+
segmentLabelStyle: {
|
|
24
|
+
fontSize: number;
|
|
25
|
+
color: string;
|
|
26
|
+
fontFamily: string;
|
|
27
|
+
};
|
|
28
|
+
separatorStyle: {
|
|
29
|
+
fontSize: number;
|
|
30
|
+
fontWeight: string;
|
|
31
|
+
color: string;
|
|
32
|
+
};
|
|
33
|
+
segments: CountdownSegment[];
|
|
34
|
+
isComplete: boolean;
|
|
35
|
+
remainingMs: number;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/countdown-timer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,aAAa,GAAG,OAAO,CAAC;AAEnE,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,gBAAgB,CAAC;IACjC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,gBAAgB,CAAC;IACrD,iBAAiB,EAAE;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,iBAAiB,EAAE;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,cAAc,EAAE;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/data-display/countdown-timer/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ThemeTokens } from '../../../theme/tokens.js';
|
|
2
|
+
import type { CountdownTimerProps, UseCountdownTimerResult } from './types.js';
|
|
3
|
+
export declare function useCountdownTimer(tokens: ThemeTokens, props: CountdownTimerProps): UseCountdownTimerResult;
|
|
4
|
+
//# sourceMappingURL=use-countdown-timer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-countdown-timer.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/countdown-timer/use-countdown-timer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAoB,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAOjG,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,mBAAmB,GACzB,uBAAuB,CA0FzB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
function pad(n) {
|
|
2
|
+
return String(n).padStart(2, '0');
|
|
3
|
+
}
|
|
4
|
+
export function useCountdownTimer(tokens, props) {
|
|
5
|
+
const { targetDate, durationMs, format = 'hh:mm:ss', } = props;
|
|
6
|
+
const remainingMs = Math.max(0, targetDate ? targetDate.getTime() - Date.now() : durationMs ?? 0);
|
|
7
|
+
const isComplete = remainingMs <= 0;
|
|
8
|
+
let segments;
|
|
9
|
+
if (format === 'dd:hh:mm:ss') {
|
|
10
|
+
const days = Math.floor(remainingMs / 86400000);
|
|
11
|
+
const hours = Math.floor((remainingMs % 86400000) / 3600000);
|
|
12
|
+
const minutes = Math.floor((remainingMs % 3600000) / 60000);
|
|
13
|
+
const seconds = Math.floor((remainingMs % 60000) / 1000);
|
|
14
|
+
segments = [
|
|
15
|
+
{ value: pad(days), label: 'DAYS' },
|
|
16
|
+
{ value: pad(hours), label: 'HRS' },
|
|
17
|
+
{ value: pad(minutes), label: 'MIN' },
|
|
18
|
+
{ value: pad(seconds), label: 'SEC' },
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
else if (format === 'mm:ss') {
|
|
22
|
+
const minutes = Math.floor(remainingMs / 60000);
|
|
23
|
+
const seconds = Math.floor((remainingMs % 60000) / 1000);
|
|
24
|
+
segments = [
|
|
25
|
+
{ value: pad(minutes), label: 'MIN' },
|
|
26
|
+
{ value: pad(seconds), label: 'SEC' },
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
// hh:mm:ss
|
|
31
|
+
const hours = Math.floor(remainingMs / 3600000);
|
|
32
|
+
const minutes = Math.floor((remainingMs % 3600000) / 60000);
|
|
33
|
+
const seconds = Math.floor((remainingMs % 60000) / 1000);
|
|
34
|
+
segments = [
|
|
35
|
+
{ value: pad(hours), label: 'HRS' },
|
|
36
|
+
{ value: pad(minutes), label: 'MIN' },
|
|
37
|
+
{ value: pad(seconds), label: 'SEC' },
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
const containerStyle = {
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
gap: tokens.spacing.xs,
|
|
44
|
+
};
|
|
45
|
+
const getSegmentStyle = (_index) => ({
|
|
46
|
+
backgroundColor: tokens.colors.card,
|
|
47
|
+
borderRadius: tokens.radii.md,
|
|
48
|
+
paddingHorizontal: tokens.spacing.sm,
|
|
49
|
+
paddingVertical: tokens.spacing.xs,
|
|
50
|
+
minWidth: 48,
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
justifyContent: 'center',
|
|
53
|
+
});
|
|
54
|
+
const segmentValueStyle = {
|
|
55
|
+
fontSize: tokens.typography.sizes.xl,
|
|
56
|
+
fontWeight: tokens.typography.weights.bold,
|
|
57
|
+
fontFamily: tokens.typography.fontFamily.mono,
|
|
58
|
+
color: tokens.colors.foreground,
|
|
59
|
+
};
|
|
60
|
+
const segmentLabelStyle = {
|
|
61
|
+
fontSize: tokens.typography.sizes.xs,
|
|
62
|
+
color: tokens.colors.mutedForeground,
|
|
63
|
+
fontFamily: tokens.typography.fontFamily.body,
|
|
64
|
+
};
|
|
65
|
+
const separatorStyle = {
|
|
66
|
+
fontSize: tokens.typography.sizes.xl,
|
|
67
|
+
fontWeight: tokens.typography.weights.bold,
|
|
68
|
+
color: tokens.colors.mutedForeground,
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
containerStyle,
|
|
72
|
+
getSegmentStyle,
|
|
73
|
+
segmentValueStyle,
|
|
74
|
+
segmentLabelStyle,
|
|
75
|
+
separatorStyle,
|
|
76
|
+
segments,
|
|
77
|
+
isComplete,
|
|
78
|
+
remainingMs,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=use-countdown-timer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-countdown-timer.js","sourceRoot":"","sources":["../../../../src/components/data-display/countdown-timer/use-countdown-timer.ts"],"names":[],"mappings":"AAIA,SAAS,GAAG,CAAC,CAAS;IACpB,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,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,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE;QACpC,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE;QAClC,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG;QACxB,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QACpC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI;QAC1C,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI;QAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;KAChC,CAAC;IAEF,MAAM,iBAAiB,GAAG;QACxB,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QACpC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe;QACpC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI;KAC9C,CAAC;IAEF,MAAM,cAAc,GAAG;QACrB,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QACpC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI;QAC1C,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe;KACrC,CAAC;IAEF,OAAO;QACL,cAAc;QACd,eAAe;QACf,iBAAiB;QACjB,iBAAiB;QACjB,cAAc;QACd,QAAQ;QACR,UAAU;QACV,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credit-card-display.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/credit-card-display/credit-card-display.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAKjG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../../theme/context.js';
|
|
4
|
+
import { useCreditCardDisplay } from './use-credit-card-display.js';
|
|
5
|
+
export function CreditCardDisplay(props) {
|
|
6
|
+
const { tokens } = useTheme();
|
|
7
|
+
const { containerStyle } = useCreditCardDisplay(tokens, props);
|
|
8
|
+
return createElement(View, { style: containerStyle, testID: props.testID });
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=credit-card-display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credit-card-display.js","sourceRoot":"","sources":["../../../../src/components/data-display/credit-card-display/credit-card-display.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAGpE,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC9B,MAAM,EAAE,cAAc,EAAE,GAAG,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAE/D,OAAO,aAAa,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { CreditCardDisplay } from './credit-card-display.js';
|
|
2
|
+
export { useCreditCardDisplay } from './use-credit-card-display.js';
|
|
3
|
+
export type { CreditCardDisplayProps, CardBrand, CardSize, UseCreditCardDisplayResult } from './types.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/credit-card-display/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,YAAY,EAAE,sBAAsB,EAAE,SAAS,EAAE,QAAQ,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/data-display/credit-card-display/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ResolvedBoxStyle } from '../../use-component-style.js';
|
|
2
|
+
export type CardBrand = 'visa' | 'mastercard' | 'amex' | 'discover' | 'generic';
|
|
3
|
+
export type CardSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export interface CreditCardDisplayProps {
|
|
5
|
+
last4: string;
|
|
6
|
+
brand: CardBrand;
|
|
7
|
+
holderName?: string;
|
|
8
|
+
expiry?: string;
|
|
9
|
+
gradient?: [string, string];
|
|
10
|
+
size?: CardSize;
|
|
11
|
+
testID?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface UseCreditCardDisplayResult {
|
|
14
|
+
containerStyle: ResolvedBoxStyle;
|
|
15
|
+
maskedNumberStyle: {
|
|
16
|
+
fontSize: number;
|
|
17
|
+
fontFamily: string;
|
|
18
|
+
color: string;
|
|
19
|
+
letterSpacing: number;
|
|
20
|
+
};
|
|
21
|
+
holderNameStyle: {
|
|
22
|
+
fontSize: number;
|
|
23
|
+
color: string;
|
|
24
|
+
textTransform: 'uppercase';
|
|
25
|
+
fontFamily: string;
|
|
26
|
+
};
|
|
27
|
+
expiryLabelStyle: {
|
|
28
|
+
fontSize: number;
|
|
29
|
+
color: string;
|
|
30
|
+
fontFamily: string;
|
|
31
|
+
};
|
|
32
|
+
expiryValueStyle: {
|
|
33
|
+
fontSize: number;
|
|
34
|
+
fontFamily: string;
|
|
35
|
+
color: string;
|
|
36
|
+
};
|
|
37
|
+
brandLogoSize: number;
|
|
38
|
+
gradientColors: [string, string];
|
|
39
|
+
maskedNumber: string;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/credit-card-display/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;AAChF,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1C,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,0BAA0B;IACzC,cAAc,EAAE,gBAAgB,CAAC;IACjC,iBAAiB,EAAE;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,eAAe,EAAE;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,EAAE,WAAW,CAAC;QAC3B,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,gBAAgB,EAAE;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,gBAAgB,EAAE;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/data-display/credit-card-display/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ThemeTokens } from '../../../theme/tokens.js';
|
|
2
|
+
import type { CreditCardDisplayProps, UseCreditCardDisplayResult } from './types.js';
|
|
3
|
+
export declare function useCreditCardDisplay(tokens: ThemeTokens, props: CreditCardDisplayProps): UseCreditCardDisplayResult;
|
|
4
|
+
//# sourceMappingURL=use-credit-card-display.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-credit-card-display.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/credit-card-display/use-credit-card-display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,0BAA0B,EAAuB,MAAM,YAAY,CAAC;AAuB1G,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,sBAAsB,GAC5B,0BAA0B,CAiE5B"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const BRAND_GRADIENTS = {
|
|
2
|
+
visa: ['#1a1f71', '#2563eb'],
|
|
3
|
+
mastercard: ['#eb001b', '#f79e1b'],
|
|
4
|
+
amex: ['#006fcf', '#00a1e4'],
|
|
5
|
+
discover: ['#ff6000', '#ff8a00'],
|
|
6
|
+
generic: ['', ''], // will be set from tokens
|
|
7
|
+
};
|
|
8
|
+
const SIZE_WIDTHS = {
|
|
9
|
+
sm: 240,
|
|
10
|
+
md: 320,
|
|
11
|
+
lg: 400,
|
|
12
|
+
};
|
|
13
|
+
const LOGO_SIZES = {
|
|
14
|
+
sm: 24,
|
|
15
|
+
md: 32,
|
|
16
|
+
lg: 40,
|
|
17
|
+
};
|
|
18
|
+
export function useCreditCardDisplay(tokens, props) {
|
|
19
|
+
const { last4, brand, gradient, size = 'md', } = props;
|
|
20
|
+
const sizeWidth = SIZE_WIDTHS[size];
|
|
21
|
+
const brandLogoSize = LOGO_SIZES[size];
|
|
22
|
+
let gradientColors;
|
|
23
|
+
if (gradient) {
|
|
24
|
+
gradientColors = gradient;
|
|
25
|
+
}
|
|
26
|
+
else if (brand === 'generic') {
|
|
27
|
+
gradientColors = [tokens.colors.muted, tokens.colors.card];
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
gradientColors = BRAND_GRADIENTS[brand];
|
|
31
|
+
}
|
|
32
|
+
const containerStyle = {
|
|
33
|
+
width: sizeWidth,
|
|
34
|
+
aspectRatio: 1.586,
|
|
35
|
+
borderRadius: tokens.radii.lg,
|
|
36
|
+
overflow: 'hidden',
|
|
37
|
+
};
|
|
38
|
+
const maskedNumber = `\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 ${last4}`;
|
|
39
|
+
const maskedNumberStyle = {
|
|
40
|
+
fontSize: tokens.typography.sizes.lg,
|
|
41
|
+
fontFamily: tokens.typography.fontFamily.mono,
|
|
42
|
+
color: tokens.colors.primaryForeground,
|
|
43
|
+
letterSpacing: 4,
|
|
44
|
+
};
|
|
45
|
+
const holderNameStyle = {
|
|
46
|
+
fontSize: tokens.typography.sizes.sm,
|
|
47
|
+
color: tokens.colors.primaryForeground,
|
|
48
|
+
textTransform: 'uppercase',
|
|
49
|
+
fontFamily: tokens.typography.fontFamily.body,
|
|
50
|
+
};
|
|
51
|
+
const expiryLabelStyle = {
|
|
52
|
+
fontSize: tokens.typography.sizes.xs,
|
|
53
|
+
color: 'rgba(255,255,255,0.7)',
|
|
54
|
+
fontFamily: tokens.typography.fontFamily.body,
|
|
55
|
+
};
|
|
56
|
+
const expiryValueStyle = {
|
|
57
|
+
fontSize: tokens.typography.sizes.sm,
|
|
58
|
+
fontFamily: tokens.typography.fontFamily.mono,
|
|
59
|
+
color: tokens.colors.primaryForeground,
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
containerStyle,
|
|
63
|
+
maskedNumberStyle,
|
|
64
|
+
holderNameStyle,
|
|
65
|
+
expiryLabelStyle,
|
|
66
|
+
expiryValueStyle,
|
|
67
|
+
brandLogoSize,
|
|
68
|
+
gradientColors,
|
|
69
|
+
maskedNumber,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=use-credit-card-display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-credit-card-display.js","sourceRoot":"","sources":["../../../../src/components/data-display/credit-card-display/use-credit-card-display.ts"],"names":[],"mappings":"AAIA,MAAM,eAAe,GAAwC;IAC3D,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC5B,UAAU,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAClC,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC5B,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAChC,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,0BAA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ACtC,aAAa,EAAE,CAAC;KACjB,CAAC;IAEF,MAAM,eAAe,GAAG;QACtB,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QACpC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB;QACtC,aAAa,EAAE,WAAoB;QACnC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI;KAC9C,CAAC;IAEF,MAAM,gBAAgB,GAAG;QACvB,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QACpC,KAAK,EAAE,uBAAuB;QAC9B,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI;KAC9C,CAAC;IAEF,MAAM,gBAAgB,GAAG;QACvB,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QACpC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI;QAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB;KACvC,CAAC;IAEF,OAAO;QACL,cAAc;QACd,iBAAiB;QACjB,eAAe;QACf,gBAAgB;QAChB,gBAAgB;QAChB,aAAa;QACb,cAAc;QACd,YAAY;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/data-table/data-table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAQjF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../../theme/context.js';
|
|
4
|
+
import { useDataTable } from './use-data-table.js';
|
|
5
|
+
export function DataTable(props) {
|
|
6
|
+
const { tokens } = useTheme();
|
|
7
|
+
const { containerStyle, accessibilityProps } = useDataTable(tokens, props);
|
|
8
|
+
return createElement(View, { style: containerStyle, ...accessibilityProps, testID: props.testID });
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=data-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table.js","sourceRoot":"","sources":["../../../../src/components/data-display/data-table/data-table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC9B,MAAM,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAE3E,OAAO,aAAa,CAClB,IAAW,EACX,EAAE,KAAK,EAAE,cAAqB,EAAE,GAAG,kBAAkB,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAC9E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/data-table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/data-display/data-table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|