@photon-ai/pho-ui 4.24.0 → 4.25.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.
|
@@ -53,7 +53,7 @@ function g({ className: e, ...t }) {
|
|
|
53
53
|
function f({ className: e, children: t, ...o }) {
|
|
54
54
|
const a = l(p);
|
|
55
55
|
return /* @__PURE__ */ c(s.Trigger, {
|
|
56
|
-
className: n("group/trigger text-pho-primary outline-pho-brand font-heading relative flex flex-1 cursor-pointer items-center justify-between gap-3 text-left font-medium
|
|
56
|
+
className: n("group/trigger text-pho-primary outline-pho-brand font-heading relative flex flex-1 cursor-pointer items-center justify-between gap-3 text-left font-medium", "ease-pho-spring-reveal data-[panel-open]:text-pho-description transition-colors duration-500", "focus-visible:outline-2 focus-visible:outline-offset-4", "before:absolute before:inset-x-0", i[a].question, i[a].hit, e),
|
|
57
57
|
...o,
|
|
58
58
|
children: [t, /* @__PURE__ */ r("svg", {
|
|
59
59
|
"aria-hidden": "true",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.js","names":["BaseAccordion","cn","createContext","useContext","jsx","jsxs","Accordion$1","SIZE","SizeContext","Root","className","multiple","size","props","Item","Header","Trigger","children","Panel","Accordion"],"sources":["../../src/components/accordion/accordion.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n type ComponentProps,\n type ElementType,\n} from \"react\";\nimport { Accordion as BaseAccordion } from \"@base-ui/react/accordion\";\nimport { cn } from \"../../utils/cn\";\n\n/** Override Base UI's `string | (state) => string` className with plain string. */\ntype StyledProps<T extends ElementType> = Omit<\n ComponentProps<T>,\n \"className\"\n> & {\n className?: string;\n};\n\nexport type AccordionSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * Three sizes, one step of the type scale apart. `lg` is photon.codes's\n * FAQ to the pixel: the question at 20/28, the answer at 18/28, 20px\n * above and below, 8px between. `md` and `sm` step the type, the\n * padding, and the gap down together; the chevron is the same small\n * glyph in the same 24px box at every size, so a row is never shorter\n * than it.\n */\nconst SIZE: Record<\n AccordionSize,\n { item: string; hit: string; question: string; gap: string; answer: string }\n> = {\n sm: {\n item: \"py-3\",\n hit: \"before:-top-3 before:-bottom-3\",\n question: \"text-base\",\n gap: \"pt-1 pb-1\",\n answer: \"text-xs\",\n },\n md: {\n item: \"py-4\",\n hit: \"before:-top-4 before:-bottom-4\",\n question: \"text-md\",\n gap: \"pt-1.5 pb-1.5\",\n answer: \"text-base\",\n },\n lg: {\n item: \"py-5\",\n hit: \"before:-top-5 before:-bottom-5\",\n question: \"text-xl leading-7\",\n gap: \"pt-2 pb-2\",\n answer: \"text-lg\",\n },\n};\n\nconst SizeContext = createContext<AccordionSize>(\"md\");\n\nexport interface AccordionRootProps extends StyledProps<\n typeof BaseAccordion.Root\n> {\n /** @default \"md\" */\n size?: AccordionSize;\n}\n\n/**\n * The list — bare, so the page decides the surface: on photon.codes the\n * FAQ card is the section's, 32px around the list; in a settings page it\n * is a `Card`. Items divide with a hairline and the list has no outer\n * lines. Items are independent, as on the site, so `multiple` is on\n * unless said otherwise.\n */\nfunction Root({\n className,\n multiple = true,\n size = \"md\",\n ...props\n}: AccordionRootProps) {\n return (\n <SizeContext.Provider value={size}>\n <BaseAccordion.Root\n multiple={multiple}\n data-size={size}\n className={cn(\"w-full\", className)}\n {...props}\n />\n </SizeContext.Provider>\n );\n}\n\n/**\n * One question, padded above and below, whatever is open inside. The\n * hairline under it overlaps the next item by its own pixel, the way\n * Framer draws a border inside the box, so an item advances by exactly\n * its padding and its rows: 68px at `lg`, the site's figure. The last\n * item draws none.\n */\nfunction Item({ className, ...props }: StyledProps<typeof BaseAccordion.Item>) {\n const size = useContext(SizeContext);\n return (\n <BaseAccordion.Item\n className={cn(\n \"border-pho-secondary -mb-px border-b last:mb-0 last:border-b-0\",\n SIZE[size].item,\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Header({\n className,\n ...props\n}: StyledProps<typeof BaseAccordion.Header>) {\n return <BaseAccordion.Header className={cn(\"flex\", className)} {...props} />;\n}\n\n/**\n * The question row: the question in medium with the chevron at the row's\n * end. The chevron is the site's small one (a 6.5×3.5 stroke in a 24px\n * box, weight 1.5) and the trigger wears it itself — pass only the\n * question. Open, the question settles to the description tone and the\n * chevron makes a half turn, both on the section spring; the chevron keeps\n * the primary ink. The whole item is the target, as on the site: the hit\n * area reaches through the item's padding above and below the row.\n */\nfunction Trigger({\n className,\n children,\n ...props\n}: StyledProps<typeof BaseAccordion.Trigger>) {\n const size = useContext(SizeContext);\n return (\n <BaseAccordion.Trigger\n className={cn(\n \"group/trigger text-pho-primary outline-pho-brand font-heading relative flex flex-1 cursor-pointer items-center justify-between gap-3 text-left font-medium
|
|
1
|
+
{"version":3,"file":"accordion.js","names":["BaseAccordion","cn","createContext","useContext","jsx","jsxs","Accordion$1","SIZE","SizeContext","Root","className","multiple","size","props","Item","Header","Trigger","children","Panel","Accordion"],"sources":["../../src/components/accordion/accordion.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n type ComponentProps,\n type ElementType,\n} from \"react\";\nimport { Accordion as BaseAccordion } from \"@base-ui/react/accordion\";\nimport { cn } from \"../../utils/cn\";\n\n/** Override Base UI's `string | (state) => string` className with plain string. */\ntype StyledProps<T extends ElementType> = Omit<\n ComponentProps<T>,\n \"className\"\n> & {\n className?: string;\n};\n\nexport type AccordionSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * Three sizes, one step of the type scale apart. `lg` is photon.codes's\n * FAQ to the pixel: the question at 20/28, the answer at 18/28, 20px\n * above and below, 8px between. `md` and `sm` step the type, the\n * padding, and the gap down together; the chevron is the same small\n * glyph in the same 24px box at every size, so a row is never shorter\n * than it.\n */\nconst SIZE: Record<\n AccordionSize,\n { item: string; hit: string; question: string; gap: string; answer: string }\n> = {\n sm: {\n item: \"py-3\",\n hit: \"before:-top-3 before:-bottom-3\",\n question: \"text-base\",\n gap: \"pt-1 pb-1\",\n answer: \"text-xs\",\n },\n md: {\n item: \"py-4\",\n hit: \"before:-top-4 before:-bottom-4\",\n question: \"text-md\",\n gap: \"pt-1.5 pb-1.5\",\n answer: \"text-base\",\n },\n lg: {\n item: \"py-5\",\n hit: \"before:-top-5 before:-bottom-5\",\n question: \"text-xl leading-7\",\n gap: \"pt-2 pb-2\",\n answer: \"text-lg\",\n },\n};\n\nconst SizeContext = createContext<AccordionSize>(\"md\");\n\nexport interface AccordionRootProps extends StyledProps<\n typeof BaseAccordion.Root\n> {\n /** @default \"md\" */\n size?: AccordionSize;\n}\n\n/**\n * The list — bare, so the page decides the surface: on photon.codes the\n * FAQ card is the section's, 32px around the list; in a settings page it\n * is a `Card`. Items divide with a hairline and the list has no outer\n * lines. Items are independent, as on the site, so `multiple` is on\n * unless said otherwise.\n */\nfunction Root({\n className,\n multiple = true,\n size = \"md\",\n ...props\n}: AccordionRootProps) {\n return (\n <SizeContext.Provider value={size}>\n <BaseAccordion.Root\n multiple={multiple}\n data-size={size}\n className={cn(\"w-full\", className)}\n {...props}\n />\n </SizeContext.Provider>\n );\n}\n\n/**\n * One question, padded above and below, whatever is open inside. The\n * hairline under it overlaps the next item by its own pixel, the way\n * Framer draws a border inside the box, so an item advances by exactly\n * its padding and its rows: 68px at `lg`, the site's figure. The last\n * item draws none.\n */\nfunction Item({ className, ...props }: StyledProps<typeof BaseAccordion.Item>) {\n const size = useContext(SizeContext);\n return (\n <BaseAccordion.Item\n className={cn(\n \"border-pho-secondary -mb-px border-b last:mb-0 last:border-b-0\",\n SIZE[size].item,\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Header({\n className,\n ...props\n}: StyledProps<typeof BaseAccordion.Header>) {\n return <BaseAccordion.Header className={cn(\"flex\", className)} {...props} />;\n}\n\n/**\n * The question row: the question in medium with the chevron at the row's\n * end. The chevron is the site's small one (a 6.5×3.5 stroke in a 24px\n * box, weight 1.5) and the trigger wears it itself — pass only the\n * question. Open, the question settles to the description tone and the\n * chevron makes a half turn, both on the section spring; the chevron keeps\n * the primary ink. The whole item is the target, as on the site: the hit\n * area reaches through the item's padding above and below the row.\n */\nfunction Trigger({\n className,\n children,\n ...props\n}: StyledProps<typeof BaseAccordion.Trigger>) {\n const size = useContext(SizeContext);\n return (\n <BaseAccordion.Trigger\n className={cn(\n \"group/trigger text-pho-primary outline-pho-brand font-heading relative flex flex-1 cursor-pointer items-center justify-between gap-3 text-left font-medium\",\n \"ease-pho-spring-reveal data-[panel-open]:text-pho-description transition-colors duration-500\",\n \"focus-visible:outline-2 focus-visible:outline-offset-4\",\n \"before:absolute before:inset-x-0\",\n SIZE[size].question,\n SIZE[size].hit,\n className,\n )}\n {...props}\n >\n {children}\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={1.5}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n data-accordion-chevron=\"\"\n className=\"text-pho-primary ease-pho-spring-reveal size-6 shrink-0 transition-[rotate] duration-500 group-data-[panel-open]/trigger:rotate-180\"\n >\n <path d=\"M 6.5 0 L 3.25 3.5 L 0 0\" transform=\"translate(8.75 10.75)\" />\n </svg>\n </BaseAccordion.Trigger>\n );\n}\n\n/**\n * The answer: medium in the primary ink, one type step under the\n * question, a short gap below it. Opening, the panel's height rides the\n * section spring while the answer arrives 100ms later on the appear\n * spring, fading in as it rises 20px. Closing, the answer is gone at once\n * and the height settles on the section spring — the site's way round.\n */\nfunction Panel({\n className,\n children,\n ...props\n}: StyledProps<typeof BaseAccordion.Panel>) {\n const size = useContext(SizeContext);\n return (\n <BaseAccordion.Panel\n className={cn(\n \"group/panel ease-pho-spring-reveal h-[var(--accordion-panel-height)] overflow-hidden transition-[height] duration-500\",\n \"data-[ending-style]:h-0 data-[starting-style]:h-0\",\n className,\n )}\n {...props}\n >\n {/* The gap is symmetric: the panel clips, so the answer's last line\n needs room below it for a link's focus ring, not just above.\n The gap and the clip live on one wrapper, the rise on another:\n the panel measures its height from layout, and a translated\n child would count its 20px of overflow into that measure. */}\n <div className={cn(\"overflow-clip\", SIZE[size].gap)}>\n <div\n data-accordion-answer=\"\"\n className={cn(\n \"text-pho-primary font-medium tracking-[-0.1px]\",\n \"ease-pho-spring-appear transition-[opacity,translate] delay-100 duration-700\",\n \"group-data-[starting-style]/panel:translate-y-5 group-data-[starting-style]/panel:opacity-0\",\n \"group-data-[ending-style]/panel:opacity-0 group-data-[ending-style]/panel:transition-none\",\n SIZE[size].answer,\n )}\n >\n {children}\n </div>\n </div>\n </BaseAccordion.Panel>\n );\n}\n\n/**\n * Questions that each reveal an answer — photon.codes's FAQ, as a\n * component, built on Base UI `Accordion`. Each `Accordion.Item` needs a\n * `value`; control the open set with `value` / `onValueChange` or\n * `defaultValue`. Items are independent by default; `multiple={false}`\n * opens one at a time. Three sizes; `lg` is the site's.\n */\nexport const Accordion = { Root, Item, Header, Trigger, Panel };\n"],"mappings":";;;;;AA2BA,IAAMO,IAGF;AAAA,EACF,IAAI;AAAA,IACF,MAAM;AAAA,IACN,KAAK;AAAA,IACL,UAAU;AAAA,IACV,KAAK;AAAA,IACL,QAAQ;AAAA,EACV;AAAA,EACA,IAAI;AAAA,IACF,MAAM;AAAA,IACN,KAAK;AAAA,IACL,UAAU;AAAA,IACV,KAAK;AAAA,IACL,QAAQ;AAAA,EACV;AAAA,EACA,IAAI;AAAA,IACF,MAAM;AAAA,IACN,KAAK;AAAA,IACL,UAAU;AAAA,IACV,KAAK;AAAA,IACL,QAAQ;AAAA,EACV;AACF,GAEMC,IAAcN,EAA6B,IAAI;AAgBrD,SAASO,EAAK,EACZ,WAAAC,GACA,UAAAC,IAAW,IACX,MAAAC,IAAO,MACP,GAAGC,EAAA,GACkB;AACrB,SACE,gBAAAT,EAACI,EAAY,UAAb;AAAA,IAAsB,OAAOI;AAAA,IAC3B,UAAA,gBAAAR,EAACJ,EAAc,MAAf;AAAA,MACY,UAAAW;AAAA,MACV,aAAWC;AAAA,MACX,WAAWX,EAAG,UAAUS,CAAS;AAAA,MACjC,GAAIG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,qDACAS,CACF;AAAA,IACA,GAAIG;AAAA,IAOJ,UAAA,gBAAAT,EAAC,OAAD;AAAA,MAAK,WAAWH,EAAG,iBAAiBM,EAAKK,CAAA,EAAM,GAAG;AAAA,MAChD,UAAA,gBAAAR,EAAC,OAAD;AAAA,QACE,yBAAsB;AAAA,QACtB,WAAWH,EACT,kDACA,gFACA,+FACA,6FACAM,EAAKK,CAAA,EAAM,MACb;AAAA,QAEC,UAAAK;AAAA,MACE,CAAA;AAAA,IACF,CAAA;AAAA,EACc,CAAA;AAEzB;AASA,IAAaE,IAAY;AAAA,EAAE,MAAAV;AAAA,EAAM,MAAAK;AAAA,EAAM,QAAAC;AAAA,EAAQ,SAAAC;AAAA,EAAS,OAAAE;AAAM"}
|
package/package.json
CHANGED
package/src/styles/fonts.css
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* paths — the theme only references the family names.
|
|
15
15
|
*
|
|
16
16
|
* Roles: PolySans names things and labels actions (`font-heading`) — page,
|
|
17
|
-
* section, card, and step titles at
|
|
17
|
+
* section, card, and step titles at 450, the titles of fields and
|
|
18
18
|
* blocks (labels, legends, row labels, column headers), every row of the
|
|
19
19
|
* sidebar, and every button (Button, ButtonLink, toggles, toolbar and
|
|
20
20
|
* notification actions), each at the weight its slot already uses; the
|
package/src/styles/theme.css
CHANGED
|
@@ -163,40 +163,41 @@
|
|
|
163
163
|
--text-xl: 1.25rem;
|
|
164
164
|
--text-xl--line-height: 1.875rem;
|
|
165
165
|
|
|
166
|
-
/* Display sizes — headings run tight (lh 1.05–1.3)
|
|
167
|
-
|
|
166
|
+
/* Display sizes — headings run tight (lh 1.05–1.3) at 0 tracking: PolySans
|
|
167
|
+
at its own spacing, never pulled in. Use for titles; body copy stays on
|
|
168
|
+
text-*. */
|
|
168
169
|
--text-display-xs: 1.125rem;
|
|
169
170
|
--text-display-xs--line-height: 1.4625rem;
|
|
170
|
-
--text-display-xs--letter-spacing:
|
|
171
|
+
--text-display-xs--letter-spacing: 0em;
|
|
171
172
|
--text-display-sm: 1.25rem;
|
|
172
173
|
--text-display-sm--line-height: 1.625rem;
|
|
173
|
-
--text-display-sm--letter-spacing:
|
|
174
|
+
--text-display-sm--letter-spacing: 0em;
|
|
174
175
|
--text-display-base: 1.5rem;
|
|
175
176
|
--text-display-base--line-height: 1.95rem;
|
|
176
|
-
--text-display-base--letter-spacing:
|
|
177
|
+
--text-display-base--letter-spacing: 0em;
|
|
177
178
|
--text-display-md: 2rem;
|
|
178
179
|
--text-display-md--line-height: 2.4rem;
|
|
179
|
-
--text-display-md--letter-spacing:
|
|
180
|
+
--text-display-md--letter-spacing: 0em;
|
|
180
181
|
--text-display-lg: 2.5rem;
|
|
181
182
|
--text-display-lg--line-height: 2.75rem;
|
|
182
|
-
--text-display-lg--letter-spacing:
|
|
183
|
+
--text-display-lg--letter-spacing: 0em;
|
|
183
184
|
--text-display-xl: 3rem;
|
|
184
185
|
--text-display-xl--line-height: 3.15rem;
|
|
185
|
-
--text-display-xl--letter-spacing:
|
|
186
|
+
--text-display-xl--letter-spacing: 0em;
|
|
186
187
|
--text-display-2xl: 3.75rem;
|
|
187
188
|
--text-display-2xl--line-height: 3.9375rem;
|
|
188
|
-
--text-display-2xl--letter-spacing:
|
|
189
|
+
--text-display-2xl--letter-spacing: 0em;
|
|
189
190
|
|
|
190
191
|
/* ========================== Font weights ========================== */
|
|
191
192
|
/* CLOSED set — three stops only; nothing else generates a utility:
|
|
192
193
|
font-light (300) display/marketing lines · font-normal (400) body ·
|
|
193
|
-
font-medium (
|
|
194
|
-
|
|
195
|
-
use font-medium. */
|
|
194
|
+
font-medium (450) UI controls, headings, and hero slogans, in Geist and
|
|
195
|
+
PolySans alike: a step above Regular, not a jump to Medium or SemiBold.
|
|
196
|
+
font-semibold is gone — use font-medium. */
|
|
196
197
|
--font-weight-*: initial;
|
|
197
198
|
--font-weight-light: 300;
|
|
198
199
|
--font-weight-normal: 400;
|
|
199
|
-
--font-weight-medium:
|
|
200
|
+
--font-weight-medium: 450;
|
|
200
201
|
|
|
201
202
|
/* ============================= Radius ============================= */
|
|
202
203
|
/* CLOSED set — three stops + Tailwind's rounded-full for pills:
|