@cognitap/radiant 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -1
- package/dist/library/Popover.d.ts +44 -0
- package/dist/library/Popover.d.ts.map +1 -0
- package/dist/library/Popover.js +94 -0
- package/dist/library/Popover.js.map +1 -0
- package/dist/library/cn.d.ts.map +1 -1
- package/dist/library/cn.js +22 -2
- package/dist/library/cn.js.map +1 -1
- package/dist/library/index.d.ts +2 -0
- package/dist/library/index.d.ts.map +1 -1
- package/dist/library/index.js +1 -0
- package/dist/library/index.js.map +1 -1
- package/dist/library/internal/popover.d.ts +36 -0
- package/dist/library/internal/popover.d.ts.map +1 -0
- package/dist/library/internal/popover.js +45 -0
- package/dist/library/internal/popover.js.map +1 -0
- package/dist/library/react/usePopoverSurface.d.ts +10 -0
- package/dist/library/react/usePopoverSurface.d.ts.map +1 -0
- package/dist/library/react/usePopoverSurface.js +193 -0
- package/dist/library/react/usePopoverSurface.js.map +1 -0
- package/dist/library/styles.css +1 -1
- package/dist/library/themes/components.d.ts +18 -0
- package/dist/library/themes/components.d.ts.map +1 -1
- package/dist/library/themes/components.js +18 -0
- package/dist/library/themes/components.js.map +1 -1
- package/docs/architecture.md +6 -3
- package/docs/theming.md +1 -1
- package/package.json +1 -1
- package/src/Popover.tsx +201 -0
- package/src/cn.ts +22 -2
- package/src/index.ts +19 -0
- package/src/internal/popover.ts +66 -0
- package/src/react/usePopoverSurface.ts +207 -0
- package/src/themes/components.ts +18 -0
|
@@ -286,6 +286,24 @@ export declare const componentRegistry: {
|
|
|
286
286
|
readonly focusOffset: "css";
|
|
287
287
|
readonly focusStyle: "css";
|
|
288
288
|
};
|
|
289
|
+
readonly popover: {
|
|
290
|
+
readonly width: "css";
|
|
291
|
+
readonly padding: "css";
|
|
292
|
+
readonly gap: "css";
|
|
293
|
+
readonly radius: "css";
|
|
294
|
+
readonly cornerShape: "css";
|
|
295
|
+
readonly background: "css";
|
|
296
|
+
readonly color: "css";
|
|
297
|
+
readonly borderWidth: "css";
|
|
298
|
+
readonly borderStyle: "css";
|
|
299
|
+
readonly borderColor: "css";
|
|
300
|
+
readonly shadow: "css";
|
|
301
|
+
readonly backdropFilter: "css";
|
|
302
|
+
readonly focusColor: "css";
|
|
303
|
+
readonly focusWidth: "css";
|
|
304
|
+
readonly focusOffset: "css";
|
|
305
|
+
readonly focusStyle: "css";
|
|
306
|
+
};
|
|
289
307
|
readonly dialog: {
|
|
290
308
|
readonly width: "css";
|
|
291
309
|
readonly padding: "css";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/themes/components.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/themes/components.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgXpB,CAAA;AAEV,KAAK,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;AACxD,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,GAAG,MAAM,GAAG,CAAC,SAAS,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AAC5F,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,CAAC,IAAI,MAAM,OAAO,iBAAiB,CAAC,CAAC,EAAE;QAC/C,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAC7D,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACjC;KACF;CACF,CAAA;AAED,eAAO,MAAM,kBAAkB,EAW1B,QAAQ,CAAC,MAAM,CAAC,MAAM,OAAO,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;AAElG,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAIrF;AAED,wBAAgB,iBAAiB,CAAC,SAAS,GAAE,uBAA4B,EAAE,KAAK,UAAQ,8CAavF"}
|
|
@@ -287,6 +287,24 @@ export const componentRegistry = {
|
|
|
287
287
|
focusOffset: 'css',
|
|
288
288
|
focusStyle: 'css'
|
|
289
289
|
},
|
|
290
|
+
popover: {
|
|
291
|
+
width: 'css',
|
|
292
|
+
padding: 'css',
|
|
293
|
+
gap: 'css',
|
|
294
|
+
radius: 'css',
|
|
295
|
+
cornerShape: 'css',
|
|
296
|
+
background: 'css',
|
|
297
|
+
color: 'css',
|
|
298
|
+
borderWidth: 'css',
|
|
299
|
+
borderStyle: 'css',
|
|
300
|
+
borderColor: 'css',
|
|
301
|
+
shadow: 'css',
|
|
302
|
+
backdropFilter: 'css',
|
|
303
|
+
focusColor: 'css',
|
|
304
|
+
focusWidth: 'css',
|
|
305
|
+
focusOffset: 'css',
|
|
306
|
+
focusStyle: 'css'
|
|
307
|
+
},
|
|
290
308
|
dialog: {
|
|
291
309
|
width: 'css',
|
|
292
310
|
padding: 'css',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../../src/themes/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE;QACN,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE,KAAK;QAClB,kBAAkB,EAAE,KAAK;QACzB,MAAM,EAAE,KAAK;QACb,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,KAAK;QACd,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;QACf,aAAa,EAAE,KAAK;QACpB,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,aAAa,EAAE,KAAK;QACpB,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,KAAK;QACpB,SAAS,EAAE,SAAS;QACpB,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,KAAK;QAChB,UAAU,EAAE,QAAQ;QACpB,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,KAAK;QAClB,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,KAAK;QACjB,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE,KAAK;QAClB,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,KAAK;QAClB,UAAU,EAAE,KAAK;QACjB,aAAa,EAAE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AC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,SAAS,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CACpF,CACF;CACF,CAAC,CACH,CAC+F,CAAA;AAElG,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,GAAW;IAC5D,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC;QAAE,OAAO,SAAS,CAAA;IAC/D,MAAM,IAAI,GAAG,iBAAiB,CAAC,MAAwC,CAAC,CAAA;IACxE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAE,IAAkC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACxF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,YAAqC,EAAE,EAAE,KAAK,GAAG,KAAK;IACtF,MAAM,MAAM,GAA+C,EAAE,CAAA;IAC7D,KAAK,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACrE,MAAM,MAAM,GAAG,SAAS,CAAC,MAAuC,CAEnD,CAAA;QACb,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACxD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,CAAA;YAC3B,IAAI,KAAK,KAAK,SAAS;gBAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAA;iBAC5C,IAAI,KAAK;gBAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAA;QAC9C,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { kebabCase } from './tokens.js'\n\n/** Explicit component slots; omitted slots reset to CSS fallback semantics. */\nexport const componentRegistry = {\n button: {\n radius: 'css',\n radiusPressed: 'css',\n cornerShape: 'css',\n cornerShapePressed: 'css',\n height: 'css',\n heightSmall: 'css',\n heightLarge: 'css',\n padding: 'css',\n paddingSmall: 'css',\n paddingLarge: 'css',\n fontSize: 'css',\n fontSizeSmall: 'css',\n fontSizeLarge: 'css',\n fontWeight: 'weight',\n letterSpacing: 'css',\n shadow: 'css',\n shadowPressed: 'css',\n highlight: 'opacity',\n sheen: 'opacity',\n glow: 'css',\n backdrop: 'css',\n stateColor: 'css',\n hoverLayer: 'css',\n pressLayer: 'css',\n hoverLift: 'css',\n pressScale: 'number',\n pressShift: 'css',\n pressShiftX: 'css',\n borderWidth: 'css',\n borderColor: 'css',\n ghostShadow: 'css',\n ghostShadowPressed: 'css',\n focusColor: 'css',\n fontFamily: 'css',\n textTransform: 'css',\n borderStyle: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css',\n pressDuration: 'css',\n pressEase: 'css',\n releaseDuration: 'css',\n releaseEase: 'css',\n colorDuration: 'css',\n disabledOpacity: 'opacity'\n },\n link: {\n color: 'css',\n hoverColor: 'css',\n underlineOffset: 'css',\n decorationThickness: 'css',\n decorationThicknessHover: 'css',\n colorDuration: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n field: {\n gap: 'css',\n labelColor: 'css',\n labelSize: 'css',\n labelWeight: 'weight',\n descriptionColor: 'css',\n descriptionSize: 'css',\n errorColor: 'css',\n errorSize: 'css',\n requiredColor: 'css',\n disabledOpacity: 'opacity'\n },\n input: {\n height: 'css',\n padding: 'css',\n fontFamily: 'css',\n fontSize: 'css',\n fontWeight: 'weight',\n color: 'css',\n background: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n radius: 'css',\n cornerShape: 'css',\n shadow: 'css',\n placeholder: 'css',\n invalidBorder: 'css',\n disabledBackground: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n textarea: {\n minHeight: 'css',\n paddingBlock: 'css',\n padding: 'css',\n fontFamily: 'css',\n fontSize: 'css',\n fontWeight: 'weight',\n color: 'css',\n background: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n radius: 'css',\n cornerShape: 'css',\n shadow: 'css',\n placeholder: 'css',\n invalidBorder: 'css',\n disabledBackground: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n slider: {\n height: 'css',\n length: 'css',\n trackSize: 'css',\n trackRadius: 'css',\n trackColor: 'css',\n thumbSize: 'css',\n thumbRadius: 'css',\n thumbColor: 'css',\n thumbBorderWidth: 'css',\n thumbBorderColor: 'css',\n thumbShadow: 'css',\n cornerShape: 'css',\n invalidTrack: 'css',\n disabledTrack: 'css',\n disabledThumb: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n tabs: {\n gap: 'css',\n listGap: 'css',\n listRadius: 'css',\n listBackground: 'css',\n listPadding: 'css',\n triggerHeight: 'css',\n triggerPadding: 'css',\n triggerRadius: 'css',\n triggerBorderWidth: 'css',\n cornerShape: 'css',\n fontFamily: 'css',\n fontWeight: 'weight',\n fontSize: 'css',\n triggerColor: 'css',\n triggerBackground: 'css',\n triggerHoverBackground: 'css',\n triggerActiveBackground: 'css',\n triggerActiveColor: 'css',\n triggerActiveBorder: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css',\n disabledOpacity: 'opacity',\n contentRadius: 'css',\n contentPadding: 'css',\n contentColor: 'css',\n contentBackground: 'css'\n },\n combobox: {\n placeholder: 'css',\n height: 'css',\n padding: 'css',\n fontFamily: 'css',\n fontSize: 'css',\n fontWeight: 'weight',\n color: 'css',\n background: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n radius: 'css',\n cornerShape: 'css',\n shadow: 'css',\n focusColor: 'css',\n contentPadding: 'css',\n contentRadius: 'css',\n contentBackground: 'css',\n contentBackdropFilter: 'css',\n contentShadow: 'css',\n itemRadius: 'css',\n itemBackground: 'css',\n itemColor: 'css'\n },\n select: {\n height: 'css',\n padding: 'css',\n fontFamily: 'css',\n fontSize: 'css',\n fontWeight: 'weight',\n color: 'css',\n background: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n radius: 'css',\n cornerShape: 'css',\n shadow: 'css',\n focusColor: 'css',\n contentPadding: 'css',\n contentRadius: 'css',\n contentBackground: 'css',\n contentBackdropFilter: 'css',\n contentShadow: 'css',\n itemRadius: 'css',\n itemBackground: 'css',\n itemColor: 'css'\n },\n checkbox: {\n size: 'css',\n radius: 'css',\n cornerShape: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n background: 'css',\n checkedBackground: 'css',\n checkedBorder: 'css',\n mark: 'css',\n invalidBorder: 'css',\n gap: 'css',\n labelColor: 'css',\n labelSize: 'css',\n disabledBorder: 'css',\n disabledBackground: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n switch: {\n width: 'css',\n height: 'css',\n radius: 'css',\n cornerShape: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n background: 'css',\n checkedBackground: 'css',\n checkedBorder: 'css',\n thumb: 'css',\n checkedThumb: 'css',\n thumbRadius: 'css',\n invalidBorder: 'css',\n gap: 'css',\n labelColor: 'css',\n labelSize: 'css',\n disabledBorder: 'css',\n disabledBackground: 'css',\n disabledThumb: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n radio: {\n size: 'css',\n radius: 'css',\n cornerShape: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n background: 'css',\n checkedBackground: 'css',\n checkedBorder: 'css',\n mark: 'css',\n invalidBorder: 'css',\n labelGap: 'css',\n labelColor: 'css',\n labelSize: 'css',\n disabledBorder: 'css',\n disabledBackground: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n dialog: {\n width: 'css',\n padding: 'css',\n gap: 'css',\n radius: 'css',\n cornerShape: 'css',\n background: 'css',\n color: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n shadow: 'css',\n backdrop: 'css',\n backdropFilter: 'css',\n titleSize: 'css',\n titleWeight: 'weight',\n descriptionColor: 'css',\n descriptionSize: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n collapsible: {\n radius: 'css',\n cornerShape: 'css',\n background: 'css',\n color: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n padding: 'css',\n gap: 'css',\n contentColor: 'css',\n contentSize: 'css',\n duration: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n accordion: {\n gap: 'css'\n },\n card: {\n radius: 'css',\n cornerShape: 'css',\n background: 'css',\n color: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n padding: 'css',\n gap: 'css',\n headerGap: 'css',\n footerGap: 'css',\n shadow: 'css',\n titleSize: 'css',\n titleWeight: 'weight',\n descriptionColor: 'css',\n descriptionSize: 'css'\n },\n radioGroup: { gap: 'css' }\n} as const\n\ntype ValueKind = 'css' | 'weight' | 'number' | 'opacity'\ntype KindValue<T> = T extends 'css' ? string : T extends 'weight' ? string | number : number\nexport type ThemeComponentOverrides = {\n readonly [F in keyof typeof componentRegistry]?: {\n readonly [K in keyof (typeof componentRegistry)[F]]?: KindValue<\n (typeof componentRegistry)[F][K]\n >\n }\n}\n\nexport const componentVariables = Object.freeze(\n Object.fromEntries(\n Object.entries(componentRegistry).map(([family, keys]) => [\n family,\n Object.freeze(\n Object.fromEntries(\n Object.keys(keys).map(key => [key, `--rad-${kebabCase(family)}-${kebabCase(key)}`])\n )\n )\n ])\n )\n) as Readonly<Record<keyof typeof componentRegistry, Readonly<Record<string, `--rad-${string}`>>>>\n\nexport function componentValueKind(family: string, key: string): ValueKind | undefined {\n if (!Object.hasOwn(componentRegistry, family)) return undefined\n const keys = componentRegistry[family as keyof typeof componentRegistry]\n return Object.hasOwn(keys, key) ? (keys as Record<string, ValueKind>)[key] : undefined\n}\n\nexport function flattenComponents(overrides: ThemeComponentOverrides = {}, reset = false) {\n const result: Record<`--rad-${string}`, string | number> = {}\n for (const [family, variables] of Object.entries(componentVariables)) {\n const values = overrides[family as keyof ThemeComponentOverrides] as\n | Record<string, string | number | undefined>\n | undefined\n for (const [key, variable] of Object.entries(variables)) {\n const value = values?.[key]\n if (value !== undefined) result[variable] = value\n else if (reset) result[variable] = 'initial'\n }\n }\n return result\n}\n"]}
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../../src/themes/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE;QACN,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE,KAAK;QAClB,kBAAkB,EAAE,KAAK;QACzB,MAAM,EAAE,KAAK;QACb,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,KAAK;QACd,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;QACf,aAAa,EAAE,KAAK;QACpB,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,aAAa,EAAE,KAAK;QACpB,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,KAAK;QACpB,SAAS,EAAE,SAAS;QACpB,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE,KAAK;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C,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAE,IAAkC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACxF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,YAAqC,EAAE,EAAE,KAAK,GAAG,KAAK;IACtF,MAAM,MAAM,GAA+C,EAAE,CAAA;IAC7D,KAAK,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACrE,MAAM,MAAM,GAAG,SAAS,CAAC,MAAuC,CAEnD,CAAA;QACb,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACxD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,CAAA;YAC3B,IAAI,KAAK,KAAK,SAAS;gBAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAA;iBAC5C,IAAI,KAAK;gBAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAA;QAC9C,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { kebabCase } from './tokens.js'\n\n/** Explicit component slots; omitted slots reset to CSS fallback semantics. */\nexport const componentRegistry = {\n button: {\n radius: 'css',\n radiusPressed: 'css',\n cornerShape: 'css',\n cornerShapePressed: 'css',\n height: 'css',\n heightSmall: 'css',\n heightLarge: 'css',\n padding: 'css',\n paddingSmall: 'css',\n paddingLarge: 'css',\n fontSize: 'css',\n fontSizeSmall: 'css',\n fontSizeLarge: 'css',\n fontWeight: 'weight',\n letterSpacing: 'css',\n shadow: 'css',\n shadowPressed: 'css',\n highlight: 'opacity',\n sheen: 'opacity',\n glow: 'css',\n backdrop: 'css',\n stateColor: 'css',\n hoverLayer: 'css',\n pressLayer: 'css',\n hoverLift: 'css',\n pressScale: 'number',\n pressShift: 'css',\n pressShiftX: 'css',\n borderWidth: 'css',\n borderColor: 'css',\n ghostShadow: 'css',\n ghostShadowPressed: 'css',\n focusColor: 'css',\n fontFamily: 'css',\n textTransform: 'css',\n borderStyle: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css',\n pressDuration: 'css',\n pressEase: 'css',\n releaseDuration: 'css',\n releaseEase: 'css',\n colorDuration: 'css',\n disabledOpacity: 'opacity'\n },\n link: {\n color: 'css',\n hoverColor: 'css',\n underlineOffset: 'css',\n decorationThickness: 'css',\n decorationThicknessHover: 'css',\n colorDuration: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n field: {\n gap: 'css',\n labelColor: 'css',\n labelSize: 'css',\n labelWeight: 'weight',\n descriptionColor: 'css',\n descriptionSize: 'css',\n errorColor: 'css',\n errorSize: 'css',\n requiredColor: 'css',\n disabledOpacity: 'opacity'\n },\n input: {\n height: 'css',\n padding: 'css',\n fontFamily: 'css',\n fontSize: 'css',\n fontWeight: 'weight',\n color: 'css',\n background: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n radius: 'css',\n cornerShape: 'css',\n shadow: 'css',\n placeholder: 'css',\n invalidBorder: 'css',\n disabledBackground: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n textarea: {\n minHeight: 'css',\n paddingBlock: 'css',\n padding: 'css',\n fontFamily: 'css',\n fontSize: 'css',\n fontWeight: 'weight',\n color: 'css',\n background: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n radius: 'css',\n cornerShape: 'css',\n shadow: 'css',\n placeholder: 'css',\n invalidBorder: 'css',\n disabledBackground: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n slider: {\n height: 'css',\n length: 'css',\n trackSize: 'css',\n trackRadius: 'css',\n trackColor: 'css',\n thumbSize: 'css',\n thumbRadius: 'css',\n thumbColor: 'css',\n thumbBorderWidth: 'css',\n thumbBorderColor: 'css',\n thumbShadow: 'css',\n cornerShape: 'css',\n invalidTrack: 'css',\n disabledTrack: 'css',\n disabledThumb: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n tabs: {\n gap: 'css',\n listGap: 'css',\n listRadius: 'css',\n listBackground: 'css',\n listPadding: 'css',\n triggerHeight: 'css',\n triggerPadding: 'css',\n triggerRadius: 'css',\n triggerBorderWidth: 'css',\n cornerShape: 'css',\n fontFamily: 'css',\n fontWeight: 'weight',\n fontSize: 'css',\n triggerColor: 'css',\n triggerBackground: 'css',\n triggerHoverBackground: 'css',\n triggerActiveBackground: 'css',\n triggerActiveColor: 'css',\n triggerActiveBorder: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css',\n disabledOpacity: 'opacity',\n contentRadius: 'css',\n contentPadding: 'css',\n contentColor: 'css',\n contentBackground: 'css'\n },\n combobox: {\n placeholder: 'css',\n height: 'css',\n padding: 'css',\n fontFamily: 'css',\n fontSize: 'css',\n fontWeight: 'weight',\n color: 'css',\n background: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n radius: 'css',\n cornerShape: 'css',\n shadow: 'css',\n focusColor: 'css',\n contentPadding: 'css',\n contentRadius: 'css',\n contentBackground: 'css',\n contentBackdropFilter: 'css',\n contentShadow: 'css',\n itemRadius: 'css',\n itemBackground: 'css',\n itemColor: 'css'\n },\n select: {\n height: 'css',\n padding: 'css',\n fontFamily: 'css',\n fontSize: 'css',\n fontWeight: 'weight',\n color: 'css',\n background: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n radius: 'css',\n cornerShape: 'css',\n shadow: 'css',\n focusColor: 'css',\n contentPadding: 'css',\n contentRadius: 'css',\n contentBackground: 'css',\n contentBackdropFilter: 'css',\n contentShadow: 'css',\n itemRadius: 'css',\n itemBackground: 'css',\n itemColor: 'css'\n },\n checkbox: {\n size: 'css',\n radius: 'css',\n cornerShape: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n background: 'css',\n checkedBackground: 'css',\n checkedBorder: 'css',\n mark: 'css',\n invalidBorder: 'css',\n gap: 'css',\n labelColor: 'css',\n labelSize: 'css',\n disabledBorder: 'css',\n disabledBackground: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n switch: {\n width: 'css',\n height: 'css',\n radius: 'css',\n cornerShape: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n background: 'css',\n checkedBackground: 'css',\n checkedBorder: 'css',\n thumb: 'css',\n checkedThumb: 'css',\n thumbRadius: 'css',\n invalidBorder: 'css',\n gap: 'css',\n labelColor: 'css',\n labelSize: 'css',\n disabledBorder: 'css',\n disabledBackground: 'css',\n disabledThumb: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n radio: {\n size: 'css',\n radius: 'css',\n cornerShape: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n background: 'css',\n checkedBackground: 'css',\n checkedBorder: 'css',\n mark: 'css',\n invalidBorder: 'css',\n labelGap: 'css',\n labelColor: 'css',\n labelSize: 'css',\n disabledBorder: 'css',\n disabledBackground: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n popover: {\n width: 'css',\n padding: 'css',\n gap: 'css',\n radius: 'css',\n cornerShape: 'css',\n background: 'css',\n color: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n shadow: 'css',\n backdropFilter: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n dialog: {\n width: 'css',\n padding: 'css',\n gap: 'css',\n radius: 'css',\n cornerShape: 'css',\n background: 'css',\n color: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n shadow: 'css',\n backdrop: 'css',\n backdropFilter: 'css',\n titleSize: 'css',\n titleWeight: 'weight',\n descriptionColor: 'css',\n descriptionSize: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n collapsible: {\n radius: 'css',\n cornerShape: 'css',\n background: 'css',\n color: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n padding: 'css',\n gap: 'css',\n contentColor: 'css',\n contentSize: 'css',\n duration: 'css',\n focusColor: 'css',\n focusWidth: 'css',\n focusOffset: 'css',\n focusStyle: 'css'\n },\n accordion: {\n gap: 'css'\n },\n card: {\n radius: 'css',\n cornerShape: 'css',\n background: 'css',\n color: 'css',\n borderWidth: 'css',\n borderStyle: 'css',\n borderColor: 'css',\n padding: 'css',\n gap: 'css',\n headerGap: 'css',\n footerGap: 'css',\n shadow: 'css',\n titleSize: 'css',\n titleWeight: 'weight',\n descriptionColor: 'css',\n descriptionSize: 'css'\n },\n radioGroup: { gap: 'css' }\n} as const\n\ntype ValueKind = 'css' | 'weight' | 'number' | 'opacity'\ntype KindValue<T> = T extends 'css' ? string : T extends 'weight' ? string | number : number\nexport type ThemeComponentOverrides = {\n readonly [F in keyof typeof componentRegistry]?: {\n readonly [K in keyof (typeof componentRegistry)[F]]?: KindValue<\n (typeof componentRegistry)[F][K]\n >\n }\n}\n\nexport const componentVariables = Object.freeze(\n Object.fromEntries(\n Object.entries(componentRegistry).map(([family, keys]) => [\n family,\n Object.freeze(\n Object.fromEntries(\n Object.keys(keys).map(key => [key, `--rad-${kebabCase(family)}-${kebabCase(key)}`])\n )\n )\n ])\n )\n) as Readonly<Record<keyof typeof componentRegistry, Readonly<Record<string, `--rad-${string}`>>>>\n\nexport function componentValueKind(family: string, key: string): ValueKind | undefined {\n if (!Object.hasOwn(componentRegistry, family)) return undefined\n const keys = componentRegistry[family as keyof typeof componentRegistry]\n return Object.hasOwn(keys, key) ? (keys as Record<string, ValueKind>)[key] : undefined\n}\n\nexport function flattenComponents(overrides: ThemeComponentOverrides = {}, reset = false) {\n const result: Record<`--rad-${string}`, string | number> = {}\n for (const [family, variables] of Object.entries(componentVariables)) {\n const values = overrides[family as keyof ThemeComponentOverrides] as\n | Record<string, string | number | undefined>\n | undefined\n for (const [key, variable] of Object.entries(variables)) {\n const value = values?.[key]\n if (value !== undefined) result[variable] = value\n else if (reset) result[variable] = 'initial'\n }\n }\n return result\n}\n"]}
|
package/docs/architecture.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Architecture
|
|
2
2
|
|
|
3
|
-
How Radiant's
|
|
3
|
+
How Radiant's eighteen families fit together and why. Props are on the
|
|
4
4
|
[docs site](https://github.com/cognitap/radiant-docs); themes are in [theming](theming.md); springs are in
|
|
5
5
|
[motion](motion.md).
|
|
6
6
|
|
|
7
7
|
The families are Button, Link, Field, Input, Textarea, Select, Combobox, Checkbox, Switch, Slider, RadioGroup (with Radio),
|
|
8
|
-
Dialog, AlertDialog, Collapsible, Accordion, Tabs and Card. All ship in one package,
|
|
8
|
+
Dialog, AlertDialog, Popover, Collapsible, Accordion, Tabs and Card. All ship in one package,
|
|
9
9
|
`@cognitap/radiant`. Deep imports are unsupported.
|
|
10
10
|
|
|
11
11
|
## Native first
|
|
@@ -23,7 +23,7 @@ Each piece of behavior has one owner:
|
|
|
23
23
|
Why: the browser already gets keyboard, focus and form behavior right.
|
|
24
24
|
Radiant has no headless-library dependency. Select owns its themed listbox and
|
|
25
25
|
item focus, while a visually hidden native select supplies form semantics.
|
|
26
|
-
Select and
|
|
26
|
+
Select, Combobox and Popover use the local top layer, preserving theme and modal ancestry.
|
|
27
27
|
Combobox keeps DOM focus on its native input and submits the committed key through
|
|
28
28
|
a hidden text control. Search text never becomes a selection. Applications own async
|
|
29
29
|
requests, cancellation and selected labels; results never trigger selection.
|
|
@@ -106,6 +106,8 @@ host, never a wrapper:
|
|
|
106
106
|
| Input / Checkbox / Switch / Slider / Radio | Native `input` |
|
|
107
107
|
| Textarea | Native `textarea` |
|
|
108
108
|
| Select / SelectPortal / Combobox / ComboboxPortal | None; state / portal |
|
|
109
|
+
| Popover / PopoverPortal | None; state / portal |
|
|
110
|
+
| PopoverTrigger / PopoverClose / PopoverContent | Button's `button` / Button's `button` / `div` |
|
|
109
111
|
| SelectTrigger / SelectContent / SelectViewport / SelectItem | Button's `button` / `div` / `div` / `div` |
|
|
110
112
|
| ComboboxInput / ComboboxContent / ComboboxItem | Native `input` / `div` / `div` |
|
|
111
113
|
| ComboboxTrigger / ComboboxClear | Button's `button` |
|
|
@@ -155,6 +157,7 @@ may refuse it. No-op requests and prop syncs fire no callback.
|
|
|
155
157
|
| Combobox | `value` / `defaultValue`; `query` / `defaultQuery` | `onValueChange(string \| null)`; `onQueryChange(string)` | `null`; `''` |
|
|
156
158
|
| Tabs | `value` / `defaultValue` | `onValueChange(string)` | Initial value required |
|
|
157
159
|
| Dialog, AlertDialog, Collapsible | `open` / `defaultOpen` | `onOpenChange(boolean)` | `false` |
|
|
160
|
+
| Popover | `open` / `defaultOpen` | `onOpenChange(boolean)` | `false` |
|
|
158
161
|
| Accordion single | `value` / `defaultValue` | `onValueChange(string \| null)` | `null` |
|
|
159
162
|
| Accordion multiple | `value` / `defaultValue` | `onValueChange(string[])` | `[]` |
|
|
160
163
|
|
package/docs/theming.md
CHANGED
|
@@ -90,7 +90,7 @@ example, `components.button.radius` changes Button only, while
|
|
|
90
90
|
component never falls back to another component's override.
|
|
91
91
|
|
|
92
92
|
Component keys are grouped by family under `components`: `button`, `link`,
|
|
93
|
-
`field`, `input`, `textarea`, `slider`, `select`, `checkbox`, `switch`, `radio`, `radioGroup`, `dialog`, `collapsible`,
|
|
93
|
+
`field`, `input`, `textarea`, `slider`, `select`, `combobox`, `checkbox`, `switch`, `radio`, `radioGroup`, `dialog`, `popover`, `collapsible`,
|
|
94
94
|
`accordion`, `tabs` and `card`. Every key is listed in
|
|
95
95
|
[`src/themes/components.ts`](../src/themes/components.ts). Button-only fonts,
|
|
96
96
|
uppercase, shadows, squash and pressed shape belong under `components.button`.
|
package/package.json
CHANGED
package/src/Popover.tsx
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
useContext,
|
|
6
|
+
useId,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
type ComponentProps,
|
|
10
|
+
type ReactNode,
|
|
11
|
+
type RefObject
|
|
12
|
+
} from 'react'
|
|
13
|
+
import { createPortal } from 'react-dom'
|
|
14
|
+
import { Button, type ButtonProps, type ButtonRenderProps } from './Button.js'
|
|
15
|
+
import { cn } from './cn.js'
|
|
16
|
+
import { composeAction } from './internal/events.js'
|
|
17
|
+
import { joinIds } from './internal/ids.js'
|
|
18
|
+
import type { PopoverSide, PopoverAlign } from './internal/popover.js'
|
|
19
|
+
import { useControllableState } from './react/useControllableState.js'
|
|
20
|
+
import { useComposedRefs } from './react/useComposedRefs.js'
|
|
21
|
+
import { usePopoverSurface } from './react/usePopoverSurface.js'
|
|
22
|
+
import { useTransitionHost } from './motion/host.js'
|
|
23
|
+
import type { ThemeStyle } from './themes/defineTheme.js'
|
|
24
|
+
|
|
25
|
+
export type { PopoverSide, PopoverAlign } from './internal/popover.js'
|
|
26
|
+
export type PopoverProps = (
|
|
27
|
+
| { open: boolean; defaultOpen?: never }
|
|
28
|
+
| { open?: undefined; defaultOpen?: boolean }
|
|
29
|
+
) & {
|
|
30
|
+
onOpenChange?: (open: boolean) => void
|
|
31
|
+
children?: ReactNode
|
|
32
|
+
}
|
|
33
|
+
export type PopoverState = { open: boolean; setOpen: (open: boolean) => void; contentId: string }
|
|
34
|
+
type Context = PopoverState & {
|
|
35
|
+
trigger: HTMLButtonElement | null
|
|
36
|
+
setTrigger: (node: HTMLButtonElement | null) => void
|
|
37
|
+
content: RefObject<HTMLDivElement | null>
|
|
38
|
+
restoreFocus: RefObject<boolean>
|
|
39
|
+
close: (restore: boolean) => void
|
|
40
|
+
}
|
|
41
|
+
const PopoverContext = createContext<Context | null>(null)
|
|
42
|
+
export function usePopover(): PopoverState | null {
|
|
43
|
+
return useContext(PopoverContext)
|
|
44
|
+
}
|
|
45
|
+
function usePopoverContext() {
|
|
46
|
+
const value = useContext(PopoverContext)
|
|
47
|
+
if (!value) throw new Error('Popover parts must render inside Popover.')
|
|
48
|
+
return value
|
|
49
|
+
}
|
|
50
|
+
export function Popover({ open, defaultOpen, onOpenChange, children }: PopoverProps) {
|
|
51
|
+
const state = useControllableState({
|
|
52
|
+
name: 'Popover',
|
|
53
|
+
value: open,
|
|
54
|
+
defaultValue: defaultOpen,
|
|
55
|
+
initialValue: false,
|
|
56
|
+
onChange: onOpenChange
|
|
57
|
+
})
|
|
58
|
+
const contentId = useId()
|
|
59
|
+
const [trigger, setTrigger] = useState<HTMLButtonElement | null>(null)
|
|
60
|
+
const content = useRef<HTMLDivElement>(null)
|
|
61
|
+
const restoreFocus = useRef(true)
|
|
62
|
+
const setOpen = (next: boolean) => {
|
|
63
|
+
restoreFocus.current = true
|
|
64
|
+
state.request(next)
|
|
65
|
+
}
|
|
66
|
+
const close = (restore: boolean) => {
|
|
67
|
+
restoreFocus.current = restore
|
|
68
|
+
state.request(false)
|
|
69
|
+
}
|
|
70
|
+
return (
|
|
71
|
+
<PopoverContext.Provider
|
|
72
|
+
value={{
|
|
73
|
+
open: state.value,
|
|
74
|
+
setOpen,
|
|
75
|
+
contentId,
|
|
76
|
+
trigger,
|
|
77
|
+
setTrigger,
|
|
78
|
+
content,
|
|
79
|
+
restoreFocus,
|
|
80
|
+
close
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
{children}
|
|
84
|
+
</PopoverContext.Provider>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type PopoverTriggerProps = ButtonProps
|
|
89
|
+
export type PopoverCloseProps = ButtonProps
|
|
90
|
+
export type PopoverRenderProps = ButtonRenderProps
|
|
91
|
+
export type PopoverPortalProps = { children?: ReactNode }
|
|
92
|
+
export type PopoverContentProps = Omit<ComponentProps<'div'>, 'style' | 'popover' | 'id'> & {
|
|
93
|
+
style?: ThemeStyle
|
|
94
|
+
side?: PopoverSide
|
|
95
|
+
align?: PopoverAlign
|
|
96
|
+
sideOffset?: number
|
|
97
|
+
collisionPadding?: number
|
|
98
|
+
/** Keep focus on the opener by default; optionally focus a descendant on each open. */
|
|
99
|
+
initialFocusRef?: RefObject<HTMLElement | null>
|
|
100
|
+
motion?: 'inherit' | 'off'
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function PopoverTrigger({ ref, onClick, ...props }: PopoverTriggerProps) {
|
|
104
|
+
const popover = usePopoverContext()
|
|
105
|
+
const hostRef = useComposedRefs(popover.setTrigger, ref)
|
|
106
|
+
return (
|
|
107
|
+
<Button
|
|
108
|
+
{...props}
|
|
109
|
+
ref={hostRef}
|
|
110
|
+
popoverTarget={undefined}
|
|
111
|
+
popoverTargetAction={undefined}
|
|
112
|
+
aria-controls={popover.contentId}
|
|
113
|
+
aria-expanded={popover.open}
|
|
114
|
+
data-slot={joinIds('popover-trigger', props['data-slot'])}
|
|
115
|
+
onClick={composeAction(onClick, () => popover.setOpen(!popover.open))}
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
export function PopoverClose({ onClick, ...props }: PopoverCloseProps) {
|
|
120
|
+
const popover = usePopoverContext()
|
|
121
|
+
return (
|
|
122
|
+
<Button
|
|
123
|
+
{...props}
|
|
124
|
+
popoverTarget={undefined}
|
|
125
|
+
popoverTargetAction={undefined}
|
|
126
|
+
data-slot={joinIds('popover-close', props['data-slot'])}
|
|
127
|
+
onClick={composeAction(onClick, () => popover.close(true))}
|
|
128
|
+
/>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
/** The local portal preserves theme, native form ownership and modal ancestry. */
|
|
132
|
+
export function PopoverPortal({ children }: PopoverPortalProps) {
|
|
133
|
+
const popover = usePopoverContext()
|
|
134
|
+
return popover.trigger?.parentElement
|
|
135
|
+
? createPortal(children, popover.trigger.parentElement)
|
|
136
|
+
: null
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const surfaceClass = [
|
|
140
|
+
'fixed right-auto bottom-auto m-0 box-border min-w-0 overflow-auto overscroll-contain text-start antialiased',
|
|
141
|
+
'[&:not(:popover-open)]:hidden',
|
|
142
|
+
'left-[var(--_rad-popover-left,0px)] top-[var(--_rad-popover-top,0px)] w-[var(--rad-popover-width,20rem)] max-w-[var(--_rad-popover-max-width,calc(100vw-1rem))] max-h-[var(--_rad-popover-max-height,calc(100dvh-1rem))]',
|
|
143
|
+
'grid gap-[var(--rad-popover-gap,var(--rad-surface-gap,1rem))] p-[var(--rad-popover-padding,var(--rad-surface-padding,1.5rem))]',
|
|
144
|
+
'rounded-[var(--rad-popover-radius,var(--rad-surface-radius,0.75rem))] [corner-shape:var(--rad-popover-corner-shape,var(--rad-surface-corner-shape,round))]',
|
|
145
|
+
'[border-width:var(--rad-popover-border-width,var(--rad-surface-border-width,1px))] [border-style:var(--rad-popover-border-style,var(--rad-surface-border-style,solid))] [border-color:var(--rad-popover-border-color,var(--rad-color-border))]',
|
|
146
|
+
'bg-[var(--rad-popover-background,var(--rad-color-surface,white))] [color:var(--rad-popover-color,var(--rad-color-foreground))] [box-shadow:var(--rad-popover-shadow,var(--rad-surface-overlay-shadow,0_8px_32px_#0003))] [backdrop-filter:var(--rad-popover-backdrop-filter,none)]',
|
|
147
|
+
'font-[family-name:var(--rad-typography-roles-ui-body-family,system-ui,sans-serif)] text-[length:var(--rad-typography-roles-ui-body-size,0.875rem)] font-[number:var(--rad-typography-roles-ui-body-weight,400)] leading-[var(--rad-typography-roles-ui-body-line-height,1.5)] tracking-[var(--rad-typography-roles-ui-body-letter-spacing,-0.011em)]',
|
|
148
|
+
'focus-visible:outline-solid focus-visible:[outline-color:var(--rad-popover-focus-color,var(--rad-color-focus))] focus-visible:[outline-width:var(--rad-popover-focus-width,var(--rad-focus-width,2px))] focus-visible:[outline-offset:var(--rad-popover-focus-offset,var(--rad-focus-offset,2px))] focus-visible:[outline-style:var(--rad-popover-focus-style,var(--rad-focus-style,solid))]',
|
|
149
|
+
'transition-colors duration-[var(--rad-motion-color-duration,150ms)] motion-reduce:transition-none',
|
|
150
|
+
'forced-colors:border-[CanvasText] forced-colors:bg-[Canvas] forced-colors:text-[CanvasText]'
|
|
151
|
+
].join(' ')
|
|
152
|
+
|
|
153
|
+
export function PopoverContent({
|
|
154
|
+
ref,
|
|
155
|
+
className,
|
|
156
|
+
side = 'bottom',
|
|
157
|
+
align = 'start',
|
|
158
|
+
sideOffset = 8,
|
|
159
|
+
collisionPadding = 8,
|
|
160
|
+
initialFocusRef,
|
|
161
|
+
motion = 'inherit',
|
|
162
|
+
...props
|
|
163
|
+
}: PopoverContentProps) {
|
|
164
|
+
const popover = usePopoverContext()
|
|
165
|
+
if (![sideOffset, collisionPadding].every(value => Number.isFinite(value) && value >= 0))
|
|
166
|
+
throw new TypeError('Popover offsets and padding must be finite, nonnegative numbers.')
|
|
167
|
+
const hostRef = useComposedRefs(popover.content, ref)
|
|
168
|
+
const {
|
|
169
|
+
ref: transitionRef,
|
|
170
|
+
active: motionActive,
|
|
171
|
+
off: motionOff
|
|
172
|
+
} = useTransitionHost('popup', hostRef, motion === 'off')
|
|
173
|
+
usePopoverSurface(
|
|
174
|
+
popover.content,
|
|
175
|
+
popover.trigger,
|
|
176
|
+
popover.open,
|
|
177
|
+
popover.close,
|
|
178
|
+
popover.restoreFocus,
|
|
179
|
+
{ side, align, sideOffset, collisionPadding, initialFocusRef }
|
|
180
|
+
)
|
|
181
|
+
return (
|
|
182
|
+
<div
|
|
183
|
+
{...props}
|
|
184
|
+
ref={transitionRef}
|
|
185
|
+
id={popover.contentId}
|
|
186
|
+
popover="manual"
|
|
187
|
+
data-slot="popover-content"
|
|
188
|
+
data-state={popover.open ? 'open' : 'closed'}
|
|
189
|
+
data-side={side}
|
|
190
|
+
data-align={align}
|
|
191
|
+
data-motion={motion}
|
|
192
|
+
className={cn(
|
|
193
|
+
surfaceClass,
|
|
194
|
+
motionActive &&
|
|
195
|
+
!motionOff &&
|
|
196
|
+
'opacity-[var(--_rad-popup-enter,0)] motion-reduce:opacity-100',
|
|
197
|
+
className
|
|
198
|
+
)}
|
|
199
|
+
/>
|
|
200
|
+
)
|
|
201
|
+
}
|
package/src/cn.ts
CHANGED
|
@@ -39,9 +39,19 @@ export const cn: CnFunction = createCn({
|
|
|
39
39
|
'h-(--rad-slider-height)',
|
|
40
40
|
'h-(--rad-slider-length)'
|
|
41
41
|
],
|
|
42
|
-
w: [
|
|
42
|
+
w: [
|
|
43
|
+
'w-(--rad-popover-width)',
|
|
44
|
+
'w-(--rad-switch-width)',
|
|
45
|
+
'w-(--rad-slider-height)',
|
|
46
|
+
'w-(--rad-slider-length)'
|
|
47
|
+
],
|
|
43
48
|
size: ['size-(--rad-slider-thumb-size)', 'size-(--rad-slider-track-size)'],
|
|
44
|
-
gap: [
|
|
49
|
+
gap: [
|
|
50
|
+
'gap-(--rad-popover-gap)',
|
|
51
|
+
'gap-(--rad-switch-gap)',
|
|
52
|
+
'gap-(--rad-tabs-gap)',
|
|
53
|
+
'gap-(--rad-tabs-list-gap)'
|
|
54
|
+
],
|
|
45
55
|
'min-h': ['min-h-(--rad-textarea-min-height)', 'min-h-(--rad-tabs-trigger-height)'],
|
|
46
56
|
py: ['py-(--rad-textarea-padding-block)'],
|
|
47
57
|
px: [
|
|
@@ -51,12 +61,14 @@ export const cn: CnFunction = createCn({
|
|
|
51
61
|
'px-(--rad-tabs-trigger-padding)'
|
|
52
62
|
],
|
|
53
63
|
p: [
|
|
64
|
+
'p-(--rad-popover-padding)',
|
|
54
65
|
'p-(--rad-combobox-content-padding)',
|
|
55
66
|
'p-(--rad-select-content-padding)',
|
|
56
67
|
'p-(--rad-tabs-list-padding)',
|
|
57
68
|
'p-(--rad-tabs-content-padding)'
|
|
58
69
|
],
|
|
59
70
|
rounded: [
|
|
71
|
+
'rounded-(--rad-popover-radius)',
|
|
60
72
|
'rounded-(--rad-combobox-radius)',
|
|
61
73
|
'rounded-(--rad-select-radius)',
|
|
62
74
|
'rounded-(--rad-textarea-radius)',
|
|
@@ -73,6 +85,7 @@ export const cn: CnFunction = createCn({
|
|
|
73
85
|
'rounded-(--rad-tabs-content-radius)'
|
|
74
86
|
],
|
|
75
87
|
'border-w': [
|
|
88
|
+
'border-(--rad-popover-border-width)',
|
|
76
89
|
'border-(--rad-combobox-border-width)',
|
|
77
90
|
'border-(--rad-select-border-width)',
|
|
78
91
|
'border-(--rad-textarea-border-width)',
|
|
@@ -81,12 +94,14 @@ export const cn: CnFunction = createCn({
|
|
|
81
94
|
'border-(--rad-tabs-trigger-border-width)'
|
|
82
95
|
],
|
|
83
96
|
'border-style': [
|
|
97
|
+
'border-(--rad-popover-border-style)',
|
|
84
98
|
'border-(--rad-combobox-border-style)',
|
|
85
99
|
'border-(--rad-select-border-style)',
|
|
86
100
|
'border-(--rad-textarea-border-style)',
|
|
87
101
|
'border-(--rad-switch-border-style)'
|
|
88
102
|
],
|
|
89
103
|
shadow: [
|
|
104
|
+
'shadow-(--rad-popover-shadow)',
|
|
90
105
|
'shadow-(--rad-combobox-shadow)',
|
|
91
106
|
'shadow-(--rad-select-shadow)',
|
|
92
107
|
'shadow-(--rad-combobox-content-shadow)',
|
|
@@ -95,6 +110,7 @@ export const cn: CnFunction = createCn({
|
|
|
95
110
|
'shadow-(--rad-slider-thumb-shadow)'
|
|
96
111
|
],
|
|
97
112
|
'corner-shape': [
|
|
113
|
+
'[corner-shape:var(--rad-popover-corner-shape)]',
|
|
98
114
|
'[corner-shape:var(--rad-combobox-corner-shape)]',
|
|
99
115
|
'[corner-shape:var(--rad-select-corner-shape)]',
|
|
100
116
|
'[corner-shape:var(--rad-textarea-corner-shape)]',
|
|
@@ -103,18 +119,21 @@ export const cn: CnFunction = createCn({
|
|
|
103
119
|
'[corner-shape:var(--rad-tabs-corner-shape)]'
|
|
104
120
|
],
|
|
105
121
|
'outline-w': [
|
|
122
|
+
'outline-(--rad-popover-focus-width)',
|
|
106
123
|
'outline-(--rad-textarea-focus-width)',
|
|
107
124
|
'outline-(--rad-switch-focus-width)',
|
|
108
125
|
'outline-(--rad-slider-focus-width)',
|
|
109
126
|
'outline-(--rad-tabs-focus-width)'
|
|
110
127
|
],
|
|
111
128
|
'outline-offset': [
|
|
129
|
+
'outline-offset-(--rad-popover-focus-offset)',
|
|
112
130
|
'outline-offset-(--rad-textarea-focus-offset)',
|
|
113
131
|
'outline-offset-(--rad-switch-focus-offset)',
|
|
114
132
|
'outline-offset-(--rad-slider-focus-offset)',
|
|
115
133
|
'outline-offset-(--rad-tabs-focus-offset)'
|
|
116
134
|
],
|
|
117
135
|
'outline-style': [
|
|
136
|
+
'outline-(--rad-popover-focus-style)',
|
|
118
137
|
'outline-(--rad-textarea-focus-style)',
|
|
119
138
|
'outline-(--rad-switch-focus-style)',
|
|
120
139
|
'outline-(--rad-slider-focus-style)',
|
|
@@ -122,6 +141,7 @@ export const cn: CnFunction = createCn({
|
|
|
122
141
|
],
|
|
123
142
|
opacity: ['opacity-(--rad-tabs-disabled-opacity)'],
|
|
124
143
|
'backdrop-filter': [
|
|
144
|
+
'[backdrop-filter:var(--rad-popover-backdrop-filter)]',
|
|
125
145
|
'[backdrop-filter:var(--rad-combobox-content-backdrop-filter)]',
|
|
126
146
|
'[backdrop-filter:var(--rad-select-content-backdrop-filter)]'
|
|
127
147
|
],
|
package/src/index.ts
CHANGED
|
@@ -21,6 +21,25 @@ export type {
|
|
|
21
21
|
ComboboxStatusProps
|
|
22
22
|
} from './Combobox.js'
|
|
23
23
|
export { Button } from './Button.js'
|
|
24
|
+
export {
|
|
25
|
+
Popover,
|
|
26
|
+
PopoverTrigger,
|
|
27
|
+
PopoverContent,
|
|
28
|
+
PopoverClose,
|
|
29
|
+
PopoverPortal,
|
|
30
|
+
usePopover
|
|
31
|
+
} from './Popover.js'
|
|
32
|
+
export type {
|
|
33
|
+
PopoverProps,
|
|
34
|
+
PopoverState,
|
|
35
|
+
PopoverTriggerProps,
|
|
36
|
+
PopoverContentProps,
|
|
37
|
+
PopoverCloseProps,
|
|
38
|
+
PopoverPortalProps,
|
|
39
|
+
PopoverRenderProps,
|
|
40
|
+
PopoverSide,
|
|
41
|
+
PopoverAlign
|
|
42
|
+
} from './Popover.js'
|
|
24
43
|
export { Link } from './Link.js'
|
|
25
44
|
export type { LinkProps, LinkRenderProps, LinkVariant } from './Link.js'
|
|
26
45
|
export { Field, useField } from './Field.js'
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type PopoverSide = 'top' | 'right' | 'bottom' | 'left'
|
|
2
|
+
export type PopoverAlign = 'start' | 'center' | 'end'
|
|
3
|
+
|
|
4
|
+
type Rect = {
|
|
5
|
+
top: number
|
|
6
|
+
right: number
|
|
7
|
+
bottom: number
|
|
8
|
+
left: number
|
|
9
|
+
width: number
|
|
10
|
+
height: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Flip toward more space, constrain the surface, then shift within the visual viewport. */
|
|
14
|
+
export function positionPopover(input: {
|
|
15
|
+
anchor: Rect
|
|
16
|
+
width: number
|
|
17
|
+
height: number
|
|
18
|
+
viewport: { top: number; left: number; width: number; height: number }
|
|
19
|
+
side: PopoverSide
|
|
20
|
+
align: PopoverAlign
|
|
21
|
+
offset: number
|
|
22
|
+
padding: number
|
|
23
|
+
rtl: boolean
|
|
24
|
+
}) {
|
|
25
|
+
const { anchor, viewport, align, rtl } = input
|
|
26
|
+
const padding = Math.max(0, input.padding)
|
|
27
|
+
const offset = Math.max(0, input.offset)
|
|
28
|
+
const leftEdge = viewport.left + padding
|
|
29
|
+
const topEdge = viewport.top + padding
|
|
30
|
+
const rightEdge = Math.max(leftEdge, viewport.left + viewport.width - padding)
|
|
31
|
+
const bottomEdge = Math.max(topEdge, viewport.top + viewport.height - padding)
|
|
32
|
+
const room = {
|
|
33
|
+
top: Math.max(0, anchor.top - offset - topEdge),
|
|
34
|
+
right: Math.max(0, rightEdge - anchor.right - offset),
|
|
35
|
+
bottom: Math.max(0, bottomEdge - anchor.bottom - offset),
|
|
36
|
+
left: Math.max(0, anchor.left - offset - leftEdge)
|
|
37
|
+
}
|
|
38
|
+
const opposite = { top: 'bottom', bottom: 'top', left: 'right', right: 'left' } as const
|
|
39
|
+
let side = input.side
|
|
40
|
+
const vertical = side === 'top' || side === 'bottom'
|
|
41
|
+
const needed = vertical ? input.height : input.width
|
|
42
|
+
if (room[side] < needed && room[opposite[side]] > room[side]) side = opposite[side]
|
|
43
|
+
const maxWidth = Math.min(rightEdge - leftEdge, vertical ? Infinity : room[side])
|
|
44
|
+
const maxHeight = Math.min(bottomEdge - topEdge, vertical ? room[side] : Infinity)
|
|
45
|
+
const width = Math.min(Math.max(0, input.width), maxWidth)
|
|
46
|
+
const height = Math.min(Math.max(0, input.height), maxHeight)
|
|
47
|
+
const cross = (start: number, end: number, size: number, reverse: boolean) =>
|
|
48
|
+
align === 'center'
|
|
49
|
+
? (start + end - size) / 2
|
|
50
|
+
: (align === 'end') !== reverse
|
|
51
|
+
? end - size
|
|
52
|
+
: start
|
|
53
|
+
let left = vertical
|
|
54
|
+
? cross(anchor.left, anchor.right, width, rtl)
|
|
55
|
+
: side === 'right'
|
|
56
|
+
? anchor.right + offset
|
|
57
|
+
: anchor.left - offset - width
|
|
58
|
+
let top = vertical
|
|
59
|
+
? side === 'bottom'
|
|
60
|
+
? anchor.bottom + offset
|
|
61
|
+
: anchor.top - offset - height
|
|
62
|
+
: cross(anchor.top, anchor.bottom, height, false)
|
|
63
|
+
left = Math.max(leftEdge, Math.min(left, rightEdge - width))
|
|
64
|
+
top = Math.max(topEdge, Math.min(top, bottomEdge - height))
|
|
65
|
+
return { left, top, maxWidth, maxHeight, side, align }
|
|
66
|
+
}
|