@flickfyi/flkr 0.0.182 → 0.0.185
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-client-CAg1b8Bh.js → api-client-nn4U_Vfn.js} +1 -1
- package/dist/{app-DpM5nhb9.js → app-COXGJhrt.js} +3 -3
- package/dist/{bundler-DNrDcqyk.js → bundler-CW4YC73e.js} +4 -2
- package/dist/cli.js +11 -11
- package/dist/{delegate-DcVye0KE.js → delegate-aUVluBjB.js} +2 -2
- package/dist/{generate-B1l1z_FZ.js → generate-BeL1QPDi.js} +1 -1
- package/dist/{preview-Dqn_Tq6K.js → preview-DTVM8Csb.js} +2 -2
- package/dist/{publish-BmDqO1xU.js → publish-BJG-s-w5.js} +4 -4
- package/dist/{pull-CO80DMn8.js → pull-B_Yfjpi2.js} +1 -1
- package/dist/{save-8crfOeo1.js → save-UrfgmK2-.js} +2 -2
- package/dist/{sdk-app-BXWrf_pf.js → sdk-app-BAxznAf9.js} +3 -3
- package/dist/{sdk-deploy-CaEonlvx.js → sdk-deploy-D1wgQxse.js} +3 -3
- package/dist/{sdk-generation-CF8ATbrL.js → sdk-generation-CLQ-QrVM.js} +1 -1
- package/dist/{sdk-project-CKV3U3u9.js → sdk-project-BaO0fqhW.js} +1 -1
- package/dist/{use-auth-B6nwU2rp.js → use-auth-CtM4_BAY.js} +1 -1
- package/node_modules/@flickfyi/biscuit/.turbo/turbo-build.log +4 -4
- package/node_modules/@flickfyi/core/README.md +19 -9
- package/node_modules/@flickfyi/core/dist/chunks/{default-CuxDsQoM.js → default-BTmKidHV.js} +1 -1
- package/node_modules/@flickfyi/core/dist/chunks/{default-BB6YexEH.cjs → default-JhTq5I_y.cjs} +1 -1
- package/node_modules/@flickfyi/core/dist/chunks/{define-CUJRqVKY.cjs → define-BKCRhpuY.cjs} +1 -1
- package/node_modules/@flickfyi/core/dist/chunks/{define-e_VqSs4M.js → define-DZXgUsy7.js} +5 -5
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.js +728 -549
- package/node_modules/@flickfyi/core/dist/kowalski/index.cjs +5 -5
- package/node_modules/@flickfyi/core/dist/kowalski/index.js +4297 -3700
- package/node_modules/@flickfyi/core/dist/kowalski/schemas.cjs +1 -0
- package/node_modules/@flickfyi/core/dist/kowalski/schemas.js +637 -0
- package/node_modules/@flickfyi/core/dist/kowalski-catalog.css +516 -0
- package/node_modules/@flickfyi/core/dist/kowalski.css +10 -0
- package/node_modules/@flickfyi/core/dist/themes/athletic/athletic.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/athletic/athletic.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/compact/compact.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/compact/compact.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/default/default.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/default/default.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/editorial/editorial.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/editorial/editorial.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/handwritten/handwritten.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/handwritten/handwritten.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/index.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/index.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/kids/kids.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/kids/kids.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/rounded/rounded.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/rounded/rounded.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/technical/technical.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/technical/technical.js +1 -1
- package/node_modules/@flickfyi/core/dist-types/hooks/use-feature-store/index.d.ts +43 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/calculations.d.ts +57 -3
- package/node_modules/@flickfyi/core/dist-types/kowalski/calculator.d.ts +7 -6
- package/node_modules/@flickfyi/core/dist-types/kowalski/catalog.d.cts +524 -809
- package/node_modules/@flickfyi/core/dist-types/kowalski/catalog.d.ts +524 -809
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/bill-split.d.ts +38 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/bookmark.d.ts +48 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/budget.d.ts +39 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/calculator.d.ts +62 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/checklist.d.ts +35 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/color-palette.d.ts +32 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/contact.d.ts +41 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/countdown.d.ts +34 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/event.d.ts +43 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/expense.d.ts +40 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/goal.d.ts +36 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/habit.d.ts +57 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/ledger.d.ts +43 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/note.d.ts +35 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/poll.d.ts +41 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/random-picker.d.ts +69 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/rating.d.ts +33 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/reminder.d.ts +48 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/rotation.d.ts +39 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/scoreboard.d.ts +37 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/shopping-list.d.ts +41 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/task-board.d.ts +39 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/time-zone.d.ts +34 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/timer.d.ts +43 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/trip.d.ts +61 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/unit-converter.d.ts +106 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/create-schemas.d.ts +6 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/date-time.d.ts +1 -1
- package/node_modules/@flickfyi/core/dist-types/kowalski/everyday.d.ts +28 -8
- package/node_modules/@flickfyi/core/dist-types/kowalski/feature-schema.d.ts +65 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/format.d.ts +4 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/fortune.d.ts +21 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/frame.d.ts +4 -4
- package/node_modules/@flickfyi/core/dist-types/kowalski/index.d.cts +31 -7
- package/node_modules/@flickfyi/core/dist-types/kowalski/index.d.ts +31 -7
- package/node_modules/@flickfyi/core/dist-types/kowalski/lesson.d.ts +89 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/recipe.d.ts +129 -8
- package/node_modules/@flickfyi/core/dist-types/kowalski/schemas.d.cts +4 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/schemas.d.ts +4 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/time-since.d.ts +34 -0
- package/node_modules/@flickfyi/core/examples/example-metadata.ts +19 -2
- package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.stories.tsx +25 -6
- package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.tsx +6 -12
- package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.stories.tsx +22 -5
- package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.stories.tsx +26 -5
- package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.tsx +6 -21
- package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.stories.tsx +18 -5
- package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.tsx +6 -19
- package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.stories.tsx +25 -5
- package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.tsx +6 -21
- package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.stories.tsx +19 -6
- package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.tsx +6 -17
- package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.stories.tsx +30 -5
- package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.stories.tsx +22 -5
- package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/event/event.stories.tsx +23 -5
- package/node_modules/@flickfyi/core/examples/kowalski/event/event.tsx +6 -19
- package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.stories.tsx +23 -5
- package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/fortune/fortune.stories.tsx +61 -0
- package/node_modules/@flickfyi/core/examples/kowalski/fortune/fortune.tsx +11 -0
- package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.stories.tsx +18 -5
- package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.tsx +3 -19
- package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.stories.tsx +22 -5
- package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.stories.tsx +25 -5
- package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.tsx +6 -20
- package/node_modules/@flickfyi/core/examples/kowalski/lesson/lesson.stories.tsx +99 -0
- package/node_modules/@flickfyi/core/examples/kowalski/lesson/lesson.tsx +11 -0
- package/node_modules/@flickfyi/core/examples/kowalski/note/note.stories.tsx +21 -5
- package/node_modules/@flickfyi/core/examples/kowalski/note/note.tsx +3 -17
- package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.stories.tsx +26 -5
- package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.tsx +3 -21
- package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.stories.tsx +37 -6
- package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.stories.tsx +18 -5
- package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.tsx +6 -14
- package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.stories.tsx +117 -5
- package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.tsx +6 -115
- package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.stories.tsx +22 -5
- package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.stories.tsx +26 -5
- package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.tsx +6 -22
- package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.stories.tsx +26 -5
- package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.tsx +6 -21
- package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.stories.tsx +28 -6
- package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.tsx +6 -22
- package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.stories.tsx +27 -6
- package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.tsx +6 -22
- package/node_modules/@flickfyi/core/examples/kowalski/time-since/time-since.stories.tsx +33 -0
- package/node_modules/@flickfyi/core/examples/kowalski/time-since/time-since.tsx +12 -0
- package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.stories.tsx +22 -6
- package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.tsx +6 -17
- package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.stories.tsx +18 -5
- package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.stories.tsx +25 -5
- package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.tsx +3 -21
- package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.stories.tsx +19 -6
- package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.tsx +6 -19
- package/node_modules/@flickfyi/core/examples/parrott/calculator/calculator.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/calculator/calculator.tsx +2 -13
- package/node_modules/@flickfyi/core/examples/parrott/checklist/checklist.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/checklist/checklist.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/countdown/countdown.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/countdown/countdown.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/counter/counter.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/counter/counter.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/fortune/fortune.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/fortune/fortune.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/grid/grid.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/grid/grid.tsx +4 -9
- package/node_modules/@flickfyi/core/examples/parrott/kale-smoothie/kale-smoothie.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/kale-smoothie/kale-smoothie.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/list/list.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/list/list.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/log/log.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/log/log.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/timed-task/timed-task.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/timed-task/timed-task.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/timer/timer.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/timer/timer.tsx +0 -8
- package/node_modules/@flickfyi/core/package.json +16 -3
- package/node_modules/@flickfyi/core/src/{kowalski/use-configured-feature.ts → hooks/use-configured-feature/index.ts} +1 -1
- package/node_modules/@flickfyi/core/src/{kowalski/use-feature-store.ts → hooks/use-feature-store/index.ts} +37 -12
- package/node_modules/@flickfyi/core/src/kowalski/README.md +13 -0
- package/node_modules/@flickfyi/core/src/kowalski/calculations.ts +36 -8
- package/node_modules/@flickfyi/core/src/kowalski/calculator.ts +15 -7
- package/node_modules/@flickfyi/core/src/kowalski/catalog.ts +110 -704
- package/node_modules/@flickfyi/core/src/kowalski/components/bill-split.tsx +284 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/bookmark.tsx +347 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/budget.tsx +169 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/calculator.tsx +202 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/checklist.tsx +119 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/color-palette.tsx +302 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/contact.tsx +247 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/countdown.tsx +173 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/event.tsx +260 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/expense.tsx +257 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/goal.tsx +182 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/habit.tsx +272 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/ledger.tsx +211 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/note.tsx +188 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/poll.tsx +242 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/random-picker.tsx +308 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/rating.tsx +112 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/reminder.tsx +298 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/rotation.tsx +146 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/scoreboard.tsx +139 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/shopping-list.tsx +144 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/task-board.tsx +146 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/time-zone.tsx +240 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/timer.tsx +225 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/trip.tsx +338 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/unit-converter.tsx +285 -0
- package/node_modules/@flickfyi/core/src/kowalski/create-schemas.ts +8 -0
- package/node_modules/@flickfyi/core/src/kowalski/date-time.tsx +1 -1
- package/node_modules/@flickfyi/core/src/kowalski/everyday.tsx +1 -640
- package/node_modules/@flickfyi/core/src/kowalski/feature-schema.ts +84 -0
- package/node_modules/@flickfyi/core/src/kowalski/format.ts +29 -3
- package/node_modules/@flickfyi/core/src/kowalski/fortune.tsx +67 -0
- package/node_modules/@flickfyi/core/src/kowalski/frame.tsx +5 -6
- package/node_modules/@flickfyi/core/src/kowalski/index.ts +31 -22
- package/node_modules/@flickfyi/core/src/kowalski/lesson.tsx +564 -0
- package/node_modules/@flickfyi/core/src/kowalski/recipe.tsx +78 -37
- package/node_modules/@flickfyi/core/src/kowalski/schemas.ts +67 -0
- package/node_modules/@flickfyi/core/src/kowalski/stories/composition.tsx +22 -20
- package/node_modules/@flickfyi/core/src/kowalski/time-since.tsx +145 -0
- package/node_modules/@flickfyi/core/src/molecules/progress/progress.tsx +4 -1
- package/node_modules/@flickfyi/core/src/oklch.ts +1 -6
- package/node_modules/@flickfyi/core/src/parrott/theme.ts +3 -1
- package/node_modules/@flickfyi/core/src/themes/editorial/editorial.ts +6 -1
- package/node_modules/@flickfyi/core/src/themes/palette.ts +5 -5
- package/node_modules/@flickfyi/core/src/themes/stories/composition.tsx +11 -9
- package/node_modules/@flickfyi/core/src/themes/stories/gallery.tsx +7 -11
- package/node_modules/@flickfyi/core/tsgo.bun.lock +7 -7
- package/node_modules/@flickfyi/core/tsgo.package.json +1 -1
- package/package.json +2 -2
- package/node_modules/@flickfyi/core/dist-types/kowalski/clocks.d.ts +0 -4
- package/node_modules/@flickfyi/core/dist-types/kowalski/details.d.ts +0 -7
- package/node_modules/@flickfyi/core/dist-types/kowalski/productivity.d.ts +0 -5
- package/node_modules/@flickfyi/core/dist-types/kowalski/tools.d.ts +0 -7
- package/node_modules/@flickfyi/core/dist-types/kowalski/use-feature-store.d.ts +0 -15
- package/node_modules/@flickfyi/core/src/kowalski/clocks.tsx +0 -464
- package/node_modules/@flickfyi/core/src/kowalski/details.tsx +0 -1387
- package/node_modules/@flickfyi/core/src/kowalski/productivity.tsx +0 -575
- package/node_modules/@flickfyi/core/src/kowalski/tools.tsx +0 -1213
- /package/node_modules/@flickfyi/core/dist-types/{kowalski/use-clock.d.ts → hooks/use-clock/index.d.ts} +0 -0
- /package/node_modules/@flickfyi/core/dist-types/{kowalski/use-configured-feature.d.ts → hooks/use-configured-feature/index.d.ts} +0 -0
- /package/node_modules/@flickfyi/core/src/{kowalski/use-clock.ts → hooks/use-clock/index.ts} +0 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { Flex, Icon, Text } from '@flickfyi/core'
|
|
2
|
+
import { Button, Input } from '@flickfyi/core/atoms'
|
|
3
|
+
import { Field } from '@flickfyi/core/molecules'
|
|
4
|
+
import * as stylex from '@stylexjs/stylex'
|
|
5
|
+
import { uniqBy } from 'lodash'
|
|
6
|
+
import { useEffect, useState } from 'react'
|
|
7
|
+
import { z } from 'zod/v4'
|
|
8
|
+
|
|
9
|
+
import { useConfiguredFeature } from '~/hooks/use-configured-feature'
|
|
10
|
+
import type { CreateSchemas } from '~/kowalski/create-schemas'
|
|
11
|
+
import { featureFields, replacement, store } from '~/kowalski/feature-schema'
|
|
12
|
+
import { format } from '~/kowalski/format'
|
|
13
|
+
import { FeatureAction, FeatureFrame, layout } from '~/kowalski/frame'
|
|
14
|
+
import { radius, size, space } from '~/themes/scale.stylex'
|
|
15
|
+
import { appearance, button, roles } from '~/themes/shared'
|
|
16
|
+
import { colors } from '~/themes/tokens.stylex'
|
|
17
|
+
|
|
18
|
+
const defaultId = 'KowalskiColorPalette'
|
|
19
|
+
const defaultScope = 'private'
|
|
20
|
+
|
|
21
|
+
export const ColorPaletteData = /* @__PURE__ */ z
|
|
22
|
+
.strictObject({
|
|
23
|
+
color: z
|
|
24
|
+
.string()
|
|
25
|
+
.describe('The starting color as a six-digit hex code, e.g. "#3366FF".'),
|
|
26
|
+
title: z.string().optional().describe('A short heading. Omit for "Palette".'),
|
|
27
|
+
})
|
|
28
|
+
.describe('Choose and retain an sRGB color and display matching shades.')
|
|
29
|
+
|
|
30
|
+
export type ColorPaletteData = z.infer<typeof ColorPaletteData>
|
|
31
|
+
|
|
32
|
+
export const ColorPaletteProps = z.strictObject({
|
|
33
|
+
data: ColorPaletteData,
|
|
34
|
+
...featureFields,
|
|
35
|
+
scope: featureFields.scope.default(defaultScope),
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
export type ColorPaletteProps = z.input<typeof ColorPaletteProps> & {
|
|
39
|
+
style?: stylex.StyleXArray<stylex.StyleXStyles>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const colorPaletteStoreSchema = store({
|
|
43
|
+
color: replacement(z.string().default('#6366f1')),
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
export const createSchemas: CreateSchemas = ({
|
|
47
|
+
id = defaultId,
|
|
48
|
+
scope = defaultScope,
|
|
49
|
+
} = {}) => ({
|
|
50
|
+
[`stores/${scope}/${id}`]: colorPaletteStoreSchema,
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
export function ColorPalette({
|
|
54
|
+
data,
|
|
55
|
+
id,
|
|
56
|
+
revision = 0,
|
|
57
|
+
scope = defaultScope,
|
|
58
|
+
style,
|
|
59
|
+
}: ColorPaletteProps) {
|
|
60
|
+
const schema = colorPaletteStoreSchema
|
|
61
|
+
const store = useConfiguredFeature({
|
|
62
|
+
name: id ?? defaultId,
|
|
63
|
+
revision,
|
|
64
|
+
schema,
|
|
65
|
+
scope,
|
|
66
|
+
seed: schema.parse({
|
|
67
|
+
color: { value: isHexColor(data.color) ? data.color : '#6366f1' },
|
|
68
|
+
}),
|
|
69
|
+
})
|
|
70
|
+
const color = isHexColor(store.value.color.value) ? store.value.color.value : '#6366f1'
|
|
71
|
+
const [hexDraft, setHexDraft] = useState<string | null>(null)
|
|
72
|
+
const [paletteBase, setPaletteBase] = useState(color.toLowerCase())
|
|
73
|
+
const editing = hexDraft !== null
|
|
74
|
+
const draftColor = `#${hexDraft ?? ''}`
|
|
75
|
+
const validDraft = isHexColor(draftColor)
|
|
76
|
+
const editDisabled = !store.ready || store.saving || (editing && !validDraft)
|
|
77
|
+
const shadesDisabled = !store.ready || editing
|
|
78
|
+
const shades = uniqBy(
|
|
79
|
+
[
|
|
80
|
+
{ label: 'Darker', mix: -0.6 },
|
|
81
|
+
{ label: 'Dark', mix: -0.3 },
|
|
82
|
+
{ label: 'Base', mix: 0 },
|
|
83
|
+
{ label: 'Light', mix: 0.3 },
|
|
84
|
+
{ label: 'Lighter', mix: 0.6 },
|
|
85
|
+
].map(shade => {
|
|
86
|
+
const value = mixColor(paletteBase, shade.mix)
|
|
87
|
+
return { color: value, label: value === paletteBase ? 'Base' : shade.label }
|
|
88
|
+
}),
|
|
89
|
+
'color'
|
|
90
|
+
)
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (
|
|
93
|
+
!editing &&
|
|
94
|
+
!store.saving &&
|
|
95
|
+
![-0.6, -0.3, 0, 0.3, 0.6].some(
|
|
96
|
+
mix => mixColor(paletteBase, mix) === color.toLowerCase()
|
|
97
|
+
)
|
|
98
|
+
) {
|
|
99
|
+
setPaletteBase(color.toLowerCase())
|
|
100
|
+
}
|
|
101
|
+
}, [color, editing, paletteBase, store.saving])
|
|
102
|
+
const channels = [1, 3, 5].map(index =>
|
|
103
|
+
Number.parseInt(color.slice(index, index + 2), 16)
|
|
104
|
+
)
|
|
105
|
+
return (
|
|
106
|
+
<FeatureFrame
|
|
107
|
+
style={style}
|
|
108
|
+
onRetry={store.retry}
|
|
109
|
+
notice={store.error}
|
|
110
|
+
component="colorPalette"
|
|
111
|
+
title={data.title ?? 'Palette'}
|
|
112
|
+
>
|
|
113
|
+
<Flex {...stylex.props(colorStyles.specimen)}>
|
|
114
|
+
<Flex {...stylex.props(appearance.surface, colorStyles.preview(color))} />
|
|
115
|
+
<Flex {...stylex.props(colorStyles.identity)}>
|
|
116
|
+
<Flex {...stylex.props(colorStyles.value)}>
|
|
117
|
+
<Text {...stylex.props(roles.h2)}>{color.toUpperCase()}</Text>
|
|
118
|
+
<Text {...stylex.props(roles.muted)}>
|
|
119
|
+
{`RGB (${channels.map(channel => format.formatNumber(channel)).join(', ')})`}
|
|
120
|
+
</Text>
|
|
121
|
+
</Flex>
|
|
122
|
+
</Flex>
|
|
123
|
+
</Flex>
|
|
124
|
+
<Field label="Shades & tints">
|
|
125
|
+
<Flex {...stylex.props(colorStyles.swatches(shades.length))}>
|
|
126
|
+
{shades.map(shade => {
|
|
127
|
+
const selected = shade.color === color.toLowerCase()
|
|
128
|
+
return (
|
|
129
|
+
<Button
|
|
130
|
+
key={shade.color}
|
|
131
|
+
selected={selected}
|
|
132
|
+
disabled={shadesDisabled}
|
|
133
|
+
onClick={() => {
|
|
134
|
+
if (!shadesDisabled) {
|
|
135
|
+
store.set(() => ({ color: { value: shade.color } }))
|
|
136
|
+
}
|
|
137
|
+
}}
|
|
138
|
+
style={[
|
|
139
|
+
button.secondary,
|
|
140
|
+
colorStyles.swatchButton,
|
|
141
|
+
shadesDisabled && button.disabled,
|
|
142
|
+
]}
|
|
143
|
+
>
|
|
144
|
+
<Flex {...stylex.props(colorStyles.swatchContent)}>
|
|
145
|
+
<Flex
|
|
146
|
+
{...stylex.props(appearance.surface, colorStyles.swatch(shade.color))}
|
|
147
|
+
>
|
|
148
|
+
{selected && (
|
|
149
|
+
<Flex {...stylex.props(colorStyles.selected)}>
|
|
150
|
+
<Icon name="checkmark" />
|
|
151
|
+
</Flex>
|
|
152
|
+
)}
|
|
153
|
+
</Flex>
|
|
154
|
+
<Text {...stylex.props(roles.label, colorStyles.centered)}>
|
|
155
|
+
{shade.label}
|
|
156
|
+
</Text>
|
|
157
|
+
<Text {...stylex.props(roles.muted, colorStyles.centered)}>
|
|
158
|
+
{shade.color.toUpperCase()}
|
|
159
|
+
</Text>
|
|
160
|
+
</Flex>
|
|
161
|
+
</Button>
|
|
162
|
+
)
|
|
163
|
+
})}
|
|
164
|
+
</Flex>
|
|
165
|
+
{(store.saving || (!store.ready && !store.error) || editing) && (
|
|
166
|
+
<Text {...stylex.props(roles.muted)}>
|
|
167
|
+
{store.saving
|
|
168
|
+
? 'Saving color…'
|
|
169
|
+
: editing
|
|
170
|
+
? 'Finish editing to choose a shade.'
|
|
171
|
+
: 'Loading saved color…'}
|
|
172
|
+
</Text>
|
|
173
|
+
)}
|
|
174
|
+
</Field>
|
|
175
|
+
{editing && (
|
|
176
|
+
<Field
|
|
177
|
+
error={!validDraft && 'Enter six digits using 0–9 and A–F.'}
|
|
178
|
+
label="Hex color"
|
|
179
|
+
>
|
|
180
|
+
<Flex {...stylex.props(colorStyles.inputRow)}>
|
|
181
|
+
<Text {...stylex.props(roles.h2, colorStyles.prefix)}>#</Text>
|
|
182
|
+
{store.ready && !store.saving ? (
|
|
183
|
+
<Input
|
|
184
|
+
placeholder="Hex color"
|
|
185
|
+
value={hexDraft}
|
|
186
|
+
onChange={value => setHexDraft(value.replace(/^#/, '').toUpperCase())}
|
|
187
|
+
style={[colorStyles.input]}
|
|
188
|
+
/>
|
|
189
|
+
) : (
|
|
190
|
+
<Text {...stylex.props(roles.text, colorStyles.input)}>{hexDraft}</Text>
|
|
191
|
+
)}
|
|
192
|
+
</Flex>
|
|
193
|
+
</Field>
|
|
194
|
+
)}
|
|
195
|
+
<Flex {...stylex.props(layout.actions)}>
|
|
196
|
+
{editing && (
|
|
197
|
+
<FeatureAction
|
|
198
|
+
component="colorPalette"
|
|
199
|
+
disabled={store.saving}
|
|
200
|
+
onClick={() => setHexDraft(null)}
|
|
201
|
+
>
|
|
202
|
+
Cancel
|
|
203
|
+
</FeatureAction>
|
|
204
|
+
)}
|
|
205
|
+
<FeatureAction
|
|
206
|
+
component="colorPalette"
|
|
207
|
+
disabled={editDisabled}
|
|
208
|
+
variant={editing ? 'primary' : 'secondary'}
|
|
209
|
+
onClick={() => {
|
|
210
|
+
if (editDisabled) {
|
|
211
|
+
return
|
|
212
|
+
}
|
|
213
|
+
if (!editing) {
|
|
214
|
+
setHexDraft(color.slice(1).toUpperCase())
|
|
215
|
+
} else if (draftColor.toLowerCase() === color.toLowerCase()) {
|
|
216
|
+
setHexDraft(null)
|
|
217
|
+
} else {
|
|
218
|
+
store.set(
|
|
219
|
+
() => ({ color: { value: draftColor } }),
|
|
220
|
+
() => {
|
|
221
|
+
setPaletteBase(draftColor.toLowerCase())
|
|
222
|
+
setHexDraft(null)
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
}}
|
|
227
|
+
>
|
|
228
|
+
{store.saving && editing ? 'Saving…' : editing ? 'Done' : 'Edit hex'}
|
|
229
|
+
</FeatureAction>
|
|
230
|
+
</Flex>
|
|
231
|
+
</FeatureFrame>
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const colorStyles = /* @__PURE__ */ stylex.create({
|
|
236
|
+
centered: { textAlign: 'center' },
|
|
237
|
+
identity: {
|
|
238
|
+
alignItems: 'center',
|
|
239
|
+
flexDirection: 'row',
|
|
240
|
+
flexWrap: 'wrap',
|
|
241
|
+
gap: space[3],
|
|
242
|
+
justifyContent: 'space-between',
|
|
243
|
+
},
|
|
244
|
+
input: { flexGrow: 1, minWidth: 0 },
|
|
245
|
+
inputRow: { alignItems: 'center', flexDirection: 'row', gap: space[2] },
|
|
246
|
+
prefix: { flexShrink: 0 },
|
|
247
|
+
preview: (color: string) => ({
|
|
248
|
+
backgroundColor: color,
|
|
249
|
+
borderRadius: radius['xl'],
|
|
250
|
+
height: space[24],
|
|
251
|
+
}),
|
|
252
|
+
selected: {
|
|
253
|
+
alignItems: 'center',
|
|
254
|
+
backgroundColor: colors.accent,
|
|
255
|
+
borderRadius: radius['xl'],
|
|
256
|
+
color: colors.onAccent,
|
|
257
|
+
height: size[6],
|
|
258
|
+
justifyContent: 'center',
|
|
259
|
+
width: size[6],
|
|
260
|
+
},
|
|
261
|
+
specimen: { gap: space[4] },
|
|
262
|
+
swatch: (color: string) => ({
|
|
263
|
+
alignItems: 'center',
|
|
264
|
+
backgroundColor: color,
|
|
265
|
+
borderRadius: radius['lg'],
|
|
266
|
+
height: size[16],
|
|
267
|
+
justifyContent: 'center',
|
|
268
|
+
}),
|
|
269
|
+
swatchButton: {
|
|
270
|
+
alignItems: 'stretch',
|
|
271
|
+
minWidth: 0,
|
|
272
|
+
paddingBottom: space[2],
|
|
273
|
+
paddingLeft: space[1],
|
|
274
|
+
paddingRight: space[1],
|
|
275
|
+
paddingTop: space[1],
|
|
276
|
+
},
|
|
277
|
+
swatchContent: { alignItems: 'stretch', gap: space[1.5] },
|
|
278
|
+
swatches: (count: number) => ({
|
|
279
|
+
display: 'grid',
|
|
280
|
+
gap: space[2],
|
|
281
|
+
gridTemplateColumns: `repeat(${Math.min(count, 3)}, minmax(0, 1fr))`,
|
|
282
|
+
}),
|
|
283
|
+
value: { gap: space[1], minWidth: 0 },
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
function mixColor(hex: string, amount: number) {
|
|
287
|
+
const target = amount < 0 ? 0 : 255
|
|
288
|
+
return `#${[1, 3, 5]
|
|
289
|
+
.map(index =>
|
|
290
|
+
Math.round(
|
|
291
|
+
Number.parseInt(hex.slice(index, index + 2), 16) * (1 - Math.abs(amount)) +
|
|
292
|
+
target * Math.abs(amount)
|
|
293
|
+
)
|
|
294
|
+
.toString(16)
|
|
295
|
+
.padStart(2, '0')
|
|
296
|
+
)
|
|
297
|
+
.join('')}`
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function isHexColor(value: string) {
|
|
301
|
+
return /^#[\da-fA-F]{6}$/.test(value)
|
|
302
|
+
}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { Flex, Icon, Text } from '@flickfyi/core'
|
|
2
|
+
import { Button as NativeButton, Input } from '@flickfyi/core/atoms'
|
|
3
|
+
import { List } from '@flickfyi/core/molecules'
|
|
4
|
+
import { Person } from '@flickfyi/schemas/person'
|
|
5
|
+
import * as stylex from '@stylexjs/stylex'
|
|
6
|
+
import { useState } from 'react'
|
|
7
|
+
import isEmail from 'validator/lib/isEmail.js'
|
|
8
|
+
import { z } from 'zod/v4'
|
|
9
|
+
|
|
10
|
+
import { useConfiguredFeature } from '~/hooks/use-configured-feature'
|
|
11
|
+
import type { CreateSchemas } from '~/kowalski/create-schemas'
|
|
12
|
+
import { featureFields, replacement, store } from '~/kowalski/feature-schema'
|
|
13
|
+
import {
|
|
14
|
+
FeatureAction,
|
|
15
|
+
FeatureEdit,
|
|
16
|
+
FeatureFacts,
|
|
17
|
+
FeatureFrame,
|
|
18
|
+
layout,
|
|
19
|
+
} from '~/kowalski/frame'
|
|
20
|
+
import { space, text } from '~/themes/scale.stylex'
|
|
21
|
+
import { button, roles } from '~/themes/shared'
|
|
22
|
+
|
|
23
|
+
const defaultId = 'KowalskiContact'
|
|
24
|
+
const defaultScope = 'private'
|
|
25
|
+
|
|
26
|
+
export const ContactData = Person
|
|
27
|
+
|
|
28
|
+
export type ContactData = Person
|
|
29
|
+
|
|
30
|
+
export const ContactProps = z.strictObject({
|
|
31
|
+
data: ContactData,
|
|
32
|
+
...featureFields,
|
|
33
|
+
scope: featureFields.scope.default(defaultScope),
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
export type ContactProps = z.input<typeof ContactProps> & {
|
|
37
|
+
style?: stylex.StyleXArray<stylex.StyleXStyles>
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const contactStoreSchema = store({
|
|
41
|
+
email: replacement(z.string().nullable().default(null)),
|
|
42
|
+
name: replacement(z.string().default('')),
|
|
43
|
+
phone: replacement(z.string().nullable().default(null)),
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
export const createSchemas: CreateSchemas = ({
|
|
47
|
+
id = defaultId,
|
|
48
|
+
scope = defaultScope,
|
|
49
|
+
} = {}) => ({
|
|
50
|
+
[`stores/${scope}/${id}`]: contactStoreSchema,
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
export function Contact({
|
|
54
|
+
data,
|
|
55
|
+
id,
|
|
56
|
+
revision = 0,
|
|
57
|
+
scope = defaultScope,
|
|
58
|
+
style,
|
|
59
|
+
}: ContactProps) {
|
|
60
|
+
const schema = contactStoreSchema
|
|
61
|
+
const store = useConfiguredFeature({
|
|
62
|
+
name: id ?? defaultId,
|
|
63
|
+
revision,
|
|
64
|
+
schema,
|
|
65
|
+
scope,
|
|
66
|
+
seed: schema.parse({
|
|
67
|
+
email: { value: data.email ?? null },
|
|
68
|
+
name: { value: data.name },
|
|
69
|
+
phone: { value: data.phone ?? null },
|
|
70
|
+
}),
|
|
71
|
+
})
|
|
72
|
+
const [draft, setDraft] = useState({ email: '', name: '', phone: '' })
|
|
73
|
+
const [baseline, setBaseline] = useState<typeof draft | null>(null)
|
|
74
|
+
const editing = baseline !== null
|
|
75
|
+
const name = store.value.name.value.trim() ? store.value.name.value : 'Unnamed contact'
|
|
76
|
+
const fields = [
|
|
77
|
+
{
|
|
78
|
+
key: 'name',
|
|
79
|
+
label: 'Name',
|
|
80
|
+
valid: draft.name.trim().length > 0,
|
|
81
|
+
validation: 'Add a name.',
|
|
82
|
+
},
|
|
83
|
+
{ key: 'phone', label: 'Phone', valid: true, validation: '' },
|
|
84
|
+
{
|
|
85
|
+
key: 'email',
|
|
86
|
+
label: 'Email',
|
|
87
|
+
valid: draft.email === '' || isEmail(draft.email),
|
|
88
|
+
validation: 'Enter a valid email address.',
|
|
89
|
+
},
|
|
90
|
+
] as const
|
|
91
|
+
const changed =
|
|
92
|
+
baseline &&
|
|
93
|
+
(draft.email !== baseline.email ||
|
|
94
|
+
draft.name !== baseline.name ||
|
|
95
|
+
draft.phone !== baseline.phone)
|
|
96
|
+
return (
|
|
97
|
+
<FeatureFrame
|
|
98
|
+
style={style}
|
|
99
|
+
onRetry={store.retry}
|
|
100
|
+
notice={store.error}
|
|
101
|
+
component="contact"
|
|
102
|
+
title={name}
|
|
103
|
+
trailing={
|
|
104
|
+
!editing && (
|
|
105
|
+
<FeatureEdit
|
|
106
|
+
disabled={!store.ready || store.saving}
|
|
107
|
+
label="Edit contact"
|
|
108
|
+
onClick={() => {
|
|
109
|
+
const values = {
|
|
110
|
+
email: store.value.email.value ?? '',
|
|
111
|
+
name: store.value.name.value,
|
|
112
|
+
phone: store.value.phone.value ?? '',
|
|
113
|
+
}
|
|
114
|
+
setBaseline(values)
|
|
115
|
+
setDraft(values)
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
>
|
|
121
|
+
{editing && !store.saving ? (
|
|
122
|
+
<Flex {...stylex.props(contactStyles.editor)}>
|
|
123
|
+
{fields.map(field => (
|
|
124
|
+
<Flex key={field.key} {...stylex.props(layout.field)}>
|
|
125
|
+
<Flex {...stylex.props(contactStyles.fieldLabel)}>
|
|
126
|
+
<Text {...stylex.props(roles.label, layout.fieldLabel)}>
|
|
127
|
+
{field.label}
|
|
128
|
+
</Text>
|
|
129
|
+
{field.key !== 'name' && (
|
|
130
|
+
<Text {...stylex.props(roles.muted, contactStyles.optional)}>
|
|
131
|
+
Optional
|
|
132
|
+
</Text>
|
|
133
|
+
)}
|
|
134
|
+
</Flex>
|
|
135
|
+
<Input
|
|
136
|
+
placeholder={field.label}
|
|
137
|
+
value={draft[field.key]}
|
|
138
|
+
onChange={value =>
|
|
139
|
+
setDraft(current => ({ ...current, [field.key]: value }))
|
|
140
|
+
}
|
|
141
|
+
style={[layout.input]}
|
|
142
|
+
/>
|
|
143
|
+
{!field.valid && (
|
|
144
|
+
<Text {...stylex.props(roles.muted)}>{field.validation}</Text>
|
|
145
|
+
)}
|
|
146
|
+
</Flex>
|
|
147
|
+
))}
|
|
148
|
+
<Flex {...stylex.props(layout.actions)}>
|
|
149
|
+
<FeatureAction component="contact" onClick={() => setBaseline(null)}>
|
|
150
|
+
Cancel
|
|
151
|
+
</FeatureAction>
|
|
152
|
+
<FeatureAction
|
|
153
|
+
component="contact"
|
|
154
|
+
disabled={
|
|
155
|
+
store.saving ||
|
|
156
|
+
!store.ready ||
|
|
157
|
+
!changed ||
|
|
158
|
+
fields.some(field => !field.valid)
|
|
159
|
+
}
|
|
160
|
+
variant="primary"
|
|
161
|
+
onClick={() => {
|
|
162
|
+
if (!baseline || !changed || fields.some(field => !field.valid)) {
|
|
163
|
+
return
|
|
164
|
+
}
|
|
165
|
+
store.set(
|
|
166
|
+
current => ({
|
|
167
|
+
...(draft.email !== baseline.email &&
|
|
168
|
+
draft.email !== (current.email.value ?? '') && {
|
|
169
|
+
email: { value: draft.email || null },
|
|
170
|
+
}),
|
|
171
|
+
...(draft.name !== baseline.name &&
|
|
172
|
+
draft.name !== current.name.value && {
|
|
173
|
+
name: { value: draft.name },
|
|
174
|
+
}),
|
|
175
|
+
...(draft.phone !== baseline.phone &&
|
|
176
|
+
draft.phone !== (current.phone.value ?? '') && {
|
|
177
|
+
phone: { value: draft.phone || null },
|
|
178
|
+
}),
|
|
179
|
+
}),
|
|
180
|
+
() => setBaseline(null)
|
|
181
|
+
)
|
|
182
|
+
}}
|
|
183
|
+
>
|
|
184
|
+
Save changes
|
|
185
|
+
</FeatureAction>
|
|
186
|
+
</Flex>
|
|
187
|
+
</Flex>
|
|
188
|
+
) : (
|
|
189
|
+
<>
|
|
190
|
+
{store.saving ? (
|
|
191
|
+
<Text {...stylex.props(roles.muted)}>Saving changes…</Text>
|
|
192
|
+
) : !store.ready && !store.error ? (
|
|
193
|
+
<Text {...stylex.props(roles.muted)}>Loading contact…</Text>
|
|
194
|
+
) : null}
|
|
195
|
+
<FeatureFacts>
|
|
196
|
+
<List.Item
|
|
197
|
+
label="Phone"
|
|
198
|
+
trailing={store.value.phone.value ?? 'No phone number'}
|
|
199
|
+
/>
|
|
200
|
+
<List.Item
|
|
201
|
+
label="Email"
|
|
202
|
+
trailing={store.value.email.value ?? 'No email address'}
|
|
203
|
+
/>
|
|
204
|
+
</FeatureFacts>
|
|
205
|
+
<Flex {...stylex.props(layout.actions)}>
|
|
206
|
+
{(
|
|
207
|
+
[
|
|
208
|
+
{ address: store.value.phone.value, icon: 'phone', verb: 'Call' },
|
|
209
|
+
{ address: store.value.email.value, icon: 'envelope', verb: 'Email' },
|
|
210
|
+
] as const
|
|
211
|
+
).map(
|
|
212
|
+
field =>
|
|
213
|
+
field.address !== null && (
|
|
214
|
+
<NativeButton
|
|
215
|
+
accessibilityLabel={`${field.verb} ${name}`}
|
|
216
|
+
disabled={!store.ready || store.saving}
|
|
217
|
+
href={
|
|
218
|
+
field.verb === 'Call'
|
|
219
|
+
? `tel:${encodeURIComponent(field.address.replaceAll(/[()\s.-]/g, ''))}`
|
|
220
|
+
: `mailto:${encodeURIComponent(field.address)}`
|
|
221
|
+
}
|
|
222
|
+
key={field.verb}
|
|
223
|
+
style={[button.secondary, button.lg, layout.action]}
|
|
224
|
+
>
|
|
225
|
+
<Flex {...stylex.props(layout.actionContent)}>
|
|
226
|
+
<Icon name={field.icon} />
|
|
227
|
+
<Text>{field.verb}</Text>
|
|
228
|
+
</Flex>
|
|
229
|
+
</NativeButton>
|
|
230
|
+
)
|
|
231
|
+
)}
|
|
232
|
+
</Flex>
|
|
233
|
+
</>
|
|
234
|
+
)}
|
|
235
|
+
</FeatureFrame>
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const contactStyles = /* @__PURE__ */ stylex.create({
|
|
240
|
+
editor: { gap: space[5] },
|
|
241
|
+
fieldLabel: {
|
|
242
|
+
alignItems: 'center',
|
|
243
|
+
flexDirection: 'row',
|
|
244
|
+
justifyContent: 'space-between',
|
|
245
|
+
},
|
|
246
|
+
optional: { fontSize: text['xs'] },
|
|
247
|
+
})
|