@ankhorage/zora 28.0.0 → 28.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 +6 -0
- package/README.md +1 -1
- package/dist/features/bottom-sheet/adapters/inbound/BottomSheet.js.map +1 -1
- package/dist/features/color/ColorHexField.d.ts +1 -1
- package/dist/features/color/ColorHexField.d.ts.map +1 -1
- package/dist/features/color/ColorHexField.js +30 -3
- package/dist/features/color/ColorHexField.js.map +1 -1
- package/dist/features/color/ColorPicker.d.ts.map +1 -1
- package/dist/features/color/ColorPicker.js +124 -63
- package/dist/features/color/ColorPicker.js.map +1 -1
- package/dist/features/color/ColorWheel.d.ts.map +1 -1
- package/dist/features/color/ColorWheel.js +33 -22
- package/dist/features/color/ColorWheel.js.map +1 -1
- package/dist/features/color/ColorWheelKeyboardProxy.d.ts +1 -0
- package/dist/features/color/ColorWheelKeyboardProxy.d.ts.map +1 -1
- package/dist/features/color/ColorWheelKeyboardProxy.js.map +1 -1
- package/dist/features/color/ColorWheelKeyboardProxy.web.d.ts +1 -1
- package/dist/features/color/ColorWheelKeyboardProxy.web.d.ts.map +1 -1
- package/dist/features/color/ColorWheelKeyboardProxy.web.js +4 -4
- package/dist/features/color/ColorWheelKeyboardProxy.web.js.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.d.ts +1 -0
- package/dist/features/color/ColorWheelPointerProxy.d.ts.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.js.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.native.d.ts +3 -2
- package/dist/features/color/ColorWheelPointerProxy.native.d.ts.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.native.js +12 -3
- package/dist/features/color/ColorWheelPointerProxy.native.js.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.web.d.ts +1 -1
- package/dist/features/color/ColorWheelPointerProxy.web.d.ts.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.web.js +1 -1
- package/dist/features/color/ColorWheelPointerProxy.web.js.map +1 -1
- package/dist/features/color/resolveColorPickerGeometry.d.ts +31 -0
- package/dist/features/color/resolveColorPickerGeometry.d.ts.map +1 -0
- package/dist/features/color/resolveColorPickerGeometry.js +94 -0
- package/dist/features/color/resolveColorPickerGeometry.js.map +1 -0
- package/dist/features/color/utils/resolveWheelColor.d.ts +2 -2
- package/dist/features/color/utils/resolveWheelColor.d.ts.map +1 -1
- package/dist/features/color/utils/resolveWheelColor.js +2 -3
- package/dist/features/color/utils/resolveWheelColor.js.map +1 -1
- package/dist/features/form/select/adapters/inbound/Select.native.js.map +1 -1
- package/dist/features/form/select/composition/SelectTrigger.d.ts.map +1 -1
- package/dist/features/form/select/composition/SelectTrigger.js +2 -2
- package/dist/features/form/select/composition/SelectTrigger.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types/color.d.ts +9 -1
- package/dist/types/color.d.ts.map +1 -1
- package/dist/types/color.js.map +1 -1
- package/dist/types/select.d.ts +2 -0
- package/dist/types/select.d.ts.map +1 -1
- package/dist/types/select.js.map +1 -1
- package/package.json +5 -5
- package/src/features/bottom-sheet/adapters/inbound/BottomSheet.tsx +1 -1
- package/src/features/color/ColorHexField.tsx +67 -21
- package/src/features/color/ColorPicker.layout.test.tsx +19 -10
- package/src/features/color/ColorPicker.tsx +319 -115
- package/src/features/color/ColorWheel.tsx +53 -51
- package/src/features/color/ColorWheelKeyboardProxy.tsx +1 -0
- package/src/features/color/ColorWheelKeyboardProxy.web.tsx +4 -3
- package/src/features/color/ColorWheelPointerProxy.native.tsx +25 -3
- package/src/features/color/ColorWheelPointerProxy.tsx +1 -0
- package/src/features/color/ColorWheelPointerProxy.web.tsx +1 -0
- package/src/features/color/resolveColorPickerGeometry.test.ts +43 -0
- package/src/features/color/resolveColorPickerGeometry.ts +116 -0
- package/src/features/color/utils/resolveWheelColor.ts +2 -3
- package/src/features/form/select/adapters/inbound/Select.native.tsx +1 -1
- package/src/features/form/select/composition/SelectTrigger.tsx +2 -1
- package/src/index.ts +6 -0
- package/src/types/color.ts +9 -1
- package/src/types/select.ts +2 -0
- package/web-dist/chunks/{Accordion-sn241nek.js → Accordion-01bsg7zt.js} +5 -5
- package/web-dist/chunks/{Accordion-jara9sqj.js → Accordion-01zvarrn.js} +8 -9
- package/web-dist/chunks/{Accordion-dxh9yn4f.js → Accordion-0dj1r7w3.js} +1 -1
- package/web-dist/chunks/{Accordion-nkppqfz4.js → Accordion-0xaq2k2h.js} +8 -8
- package/web-dist/chunks/{Accordion-3t2936t6.js → Accordion-15sxxjym.js} +4 -5
- package/web-dist/chunks/{Accordion-eq27a9ms.js → Accordion-1fz55hk4.js} +1 -1
- package/web-dist/chunks/{Accordion-q697hacs.js → Accordion-22cda3h5.js} +7 -8
- package/web-dist/chunks/{Accordion-3ar6p84m.js → Accordion-27yg9ktv.js} +3 -3
- package/web-dist/chunks/{Accordion-94vndckf.js → Accordion-34b3rwbc.js} +6 -8
- package/web-dist/chunks/{Accordion-8wm25z0h.js → Accordion-3zzzw7a8.js} +2 -2
- package/web-dist/chunks/{Accordion-00h253nv.js → Accordion-46n609yq.js} +13 -12
- package/web-dist/chunks/{Accordion-0t53jhx1.js → Accordion-4zb6dcys.js} +4 -7
- package/web-dist/chunks/{Accordion-dfv6p6gt.js → Accordion-5cjhz94e.js} +5 -5
- package/web-dist/chunks/{Accordion-5wx67nhg.js → Accordion-5mga7hty.js} +2 -2
- package/web-dist/chunks/{Accordion-kcx57mk5.js → Accordion-76b0qz8y.js} +24 -22
- package/web-dist/chunks/{Accordion-5adv6dv1.js → Accordion-78tknqmc.js} +4 -4
- package/web-dist/chunks/{Accordion-81rx3bh0.js → Accordion-7bd6zq4s.js} +9 -9
- package/web-dist/chunks/{Accordion-7ppf31tg.js → Accordion-8c4w7366.js} +5 -5
- package/web-dist/chunks/{Accordion-1b2t4k36.js → Accordion-8t6vh482.js} +3 -4
- package/web-dist/chunks/{Accordion-7d0e5vhe.js → Accordion-9d38cgqj.js} +87 -91
- package/web-dist/chunks/{Accordion-6wcbzxzb.js → Accordion-9k7ktksc.js} +212 -215
- package/web-dist/chunks/{Accordion-1dv8wytq.js → Accordion-afpjg1d6.js} +3 -4
- package/web-dist/chunks/{Accordion-j6hgazmz.js → Accordion-b1y5mjac.js} +1 -1
- package/web-dist/chunks/{Accordion-re4r47xn.js → Accordion-b8w0f8s0.js} +6 -7
- package/web-dist/chunks/{Accordion-9fhsfynt.js → Accordion-bexwrnfh.js} +3 -4
- package/web-dist/chunks/Accordion-chdbfcm6.js +93 -0
- package/web-dist/chunks/{Accordion-wbmzvfaw.js → Accordion-d405whfb.js} +2 -2
- package/web-dist/chunks/{Accordion-z9yw0xy9.js → Accordion-de8srt4x.js} +8 -8
- package/web-dist/chunks/{Accordion-dpkp0y4p.js → Accordion-epv5yhch.js} +3 -3
- package/web-dist/chunks/{Accordion-d4dp5ryp.js → Accordion-f4919ghm.js} +4 -4
- package/web-dist/chunks/{Accordion-0gae3kzr.js → Accordion-f8a49gy8.js} +19 -22
- package/web-dist/chunks/{Accordion-3s7zeagv.js → Accordion-fdzyyqe9.js} +1 -1
- package/web-dist/chunks/{Accordion-rev9ssd4.js → Accordion-gnxmybxx.js} +490 -205
- package/web-dist/chunks/{Accordion-36674tfw.js → Accordion-h1q243zq.js} +13 -11
- package/web-dist/chunks/{Accordion-dtt4qkrb.js → Accordion-h63c9k9k.js} +1 -1
- package/web-dist/chunks/{Accordion-43gp801f.js → Accordion-hdyzyw8q.js} +3 -3
- package/web-dist/chunks/{Accordion-phcp8d5v.js → Accordion-htvmkx8s.js} +118 -118
- package/web-dist/chunks/{Accordion-b41rev86.js → Accordion-jmxe6kw0.js} +9 -11
- package/web-dist/chunks/{Accordion-wpj8pd40.js → Accordion-kcm6jcpp.js} +2 -3
- package/web-dist/chunks/{Accordion-fcczvwgg.js → Accordion-mrstcjcm.js} +1 -0
- package/web-dist/chunks/{Accordion-6225tr9r.js → Accordion-mx7nkg85.js} +1 -1
- package/web-dist/chunks/{Accordion-pm2f2j32.js → Accordion-pdjhezmz.js} +2 -2
- package/web-dist/chunks/{Accordion-hbkzy0bg.js → Accordion-q046ws5p.js} +6 -6
- package/web-dist/chunks/{Accordion-tppk4vwt.js → Accordion-q11svb96.js} +19 -19
- package/web-dist/chunks/{Accordion-36j1fw8r.js → Accordion-qkkeyr18.js} +6 -8
- package/web-dist/chunks/{Accordion-c8mmgjtj.js → Accordion-qrt9xz0h.js} +7 -8
- package/web-dist/chunks/{Accordion-z1cq2mnx.js → Accordion-qsppnx7g.js} +10 -11
- package/web-dist/chunks/{Accordion-neg1cgeh.js → Accordion-rhjddvkh.js} +1 -2
- package/web-dist/chunks/{Accordion-238zba4h.js → Accordion-rtamzg9j.js} +47 -28
- package/web-dist/chunks/{Accordion-zzymcpty.js → Accordion-sfvqf4fz.js} +134 -132
- package/web-dist/chunks/{Accordion-ah1d9b6z.js → Accordion-sh79sr5g.js} +5 -5
- package/web-dist/chunks/{Accordion-wcw153f0.js → Accordion-t9n4ey2r.js} +5 -3
- package/web-dist/chunks/{Accordion-zte416jw.js → Accordion-tk8zf9ff.js} +3 -3
- package/web-dist/chunks/{Accordion-zypyr9xw.js → Accordion-tnyqv1xv.js} +296 -305
- package/web-dist/chunks/{Accordion-52s4t1aq.js → Accordion-v6vhyv31.js} +95 -165
- package/web-dist/chunks/{Accordion-m5baah44.js → Accordion-vkqqktc5.js} +3 -3
- package/web-dist/chunks/{Accordion-ytxgphds.js → Accordion-vzq344av.js} +2 -3
- package/web-dist/chunks/{Accordion-d2kg4729.js → Accordion-wb9pmykz.js} +5 -6
- package/web-dist/chunks/{Accordion-6r1e7k5r.js → Accordion-ww4f12ty.js} +1 -1
- package/web-dist/chunks/{Accordion-ec1tt3be.js → Accordion-xb9zhdhp.js} +42 -45
- package/web-dist/chunks/{Accordion-knb3e18b.js → Accordion-xfkg7dcw.js} +4 -5
- package/web-dist/chunks/{Accordion-6ec4gxv2.js → Accordion-xzaa9s7f.js} +12 -23
- package/web-dist/chunks/{Accordion-epwpdegg.js → Accordion-yrac5a7m.js} +1 -1
- package/web-dist/chunks/{zip-reader-f0yphjb9.js → zip-reader-5xrcmjr8.js} +1 -1
- package/web-dist/components/accordion/Accordion.js +11 -11
- package/web-dist/components/accordion-item/AccordionItem.js +11 -11
- package/web-dist/components/activity-indicator/ActivityIndicator.js +4 -4
- package/web-dist/components/app-bar/AppBar.js +18 -18
- package/web-dist/components/app-header/AppHeader.js +18 -18
- package/web-dist/components/app-shell/AppShell.js +5 -5
- package/web-dist/components/auth-screen/AuthScreen.js +21 -21
- package/web-dist/components/avatar/Avatar.js +11 -11
- package/web-dist/components/avatar-group/AvatarGroup.js +11 -11
- package/web-dist/components/badge/Badge.js +6 -6
- package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +19 -19
- package/web-dist/components/bottom-sheet/BottomSheet.js +10 -7
- package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +10 -7
- package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +10 -7
- package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +10 -7
- package/web-dist/components/bottom-sheet-view/BottomSheetView.js +10 -7
- package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +10 -7
- package/web-dist/components/breadcrumbs/Breadcrumbs.js +13 -13
- package/web-dist/components/button/Button.js +11 -11
- package/web-dist/components/button-group/ButtonGroup.js +11 -11
- package/web-dist/components/calendar/Calendar.js +14 -14
- package/web-dist/components/camera-permission-view/CameraPermissionView.js +19 -19
- package/web-dist/components/card/Card.js +18 -18
- package/web-dist/components/card-back/CardBack.js +5 -5
- package/web-dist/components/card-hand/CardHand.js +5 -5
- package/web-dist/components/carousel/Carousel.js +2 -2
- package/web-dist/components/chat-list-item/ChatListItem.js +15 -15
- package/web-dist/components/checkbox/Checkbox.js +11 -11
- package/web-dist/components/checkbox-group/CheckboxGroup.js +11 -11
- package/web-dist/components/chess-board/ChessBoard.js +6 -6
- package/web-dist/components/chip/Chip.js +12 -12
- package/web-dist/components/chip-group/ChipGroup.js +12 -12
- package/web-dist/components/collection-editor/CollectionEditor.js +18 -18
- package/web-dist/components/color-hue-scale/ColorHueScale.js +27 -27
- package/web-dist/components/color-picker/ColorPicker.js +27 -27
- package/web-dist/components/color-picker/ColorPicker.types-0.d.ts +9 -1
- package/web-dist/components/color-tone/ColorTone.js +27 -27
- package/web-dist/components/color-wheel/ColorWheel.js +27 -27
- package/web-dist/components/color-wheel/ColorWheel.types-0.d.ts +8 -0
- package/web-dist/components/content-rail/ContentRail.js +12 -12
- package/web-dist/components/data-table/DataTable.js +26 -26
- package/web-dist/components/date-picker/DatePicker.js +20 -20
- package/web-dist/components/dialog/Dialog.js +11 -11
- package/web-dist/components/divider/Divider.js +5 -5
- package/web-dist/components/empty-state/EmptyState.js +19 -19
- package/web-dist/components/explorer/Explorer.js +13 -13
- package/web-dist/components/field/Field.js +11 -11
- package/web-dist/components/file-explorer/FileExplorer.js +13 -13
- package/web-dist/components/flat-list/FlatList.js +12 -12
- package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +21 -21
- package/web-dist/components/form/Form.js +15 -15
- package/web-dist/components/form-actions/FormActions.js +15 -15
- package/web-dist/components/form-error/FormError.js +15 -15
- package/web-dist/components/game/Game.js +7 -6
- package/web-dist/components/game-entity/GameEntity.js +7 -6
- package/web-dist/components/game-field/GameField.js +7 -6
- package/web-dist/components/game-input-zone/GameInputZone.js +7 -6
- package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +7 -6
- package/web-dist/components/game-overlay/GameOverlay.js +7 -6
- package/web-dist/components/gradient/Gradient.js +6 -6
- package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +6 -6
- package/web-dist/components/graph-view/GraphView.js +2 -2
- package/web-dist/components/grid/Grid.js +5 -5
- package/web-dist/components/grid-interactions/GridInteractions.js +1 -1
- package/web-dist/components/grid-line-overlay/GridLineOverlay.js +5 -5
- package/web-dist/components/grid-ruler/GridRuler.js +5 -5
- package/web-dist/components/grid-view/GridView.js +1 -1
- package/web-dist/components/heading/Heading.js +6 -6
- package/web-dist/components/hero/Hero.js +18 -18
- package/web-dist/components/icon/Icon.js +5 -5
- package/web-dist/components/icon-button/IconButton.js +11 -11
- package/web-dist/components/image/Image.js +9 -9
- package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +4 -4
- package/web-dist/components/list/List.js +12 -12
- package/web-dist/components/list-item/ListItem.js +12 -12
- package/web-dist/components/list-section/ListSection.js +12 -12
- package/web-dist/components/master-detail/MasterDetail.js +5 -5
- package/web-dist/components/matrix-grid/MatrixGrid.js +9 -9
- package/web-dist/components/media-card/MediaCard.js +18 -18
- package/web-dist/components/media-explorer/MediaExplorer.js +13 -13
- package/web-dist/components/message-bubble/MessageBubble.js +15 -15
- package/web-dist/components/metric-card/MetricCard.js +18 -18
- package/web-dist/components/missing-element/MissingElement.js +10 -10
- package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +21 -21
- package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +21 -21
- package/web-dist/components/opening-book/OpeningBook.js +6 -6
- package/web-dist/components/otp-form/OtpForm.js +21 -21
- package/web-dist/components/pagination/Pagination.js +12 -12
- package/web-dist/components/palette-item/PaletteItem.js +18 -18
- package/web-dist/components/playing-card/PlayingCard.js +5 -5
- package/web-dist/components/poker-training-table/PokerTrainingTable.js +5 -5
- package/web-dist/components/popover-menu/PopoverMenu.js +13 -13
- package/web-dist/components/post-card/PostCard.js +18 -18
- package/web-dist/components/product-card/ProductCard.js +18 -18
- package/web-dist/components/progress/Progress.js +9 -9
- package/web-dist/components/progress-ring/ProgressRing.js +9 -9
- package/web-dist/components/radio/Radio.js +13 -13
- package/web-dist/components/radio-group/RadioGroup.js +13 -13
- package/web-dist/components/rating/Rating.js +8 -8
- package/web-dist/components/reader/Reader.js +34 -34
- package/web-dist/components/scan-overlay/ScanOverlay.js +19 -19
- package/web-dist/components/screen/Screen.js +5 -5
- package/web-dist/components/screen-section/ScreenSection.js +9 -9
- package/web-dist/components/scroll-view/ScrollView.js +5 -5
- package/web-dist/components/search-input/SearchInput.js +13 -13
- package/web-dist/components/section-header/SectionHeader.js +9 -9
- package/web-dist/components/section-list/SectionList.js +12 -12
- package/web-dist/components/select/Select.js +20 -20
- package/web-dist/components/select/Select.types-0.d.ts +2 -0
- package/web-dist/components/selectable-item/SelectableItem.js +4 -4
- package/web-dist/components/selection-provider/SelectionProvider.js +4 -4
- package/web-dist/components/sign-in-form/SignInForm.js +21 -21
- package/web-dist/components/sign-up-form/SignUpForm.js +21 -21
- package/web-dist/components/skeleton/Skeleton.js +21 -21
- package/web-dist/components/skeleton-card/SkeletonCard.js +21 -21
- package/web-dist/components/skeleton-list/SkeletonList.js +21 -21
- package/web-dist/components/skeleton-text/SkeletonText.js +21 -21
- package/web-dist/components/spatial-grid/SpatialGrid.js +1 -1
- package/web-dist/components/surface/Surface.js +6 -6
- package/web-dist/components/switch/Switch.js +8 -8
- package/web-dist/components/tab/Tab.js +6 -6
- package/web-dist/components/tab-list/TabList.js +6 -6
- package/web-dist/components/tab-panel/TabPanel.js +6 -6
- package/web-dist/components/tabletop-table/TabletopTable.js +5 -5
- package/web-dist/components/tabs/Tabs.js +6 -6
- package/web-dist/components/text/Text.js +6 -6
- package/web-dist/components/text-input/TextInput.js +13 -13
- package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +11 -11
- package/web-dist/components/tile-grid/TileGrid.js +1 -1
- package/web-dist/components/time-grid/TimeGrid.js +2 -2
- package/web-dist/components/time-picker/TimePicker.js +18 -18
- package/web-dist/components/timeline/Timeline.js +11 -11
- package/web-dist/components/toast/Toast.js +9 -9
- package/web-dist/components/toast-provider/ToastProvider.js +9 -9
- package/web-dist/components/toolbar/Toolbar.js +18 -18
- package/web-dist/components/tree-item/TreeItem.js +17 -17
- package/web-dist/components/tree-view/TreeView.js +1 -1
- package/web-dist/components/uploader/Uploader.js +23 -23
- package/web-dist/components/view/View.js +5 -5
- package/web-dist/manifest.json +1897 -1873
- package/web-dist/runtime/ZoraProvider.js +9 -9
- package/web-dist/chunks/{Accordion-vgkvvdvg.js → Accordion-ykk40jz9.js} +36 -36
|
@@ -7,24 +7,28 @@ import {
|
|
|
7
7
|
COLOR_HARMONY_CATALOG,
|
|
8
8
|
generateHarmonyRoleColors,
|
|
9
9
|
generateColorSwatch
|
|
10
|
-
} from "./Accordion-
|
|
10
|
+
} from "./Accordion-9d38cgqj.js";
|
|
11
11
|
import {
|
|
12
12
|
Pressable
|
|
13
|
-
} from "./Accordion-
|
|
13
|
+
} from "./Accordion-hdyzyw8q.js";
|
|
14
14
|
import {
|
|
15
15
|
withZoraThemeScope
|
|
16
|
-
} from "./Accordion-
|
|
16
|
+
} from "./Accordion-tk8zf9ff.js";
|
|
17
17
|
import {
|
|
18
18
|
View2,
|
|
19
19
|
Divider2
|
|
20
|
-
} from "./Accordion-
|
|
20
|
+
} from "./Accordion-f8a49gy8.js";
|
|
21
21
|
import {
|
|
22
22
|
Heading2,
|
|
23
23
|
Text3
|
|
24
|
-
} from "./Accordion-
|
|
24
|
+
} from "./Accordion-afpjg1d6.js";
|
|
25
|
+
import {
|
|
26
|
+
useClipboardWriter,
|
|
27
|
+
writeClipboardTextAsync
|
|
28
|
+
} from "./Accordion-chdbfcm6.js";
|
|
25
29
|
import {
|
|
26
30
|
TextInput3
|
|
27
|
-
} from "./Accordion-
|
|
31
|
+
} from "./Accordion-d405whfb.js";
|
|
28
32
|
import {
|
|
29
33
|
Button2,
|
|
30
34
|
Circle,
|
|
@@ -38,51 +42,86 @@ import {
|
|
|
38
42
|
Stop,
|
|
39
43
|
Svg,
|
|
40
44
|
IconButton2
|
|
41
|
-
} from "./Accordion-
|
|
45
|
+
} from "./Accordion-jmxe6kw0.js";
|
|
42
46
|
import {
|
|
43
47
|
Card2
|
|
44
|
-
} from "./Accordion-
|
|
48
|
+
} from "./Accordion-9k7ktksc.js";
|
|
49
|
+
import {
|
|
50
|
+
Icon2
|
|
51
|
+
} from "./Accordion-3zzzw7a8.js";
|
|
45
52
|
import {
|
|
46
53
|
Select2
|
|
47
|
-
} from "./Accordion-
|
|
54
|
+
} from "./Accordion-46n609yq.js";
|
|
48
55
|
import {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
TabPanel2,
|
|
52
|
-
Tabs2
|
|
53
|
-
} from "./Accordion-0t53jhx1.js";
|
|
56
|
+
Gradient2
|
|
57
|
+
} from "./Accordion-t9n4ey2r.js";
|
|
54
58
|
import {
|
|
55
59
|
useZoraTheme2
|
|
56
|
-
} from "./Accordion-
|
|
60
|
+
} from "./Accordion-b1y5mjac.js";
|
|
61
|
+
import {
|
|
62
|
+
require_cjs
|
|
63
|
+
} from "./Accordion-xgpzh4wq.js";
|
|
64
|
+
import {
|
|
65
|
+
__toESM
|
|
66
|
+
} from "./Accordion-nh0cs9hq.js";
|
|
57
67
|
|
|
58
68
|
// src/features/color/ColorHexField.tsx
|
|
59
69
|
import React from "react";
|
|
60
|
-
import { jsx } from "react/jsx-runtime";
|
|
70
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
61
71
|
function ColorHexField({
|
|
62
72
|
disabled,
|
|
63
73
|
onChange,
|
|
64
74
|
value
|
|
65
75
|
}) {
|
|
66
76
|
const [input, setInput] = React.useState(value);
|
|
77
|
+
const [previousValue, setPreviousValue] = React.useState(value);
|
|
78
|
+
const [copyFeedback, setCopyFeedback] = React.useState();
|
|
79
|
+
const clipboardWriter = useClipboardWriter();
|
|
67
80
|
const { theme } = useZoraTheme2();
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
if (value !== previousValue) {
|
|
82
|
+
setPreviousValue(value);
|
|
83
|
+
setInput(value);
|
|
84
|
+
}
|
|
85
|
+
return /* @__PURE__ */ jsxs(View2, {
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsx(TextInput3, {
|
|
88
|
+
accessibilityLabel: "Color hex value",
|
|
89
|
+
disabled,
|
|
90
|
+
leadingAccessory: /* @__PURE__ */ jsx(View2, {
|
|
91
|
+
bg: value,
|
|
92
|
+
borderColor: theme.semantics.border.default,
|
|
93
|
+
borderWidth: 1,
|
|
94
|
+
height: 30,
|
|
95
|
+
radius: "s",
|
|
96
|
+
width: 30
|
|
97
|
+
}),
|
|
98
|
+
onChangeText: (nextValue) => {
|
|
99
|
+
setInput(nextValue);
|
|
100
|
+
if (isHexColor(nextValue))
|
|
101
|
+
onChange(nextValue);
|
|
102
|
+
},
|
|
103
|
+
trailingAccessory: /* @__PURE__ */ jsx(IconButton2, {
|
|
104
|
+
iconName: copyFeedback === "Color hex copied." ? "checkmark" : copyFeedback ? "warning" : "copy-outline",
|
|
105
|
+
label: copyFeedback ?? "Copy color hex value",
|
|
106
|
+
disabled,
|
|
107
|
+
onPress: () => {
|
|
108
|
+
writeClipboardTextAsync(clipboardWriter, value).then((result) => {
|
|
109
|
+
setCopyFeedback(result === "written" ? "Color hex copied." : result === "denied" ? "Clipboard access was denied." : "Clipboard is unavailable.");
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
variant: "ghost"
|
|
113
|
+
}),
|
|
114
|
+
value: input
|
|
115
|
+
}),
|
|
116
|
+
copyFeedback ? /* @__PURE__ */ jsx(Text3, {
|
|
117
|
+
accessibilityLiveRegion: "polite",
|
|
118
|
+
emphasis: "muted",
|
|
119
|
+
style: { position: "absolute", opacity: 0 },
|
|
120
|
+
variant: "caption",
|
|
121
|
+
children: copyFeedback
|
|
122
|
+
}) : null
|
|
123
|
+
]
|
|
124
|
+
});
|
|
86
125
|
}
|
|
87
126
|
|
|
88
127
|
// src/features/color/ColorSpectrumSlider.tsx
|
|
@@ -132,7 +171,7 @@ function resolveOklchColor(target, hue) {
|
|
|
132
171
|
}
|
|
133
172
|
|
|
134
173
|
// src/features/color/ColorSpectrumSlider.tsx
|
|
135
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
174
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
136
175
|
var SPECTRUM_WIDTH = 280;
|
|
137
176
|
var SPECTRUM_HUES = [0, 60, 120, 180, 240, 300, 360];
|
|
138
177
|
function ColorSpectrumSlider({
|
|
@@ -148,11 +187,11 @@ function ColorSpectrumSlider({
|
|
|
148
187
|
if (!disabled)
|
|
149
188
|
onChange(Math.max(0, Math.min(360, locationX / trackWidth * 360)));
|
|
150
189
|
};
|
|
151
|
-
return /* @__PURE__ */
|
|
190
|
+
return /* @__PURE__ */ jsxs2(View2, {
|
|
152
191
|
gap: "xxs",
|
|
153
192
|
width: "100%",
|
|
154
193
|
children: [
|
|
155
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ jsxs2(View2, {
|
|
156
195
|
direction: "row",
|
|
157
196
|
justify: "space-between",
|
|
158
197
|
children: [
|
|
@@ -170,7 +209,7 @@ function ColorSpectrumSlider({
|
|
|
170
209
|
disabled,
|
|
171
210
|
onChange: changeAt,
|
|
172
211
|
width: SPECTRUM_WIDTH,
|
|
173
|
-
children: /* @__PURE__ */
|
|
212
|
+
children: /* @__PURE__ */ jsxs2(Svg, {
|
|
174
213
|
accessibilityLabel: `${label} spectrum`,
|
|
175
214
|
height: 36,
|
|
176
215
|
onLayout: (event) => setTrackWidth(Math.max(1, event.nativeEvent.layout.width)),
|
|
@@ -239,7 +278,7 @@ function resolveColorHue(color) {
|
|
|
239
278
|
}
|
|
240
279
|
|
|
241
280
|
// src/features/color/ColorHueScale.tsx
|
|
242
|
-
import { jsx as jsx4, jsxs as
|
|
281
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
243
282
|
var ColorHueScale2 = withZoraThemeScope(ColorHueScaleInner);
|
|
244
283
|
function ColorHueScaleInner({
|
|
245
284
|
themeId: _themeId,
|
|
@@ -253,7 +292,7 @@ function ColorHueScaleInner({
|
|
|
253
292
|
const { theme } = useZoraTheme2();
|
|
254
293
|
const { swatch } = generateColorSwatch(value);
|
|
255
294
|
const swatches = Object.entries(swatch);
|
|
256
|
-
return /* @__PURE__ */
|
|
295
|
+
return /* @__PURE__ */ jsxs3(View2, {
|
|
257
296
|
gap: "m",
|
|
258
297
|
testID,
|
|
259
298
|
children: [
|
|
@@ -296,6 +335,9 @@ function ColorHueScaleInner({
|
|
|
296
335
|
]
|
|
297
336
|
});
|
|
298
337
|
}
|
|
338
|
+
// src/features/color/ColorPicker.tsx
|
|
339
|
+
var import_react_native = __toESM(require_cjs(), 1);
|
|
340
|
+
import React6 from "react";
|
|
299
341
|
|
|
300
342
|
// src/features/color/ColorWheel.tsx
|
|
301
343
|
import React5 from "react";
|
|
@@ -307,6 +349,7 @@ function ColorWheelKeyboardProxy({
|
|
|
307
349
|
chroma,
|
|
308
350
|
disabled,
|
|
309
351
|
hue,
|
|
352
|
+
maxChroma = 0.2,
|
|
310
353
|
onChange
|
|
311
354
|
}) {
|
|
312
355
|
return /* @__PURE__ */ jsx5("div", {
|
|
@@ -317,7 +360,7 @@ function ColorWheelKeyboardProxy({
|
|
|
317
360
|
"aria-valuetext": `Hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`,
|
|
318
361
|
"aria-disabled": disabled,
|
|
319
362
|
onKeyDown: (event) => {
|
|
320
|
-
const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma);
|
|
363
|
+
const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma, maxChroma);
|
|
321
364
|
if (!nextValue || disabled)
|
|
322
365
|
return;
|
|
323
366
|
event.preventDefault();
|
|
@@ -328,7 +371,7 @@ function ColorWheelKeyboardProxy({
|
|
|
328
371
|
children
|
|
329
372
|
});
|
|
330
373
|
}
|
|
331
|
-
function resolveKeyboardWheelValue(key, hue, chroma) {
|
|
374
|
+
function resolveKeyboardWheelValue(key, hue, chroma, maxChroma) {
|
|
332
375
|
if (key === "ArrowLeft")
|
|
333
376
|
return { chroma, hue: normalizeHue(hue - 5) };
|
|
334
377
|
if (key === "ArrowRight")
|
|
@@ -336,7 +379,7 @@ function resolveKeyboardWheelValue(key, hue, chroma) {
|
|
|
336
379
|
if (key === "ArrowDown")
|
|
337
380
|
return { chroma: Math.max(0, chroma - 0.02), hue };
|
|
338
381
|
if (key === "ArrowUp")
|
|
339
|
-
return { chroma: Math.min(
|
|
382
|
+
return { chroma: Math.min(maxChroma, chroma + 0.02), hue };
|
|
340
383
|
return;
|
|
341
384
|
}
|
|
342
385
|
function normalizeHue(hue) {
|
|
@@ -351,6 +394,7 @@ function ColorWheelPointerProxy({
|
|
|
351
394
|
disabled,
|
|
352
395
|
height,
|
|
353
396
|
onChange,
|
|
397
|
+
renderedSize: _renderedSize,
|
|
354
398
|
width
|
|
355
399
|
}) {
|
|
356
400
|
const dragging = React4.useRef(false);
|
|
@@ -395,8 +439,7 @@ function resolveWheelColorComponents(color) {
|
|
|
395
439
|
}
|
|
396
440
|
|
|
397
441
|
// src/features/color/utils/resolveWheelColor.ts
|
|
398
|
-
function resolveWheelColor(color, x, y, center, radius, maxChroma) {
|
|
399
|
-
const { lightness } = resolveWheelColorComponents(color);
|
|
442
|
+
function resolveWheelColor(color, x, y, center, radius, maxChroma, lightness = resolveWheelColorComponents(color).lightness) {
|
|
400
443
|
const deltaX = x - center;
|
|
401
444
|
const deltaY = y - center;
|
|
402
445
|
const distance = Math.min(Math.hypot(deltaX, deltaY), radius);
|
|
@@ -409,11 +452,11 @@ function normalizeHue2(hue) {
|
|
|
409
452
|
}
|
|
410
453
|
|
|
411
454
|
// src/features/color/ColorWheel.tsx
|
|
412
|
-
import { jsx as jsx7, jsxs as
|
|
455
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
413
456
|
var VIEWBOX = 1000;
|
|
414
457
|
var CENTER = VIEWBOX / 2;
|
|
415
458
|
var RADIUS = 480;
|
|
416
|
-
var SEGMENTS =
|
|
459
|
+
var SEGMENTS = 720;
|
|
417
460
|
var MAX_CHROMA = 0.2;
|
|
418
461
|
var ColorWheel2 = withZoraThemeScope(ColorWheelInner);
|
|
419
462
|
function ColorWheelInner({
|
|
@@ -423,51 +466,62 @@ function ColorWheelInner({
|
|
|
423
466
|
interactionPolicy,
|
|
424
467
|
value,
|
|
425
468
|
harmony = null,
|
|
469
|
+
toneTarget,
|
|
426
470
|
onChange,
|
|
427
471
|
size = 340,
|
|
428
472
|
testID
|
|
429
473
|
}) {
|
|
430
|
-
const { theme } = useZoraTheme2();
|
|
431
474
|
const hue = resolveColorHue(value);
|
|
432
475
|
const { chroma, lightness } = resolveWheelColorComponents(value);
|
|
433
|
-
const
|
|
434
|
-
const
|
|
476
|
+
const targetLightness = toneTarget?.lightness ?? lightness;
|
|
477
|
+
const maximumChroma = toneTarget?.chroma ?? MAX_CHROMA;
|
|
478
|
+
const primaryPoint = pointFor(hue, Math.min(1, chroma / maximumChroma));
|
|
479
|
+
const harmonyRoles = harmony ? generateHarmonyRoleColors(value, harmony).colors : [];
|
|
480
|
+
const harmonyPoints = harmonyRoles.map((role) => ({
|
|
481
|
+
color: role.hex,
|
|
482
|
+
...pointFor(role.hueDegrees, Math.min(1, resolveWheelColorComponents(role.hex).chroma / maximumChroma))
|
|
483
|
+
}));
|
|
435
484
|
const gradientId = `color-wheel-${React5.useId().replaceAll(":", "")}`;
|
|
436
485
|
const changeAt = (x, y) => {
|
|
437
486
|
if (interactionPolicy !== "passive")
|
|
438
|
-
onChange({
|
|
487
|
+
onChange({
|
|
488
|
+
color: resolveWheelColor(value, x, y, CENTER, RADIUS, maximumChroma, targetLightness),
|
|
489
|
+
harmony
|
|
490
|
+
});
|
|
439
491
|
};
|
|
440
492
|
return /* @__PURE__ */ jsx7(ColorWheelKeyboardProxy, {
|
|
441
493
|
chroma,
|
|
442
494
|
disabled: interactionPolicy === "passive",
|
|
443
495
|
hue,
|
|
444
|
-
|
|
496
|
+
maxChroma: maximumChroma,
|
|
497
|
+
onChange: (nextHue, nextChroma) => onChange({
|
|
498
|
+
color: resolveOklchColor({ chroma: nextChroma, lightness: targetLightness }, nextHue),
|
|
499
|
+
harmony
|
|
500
|
+
}),
|
|
445
501
|
children: /* @__PURE__ */ jsx7(ColorWheelPointerProxy, {
|
|
446
502
|
disabled: interactionPolicy === "passive",
|
|
447
503
|
height: VIEWBOX,
|
|
448
504
|
onChange: changeAt,
|
|
505
|
+
renderedSize: size,
|
|
449
506
|
width: VIEWBOX,
|
|
450
|
-
children: /* @__PURE__ */
|
|
507
|
+
children: /* @__PURE__ */ jsxs4(Svg, {
|
|
451
508
|
accessibilityLabel: "Color wheel",
|
|
452
509
|
height: size,
|
|
453
|
-
onResponderGrant: (event) => changeAt(event.nativeEvent.locationX / size * VIEWBOX, event.nativeEvent.locationY / size * VIEWBOX),
|
|
454
|
-
onResponderMove: (event) => changeAt(event.nativeEvent.locationX / size * VIEWBOX, event.nativeEvent.locationY / size * VIEWBOX),
|
|
455
|
-
onResponderRelease: (event) => changeAt(event.nativeEvent.locationX / size * VIEWBOX, event.nativeEvent.locationY / size * VIEWBOX),
|
|
456
|
-
onStartShouldSetResponder: () => interactionPolicy !== "passive",
|
|
457
510
|
testID,
|
|
458
511
|
viewBox: `0 0 ${VIEWBOX} ${VIEWBOX}`,
|
|
459
512
|
width: size,
|
|
460
513
|
children: [
|
|
461
514
|
/* @__PURE__ */ jsx7(Defs, {
|
|
462
|
-
children: segments().map((segment) => /* @__PURE__ */
|
|
515
|
+
children: segments(targetLightness, maximumChroma).map((segment) => /* @__PURE__ */ jsxs4(RadialGradient, {
|
|
463
516
|
cx: CENTER,
|
|
464
517
|
cy: CENTER,
|
|
518
|
+
gradientUnits: "userSpaceOnUse",
|
|
465
519
|
id: `${gradientId}-${segment.hue}`,
|
|
466
520
|
r: RADIUS,
|
|
467
521
|
children: [
|
|
468
522
|
/* @__PURE__ */ jsx7(Stop, {
|
|
469
523
|
offset: "0",
|
|
470
|
-
stopColor:
|
|
524
|
+
stopColor: segment.centerColor
|
|
471
525
|
}),
|
|
472
526
|
/* @__PURE__ */ jsx7(Stop, {
|
|
473
527
|
offset: "1",
|
|
@@ -476,26 +530,28 @@ function ColorWheelInner({
|
|
|
476
530
|
]
|
|
477
531
|
}, segment.hue))
|
|
478
532
|
}),
|
|
479
|
-
segments().map((segment) => /* @__PURE__ */ jsx7(Path, {
|
|
533
|
+
segments(targetLightness, maximumChroma).map((segment) => /* @__PURE__ */ jsx7(Path, {
|
|
480
534
|
d: segment.path,
|
|
481
535
|
fill: `url(#${gradientId}-${segment.hue})`
|
|
482
536
|
}, segment.hue)),
|
|
483
|
-
harmonyPoints.length
|
|
537
|
+
harmonyPoints.length >= 3 ? /* @__PURE__ */ jsx7(Polygon, {
|
|
484
538
|
fill: "none",
|
|
485
539
|
points: harmonyPoints.map((point) => `${point.x},${point.y}`).join(" "),
|
|
486
|
-
stroke:
|
|
540
|
+
stroke: "white",
|
|
487
541
|
strokeWidth: 6
|
|
488
|
-
}) : linesFor(harmonyPoints, primaryPoint,
|
|
489
|
-
harmonyPoints.map((point) => /* @__PURE__ */ jsx7(Circle, {
|
|
542
|
+
}) : linesFor(harmonyPoints, primaryPoint, "white"),
|
|
543
|
+
harmonyPoints.filter((point) => point.color !== value).map((point) => /* @__PURE__ */ jsx7(Circle, {
|
|
490
544
|
cx: point.x,
|
|
491
545
|
cy: point.y,
|
|
492
|
-
fill:
|
|
546
|
+
fill: point.color,
|
|
547
|
+
stroke: "white",
|
|
548
|
+
strokeWidth: 6,
|
|
493
549
|
r: 26
|
|
494
550
|
}, `${point.x}-${point.y}`)),
|
|
495
551
|
/* @__PURE__ */ jsx7(Circle, {
|
|
496
552
|
cx: primaryPoint.x,
|
|
497
553
|
cy: primaryPoint.y,
|
|
498
|
-
fill:
|
|
554
|
+
fill: value,
|
|
499
555
|
r: 36,
|
|
500
556
|
stroke: "white",
|
|
501
557
|
strokeWidth: 12
|
|
@@ -505,7 +561,7 @@ function ColorWheelInner({
|
|
|
505
561
|
cy: primaryPoint.y,
|
|
506
562
|
fill: "none",
|
|
507
563
|
r: 42,
|
|
508
|
-
stroke:
|
|
564
|
+
stroke: "white",
|
|
509
565
|
strokeWidth: 6
|
|
510
566
|
})
|
|
511
567
|
]
|
|
@@ -513,11 +569,12 @@ function ColorWheelInner({
|
|
|
513
569
|
})
|
|
514
570
|
});
|
|
515
571
|
}
|
|
516
|
-
function segments() {
|
|
572
|
+
function segments(lightness, maximumChroma) {
|
|
517
573
|
return Array.from({ length: SEGMENTS }, (_, index) => {
|
|
518
574
|
const hue = index * 360 / SEGMENTS;
|
|
519
575
|
return {
|
|
520
|
-
|
|
576
|
+
centerColor: resolveOklchColor({ chroma: 0, lightness }, hue),
|
|
577
|
+
color: resolveOklchColor({ chroma: maximumChroma, lightness }, hue),
|
|
521
578
|
hue,
|
|
522
579
|
path: segmentPath(hue, hue + 360 / SEGMENTS)
|
|
523
580
|
};
|
|
@@ -552,9 +609,86 @@ function linesFor(points, primary, stroke) {
|
|
|
552
609
|
}), { lines: [], previous: points.at(0) ?? primary }).lines;
|
|
553
610
|
}
|
|
554
611
|
|
|
612
|
+
// src/features/color/resolveColorPickerGeometry.ts
|
|
613
|
+
var MINIMUM_WIDTH = 360;
|
|
614
|
+
var REFERENCE_WIDTH = 560;
|
|
615
|
+
function resolveColorPickerGeometry(input) {
|
|
616
|
+
const availableWidth = Math.min(input.width ?? REFERENCE_WIDTH, input.hostWidth ?? REFERENCE_WIDTH);
|
|
617
|
+
const availableHeight = Math.min(input.height ?? Number.POSITIVE_INFINITY, input.hostHeight ?? Number.POSITIVE_INFINITY);
|
|
618
|
+
const minimum = resolveGeometryAtWidth(MINIMUM_WIDTH, input.showTabs);
|
|
619
|
+
const maximum = resolveGeometryAtWidth(Math.max(MINIMUM_WIDTH, availableWidth), input.showTabs);
|
|
620
|
+
const resolved = resolveLargestGeometry(maximum, availableHeight, input.showTabs);
|
|
621
|
+
return {
|
|
622
|
+
...resolved,
|
|
623
|
+
insufficientSpace: availableWidth < MINIMUM_WIDTH || availableHeight < minimum.height,
|
|
624
|
+
minimumHeight: minimum.height,
|
|
625
|
+
minimumWidth: MINIMUM_WIDTH
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
function resolveGeometryAtWidth(width, showTabs) {
|
|
629
|
+
const progress = Math.max(0, Math.min(1, (width - MINIMUM_WIDTH) / (REFERENCE_WIDTH - MINIMUM_WIDTH)));
|
|
630
|
+
const padding = interpolate(12, 24, progress);
|
|
631
|
+
const rail = interpolate(104, 150, progress);
|
|
632
|
+
const gap = interpolate(12, 20, progress);
|
|
633
|
+
const scale = interpolate(0.75, 1, progress);
|
|
634
|
+
const border = 1;
|
|
635
|
+
const stage = width - border * 2 - padding * 2 - rail - gap;
|
|
636
|
+
const headerHeight = 48 * scale;
|
|
637
|
+
const tabHeight = showTabs ? 48 * scale : 0;
|
|
638
|
+
const cardGap = 16 * scale;
|
|
639
|
+
const cardHeight = 52 * scale;
|
|
640
|
+
const settingsHeight = cardHeight * 2 + cardGap;
|
|
641
|
+
const mainHeight = Math.max(stage, settingsHeight);
|
|
642
|
+
const infoLineHeight = 20 * scale;
|
|
643
|
+
const mainGap = 16 * scale;
|
|
644
|
+
const footerGap = 10 * scale;
|
|
645
|
+
const footerHeight = 52 * scale;
|
|
646
|
+
const footerInset = 12 * scale;
|
|
647
|
+
const height = border * 2 + padding + headerHeight + mainGap + tabHeight + (showTabs ? mainGap : 0) + mainHeight + mainGap + infoLineHeight + footerGap + 1 + footerGap + footerHeight + footerInset;
|
|
648
|
+
return {
|
|
649
|
+
border,
|
|
650
|
+
cardGap,
|
|
651
|
+
cardHeight,
|
|
652
|
+
footerGap,
|
|
653
|
+
footerHeight,
|
|
654
|
+
footerInset,
|
|
655
|
+
gap,
|
|
656
|
+
headerHeight,
|
|
657
|
+
height,
|
|
658
|
+
infoLineHeight,
|
|
659
|
+
mainGap,
|
|
660
|
+
padding,
|
|
661
|
+
rail,
|
|
662
|
+
scale,
|
|
663
|
+
settingsHeight,
|
|
664
|
+
stage,
|
|
665
|
+
tabHeight,
|
|
666
|
+
width
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
function resolveLargestGeometry(maximum, height, showTabs) {
|
|
670
|
+
if (!Number.isFinite(height) || maximum.height <= height)
|
|
671
|
+
return maximum;
|
|
672
|
+
const minimum = resolveGeometryAtWidth(MINIMUM_WIDTH, showTabs);
|
|
673
|
+
if (height < minimum.height)
|
|
674
|
+
return minimum;
|
|
675
|
+
let lower = MINIMUM_WIDTH;
|
|
676
|
+
let upper = maximum.width;
|
|
677
|
+
for (let iteration = 0;iteration < 20; iteration += 1) {
|
|
678
|
+
const midpoint = (lower + upper) / 2;
|
|
679
|
+
if (resolveGeometryAtWidth(midpoint, showTabs).height <= height)
|
|
680
|
+
lower = midpoint;
|
|
681
|
+
else
|
|
682
|
+
upper = midpoint;
|
|
683
|
+
}
|
|
684
|
+
return resolveGeometryAtWidth(lower, showTabs);
|
|
685
|
+
}
|
|
686
|
+
function interpolate(minimum, reference, progress) {
|
|
687
|
+
return minimum + (reference - minimum) * progress;
|
|
688
|
+
}
|
|
689
|
+
|
|
555
690
|
// src/features/color/ColorPicker.tsx
|
|
556
|
-
import
|
|
557
|
-
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
691
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
558
692
|
var DEFAULT_TABS = ["grid", "wheel"];
|
|
559
693
|
var ColorPicker2 = withZoraThemeScope(ColorPickerInner);
|
|
560
694
|
function ColorPickerInner({
|
|
@@ -567,6 +701,9 @@ function ColorPickerInner({
|
|
|
567
701
|
tone,
|
|
568
702
|
tones = [],
|
|
569
703
|
width = 560,
|
|
704
|
+
height,
|
|
705
|
+
infoLine,
|
|
706
|
+
onInsufficientSpaceChange,
|
|
570
707
|
activeTab,
|
|
571
708
|
onValueChange,
|
|
572
709
|
onActiveTabChange,
|
|
@@ -577,23 +714,32 @@ function ColorPickerInner({
|
|
|
577
714
|
testID
|
|
578
715
|
}) {
|
|
579
716
|
const { theme } = useZoraTheme2();
|
|
717
|
+
const [hostBounds, setHostBounds] = React6.useState();
|
|
580
718
|
const enabledTabs = resolveEnabledTabs(tabs);
|
|
581
719
|
const firstTab = enabledTabs.at(0);
|
|
582
720
|
if (!firstTab)
|
|
583
721
|
throw new Error("ColorPicker requires at least one tab.");
|
|
584
|
-
const
|
|
585
|
-
const
|
|
722
|
+
const [uncontrolledTab, setUncontrolledTab] = React6.useState(firstTab);
|
|
723
|
+
const resolvedTab = activeTab && enabledTabs.includes(activeTab) ? activeTab : enabledTabs.includes(uncontrolledTab) ? uncontrolledTab : firstTab;
|
|
724
|
+
const geometry = resolveColorPickerGeometry({
|
|
725
|
+
height,
|
|
726
|
+
hostHeight: hostBounds && hostBounds.height > 0 ? hostBounds.height : undefined,
|
|
727
|
+
hostWidth: hostBounds && hostBounds.width > 0 ? hostBounds.width : undefined,
|
|
728
|
+
showTabs: enabledTabs.length > 1 || !hideTabListWhenSingle,
|
|
729
|
+
width
|
|
730
|
+
});
|
|
586
731
|
const selectedTone = tones.find((entry) => entry.id === tone);
|
|
587
732
|
const emit = (next) => onValueChange({
|
|
588
733
|
primaryColor: next.primaryColor ?? primaryColor,
|
|
589
|
-
...next
|
|
590
|
-
...next
|
|
734
|
+
...Object.hasOwn(next, "harmony") ? { harmony: next.harmony } : harmony ? { harmony } : {},
|
|
735
|
+
...Object.hasOwn(next, "tone") ? { tone: next.tone } : tone ? { tone } : {}
|
|
591
736
|
});
|
|
592
737
|
const settings = (children) => /* @__PURE__ */ jsx8(PickerRow, {
|
|
593
738
|
geometry,
|
|
594
739
|
tone,
|
|
595
740
|
tones,
|
|
596
741
|
harmony,
|
|
742
|
+
interactionPolicy,
|
|
597
743
|
onHarmonyChange: (next) => emit({ harmony: next }),
|
|
598
744
|
onToneChange: (next) => emit({ tone: next }),
|
|
599
745
|
children
|
|
@@ -602,100 +748,186 @@ function ColorPickerInner({
|
|
|
602
748
|
if (activeTab && activeTab !== resolvedTab)
|
|
603
749
|
onActiveTabChange?.(resolvedTab);
|
|
604
750
|
}, [activeTab, onActiveTabChange, resolvedTab]);
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
751
|
+
React6.useEffect(() => {
|
|
752
|
+
onInsufficientSpaceChange?.(geometry.insufficientSpace);
|
|
753
|
+
}, [geometry.insufficientSpace, onInsufficientSpaceChange]);
|
|
754
|
+
return /* @__PURE__ */ jsx8(import_react_native.View, {
|
|
755
|
+
onLayout: (event) => setHostBounds({
|
|
756
|
+
height: event.nativeEvent.layout.height,
|
|
757
|
+
width: event.nativeEvent.layout.width
|
|
758
|
+
}),
|
|
759
|
+
style: {
|
|
760
|
+
alignSelf: "stretch",
|
|
761
|
+
flexShrink: 1,
|
|
762
|
+
height: height ?? "100%",
|
|
763
|
+
maxHeight: "100%",
|
|
764
|
+
maxWidth: "100%",
|
|
765
|
+
width: "100%"
|
|
766
|
+
},
|
|
767
|
+
children: !geometry.insufficientSpace ? /* @__PURE__ */ jsx8(View2, {
|
|
768
|
+
alignSelf: "center",
|
|
769
|
+
borderColor: theme.semantics.action.primary.base,
|
|
770
|
+
borderWidth: geometry.border,
|
|
771
|
+
radius: "l",
|
|
772
|
+
testID,
|
|
773
|
+
width: geometry.width,
|
|
774
|
+
children: /* @__PURE__ */ jsx8(Gradient2, {
|
|
775
|
+
colors: [theme.semantics.surface.raised, theme.semantics.neutral.surface],
|
|
776
|
+
end: { x: 0, y: 1 },
|
|
777
|
+
radius: "l",
|
|
778
|
+
start: { x: 0, y: 0 },
|
|
779
|
+
children: /* @__PURE__ */ jsxs5(View2, {
|
|
780
|
+
gap: geometry.footerGap,
|
|
781
|
+
pb: geometry.footerInset,
|
|
782
|
+
pt: geometry.padding,
|
|
783
|
+
px: geometry.padding,
|
|
784
|
+
children: [
|
|
785
|
+
/* @__PURE__ */ jsxs5(View2, {
|
|
786
|
+
gap: geometry.mainGap,
|
|
787
|
+
children: [
|
|
788
|
+
/* @__PURE__ */ jsxs5(View2, {
|
|
789
|
+
align: "center",
|
|
790
|
+
direction: "row",
|
|
791
|
+
justify: "space-between",
|
|
792
|
+
minHeight: geometry.headerHeight,
|
|
793
|
+
children: [
|
|
794
|
+
/* @__PURE__ */ jsx8(Heading2, {
|
|
795
|
+
level: 2,
|
|
796
|
+
children: "Color"
|
|
797
|
+
}),
|
|
798
|
+
/* @__PURE__ */ jsxs5(View2, {
|
|
799
|
+
align: "center",
|
|
800
|
+
direction: "row",
|
|
801
|
+
gap: "s",
|
|
802
|
+
children: [
|
|
803
|
+
/* @__PURE__ */ jsx8(View2, {
|
|
804
|
+
bg: primaryColor,
|
|
805
|
+
borderColor: theme.semantics.border.default,
|
|
806
|
+
borderWidth: 1,
|
|
807
|
+
height: 36 * geometry.scale,
|
|
808
|
+
radius: "s",
|
|
809
|
+
width: 52 * geometry.scale
|
|
810
|
+
}),
|
|
811
|
+
onDismiss ? /* @__PURE__ */ jsx8(IconButton2, {
|
|
812
|
+
iconName: "close",
|
|
813
|
+
label: "Close color picker",
|
|
814
|
+
onPress: onDismiss
|
|
815
|
+
}) : null
|
|
816
|
+
]
|
|
817
|
+
})
|
|
818
|
+
]
|
|
819
|
+
}),
|
|
820
|
+
enabledTabs.length > 1 || !hideTabListWhenSingle ? /* @__PURE__ */ jsx8(ColorPickerTabSelector, {
|
|
821
|
+
activeTab: resolvedTab,
|
|
822
|
+
geometry,
|
|
823
|
+
interactionPolicy,
|
|
824
|
+
tabs: enabledTabs,
|
|
825
|
+
onChange: (next) => {
|
|
826
|
+
setUncontrolledTab(next);
|
|
827
|
+
onActiveTabChange?.(next);
|
|
828
|
+
}
|
|
829
|
+
}) : null,
|
|
830
|
+
resolvedTab === "grid" ? settings(/* @__PURE__ */ jsx8(ColorGrid, {
|
|
831
|
+
disabled: interactionPolicy === "passive",
|
|
832
|
+
harmony,
|
|
833
|
+
onSelect: (color) => emit({ primaryColor: color }),
|
|
834
|
+
palette: resolvePalette(selectedTone, primaryColor, harmony),
|
|
835
|
+
primaryIndicatorColor: theme.semantics.action.primary.base,
|
|
836
|
+
selectionBorderColor: theme.semantics.content.default,
|
|
837
|
+
selected: primaryColor,
|
|
838
|
+
size: geometry.stage
|
|
839
|
+
})) : settings(/* @__PURE__ */ jsx8(ColorWheel2, {
|
|
840
|
+
...wheel,
|
|
841
|
+
harmony: harmony ?? null,
|
|
842
|
+
interactionPolicy,
|
|
843
|
+
onChange: (next) => emit({ primaryColor: next.color, harmony: next.harmony ?? undefined }),
|
|
844
|
+
size: geometry.stage,
|
|
845
|
+
toneTarget: selectedTone?.accentTarget,
|
|
846
|
+
value: primaryColor
|
|
847
|
+
})),
|
|
848
|
+
/* @__PURE__ */ jsx8(View2, {
|
|
849
|
+
height: geometry.infoLineHeight,
|
|
850
|
+
justify: "center",
|
|
851
|
+
children: infoLine ? /* @__PURE__ */ jsx8(Text3, {
|
|
852
|
+
accessibilityLabel: infoLine,
|
|
853
|
+
numberOfLines: 1,
|
|
854
|
+
variant: "caption",
|
|
855
|
+
children: infoLine
|
|
856
|
+
}) : null
|
|
857
|
+
})
|
|
858
|
+
]
|
|
859
|
+
}),
|
|
860
|
+
/* @__PURE__ */ jsxs5(View2, {
|
|
861
|
+
gap: geometry.footerGap,
|
|
862
|
+
children: [
|
|
863
|
+
/* @__PURE__ */ jsx8(Divider2, {}),
|
|
864
|
+
/* @__PURE__ */ jsx8(View2, {
|
|
865
|
+
height: geometry.footerHeight,
|
|
866
|
+
justify: "center",
|
|
867
|
+
children: /* @__PURE__ */ jsx8(ColorHexField, {
|
|
868
|
+
disabled: interactionPolicy === "passive",
|
|
869
|
+
onChange: (color) => emit({ primaryColor: color }),
|
|
870
|
+
value: primaryColor
|
|
871
|
+
})
|
|
872
|
+
})
|
|
873
|
+
]
|
|
874
|
+
})
|
|
875
|
+
]
|
|
876
|
+
})
|
|
877
|
+
})
|
|
878
|
+
}) : /* @__PURE__ */ jsx8(View2, {
|
|
879
|
+
accessibilityLabel: "Color picker needs more space",
|
|
880
|
+
testID: testID ? `${testID}-insufficient-space` : undefined
|
|
881
|
+
})
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
function ColorPickerTabSelector({
|
|
885
|
+
activeTab,
|
|
886
|
+
geometry,
|
|
887
|
+
interactionPolicy,
|
|
888
|
+
tabs,
|
|
889
|
+
onChange
|
|
890
|
+
}) {
|
|
891
|
+
const { theme } = useZoraTheme2();
|
|
892
|
+
return /* @__PURE__ */ jsx8(View2, {
|
|
608
893
|
borderColor: theme.semantics.border.default,
|
|
609
894
|
borderWidth: 1,
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
direction: "row",
|
|
620
|
-
justify: "space-between",
|
|
621
|
-
minHeight: 48,
|
|
622
|
-
children: [
|
|
623
|
-
/* @__PURE__ */ jsx8(Heading2, {
|
|
624
|
-
level: 2,
|
|
625
|
-
children: "Color"
|
|
626
|
-
}),
|
|
627
|
-
/* @__PURE__ */ jsxs4(View2, {
|
|
628
|
-
align: "center",
|
|
629
|
-
direction: "row",
|
|
630
|
-
gap: "s",
|
|
631
|
-
children: [
|
|
632
|
-
/* @__PURE__ */ jsx8(View2, {
|
|
633
|
-
bg: primaryColor,
|
|
634
|
-
borderColor: theme.semantics.border.default,
|
|
635
|
-
borderWidth: 1,
|
|
636
|
-
height: 36,
|
|
637
|
-
radius: "s",
|
|
638
|
-
width: 52
|
|
639
|
-
}),
|
|
640
|
-
onDismiss ? /* @__PURE__ */ jsx8(IconButton2, {
|
|
641
|
-
iconName: "close",
|
|
642
|
-
label: "Close color picker",
|
|
643
|
-
onPress: onDismiss
|
|
644
|
-
}) : null
|
|
645
|
-
]
|
|
646
|
-
})
|
|
647
|
-
]
|
|
648
|
-
}),
|
|
649
|
-
/* @__PURE__ */ jsxs4(Tabs2, {
|
|
650
|
-
onValueChange: (next) => {
|
|
651
|
-
if (isColorPickerTab(next) && enabledTabs.includes(next))
|
|
652
|
-
onActiveTabChange?.(next);
|
|
653
|
-
},
|
|
654
|
-
value: resolvedTab,
|
|
655
|
-
variant: "attached",
|
|
656
|
-
children: [
|
|
657
|
-
enabledTabs.length > 1 || !hideTabListWhenSingle ? /* @__PURE__ */ jsx8(View2, {
|
|
658
|
-
borderColor: theme.semantics.border.default,
|
|
659
|
-
borderWidth: 1,
|
|
660
|
-
overflow: "hidden",
|
|
661
|
-
radius: "m",
|
|
662
|
-
children: /* @__PURE__ */ jsx8(TabList2, {
|
|
663
|
-
fill: true,
|
|
664
|
-
children: enabledTabs.map((tab) => /* @__PURE__ */ jsx8(Tab2, {
|
|
665
|
-
label: tab === "grid" ? "Grid" : "Wheel",
|
|
666
|
-
value: tab
|
|
667
|
-
}, tab))
|
|
668
|
-
})
|
|
669
|
-
}) : null,
|
|
670
|
-
enabledTabs.includes("grid") ? /* @__PURE__ */ jsx8(TabPanel2, {
|
|
671
|
-
value: "grid",
|
|
672
|
-
children: settings(/* @__PURE__ */ jsx8(ColorGrid, {
|
|
673
|
-
onSelect: (color) => emit({ primaryColor: color }),
|
|
674
|
-
palette: resolvePalette(selectedTone),
|
|
675
|
-
selectionBorderColor: theme.semantics.content.default,
|
|
676
|
-
selected: primaryColor,
|
|
677
|
-
size: geometry.stage
|
|
678
|
-
}))
|
|
679
|
-
}) : null,
|
|
680
|
-
enabledTabs.includes("wheel") ? /* @__PURE__ */ jsx8(TabPanel2, {
|
|
681
|
-
value: "wheel",
|
|
682
|
-
children: settings(/* @__PURE__ */ jsx8(ColorWheel2, {
|
|
683
|
-
...wheel,
|
|
684
|
-
harmony: harmony ?? null,
|
|
685
|
-
onChange: (next) => emit({ primaryColor: next.color, harmony: next.harmony ?? undefined }),
|
|
686
|
-
size: geometry.stage,
|
|
687
|
-
value: primaryColor
|
|
688
|
-
}))
|
|
689
|
-
}) : null
|
|
690
|
-
]
|
|
691
|
-
}),
|
|
692
|
-
/* @__PURE__ */ jsx8(Divider2, {}),
|
|
693
|
-
/* @__PURE__ */ jsx8(ColorHexField, {
|
|
895
|
+
direction: "row",
|
|
896
|
+
overflow: "hidden",
|
|
897
|
+
radius: "m",
|
|
898
|
+
children: tabs.map((tab) => {
|
|
899
|
+
const selected = tab === activeTab;
|
|
900
|
+
return /* @__PURE__ */ jsx8(Pressable, {
|
|
901
|
+
accessibilityLabel: `${tab === "grid" ? "Grid" : "Wheel"} color picker tab`,
|
|
902
|
+
accessibilityRole: "tab",
|
|
903
|
+
accessibilityState: { selected },
|
|
694
904
|
disabled: interactionPolicy === "passive",
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
905
|
+
onPress: () => onChange(tab),
|
|
906
|
+
style: { flex: 1 },
|
|
907
|
+
children: /* @__PURE__ */ jsxs5(View2, {
|
|
908
|
+
align: "center",
|
|
909
|
+
bg: selected ? theme.semantics.action.primary.base : "transparent",
|
|
910
|
+
direction: "row",
|
|
911
|
+
gap: "xs",
|
|
912
|
+
height: geometry.tabHeight - geometry.border * 2,
|
|
913
|
+
justify: "center",
|
|
914
|
+
radius: "s",
|
|
915
|
+
children: [
|
|
916
|
+
/* @__PURE__ */ jsx8(Icon2, {
|
|
917
|
+
color: selected ? theme.semantics.action.primary.onSolidText : undefined,
|
|
918
|
+
name: tab === "grid" ? "grid" : "color-palette",
|
|
919
|
+
size: 16 * geometry.scale
|
|
920
|
+
}),
|
|
921
|
+
/* @__PURE__ */ jsx8(Text3, {
|
|
922
|
+
style: selected ? { color: theme.semantics.action.primary.onSolidText } : undefined,
|
|
923
|
+
variant: "label",
|
|
924
|
+
weight: "medium",
|
|
925
|
+
children: tab === "grid" ? "Grid" : "Wheel"
|
|
926
|
+
})
|
|
927
|
+
]
|
|
928
|
+
})
|
|
929
|
+
}, tab);
|
|
930
|
+
})
|
|
699
931
|
});
|
|
700
932
|
}
|
|
701
933
|
function PickerRow({
|
|
@@ -704,32 +936,43 @@ function PickerRow({
|
|
|
704
936
|
tone,
|
|
705
937
|
tones,
|
|
706
938
|
harmony,
|
|
939
|
+
interactionPolicy,
|
|
707
940
|
onToneChange,
|
|
708
941
|
onHarmonyChange
|
|
709
942
|
}) {
|
|
710
|
-
return /* @__PURE__ */
|
|
943
|
+
return /* @__PURE__ */ jsxs5(View2, {
|
|
711
944
|
align: "flex-start",
|
|
712
945
|
direction: "row",
|
|
713
946
|
gap: geometry.gap,
|
|
714
947
|
children: [
|
|
715
|
-
/* @__PURE__ */
|
|
716
|
-
gap:
|
|
948
|
+
/* @__PURE__ */ jsxs5(View2, {
|
|
949
|
+
gap: geometry.cardGap,
|
|
717
950
|
width: geometry.rail,
|
|
718
951
|
children: [
|
|
719
|
-
/* @__PURE__ */ jsx8(
|
|
720
|
-
|
|
721
|
-
|
|
952
|
+
/* @__PURE__ */ jsx8(SettingCard, {
|
|
953
|
+
geometry,
|
|
954
|
+
icon: "diamond",
|
|
955
|
+
interactionPolicy,
|
|
956
|
+
label: "Tone",
|
|
957
|
+
onClear: tone ? () => onToneChange(undefined) : undefined,
|
|
722
958
|
children: /* @__PURE__ */ jsx8(Select2, {
|
|
959
|
+
compact: true,
|
|
960
|
+
interactionPolicy,
|
|
723
961
|
onValueChange: onToneChange,
|
|
724
962
|
options: tones.map((entry) => ({ label: entry.accent, value: entry.id })),
|
|
725
963
|
placeholder: "Any tone",
|
|
726
964
|
value: tone
|
|
727
965
|
})
|
|
728
966
|
}),
|
|
729
|
-
/* @__PURE__ */ jsx8(
|
|
730
|
-
|
|
731
|
-
|
|
967
|
+
/* @__PURE__ */ jsx8(SettingCard, {
|
|
968
|
+
geometry,
|
|
969
|
+
icon: "color-palette",
|
|
970
|
+
interactionPolicy,
|
|
971
|
+
label: "Harmony",
|
|
972
|
+
onClear: harmony ? () => onHarmonyChange(undefined) : undefined,
|
|
732
973
|
children: /* @__PURE__ */ jsx8(Select2, {
|
|
974
|
+
compact: true,
|
|
975
|
+
interactionPolicy,
|
|
733
976
|
onValueChange: onHarmonyChange,
|
|
734
977
|
options: COLOR_HARMONY_CATALOG.map((entry) => ({
|
|
735
978
|
label: entry.label,
|
|
@@ -745,15 +988,70 @@ function PickerRow({
|
|
|
745
988
|
]
|
|
746
989
|
});
|
|
747
990
|
}
|
|
991
|
+
function SettingCard({
|
|
992
|
+
children,
|
|
993
|
+
geometry,
|
|
994
|
+
icon,
|
|
995
|
+
interactionPolicy,
|
|
996
|
+
label,
|
|
997
|
+
onClear
|
|
998
|
+
}) {
|
|
999
|
+
return /* @__PURE__ */ jsxs5(Card2, {
|
|
1000
|
+
compact: true,
|
|
1001
|
+
minHeight: geometry.cardHeight,
|
|
1002
|
+
padding: "s",
|
|
1003
|
+
radius: "m",
|
|
1004
|
+
tone: "subtle",
|
|
1005
|
+
children: [
|
|
1006
|
+
/* @__PURE__ */ jsxs5(View2, {
|
|
1007
|
+
align: "center",
|
|
1008
|
+
direction: "row",
|
|
1009
|
+
gap: "xs",
|
|
1010
|
+
justify: "space-between",
|
|
1011
|
+
children: [
|
|
1012
|
+
/* @__PURE__ */ jsxs5(View2, {
|
|
1013
|
+
align: "center",
|
|
1014
|
+
direction: "row",
|
|
1015
|
+
gap: "xs",
|
|
1016
|
+
children: [
|
|
1017
|
+
/* @__PURE__ */ jsx8(Icon2, {
|
|
1018
|
+
name: icon,
|
|
1019
|
+
size: 20 * geometry.scale
|
|
1020
|
+
}),
|
|
1021
|
+
/* @__PURE__ */ jsx8(Text3, {
|
|
1022
|
+
numberOfLines: 1,
|
|
1023
|
+
variant: "label",
|
|
1024
|
+
weight: "medium",
|
|
1025
|
+
children: label
|
|
1026
|
+
})
|
|
1027
|
+
]
|
|
1028
|
+
}),
|
|
1029
|
+
onClear ? /* @__PURE__ */ jsx8(IconButton2, {
|
|
1030
|
+
disabled: interactionPolicy === "passive",
|
|
1031
|
+
iconName: "close",
|
|
1032
|
+
label: `Clear ${label}`,
|
|
1033
|
+
onPress: onClear,
|
|
1034
|
+
size: "s"
|
|
1035
|
+
}) : null
|
|
1036
|
+
]
|
|
1037
|
+
}),
|
|
1038
|
+
children
|
|
1039
|
+
]
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
748
1042
|
function ColorGrid({
|
|
749
1043
|
palette,
|
|
1044
|
+
primaryIndicatorColor,
|
|
750
1045
|
selectionBorderColor,
|
|
751
1046
|
selected,
|
|
752
1047
|
size,
|
|
753
|
-
onSelect
|
|
1048
|
+
onSelect,
|
|
1049
|
+
disabled = false,
|
|
1050
|
+
harmony
|
|
754
1051
|
}) {
|
|
755
1052
|
const gap = Math.max(3, Math.round(size / 68));
|
|
756
1053
|
const cell = (size - 7 * gap) / 8;
|
|
1054
|
+
const harmonyColors = new Set(harmony ? generateHarmonyRoleColors(selected, harmony).colors.map((role) => role.hex) : []);
|
|
757
1055
|
return /* @__PURE__ */ jsx8(View2, {
|
|
758
1056
|
accessibilityLabel: "Color grid",
|
|
759
1057
|
direction: "row",
|
|
@@ -763,8 +1061,9 @@ function ColorGrid({
|
|
|
763
1061
|
children: palette.map((color) => /* @__PURE__ */ jsx8(Pressable, {
|
|
764
1062
|
accessibilityLabel: `Select ${color}`,
|
|
765
1063
|
bg: color,
|
|
766
|
-
borderColor: color === selected ? selectionBorderColor : "transparent",
|
|
767
|
-
borderWidth: color === selected ? 3 : 1,
|
|
1064
|
+
borderColor: color === selected ? selectionBorderColor : harmonyColors.has(color) ? primaryIndicatorColor : "transparent",
|
|
1065
|
+
borderWidth: color === selected ? 3 : harmonyColors.has(color) ? 1 : 0,
|
|
1066
|
+
disabled,
|
|
768
1067
|
height: cell,
|
|
769
1068
|
onPress: () => onSelect(color),
|
|
770
1069
|
radius: "s",
|
|
@@ -772,27 +1071,14 @@ function ColorGrid({
|
|
|
772
1071
|
}, color))
|
|
773
1072
|
});
|
|
774
1073
|
}
|
|
775
|
-
function resolvePalette(tone) {
|
|
1074
|
+
function resolvePalette(tone, primaryColor, harmony) {
|
|
776
1075
|
const target = tone?.accentTarget;
|
|
777
|
-
|
|
1076
|
+
const candidates = Array.from({ length: 64 }, (_, index) => resolveOklchColor({
|
|
778
1077
|
chroma: target?.chroma ?? 0.08 + index % 8 * 0.018,
|
|
779
1078
|
lightness: target?.lightness ?? 0.35 + Math.floor(index / 8) * 0.065
|
|
780
1079
|
}, index * 137.508 % 360));
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
if (requestedWidth < 360)
|
|
784
|
-
throw new Error("ColorPicker requires a host width of at least 360 logical pixels.");
|
|
785
|
-
const scale = Math.max(0, (Math.min(requestedWidth, 560) - 360) / 200);
|
|
786
|
-
const padding = 12 + scale * 12;
|
|
787
|
-
const rail = 104 + scale * 46;
|
|
788
|
-
const gap = 12 + scale * 8;
|
|
789
|
-
return {
|
|
790
|
-
width: requestedWidth,
|
|
791
|
-
padding,
|
|
792
|
-
rail,
|
|
793
|
-
gap,
|
|
794
|
-
stage: requestedWidth - 2 - 2 * padding - rail - gap
|
|
795
|
-
};
|
|
1080
|
+
const roleColors = harmony ? generateHarmonyRoleColors(primaryColor, harmony).colors.map((role) => role.hex) : [];
|
|
1081
|
+
return Array.from(new Set([primaryColor, ...roleColors, ...candidates])).slice(0, 64);
|
|
796
1082
|
}
|
|
797
1083
|
function resolveEnabledTabs(tabs) {
|
|
798
1084
|
if (tabs.length === 0)
|
|
@@ -804,10 +1090,9 @@ function resolveEnabledTabs(tabs) {
|
|
|
804
1090
|
function isColorPickerTab(value) {
|
|
805
1091
|
return value === "grid" || value === "wheel";
|
|
806
1092
|
}
|
|
807
|
-
|
|
808
1093
|
// src/features/color/ColorTone.tsx
|
|
809
1094
|
import React7 from "react";
|
|
810
|
-
import { jsx as jsx9, jsxs as
|
|
1095
|
+
import { jsx as jsx9, jsxs as jsxs6, Fragment } from "react/jsx-runtime";
|
|
811
1096
|
var MAX_TONE_COLORS = 4;
|
|
812
1097
|
var TONE_MAP_WIDTH = 280;
|
|
813
1098
|
var TONE_MAP_HEIGHT = 220;
|
|
@@ -835,11 +1120,11 @@ function ColorToneInner({
|
|
|
835
1120
|
setEditingColorIndex(0);
|
|
836
1121
|
onChange({ toneId: tone.id, colors: [resolveOklchColor(tone.accentTarget, hue)] });
|
|
837
1122
|
};
|
|
838
|
-
return /* @__PURE__ */
|
|
1123
|
+
return /* @__PURE__ */ jsxs6(View2, {
|
|
839
1124
|
gap: "m",
|
|
840
1125
|
testID,
|
|
841
1126
|
children: [
|
|
842
|
-
/* @__PURE__ */
|
|
1127
|
+
/* @__PURE__ */ jsxs6(View2, {
|
|
843
1128
|
gap: "xs",
|
|
844
1129
|
children: [
|
|
845
1130
|
/* @__PURE__ */ jsx9(Text3, {
|
|
@@ -880,7 +1165,7 @@ function ColorToneInner({
|
|
|
880
1165
|
}, tone.id);
|
|
881
1166
|
})
|
|
882
1167
|
}),
|
|
883
|
-
selectedTone && selectedColor && value ? /* @__PURE__ */
|
|
1168
|
+
selectedTone && selectedColor && value ? /* @__PURE__ */ jsxs6(Fragment, {
|
|
884
1169
|
children: [
|
|
885
1170
|
/* @__PURE__ */ jsx9(ColorToneMap, {
|
|
886
1171
|
color: selectedColor,
|
|
@@ -890,7 +1175,7 @@ function ColorToneInner({
|
|
|
890
1175
|
colors: colors.map((entry, index) => index === currentEditingColorIndex ? resolveOklchColor({ chroma, lightness }, resolveColorHue(entry)) : entry)
|
|
891
1176
|
})
|
|
892
1177
|
}),
|
|
893
|
-
/* @__PURE__ */
|
|
1178
|
+
/* @__PURE__ */ jsxs6(View2, {
|
|
894
1179
|
direction: "row",
|
|
895
1180
|
gap: "xs",
|
|
896
1181
|
wrap: "wrap",
|
|
@@ -969,14 +1254,14 @@ function ColorToneMap({
|
|
|
969
1254
|
height: TONE_MAP_HEIGHT,
|
|
970
1255
|
onChange: changeAt,
|
|
971
1256
|
width: TONE_MAP_WIDTH,
|
|
972
|
-
children: /* @__PURE__ */
|
|
1257
|
+
children: /* @__PURE__ */ jsxs6(Svg, {
|
|
973
1258
|
accessibilityLabel: "Tone color plane",
|
|
974
1259
|
height: TONE_MAP_HEIGHT,
|
|
975
1260
|
width: TONE_MAP_WIDTH,
|
|
976
1261
|
children: [
|
|
977
|
-
/* @__PURE__ */
|
|
1262
|
+
/* @__PURE__ */ jsxs6(Defs, {
|
|
978
1263
|
children: [
|
|
979
|
-
/* @__PURE__ */
|
|
1264
|
+
/* @__PURE__ */ jsxs6(LinearGradient, {
|
|
980
1265
|
id: `${gradientId}-white`,
|
|
981
1266
|
x1: "0",
|
|
982
1267
|
x2: "1",
|
|
@@ -993,7 +1278,7 @@ function ColorToneMap({
|
|
|
993
1278
|
})
|
|
994
1279
|
]
|
|
995
1280
|
}),
|
|
996
|
-
/* @__PURE__ */
|
|
1281
|
+
/* @__PURE__ */ jsxs6(LinearGradient, {
|
|
997
1282
|
id: `${gradientId}-black`,
|
|
998
1283
|
x1: "0",
|
|
999
1284
|
x2: "0",
|