@ankhorage/zora 27.11.3 → 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 +12 -0
- package/README.md +4 -3
- 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 -4
- package/dist/features/color/ColorHexField.js.map +1 -1
- package/dist/features/color/ColorPicker.d.ts +1 -1
- package/dist/features/color/ColorPicker.d.ts.map +1 -1
- package/dist/features/color/ColorPicker.js +174 -59
- package/dist/features/color/ColorPicker.js.map +1 -1
- package/dist/features/color/ColorWheel.d.ts +1 -1
- package/dist/features/color/ColorWheel.d.ts.map +1 -1
- package/dist/features/color/ColorWheel.js +61 -117
- 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 +2 -2
- package/dist/features/color/ColorWheelPointerProxy.web.d.ts.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.web.js +8 -5
- package/dist/features/color/ColorWheelPointerProxy.web.js.map +1 -1
- package/dist/features/color/public.d.ts +1 -1
- package/dist/features/color/public.d.ts.map +1 -1
- package/dist/features/color/public.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 +3 -1
- 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 +34 -26
- 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 +6 -6
- package/src/features/bottom-sheet/adapters/inbound/BottomSheet.tsx +1 -1
- package/src/features/color/ColorHexField.tsx +67 -23
- package/src/features/color/ColorPicker.layout.test.tsx +28 -24
- package/src/features/color/ColorPicker.tsx +449 -121
- package/src/features/color/ColorWheel.tsx +124 -248
- 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 +12 -5
- package/src/features/color/public.ts +0 -2
- 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 -2
- package/src/types/color.ts +34 -22
- package/src/types/select.ts +2 -0
- package/web-dist/chunks/{Accordion-h2nd5y0z.js → Accordion-01bsg7zt.js} +5 -5
- package/web-dist/chunks/{Accordion-6nrpdbmb.js → Accordion-01zvarrn.js} +8 -9
- package/web-dist/chunks/{Accordion-pmfdf08d.js → Accordion-0dj1r7w3.js} +1 -1
- package/web-dist/chunks/{Accordion-3zw817fr.js → Accordion-0xaq2k2h.js} +8 -8
- package/web-dist/chunks/{Accordion-gezcm372.js → Accordion-15sxxjym.js} +4 -5
- package/web-dist/chunks/{Accordion-eq27a9ms.js → Accordion-1fz55hk4.js} +1 -1
- package/web-dist/chunks/{Accordion-j0zhpq4s.js → Accordion-22cda3h5.js} +7 -8
- package/web-dist/chunks/{Accordion-jd26f516.js → Accordion-27yg9ktv.js} +3 -3
- package/web-dist/chunks/{Accordion-f60g73bp.js → Accordion-34b3rwbc.js} +6 -8
- package/web-dist/chunks/{Accordion-1etqb3cj.js → Accordion-3zzzw7a8.js} +2 -2
- package/web-dist/chunks/Accordion-46n609yq.js +253 -0
- package/web-dist/chunks/{Accordion-3jkeydhb.js → Accordion-4zb6dcys.js} +4 -7
- package/web-dist/chunks/{Accordion-dfq04q82.js → Accordion-5cjhz94e.js} +5 -5
- package/web-dist/chunks/{Accordion-49w9bc2f.js → Accordion-5mga7hty.js} +2 -2
- package/web-dist/chunks/{Accordion-kcx57mk5.js → Accordion-76b0qz8y.js} +24 -22
- package/web-dist/chunks/{Accordion-vewhx028.js → Accordion-78tknqmc.js} +4 -4
- package/web-dist/chunks/{Accordion-5vs1k81g.js → Accordion-7bd6zq4s.js} +9 -9
- package/web-dist/chunks/{Accordion-phtyg3k4.js → Accordion-8c4w7366.js} +5 -5
- package/web-dist/chunks/{Accordion-vk2v1zwv.js → Accordion-8t6vh482.js} +3 -4
- package/web-dist/chunks/{Accordion-an5prgty.js → Accordion-9d38cgqj.js} +88 -92
- package/web-dist/chunks/{Accordion-1mxnyexh.js → Accordion-9k7ktksc.js} +212 -215
- package/web-dist/chunks/{Accordion-aws0caav.js → Accordion-afpjg1d6.js} +3 -4
- package/web-dist/chunks/{Accordion-c3nna2bz.js → Accordion-b1y5mjac.js} +1 -1
- package/web-dist/chunks/{Accordion-eak89n4n.js → Accordion-b8w0f8s0.js} +6 -7
- package/web-dist/chunks/{Accordion-ne91vwkd.js → Accordion-bexwrnfh.js} +3 -4
- package/web-dist/chunks/Accordion-chdbfcm6.js +93 -0
- package/web-dist/chunks/{Accordion-6yv4beha.js → Accordion-d405whfb.js} +2 -2
- package/web-dist/chunks/{Accordion-xb174981.js → Accordion-de8srt4x.js} +8 -8
- package/web-dist/chunks/{Accordion-e3r3573t.js → Accordion-epv5yhch.js} +3 -3
- package/web-dist/chunks/{Accordion-g451f3g9.js → Accordion-f4919ghm.js} +4 -4
- package/web-dist/chunks/{Accordion-qhn8z92r.js → Accordion-f8a49gy8.js} +19 -22
- package/web-dist/chunks/{Accordion-3s7zeagv.js → Accordion-fdzyyqe9.js} +1 -1
- package/web-dist/chunks/Accordion-gnxmybxx.js +1331 -0
- package/web-dist/chunks/{Accordion-z8ryq8cb.js → Accordion-h1q243zq.js} +13 -11
- package/web-dist/chunks/{Accordion-dtt4qkrb.js → Accordion-h63c9k9k.js} +1 -1
- package/web-dist/chunks/{Accordion-rzf52xq8.js → Accordion-hdyzyw8q.js} +3 -3
- package/web-dist/chunks/{Accordion-3wkd5x2q.js → Accordion-htvmkx8s.js} +118 -118
- package/web-dist/chunks/{Accordion-0kr0h68p.js → Accordion-jmxe6kw0.js} +9 -11
- package/web-dist/chunks/{Accordion-705yrq6w.js → Accordion-kcm6jcpp.js} +2 -3
- package/web-dist/chunks/{Accordion-fcczvwgg.js → Accordion-mrstcjcm.js} +1 -0
- package/web-dist/chunks/{Accordion-p29kmwh9.js → Accordion-mx7nkg85.js} +1 -1
- package/web-dist/chunks/{Accordion-x0p3wxfp.js → Accordion-pdjhezmz.js} +2 -2
- package/web-dist/chunks/{Accordion-8g9c7890.js → Accordion-q046ws5p.js} +6 -6
- package/web-dist/chunks/{Accordion-jbwey4za.js → Accordion-q11svb96.js} +19 -19
- package/web-dist/chunks/{Accordion-bd6q61s1.js → Accordion-qkkeyr18.js} +6 -8
- package/web-dist/chunks/{Accordion-q1tdazgq.js → Accordion-qrt9xz0h.js} +7 -8
- package/web-dist/chunks/{Accordion-h0e95qxp.js → Accordion-qsppnx7g.js} +10 -11
- package/web-dist/chunks/{Accordion-neg1cgeh.js → Accordion-rhjddvkh.js} +1 -2
- package/web-dist/chunks/{Accordion-ysmzrvhn.js → Accordion-rtamzg9j.js} +47 -28
- package/web-dist/chunks/{Accordion-xwstve3k.js → Accordion-sfvqf4fz.js} +134 -132
- package/web-dist/chunks/{Accordion-9c63jn3m.js → Accordion-sh79sr5g.js} +5 -5
- package/web-dist/chunks/{Accordion-4g54je0w.js → Accordion-t9n4ey2r.js} +5 -3
- package/web-dist/chunks/{Accordion-e5jr9ahb.js → Accordion-tk8zf9ff.js} +3 -3
- package/web-dist/chunks/{Accordion-zypyr9xw.js → Accordion-tnyqv1xv.js} +296 -305
- package/web-dist/chunks/{Accordion-c0a7mhq3.js → Accordion-v6vhyv31.js} +95 -165
- package/web-dist/chunks/{Accordion-6m3k4avp.js → Accordion-vkqqktc5.js} +3 -3
- package/web-dist/chunks/{Accordion-z4qakakw.js → Accordion-vzq344av.js} +2 -3
- package/web-dist/chunks/{Accordion-pcj256bc.js → Accordion-wb9pmykz.js} +5 -6
- package/web-dist/chunks/{Accordion-x7ynjdv7.js → Accordion-ww4f12ty.js} +1 -1
- package/web-dist/chunks/{Accordion-zx8gmww4.js → Accordion-xb9zhdhp.js} +42 -45
- package/web-dist/chunks/{Accordion-3ecnh8d0.js → Accordion-xfkg7dcw.js} +4 -5
- package/web-dist/chunks/{Accordion-6ec4gxv2.js → Accordion-xzaa9s7f.js} +12 -23
- package/web-dist/chunks/{Accordion-vnrqvfca.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 +28 -17
- package/web-dist/components/color-picker/ColorPicker.d.ts +2 -2
- package/web-dist/components/color-picker/ColorPicker.js +28 -17
- package/web-dist/components/color-picker/ColorPicker.types-0.d.ts +34 -45
- package/web-dist/components/color-picker/index.d.ts +1 -1
- package/web-dist/components/color-tone/ColorTone.js +28 -17
- package/web-dist/components/color-wheel/ColorWheel.d.ts +1 -1
- package/web-dist/components/color-wheel/ColorWheel.js +28 -17
- package/web-dist/components/color-wheel/ColorWheel.types-0.d.ts +10 -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 +23 -259
- 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 +1950 -1877
- package/web-dist/runtime/ZoraProvider.js +9 -9
- package/web-dist/chunks/Accordion-r1wkgt7c.js +0 -1074
- package/web-dist/chunks/{Accordion-vgkvvdvg.js → Accordion-ykk40jz9.js} +36 -36
|
@@ -1,1074 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import {
|
|
3
|
-
isHexColor,
|
|
4
|
-
parseHexColorOrThrow,
|
|
5
|
-
converter_default,
|
|
6
|
-
formatHex,
|
|
7
|
-
generateHarmonyRoleColors,
|
|
8
|
-
generateColorSwatch
|
|
9
|
-
} from "./Accordion-an5prgty.js";
|
|
10
|
-
import {
|
|
11
|
-
Pressable
|
|
12
|
-
} from "./Accordion-rzf52xq8.js";
|
|
13
|
-
import {
|
|
14
|
-
withZoraThemeScope
|
|
15
|
-
} from "./Accordion-e5jr9ahb.js";
|
|
16
|
-
import {
|
|
17
|
-
View2
|
|
18
|
-
} from "./Accordion-qhn8z92r.js";
|
|
19
|
-
import {
|
|
20
|
-
Text3
|
|
21
|
-
} from "./Accordion-aws0caav.js";
|
|
22
|
-
import {
|
|
23
|
-
TextInput3
|
|
24
|
-
} from "./Accordion-6yv4beha.js";
|
|
25
|
-
import {
|
|
26
|
-
Icon2
|
|
27
|
-
} from "./Accordion-1etqb3cj.js";
|
|
28
|
-
import {
|
|
29
|
-
Button2,
|
|
30
|
-
Circle,
|
|
31
|
-
Defs,
|
|
32
|
-
Line,
|
|
33
|
-
LinearGradient,
|
|
34
|
-
Path,
|
|
35
|
-
Polygon,
|
|
36
|
-
RadialGradient,
|
|
37
|
-
Rect,
|
|
38
|
-
Stop,
|
|
39
|
-
Svg,
|
|
40
|
-
IconButton2
|
|
41
|
-
} from "./Accordion-0kr0h68p.js";
|
|
42
|
-
import {
|
|
43
|
-
Tab2,
|
|
44
|
-
TabList2,
|
|
45
|
-
TabPanel2,
|
|
46
|
-
Tabs2
|
|
47
|
-
} from "./Accordion-3jkeydhb.js";
|
|
48
|
-
import {
|
|
49
|
-
useZoraTheme2
|
|
50
|
-
} from "./Accordion-c3nna2bz.js";
|
|
51
|
-
|
|
52
|
-
// src/features/color/ColorHexField.tsx
|
|
53
|
-
import React from "react";
|
|
54
|
-
import { jsx } from "react/jsx-runtime";
|
|
55
|
-
function ColorHexField({
|
|
56
|
-
disabled,
|
|
57
|
-
onChange,
|
|
58
|
-
value
|
|
59
|
-
}) {
|
|
60
|
-
const [input, setInput] = React.useState(value);
|
|
61
|
-
const { theme } = useZoraTheme2();
|
|
62
|
-
return /* @__PURE__ */ jsx(TextInput3, {
|
|
63
|
-
accessibilityLabel: "Color hex value",
|
|
64
|
-
disabled,
|
|
65
|
-
leadingAccessory: /* @__PURE__ */ jsx(View2, {
|
|
66
|
-
bg: value,
|
|
67
|
-
borderColor: theme.semantics.border.default,
|
|
68
|
-
borderWidth: 1,
|
|
69
|
-
height: 30,
|
|
70
|
-
radius: "s",
|
|
71
|
-
width: 30
|
|
72
|
-
}),
|
|
73
|
-
onChangeText: (nextValue) => {
|
|
74
|
-
setInput(nextValue);
|
|
75
|
-
if (isHexColor(nextValue))
|
|
76
|
-
onChange(nextValue);
|
|
77
|
-
},
|
|
78
|
-
trailingAccessory: /* @__PURE__ */ jsx(Icon2, {
|
|
79
|
-
color: "textMuted",
|
|
80
|
-
name: "copy-outline",
|
|
81
|
-
size: "m"
|
|
82
|
-
}),
|
|
83
|
-
value: input
|
|
84
|
-
}, value);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// src/features/color/ColorSpectrumSlider.tsx
|
|
88
|
-
import React3 from "react";
|
|
89
|
-
|
|
90
|
-
// src/features/color/ColorHorizontalPointerProxy.web.tsx
|
|
91
|
-
import React2 from "react";
|
|
92
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
93
|
-
function ColorHorizontalPointerProxy({
|
|
94
|
-
children,
|
|
95
|
-
disabled,
|
|
96
|
-
onChange,
|
|
97
|
-
width
|
|
98
|
-
}) {
|
|
99
|
-
const dragging = React2.useRef(false);
|
|
100
|
-
const changeAt = (event) => {
|
|
101
|
-
const target = event.currentTarget;
|
|
102
|
-
const rect = target.getBoundingClientRect();
|
|
103
|
-
onChange((event.clientX - rect.left) / rect.width * width);
|
|
104
|
-
};
|
|
105
|
-
return /* @__PURE__ */ jsx2("div", {
|
|
106
|
-
onMouseDown: (event) => {
|
|
107
|
-
if (disabled)
|
|
108
|
-
return;
|
|
109
|
-
dragging.current = true;
|
|
110
|
-
changeAt(event);
|
|
111
|
-
},
|
|
112
|
-
onMouseMove: (event) => {
|
|
113
|
-
if (!disabled && dragging.current)
|
|
114
|
-
changeAt(event);
|
|
115
|
-
},
|
|
116
|
-
onMouseUp: (event) => {
|
|
117
|
-
if (!disabled && dragging.current)
|
|
118
|
-
changeAt(event);
|
|
119
|
-
dragging.current = false;
|
|
120
|
-
},
|
|
121
|
-
style: { touchAction: "none" },
|
|
122
|
-
children
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
// src/features/color/utils/resolveOklchColor.ts
|
|
126
|
-
function resolveOklchColor(target, hue) {
|
|
127
|
-
const formatted = formatHex({ mode: "oklch", l: target.lightness, c: target.chroma, h: hue });
|
|
128
|
-
if (!formatted)
|
|
129
|
-
throw new Error("The supplied OKLCH target cannot be represented as a hex color.");
|
|
130
|
-
return parseHexColorOrThrow(formatted);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// src/features/color/ColorSpectrumSlider.tsx
|
|
134
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
135
|
-
var SPECTRUM_WIDTH = 280;
|
|
136
|
-
var SPECTRUM_HUES = [0, 60, 120, 180, 240, 300, 360];
|
|
137
|
-
function ColorSpectrumSlider({
|
|
138
|
-
disabled,
|
|
139
|
-
hue,
|
|
140
|
-
label = "Hue",
|
|
141
|
-
onChange
|
|
142
|
-
}) {
|
|
143
|
-
const { theme } = useZoraTheme2();
|
|
144
|
-
const [trackWidth, setTrackWidth] = React3.useState(SPECTRUM_WIDTH);
|
|
145
|
-
const gradientId = `color-spectrum-${React3.useId().replaceAll(":", "")}`;
|
|
146
|
-
const changeAt = (locationX) => {
|
|
147
|
-
if (!disabled)
|
|
148
|
-
onChange(Math.max(0, Math.min(360, locationX / trackWidth * 360)));
|
|
149
|
-
};
|
|
150
|
-
return /* @__PURE__ */ jsxs(View2, {
|
|
151
|
-
gap: "xxs",
|
|
152
|
-
width: "100%",
|
|
153
|
-
children: [
|
|
154
|
-
/* @__PURE__ */ jsxs(View2, {
|
|
155
|
-
direction: "row",
|
|
156
|
-
justify: "space-between",
|
|
157
|
-
children: [
|
|
158
|
-
/* @__PURE__ */ jsx3(Text3, {
|
|
159
|
-
variant: "label",
|
|
160
|
-
children: label
|
|
161
|
-
}),
|
|
162
|
-
/* @__PURE__ */ jsx3(Text3, {
|
|
163
|
-
variant: "label",
|
|
164
|
-
children: `${Math.round(hue)}°`
|
|
165
|
-
})
|
|
166
|
-
]
|
|
167
|
-
}),
|
|
168
|
-
/* @__PURE__ */ jsx3(ColorHorizontalPointerProxy, {
|
|
169
|
-
disabled,
|
|
170
|
-
onChange: changeAt,
|
|
171
|
-
width: SPECTRUM_WIDTH,
|
|
172
|
-
children: /* @__PURE__ */ jsxs(Svg, {
|
|
173
|
-
accessibilityLabel: `${label} spectrum`,
|
|
174
|
-
height: 36,
|
|
175
|
-
onLayout: (event) => setTrackWidth(Math.max(1, event.nativeEvent.layout.width)),
|
|
176
|
-
viewBox: `0 0 ${SPECTRUM_WIDTH} 36`,
|
|
177
|
-
width: "100%",
|
|
178
|
-
children: [
|
|
179
|
-
/* @__PURE__ */ jsx3(Defs, {
|
|
180
|
-
children: /* @__PURE__ */ jsx3(LinearGradient, {
|
|
181
|
-
id: gradientId,
|
|
182
|
-
x1: "0",
|
|
183
|
-
x2: "1",
|
|
184
|
-
y1: "0",
|
|
185
|
-
y2: "0",
|
|
186
|
-
children: SPECTRUM_HUES.map((stopHue, index) => /* @__PURE__ */ jsx3(Stop, {
|
|
187
|
-
offset: String(index / (SPECTRUM_HUES.length - 1)),
|
|
188
|
-
stopColor: resolveOklchColor({ lightness: 0.65, chroma: 0.2 }, stopHue)
|
|
189
|
-
}, stopHue))
|
|
190
|
-
})
|
|
191
|
-
}),
|
|
192
|
-
/* @__PURE__ */ jsx3(Rect, {
|
|
193
|
-
fill: `url(#${gradientId})`,
|
|
194
|
-
height: 12,
|
|
195
|
-
rx: 6,
|
|
196
|
-
width: SPECTRUM_WIDTH,
|
|
197
|
-
y: 12
|
|
198
|
-
}),
|
|
199
|
-
/* @__PURE__ */ jsx3(Circle, {
|
|
200
|
-
cx: hue / 360 * SPECTRUM_WIDTH,
|
|
201
|
-
cy: 18,
|
|
202
|
-
fill: "white",
|
|
203
|
-
r: 10,
|
|
204
|
-
stroke: theme.semantics.content.default,
|
|
205
|
-
strokeWidth: 2
|
|
206
|
-
}),
|
|
207
|
-
/* @__PURE__ */ jsx3(Rect, {
|
|
208
|
-
fill: "transparent",
|
|
209
|
-
height: 36,
|
|
210
|
-
onResponderGrant: (event) => changeAt(event.nativeEvent.locationX),
|
|
211
|
-
onResponderMove: (event) => changeAt(event.nativeEvent.locationX),
|
|
212
|
-
onResponderRelease: (event) => changeAt(event.nativeEvent.locationX),
|
|
213
|
-
onStartShouldSetResponder: () => !disabled,
|
|
214
|
-
width: SPECTRUM_WIDTH
|
|
215
|
-
})
|
|
216
|
-
]
|
|
217
|
-
})
|
|
218
|
-
})
|
|
219
|
-
]
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// src/features/color/utils/resolveColorAtHue.ts
|
|
224
|
-
var toOklch = converter_default("oklch");
|
|
225
|
-
function resolveColorAtHue(color, hue) {
|
|
226
|
-
const parsed = toOklch(color);
|
|
227
|
-
if (!parsed || typeof parsed.l !== "number" || typeof parsed.c !== "number")
|
|
228
|
-
return color;
|
|
229
|
-
const formatted = formatHex({ mode: "oklch", l: parsed.l, c: parsed.c, h: hue });
|
|
230
|
-
return formatted ? parseHexColorOrThrow(formatted) : color;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// src/features/color/utils/resolveColorHue.ts
|
|
234
|
-
var toOklch2 = converter_default("oklch");
|
|
235
|
-
function resolveColorHue(color) {
|
|
236
|
-
const parsed = toOklch2(color);
|
|
237
|
-
return typeof parsed?.h === "number" ? parsed.h : 0;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// src/features/color/ColorHueScale.tsx
|
|
241
|
-
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
242
|
-
var ColorHueScale2 = withZoraThemeScope(ColorHueScaleInner);
|
|
243
|
-
function ColorHueScaleInner({
|
|
244
|
-
themeId: _themeId,
|
|
245
|
-
mode: _mode,
|
|
246
|
-
inverted: _inverted,
|
|
247
|
-
interactionPolicy,
|
|
248
|
-
value,
|
|
249
|
-
onChange,
|
|
250
|
-
testID
|
|
251
|
-
}) {
|
|
252
|
-
const { theme } = useZoraTheme2();
|
|
253
|
-
const { swatch } = generateColorSwatch(value);
|
|
254
|
-
const swatches = Object.entries(swatch);
|
|
255
|
-
return /* @__PURE__ */ jsxs2(View2, {
|
|
256
|
-
gap: "m",
|
|
257
|
-
testID,
|
|
258
|
-
children: [
|
|
259
|
-
/* @__PURE__ */ jsx4(ColorSpectrumSlider, {
|
|
260
|
-
disabled: interactionPolicy === "passive",
|
|
261
|
-
hue: resolveColorHue(value),
|
|
262
|
-
onChange: (nextHue) => onChange(resolveColorAtHue(value, nextHue))
|
|
263
|
-
}),
|
|
264
|
-
/* @__PURE__ */ jsx4(Text3, {
|
|
265
|
-
variant: "label",
|
|
266
|
-
children: "Intensity"
|
|
267
|
-
}),
|
|
268
|
-
/* @__PURE__ */ jsx4(View2, {
|
|
269
|
-
accessibilityLabel: "Color scale previews; choose a preview as the next 500 base color",
|
|
270
|
-
direction: "row",
|
|
271
|
-
gap: "xs",
|
|
272
|
-
wrap: "wrap",
|
|
273
|
-
children: swatches.map(([step, color]) => /* @__PURE__ */ jsx4(Pressable, {
|
|
274
|
-
accessibilityLabel: Number(step) === 500 ? `Current editable base color 500: ${color}` : `Use generated ${step} preview ${color} as the next base color 500`,
|
|
275
|
-
bg: color,
|
|
276
|
-
borderColor: theme.semantics.border.default,
|
|
277
|
-
borderWidth: Number(step) === 500 ? 3 : 1,
|
|
278
|
-
disabled: interactionPolicy === "passive",
|
|
279
|
-
height: 48,
|
|
280
|
-
onPress: () => onChange(color),
|
|
281
|
-
radius: "s",
|
|
282
|
-
width: "18%",
|
|
283
|
-
children: /* @__PURE__ */ jsx4(Text3, {
|
|
284
|
-
align: "center",
|
|
285
|
-
variant: "caption",
|
|
286
|
-
children: step
|
|
287
|
-
})
|
|
288
|
-
}, step))
|
|
289
|
-
}),
|
|
290
|
-
/* @__PURE__ */ jsx4(ColorHexField, {
|
|
291
|
-
disabled: interactionPolicy === "passive",
|
|
292
|
-
onChange,
|
|
293
|
-
value
|
|
294
|
-
}, value)
|
|
295
|
-
]
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// src/features/color/ColorTone.tsx
|
|
300
|
-
import React5 from "react";
|
|
301
|
-
|
|
302
|
-
// src/features/color/ColorWheelPointerProxy.web.tsx
|
|
303
|
-
import React4 from "react";
|
|
304
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
305
|
-
function ColorWheelPointerProxy({
|
|
306
|
-
children,
|
|
307
|
-
disabled,
|
|
308
|
-
height,
|
|
309
|
-
onChange,
|
|
310
|
-
width
|
|
311
|
-
}) {
|
|
312
|
-
const dragging = React4.useRef(false);
|
|
313
|
-
const changeAt = (event) => {
|
|
314
|
-
const target = event.currentTarget;
|
|
315
|
-
const rect = target.getBoundingClientRect();
|
|
316
|
-
onChange((event.clientX - rect.left) / rect.width * width, (event.clientY - rect.top) / rect.height * height);
|
|
317
|
-
};
|
|
318
|
-
return /* @__PURE__ */ jsx5("div", {
|
|
319
|
-
onMouseDown: (event) => {
|
|
320
|
-
if (disabled)
|
|
321
|
-
return;
|
|
322
|
-
dragging.current = true;
|
|
323
|
-
changeAt(event);
|
|
324
|
-
},
|
|
325
|
-
onMouseMove: (event) => {
|
|
326
|
-
if (!disabled && dragging.current)
|
|
327
|
-
changeAt(event);
|
|
328
|
-
},
|
|
329
|
-
onMouseUp: (event) => {
|
|
330
|
-
if (!disabled && dragging.current)
|
|
331
|
-
changeAt(event);
|
|
332
|
-
dragging.current = false;
|
|
333
|
-
},
|
|
334
|
-
style: { touchAction: "none" },
|
|
335
|
-
children
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// src/features/color/utils/resolveWheelColorComponents.ts
|
|
340
|
-
var toOklch3 = converter_default("oklch");
|
|
341
|
-
function resolveWheelColorComponents(color) {
|
|
342
|
-
const parsed = toOklch3(color);
|
|
343
|
-
return {
|
|
344
|
-
chroma: typeof parsed?.c === "number" ? parsed.c : 0,
|
|
345
|
-
lightness: typeof parsed?.l === "number" ? parsed.l : 0.65
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
// src/features/color/ColorTone.tsx
|
|
350
|
-
import { jsx as jsx6, jsxs as jsxs3, Fragment } from "react/jsx-runtime";
|
|
351
|
-
var MAX_TONE_COLORS = 4;
|
|
352
|
-
var TONE_MAP_WIDTH = 280;
|
|
353
|
-
var TONE_MAP_HEIGHT = 220;
|
|
354
|
-
var TONE_MAX_CHROMA = 0.2;
|
|
355
|
-
var ColorTone2 = withZoraThemeScope(ColorToneInner);
|
|
356
|
-
function ColorToneInner({
|
|
357
|
-
themeId: _themeId,
|
|
358
|
-
mode: _mode,
|
|
359
|
-
inverted: _inverted,
|
|
360
|
-
interactionPolicy,
|
|
361
|
-
tones,
|
|
362
|
-
selectionMode = "single",
|
|
363
|
-
value,
|
|
364
|
-
onChange,
|
|
365
|
-
testID
|
|
366
|
-
}) {
|
|
367
|
-
const { theme } = useZoraTheme2();
|
|
368
|
-
const [editingColorIndex, setEditingColorIndex] = React5.useState(0);
|
|
369
|
-
const selectedTone = tones.find((tone) => tone.id === value?.toneId);
|
|
370
|
-
const colors = value ? selectionMode === "single" ? value.colors.slice(0, 1) : value.colors.slice(0, MAX_TONE_COLORS) : [];
|
|
371
|
-
const currentEditingColorIndex = Math.min(editingColorIndex, Math.max(0, colors.length - 1));
|
|
372
|
-
const selectedColor = colors.at(currentEditingColorIndex);
|
|
373
|
-
const selectTone = (tone) => {
|
|
374
|
-
const hue = selectedColor ? resolveColorHue(selectedColor) : 0;
|
|
375
|
-
setEditingColorIndex(0);
|
|
376
|
-
onChange({ toneId: tone.id, colors: [resolveOklchColor(tone.accentTarget, hue)] });
|
|
377
|
-
};
|
|
378
|
-
return /* @__PURE__ */ jsxs3(View2, {
|
|
379
|
-
gap: "m",
|
|
380
|
-
testID,
|
|
381
|
-
children: [
|
|
382
|
-
/* @__PURE__ */ jsxs3(View2, {
|
|
383
|
-
gap: "xs",
|
|
384
|
-
children: [
|
|
385
|
-
/* @__PURE__ */ jsx6(Text3, {
|
|
386
|
-
variant: "label",
|
|
387
|
-
children: "Tone"
|
|
388
|
-
}),
|
|
389
|
-
/* @__PURE__ */ jsx6(Text3, {
|
|
390
|
-
emphasis: "muted",
|
|
391
|
-
variant: "caption",
|
|
392
|
-
children: "Choose a catalog tone"
|
|
393
|
-
})
|
|
394
|
-
]
|
|
395
|
-
}),
|
|
396
|
-
/* @__PURE__ */ jsx6(View2, {
|
|
397
|
-
direction: "row",
|
|
398
|
-
gap: "s",
|
|
399
|
-
wrap: "wrap",
|
|
400
|
-
children: tones.map((tone) => {
|
|
401
|
-
const selected = value?.toneId === tone.id;
|
|
402
|
-
const color = selected && selectedColor ? selectedColor : resolveOklchColor(tone.accentTarget, 0);
|
|
403
|
-
return /* @__PURE__ */ jsx6(Pressable, {
|
|
404
|
-
accessibilityLabel: tone.accent,
|
|
405
|
-
accessibilityRole: "radio",
|
|
406
|
-
accessibilityState: { checked: selected },
|
|
407
|
-
bg: color,
|
|
408
|
-
borderColor: theme.semantics.border.default,
|
|
409
|
-
borderWidth: selected ? 3 : 1,
|
|
410
|
-
disabled: interactionPolicy === "passive",
|
|
411
|
-
height: 56,
|
|
412
|
-
onPress: () => selectTone(tone),
|
|
413
|
-
radius: "m",
|
|
414
|
-
width: 56,
|
|
415
|
-
children: /* @__PURE__ */ jsx6(Text3, {
|
|
416
|
-
align: "center",
|
|
417
|
-
variant: "caption",
|
|
418
|
-
children: tone.accent
|
|
419
|
-
})
|
|
420
|
-
}, tone.id);
|
|
421
|
-
})
|
|
422
|
-
}),
|
|
423
|
-
selectedTone && selectedColor && value ? /* @__PURE__ */ jsxs3(Fragment, {
|
|
424
|
-
children: [
|
|
425
|
-
/* @__PURE__ */ jsx6(ColorToneMap, {
|
|
426
|
-
color: selectedColor,
|
|
427
|
-
disabled: interactionPolicy === "passive",
|
|
428
|
-
onChange: (lightness, chroma) => onChange({
|
|
429
|
-
toneId: selectedTone.id,
|
|
430
|
-
colors: colors.map((entry, index) => index === currentEditingColorIndex ? resolveOklchColor({ chroma, lightness }, resolveColorHue(entry)) : entry)
|
|
431
|
-
})
|
|
432
|
-
}),
|
|
433
|
-
/* @__PURE__ */ jsxs3(View2, {
|
|
434
|
-
direction: "row",
|
|
435
|
-
gap: "xs",
|
|
436
|
-
wrap: "wrap",
|
|
437
|
-
children: [
|
|
438
|
-
colors.map((color, index) => /* @__PURE__ */ jsx6(Pressable, {
|
|
439
|
-
accessibilityLabel: `Selected ${selectedTone.accent} color ${index + 1}: ${color}`,
|
|
440
|
-
accessibilityRole: "radio",
|
|
441
|
-
accessibilityState: { checked: currentEditingColorIndex === index },
|
|
442
|
-
bg: color,
|
|
443
|
-
borderColor: theme.semantics.border.default,
|
|
444
|
-
borderWidth: currentEditingColorIndex === index ? 3 : 1,
|
|
445
|
-
disabled: interactionPolicy === "passive",
|
|
446
|
-
height: 44,
|
|
447
|
-
onPress: () => setEditingColorIndex(index),
|
|
448
|
-
radius: "m",
|
|
449
|
-
width: 44
|
|
450
|
-
}, `${color}-${index}`)),
|
|
451
|
-
selectionMode === "multiple" ? /* @__PURE__ */ jsx6(Button2, {
|
|
452
|
-
disabled: interactionPolicy === "passive" || colors.length >= MAX_TONE_COLORS,
|
|
453
|
-
onPress: () => {
|
|
454
|
-
setEditingColorIndex(colors.length);
|
|
455
|
-
onChange({
|
|
456
|
-
toneId: selectedTone.id,
|
|
457
|
-
colors: [...colors, resolveOklchColor(selectedTone.accentTarget, 0)]
|
|
458
|
-
});
|
|
459
|
-
},
|
|
460
|
-
children: "Add color"
|
|
461
|
-
}) : null,
|
|
462
|
-
selectionMode === "multiple" && colors.length > 1 ? /* @__PURE__ */ jsx6(Button2, {
|
|
463
|
-
disabled: interactionPolicy === "passive",
|
|
464
|
-
onPress: () => {
|
|
465
|
-
const nextColors = colors.filter((_, index) => index !== currentEditingColorIndex);
|
|
466
|
-
setEditingColorIndex(Math.min(currentEditingColorIndex, nextColors.length - 1));
|
|
467
|
-
onChange({ toneId: selectedTone.id, colors: nextColors });
|
|
468
|
-
},
|
|
469
|
-
children: "Remove color"
|
|
470
|
-
}) : null
|
|
471
|
-
]
|
|
472
|
-
}),
|
|
473
|
-
/* @__PURE__ */ jsx6(ColorSpectrumSlider, {
|
|
474
|
-
disabled: interactionPolicy === "passive",
|
|
475
|
-
hue: resolveColorHue(selectedColor),
|
|
476
|
-
onChange: (nextHue) => onChange({
|
|
477
|
-
toneId: selectedTone.id,
|
|
478
|
-
colors: colors.map((entry, index) => index === currentEditingColorIndex ? resolveOklchColor(selectedTone.accentTarget, nextHue) : entry)
|
|
479
|
-
})
|
|
480
|
-
}),
|
|
481
|
-
/* @__PURE__ */ jsx6(ColorHexField, {
|
|
482
|
-
disabled: interactionPolicy === "passive",
|
|
483
|
-
onChange: (color) => onChange({
|
|
484
|
-
toneId: selectedTone.id,
|
|
485
|
-
colors: colors.map((entry, index) => index === currentEditingColorIndex ? color : entry)
|
|
486
|
-
}),
|
|
487
|
-
value: selectedColor
|
|
488
|
-
}, selectedColor)
|
|
489
|
-
]
|
|
490
|
-
}) : null
|
|
491
|
-
]
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
function ColorToneMap({
|
|
495
|
-
color,
|
|
496
|
-
disabled,
|
|
497
|
-
onChange
|
|
498
|
-
}) {
|
|
499
|
-
const hue = resolveColorHue(color);
|
|
500
|
-
const { chroma, lightness } = resolveWheelColorComponents(color);
|
|
501
|
-
const gradientId = `color-tone-${React5.useId().replaceAll(":", "")}`;
|
|
502
|
-
const changeAt = (x, y) => {
|
|
503
|
-
if (disabled)
|
|
504
|
-
return;
|
|
505
|
-
onChange(Math.max(0, Math.min(1, 1 - y / TONE_MAP_HEIGHT)), Math.max(0, Math.min(TONE_MAX_CHROMA, x / TONE_MAP_WIDTH * TONE_MAX_CHROMA)));
|
|
506
|
-
};
|
|
507
|
-
return /* @__PURE__ */ jsx6(ColorWheelPointerProxy, {
|
|
508
|
-
disabled,
|
|
509
|
-
height: TONE_MAP_HEIGHT,
|
|
510
|
-
onChange: changeAt,
|
|
511
|
-
width: TONE_MAP_WIDTH,
|
|
512
|
-
children: /* @__PURE__ */ jsxs3(Svg, {
|
|
513
|
-
accessibilityLabel: "Tone color plane",
|
|
514
|
-
height: TONE_MAP_HEIGHT,
|
|
515
|
-
width: TONE_MAP_WIDTH,
|
|
516
|
-
children: [
|
|
517
|
-
/* @__PURE__ */ jsxs3(Defs, {
|
|
518
|
-
children: [
|
|
519
|
-
/* @__PURE__ */ jsxs3(LinearGradient, {
|
|
520
|
-
id: `${gradientId}-white`,
|
|
521
|
-
x1: "0",
|
|
522
|
-
x2: "1",
|
|
523
|
-
y1: "0",
|
|
524
|
-
y2: "0",
|
|
525
|
-
children: [
|
|
526
|
-
/* @__PURE__ */ jsx6(Stop, {
|
|
527
|
-
offset: "0",
|
|
528
|
-
stopColor: "white"
|
|
529
|
-
}),
|
|
530
|
-
/* @__PURE__ */ jsx6(Stop, {
|
|
531
|
-
offset: "1",
|
|
532
|
-
stopColor: resolveOklchColor({ chroma: TONE_MAX_CHROMA, lightness: 0.65 }, hue)
|
|
533
|
-
})
|
|
534
|
-
]
|
|
535
|
-
}),
|
|
536
|
-
/* @__PURE__ */ jsxs3(LinearGradient, {
|
|
537
|
-
id: `${gradientId}-black`,
|
|
538
|
-
x1: "0",
|
|
539
|
-
x2: "0",
|
|
540
|
-
y1: "0",
|
|
541
|
-
y2: "1",
|
|
542
|
-
children: [
|
|
543
|
-
/* @__PURE__ */ jsx6(Stop, {
|
|
544
|
-
offset: "0",
|
|
545
|
-
stopColor: "transparent"
|
|
546
|
-
}),
|
|
547
|
-
/* @__PURE__ */ jsx6(Stop, {
|
|
548
|
-
offset: "1",
|
|
549
|
-
stopColor: "black"
|
|
550
|
-
})
|
|
551
|
-
]
|
|
552
|
-
})
|
|
553
|
-
]
|
|
554
|
-
}),
|
|
555
|
-
/* @__PURE__ */ jsx6(Rect, {
|
|
556
|
-
fill: `url(#${gradientId}-white)`,
|
|
557
|
-
height: TONE_MAP_HEIGHT,
|
|
558
|
-
width: TONE_MAP_WIDTH
|
|
559
|
-
}),
|
|
560
|
-
/* @__PURE__ */ jsx6(Rect, {
|
|
561
|
-
fill: `url(#${gradientId}-black)`,
|
|
562
|
-
height: TONE_MAP_HEIGHT,
|
|
563
|
-
width: TONE_MAP_WIDTH
|
|
564
|
-
}),
|
|
565
|
-
/* @__PURE__ */ jsx6(Circle, {
|
|
566
|
-
cx: chroma / TONE_MAX_CHROMA * TONE_MAP_WIDTH,
|
|
567
|
-
cy: (1 - lightness) * TONE_MAP_HEIGHT,
|
|
568
|
-
fill: "none",
|
|
569
|
-
r: 10,
|
|
570
|
-
stroke: "white",
|
|
571
|
-
strokeWidth: 3
|
|
572
|
-
}),
|
|
573
|
-
/* @__PURE__ */ jsx6(Rect, {
|
|
574
|
-
fill: "transparent",
|
|
575
|
-
height: TONE_MAP_HEIGHT,
|
|
576
|
-
onResponderGrant: (event) => changeAt(event.nativeEvent.locationX, event.nativeEvent.locationY),
|
|
577
|
-
onResponderMove: (event) => changeAt(event.nativeEvent.locationX, event.nativeEvent.locationY),
|
|
578
|
-
onResponderRelease: (event) => changeAt(event.nativeEvent.locationX, event.nativeEvent.locationY),
|
|
579
|
-
onStartShouldSetResponder: () => !disabled,
|
|
580
|
-
width: TONE_MAP_WIDTH
|
|
581
|
-
})
|
|
582
|
-
]
|
|
583
|
-
})
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
// src/features/color/ColorWheel.tsx
|
|
588
|
-
import React6 from "react";
|
|
589
|
-
|
|
590
|
-
// src/features/color/ColorWheelKeyboardProxy.web.tsx
|
|
591
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
592
|
-
function ColorWheelKeyboardProxy({
|
|
593
|
-
children,
|
|
594
|
-
chroma,
|
|
595
|
-
disabled,
|
|
596
|
-
hue,
|
|
597
|
-
onChange
|
|
598
|
-
}) {
|
|
599
|
-
return /* @__PURE__ */ jsx7("div", {
|
|
600
|
-
"aria-label": `Color wheel, hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`,
|
|
601
|
-
"aria-valuemax": 360,
|
|
602
|
-
"aria-valuemin": 0,
|
|
603
|
-
"aria-valuenow": Math.round(hue),
|
|
604
|
-
"aria-valuetext": `Hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`,
|
|
605
|
-
"aria-disabled": disabled,
|
|
606
|
-
onKeyDown: (event) => {
|
|
607
|
-
const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma);
|
|
608
|
-
if (!nextValue || disabled)
|
|
609
|
-
return;
|
|
610
|
-
event.preventDefault();
|
|
611
|
-
onChange(nextValue.hue, nextValue.chroma);
|
|
612
|
-
},
|
|
613
|
-
role: "slider",
|
|
614
|
-
tabIndex: disabled ? -1 : 0,
|
|
615
|
-
children
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
function resolveKeyboardWheelValue(key, hue, chroma) {
|
|
619
|
-
if (key === "ArrowLeft")
|
|
620
|
-
return { chroma, hue: normalizeHue(hue - 5) };
|
|
621
|
-
if (key === "ArrowRight")
|
|
622
|
-
return { chroma, hue: normalizeHue(hue + 5) };
|
|
623
|
-
if (key === "ArrowDown")
|
|
624
|
-
return { chroma: Math.max(0, chroma - 0.02), hue };
|
|
625
|
-
if (key === "ArrowUp")
|
|
626
|
-
return { chroma: Math.min(0.2, chroma + 0.02), hue };
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
function normalizeHue(hue) {
|
|
630
|
-
return hue < 0 ? hue + 360 : hue >= 360 ? hue - 360 : hue;
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
// src/features/color/utils/resolveWheelColor.ts
|
|
634
|
-
function resolveWheelColor(color, x, y, center, radius, maxChroma) {
|
|
635
|
-
const { lightness } = resolveWheelColorComponents(color);
|
|
636
|
-
const deltaX = x - center;
|
|
637
|
-
const deltaY = y - center;
|
|
638
|
-
const distance = Math.min(Math.hypot(deltaX, deltaY), radius);
|
|
639
|
-
const hue = normalizeHue2(Math.atan2(deltaY, deltaX) * 180 / Math.PI + 90);
|
|
640
|
-
const chroma = distance / radius * maxChroma;
|
|
641
|
-
return resolveOklchColor({ lightness, chroma }, hue);
|
|
642
|
-
}
|
|
643
|
-
function normalizeHue2(hue) {
|
|
644
|
-
return hue < 0 ? hue + 360 : hue;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
// src/features/color/ColorWheel.tsx
|
|
648
|
-
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
649
|
-
var WHEEL_SIZE = 280;
|
|
650
|
-
var WHEEL_CENTER = WHEEL_SIZE / 2;
|
|
651
|
-
var WHEEL_RADIUS = 128;
|
|
652
|
-
var WHEEL_SEGMENT_COUNT = 72;
|
|
653
|
-
var WHEEL_MAX_CHROMA = 0.2;
|
|
654
|
-
var ColorWheel2 = withZoraThemeScope(ColorWheelInner);
|
|
655
|
-
function ColorWheelInner({
|
|
656
|
-
themeId: _themeId,
|
|
657
|
-
mode: _mode,
|
|
658
|
-
inverted: _inverted,
|
|
659
|
-
interactionPolicy,
|
|
660
|
-
value,
|
|
661
|
-
harmony = null,
|
|
662
|
-
harmonies,
|
|
663
|
-
onChange,
|
|
664
|
-
testID
|
|
665
|
-
}) {
|
|
666
|
-
const { theme } = useZoraTheme2();
|
|
667
|
-
const hue = resolveColorHue(value);
|
|
668
|
-
const { chroma, lightness } = resolveWheelColorComponents(value);
|
|
669
|
-
const harmonyColors = harmony ? generateHarmonyRoleColors(value, harmony).colors : [];
|
|
670
|
-
const selectedPoint = resolveWheelPoint(hue, Math.min(1, chroma / WHEEL_MAX_CHROMA));
|
|
671
|
-
const harmonyPoints = harmonyColors.map((color) => resolveWheelPoint(color.hueDegrees));
|
|
672
|
-
const harmonyLines = resolveHarmonyLines(harmonyPoints, selectedPoint, theme.semantics.content.default);
|
|
673
|
-
const wheelGradientId = `color-wheel-${React6.useId().replaceAll(":", "")}`;
|
|
674
|
-
const changeColorAt = (x, y) => {
|
|
675
|
-
if (interactionPolicy === "passive")
|
|
676
|
-
return;
|
|
677
|
-
onChange({
|
|
678
|
-
color: resolveWheelColor(value, x, y, WHEEL_CENTER, WHEEL_RADIUS, WHEEL_MAX_CHROMA),
|
|
679
|
-
harmony
|
|
680
|
-
});
|
|
681
|
-
};
|
|
682
|
-
const changeLightness = (nextLightness) => onChange({
|
|
683
|
-
color: resolveOklchColor({ chroma, lightness: Math.max(0, Math.min(1, nextLightness)) }, hue),
|
|
684
|
-
harmony
|
|
685
|
-
});
|
|
686
|
-
return /* @__PURE__ */ jsxs4(View2, {
|
|
687
|
-
align: "center",
|
|
688
|
-
gap: "s",
|
|
689
|
-
testID,
|
|
690
|
-
children: [
|
|
691
|
-
/* @__PURE__ */ jsx8(ColorWheelKeyboardProxy, {
|
|
692
|
-
chroma,
|
|
693
|
-
disabled: interactionPolicy === "passive",
|
|
694
|
-
hue,
|
|
695
|
-
onChange: (nextHue, nextChroma) => onChange({
|
|
696
|
-
color: resolveOklchColor({ lightness: resolveWheelLightness(value), chroma: nextChroma }, nextHue),
|
|
697
|
-
harmony
|
|
698
|
-
}),
|
|
699
|
-
children: /* @__PURE__ */ jsx8(ColorWheelPointerProxy, {
|
|
700
|
-
disabled: interactionPolicy === "passive",
|
|
701
|
-
height: WHEEL_SIZE,
|
|
702
|
-
onChange: changeColorAt,
|
|
703
|
-
width: WHEEL_SIZE,
|
|
704
|
-
children: /* @__PURE__ */ jsxs4(Svg, {
|
|
705
|
-
accessibilityLabel: "Color wheel",
|
|
706
|
-
height: WHEEL_SIZE,
|
|
707
|
-
onResponderGrant: (event) => {
|
|
708
|
-
const { locationX, locationY } = event.nativeEvent;
|
|
709
|
-
changeColorAt(locationX, locationY);
|
|
710
|
-
},
|
|
711
|
-
onResponderMove: (event) => {
|
|
712
|
-
const { locationX, locationY } = event.nativeEvent;
|
|
713
|
-
changeColorAt(locationX, locationY);
|
|
714
|
-
},
|
|
715
|
-
onResponderRelease: (event) => {
|
|
716
|
-
const { locationX, locationY } = event.nativeEvent;
|
|
717
|
-
changeColorAt(locationX, locationY);
|
|
718
|
-
},
|
|
719
|
-
onStartShouldSetResponder: () => interactionPolicy !== "passive",
|
|
720
|
-
width: WHEEL_SIZE,
|
|
721
|
-
children: [
|
|
722
|
-
/* @__PURE__ */ jsx8(Defs, {
|
|
723
|
-
children: resolveWheelSegments().map((segment) => /* @__PURE__ */ jsxs4(RadialGradient, {
|
|
724
|
-
cx: WHEEL_CENTER,
|
|
725
|
-
cy: WHEEL_CENTER,
|
|
726
|
-
id: `${wheelGradientId}-${segment.hue}`,
|
|
727
|
-
r: WHEEL_RADIUS,
|
|
728
|
-
children: [
|
|
729
|
-
/* @__PURE__ */ jsx8(Stop, {
|
|
730
|
-
offset: "0",
|
|
731
|
-
stopColor: resolveOklchColor({ lightness: 0.65, chroma: 0 }, segment.hue)
|
|
732
|
-
}),
|
|
733
|
-
/* @__PURE__ */ jsx8(Stop, {
|
|
734
|
-
offset: "1",
|
|
735
|
-
stopColor: segment.color
|
|
736
|
-
})
|
|
737
|
-
]
|
|
738
|
-
}, segment.hue))
|
|
739
|
-
}),
|
|
740
|
-
resolveWheelSegments().map((segment) => /* @__PURE__ */ jsx8(Path, {
|
|
741
|
-
d: segment.path,
|
|
742
|
-
fill: `url(#${wheelGradientId}-${segment.hue})`
|
|
743
|
-
}, segment.hue)),
|
|
744
|
-
harmony === "triadic" && harmonyPoints.length === 3 ? /* @__PURE__ */ jsx8(Polygon, {
|
|
745
|
-
fill: "none",
|
|
746
|
-
points: harmonyPoints.map((point) => `${point.x},${point.y}`).join(" "),
|
|
747
|
-
stroke: theme.semantics.content.default,
|
|
748
|
-
strokeWidth: 2
|
|
749
|
-
}) : harmonyLines,
|
|
750
|
-
harmonyPoints.map((point) => /* @__PURE__ */ jsx8(Circle, {
|
|
751
|
-
cx: point.x,
|
|
752
|
-
cy: point.y,
|
|
753
|
-
fill: theme.semantics.content.default,
|
|
754
|
-
r: 5
|
|
755
|
-
}, `${point.x}-${point.y}`)),
|
|
756
|
-
/* @__PURE__ */ jsx8(Circle, {
|
|
757
|
-
cx: selectedPoint.x,
|
|
758
|
-
cy: selectedPoint.y,
|
|
759
|
-
fill: "none",
|
|
760
|
-
r: 9,
|
|
761
|
-
stroke: theme.semantics.content.default,
|
|
762
|
-
strokeWidth: 3
|
|
763
|
-
})
|
|
764
|
-
]
|
|
765
|
-
})
|
|
766
|
-
})
|
|
767
|
-
}),
|
|
768
|
-
/* @__PURE__ */ jsx8(ColorLightnessSlider, {
|
|
769
|
-
chroma,
|
|
770
|
-
disabled: interactionPolicy === "passive",
|
|
771
|
-
hue,
|
|
772
|
-
lightness,
|
|
773
|
-
onChange: changeLightness,
|
|
774
|
-
selectionBorderColor: theme.semantics.content.default
|
|
775
|
-
}),
|
|
776
|
-
/* @__PURE__ */ jsx8(ColorHexField, {
|
|
777
|
-
disabled: interactionPolicy === "passive",
|
|
778
|
-
onChange: (color) => onChange({ color, harmony }),
|
|
779
|
-
value
|
|
780
|
-
}, value),
|
|
781
|
-
harmonies ? /* @__PURE__ */ jsxs4(View2, {
|
|
782
|
-
direction: "row",
|
|
783
|
-
gap: "xs",
|
|
784
|
-
wrap: "wrap",
|
|
785
|
-
children: [
|
|
786
|
-
/* @__PURE__ */ jsx8(Button2, {
|
|
787
|
-
disabled: interactionPolicy === "passive",
|
|
788
|
-
onPress: () => onChange({ color: value, harmony: null }),
|
|
789
|
-
variant: harmony === null ? "solid" : "outline",
|
|
790
|
-
children: "None"
|
|
791
|
-
}),
|
|
792
|
-
harmonies.map((candidate) => /* @__PURE__ */ jsx8(Button2, {
|
|
793
|
-
disabled: interactionPolicy === "passive",
|
|
794
|
-
onPress: () => onChange({ color: value, harmony: candidate }),
|
|
795
|
-
variant: harmony === candidate ? "solid" : "outline",
|
|
796
|
-
children: candidate
|
|
797
|
-
}, candidate))
|
|
798
|
-
]
|
|
799
|
-
}) : null
|
|
800
|
-
]
|
|
801
|
-
});
|
|
802
|
-
}
|
|
803
|
-
function ColorLightnessSlider({
|
|
804
|
-
chroma,
|
|
805
|
-
disabled,
|
|
806
|
-
hue,
|
|
807
|
-
lightness,
|
|
808
|
-
onChange,
|
|
809
|
-
selectionBorderColor
|
|
810
|
-
}) {
|
|
811
|
-
const changeAt = (locationX) => {
|
|
812
|
-
if (!disabled)
|
|
813
|
-
onChange(Math.max(0, Math.min(1, locationX / WHEEL_SIZE)));
|
|
814
|
-
};
|
|
815
|
-
return /* @__PURE__ */ jsxs4(View2, {
|
|
816
|
-
gap: "xxs",
|
|
817
|
-
width: WHEEL_SIZE,
|
|
818
|
-
children: [
|
|
819
|
-
/* @__PURE__ */ jsxs4(View2, {
|
|
820
|
-
direction: "row",
|
|
821
|
-
justify: "space-between",
|
|
822
|
-
children: [
|
|
823
|
-
/* @__PURE__ */ jsx8(Text3, {
|
|
824
|
-
variant: "label",
|
|
825
|
-
children: "Lightness"
|
|
826
|
-
}),
|
|
827
|
-
/* @__PURE__ */ jsx8(Text3, {
|
|
828
|
-
variant: "label",
|
|
829
|
-
children: `${Math.round(lightness * 100)}%`
|
|
830
|
-
})
|
|
831
|
-
]
|
|
832
|
-
}),
|
|
833
|
-
/* @__PURE__ */ jsx8(ColorHorizontalPointerProxy, {
|
|
834
|
-
disabled,
|
|
835
|
-
onChange: changeAt,
|
|
836
|
-
width: WHEEL_SIZE,
|
|
837
|
-
children: /* @__PURE__ */ jsxs4(Svg, {
|
|
838
|
-
accessibilityLabel: "Color lightness",
|
|
839
|
-
height: 36,
|
|
840
|
-
width: WHEEL_SIZE,
|
|
841
|
-
children: [
|
|
842
|
-
/* @__PURE__ */ jsx8(Defs, {
|
|
843
|
-
children: /* @__PURE__ */ jsxs4(LinearGradient, {
|
|
844
|
-
id: "color-lightness",
|
|
845
|
-
x1: "0",
|
|
846
|
-
x2: "1",
|
|
847
|
-
y1: "0",
|
|
848
|
-
y2: "0",
|
|
849
|
-
children: [
|
|
850
|
-
/* @__PURE__ */ jsx8(Stop, {
|
|
851
|
-
offset: "0",
|
|
852
|
-
stopColor: resolveOklchColor({ chroma, lightness: 0 }, hue)
|
|
853
|
-
}),
|
|
854
|
-
/* @__PURE__ */ jsx8(Stop, {
|
|
855
|
-
offset: "1",
|
|
856
|
-
stopColor: resolveOklchColor({ chroma, lightness: 1 }, hue)
|
|
857
|
-
})
|
|
858
|
-
]
|
|
859
|
-
})
|
|
860
|
-
}),
|
|
861
|
-
/* @__PURE__ */ jsx8(Rect, {
|
|
862
|
-
fill: "url(#color-lightness)",
|
|
863
|
-
height: 10,
|
|
864
|
-
rx: 5,
|
|
865
|
-
y: 13,
|
|
866
|
-
width: WHEEL_SIZE
|
|
867
|
-
}),
|
|
868
|
-
/* @__PURE__ */ jsx8(Circle, {
|
|
869
|
-
cx: lightness * WHEEL_SIZE,
|
|
870
|
-
cy: 18,
|
|
871
|
-
fill: "white",
|
|
872
|
-
r: 10,
|
|
873
|
-
stroke: selectionBorderColor,
|
|
874
|
-
strokeWidth: 2
|
|
875
|
-
}),
|
|
876
|
-
/* @__PURE__ */ jsx8(Rect, {
|
|
877
|
-
fill: "transparent",
|
|
878
|
-
height: 36,
|
|
879
|
-
onResponderGrant: (event) => changeAt(event.nativeEvent.locationX),
|
|
880
|
-
onResponderMove: (event) => changeAt(event.nativeEvent.locationX),
|
|
881
|
-
onResponderRelease: (event) => changeAt(event.nativeEvent.locationX),
|
|
882
|
-
onStartShouldSetResponder: () => !disabled,
|
|
883
|
-
width: WHEEL_SIZE
|
|
884
|
-
})
|
|
885
|
-
]
|
|
886
|
-
})
|
|
887
|
-
})
|
|
888
|
-
]
|
|
889
|
-
});
|
|
890
|
-
}
|
|
891
|
-
function resolveWheelSegments() {
|
|
892
|
-
return Array.from({ length: WHEEL_SEGMENT_COUNT }, (_, index) => {
|
|
893
|
-
const hue = index * 360 / WHEEL_SEGMENT_COUNT;
|
|
894
|
-
return {
|
|
895
|
-
color: resolveOklchColor({ lightness: 0.65, chroma: WHEEL_MAX_CHROMA }, hue),
|
|
896
|
-
hue,
|
|
897
|
-
path: resolveSegmentPath(hue, hue + 360 / WHEEL_SEGMENT_COUNT)
|
|
898
|
-
};
|
|
899
|
-
});
|
|
900
|
-
}
|
|
901
|
-
function resolveSegmentPath(startHue, endHue) {
|
|
902
|
-
const start = resolveWheelPoint(startHue);
|
|
903
|
-
const end = resolveWheelPoint(endHue);
|
|
904
|
-
return `M ${WHEEL_CENTER} ${WHEEL_CENTER} L ${start.x} ${start.y} A ${WHEEL_RADIUS} ${WHEEL_RADIUS} 0 0 1 ${end.x} ${end.y} Z`;
|
|
905
|
-
}
|
|
906
|
-
function resolveWheelPoint(hue, radiusRatio = 1) {
|
|
907
|
-
const radians = (hue - 90) * Math.PI / 180;
|
|
908
|
-
return {
|
|
909
|
-
x: WHEEL_CENTER + WHEEL_RADIUS * radiusRatio * Math.cos(radians),
|
|
910
|
-
y: WHEEL_CENTER + WHEEL_RADIUS * radiusRatio * Math.sin(radians)
|
|
911
|
-
};
|
|
912
|
-
}
|
|
913
|
-
function resolveHarmonyLines(points, selectedPoint, stroke) {
|
|
914
|
-
return points.slice(1).reduce(({ lines, previous }, point) => ({
|
|
915
|
-
lines: [
|
|
916
|
-
...lines,
|
|
917
|
-
/* @__PURE__ */ jsx8(Line, {
|
|
918
|
-
stroke,
|
|
919
|
-
strokeWidth: 2,
|
|
920
|
-
x1: previous.x,
|
|
921
|
-
x2: point.x,
|
|
922
|
-
y1: previous.y,
|
|
923
|
-
y2: point.y
|
|
924
|
-
}, `${previous.x}-${previous.y}-${point.x}-${point.y}`)
|
|
925
|
-
],
|
|
926
|
-
previous: point
|
|
927
|
-
}), { lines: [], previous: points.at(0) ?? selectedPoint }).lines;
|
|
928
|
-
}
|
|
929
|
-
function resolveWheelLightness(color) {
|
|
930
|
-
const { lightness } = resolveWheelColorComponents(color);
|
|
931
|
-
return lightness;
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
// src/features/color/ColorPicker.tsx
|
|
935
|
-
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
936
|
-
var ColorPicker2 = withZoraThemeScope(ColorPickerInner);
|
|
937
|
-
function ColorPickerInner({
|
|
938
|
-
themeId: _themeId,
|
|
939
|
-
mode: _mode,
|
|
940
|
-
inverted: _inverted,
|
|
941
|
-
tabs,
|
|
942
|
-
value,
|
|
943
|
-
onValueChange,
|
|
944
|
-
onSelectionChange,
|
|
945
|
-
onDismiss,
|
|
946
|
-
hideTabListWhenSingle = true,
|
|
947
|
-
wheel,
|
|
948
|
-
tone,
|
|
949
|
-
hue,
|
|
950
|
-
testID
|
|
951
|
-
}) {
|
|
952
|
-
const { theme } = useZoraTheme2();
|
|
953
|
-
if (tabs.length === 0)
|
|
954
|
-
throw new Error("ColorPicker requires at least one tab.");
|
|
955
|
-
if (!tabs.includes(value.tab))
|
|
956
|
-
throw new Error("ColorPicker value must be configured in tabs.");
|
|
957
|
-
const previewColor = resolvePickerPreviewColor(value);
|
|
958
|
-
return /* @__PURE__ */ jsxs5(View2, {
|
|
959
|
-
alignSelf: "center",
|
|
960
|
-
bg: theme.semantics.surface.raised,
|
|
961
|
-
borderColor: theme.semantics.border.default,
|
|
962
|
-
borderWidth: 1,
|
|
963
|
-
flexShrink: 1,
|
|
964
|
-
gap: "s",
|
|
965
|
-
maxWidth: 400,
|
|
966
|
-
p: "m",
|
|
967
|
-
radius: "l",
|
|
968
|
-
testID,
|
|
969
|
-
width: "100%",
|
|
970
|
-
children: [
|
|
971
|
-
/* @__PURE__ */ jsxs5(View2, {
|
|
972
|
-
align: "center",
|
|
973
|
-
direction: "row",
|
|
974
|
-
justify: "space-between",
|
|
975
|
-
children: [
|
|
976
|
-
/* @__PURE__ */ jsx9(Text3, {
|
|
977
|
-
variant: "lead",
|
|
978
|
-
weight: "semiBold",
|
|
979
|
-
children: "Color"
|
|
980
|
-
}),
|
|
981
|
-
/* @__PURE__ */ jsxs5(View2, {
|
|
982
|
-
align: "center",
|
|
983
|
-
direction: "row",
|
|
984
|
-
gap: "s",
|
|
985
|
-
children: [
|
|
986
|
-
/* @__PURE__ */ jsx9(View2, {
|
|
987
|
-
bg: previewColor,
|
|
988
|
-
borderColor: theme.semantics.border.default,
|
|
989
|
-
borderWidth: 1,
|
|
990
|
-
height: 38,
|
|
991
|
-
radius: "s",
|
|
992
|
-
width: 38
|
|
993
|
-
}),
|
|
994
|
-
onDismiss ? /* @__PURE__ */ jsx9(IconButton2, {
|
|
995
|
-
iconName: "close",
|
|
996
|
-
label: "Close color picker",
|
|
997
|
-
onPress: onDismiss
|
|
998
|
-
}) : null
|
|
999
|
-
]
|
|
1000
|
-
})
|
|
1001
|
-
]
|
|
1002
|
-
}),
|
|
1003
|
-
/* @__PURE__ */ jsxs5(Tabs2, {
|
|
1004
|
-
defaultValue: value.tab,
|
|
1005
|
-
onValueChange: (nextValue) => {
|
|
1006
|
-
if (isColorPickerTab(nextValue) && tabs.includes(nextValue))
|
|
1007
|
-
onValueChange({ ...value, tab: nextValue });
|
|
1008
|
-
},
|
|
1009
|
-
testID: testID ? `${testID}-tabs` : undefined,
|
|
1010
|
-
value: value.tab,
|
|
1011
|
-
variant: "attached",
|
|
1012
|
-
children: [
|
|
1013
|
-
tabs.length > 1 || !hideTabListWhenSingle ? /* @__PURE__ */ jsx9(View2, {
|
|
1014
|
-
borderColor: theme.semantics.border.default,
|
|
1015
|
-
borderWidth: 1,
|
|
1016
|
-
overflow: "hidden",
|
|
1017
|
-
radius: "m",
|
|
1018
|
-
children: /* @__PURE__ */ jsx9(TabList2, {
|
|
1019
|
-
fill: true,
|
|
1020
|
-
children: tabs.map((tab) => /* @__PURE__ */ jsx9(Tab2, {
|
|
1021
|
-
label: tab,
|
|
1022
|
-
value: tab
|
|
1023
|
-
}, tab))
|
|
1024
|
-
})
|
|
1025
|
-
}) : null,
|
|
1026
|
-
tabs.map((tab) => /* @__PURE__ */ jsx9(TabPanel2, {
|
|
1027
|
-
value: tab,
|
|
1028
|
-
children: resolveTabContent(tab, value, wheel, tone, hue, onValueChange, onSelectionChange)
|
|
1029
|
-
}, tab))
|
|
1030
|
-
]
|
|
1031
|
-
})
|
|
1032
|
-
]
|
|
1033
|
-
});
|
|
1034
|
-
}
|
|
1035
|
-
function isColorPickerTab(value) {
|
|
1036
|
-
return value === "wheel" || value === "tone" || value === "hue";
|
|
1037
|
-
}
|
|
1038
|
-
function resolvePickerPreviewColor(value) {
|
|
1039
|
-
if (value.tab === "hue")
|
|
1040
|
-
return value.hue;
|
|
1041
|
-
if (value.tab === "tone")
|
|
1042
|
-
return value.tone?.colors.at(0) ?? value.wheel.color;
|
|
1043
|
-
return value.wheel.color;
|
|
1044
|
-
}
|
|
1045
|
-
function resolveTabContent(tab, value, wheel, tone, hue, onValueChange, onSelectionChange) {
|
|
1046
|
-
if (tab === "wheel")
|
|
1047
|
-
return wheel ? /* @__PURE__ */ jsx9(ColorWheel2, {
|
|
1048
|
-
...wheel,
|
|
1049
|
-
harmony: value.wheel.harmony,
|
|
1050
|
-
onChange: (next) => {
|
|
1051
|
-
onValueChange({ ...value, wheel: next });
|
|
1052
|
-
onSelectionChange?.({ mode: "wheel", value: next });
|
|
1053
|
-
},
|
|
1054
|
-
value: value.wheel.color
|
|
1055
|
-
}) : null;
|
|
1056
|
-
if (tab === "tone")
|
|
1057
|
-
return tone ? /* @__PURE__ */ jsx9(ColorTone2, {
|
|
1058
|
-
...tone,
|
|
1059
|
-
onChange: (next) => {
|
|
1060
|
-
onValueChange({ ...value, tone: next });
|
|
1061
|
-
onSelectionChange?.({ mode: "tone", value: next });
|
|
1062
|
-
},
|
|
1063
|
-
value: value.tone
|
|
1064
|
-
}) : null;
|
|
1065
|
-
return hue ? /* @__PURE__ */ jsx9(ColorHueScale2, {
|
|
1066
|
-
...hue,
|
|
1067
|
-
onChange: (next) => {
|
|
1068
|
-
onValueChange({ ...value, hue: next });
|
|
1069
|
-
onSelectionChange?.({ mode: "hue", value: next });
|
|
1070
|
-
},
|
|
1071
|
-
value: value.hue
|
|
1072
|
-
}) : null;
|
|
1073
|
-
}
|
|
1074
|
-
export { ColorHueScale2, ColorTone2, ColorWheel2, ColorPicker2 };
|