@korzun/design 0.0.5 → 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.
Files changed (48) hide show
  1. package/AGENTS.md +5 -1
  2. package/dist/component/card/style.d.ts.map +1 -1
  3. package/dist/component/card/style.js +3 -1
  4. package/dist/component/card/style.js.map +1 -1
  5. package/dist/component/card-row/style.js +1 -1
  6. package/dist/component/card-row/style.js.map +1 -1
  7. package/dist/component/tag/index.d.ts +1 -1
  8. package/dist/component/tag/index.d.ts.map +1 -1
  9. package/dist/component/tag/index.js.map +1 -1
  10. package/dist/component/tag/style.d.ts +1 -1
  11. package/dist/component/tag/style.d.ts.map +1 -1
  12. package/dist/control/index.d.ts +1 -1
  13. package/dist/control/index.d.ts.map +1 -1
  14. package/dist/control/index.js +1 -1
  15. package/dist/control/index.js.map +1 -1
  16. package/dist/control/popover/index.d.ts +24 -8
  17. package/dist/control/popover/index.d.ts.map +1 -1
  18. package/dist/control/popover/index.js +60 -15
  19. package/dist/control/popover/index.js.map +1 -1
  20. package/dist/control/popover/position.d.ts +47 -0
  21. package/dist/control/popover/position.d.ts.map +1 -0
  22. package/dist/control/popover/position.js +29 -0
  23. package/dist/control/popover/position.js.map +1 -0
  24. package/dist/control/switch/style.d.ts.map +1 -1
  25. package/dist/control/switch/style.js +1 -3
  26. package/dist/control/switch/style.js.map +1 -1
  27. package/dist/theme/theme.d.ts +26 -0
  28. package/dist/theme/theme.d.ts.map +1 -1
  29. package/dist/theme/theme.js +41 -0
  30. package/dist/theme/theme.js.map +1 -1
  31. package/docs/component/card-row.md +11 -12
  32. package/docs/component/card.md +3 -3
  33. package/docs/component/metadata-list.md +1 -1
  34. package/docs/component/tag.md +26 -6
  35. package/docs/control/popover.md +41 -10
  36. package/docs/corners.md +4 -4
  37. package/docs/philosophy.md +1 -1
  38. package/docs/theme.md +5 -2
  39. package/docs/tokens.md +4 -3
  40. package/package.json +1 -1
  41. package/src/component/card/style.ts +3 -1
  42. package/src/component/card-row/style.ts +1 -1
  43. package/src/component/tag/index.tsx +1 -1
  44. package/src/control/index.ts +6 -1
  45. package/src/control/popover/index.tsx +77 -19
  46. package/src/control/popover/position.ts +66 -0
  47. package/src/control/switch/style.ts +1 -3
  48. package/src/theme/theme.ts +52 -0
