@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,308 @@
|
|
|
1
|
+
import { Flex, Icon, Text } from '@flickfyi/core'
|
|
2
|
+
import { Button } from '@flickfyi/core/atoms'
|
|
3
|
+
import { Field, List } from '@flickfyi/core/molecules'
|
|
4
|
+
import * as stylex from '@stylexjs/stylex'
|
|
5
|
+
import { isEqual } from 'lodash'
|
|
6
|
+
import { useEffect, useMemo, useState } from 'react'
|
|
7
|
+
import { z } from 'zod/v4'
|
|
8
|
+
|
|
9
|
+
import { useConfiguredFeature } from '~/hooks/use-configured-feature'
|
|
10
|
+
import { pickResult } from '~/kowalski/calculations'
|
|
11
|
+
import type { CreateSchemas } from '~/kowalski/create-schemas'
|
|
12
|
+
import { featureFields, store } from '~/kowalski/feature-schema'
|
|
13
|
+
import { format } from '~/kowalski/format'
|
|
14
|
+
import { FeatureAction, FeatureFacts, FeatureFrame, FeatureWell } from '~/kowalski/frame'
|
|
15
|
+
import { radius, space, text } from '~/themes/scale.stylex'
|
|
16
|
+
import { appearance, button, roles } from '~/themes/shared'
|
|
17
|
+
import { font } from '~/themes/tokens.stylex'
|
|
18
|
+
|
|
19
|
+
const defaultId = 'KowalskiRandomPicker'
|
|
20
|
+
const defaultScope = 'private'
|
|
21
|
+
|
|
22
|
+
export const RandomPickerData = /* @__PURE__ */ z
|
|
23
|
+
.discriminatedUnion('mode', [
|
|
24
|
+
z.strictObject({
|
|
25
|
+
mode: z.literal('coin'),
|
|
26
|
+
title: z.string().optional().describe('A short heading. Omit for "Pick one".'),
|
|
27
|
+
}),
|
|
28
|
+
z.strictObject({
|
|
29
|
+
mode: z.literal('dice'),
|
|
30
|
+
title: z.string().optional().describe('A short heading. Omit for "Pick one".'),
|
|
31
|
+
}),
|
|
32
|
+
z.strictObject({
|
|
33
|
+
maximum: z.number().describe('The largest whole number that can be picked.'),
|
|
34
|
+
minimum: z.number().describe('The smallest whole number that can be picked.'),
|
|
35
|
+
mode: z.literal('range'),
|
|
36
|
+
title: z.string().optional().describe('A short heading. Omit for "Pick one".'),
|
|
37
|
+
}),
|
|
38
|
+
z.strictObject({
|
|
39
|
+
mode: z.literal('list'),
|
|
40
|
+
options: z.array(z.string()).describe('The choices to pick from.'),
|
|
41
|
+
title: z.string().optional().describe('A short heading. Omit for "Pick one".'),
|
|
42
|
+
}),
|
|
43
|
+
])
|
|
44
|
+
.describe(
|
|
45
|
+
'Flip a coin, roll a die, or pick from a whole-number range or list. Retains the last result.'
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
export type RandomPickerData = z.infer<typeof RandomPickerData>
|
|
49
|
+
|
|
50
|
+
export const RandomPickerProps = z.strictObject({
|
|
51
|
+
data: RandomPickerData,
|
|
52
|
+
...featureFields,
|
|
53
|
+
scope: featureFields.scope.default(defaultScope),
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
export type RandomPickerProps = z.input<typeof RandomPickerProps> & {
|
|
57
|
+
style?: stylex.StyleXArray<stylex.StyleXStyles>
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const randomPickerStoreSchema = store({
|
|
61
|
+
result: z
|
|
62
|
+
.strictObject({
|
|
63
|
+
domain: pickerDomain(),
|
|
64
|
+
value: z.union([z.number(), z.string()]),
|
|
65
|
+
})
|
|
66
|
+
.nullable()
|
|
67
|
+
.default(null),
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
export const createSchemas: CreateSchemas = ({
|
|
71
|
+
id = defaultId,
|
|
72
|
+
scope = defaultScope,
|
|
73
|
+
} = {}) => ({
|
|
74
|
+
[`stores/${scope}/${id}`]: randomPickerStoreSchema,
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
export function RandomPicker({
|
|
78
|
+
data,
|
|
79
|
+
id,
|
|
80
|
+
revision = 0,
|
|
81
|
+
scope = defaultScope,
|
|
82
|
+
style,
|
|
83
|
+
}: RandomPickerProps) {
|
|
84
|
+
const schema = randomPickerStoreSchema
|
|
85
|
+
const name = id ?? defaultId
|
|
86
|
+
const [poolExpanded, setPoolExpanded] = useState(false)
|
|
87
|
+
const store = useConfiguredFeature({
|
|
88
|
+
name,
|
|
89
|
+
revision,
|
|
90
|
+
schema,
|
|
91
|
+
scope,
|
|
92
|
+
seed: schema.parse({}),
|
|
93
|
+
})
|
|
94
|
+
const domain: PickerDomain =
|
|
95
|
+
data.mode === 'list'
|
|
96
|
+
? { mode: data.mode, options: data.options }
|
|
97
|
+
: data.mode === 'range'
|
|
98
|
+
? {
|
|
99
|
+
// Authored bounds are unvalidated; pick between whole numbers in either order.
|
|
100
|
+
maximum: Math.round(Math.max(data.minimum, data.maximum)),
|
|
101
|
+
minimum: Math.round(Math.min(data.minimum, data.maximum)),
|
|
102
|
+
mode: data.mode,
|
|
103
|
+
}
|
|
104
|
+
: { mode: data.mode }
|
|
105
|
+
// A stable key for the effect below; the saved domain itself stays structured.
|
|
106
|
+
const domainKey = JSON.stringify(domain)
|
|
107
|
+
const numbers = format.formatters.getNumberFormat(format.locale)
|
|
108
|
+
const detail =
|
|
109
|
+
data.mode === 'range'
|
|
110
|
+
? `${numbers.format(domain.mode === 'range' ? domain.minimum : 0)} to ${numbers.format(domain.mode === 'range' ? domain.maximum : 0)}, inclusive`
|
|
111
|
+
: undefined
|
|
112
|
+
const { ready, set, value } = store
|
|
113
|
+
const result =
|
|
114
|
+
value.result && isEqual(value.result.domain, domain) ? value.result.value : null
|
|
115
|
+
const resultDisplay = typeof result === 'number' ? numbers.format(result) : result
|
|
116
|
+
const resultLabel =
|
|
117
|
+
data.mode === 'dice'
|
|
118
|
+
? 'You rolled'
|
|
119
|
+
: data.mode === 'coin'
|
|
120
|
+
? 'It landed on'
|
|
121
|
+
: 'Your pick'
|
|
122
|
+
const attemptedReset = useMemo<{ key?: string }>(() => ({}), [name, scope])
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
const key = JSON.stringify([domainKey, revision, value.result])
|
|
125
|
+
if (
|
|
126
|
+
ready &&
|
|
127
|
+
attemptedReset.key !== key &&
|
|
128
|
+
revision >= value.configurationRevision &&
|
|
129
|
+
value.result &&
|
|
130
|
+
JSON.stringify(value.result.domain) !== domainKey
|
|
131
|
+
) {
|
|
132
|
+
attemptedReset.key = key
|
|
133
|
+
set({ result: null })
|
|
134
|
+
}
|
|
135
|
+
}, [
|
|
136
|
+
attemptedReset,
|
|
137
|
+
revision,
|
|
138
|
+
domainKey,
|
|
139
|
+
ready,
|
|
140
|
+
set,
|
|
141
|
+
value.configurationRevision,
|
|
142
|
+
value.result,
|
|
143
|
+
])
|
|
144
|
+
return (
|
|
145
|
+
<FeatureFrame
|
|
146
|
+
style={style}
|
|
147
|
+
onRetry={store.retry}
|
|
148
|
+
notice={store.error}
|
|
149
|
+
component="randomPicker"
|
|
150
|
+
title={data.title ?? 'Pick one'}
|
|
151
|
+
detail={detail}
|
|
152
|
+
>
|
|
153
|
+
{data.mode === 'list' && (
|
|
154
|
+
<Field label="Choices">
|
|
155
|
+
<FeatureFacts>
|
|
156
|
+
{data.options
|
|
157
|
+
.slice(0, poolExpanded ? data.options.length : 4)
|
|
158
|
+
.map((option, index) => (
|
|
159
|
+
<List.Item
|
|
160
|
+
key={index}
|
|
161
|
+
label={`${format.formatNumber(index + 1)}. ${option}`}
|
|
162
|
+
trailing={
|
|
163
|
+
result === option ? (
|
|
164
|
+
<Icon name="checkmark" {...stylex.props(appearance.accent)} />
|
|
165
|
+
) : undefined
|
|
166
|
+
}
|
|
167
|
+
/>
|
|
168
|
+
))}
|
|
169
|
+
</FeatureFacts>
|
|
170
|
+
{data.options.length > 4 && (
|
|
171
|
+
<Button
|
|
172
|
+
onClick={() => setPoolExpanded(current => !current)}
|
|
173
|
+
style={[button.quiet, randomPickerStyles.disclosure]}
|
|
174
|
+
>
|
|
175
|
+
<Text>
|
|
176
|
+
{poolExpanded
|
|
177
|
+
? 'Show fewer'
|
|
178
|
+
: `Show all ${format.formatNumber(data.options.length)} options`}
|
|
179
|
+
</Text>
|
|
180
|
+
</Button>
|
|
181
|
+
)}
|
|
182
|
+
</Field>
|
|
183
|
+
)}
|
|
184
|
+
<FeatureWell style={randomPickerStyles.stage}>
|
|
185
|
+
{!store.ready && !store.error ? (
|
|
186
|
+
<Text {...stylex.props(roles.muted)}>Loading last result…</Text>
|
|
187
|
+
) : data.mode === 'coin' || data.mode === 'dice' ? (
|
|
188
|
+
<>
|
|
189
|
+
<Text {...stylex.props(roles.h2)}>
|
|
190
|
+
{result === null
|
|
191
|
+
? data.mode === 'coin'
|
|
192
|
+
? 'Heads or tails?'
|
|
193
|
+
: 'Ready to roll'
|
|
194
|
+
: resultLabel}
|
|
195
|
+
</Text>
|
|
196
|
+
<Flex
|
|
197
|
+
{...stylex.props(
|
|
198
|
+
appearance.surface,
|
|
199
|
+
randomPickerStyles.face,
|
|
200
|
+
data.mode === 'coin' && randomPickerStyles.coin
|
|
201
|
+
)}
|
|
202
|
+
>
|
|
203
|
+
<Text
|
|
204
|
+
{...stylex.props(
|
|
205
|
+
roles.display,
|
|
206
|
+
randomPickerStyles.faceValue,
|
|
207
|
+
data.mode === 'coin' && result !== null && randomPickerStyles.coinValue
|
|
208
|
+
)}
|
|
209
|
+
>
|
|
210
|
+
{resultDisplay ?? '?'}
|
|
211
|
+
</Text>
|
|
212
|
+
</Flex>
|
|
213
|
+
</>
|
|
214
|
+
) : resultDisplay === null ? (
|
|
215
|
+
<Text {...stylex.props(roles.muted)}>No pick yet</Text>
|
|
216
|
+
) : (
|
|
217
|
+
<>
|
|
218
|
+
<Text {...stylex.props(roles.muted)}>{resultLabel}</Text>
|
|
219
|
+
<Text
|
|
220
|
+
{...stylex.props(
|
|
221
|
+
roles.display,
|
|
222
|
+
randomPickerStyles.result(resultDisplay.length),
|
|
223
|
+
data.mode === 'list' && randomPickerStyles.listResult
|
|
224
|
+
)}
|
|
225
|
+
>
|
|
226
|
+
{resultDisplay}
|
|
227
|
+
</Text>
|
|
228
|
+
</>
|
|
229
|
+
)}
|
|
230
|
+
</FeatureWell>
|
|
231
|
+
{store.saving && <Text {...stylex.props(roles.muted)}>Saving pick…</Text>}
|
|
232
|
+
<FeatureAction
|
|
233
|
+
component="randomPicker"
|
|
234
|
+
icon="shuffle"
|
|
235
|
+
size="lg"
|
|
236
|
+
variant="primary"
|
|
237
|
+
disabled={!store.ready || (domain.mode === 'list' && domain.options.length === 0)}
|
|
238
|
+
onClick={() => {
|
|
239
|
+
store.set(() => ({
|
|
240
|
+
result: { domain, value: pickResult(domain, Math.random()) },
|
|
241
|
+
}))
|
|
242
|
+
}}
|
|
243
|
+
>
|
|
244
|
+
{data.mode === 'coin'
|
|
245
|
+
? result === null
|
|
246
|
+
? 'Flip coin'
|
|
247
|
+
: 'Flip again'
|
|
248
|
+
: data.mode === 'dice'
|
|
249
|
+
? result === null
|
|
250
|
+
? 'Roll die'
|
|
251
|
+
: 'Roll again'
|
|
252
|
+
: result === null
|
|
253
|
+
? 'Pick one'
|
|
254
|
+
: 'Pick again'}
|
|
255
|
+
</FeatureAction>
|
|
256
|
+
</FeatureFrame>
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const randomPickerStyles = /* @__PURE__ */ stylex.create({
|
|
261
|
+
coin: { borderRadius: radius['full'] },
|
|
262
|
+
coinValue: { fontSize: text['3xl'], lineHeight: text['3xlLeading'] },
|
|
263
|
+
disclosure: { alignSelf: 'flex-start', paddingLeft: 0, paddingRight: 0 },
|
|
264
|
+
face: {
|
|
265
|
+
alignItems: 'center',
|
|
266
|
+
borderRadius: radius['3xl'],
|
|
267
|
+
height: space[24],
|
|
268
|
+
justifyContent: 'center',
|
|
269
|
+
width: space[24],
|
|
270
|
+
},
|
|
271
|
+
faceValue: { textAlign: 'center' },
|
|
272
|
+
listResult: { fontSize: text['3xl'], lineHeight: text['3xlLeading'] },
|
|
273
|
+
result: (length: number) => ({
|
|
274
|
+
fontSize: length > 14 ? text['2xl'] : length > 8 ? text['4xl'] : font.displaySize,
|
|
275
|
+
lineHeight:
|
|
276
|
+
length > 14
|
|
277
|
+
? text['2xlLeading']
|
|
278
|
+
: length > 8
|
|
279
|
+
? text['4xlLeading']
|
|
280
|
+
: font.displayLeading,
|
|
281
|
+
textAlign: 'center',
|
|
282
|
+
}),
|
|
283
|
+
stage: { alignItems: 'center', gap: space[4], justifyContent: 'center' },
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
export type PickerDomain = NonNullable<
|
|
287
|
+
z.output<typeof randomPickerStoreSchema>['result']
|
|
288
|
+
>['domain']
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* The choices a pick was drawn from. A plain union of strict variants (anyOf in JSON
|
|
292
|
+
* Schema) stays representable in the generated Quantum store source; oneOf does not.
|
|
293
|
+
*/
|
|
294
|
+
function pickerDomain() {
|
|
295
|
+
return z.union([
|
|
296
|
+
z.strictObject({ mode: z.literal('coin') }),
|
|
297
|
+
z.strictObject({ mode: z.literal('dice') }),
|
|
298
|
+
z.strictObject({
|
|
299
|
+
maximum: z.number(),
|
|
300
|
+
minimum: z.number(),
|
|
301
|
+
mode: z.literal('range'),
|
|
302
|
+
}),
|
|
303
|
+
z.strictObject({
|
|
304
|
+
mode: z.literal('list'),
|
|
305
|
+
options: z.array(z.string()),
|
|
306
|
+
}),
|
|
307
|
+
])
|
|
308
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Flex, Icon, Text } from '@flickfyi/core'
|
|
2
|
+
import { Button } from '@flickfyi/core/atoms'
|
|
3
|
+
import * as stylex from '@stylexjs/stylex'
|
|
4
|
+
import { z } from 'zod/v4'
|
|
5
|
+
|
|
6
|
+
import { useConfiguredFeature } from '~/hooks/use-configured-feature'
|
|
7
|
+
import type { CreateSchemas } from '~/kowalski/create-schemas'
|
|
8
|
+
import { everydayStyles } from '~/kowalski/everyday'
|
|
9
|
+
import { featureFields, replacement, store } from '~/kowalski/feature-schema'
|
|
10
|
+
import { FeatureField, FeatureFrame, FeatureWell } from '~/kowalski/frame'
|
|
11
|
+
import { appearance, button, roles } from '~/themes/shared'
|
|
12
|
+
|
|
13
|
+
const defaultId = 'KowalskiRating'
|
|
14
|
+
const defaultScope = 'private'
|
|
15
|
+
|
|
16
|
+
export const RatingData = /* @__PURE__ */ z
|
|
17
|
+
.strictObject({
|
|
18
|
+
subject: z.string().describe('What is being rated, e.g. "Pad thai at Lotus".'),
|
|
19
|
+
title: z.string().optional().describe('A short heading. Omit for "Your rating".'),
|
|
20
|
+
})
|
|
21
|
+
.describe('Rate one thing from one to five stars and keep a short note about it.')
|
|
22
|
+
|
|
23
|
+
export type RatingData = z.infer<typeof RatingData>
|
|
24
|
+
|
|
25
|
+
export const RatingProps = z.strictObject({
|
|
26
|
+
data: RatingData,
|
|
27
|
+
...featureFields,
|
|
28
|
+
scope: featureFields.scope.default(defaultScope),
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
export type RatingProps = z.input<typeof RatingProps> & {
|
|
32
|
+
style?: stylex.StyleXArray<stylex.StyleXStyles>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const ratingStoreSchema = store({
|
|
36
|
+
note: replacement(z.string().default('')),
|
|
37
|
+
stars: z.number().default(0),
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
export const createSchemas: CreateSchemas = ({
|
|
41
|
+
id = defaultId,
|
|
42
|
+
scope = defaultScope,
|
|
43
|
+
} = {}) => ({
|
|
44
|
+
[`stores/${scope}/${id}`]: ratingStoreSchema,
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
export function Rating({
|
|
48
|
+
data,
|
|
49
|
+
id,
|
|
50
|
+
revision = 0,
|
|
51
|
+
scope = defaultScope,
|
|
52
|
+
style,
|
|
53
|
+
}: RatingProps) {
|
|
54
|
+
const schema = ratingStoreSchema
|
|
55
|
+
const store = useConfiguredFeature({
|
|
56
|
+
name: id ?? defaultId,
|
|
57
|
+
revision,
|
|
58
|
+
schema,
|
|
59
|
+
scope,
|
|
60
|
+
seed: schema.parse({}),
|
|
61
|
+
})
|
|
62
|
+
const stars = store.value.stars
|
|
63
|
+
return (
|
|
64
|
+
<FeatureFrame
|
|
65
|
+
style={style}
|
|
66
|
+
onRetry={store.retry}
|
|
67
|
+
notice={store.error}
|
|
68
|
+
component="rating"
|
|
69
|
+
title={data.title ?? 'Your rating'}
|
|
70
|
+
detail={data.subject}
|
|
71
|
+
>
|
|
72
|
+
<FeatureField
|
|
73
|
+
component="rating"
|
|
74
|
+
label="Note"
|
|
75
|
+
multiline
|
|
76
|
+
ready={store.ready}
|
|
77
|
+
saving={store.saving}
|
|
78
|
+
value={store.value.note.value}
|
|
79
|
+
onChange={(note, onSaved) =>
|
|
80
|
+
store.set(() => ({ note: { value: note } }), onSaved)
|
|
81
|
+
}
|
|
82
|
+
/>
|
|
83
|
+
<FeatureWell style={everydayStyles.centered}>
|
|
84
|
+
<Flex {...stylex.props(everydayStyles.stars)}>
|
|
85
|
+
{[1, 2, 3, 4, 5].map(value => (
|
|
86
|
+
<Button
|
|
87
|
+
accessibilityLabel={`${value} ${value === 1 ? 'star' : 'stars'}`}
|
|
88
|
+
disabled={!store.ready}
|
|
89
|
+
key={value}
|
|
90
|
+
onClick={() => {
|
|
91
|
+
store.set(() => ({ stars: stars === value ? 0 : value }))
|
|
92
|
+
}}
|
|
93
|
+
selected={value === stars}
|
|
94
|
+
style={[button.quiet, everydayStyles.star]}
|
|
95
|
+
>
|
|
96
|
+
<Icon
|
|
97
|
+
name="star"
|
|
98
|
+
{...stylex.props(
|
|
99
|
+
roles.h1,
|
|
100
|
+
value <= stars ? appearance.accent : everydayStyles.emptyStar
|
|
101
|
+
)}
|
|
102
|
+
/>
|
|
103
|
+
</Button>
|
|
104
|
+
))}
|
|
105
|
+
</Flex>
|
|
106
|
+
<Text {...stylex.props(roles.muted)}>{ratingLabels[stars]}</Text>
|
|
107
|
+
</FeatureWell>
|
|
108
|
+
</FeatureFrame>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const ratingLabels = ['Tap a star to rate', 'Poor', 'Fair', 'Good', 'Great', 'Excellent']
|