phation 0.0.0-stage → 0.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/LICENSE.md +15 -0
- package/README.md +142 -2
- package/animate/core/feels.js +11 -0
- package/animate/core/recipes/index.js +84 -0
- package/animate/core/recipes/resolve.js +96 -0
- package/animate/detect.mjs +201 -0
- package/animate/index.mjs +266 -0
- package/animate/testset/eval.mjs +24 -0
- package/animate/testset/expected.json +23 -0
- package/animate/testset/holdout/commerce-delete-item-button.tsx +38 -0
- package/animate/testset/holdout/commerce-gallery.tsx +96 -0
- package/animate/testset/holdout/commerce-tile.tsx +50 -0
- package/animate/testset/holdout/shadcn-button-group-demo.tsx +114 -0
- package/animate/testset/holdout/shadcn-card-demo.tsx +63 -0
- package/animate/testset/holdout/shadcn-command-dialog.tsx +87 -0
- package/animate/testset/holdout/shadcn-drawer-dialog.tsx +90 -0
- package/animate/testset/holdout/shadcn-field-switch.tsx +24 -0
- package/animate/testset/holdout/shadcn-hover-card-demo.tsx +40 -0
- package/animate/testset/holdout/shadcn-mode-toggle.tsx +40 -0
- package/animate/testset/holdout/shadcn-toggle-group-demo.tsx +22 -0
- package/animate/testset/holdout.json +14 -0
- package/animate/testset/holdout2/chatbot-artifact-close-button.tsx +30 -0
- package/animate/testset/holdout2/chatbot-message-actions.tsx +211 -0
- package/animate/testset/holdout2/chatbot-sidebar-history-item.tsx +132 -0
- package/animate/testset/holdout2/chatbot-sidebar-toggle.tsx +35 -0
- package/animate/testset/holdout2/chatbot-suggested-actions.tsx +82 -0
- package/animate/testset/holdout2/chatbot-weather.tsx +434 -0
- package/animate/testset/holdout2/site-code-tabs.tsx +26 -0
- package/animate/testset/holdout2/site-copy-button.tsx +121 -0
- package/animate/testset/holdout2/site-github-link.tsx +38 -0
- package/animate/testset/holdout2/site-mobile-nav.tsx +220 -0
- package/animate/testset/holdout2/site-mode-switcher.tsx +97 -0
- package/animate/testset/holdout2/site-page-nav.tsx +15 -0
- package/animate/testset/holdout2.json +15 -0
- package/animate/testset/screens/commerce-cart-add-to-cart.tsx +94 -0
- package/animate/testset/screens/commerce-cart-modal.tsx +256 -0
- package/animate/testset/screens/commerce-navbar-mobile-menu.tsx +104 -0
- package/animate/testset/screens/commerce-product-variant-selector.tsx +106 -0
- package/animate/testset/screens/shadcn-accordion-demo.tsx +61 -0
- package/animate/testset/screens/shadcn-alert-dialog-demo.tsx +35 -0
- package/animate/testset/screens/shadcn-card-with-form.tsx +59 -0
- package/animate/testset/screens/shadcn-collapsible-demo.tsx +46 -0
- package/animate/testset/screens/shadcn-dialog-demo.tsx +50 -0
- package/animate/testset/screens/shadcn-drawer-demo.tsx +136 -0
- package/animate/testset/screens/shadcn-login-form.tsx +71 -0
- package/animate/testset/screens/shadcn-nav-main.tsx +73 -0
- package/animate/testset/screens/shadcn-section-cards.tsx +102 -0
- package/animate/testset/screens/shadcn-sheet-demo.tsx +47 -0
- package/animate/testset/screens/shadcn-switch-demo.tsx +11 -0
- package/animate/testset/screens/shadcn-tabs-demo.tsx +80 -0
- package/animate/testset/screens/taxonomy-main-nav.tsx +61 -0
- package/animate/testset/screens/taxonomy-post-item.tsx +42 -0
- package/animate/testset/screens/taxonomy-pricing.tsx +69 -0
- package/animate/testset/screens/taxonomy-user-account-nav.tsx +65 -0
- package/audit.mjs +456 -0
- package/bin/cli.mjs +113 -0
- package/bin/server.mjs +147 -0
- package/data/entries.json +864 -0
- package/data/standard/CORE.md +21 -0
- package/data/standard/STANDARD.md +185 -0
- package/data/standard/claude/CLAUDE.block.md +5 -0
- package/data/standard/claude/SKILL.md +26 -0
- package/data/standard/codex/AGENTS.block.md +25 -0
- package/data/standard/cursor/phation.mdc +27 -0
- package/data/standard/meta.json +4 -0
- package/data/standard/vscode/phation.instructions.md +25 -0
- package/data/standard/windsurf/phation.md +26 -0
- package/lib.mjs +214 -0
- package/package.json +41 -4
- package/share.mjs +72 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
// Phation Animate — surface A (ANIMATE_SPEC.md §04): plan and apply recipes on a user's own JSX/TSX.
|
|
2
|
+
// animate(path, { feel, only, roles, apply, write }) → { text, files[], plan[] }
|
|
3
|
+
// plan: token-lean list (≈ 15 tokens a part) of role → recipe, with confidence and "⚠ check" under 0.6.
|
|
4
|
+
// apply: edits the file in place by offsets (never re-prints it): motion tags, one MOTION object, data-phation hooks for
|
|
5
|
+
// audit_motion. Writes <name>.animated.<ext> unless write: true. Returns the changed lines only.
|
|
6
|
+
import fs from 'fs'
|
|
7
|
+
import path from 'path'
|
|
8
|
+
import { detect, jsxName } from './detect.mjs'
|
|
9
|
+
import { RECIPES, recipesFor, resolve, DEFAULT_FEEL } from './core/recipes/index.js'
|
|
10
|
+
import { FEELS } from './core/feels.js'
|
|
11
|
+
|
|
12
|
+
const EXT = /\.(jsx|tsx)$/
|
|
13
|
+
const camel = id => id.replace(/-(\w)/g, (_, c) => c.toUpperCase())
|
|
14
|
+
const feelName = id => FEELS.find(f => f.id === id)?.name || id
|
|
15
|
+
// what each recipe can do automatically in code; the rest is planned and pointed at a library entry
|
|
16
|
+
const AUTO = new Set(['press', 'hover-lift', 'sheet-open', 'modal-open', 'accordion-open', 'list-enter', 'number-roll', 'toggle-knob', 'tab-pill'])
|
|
17
|
+
|
|
18
|
+
/** Pick the recipe for a part: the first recipe for its role, filtered by `only`. */
|
|
19
|
+
function pick(part, only) {
|
|
20
|
+
const list = recipesFor(part.role).filter(r => !only?.length || only.includes(r.id))
|
|
21
|
+
return list[0] || null
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function files(target) {
|
|
25
|
+
const st = fs.statSync(target)
|
|
26
|
+
if (st.isFile()) return [target]
|
|
27
|
+
const out = []
|
|
28
|
+
const visit = d => { for (const f of fs.readdirSync(d, { withFileTypes: true })) {
|
|
29
|
+
if (f.name.startsWith('.') || f.name === 'node_modules' || f.name.includes('.animated.')) continue
|
|
30
|
+
const p = path.join(d, f.name)
|
|
31
|
+
if (f.isDirectory()) visit(p); else if (EXT.test(f.name)) out.push(p)
|
|
32
|
+
} }
|
|
33
|
+
visit(target)
|
|
34
|
+
return out
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Plan one file: parts with their recipe and resolved values. `roles` = { "<line>": "<role>" } overrides. */
|
|
38
|
+
export function planFile(file, { feel = DEFAULT_FEEL, only, roles } = {}) {
|
|
39
|
+
const source = fs.readFileSync(file, 'utf8')
|
|
40
|
+
const d = detect(source, { file })
|
|
41
|
+
const items = []
|
|
42
|
+
for (const p of d.parts) {
|
|
43
|
+
const forced = roles?.[String(p.line)] || roles?.[p.name]
|
|
44
|
+
if (forced) { p.role = forced; p.confidence = 1; p.signal = 'you' }
|
|
45
|
+
const rc = pick(p, only)
|
|
46
|
+
if (!rc) continue
|
|
47
|
+
// a number shown by a component (<Price amount={…}/>) has no expression here to roll: point at its file instead
|
|
48
|
+
items.push({ ...p, recipe: rc, values: resolve(rc, feel), auto: AUTO.has(rc.id) && !(rc.id === 'number-roll' && p.kind !== 'expr') })
|
|
49
|
+
}
|
|
50
|
+
// one recipe per element: keep the strongest; a list item can also take hover-lift (different trigger)
|
|
51
|
+
const seen = new Map(), keep = []
|
|
52
|
+
for (const it of items.sort((a, b) => b.confidence - a.confidence)) {
|
|
53
|
+
const k = `${it.el.start}:${it.recipe.trigger}`
|
|
54
|
+
if (seen.has(k)) continue
|
|
55
|
+
seen.set(k, it); keep.push(it)
|
|
56
|
+
}
|
|
57
|
+
keep.sort((a, b) => a.line - b.line)
|
|
58
|
+
keep.forEach((it, i) => { it.n = i + 1 })
|
|
59
|
+
return { file, source, detected: d, items: keep, feel }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// one short line a part: "5 L126 <DeleteItemButton> icon-button .5 → press ⚠" (⚠ = a guess: confirm with roles)
|
|
63
|
+
function planLine(it) {
|
|
64
|
+
const v = it.values, extra = v.staggerMs ? ` ${v.staggerMs}ms` : ''
|
|
65
|
+
const warn = it.confidence < 0.6 ? ' ⚠' : ''
|
|
66
|
+
const manual = it.auto ? '' : it.recipe.entry ? ` · manual: add_motion ${it.recipe.entry}` : ' · manual'
|
|
67
|
+
const label = it.kind === 'expr' ? `{} in <${it.name}>` : `<${it.name}>`
|
|
68
|
+
return `${it.n} L${it.line} ${label} ${it.role} ${String(it.confidence.toFixed(1)).replace(/^0/, '')} → ${it.recipe.id}${extra}${manual}${warn}`
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ---------- apply ----------
|
|
72
|
+
const lit = v => typeof v === 'string' ? `'${v}'` : String(v)
|
|
73
|
+
const obj = o => `{ ${Object.entries(o).map(([k, v]) => `${k}: ${Array.isArray(v) ? `[${v.join(', ')}]` : typeof v === 'object' ? obj(v) : lit(v)}`).join(', ')} }`
|
|
74
|
+
const spring = s => ({ type: 'spring', stiffness: s.stiffness, damping: s.damping, mass: s.mass })
|
|
75
|
+
|
|
76
|
+
function motionEntry(rc, v) {
|
|
77
|
+
const e = {}
|
|
78
|
+
const st = rc.states || rc.content
|
|
79
|
+
if (st) { e.from = { ...st.from }; e.to = { ...st.to } }
|
|
80
|
+
if (rc.id === 'toggle-knob') { e.to = { x: 20 }; e.travel = 'track − knob − 2 × inset' }
|
|
81
|
+
e.spring = spring(v.spring)
|
|
82
|
+
if (v.exit) e.exit = v.exit.durationMs ? { durationMs: v.exit.durationMs, ease: v.exit.ease } : { spring: spring(v.exit.spring) }
|
|
83
|
+
if (v.staggerMs) { e.staggerMs = v.staggerMs; e.maxItems = v.staggerMaxItems }
|
|
84
|
+
return e
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function applyPlan(plan) {
|
|
88
|
+
const { source, detected, items } = plan
|
|
89
|
+
const ast = detected.ast, edits = [], notes = [], done = []
|
|
90
|
+
const M = /\bexport\s+const\s+MOTION\b|\bconst\s+MOTION\b/.test(source) ? 'PHATION_MOTION' : 'MOTION'
|
|
91
|
+
const creates = new Map() // component name → Motion alias
|
|
92
|
+
const used = new Map() // recipe id → entry
|
|
93
|
+
const edit = (start, end, text) => edits.push({ start, end, text })
|
|
94
|
+
const tagged = new Set()
|
|
95
|
+
|
|
96
|
+
const motionName = name => {
|
|
97
|
+
if (/^[a-z]/.test(name) && !name.includes('.')) return `motion.${name}`
|
|
98
|
+
const alias = 'Motion' + name.replace(/\./g, '')
|
|
99
|
+
creates.set(name, alias)
|
|
100
|
+
return alias
|
|
101
|
+
}
|
|
102
|
+
const retag = el => {
|
|
103
|
+
if (tagged.has(el)) return
|
|
104
|
+
tagged.add(el)
|
|
105
|
+
const name = jsxName(el.openingElement.name), to = motionName(name)
|
|
106
|
+
edit(el.openingElement.name.start, el.openingElement.name.end, to)
|
|
107
|
+
if (el.closingElement) edit(el.closingElement.name.start, el.closingElement.name.end, to)
|
|
108
|
+
}
|
|
109
|
+
const has = (el, n) => el.openingElement.attributes.some(a => a.type === 'JSXAttribute' && a.name?.name === n)
|
|
110
|
+
// props are collected per element and written once, so two recipes on one element never repeat an attribute
|
|
111
|
+
const pending = new Map() // el → { hooks: [], props: [] }
|
|
112
|
+
const props = (el, text, id) => { const p = pending.get(el) || { hooks: [], props: [] }; p.props.push(text); if (id) p.hooks.push(id); pending.set(el, p) }
|
|
113
|
+
|
|
114
|
+
for (const it of items) {
|
|
115
|
+
const rc = it.recipe, key = camel(rc.id), ref = `${M}.${key}`
|
|
116
|
+
if (!it.auto) { notes.push(`${it.n} ${rc.id}: not applied automatically${rc.entry ? `. add_motion ${rc.entry} for the full pattern` : ''}`); continue }
|
|
117
|
+
const el = it.el
|
|
118
|
+
const clash = ['whileTap', 'whileHover', 'initial', 'animate', 'layoutId'].find(p => has(el, p))
|
|
119
|
+
if (it.kind === 'element' && clash) { notes.push(`${it.n} ${rc.id}: <${it.name}> already has ${clash}; left as is`); continue }
|
|
120
|
+
const hook = '' // data-phation is written once per element below
|
|
121
|
+
// gestures carry their own spring inside the target, so they never fight an entrance transition on the same element
|
|
122
|
+
if (rc.id === 'press') { retag(el); props(el, `whileTap={{ ...${ref}.to, transition: ${ref}.spring }}`, rc.id) }
|
|
123
|
+
else if (rc.id === 'hover-lift') { retag(el); props(el, `whileHover={{ ...${ref}.to, transition: ${ref}.spring }}`, rc.id) }
|
|
124
|
+
else if (rc.id === 'sheet-open' || rc.id === 'modal-open') {
|
|
125
|
+
retag(el)
|
|
126
|
+
props(el, `initial={${ref}.from} animate={${ref}.to} exit={{ ...${ref}.from, transition: { duration: ${ref}.exit.durationMs / 1000, ease: ${ref}.exit.ease } }} transition={${ref}.spring}`, rc.id)
|
|
127
|
+
notes.push(`${it.n} ${rc.id}: the exit plays only inside <AnimatePresence> (Radix: add forceMount to the content)`)
|
|
128
|
+
} else if (rc.id === 'accordion-open') { retag(el); props(el, `initial={${ref}.from} animate={${ref}.to} transition={${ref}.spring}`, rc.id) }
|
|
129
|
+
else if (rc.id === 'list-enter') {
|
|
130
|
+
const fn = el.__phationMap
|
|
131
|
+
let idx = fn?.params[1]?.type === 'Identifier' ? fn.params[1].name : null
|
|
132
|
+
if (!idx && fn?.params.length === 1) {
|
|
133
|
+
idx = 'phationI'
|
|
134
|
+
const p = fn.params[0], wrapped = fn.start < p.start && source.slice(fn.start, p.start).includes('(')
|
|
135
|
+
if (wrapped) edit(p.end, p.end, ', phationI'); else edit(p.start, p.end, `(${source.slice(p.start, p.end)}, phationI)`)
|
|
136
|
+
}
|
|
137
|
+
retag(el)
|
|
138
|
+
props(el, idx
|
|
139
|
+
? `initial={${ref}.from} animate={${ref}.to} transition={{ ...${ref}.spring, delay: Math.min(${idx}, ${ref}.maxItems - 1) * ${ref}.staggerMs / 1000 }}`
|
|
140
|
+
: `initial={${ref}.from} animate={${ref}.to} transition={${ref}.spring}`, rc.id)
|
|
141
|
+
} else if (rc.id === 'number-roll') {
|
|
142
|
+
const ex = it.expr, code = source.slice(ex.expression.start, ex.expression.end)
|
|
143
|
+
edit(ex.start, ex.end, `<motion.span key={String(${code})} data-phation="number-roll" initial={${ref}.from} animate={${ref}.to} transition={${ref}.spring} style={{ display: 'inline-block' }}>{${code}}</motion.span>`)
|
|
144
|
+
notes.push(`${it.n} number-roll: the whole value rolls in; add_motion digit-roll rolls each digit`)
|
|
145
|
+
} else if (rc.id === 'toggle-knob') {
|
|
146
|
+
const knob = el.children.find(c => c.type === 'JSXElement')
|
|
147
|
+
const state = el.openingElement.attributes.find(a => a.type === 'JSXAttribute' && ['checked', 'aria-checked'].includes(a.name?.name) && a.value?.type === 'JSXExpressionContainer')
|
|
148
|
+
if (!knob || !state) { notes.push(`${it.n} toggle-knob: no knob child with a checked state here; animate the thumb inside the switch component (add_motion day-night)`); continue }
|
|
149
|
+
const cond = source.slice(state.value.expression.start, state.value.expression.end)
|
|
150
|
+
retag(knob); props(knob, `initial={false} animate={{ x: ${cond} ? ${ref}.to.x : 0 }} transition={${ref}.spring}`, rc.id)
|
|
151
|
+
notes.push(`${it.n} toggle-knob: set ${M}.toggleKnob.to.x to the real travel (track − knob − 2 × inset)`)
|
|
152
|
+
} else if (rc.id === 'tab-pill') {
|
|
153
|
+
let pill = null
|
|
154
|
+
const visit = n => { if (!n || pill || typeof n !== 'object') return
|
|
155
|
+
if (n.type === 'LogicalExpression' && n.operator === '&&' && n.right?.type === 'JSXElement') { pill = n.right; return }
|
|
156
|
+
if (n.type === 'ConditionalExpression' && n.consequent?.type === 'JSXElement' && n.alternate?.type !== 'JSXElement') { pill = n.consequent; return }
|
|
157
|
+
for (const k in n) if (k !== 'loc' && !k.startsWith('__') && n[k] && typeof n[k] === 'object') Array.isArray(n[k]) ? n[k].forEach(visit) : visit(n[k]) }
|
|
158
|
+
visit(el)
|
|
159
|
+
if (!pill) { notes.push(`${it.n} tab-pill: no active-tab indicator found; render one inside the active tab and give it layoutId (add_motion model-picker)`); continue }
|
|
160
|
+
retag(pill); props(pill, `layoutId="phation-tab-pill" transition={${ref}.spring}`, rc.id)
|
|
161
|
+
}
|
|
162
|
+
used.set(rc.id, motionEntry(rc, it.values))
|
|
163
|
+
done.push(it.n)
|
|
164
|
+
}
|
|
165
|
+
// reduced motion (Standard §6): wrap each touched component's returned JSX once in <MotionConfig reducedMotion="user">,
|
|
166
|
+
// which drops transform and layout motion for users who ask for less and keeps opacity fades
|
|
167
|
+
const roots = new Set()
|
|
168
|
+
const visitRet = n => { if (!n || typeof n !== 'object') return
|
|
169
|
+
let arg = n.type === 'ReturnStatement' ? n.argument : n.type === 'ArrowFunctionExpression' && n.body?.type !== 'BlockStatement' ? n.body : null
|
|
170
|
+
while (arg?.type === 'ParenthesizedExpression') arg = arg.expression
|
|
171
|
+
if (arg && (arg.type === 'JSXElement' || arg.type === 'JSXFragment') && [...pending.keys(), ...items.filter(i => i.kind === 'expr').map(i => i.expr)].some(e => e.start >= arg.start && e.end <= arg.end)) {
|
|
172
|
+
if (![...roots].some(r => r.start <= arg.start && r.end >= arg.end)) { for (const r of [...roots]) if (arg.start <= r.start && arg.end >= r.end) roots.delete(r); roots.add(arg) }
|
|
173
|
+
}
|
|
174
|
+
for (const k in n) if (k !== 'loc' && !k.startsWith('__') && n[k] && typeof n[k] === 'object') Array.isArray(n[k]) ? n[k].forEach(visitRet) : visitRet(n[k]) }
|
|
175
|
+
visitRet(ast.program)
|
|
176
|
+
for (const r of roots) { edit(r.start, r.start, '<MotionConfig reducedMotion="user">'); edit(r.end, r.end, '</MotionConfig>') }
|
|
177
|
+
const needConfig = roots.size > 0
|
|
178
|
+
|
|
179
|
+
for (const [el, p] of pending) {
|
|
180
|
+
// an element with an entrance transition and a gesture keeps one transition prop (the entrance); gestures carry theirs
|
|
181
|
+
const text = (p.hooks.length ? `data-phation="${p.hooks.join(' ')}" ` : '') + p.props.join(' ')
|
|
182
|
+
edit(el.openingElement.name.end, el.openingElement.name.end, ' ' + text)
|
|
183
|
+
}
|
|
184
|
+
if (!done.length) return { source, changed: false, notes, done }
|
|
185
|
+
|
|
186
|
+
// imports + MOTION object (after the last import; after directives when there are none)
|
|
187
|
+
const body = ast.program.body
|
|
188
|
+
const imp = body.filter(s => s.type === 'ImportDeclaration')
|
|
189
|
+
const mImp = imp.find(s => s.source.value === 'motion/react' || s.source.value === 'framer-motion')
|
|
190
|
+
const head = []
|
|
191
|
+
const want = ['motion', ...(needConfig ? ['MotionConfig'] : [])]
|
|
192
|
+
if (!mImp) head.push(`import { ${want.join(', ')} } from 'motion/react'`)
|
|
193
|
+
else {
|
|
194
|
+
const missing = want.filter(n => !mImp.specifiers.some(s => s.local.name === n))
|
|
195
|
+
const first = mImp.specifiers.find(s => s.type === 'ImportSpecifier')
|
|
196
|
+
if (missing.length && first) edit(first.start, first.start, missing.join(', ') + ', ')
|
|
197
|
+
else if (missing.length) head.push(`import { ${missing.join(', ')} } from '${mImp.source.value}'`)
|
|
198
|
+
}
|
|
199
|
+
const at = imp.length ? imp[imp.length - 1].end : (ast.program.directives?.length ? ast.program.directives.at(-1).end : 0)
|
|
200
|
+
const motionObj = [`// Phation Animate · Feel: ${feelName(plan.feel)} · springs k/c/m, durations in ms. Reduced motion: <MotionConfig reducedMotion="user"> keeps fades, drops movement.`,
|
|
201
|
+
`export const ${M} = {`, ...[...used].map(([id, e]) => ` ${camel(id)}: ${obj(e)},`), `}`]
|
|
202
|
+
const createLines = [...creates].map(([name, alias]) => `const ${alias} = motion.create(${name})`)
|
|
203
|
+
const block = (head.length ? '\n' + head.join('\n') : '') + '\n\n' + motionObj.join('\n') + (createLines.length ? '\n' + createLines.join('\n') : '')
|
|
204
|
+
edit(at, at, at === 0 ? block.trimStart() + '\n' : block)
|
|
205
|
+
if (creates.size) notes.push(`motion.create(${[...creates.keys()].join(', ')}): these components must forward their ref to the DOM element (shadcn/Radix do)`)
|
|
206
|
+
|
|
207
|
+
let out = source
|
|
208
|
+
for (const e of edits.sort((a, b) => b.start - a.start || b.end - a.end)) out = out.slice(0, e.start) + e.text + out.slice(e.end)
|
|
209
|
+
return { source: out, changed: true, notes, done }
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** Changed lines only, as a compact unified-style list. */
|
|
213
|
+
export function lineDiff(a, b) {
|
|
214
|
+
const A = a.split('\n'), B = b.split('\n'), n = A.length, m = B.length
|
|
215
|
+
const L = Array.from({ length: n + 1 }, () => new Int32Array(m + 1))
|
|
216
|
+
for (let i = n - 1; i >= 0; i--) for (let j = m - 1; j >= 0; j--) L[i][j] = A[i] === B[j] ? L[i + 1][j + 1] + 1 : Math.max(L[i + 1][j], L[i][j + 1])
|
|
217
|
+
const out = []
|
|
218
|
+
let i = 0, j = 0
|
|
219
|
+
while (i < n || j < m) {
|
|
220
|
+
if (i < n && j < m && A[i] === B[j]) { i++; j++ }
|
|
221
|
+
else if (j < m && (i >= n || L[i][j + 1] >= L[i + 1][j])) { out.push(`+${String(j + 1).padStart(4)} ${B[j]}`); j++ }
|
|
222
|
+
else { out.push(`-${String(i + 1).padStart(4)} ${A[i]}`); i++ }
|
|
223
|
+
}
|
|
224
|
+
return out.join('\n')
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// audit actions that trigger each applied recipe (audit_motion `actions`)
|
|
228
|
+
const ACTION = {
|
|
229
|
+
press: '"hold:[data-phation~=press]:300"', 'hover-lift': '"hover:[data-phation~=hover-lift]"', 'tab-pill': 'click on another tab',
|
|
230
|
+
'toggle-knob': 'click the switch', 'accordion-open': 'click its trigger', 'sheet-open': 'click its trigger', 'modal-open': 'click its trigger',
|
|
231
|
+
'list-enter': 'page load (no action)', 'number-roll': 'change the value',
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Plan (default) or apply across a file or folder. */
|
|
235
|
+
export function animate(target, { feel = DEFAULT_FEEL, only, roles, apply = false, write = false, projectRoot = process.cwd() } = {}) {
|
|
236
|
+
const abs = path.resolve(projectRoot, target)
|
|
237
|
+
if (!fs.existsSync(abs)) throw new Error(`No file or folder at ${target}`)
|
|
238
|
+
if (!FEELS.some(f => f.id === feel)) throw new Error(`Unknown feel "${feel}". Use one of: ${FEELS.map(f => f.id).join(', ')}`)
|
|
239
|
+
const list = files(abs)
|
|
240
|
+
if (!list.length) throw new Error(`No .jsx/.tsx files in ${target}`)
|
|
241
|
+
const lines = [], results = []
|
|
242
|
+
for (const f of list) {
|
|
243
|
+
let plan
|
|
244
|
+
try { plan = planFile(f, { feel, only, roles }) } catch (e) { lines.push(`${path.relative(projectRoot, f)} · parse error: ${e.message}`); continue }
|
|
245
|
+
if (!plan.items.length) continue
|
|
246
|
+
const rel = path.relative(projectRoot, f)
|
|
247
|
+
lines.push(`${rel} · Feel: ${feelName(feel)}`, ...plan.items.map(planLine))
|
|
248
|
+
if (apply) {
|
|
249
|
+
const r = applyPlan(plan)
|
|
250
|
+
if (r.changed) {
|
|
251
|
+
const out = write ? f : f.replace(EXT, '.animated.$1')
|
|
252
|
+
fs.writeFileSync(out, r.source)
|
|
253
|
+
lines.push(`→ wrote ${path.relative(projectRoot, out)} (${r.done.length} part${r.done.length > 1 ? 's' : ''})`, lineDiff(plan.source, r.source))
|
|
254
|
+
const acts = [...new Set(plan.items.filter(it => r.done.includes(it.n)).map(it => `${it.recipe.id}: ${ACTION[it.recipe.id]}`))]
|
|
255
|
+
lines.push(`check: audit_motion({ url, actions }) · ${acts.join(' · ')}`)
|
|
256
|
+
}
|
|
257
|
+
lines.push(...r.notes.map(n => ` · ${n}`))
|
|
258
|
+
results.push({ file: rel, ...r, source: undefined })
|
|
259
|
+
}
|
|
260
|
+
lines.push('')
|
|
261
|
+
results.push({ file: rel, parts: plan.items.map(it => ({ n: it.n, line: it.line, name: it.name, role: it.role, confidence: it.confidence, signal: it.signal, recipe: it.recipe.id, auto: it.auto })) })
|
|
262
|
+
}
|
|
263
|
+
if (!lines.length) return { text: `Nothing to animate in ${target}: no buttons, cards, sheets, dialogs, tabs, toggles, lists or numbers found.`, results }
|
|
264
|
+
if (!apply) lines.push(`⚠ = guess, fix with roles: { "<line>": "<role>" } · then apply: true`)
|
|
265
|
+
return { text: lines.join('\n').trim(), results }
|
|
266
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Detection accuracy on the test set (ANIMATE_SPEC.md §04 "Done when": ≥ 85 % correct roles).
|
|
2
|
+
// node animate/testset/eval.mjs [--holdout] [--v] (--holdout: screens labelled before the rules saw them)
|
|
3
|
+
// correct = a detected (line, role) that is in the labels · wrong = detected but not labelled · missed = labelled, not found.
|
|
4
|
+
// accuracy = correct / (correct + wrong + missed)
|
|
5
|
+
import fs from 'fs'
|
|
6
|
+
import path from 'path'
|
|
7
|
+
import { fileURLToPath } from 'url'
|
|
8
|
+
import { detect } from '../detect.mjs'
|
|
9
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url))
|
|
10
|
+
const set = process.argv.includes('--holdout2') ? ['holdout2.json', 'holdout2'] : process.argv.includes('--holdout') ? ['holdout.json', 'holdout'] : ['expected.json', 'screens']
|
|
11
|
+
const want = JSON.parse(fs.readFileSync(path.join(HERE, set[0]), 'utf8'))
|
|
12
|
+
const verbose = process.argv.includes('--v')
|
|
13
|
+
let c = 0, w = 0, m = 0
|
|
14
|
+
for (const f of Object.keys(want).filter(k => !k.startsWith('_'))) {
|
|
15
|
+
const { parts } = detect(fs.readFileSync(path.join(HERE, set[1], f), 'utf8'))
|
|
16
|
+
const got = new Set(parts.map(p => `${p.line}:${p.role}`))
|
|
17
|
+
const exp = new Set(Object.entries(want[f]).flatMap(([l, rs]) => rs.map(r => `${l}:${r}`)))
|
|
18
|
+
const ok = [...got].filter(x => exp.has(x)), bad = [...got].filter(x => !exp.has(x)), miss = [...exp].filter(x => !got.has(x))
|
|
19
|
+
c += ok.length; w += bad.length; m += miss.length
|
|
20
|
+
if (verbose || bad.length || miss.length) console.log(`${f.padEnd(40)} ${ok.length} ok${bad.length ? ` · wrong ${bad.join(' ')}` : ''}${miss.length ? ` · missed ${miss.join(' ')}` : ''}`)
|
|
21
|
+
}
|
|
22
|
+
const acc = c / (c + w + m)
|
|
23
|
+
console.log(`\n${c} correct · ${w} wrong · ${m} missed → accuracy ${(acc * 100).toFixed(1)} % (precision ${(c / (c + w) * 100).toFixed(1)} %, recall ${(c / (c + m) * 100).toFixed(1)} %)`)
|
|
24
|
+
process.exit(acc >= 0.85 ? 0 : 1)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_about": "Hand labels for the 20 test screens (real code: shadcn examples/blocks, vercel/commerce, shadcn/taxonomy; fetched 2026-11-18). line → roles a motion designer would treat as parts. Labelled by Claude for Huy; review before trusting the score.",
|
|
3
|
+
"commerce-cart-add-to-cart.tsx": { "24": ["button"], "32": ["button"], "46": ["button"], "85": ["button"] },
|
|
4
|
+
"commerce-cart-modal.tsx": { "52": ["icon-button"], "77": ["sheet"], "80": ["icon-button"], "120": ["list"], "126": ["icon-button"], "166": ["number"], "174": ["icon-button"], "181": ["number"], "184": ["icon-button"], "199": ["number"], "211": ["number"], "219": ["button"], "248": ["button"] },
|
|
5
|
+
"commerce-navbar-mobile-menu.tsx": { "35": ["icon-button"], "64": ["sheet"], "66": ["icon-button"], "82": ["list"] },
|
|
6
|
+
"commerce-product-variant-selector.tsx": { "81": ["button", "list"] },
|
|
7
|
+
"shadcn-accordion-demo.tsx": { "17": ["button"], "18": ["accordion"], "31": ["button"], "32": ["accordion"], "45": ["button"], "46": ["accordion"] },
|
|
8
|
+
"shadcn-alert-dialog-demo.tsx": { "18": ["button"], "20": ["modal"] },
|
|
9
|
+
"shadcn-card-with-form.tsx": { "24": ["card"], "34": ["input"], "39": ["input"], "54": ["button"], "55": ["button"] },
|
|
10
|
+
"shadcn-collapsible-demo.tsx": { "27": ["icon-button"], "36": ["accordion"] },
|
|
11
|
+
"shadcn-dialog-demo.tsx": { "20": ["button"], "22": ["modal"], "33": ["input"], "37": ["input"], "42": ["button"], "44": ["button"] },
|
|
12
|
+
"shadcn-drawer-demo.tsx": { "71": ["button"], "73": ["sheet"], "81": ["icon-button"], "93": ["number"], "99": ["icon-button"], "127": ["button"], "129": ["button"] },
|
|
13
|
+
"shadcn-login-form.tsx": { "25": ["card"], "37": ["input"], "54": ["input"], "57": ["button"], "58": ["button"] },
|
|
14
|
+
"shadcn-nav-main.tsx": { "40": ["list"], "48": ["button"], "54": ["accordion"], "57": ["list"], "58": ["button"] },
|
|
15
|
+
"shadcn-section-cards.tsx": { "16": ["card"], "38": ["card"], "60": ["card"], "80": ["card"] },
|
|
16
|
+
"shadcn-sheet-demo.tsx": { "19": ["button"], "21": ["sheet"], "31": ["input"], "35": ["input"], "39": ["button"], "41": ["button"] },
|
|
17
|
+
"shadcn-switch-demo.tsx": { "7": ["toggle"] },
|
|
18
|
+
"shadcn-tabs-demo.tsx": { "25": ["tabs"], "30": ["card"], "41": ["input"], "45": ["input"], "49": ["button"], "54": ["card"], "65": ["input"], "69": ["input"], "73": ["button"] },
|
|
19
|
+
"taxonomy-main-nav.tsx": { "33": ["nav-link", "list"], "49": ["button"], "57": ["sheet"] },
|
|
20
|
+
"taxonomy-post-item.tsx": {},
|
|
21
|
+
"taxonomy-pricing.tsx": { "22": ["card"], "56": ["button"] },
|
|
22
|
+
"taxonomy-user-account-nav.tsx": { "23": ["icon-button"] }
|
|
23
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { XMarkIcon } from "@heroicons/react/24/outline";
|
|
4
|
+
import { removeItem } from "components/cart/actions";
|
|
5
|
+
import type { CartItem } from "lib/shopify/types";
|
|
6
|
+
import { useActionState } from "react";
|
|
7
|
+
|
|
8
|
+
export function DeleteItemButton({
|
|
9
|
+
item,
|
|
10
|
+
optimisticUpdate,
|
|
11
|
+
}: {
|
|
12
|
+
item: CartItem;
|
|
13
|
+
optimisticUpdate: any;
|
|
14
|
+
}) {
|
|
15
|
+
const [message, formAction] = useActionState(removeItem, null);
|
|
16
|
+
const merchandiseId = item.merchandise.id;
|
|
17
|
+
const removeItemAction = formAction.bind(null, merchandiseId);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<form
|
|
21
|
+
action={async () => {
|
|
22
|
+
optimisticUpdate(merchandiseId, "delete");
|
|
23
|
+
removeItemAction();
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<button
|
|
27
|
+
type="submit"
|
|
28
|
+
aria-label="Remove cart item"
|
|
29
|
+
className="flex h-[24px] w-[24px] items-center justify-center rounded-full bg-neutral-500"
|
|
30
|
+
>
|
|
31
|
+
<XMarkIcon className="mx-[1px] h-4 w-4 text-white dark:text-black" />
|
|
32
|
+
</button>
|
|
33
|
+
<p aria-live="polite" className="sr-only" role="status">
|
|
34
|
+
{message}
|
|
35
|
+
</p>
|
|
36
|
+
</form>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ArrowLeftIcon, ArrowRightIcon } from "@heroicons/react/24/outline";
|
|
4
|
+
import { GridTileImage } from "components/grid/tile";
|
|
5
|
+
import Image from "next/image";
|
|
6
|
+
import { useRouter, useSearchParams } from "next/navigation";
|
|
7
|
+
|
|
8
|
+
export function Gallery({
|
|
9
|
+
images,
|
|
10
|
+
}: {
|
|
11
|
+
images: { src: string; altText: string }[];
|
|
12
|
+
}) {
|
|
13
|
+
const router = useRouter();
|
|
14
|
+
const searchParams = useSearchParams();
|
|
15
|
+
const imageIndex = searchParams.has("image")
|
|
16
|
+
? parseInt(searchParams.get("image")!)
|
|
17
|
+
: 0;
|
|
18
|
+
|
|
19
|
+
const updateImage = (index: string) => {
|
|
20
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
21
|
+
params.set("image", index);
|
|
22
|
+
router.replace(`?${params.toString()}`, { scroll: false });
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const nextImageIndex = imageIndex + 1 < images.length ? imageIndex + 1 : 0;
|
|
26
|
+
const previousImageIndex =
|
|
27
|
+
imageIndex === 0 ? images.length - 1 : imageIndex - 1;
|
|
28
|
+
|
|
29
|
+
const buttonClassName =
|
|
30
|
+
"h-full px-6 transition-all ease-in-out hover:scale-110 hover:text-black dark:hover:text-white flex items-center justify-center";
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<form>
|
|
34
|
+
<div className="relative aspect-square h-full max-h-[550px] w-full overflow-hidden">
|
|
35
|
+
{images[imageIndex] && (
|
|
36
|
+
<Image
|
|
37
|
+
className="h-full w-full object-contain"
|
|
38
|
+
fill
|
|
39
|
+
sizes="(min-width: 1024px) 66vw, 100vw"
|
|
40
|
+
alt={images[imageIndex]?.altText as string}
|
|
41
|
+
src={images[imageIndex]?.src as string}
|
|
42
|
+
priority={true}
|
|
43
|
+
/>
|
|
44
|
+
)}
|
|
45
|
+
|
|
46
|
+
{images.length > 1 ? (
|
|
47
|
+
<div className="absolute bottom-[15%] flex w-full justify-center">
|
|
48
|
+
<div className="mx-auto flex h-11 items-center rounded-full border border-white bg-neutral-50/80 text-neutral-500 backdrop-blur-sm dark:border-black dark:bg-neutral-900/80">
|
|
49
|
+
<button
|
|
50
|
+
formAction={() => updateImage(previousImageIndex.toString())}
|
|
51
|
+
aria-label="Previous product image"
|
|
52
|
+
className={buttonClassName}
|
|
53
|
+
>
|
|
54
|
+
<ArrowLeftIcon className="h-5" />
|
|
55
|
+
</button>
|
|
56
|
+
<div className="mx-1 h-6 w-px bg-neutral-500"></div>
|
|
57
|
+
<button
|
|
58
|
+
formAction={() => updateImage(nextImageIndex.toString())}
|
|
59
|
+
aria-label="Next product image"
|
|
60
|
+
className={buttonClassName}
|
|
61
|
+
>
|
|
62
|
+
<ArrowRightIcon className="h-5" />
|
|
63
|
+
</button>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
) : null}
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
{images.length > 1 ? (
|
|
70
|
+
<ul className="my-12 flex items-center flex-wrap justify-center gap-2 overflow-auto py-1 lg:mb-0">
|
|
71
|
+
{images.map((image, index) => {
|
|
72
|
+
const isActive = index === imageIndex;
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<li key={image.src} className="h-20 w-20">
|
|
76
|
+
<button
|
|
77
|
+
formAction={() => updateImage(index.toString())}
|
|
78
|
+
aria-label="Select product image"
|
|
79
|
+
className="h-full w-full"
|
|
80
|
+
>
|
|
81
|
+
<GridTileImage
|
|
82
|
+
alt={image.altText}
|
|
83
|
+
src={image.src}
|
|
84
|
+
width={80}
|
|
85
|
+
height={80}
|
|
86
|
+
active={isActive}
|
|
87
|
+
/>
|
|
88
|
+
</button>
|
|
89
|
+
</li>
|
|
90
|
+
);
|
|
91
|
+
})}
|
|
92
|
+
</ul>
|
|
93
|
+
) : null}
|
|
94
|
+
</form>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import Image from "next/image";
|
|
3
|
+
import Label from "../label";
|
|
4
|
+
|
|
5
|
+
export function GridTileImage({
|
|
6
|
+
isInteractive = true,
|
|
7
|
+
active,
|
|
8
|
+
label,
|
|
9
|
+
...props
|
|
10
|
+
}: {
|
|
11
|
+
isInteractive?: boolean;
|
|
12
|
+
active?: boolean;
|
|
13
|
+
label?: {
|
|
14
|
+
title: string;
|
|
15
|
+
amount: string;
|
|
16
|
+
currencyCode: string;
|
|
17
|
+
position?: "bottom" | "center";
|
|
18
|
+
};
|
|
19
|
+
} & React.ComponentProps<typeof Image>) {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
className={clsx(
|
|
23
|
+
"group flex h-full w-full items-center justify-center overflow-hidden rounded-lg border bg-white hover:border-blue-600 dark:bg-black",
|
|
24
|
+
{
|
|
25
|
+
relative: label,
|
|
26
|
+
"border-2 border-blue-600": active,
|
|
27
|
+
"border-neutral-200 dark:border-neutral-800": !active,
|
|
28
|
+
},
|
|
29
|
+
)}
|
|
30
|
+
>
|
|
31
|
+
{props.src ? (
|
|
32
|
+
<Image
|
|
33
|
+
className={clsx("relative h-full w-full object-contain", {
|
|
34
|
+
"transition duration-300 ease-in-out group-hover:scale-105":
|
|
35
|
+
isInteractive,
|
|
36
|
+
})}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
) : null}
|
|
40
|
+
{label ? (
|
|
41
|
+
<Label
|
|
42
|
+
title={label.title}
|
|
43
|
+
amount={label.amount}
|
|
44
|
+
currencyCode={label.currencyCode}
|
|
45
|
+
position={label.position}
|
|
46
|
+
/>
|
|
47
|
+
) : null}
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import {
|
|
5
|
+
ArchiveIcon,
|
|
6
|
+
ArrowLeftIcon,
|
|
7
|
+
CalendarPlusIcon,
|
|
8
|
+
ClockIcon,
|
|
9
|
+
ListFilterIcon,
|
|
10
|
+
MailCheckIcon,
|
|
11
|
+
MoreHorizontalIcon,
|
|
12
|
+
TagIcon,
|
|
13
|
+
Trash2Icon,
|
|
14
|
+
} from "lucide-react"
|
|
15
|
+
|
|
16
|
+
import { Button } from "@/registry/new-york-v4/ui/button"
|
|
17
|
+
import { ButtonGroup } from "@/registry/new-york-v4/ui/button-group"
|
|
18
|
+
import {
|
|
19
|
+
DropdownMenu,
|
|
20
|
+
DropdownMenuContent,
|
|
21
|
+
DropdownMenuGroup,
|
|
22
|
+
DropdownMenuItem,
|
|
23
|
+
DropdownMenuRadioGroup,
|
|
24
|
+
DropdownMenuRadioItem,
|
|
25
|
+
DropdownMenuSeparator,
|
|
26
|
+
DropdownMenuSub,
|
|
27
|
+
DropdownMenuSubContent,
|
|
28
|
+
DropdownMenuSubTrigger,
|
|
29
|
+
DropdownMenuTrigger,
|
|
30
|
+
} from "@/registry/new-york-v4/ui/dropdown-menu"
|
|
31
|
+
|
|
32
|
+
export default function ButtonGroupDemo() {
|
|
33
|
+
const [label, setLabel] = React.useState("personal")
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<ButtonGroup>
|
|
37
|
+
<ButtonGroup className="hidden sm:flex">
|
|
38
|
+
<Button variant="outline" size="icon" aria-label="Go Back">
|
|
39
|
+
<ArrowLeftIcon />
|
|
40
|
+
</Button>
|
|
41
|
+
</ButtonGroup>
|
|
42
|
+
<ButtonGroup>
|
|
43
|
+
<Button variant="outline">Archive</Button>
|
|
44
|
+
<Button variant="outline">Report</Button>
|
|
45
|
+
</ButtonGroup>
|
|
46
|
+
<ButtonGroup>
|
|
47
|
+
<Button variant="outline">Snooze</Button>
|
|
48
|
+
<DropdownMenu>
|
|
49
|
+
<DropdownMenuTrigger asChild>
|
|
50
|
+
<Button variant="outline" size="icon" aria-label="More Options">
|
|
51
|
+
<MoreHorizontalIcon />
|
|
52
|
+
</Button>
|
|
53
|
+
</DropdownMenuTrigger>
|
|
54
|
+
<DropdownMenuContent align="end" className="w-52">
|
|
55
|
+
<DropdownMenuGroup>
|
|
56
|
+
<DropdownMenuItem>
|
|
57
|
+
<MailCheckIcon />
|
|
58
|
+
Mark as Read
|
|
59
|
+
</DropdownMenuItem>
|
|
60
|
+
<DropdownMenuItem>
|
|
61
|
+
<ArchiveIcon />
|
|
62
|
+
Archive
|
|
63
|
+
</DropdownMenuItem>
|
|
64
|
+
</DropdownMenuGroup>
|
|
65
|
+
<DropdownMenuSeparator />
|
|
66
|
+
<DropdownMenuGroup>
|
|
67
|
+
<DropdownMenuItem>
|
|
68
|
+
<ClockIcon />
|
|
69
|
+
Snooze
|
|
70
|
+
</DropdownMenuItem>
|
|
71
|
+
<DropdownMenuItem>
|
|
72
|
+
<CalendarPlusIcon />
|
|
73
|
+
Add to Calendar
|
|
74
|
+
</DropdownMenuItem>
|
|
75
|
+
<DropdownMenuItem>
|
|
76
|
+
<ListFilterIcon />
|
|
77
|
+
Add to List
|
|
78
|
+
</DropdownMenuItem>
|
|
79
|
+
<DropdownMenuSub>
|
|
80
|
+
<DropdownMenuSubTrigger>
|
|
81
|
+
<TagIcon />
|
|
82
|
+
Label As...
|
|
83
|
+
</DropdownMenuSubTrigger>
|
|
84
|
+
<DropdownMenuSubContent>
|
|
85
|
+
<DropdownMenuRadioGroup
|
|
86
|
+
value={label}
|
|
87
|
+
onValueChange={setLabel}
|
|
88
|
+
>
|
|
89
|
+
<DropdownMenuRadioItem value="personal">
|
|
90
|
+
Personal
|
|
91
|
+
</DropdownMenuRadioItem>
|
|
92
|
+
<DropdownMenuRadioItem value="work">
|
|
93
|
+
Work
|
|
94
|
+
</DropdownMenuRadioItem>
|
|
95
|
+
<DropdownMenuRadioItem value="other">
|
|
96
|
+
Other
|
|
97
|
+
</DropdownMenuRadioItem>
|
|
98
|
+
</DropdownMenuRadioGroup>
|
|
99
|
+
</DropdownMenuSubContent>
|
|
100
|
+
</DropdownMenuSub>
|
|
101
|
+
</DropdownMenuGroup>
|
|
102
|
+
<DropdownMenuSeparator />
|
|
103
|
+
<DropdownMenuGroup>
|
|
104
|
+
<DropdownMenuItem variant="destructive">
|
|
105
|
+
<Trash2Icon />
|
|
106
|
+
Trash
|
|
107
|
+
</DropdownMenuItem>
|
|
108
|
+
</DropdownMenuGroup>
|
|
109
|
+
</DropdownMenuContent>
|
|
110
|
+
</DropdownMenu>
|
|
111
|
+
</ButtonGroup>
|
|
112
|
+
</ButtonGroup>
|
|
113
|
+
)
|
|
114
|
+
}
|