package/AGENTS.md CHANGED
@@ -44,7 +44,11 @@ Every component exports its props type as `<Name>Props` (`ButtonProps`,
44
44
  sibling `style.ts`. Colours, spacing, font sizes, radii, shadows, and z-index
45
45
  all come from `theme.*`; use `applyTransparency(token, alpha)` for tints. No
46
46
  literal hex, px, or rem values, no inline `style={{…}}` with literals, and no
47
- other CSS-in-JS or Tailwind. See [theme](docs/theme.md).
47
+ other CSS-in-JS or Tailwind. See [theme](docs/theme.md). **Tags that report
48
+ state use a status tone**; label tones (`subject`, `author`, …) name
49
+ things. `status` is a legacy label tone despite its name; for a state use
50
+ `success`/`warning`/`danger`/`info`, or `neutral` when it carries no
51
+ meaning.
48
52
  2. **Corners follow depth.** On the page background use `lg`. Inside a card or
49
53
  modal use `md`. Inside one of those use `sm`. A flush child takes its
50
54
  parent's radius. Popovers, menus, and toasts use `md`, and their items `sm`.
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/component/card/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEnE,eAAO,MAAM,QAAQ;;oRAkElB,CAAC"}
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/component/card/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEnE,eAAO,MAAM,QAAQ;;oRAoElB,CAAC"}
@@ -2,7 +2,9 @@ import { createUseStyles } from '../../theme/index.js';
2
2
  export const useStyle = createUseStyles((theme) => ({
3
3
  root: {
4
4
  ...theme.recipe.card.shell,
5
- '&$small': { borderRadius: '9px' },
5
+ // A small card insets its content by 1px, so it is md + 1px: concentric with the
6
+ // md-cornered children (covers, rows) that sit flush inside it.
7
+ '&$small': { borderRadius: `calc(${theme.radius.md} + 1px)` },
6
8
  },
7
9
  header: {
8
10
  ...theme.recipe.card.header,
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/component/card/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAc,MAAM,sBAAsB,CAAC;AAEnE,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,KAAY,EAAE,EAAE,CAAC,CAAC;IACzD,IAAI,EAAE;QACJ,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK;QAC1B,SAAS,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE;KACnC;IACD,MAAM,EAAE;QACN,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;QAC3B,UAAU,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE;QACjD,aAAa,EAAE;YACb,iBAAiB,EAAE,MAAM;SAC1B;KACF;IACD,YAAY,EAAE;QACZ,OAAO,EAAE,MAAM;QACf,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE;KACpB;IACD,MAAM,EAAE;QACN,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;KAC5B;IACD,KAAK,EAAE;QACL,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,QAAQ;QACrC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE;QAC3B,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK;KAC9B;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE;QAC3B,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK;QAC7B,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE;KAC3B;IACD,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;IACvB,OAAO,EAAE;QACP,SAAS,EAAE;YACT,OAAO,EAAE,KAAK;SACf;QACD,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE;KACvC;IACD,UAAU,EAAE;QACV,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,UAAU;KACvB;IACD,YAAY,EAAE;QACZ,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,UAAU;QACtB,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE;KACpB;IACD,OAAO,EAAE;QACP,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,OAAO,EAAE,8BAA8B;QAC5C,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,aAAa,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE;KACnD;IACD,gBAAgB,EAAE;QAChB,SAAS,EAAE,cAAc;KAC1B;IACD,eAAe,EAAE;QACf,SAAS,EAAE,eAAe;KAC3B;IACD,SAAS,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;IAChC,SAAS,EAAE,EAAE;IACb,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE;CACV,CAAC,CAAC,CAAC","sourcesContent":["import { createUseStyles, type Theme } from '../../theme/index.js';\n\nexport const useStyle = createUseStyles((theme: Theme) => ({\n root: {\n ...theme.recipe.card.shell,\n '&$small': { borderRadius: '9px' },\n },\n header: {\n ...theme.recipe.card.header,\n '&$danger': { color: theme.color.danger.default },\n '&$collapsed': {\n borderBottomStyle: 'none',\n },\n },\n headerAction: {\n display: 'flex',\n gap: theme.space.sm,\n },\n footer: {\n ...theme.recipe.card.footer,\n },\n title: {\n fontWeight: theme.fontWeight.semibold,\n fontSize: theme.fontSize.md,\n color: theme.color.text.muted,\n },\n subTitle: {\n fontSize: theme.fontSize.xs,\n color: theme.color.text.faint,\n marginLeft: theme.space.xs,\n },\n spacer: { flexGrow: 1 },\n content: {\n '&$small': {\n padding: '1px',\n },\n '&$large': { padding: theme.space.xl },\n },\n titleGroup: {\n display: 'flex',\n alignItems: 'baseline',\n },\n titleWrapper: {\n display: 'flex',\n alignItems: 'baseline',\n gap: theme.space.xl,\n },\n chevron: {\n position: 'relative',\n top: '4.5px', // sub-pixel optical centering\n left: '1.5px',\n display: 'block',\n height: '20px',\n width: '20px',\n margin: '-6px',\n transition: `transform ${theme.transition.medium}`,\n },\n chevronCollapsed: {\n transform: 'rotate(0deg)',\n },\n chevronExpanded: {\n transform: 'rotate(90deg)',\n },\n clickable: { cursor: 'pointer' },\n collapsed: {},\n danger: {},\n small: {},\n large: {},\n}));\n"]}
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/component/card/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAc,MAAM,sBAAsB,CAAC;AAEnE,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,KAAY,EAAE,EAAE,CAAC,CAAC;IACzD,IAAI,EAAE;QACJ,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK;QAC1B,iFAAiF;QACjF,gEAAgE;QAChE,SAAS,EAAE,EAAE,YAAY,EAAE,QAAQ,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE;KAC9D;IACD,MAAM,EAAE;QACN,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;QAC3B,UAAU,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE;QACjD,aAAa,EAAE;YACb,iBAAiB,EAAE,MAAM;SAC1B;KACF;IACD,YAAY,EAAE;QACZ,OAAO,EAAE,MAAM;QACf,GAAG,EAAE,KAAK,CAAC,KA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AAE,SAAS,EAAE;IAChC,SAAS,EAAE,EAAE;IACb,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE;CACV,CAAC,CAAC,CAAC","sourcesContent":["import { createUseStyles, type Theme } from '../../theme/index.js';\n\nexport const useStyle = createUseStyles((theme: Theme) => ({\n root: {\n ...theme.recipe.card.shell,\n // A small card insets its content by 1px, so it is md + 1px: concentric with the\n // md-cornered children (covers, rows) that sit flush inside it.\n '&$small': { borderRadius: `calc(${theme.radius.md} + 1px)` },\n },\n header: {\n ...theme.recipe.card.header,\n '&$danger': { color: theme.color.danger.default },\n '&$collapsed': {\n borderBottomStyle: 'none',\n },\n },\n headerAction: {\n display: 'flex',\n gap: theme.space.sm,\n },\n footer: {\n ...theme.recipe.card.footer,\n },\n title: {\n fontWeight: theme.fontWeight.semibold,\n fontSize: theme.fontSize.md,\n color: theme.color.text.muted,\n },\n subTitle: {\n fontSize: theme.fontSize.xs,\n color: theme.color.text.faint,\n marginLeft: theme.space.xs,\n },\n spacer: { flexGrow: 1 },\n content: {\n '&$small': {\n padding: '1px',\n },\n '&$large': { padding: theme.space.xl },\n },\n titleGroup: {\n display: 'flex',\n alignItems: 'baseline',\n },\n titleWrapper: {\n display: 'flex',\n alignItems: 'baseline',\n gap: theme.space.xl,\n },\n chevron: {\n position: 'relative',\n top: '4.5px', // sub-pixel optical centering\n left: '1.5px',\n display: 'block',\n height: '20px',\n width: '20px',\n margin: '-6px',\n transition: `transform ${theme.transition.medium}`,\n },\n chevronCollapsed: {\n transform: 'rotate(0deg)',\n },\n chevronExpanded: {\n transform: 'rotate(90deg)',\n },\n clickable: { cursor: 'pointer' },\n collapsed: {},\n danger: {},\n small: {},\n large: {},\n}));\n"]}
@@ -4,7 +4,7 @@ export const useStyle = createUseStyles((theme) => ({
4
4
  ...theme.recipe.card.shell,
5
5
  backgroundColor: theme.color.bg.card,
6
6
  padding: '6px', // row-specific compact padding
7
- borderRadius: '12px', // row-specific 10px radius (not on theme scale)
7
+ // Corners come from recipe.card.shell (radius.lg): a row sits on the page background.
8
8
  },
9
9
  clickable: {
10
10
  cursor: 'pointer',
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/component/card-row/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAc,MAAM,sBAAsB,CAAC;AAEnE,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,KAAY,EAAE,EAAE,CAAC,CAAC;IACzD,IAAI,EAAE;QACJ,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK;QAC1B,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI;QACpC,OAAO,EAAE,KAAK,EAAE,+BAA+B;QAC/C,YAAY,EAAE,MAAM,EAAE,gDAAgD;KACvE;IACD,SAAS,EAAE;QACT,MAAM,EAAE,SAAS;KAClB;CACF,CAAC,CAAC,CAAC","sourcesContent":["import { createUseStyles, type Theme } from '../../theme/index.js';\n\nexport const useStyle = createUseStyles((theme: Theme) => ({\n root: {\n ...theme.recipe.card.shell,\n backgroundColor: theme.color.bg.card,\n padding: '6px', // row-specific compact padding\n borderRadius: '12px', // row-specific 10px radius (not on theme scale)\n },\n clickable: {\n cursor: 'pointer',\n },\n}));\n"]}
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/component/card-row/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAc,MAAM,sBAAsB,CAAC;AAEnE,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,KAAY,EAAE,EAAE,CAAC,CAAC;IACzD,IAAI,EAAE;QACJ,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK;QAC1B,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI;QACpC,OAAO,EAAE,KAAK,EAAE,+BAA+B;QAC/C,sFAAsF;KACvF;IACD,SAAS,EAAE;QACT,MAAM,EAAE,SAAS;KAClB;CACF,CAAC,CAAC,CAAC","sourcesContent":["import { createUseStyles, type Theme } from '../../theme/index.js';\n\nexport const useStyle = createUseStyles((theme: Theme) => ({\n root: {\n ...theme.recipe.card.shell,\n backgroundColor: theme.color.bg.card,\n padding: '6px', // row-specific compact padding\n // Corners come from recipe.card.shell (radius.lg): a row sits on the page background.\n },\n clickable: {\n cursor: 'pointer',\n },\n}));\n"]}
@@ -7,7 +7,7 @@ export interface TagProps {
7
7
  onClick?: () => void;
8
8
  /** `sm` renders a compact chip that fits within a normal text line height. Default `'md'`. */
9
9
  size?: 'sm' | 'md';
10
- /** Colour, from the theme's `color.chip` tokens (default `'subject'`). `neutral` is a quiet grey. */
10
+ /** Colour, from the theme's `color.chip` tokens. Status tones (`success`, `warning`, `danger`, `info`, `neutral`) report state; label tones (the rest) name a kind of thing. `status` is a legacy label tone despite its name; for a state use `success`/`warning`/`danger`/`info`, or `neutral` when it carries no meaning. Default `subject`. */
11
11
  tone?: TagTone;
12
12
  }
13
13
  /** A small coloured chip for a category, status, or value. Optionally clickable. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/component/tag/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAY,MAAM,YAAY,CAAC;AAEpD,YAAY,EAAE,OAAO,EAAE,CAAC;AAExB,MAAM,WAAW,QAAQ;IACvB,iBAAiB;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,8FAA8F;IAC9F,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,qGAAqG;IACrG,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,oFAAoF;AACpF,eAAO,MAAM,GAAG,sCAA0D,QAAQ,gCA2BjF,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/component/tag/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAY,MAAM,YAAY,CAAC;AAEpD,YAAY,EAAE,OAAO,EAAE,CAAC;AAExB,MAAM,WAAW,QAAQ;IACvB,iBAAiB;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,8FAA8F;IAC9F,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,mVAAmV;IACnV,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,oFAAoF;AACpF,eAAO,MAAM,GAAG,sCAA0D,QAAQ,gCA2BjF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/component/tag/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAgB,QAAQ,EAAE,MAAM,YAAY,CAAC;AAepD,oFAAoF;AACpF,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,SAAS,EAAY,EAAE,EAAE;IACpF,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,EACrB,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,EAAE,EACzB,OAAO,KAAK,SAAS,IAAI,KAAK,CAAC,SAAS,CACzC,EACD,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAClD,QAAQ,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAC/C,SAAS,EACP,OAAO,KAAK,SAAS;YACnB,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE;gBACJ,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;oBACvC,CAAC,CAAC,cAAc,EAAE,CAAC;oBACnB,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC;YACH,CAAC,CAAC,SAAS,YAGd,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import cx from 'classnames';\n\nimport { type TagTone, useStyle } from './style.js';\n\nexport type { TagTone };\n\nexport interface TagProps {\n /** The label. */\n children: React.ReactNode;\n /** Makes it a button (focusable, Enter/Space, pointer cursor). Receives no event. */\n onClick?: () => void;\n /** `sm` renders a compact chip that fits within a normal text line height. Default `'md'`. */\n size?: 'sm' | 'md';\n /** Colour, from the theme's `color.chip` tokens (default `'subject'`). `neutral` is a quiet grey. */\n tone?: TagTone;\n}\n\n/** A small coloured chip for a category, status, or value. Optionally clickable. */\nexport const Tag = ({ children, onClick, size = 'md', tone = 'subject' }: TagProps) => {\n const style = useStyle();\n return (\n <span\n className={cx(\n style.root,\n style[`tone-${tone}`],\n size === 'sm' && style.sm,\n onClick !== undefined && style.clickable\n )}\n onClick={onClick}\n role={onClick !== undefined ? 'button' : undefined}\n tabIndex={onClick !== undefined ? 0 : undefined}\n onKeyDown={\n onClick !== undefined\n ? (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick();\n }\n }\n : undefined\n }\n >\n {children}\n </span>\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/component/tag/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAgB,QAAQ,EAAE,MAAM,YAAY,CAAC;AAepD,oFAAoF;AACpF,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,SAAS,EAAY,EAAE,EAAE;IACpF,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,EACrB,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,EAAE,EACzB,OAAO,KAAK,SAAS,IAAI,KAAK,CAAC,SAAS,CACzC,EACD,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAClD,QAAQ,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAC/C,SAAS,EACP,OAAO,KAAK,SAAS;YACnB,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE;gBACJ,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;oBACvC,CAAC,CAAC,cAAc,EAAE,CAAC;oBACnB,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC;YACH,CAAC,CAAC,SAAS,YAGd,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import cx from 'classnames';\n\nimport { type TagTone, useStyle } from './style.js';\n\nexport type { TagTone };\n\nexport interface TagProps {\n /** The label. */\n children: React.ReactNode;\n /** Makes it a button (focusable, Enter/Space, pointer cursor). Receives no event. */\n onClick?: () => void;\n /** `sm` renders a compact chip that fits within a normal text line height. Default `'md'`. */\n size?: 'sm' | 'md';\n /** Colour, from the theme's `color.chip` tokens. Status tones (`success`, `warning`, `danger`, `info`, `neutral`) report state; label tones (the rest) name a kind of thing. `status` is a legacy label tone despite its name; for a state use `success`/`warning`/`danger`/`info`, or `neutral` when it carries no meaning. Default `subject`. */\n tone?: TagTone;\n}\n\n/** A small coloured chip for a category, status, or value. Optionally clickable. */\nexport const Tag = ({ children, onClick, size = 'md', tone = 'subject' }: TagProps) => {\n const style = useStyle();\n return (\n <span\n className={cx(\n style.root,\n style[`tone-${tone}`],\n size === 'sm' && style.sm,\n onClick !== undefined && style.clickable\n )}\n onClick={onClick}\n role={onClick !== undefined ? 'button' : undefined}\n tabIndex={onClick !== undefined ? 0 : undefined}\n onKeyDown={\n onClick !== undefined\n ? (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick();\n }\n }\n : undefined\n }\n >\n {children}\n </span>\n );\n};\n"]}
@@ -2,5 +2,5 @@ import { type Theme } from '../../theme/index.js';
2
2
  export type TagTone = keyof Theme['color']['chip'];
3
3
  export declare const useStyle: (data?: {
4
4
  theme?: Theme | undefined;
5
- } | undefined) => import("jss").Classes<"clickable" | "root" | "sm" | "tone-author" | "tone-book" | "tone-entryType" | "tone-neutral" | "tone-rating" | "tone-series" | "tone-status" | "tone-subject" | "tone-user">;
5
+ } | undefined) => import("jss").Classes<"clickable" | "root" | "sm" | "tone-author" | "tone-book" | "tone-danger" | "tone-entryType" | "tone-info" | "tone-neutral" | "tone-rating" | "tone-series" | "tone-status" | "tone-subject" | "tone-success" | "tone-user" | "tone-warning">;
6
6
  //# sourceMappingURL=style.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/component/tag/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGnE,MAAM,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAwBnD,eAAO,MAAM,QAAQ;;qNAoBlB,CAAC"}
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/component/tag/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGnE,MAAM,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAwBnD,eAAO,MAAM,QAAQ;;qRAoBlB,CAAC"}
@@ -8,7 +8,7 @@ export { NumberInput, type NumberInputProps } from './number-input/index.js';
8
8
  export { PageActionsBar, type PageActionsBarProps } from './page-actions-bar/index.js';
9
9
  export { PageActionsMenu, type PageActionIntentProps, type PageActionItem, type PageActionsMenuProps, } from './page-actions-menu/index.js';
10
10
  export { PageFooterActions, type FooterAction, type PageFooterActionsProps, } from './page-footer-actions/index.js';
11
- export { Popover, type PopoverProps } from './popover/index.js';
11
+ export { Popover, type PopoverAlign, type PopoverProps, type PopoverSide, } from './popover/index.js';
12
12
  export { Select, type SelectOption, type SelectProps } from './select/index.js';
13
13
  export { SegmentedControl, type SegmentedControlProps, type SegmentedOption, } from './segmented-control/index.js';
14
14
  export { Switch, type SwitchProps, type SwitchRadiusValue } from './switch/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/control/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EACL,MAAM,EACN,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,QAAQ,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EA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  export { PageActionsMenu, } from './page-actions-menu/index.js';
10
10
  export { PageFooterActions, } from './page-footer-actions/index.js';
11
- export { Popover } from './popover/index.js';
11
+ export { Popover, } from './popover/index.js';
12
12
  export { Select } from './select/index.js';
13
13
  export { SegmentedControl, } from './segmented-control/index.js';
14
14
  export { Switch } from './switch/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/control/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwB,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EACL,MAAM,GAIP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAwC,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,YAAY,EAA0B,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,aAAa,EAA2B,MAAM,4BAA4B,CAAC;AACpF,OAAO,EACL,SAAS,GAIV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAyB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAA4B,MAAM,6BAA6B,CAAC;AACvF,OAAO,EACL,eAAe,GAIhB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,iBAAiB,GAGlB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,OAAO,EAAqB,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAuC,MAAM,mBAAmB,CAAC;AAChF,OAAO,EACL,gBAAgB,GAGjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAA4C,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAsB,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,SAAS,EAA6C,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["export { BackButton, type BackButtonProps } from './back-button/index.js';\nexport {\n Button,\n type ButtonProps,\n type ButtonRadiusValue,\n type ButtonTypeValue,\n} from './button/index.js';\nexport { ChipsInput, type ChipColor, type ChipsInputProps } from './chips-input/index.js';\nexport { ConfirmModal, type ConfirmModalProps } from './confirm-modal/index.js';\nexport { DateTimeInput, type DateTimeInputProps } from './date-time-input/index.js';\nexport {\n FieldList,\n type ColumnDescriptor,\n type FieldListProps,\n type FieldRow,\n} from './field-list/index.js';\nexport { NumberInput, type NumberInputProps } from './number-input/index.js';\nexport { PageActionsBar, type PageActionsBarProps } from './page-actions-bar/index.js';\nexport {\n PageActionsMenu,\n type PageActionIntentProps,\n type PageActionItem,\n type PageActionsMenuProps,\n} from './page-actions-menu/index.js';\nexport {\n PageFooterActions,\n type FooterAction,\n type PageFooterActionsProps,\n} from './page-footer-actions/index.js';\nexport { Popover, type PopoverProps } from './popover/index.js';\nexport { Select, type SelectOption, type SelectProps } from './select/index.js';\nexport {\n SegmentedControl,\n type SegmentedControlProps,\n type SegmentedOption,\n} from './segmented-control/index.js';\nexport { Switch, type SwitchProps, type SwitchRadiusValue } from './switch/index.js';\nexport { TextArea, type TextAreaProps } from './text-area/index.js';\nexport { TextInput, type TextInputAction, type TextInputProps } from './text-input/index.js';\nexport { useModalDialog } from './use-modal-dialog/index.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/control/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwB,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EACL,MAAM,GAIP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAwC,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,YAAY,EAA0B,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,aAAa,EAA2B,MAAM,4BAA4B,CAAC;AACpF,OAAO,EACL,SAAS,GAIV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAyB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAA4B,MAAM,6BAA6B,CAAC;AACvF,OAAO,EACL,eAAe,GAIhB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,iBAAiB,GAGlB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,OAAO,GAIR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAuC,MAAM,mBAAmB,CAAC;AAChF,OAAO,EACL,gBAAgB,GAGjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAA4C,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAsB,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,SAAS,EAA6C,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["export { BackButton, type BackButtonProps } from './back-button/index.js';\nexport {\n Button,\n type ButtonProps,\n type ButtonRadiusValue,\n type ButtonTypeValue,\n} from './button/index.js';\nexport { ChipsInput, type ChipColor, type ChipsInputProps } from './chips-input/index.js';\nexport { ConfirmModal, type ConfirmModalProps } from './confirm-modal/index.js';\nexport { DateTimeInput, type DateTimeInputProps } from './date-time-input/index.js';\nexport {\n FieldList,\n type ColumnDescriptor,\n type FieldListProps,\n type FieldRow,\n} from './field-list/index.js';\nexport { NumberInput, type NumberInputProps } from './number-input/index.js';\nexport { PageActionsBar, type PageActionsBarProps } from './page-actions-bar/index.js';\nexport {\n PageActionsMenu,\n type PageActionIntentProps,\n type PageActionItem,\n type PageActionsMenuProps,\n} from './page-actions-menu/index.js';\nexport {\n PageFooterActions,\n type FooterAction,\n type PageFooterActionsProps,\n} from './page-footer-actions/index.js';\nexport {\n Popover,\n type PopoverAlign,\n type PopoverProps,\n type PopoverSide,\n} from './popover/index.js';\nexport { Select, type SelectOption, type SelectProps } from './select/index.js';\nexport {\n SegmentedControl,\n type SegmentedControlProps,\n type SegmentedOption,\n} from './segmented-control/index.js';\nexport { Switch, type SwitchProps, type SwitchRadiusValue } from './switch/index.js';\nexport { TextArea, type TextAreaProps } from './text-area/index.js';\nexport { TextInput, type TextInputAction, type TextInputProps } from './text-input/index.js';\nexport { useModalDialog } from './use-modal-dialog/index.js';\n"]}
@@ -1,6 +1,8 @@
1
1
  import { ReactNode, RefObject } from 'react';
2
+ import { type PopoverAlign, type PopoverSide } from './position.js';
3
+ export type { PopoverAlign, PopoverSide } from './position.js';
2
4
  export type PopoverProps = {
3
- /** Element the popover aligns to (positioned directly beneath it). */
5
+ /** Element the popover aligns to (placed below or above it, per `side`). */
4
6
  anchorRef: RefObject<HTMLElement | null>;
5
7
  /** Whether the popover is rendered. */
6
8
  open: boolean;
@@ -8,23 +10,37 @@ export type PopoverProps = {
8
10
  children: ReactNode;
9
11
  /** Applied to the fixed wrapper; win specificity with `'&&'`, never `!important`. */
10
12
  className?: string;
11
- /** Vertical gap between the anchor and the popover, in pixels. */
13
+ /** Vertical gap between the anchor and the popover, in pixels; also the viewport edge margin when `matchWidth` is false. */
12
14
  gap?: number;
13
15
  /** Match the popover width to the anchor width (default true). */
14
16
  matchWidth?: boolean;
17
+ /** Preferred side; flips to the other side when this one has no room. */
18
+ side?: PopoverSide;
19
+ /** Horizontal alignment to the anchor's left edge, centre, or right edge. */
20
+ align?: PopoverAlign;
15
21
  /**
16
- * Called on a pointer-down outside both the anchor and the popover content.
17
- * Omit to opt out of outside-close handling.
22
+ * Called on a pointer-down outside both the anchor and the popover content,
23
+ * and on an Escape keydown no control has already handled. Omit to opt out.
18
24
  */
19
25
  onClose?: () => void;
20
26
  };
21
27
  /**
22
28
  * Renders `children` in a portal on `document.body`, positioned with `fixed`
23
- * coordinates directly under `anchorRef`. This lets dropdowns escape ancestors
24
- * that clip overflow (e.g. cards with rounded corners) without those ancestors
29
+ * coordinates against `anchorRef`. This lets dropdowns escape ancestors that
30
+ * clip overflow (e.g. cards with rounded corners) without those ancestors
25
31
  * having to opt out of clipping.
26
32
  *
27
- * No Escape handling or focus management, and it never flips above the anchor.
33
+ * Opens on `side` (default below) and flips when that side has no room; aligns
34
+ * per `align` and clamps horizontally to the viewport (only without
35
+ * `matchWidth`). The wrapper carries `data-side` with the side actually used.
36
+ * On the top side it is anchored by CSS `bottom`, so it stays attached as its
37
+ * content changes height. The first render is transparent (`opacity: 0`, still
38
+ * focusable) until measured, then it re-measures on scroll (capture phase),
39
+ * window resize, and content resize (`ResizeObserver`, where available).
40
+ *
41
+ * With `onClose`, Escape closes it unless the keydown was already
42
+ * `defaultPrevented`; it calls `preventDefault` so an enclosing `<dialog>`
43
+ * does not also cancel. No focus management.
28
44
  */
29
- export declare const Popover: ({ anchorRef, open, children, className, gap, matchWidth, onClose, }: PopoverProps) => import("react").ReactPortal | null;
45
+ export declare const Popover: ({ anchorRef, open, children, className, gap, matchWidth, side, align, onClose, }: PopoverProps) => import("react").ReactPortal | null;
30
46
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/control/popover/index.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,SAAS,EAMV,MAAM,OAAO,CAAC;AAOf,MAAM,MAAM,YAAY,GAAG;IACzB,sEAAsE;IACtE,SAAS,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACzC,uCAAuC;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,oEAAoE;IACpE,QAAQ,EAAE,SAAS,CAAC;IACpB,qFAAqF;IACrF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,wEAQjB,YAAY,uCAqDd,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/control/popover/index.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,SAAS,EAMV,MAAM,OAAO,CAAC;AAGf,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAGvB,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE/D,MAAM,MAAM,YAAY,GAAG;IACzB,4EAA4E;IAC5E,SAAS,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACzC,uCAAuC;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,oEAAoE;IACpE,QAAQ,EAAE,SAAS,CAAC;IACpB,qFAAqF;IACrF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4HAA4H;IAC5H,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yEAAyE;IACzE,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,OAAO,qFAUjB,YAAY,uCAyFd,CAAC"}
@@ -2,26 +2,50 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import cx from 'classnames';
3
3
  import { useCallback, useEffect, useLayoutEffect, useRef, useState, } from 'react';
4
4
  import { createPortal } from 'react-dom';
5
+ import { computePosition, } from './position.js';
5
6
  import { useStyle } from './style.js';
6
7
  /**
7
8
  * Renders `children` in a portal on `document.body`, positioned with `fixed`
8
- * coordinates directly under `anchorRef`. This lets dropdowns escape ancestors
9
- * that clip overflow (e.g. cards with rounded corners) without those ancestors
9
+ * coordinates against `anchorRef`. This lets dropdowns escape ancestors that
10
+ * clip overflow (e.g. cards with rounded corners) without those ancestors
10
11
  * having to opt out of clipping.
11
12
  *
12
- * No Escape handling or focus management, and it never flips above the anchor.
13
+ * Opens on `side` (default below) and flips when that side has no room; aligns
14
+ * per `align` and clamps horizontally to the viewport (only without
15
+ * `matchWidth`). The wrapper carries `data-side` with the side actually used.
16
+ * On the top side it is anchored by CSS `bottom`, so it stays attached as its
17
+ * content changes height. The first render is transparent (`opacity: 0`, still
18
+ * focusable) until measured, then it re-measures on scroll (capture phase),
19
+ * window resize, and content resize (`ResizeObserver`, where available).
20
+ *
21
+ * With `onClose`, Escape closes it unless the keydown was already
22
+ * `defaultPrevented`; it calls `preventDefault` so an enclosing `<dialog>`
23
+ * does not also cancel. No focus management.
13
24
  */
14
- export const Popover = ({ anchorRef, open, children, className, gap = 4, matchWidth = true, onClose, }) => {
25
+ export const Popover = ({ anchorRef, open, children, className, gap = 4, matchWidth = true, side = 'bottom', align = 'start', onClose, }) => {
15
26
  const style = useStyle();
16
27
  const contentRef = useRef(null);
17
- const [position, setPosition] = useState(null);
28
+ const [placement, setPlacement] = useState(null);
18
29
  const updatePosition = useCallback(() => {
19
30
  const anchor = anchorRef.current;
20
- if (!anchor)
31
+ const content = contentRef.current;
32
+ if (!anchor || !content)
21
33
  return;
22
34
  const rect = anchor.getBoundingClientRect();
23
- setPosition({ top: rect.bottom + gap, left: rect.left, width: rect.width });
24
- }, [anchorRef, gap]);
35
+ // Measure at the width it will render with, so wrapped height is right.
36
+ if (matchWidth)
37
+ content.style.width = `${rect.width}px`;
38
+ const size = content.getBoundingClientRect();
39
+ setPlacement(computePosition({
40
+ anchor: rect,
41
+ content: { width: size.width, height: size.height },
42
+ viewport: { width: window.innerWidth, height: window.innerHeight },
43
+ side,
44
+ align,
45
+ gap,
46
+ matchWidth,
47
+ }));
48
+ }, [anchorRef, gap, matchWidth, side, align]);
25
49
  useLayoutEffect(() => {
26
50
  if (!open)
27
51
  return;
@@ -30,9 +54,14 @@ export const Popover = ({ anchorRef, open, children, className, gap = 4, matchWi
30
54
  // Capture-phase scroll so nested scroll containers reposition too.
31
55
  window.addEventListener('scroll', handle, true);
32
56
  window.addEventListener('resize', handle);
57
+ const observer = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(handle) : undefined;
58
+ if (observer && contentRef.current)
59
+ observer.observe(contentRef.current);
33
60
  return () => {
34
61
  window.removeEventListener('scroll', handle, true);
35
62
  window.removeEventListener('resize', handle);
63
+ observer?.disconnect();
64
+ setPlacement(null);
36
65
  };
37
66
  }, [open, updatePosition]);
38
67
  useEffect(() => {
@@ -46,15 +75,31 @@ export const Popover = ({ anchorRef, open, children, className, gap = 4, matchWi
46
75
  return;
47
76
  onClose();
48
77
  };
78
+ const handleKeyDown = (event) => {
79
+ if (event.key !== 'Escape' || event.defaultPrevented)
80
+ return;
81
+ // preventDefault on keydown is what stops a native <dialog> from cancelling.
82
+ event.preventDefault();
83
+ onClose();
84
+ };
49
85
  document.addEventListener('mousedown', handleMouseDown);
50
- return () => document.removeEventListener('mousedown', handleMouseDown);
86
+ document.addEventListener('keydown', handleKeyDown);
87
+ return () => {
88
+ document.removeEventListener('mousedown', handleMouseDown);
89
+ document.removeEventListener('keydown', handleKeyDown);
90
+ };
51
91
  }, [open, onClose, anchorRef]);
52
- if (!open || !position)
92
+ if (!open)
53
93
  return null;
54
- return createPortal(_jsx("div", { ref: contentRef, className: cx(style.popover, className), style: {
55
- top: position.top,
56
- left: position.left,
57
- width: matchWidth ? position.width : undefined,
58
- }, children: children }), document.body);
94
+ return createPortal(_jsx("div", { ref: contentRef, className: cx(style.popover, className), "data-side": placement?.side, style: placement
95
+ ? {
96
+ top: placement.top,
97
+ bottom: placement.bottom,
98
+ left: placement.left,
99
+ width: placement.width,
100
+ }
101
+ : // Never painted: the layout effect measures and re-renders first.
102
+ // Opacity, not visibility, so an autoFocus child can take focus.
103
+ { top: 0, left: 0, opacity: 0 }, children: children }), document.body);
59
104
  };
60
105
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/control/pop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AU,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;SAC/C,YAEA,QAAQ,GACL,EACN,QAAQ,CAAC,IAAI,CACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import cx from 'classnames';\nimport {\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { useStyle } from './style.js';\n\ntype Position = { top: number; left: number; width: number };\n\nexport type PopoverProps = {\n /** Element the popover aligns to (positioned directly beneath it). */\n anchorRef: RefObject<HTMLElement | null>;\n /** Whether the popover is rendered. */\n open: boolean;\n /** Your surface: give it its own background, border, and radius. */\n children: ReactNode;\n /** Applied to the fixed wrapper; win specificity with `'&&'`, never `!important`. */\n className?: string;\n /** Vertical gap between the anchor and the popover, in pixels. */\n gap?: number;\n /** Match the popover width to the anchor width (default true). */\n matchWidth?: boolean;\n /**\n * Called on a pointer-down outside both the anchor and the popover content.\n * Omit to opt out of outside-close handling.\n */\n onClose?: () => void;\n};\n\n/**\n * Renders `children` in a portal on `document.body`, positioned with `fixed`\n * coordinates directly under `anchorRef`. This lets dropdowns escape ancestors\n * that clip overflow (e.g. cards with rounded corners) without those ancestors\n * having to opt out of clipping.\n *\n * No Escape handling or focus management, and it never flips above the anchor.\n */\nexport const Popover = ({\n anchorRef,\n open,\n children,\n className,\n gap = 4,\n matchWidth = true,\n onClose,\n}: PopoverProps) => {\n const style = useStyle();\n const contentRef = useRef<HTMLDivElement>(null);\n const [position, setPosition] = useState<Position | null>(null);\n\n const updatePosition = useCallback(() => {\n const anchor = anchorRef.current;\n if (!anchor) return;\n const rect = anchor.getBoundingClientRect();\n setPosition({ top: rect.bottom + gap, left: rect.left, width: rect.width });\n }, [anchorRef, gap]);\n\n useLayoutEffect(() => {\n if (!open) return;\n updatePosition();\n const handle = () => updatePosition();\n // Capture-phase scroll so nested scroll containers reposition too.\n window.addEventListener('scroll', handle, true);\n window.addEventListener('resize', handle);\n return () => {\n window.removeEventListener('scroll', handle, true);\n window.removeEventListener('resize', handle);\n };\n }, [open, updatePosition]);\n\n useEffect(() => {\n if (!open || !onClose) return;\n const handleMouseDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (anchorRef.current?.contains(target)) return;\n if (contentRef.current?.contains(target)) return;\n onClose();\n };\n document.addEventListener('mousedown', handleMouseDown);\n return () => document.removeEventListener('mousedown', handleMouseDown);\n }, [open, onClose, anchorRef]);\n\n if (!open || !position) return null;\n\n return createPortal(\n <div\n ref={contentRef}\n className={cx(style.popover, className)}\n style={{\n top: position.top,\n left: position.left,\n width: matchWidth ? position.width : undefined,\n }}\n >\n {children}\n </div>,\n document.body\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/control/popover/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAGL,WAAW,EACX,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EACL,eAAe,GAIhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA4BtC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EACtB,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,GAAG,GAAG,CAAC,EACP,UAAU,GAAG,IAAI,EACjB,IAAI,GAAG,QAAQ,EACf,KAAK,GAAG,OAAO,EACf,OAAO,GACM,EAAE,EAAE;IACjB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAChD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAmB,IAAI,CAAC,CAAC;IA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B,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;YAC3D,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACzD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;IAE/B,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,OAAO,YAAY,CACjB,cACE,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,eAC5B,SAAS,EAAE,IAAI,EAC1B,KAAK,EACH,SAAS;YACP,CAAC,CAAC;gBACE,GAAG,EAAE,SAAS,CAAC,GAAG;gBAClB,MAAM,EAAE,SAAS,CAAC,MAAM;gBACxB,IAAI,EAAE,SAAS,CAAC,IAAI;gBACpB,KAAK,EAAE,SAAS,CAAC,KAAK;aACvB;YACH,CAAC,CAAC,kEAAkE;gBAClE,iEAAiE;gBACjE,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,YAGpC,QAAQ,GACL,EACN,QAAQ,CAAC,IAAI,CACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import cx from 'classnames';\nimport {\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport {\n computePosition,\n type Placement,\n type PopoverAlign,\n type PopoverSide,\n} from './position.js';\nimport { useStyle } from './style.js';\n\nexport type { PopoverAlign, PopoverSide } from './position.js';\n\nexport type PopoverProps = {\n /** Element the popover aligns to (placed below or above it, per `side`). */\n anchorRef: RefObject<HTMLElement | null>;\n /** Whether the popover is rendered. */\n open: boolean;\n /** Your surface: give it its own background, border, and radius. */\n children: ReactNode;\n /** Applied to the fixed wrapper; win specificity with `'&&'`, never `!important`. */\n className?: string;\n /** Vertical gap between the anchor and the popover, in pixels; also the viewport edge margin when `matchWidth` is false. */\n gap?: number;\n /** Match the popover width to the anchor width (default true). */\n matchWidth?: boolean;\n /** Preferred side; flips to the other side when this one has no room. */\n side?: PopoverSide;\n /** Horizontal alignment to the anchor's left edge, centre, or right edge. */\n align?: PopoverAlign;\n /**\n * Called on a pointer-down outside both the anchor and the popover content,\n * and on an Escape keydown no control has already handled. Omit to opt out.\n */\n onClose?: () => void;\n};\n\n/**\n * Renders `children` in a portal on `document.body`, positioned with `fixed`\n * coordinates against `anchorRef`. This lets dropdowns escape ancestors that\n * clip overflow (e.g. cards with rounded corners) without those ancestors\n * having to opt out of clipping.\n *\n * Opens on `side` (default below) and flips when that side has no room; aligns\n * per `align` and clamps horizontally to the viewport (only without\n * `matchWidth`). The wrapper carries `data-side` with the side actually used.\n * On the top side it is anchored by CSS `bottom`, so it stays attached as its\n * content changes height. The first render is transparent (`opacity: 0`, still\n * focusable) until measured, then it re-measures on scroll (capture phase),\n * window resize, and content resize (`ResizeObserver`, where available).\n *\n * With `onClose`, Escape closes it unless the keydown was already\n * `defaultPrevented`; it calls `preventDefault` so an enclosing `<dialog>`\n * does not also cancel. No focus management.\n */\nexport const Popover = ({\n anchorRef,\n open,\n children,\n className,\n gap = 4,\n matchWidth = true,\n side = 'bottom',\n align = 'start',\n onClose,\n}: PopoverProps) => {\n const style = useStyle();\n const contentRef = useRef<HTMLDivElement>(null);\n const [placement, setPlacement] = useState<Placement | null>(null);\n\n const updatePosition = useCallback(() => {\n const anchor = anchorRef.current;\n const content = contentRef.current;\n if (!anchor || !content) return;\n const rect = anchor.getBoundingClientRect();\n // Measure at the width it will render with, so wrapped height is right.\n if (matchWidth) content.style.width = `${rect.width}px`;\n const size = content.getBoundingClientRect();\n setPlacement(\n computePosition({\n anchor: rect,\n content: { width: size.width, height: size.height },\n viewport: { width: window.innerWidth, height: window.innerHeight },\n side,\n align,\n gap,\n matchWidth,\n })\n );\n }, [anchorRef, gap, matchWidth, side, align]);\n\n useLayoutEffect(() => {\n if (!open) return;\n updatePosition();\n const handle = () => updatePosition();\n // Capture-phase scroll so nested scroll containers reposition too.\n window.addEventListener('scroll', handle, true);\n window.addEventListener('resize', handle);\n const observer = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(handle) : undefined;\n if (observer && contentRef.current) observer.observe(contentRef.current);\n return () => {\n window.removeEventListener('scroll', handle, true);\n window.removeEventListener('resize', handle);\n observer?.disconnect();\n setPlacement(null);\n };\n }, [open, updatePosition]);\n\n useEffect(() => {\n if (!open || !onClose) return;\n const handleMouseDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (anchorRef.current?.contains(target)) return;\n if (contentRef.current?.contains(target)) return;\n onClose();\n };\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || event.defaultPrevented) return;\n // preventDefault on keydown is what stops a native <dialog> from cancelling.\n event.preventDefault();\n onClose();\n };\n document.addEventListener('mousedown', handleMouseDown);\n document.addEventListener('keydown', handleKeyDown);\n return () => {\n document.removeEventListener('mousedown', handleMouseDown);\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [open, onClose, anchorRef]);\n\n if (!open) return null;\n\n return createPortal(\n <div\n ref={contentRef}\n className={cx(style.popover, className)}\n data-side={placement?.side}\n style={\n placement\n ? {\n top: placement.top,\n bottom: placement.bottom,\n left: placement.left,\n width: placement.width,\n }\n : // Never painted: the layout effect measures and re-renders first.\n // Opacity, not visibility, so an autoFocus child can take focus.\n { top: 0, left: 0, opacity: 0 }\n }\n >\n {children}\n </div>,\n document.body\n );\n};\n"]}
@@ -0,0 +1,47 @@
1
+ /** Which side of the anchor the popover prefers. */
2
+ export type PopoverSide = 'bottom' | 'top';
3
+ /** Horizontal alignment of the popover against the anchor. */
4
+ export type PopoverAlign = 'start' | 'center' | 'end';
5
+ /** Viewport-relative rectangle, as from getBoundingClientRect. */
6
+ export type Rect = {
7
+ top: number;
8
+ bottom: number;
9
+ left: number;
10
+ right: number;
11
+ width: number;
12
+ };
13
+ /**
14
+ * Resolved popover position; `side` is the side actually used after flipping.
15
+ * Exactly one of `top` / `bottom` is set: the bottom side is anchored by its
16
+ * top edge (CSS `top`), the top side by its bottom edge (CSS `bottom`, measured
17
+ * from the viewport's bottom), so content that grows or shrinks while open
18
+ * stays attached to the anchor.
19
+ */
20
+ export type Placement = {
21
+ top: number | undefined;
22
+ bottom: number | undefined;
23
+ left: number;
24
+ width: number | undefined;
25
+ side: PopoverSide;
26
+ };
27
+ /**
28
+ * Pure placement: picks the side (flipping when the preferred side does not
29
+ * fit and the other has more room), aligns horizontally, and clamps to the
30
+ * viewport horizontally unless `matchWidth` (then it lines up with the anchor).
31
+ */
32
+ export declare function computePosition({ anchor, content, viewport, side, align, gap, matchWidth, }: {
33
+ anchor: Rect;
34
+ content: {
35
+ width: number;
36
+ height: number;
37
+ };
38
+ viewport: {
39
+ width: number;
40
+ height: number;
41
+ };
42
+ side: PopoverSide;
43
+ align: PopoverAlign;
44
+ gap: number;
45
+ matchWidth: boolean;
46
+ }): Placement;
47
+ //# sourceMappingURL=position.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../src/control/popover/position.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,KAAK,CAAC;AAC3C,8DAA8D;AAC9D,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AACtD,kEAAkE;AAClE,MAAM,MAAM,IAAI,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/F;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,GAAG,EACH,UAAU,GACX,EAAE;IACD,MAAM,EAAE,IAAI,CAAC;IACb,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,OAAO,CAAC;CACrB,GAAG,SAAS,CAuBZ"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Pure placement: picks the side (flipping when the preferred side does not
3
+ * fit and the other has more room), aligns horizontally, and clamps to the
4
+ * viewport horizontally unless `matchWidth` (then it lines up with the anchor).
5
+ */
6
+ export function computePosition({ anchor, content, viewport, side, align, gap, matchWidth, }) {
7
+ const w = matchWidth ? anchor.width : content.width;
8
+ const h = content.height;
9
+ const roomBelow = viewport.height - anchor.bottom - gap;
10
+ const roomAbove = anchor.top - gap;
11
+ const room = (s) => (s === 'bottom' ? roomBelow : roomAbove);
12
+ const other = side === 'bottom' ? 'top' : 'bottom';
13
+ const used = room(side) >= h || room(other) <= room(side) ? side : other;
14
+ const top = used === 'bottom' ? anchor.bottom + gap : undefined;
15
+ const bottom = used === 'top' ? viewport.height - anchor.top + gap : undefined;
16
+ let left;
17
+ if (align === 'start')
18
+ left = anchor.left;
19
+ else if (align === 'center')
20
+ left = anchor.left + anchor.width / 2 - w / 2;
21
+ else
22
+ left = anchor.right - w;
23
+ if (!matchWidth) {
24
+ left =
25
+ w > viewport.width - 2 * gap ? gap : Math.max(gap, Math.min(left, viewport.width - w - gap));
26
+ }
27
+ return { top, bottom, left, width: matchWidth ? anchor.width : undefined, side: used };
28
+ }
29
+ //# sourceMappingURL=position.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"position.js","sourceRoot":"","sources":["../../../src/control/popover/position.ts"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,MAAM,EACN,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,GAAG,EACH,UAAU,GASX;IACC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACpD,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAEzB,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC;IACxD,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC;IACnC,MAAM,IAAI,GAAG,CAAC,CAAc,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC1E,MAAM,KAAK,GAAgB,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;IAChE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACzE,MAAM,GAAG,GAAG,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IAChE,MAAM,MAAM,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IAE/E,IAAI,IAAY,CAAC;IACjB,IAAI,KAAK,KAAK,OAAO;QAAE,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;SACrC,IAAI,KAAK,KAAK,QAAQ;QAAE,IAAI,GAAG,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;;QACtE,IAAI,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;IAE7B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,IAAI;YACF,CAAC,GAAG,QAAQ,CAAC,KAAK,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACjG,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACzF,CAAC","sourcesContent":["/** Which side of the anchor the popover prefers. */\nexport type PopoverSide = 'bottom' | 'top';\n/** Horizontal alignment of the popover against the anchor. */\nexport type PopoverAlign = 'start' | 'center' | 'end';\n/** Viewport-relative rectangle, as from getBoundingClientRect. */\nexport type Rect = { top: number; bottom: number; left: number; right: number; width: number };\n/**\n * Resolved popover position; `side` is the side actually used after flipping.\n * Exactly one of `top` / `bottom` is set: the bottom side is anchored by its\n * top edge (CSS `top`), the top side by its bottom edge (CSS `bottom`, measured\n * from the viewport's bottom), so content that grows or shrinks while open\n * stays attached to the anchor.\n */\nexport type Placement = {\n top: number | undefined;\n bottom: number | undefined;\n left: number;\n width: number | undefined;\n side: PopoverSide;\n};\n\n/**\n * Pure placement: picks the side (flipping when the preferred side does not\n * fit and the other has more room), aligns horizontally, and clamps to the\n * viewport horizontally unless `matchWidth` (then it lines up with the anchor).\n */\nexport function computePosition({\n anchor,\n content,\n viewport,\n side,\n align,\n gap,\n matchWidth,\n}: {\n anchor: Rect;\n content: { width: number; height: number };\n viewport: { width: number; height: number };\n side: PopoverSide;\n align: PopoverAlign;\n gap: number;\n matchWidth: boolean;\n}): Placement {\n const w = matchWidth ? anchor.width : content.width;\n const h = content.height;\n\n const roomBelow = viewport.height - anchor.bottom - gap;\n const roomAbove = anchor.top - gap;\n const room = (s: PopoverSide) => (s === 'bottom' ? roomBelow : roomAbove);\n const other: PopoverSide = side === 'bottom' ? 'top' : 'bottom';\n const used = room(side) >= h || room(other) <= room(side) ? side : other;\n const top = used === 'bottom' ? anchor.bottom + gap : undefined;\n const bottom = used === 'top' ? viewport.height - anchor.top + gap : undefined;\n\n let left: number;\n if (align === 'start') left = anchor.left;\n else if (align === 'center') left = anchor.left + anchor.width / 2 - w / 2;\n else left = anchor.right - w;\n\n if (!matchWidth) {\n left =\n w > viewport.width - 2 * gap ? gap : Math.max(gap, Math.min(left, viewport.width - w - gap));\n }\n\n return { top, bottom, left, width: matchWidth ? anchor.width : undefined, side: used };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/control/switch/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEnE;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,CAAC;AACjD,oBAAY,YAAY;IACtB;;;;OAIG;IACH,KAAK,UAAU;IACf;;;;;;;;;;OAUG;IACH,IAAI,SAAS;CACd;AAED,eAAO,MAAM,QAAQ;;2MAyIlB,CAAC"}
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/control/switch/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEnE;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,CAAC;AACjD,oBAAY,YAAY;IACtB;;;;OAIG;IACH,KAAK,UAAU;IACf;;;;;;;;;;OAUG;IACH,IAAI,SAAS;CACd;AAED,eAAO,MAAM,QAAQ;;2MAuIlB,CAAC"}
@@ -128,9 +128,7 @@ export const useStyle = createUseStyles((theme) => ({
128
128
  alignItems: 'center',
129
129
  gap: theme.space.md,
130
130
  width: '100%',
131
- backgroundColor: theme.color.bg.cardHeader,
132
- borderRadius: theme.radius.md,
133
- padding: `${theme.space.md} ${theme.space.lg} ${theme.space.md} ${theme.space.sm}`,
131
+ ...theme.recipe.row,
134
132
  '& $content': {
135
133
  display: 'flex',
136
134
  flexDirection: 'column',
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/control/switch/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAc,MAAM,sBAAsB,CAAC;AAanE,MAAM,CAAN,IAAY,YAmBX;AAnBD,WAAY,YAAY;IACtB;;;;OAIG;IACH,+BAAe,CAAA;IACf;;;;;;;;;;OAUG;IACH,6BAAa,CAAA;AACf,CAAC,EAnBW,YAAY,KAAZ,YAAY,QAmBvB;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,KAAY,EAAE,EAAE,CAAC,CAAC;IACzD,IAAI,EAAE;QACJ,OAAO,EAAE,aAAa;QACtB,aAAa,EAAE,QAAQ;QACvB,UAAU,EAAE,YAAY;QACxB,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE;QACnB,MAAM,EAAE,SAAS;QACjB,UAAU,EAAE,MAAM;QAClB,qBAA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EAAE,EAAE;IACX,UAAU,EAAE;QACV,+EAA+E;QAC/E,OAAO,EAAE,MAAM;QACf,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE;QACnB,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU;QAC1C,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE;QAC7B,OAAO,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE;QAClF,YAAY,EAAE;YACZ,OAAO,EAAE,MAAM;YACf,aAAa,EAAE,QAAQ;YACvB,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE;YACnB,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,CAAC;SACZ;QACD,UAAU,EAAE;YACV,6DAA6D;YAC7D,SAAS,EAAE,MAAM;SAClB;QACD,gBAAgB,EAAE;YAChB,MAAM,EAAE,CAAC;YACT,gFAAgF;YAChF,MAAM,EAAE,SAAS;SAClB;QACD,UAAU,EAAE;YACV,mEAAmE;YACnE,UAAU,EAAE,CAAC;SACd;KACF;IACD,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,EAAE;CACX,CAAC,CAAC,CAAC","sourcesContent":["import { createUseStyles, type Theme } from '../../theme/index.js';\n\n/**\n * Named for what the switch SITS IN rather than for a size, matching\n * `ButtonRadius`: a caller knows its own surroundings, not which step of the\n * radius scale suits a 16px-tall track.\n *\n * Deliberately two values, where `ButtonRadius` has four. A switch's track is\n * 16px tall, so any radius of 8px or more clamps to a full pill — `card`\n * (`radius.md`) and `pill` would be the same shape, named twice, and could\n * never diverge while the track keeps that height.\n */\nexport type SwitchRadiusValue = 'inset' | 'pill';\nexport enum SwitchRadius {\n /**\n * Concentric with the shaded input row the switch sits in: 16px card, 8px\n * row, 4px track, 2px thumb. The default, because that row is where every\n * switch in this app currently lives.\n */\n Inset = 'inset',\n /**\n * The classic capsule, and the rule for a switch in a CARD HEADER.\n *\n * Not about shading — a card header is painted `bg.cardHeader`, the same\n * colour as the input row. It is about whether there is anything nearby to\n * be concentric WITH. An input row is a small rounded rectangle wrapping the\n * switch, so a 4px track echoes its 8px corner a few pixels away. A card\n * header is a full-width bar whose only corners are the card's own, far off\n * at either end: nothing for the track to relate to, so it reads better as a\n * self-contained control than as a square-ish chip floating in a bar.\n */\n Pill = 'pill',\n}\n\nexport const useStyle = createUseStyles((theme: Theme) => ({\n root: {\n display: 'inline-flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n gap: theme.space.xs,\n cursor: 'pointer',\n userSelect: 'none',\n '-webkit-user-select': 'none',\n },\n row: {\n display: 'flex',\n alignItems: 'center',\n gap: theme.space.md,\n },\n description: {\n // Indent under the label (past the 28px track + row gap) so it reads as\n // helper text for this toggle rather than a separate row.\n marginLeft: `calc(28px + ${theme.space.md})`,\n fontSize: theme.fontSize.sm,\n // Dedicated description colour — darker than faint for readable helper text,\n // especially on the shaded background of the horizontal layout.\n color: theme.color.text.description,\n cursor: 'auto',\n },\n track: {\n position: 'relative',\n width: '28px',\n height: '16px',\n backgroundColor: theme.color.border.default,\n ...theme.recipe.focusRing,\n transitionProperty: 'background-color, outline-color',\n transitionDuration: '0.1s',\n transitionTimingFunction: 'ease-in',\n '$root:hover &': { outlineColor: theme.color.brand.outline },\n '$root:focus &': { outlineColor: theme.color.brand.outline },\n '&$checked': { backgroundColor: theme.color.brand.default },\n '&$disabled': { opacity: 0.4, cursor: 'not-allowed' },\n },\n thumb: {\n position: 'absolute',\n top: '2px',\n left: '2px',\n width: '12px',\n height: '12px',\n backgroundColor: theme.color.bg.input,\n transitionProperty: 'left',\n transitionDuration: '0.1s',\n transitionTimingFunction: 'ease-in',\n '$checked &': { left: '14px' },\n },\n /**\n * Each value sets the track AND its thumb together, because the two are not\n * independent: the thumb is inset 2px on every side, so a concentric thumb\n * is always the track's radius less that inset. Splitting them into two\n * props would let a caller produce a square thumb in a capsule track.\n */\n [SwitchRadius.Inset]: {\n borderRadius: theme.radius.sm,\n // Arithmetic rather than a token so it follows the track automatically if\n // that radius ever changes — and because the scale has no 2px step.\n '& $thumb': { borderRadius: `calc(${theme.radius.sm} - 2px)` },\n },\n [SwitchRadius.Pill]: {\n borderRadius: theme.radius.pill,\n '& $thumb': { borderRadius: theme.radius.circle },\n },\n\n /**\n * Replaces the thumb while a save is in flight. Sized to the thumb it\n * stands in for, and inheriting `currentColor` from `$track` below so it\n * stays legible against both track colours.\n */\n spinner: {\n ...theme.recipe.spinner,\n position: 'absolute',\n top: '2px',\n width: '12px',\n height: '12px',\n // Matches the thumb's own transition, so a click that both moves the\n // switch AND starts a save does not animate the two at different speeds.\n transitionProperty: 'left',\n transitionDuration: '0.1s',\n transitionTimingFunction: 'ease-in',\n left: '2px',\n '$checked &': { left: '14px' },\n },\n loading: {\n // The track keeps its colour — this is \"working\", not \"unavailable\",\n // which `disabled` already says by fading to 40%. Only the cursor and the\n // thumb change.\n cursor: 'progress',\n // `currentColor` for the spinner: muted against the pale unchecked track,\n // white against the saturated checked one. A single colour would vanish\n // into one of the two.\n color: theme.color.text.muted,\n '&$checked': { color: theme.color.bg.input },\n },\n\n label: {\n ...theme.recipe.label,\n },\n content: {},\n horizontal: {\n // Two columns: content (label + description) on the left, toggle on the right.\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.space.md,\n width: '100%',\n backgroundColor: theme.color.bg.cardHeader,\n borderRadius: theme.radius.md,\n padding: `${theme.space.md} ${theme.space.lg} ${theme.space.md} ${theme.space.sm}`,\n '& $content': {\n display: 'flex',\n flexDirection: 'column',\n gap: theme.space.xs,\n flexGrow: 1,\n minWidth: 0,\n },\n '& $label': {\n // Left-aligned to the same edge as the other fields' labels.\n textAlign: 'left',\n },\n '& $description': {\n margin: 0,\n // The whole shaded row toggles, so the description shows the toggle cursor too.\n cursor: 'pointer',\n },\n '& $track': {\n // Kept in its own column so the description never runs beneath it.\n flexShrink: 0,\n },\n },\n checked: {},\n disabled: {},\n danger: {},\n}));\n"]}
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/control/switch/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAc,MAAM,sBAAsB,CAAC;AAanE,MAAM,CAAN,IAAY,YAmBX;AAnBD,WAAY,YAAY;IACtB;;;;OAIG;IACH,+BAAe,CAAA;IACf;;;;;;;;;;OAUG;IACH,6BAAa,CAAA;AACf,CAAC,EAnBW,YAAY,KAAZ,YAAY,QAmBvB;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,KAAY,EAAE,EAAE,CAAC,CAAC;IACzD,IAAI,EAAE;QACJ,OAAO,EAAE,aAAa;QACtB,aAAa,EAAE,QAAQ;QACvB,UAAU,EAAE,YAAY;QACxB,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE;QACnB,MAAM,EAAE,SAAS;QACjB,UAAU,EAAE,MAAM;QAClB,qBAAqB,EAAE,MAAM;KAC9B;IACD,GAAG,EAAE;QACH,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE;KACpB;IACD,WAAW,EAAE;QACX,wEAAwE;QACxE,0DAA0D;QAC1D,UAAU,EAAE,eAAe,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG;QAC5C,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE;QAC3B,6EAA6E;QAC7E,gEAAgE;QAChE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW;QACnC,MAAM,EAAE,MAAM;KACf;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,UAAU;QACpB,KAAK,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,EAAE;YAChB,MAAM,EAAE,CAAC;YACT,gFAAgF;YAChF,MAAM,EAAE,SAAS;SAClB;QACD,UAAU,EAAE;YACV,mEAAmE;YACnE,UAAU,EAAE,CAAC;SACd;KACF;IACD,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,EAAE;CACX,CAAC,CAAC,CAAC","sourcesContent":["import { createUseStyles, type Theme } from '../../theme/index.js';\n\n/**\n * Named for what the switch SITS IN rather than for a size, matching\n * `ButtonRadius`: a caller knows its own surroundings, not which step of the\n * radius scale suits a 16px-tall track.\n *\n * Deliberately two values, where `ButtonRadius` has four. A switch's track is\n * 16px tall, so any radius of 8px or more clamps to a full pill — `card`\n * (`radius.md`) and `pill` would be the same shape, named twice, and could\n * never diverge while the track keeps that height.\n */\nexport type SwitchRadiusValue = 'inset' | 'pill';\nexport enum SwitchRadius {\n /**\n * Concentric with the shaded input row the switch sits in: 16px card, 8px\n * row, 4px track, 2px thumb. The default, because that row is where every\n * switch in this app currently lives.\n */\n Inset = 'inset',\n /**\n * The classic capsule, and the rule for a switch in a CARD HEADER.\n *\n * Not about shading — a card header is painted `bg.cardHeader`, the same\n * colour as the input row. It is about whether there is anything nearby to\n * be concentric WITH. An input row is a small rounded rectangle wrapping the\n * switch, so a 4px track echoes its 8px corner a few pixels away. A card\n * header is a full-width bar whose only corners are the card's own, far off\n * at either end: nothing for the track to relate to, so it reads better as a\n * self-contained control than as a square-ish chip floating in a bar.\n */\n Pill = 'pill',\n}\n\nexport const useStyle = createUseStyles((theme: Theme) => ({\n root: {\n display: 'inline-flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n gap: theme.space.xs,\n cursor: 'pointer',\n userSelect: 'none',\n '-webkit-user-select': 'none',\n },\n row: {\n display: 'flex',\n alignItems: 'center',\n gap: theme.space.md,\n },\n description: {\n // Indent under the label (past the 28px track + row gap) so it reads as\n // helper text for this toggle rather than a separate row.\n marginLeft: `calc(28px + ${theme.space.md})`,\n fontSize: theme.fontSize.sm,\n // Dedicated description colour — darker than faint for readable helper text,\n // especially on the shaded background of the horizontal layout.\n color: theme.color.text.description,\n cursor: 'auto',\n },\n track: {\n position: 'relative',\n width: '28px',\n height: '16px',\n backgroundColor: theme.color.border.default,\n ...theme.recipe.focusRing,\n transitionProperty: 'background-color, outline-color',\n transitionDuration: '0.1s',\n transitionTimingFunction: 'ease-in',\n '$root:hover &': { outlineColor: theme.color.brand.outline },\n '$root:focus &': { outlineColor: theme.color.brand.outline },\n '&$checked': { backgroundColor: theme.color.brand.default },\n '&$disabled': { opacity: 0.4, cursor: 'not-allowed' },\n },\n thumb: {\n position: 'absolute',\n top: '2px',\n left: '2px',\n width: '12px',\n height: '12px',\n backgroundColor: theme.color.bg.input,\n transitionProperty: 'left',\n transitionDuration: '0.1s',\n transitionTimingFunction: 'ease-in',\n '$checked &': { left: '14px' },\n },\n /**\n * Each value sets the track AND its thumb together, because the two are not\n * independent: the thumb is inset 2px on every side, so a concentric thumb\n * is always the track's radius less that inset. Splitting them into two\n * props would let a caller produce a square thumb in a capsule track.\n */\n [SwitchRadius.Inset]: {\n borderRadius: theme.radius.sm,\n // Arithmetic rather than a token so it follows the track automatically if\n // that radius ever changes — and because the scale has no 2px step.\n '& $thumb': { borderRadius: `calc(${theme.radius.sm} - 2px)` },\n },\n [SwitchRadius.Pill]: {\n borderRadius: theme.radius.pill,\n '& $thumb': { borderRadius: theme.radius.circle },\n },\n\n /**\n * Replaces the thumb while a save is in flight. Sized to the thumb it\n * stands in for, and inheriting `currentColor` from `$track` below so it\n * stays legible against both track colours.\n */\n spinner: {\n ...theme.recipe.spinner,\n position: 'absolute',\n top: '2px',\n width: '12px',\n height: '12px',\n // Matches the thumb's own transition, so a click that both moves the\n // switch AND starts a save does not animate the two at different speeds.\n transitionProperty: 'left',\n transitionDuration: '0.1s',\n transitionTimingFunction: 'ease-in',\n left: '2px',\n '$checked &': { left: '14px' },\n },\n loading: {\n // The track keeps its colour — this is \"working\", not \"unavailable\",\n // which `disabled` already says by fading to 40%. Only the cursor and the\n // thumb change.\n cursor: 'progress',\n // `currentColor` for the spinner: muted against the pale unchecked track,\n // white against the saturated checked one. A single colour would vanish\n // into one of the two.\n color: theme.color.text.muted,\n '&$checked': { color: theme.color.bg.input },\n },\n\n label: {\n ...theme.recipe.label,\n },\n content: {},\n horizontal: {\n // Two columns: content (label + description) on the left, toggle on the right.\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.space.md,\n width: '100%',\n ...theme.recipe.row,\n '& $content': {\n display: 'flex',\n flexDirection: 'column',\n gap: theme.space.xs,\n flexGrow: 1,\n minWidth: 0,\n },\n '& $label': {\n // Left-aligned to the same edge as the other fields' labels.\n textAlign: 'left',\n },\n '& $description': {\n margin: 0,\n // The whole shaded row toggles, so the description shows the toggle cursor too.\n cursor: 'pointer',\n },\n '& $track': {\n // Kept in its own column so the description never runs beneath it.\n flexShrink: 0,\n },\n },\n checked: {},\n disabled: {},\n danger: {},\n}));\n"]}
@@ -85,6 +85,10 @@ export interface Theme {
85
85
  section: string;
86
86
  };
87
87
  success: string;
88
+ /** Solid warning colour for icons and accents. */
89
+ warning: string;
90
+ /** Solid info colour for icons and accents. */
91
+ info: string;
88
92
  brand: {
89
93
  default: string;
90
94
  hover: string;
@@ -155,6 +159,26 @@ export interface Theme {
155
159
  bg: string;
156
160
  border: string;
157
161
  };
162
+ success: {
163
+ text: string;
164
+ bg: string;
165
+ border: string;
166
+ };
167
+ warning: {
168
+ text: string;
169
+ bg: string;
170
+ border: string;
171
+ };
172
+ danger: {
173
+ text: string;
174
+ bg: string;
175
+ border: string;
176
+ };
177
+ info: {
178
+ text: string;
179
+ bg: string;
180
+ border: string;
181
+ };
158
182
  };
159
183
  };
160
184
  space: {
@@ -248,6 +272,8 @@ export interface Theme {
248
272
  spinner: Recipe;
249
273
  glass: Recipe;
250
274
  glassHighlight: Recipe;
275
+ /** The shaded field row (`bg.cardHeader`, `md` corners) a control sits in inside a card. */
276
+ row: Recipe;
251
277
  modal: {
252
278
  dialog: Recipe;
253
279
  header: Recipe;