@pyreon/elements 0.11.5 → 0.11.7

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 (53) hide show
  1. package/README.md +38 -35
  2. package/lib/index.d.ts +15 -15
  3. package/package.json +24 -24
  4. package/src/Element/component.tsx +14 -14
  5. package/src/Element/constants.ts +25 -25
  6. package/src/Element/index.ts +2 -2
  7. package/src/Element/types.ts +3 -3
  8. package/src/Element/utils.ts +1 -1
  9. package/src/List/component.tsx +7 -7
  10. package/src/List/index.ts +2 -2
  11. package/src/Overlay/component.tsx +22 -22
  12. package/src/Overlay/context.tsx +2 -2
  13. package/src/Overlay/index.ts +3 -3
  14. package/src/Overlay/useOverlay.tsx +97 -97
  15. package/src/Portal/component.tsx +6 -6
  16. package/src/Portal/index.ts +2 -2
  17. package/src/Text/component.tsx +6 -6
  18. package/src/Text/index.ts +2 -2
  19. package/src/Text/styled.ts +4 -4
  20. package/src/Util/component.tsx +5 -5
  21. package/src/Util/index.ts +2 -2
  22. package/src/__tests__/Content.test.tsx +46 -46
  23. package/src/__tests__/Element.test.ts +251 -251
  24. package/src/__tests__/Iterator.test.ts +142 -142
  25. package/src/__tests__/List.test.ts +61 -61
  26. package/src/__tests__/Overlay.test.ts +125 -125
  27. package/src/__tests__/Portal.test.ts +33 -33
  28. package/src/__tests__/Text.test.ts +128 -128
  29. package/src/__tests__/Util.test.ts +31 -31
  30. package/src/__tests__/Wrapper.test.tsx +60 -60
  31. package/src/__tests__/equalBeforeAfter.test.ts +41 -41
  32. package/src/__tests__/helpers.test.ts +29 -29
  33. package/src/__tests__/overlayContext.test.tsx +14 -14
  34. package/src/__tests__/responsiveProps.test.ts +116 -116
  35. package/src/__tests__/useOverlay.test.ts +283 -283
  36. package/src/__tests__/utils.test.ts +43 -43
  37. package/src/constants.ts +1 -1
  38. package/src/helpers/Content/component.tsx +5 -5
  39. package/src/helpers/Content/index.ts +1 -1
  40. package/src/helpers/Content/styled.ts +16 -16
  41. package/src/helpers/Content/types.ts +7 -7
  42. package/src/helpers/Iterator/component.tsx +28 -28
  43. package/src/helpers/Iterator/index.ts +2 -2
  44. package/src/helpers/Iterator/types.ts +3 -3
  45. package/src/helpers/Wrapper/component.tsx +6 -6
  46. package/src/helpers/Wrapper/index.ts +1 -1
  47. package/src/helpers/Wrapper/styled.ts +8 -8
  48. package/src/helpers/Wrapper/types.ts +3 -3
  49. package/src/helpers/Wrapper/utils.ts +1 -1
  50. package/src/helpers/index.ts +2 -2
  51. package/src/index.ts +16 -16
  52. package/src/types.ts +7 -7
  53. package/src/utils.ts +1 -1
package/README.md CHANGED
@@ -45,25 +45,25 @@ When only content is present (no beforeContent/afterContent), Element optimizes
45
45
 
46
46
  **Content props** (rendered in priority order: children > content > label):
47
47
 
48
- | Prop | Type | Description |
49
- | ---- | ---- | ----------- |
50
- | children | `VNode` | Standard children |
51
- | content | `VNode` | Alternative to children |
52
- | label | `VNode` | Alternative to children/content |
48
+ | Prop | Type | Description |
49
+ | ------------- | ------- | ------------------------------------- |
50
+ | children | `VNode` | Standard children |
51
+ | content | `VNode` | Alternative to children |
52
+ | label | `VNode` | Alternative to children/content |
53
53
  | beforeContent | `VNode` | Content rendered before the main slot |
54
- | afterContent | `VNode` | Content rendered after the main slot |
54
+ | afterContent | `VNode` | Content rendered after the main slot |
55
55
 
56
56
  **Layout props** (all responsive):
57
57
 
58
- | Prop | Type | Default | Description |
59
- | ---- | ---- | ------- | ----------- |
60
- | tag | `HTMLTags` | `'div'` | HTML element tag |
61
- | block | `boolean` | — | `flex` vs `inline-flex` |
58
+ | Prop | Type | Default | Description |
59
+ | --------- | ----------- | ---------- | -------------------------------------------------------------- |
60
+ | tag | `HTMLTags` | `'div'` | HTML element tag |
61
+ | block | `boolean` | — | `flex` vs `inline-flex` |
62
62
  | direction | `Direction` | `'inline'` | `'inline'` \| `'rows'` \| `'reverseInline'` \| `'reverseRows'` |
63
- | alignX | `AlignX` | `'left'` | Horizontal alignment |
64
- | alignY | `AlignY` | `'center'` | Vertical alignment |
65
- | gap | `number` | — | Gap between content sections |
66
- | equalCols | `boolean` | — | Equal width/height for before/after |
63
+ | alignX | `AlignX` | `'left'` | Horizontal alignment |
64
+ | alignY | `AlignY` | `'center'` | Vertical alignment |
65
+ | gap | `number` | — | Gap between content sections |
66
+ | equalCols | `boolean` | — | Equal width/height for before/after |
67
67
 
68
68
  Each section (content, beforeContent, afterContent) has its own direction, alignX, and alignY props prefixed with the section name:
69
69
 
@@ -88,12 +88,12 @@ Text({ paragraph: true, children: 'This renders as a p tag.' })
88
88
  Text({ tag: 'strong', label: 'Bold text' })
89
89
  ```
90
90
 
91
- | Prop | Type | Description |
92
- | ---- | ---- | ----------- |
93
- | tag | `HTMLTextTags` | `'h1'`–`'h6'`, `'p'`, `'span'`, `'strong'`, `'em'`, etc. |
94
- | paragraph | `boolean` | Shorthand for `tag="p"` |
95
- | children / label | `VNode` | Text content |
96
- | css | `ExtendCss` | Extend styling |
91
+ | Prop | Type | Description |
92
+ | ---------------- | -------------- | -------------------------------------------------------- |
93
+ | tag | `HTMLTextTags` | `'h1'`–`'h6'`, `'p'`, `'span'`, `'strong'`, `'em'`, etc. |
94
+ | paragraph | `boolean` | Shorthand for `tag="p"` |
95
+ | children / label | `VNode` | Text content |
96
+ | css | `ExtendCss` | Extend styling |
97
97
 
98
98
  ### List
99
99
 
@@ -112,7 +112,10 @@ List({
112
112
  // Object data with positional metadata
113
113
  List({
114
114
  component: ListItem,
115
- data: [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }],
115
+ data: [
116
+ { id: 1, name: 'Alice' },
117
+ { id: 2, name: 'Bob' },
118
+ ],
116
119
  itemKey: 'id',
117
120
  itemProps: (item, { first, last, odd, even, index }) => ({
118
121
  highlighted: first,
@@ -130,15 +133,15 @@ List({
130
133
  })
131
134
  ```
132
135
 
133
- | Prop | Type | Description |
134
- | ---- | ---- | ----------- |
135
- | data | `Array` | Array of strings, numbers, or objects |
136
- | component | `ComponentFn` | Component to render for each item |
137
- | valueName | `string` | Prop name for scalar values (default: `'children'`) |
138
- | itemKey | `string \| function` | Key extraction for list items |
139
- | itemProps | `object \| function` | Extra props injected into each item |
140
- | wrapComponent | `ComponentFn` | Wrapper around each item |
141
- | rootElement | `boolean` | Wrap list in an Element (enables direction, gap, etc.) |
136
+ | Prop | Type | Description |
137
+ | ------------- | -------------------- | ------------------------------------------------------ |
138
+ | data | `Array` | Array of strings, numbers, or objects |
139
+ | component | `ComponentFn` | Component to render for each item |
140
+ | valueName | `string` | Prop name for scalar values (default: `'children'`) |
141
+ | itemKey | `string \| function` | Key extraction for list items |
142
+ | itemProps | `object \| function` | Extra props injected into each item |
143
+ | wrapComponent | `ComponentFn` | Wrapper around each item |
144
+ | rootElement | `boolean` | Wrap list in an Element (enables direction, gap, etc.) |
142
145
 
143
146
  **Positional metadata** passed to `itemProps` callback:
144
147
 
@@ -182,12 +185,12 @@ Element({ direction: { xs: 'rows', md: 'inline', lg: 'inline' } })
182
185
 
183
186
  ## Peer Dependencies
184
187
 
185
- | Package | Version |
186
- | ------- | ------- |
187
- | @pyreon/core | >= 0.0.1 |
188
+ | Package | Version |
189
+ | ------------------ | -------- |
190
+ | @pyreon/core | >= 0.0.1 |
188
191
  | @pyreon/reactivity | >= 0.0.1 |
189
- | @pyreon/ui-core | >= 0.0.1 |
190
- | @pyreon/unistyle | >= 0.0.1 |
192
+ | @pyreon/ui-core | >= 0.0.1 |
193
+ | @pyreon/unistyle | >= 0.0.1 |
191
194
 
192
195
  ## License
193
196
 
package/lib/index.d.ts CHANGED
@@ -13,10 +13,10 @@ type MergeTypes<A extends readonly [...any]> = ExtractNullableKeys<Spread<A>>;
13
13
  type InnerRef = HTMLElement | ((el: HTMLElement | null) => void) | null;
14
14
  type CssCallback = (css: typeof config.css) => ReturnType<typeof css>;
15
15
  type Css = CssCallback | ReturnType<typeof config.css> | string;
16
- type Content = Parameters<typeof render>["0"];
17
- type ContentAlignX = "left" | "center" | "right" | "spaceBetween" | "spaceAround" | "block";
18
- type ContentAlignY = "top" | "center" | "bottom" | "spaceBetween" | "spaceAround" | "block";
19
- type ContentDirection = "inline" | "rows" | "reverseInline" | "reverseRows";
16
+ type Content = Parameters<typeof render>['0'];
17
+ type ContentAlignX = 'left' | 'center' | 'right' | 'spaceBetween' | 'spaceAround' | 'block';
18
+ type ContentAlignY = 'top' | 'center' | 'bottom' | 'spaceBetween' | 'spaceAround' | 'block';
19
+ type ContentDirection = 'inline' | 'rows' | 'reverseInline' | 'reverseRows';
20
20
  type ContentBoolean = boolean;
21
21
  type ContentSimpleValue = string | number;
22
22
  type AlignY = ContentAlignY | ContentAlignY[] | Partial<Record<BreakpointKeys, ContentAlignY>>;
@@ -219,7 +219,7 @@ type Props$1 = Partial<{
219
219
  /**
220
220
  * Extension of **item** `wrapComponent` props to be passed
221
221
  */
222
- itemKey?: keyof ObjectValue | ((item: SimpleValue | Omit<ObjectValue, "component">, index: number) => SimpleValue);
222
+ itemKey?: keyof ObjectValue | ((item: SimpleValue | Omit<ObjectValue, 'component'>, index: number) => SimpleValue);
223
223
  }>;
224
224
  //#endregion
225
225
  //#region src/helpers/Iterator/component.d.ts
@@ -272,15 +272,15 @@ declare const Component$3: ({
272
272
  * Event handlers are throttled for performance, and nested overlay blocking
273
273
  * is coordinated through the overlay context.
274
274
  */
275
- type Align$1 = "bottom" | "top" | "left" | "right";
276
- type AlignX$2 = "left" | "center" | "right";
277
- type AlignY$2 = "bottom" | "top" | "center";
275
+ type Align$1 = 'bottom' | 'top' | 'left' | 'right';
276
+ type AlignX$2 = 'left' | 'center' | 'right';
277
+ type AlignY$2 = 'bottom' | 'top' | 'center';
278
278
  type UseOverlayProps = Partial<{
279
279
  isOpen: boolean;
280
- openOn: "click" | "hover" | "manual";
281
- closeOn: "click" | "clickOnTrigger" | "clickOutsideContent" | "hover" | "manual";
282
- type: "dropdown" | "tooltip" | "popover" | "modal" | "custom";
283
- position: "absolute" | "fixed" | "relative" | "static";
280
+ openOn: 'click' | 'hover' | 'manual';
281
+ closeOn: 'click' | 'clickOnTrigger' | 'clickOutsideContent' | 'hover' | 'manual';
282
+ type: 'dropdown' | 'tooltip' | 'popover' | 'modal' | 'custom';
283
+ position: 'absolute' | 'fixed' | 'relative' | 'static';
284
284
  align: Align$1;
285
285
  alignX: AlignX$2;
286
286
  alignY: AlignY$2;
@@ -336,9 +336,9 @@ declare const useOverlay: ({
336
336
  };
337
337
  //#endregion
338
338
  //#region src/Overlay/component.d.ts
339
- type Align = "bottom" | "top" | "left" | "right";
340
- type AlignX$1 = "left" | "center" | "right";
341
- type AlignY$1 = "bottom" | "top" | "center";
339
+ type Align = 'bottom' | 'top' | 'left' | 'right';
340
+ type AlignX$1 = 'left' | 'center' | 'right';
341
+ type AlignY$1 = 'bottom' | 'top' | 'center';
342
342
  type TriggerRenderer = (props: Partial<{
343
343
  active: boolean;
344
344
  showContent: () => void;
package/package.json CHANGED
@@ -1,24 +1,13 @@
1
1
  {
2
2
  "name": "@pyreon/elements",
3
- "version": "0.11.5",
3
+ "version": "0.11.7",
4
+ "description": "Foundational UI components for Pyreon",
5
+ "license": "MIT",
4
6
  "repository": {
5
7
  "type": "git",
6
8
  "url": "https://github.com/pyreon/pyreon",
7
9
  "directory": "packages/ui-system/elements"
8
10
  },
9
- "description": "Foundational UI components for Pyreon",
10
- "license": "MIT",
11
- "type": "module",
12
- "sideEffects": false,
13
- "exports": {
14
- ".": {
15
- "bun": "./src/index.ts",
16
- "import": "./lib/index.js",
17
- "types": "./lib/index.d.ts"
18
- }
19
- },
20
- "types": "./lib/index.d.ts",
21
- "main": "./lib/index.js",
22
11
  "files": [
23
12
  "lib",
24
13
  "!lib/**/*.map",
@@ -27,8 +16,16 @@
27
16
  "LICENSE",
28
17
  "src"
29
18
  ],
30
- "engines": {
31
- "node": ">= 22"
19
+ "type": "module",
20
+ "sideEffects": false,
21
+ "main": "./lib/index.js",
22
+ "types": "./lib/index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "bun": "./src/index.ts",
26
+ "import": "./lib/index.js",
27
+ "types": "./lib/index.d.ts"
28
+ }
32
29
  },
33
30
  "publishConfig": {
34
31
  "access": "public"
@@ -37,20 +34,23 @@
37
34
  "prepublish": "bun run build",
38
35
  "build": "bun run vl_rolldown_build",
39
36
  "build:watch": "bun run vl_rolldown_build-watch",
40
- "lint": "biome check src/",
37
+ "lint": "oxlint .",
41
38
  "test": "vitest run",
42
39
  "test:coverage": "vitest run --coverage",
43
40
  "test:watch": "vitest",
44
41
  "typecheck": "tsc --noEmit"
45
42
  },
43
+ "devDependencies": {
44
+ "@pyreon/typescript": "^0.11.7",
45
+ "@vitus-labs/tools-rolldown": "^1.15.3"
46
+ },
46
47
  "peerDependencies": {
47
- "@pyreon/core": "^0.11.5",
48
- "@pyreon/reactivity": "^0.11.5",
49
- "@pyreon/ui-core": "^0.11.5",
50
- "@pyreon/unistyle": "^0.11.5"
48
+ "@pyreon/core": "^0.11.7",
49
+ "@pyreon/reactivity": "^0.11.7",
50
+ "@pyreon/ui-core": "^0.11.7",
51
+ "@pyreon/unistyle": "^0.11.7"
51
52
  },
52
- "devDependencies": {
53
- "@vitus-labs/tools-rolldown": "^1.15.3",
54
- "@pyreon/typescript": "^0.11.5"
53
+ "engines": {
54
+ "node": ">= 22"
55
55
  }
56
56
  }
@@ -7,20 +7,20 @@
7
7
  * skipping children or switching sub-tags accordingly.
8
8
  */
9
9
 
10
- import { onMount } from "@pyreon/core"
11
- import { render } from "@pyreon/ui-core"
12
- import { PKG_NAME } from "../constants"
13
- import { Content, Wrapper } from "../helpers"
14
- import type { PyreonElement } from "./types"
15
- import { getShouldBeEmpty, isInlineElement } from "./utils"
10
+ import { onMount } from '@pyreon/core'
11
+ import { render } from '@pyreon/ui-core'
12
+ import { PKG_NAME } from '../constants'
13
+ import { Content, Wrapper } from '../helpers'
14
+ import type { PyreonElement } from './types'
15
+ import { getShouldBeEmpty, isInlineElement } from './utils'
16
16
 
17
17
  const equalize = (el: HTMLElement, direction: unknown) => {
18
18
  const beforeEl = el.firstElementChild as HTMLElement | null
19
19
  const afterEl = el.lastElementChild as HTMLElement | null
20
20
 
21
21
  if (beforeEl && afterEl && beforeEl !== afterEl) {
22
- const type: "height" | "width" = direction === "rows" ? "height" : "width"
23
- const prop = type === "height" ? "offsetHeight" : "offsetWidth"
22
+ const type: 'height' | 'width' = direction === 'rows' ? 'height' : 'width'
23
+ const prop = type === 'height' ? 'offsetHeight' : 'offsetWidth'
24
24
  const beforeSize = beforeEl[prop]
25
25
  const afterSize = afterEl[prop]
26
26
 
@@ -32,10 +32,10 @@ const equalize = (el: HTMLElement, direction: unknown) => {
32
32
  }
33
33
  }
34
34
 
35
- const defaultDirection = "inline"
36
- const defaultContentDirection = "rows"
37
- const defaultAlignX = "left"
38
- const defaultAlignY = "center"
35
+ const defaultDirection = 'inline'
36
+ const defaultContentDirection = 'rows'
37
+ const defaultAlignX = 'left'
38
+ const defaultAlignY = 'center'
39
39
 
40
40
  const Component: PyreonElement = ({
41
41
  innerRef,
@@ -87,7 +87,7 @@ const Component: PyreonElement = ({
87
87
  const CHILDREN = children ?? content ?? label
88
88
 
89
89
  const isInline = isInlineElement(tag)
90
- const SUB_TAG = isInline ? "span" : undefined
90
+ const SUB_TAG = isInline ? 'span' : undefined
91
91
 
92
92
  // --------------------------------------------------------
93
93
  // direction & alignX & alignY calculations
@@ -114,7 +114,7 @@ const Component: PyreonElement = ({
114
114
 
115
115
  const mergedRef = (node: HTMLElement | null) => {
116
116
  equalizeRef = node
117
- if (typeof externalRef === "function") externalRef(node)
117
+ if (typeof externalRef === 'function') externalRef(node)
118
118
  else if (externalRef != null) {
119
119
  ;(externalRef as unknown as { current: HTMLElement | null }).current = node
120
120
  }
@@ -1,35 +1,35 @@
1
1
  /** Props consumed by Element that should not be forwarded to the underlying DOM node. */
2
2
  export const RESERVED_PROPS = [
3
- "innerRef",
4
- "tag",
5
- "block",
6
- "label",
7
- "children",
8
- "beforeContent",
9
- "afterContent",
3
+ 'innerRef',
4
+ 'tag',
5
+ 'block',
6
+ 'label',
7
+ 'children',
8
+ 'beforeContent',
9
+ 'afterContent',
10
10
 
11
- "equalCols",
12
- "vertical",
13
- "direction",
14
- "alignX",
15
- "alignY",
11
+ 'equalCols',
12
+ 'vertical',
13
+ 'direction',
14
+ 'alignX',
15
+ 'alignY',
16
16
 
17
- "css",
18
- "contentCss",
19
- "beforeContentCss",
20
- "afterContentCss",
17
+ 'css',
18
+ 'contentCss',
19
+ 'beforeContentCss',
20
+ 'afterContentCss',
21
21
 
22
- "contentDirection",
23
- "contentAlignX",
24
- "contentAlignY",
22
+ 'contentDirection',
23
+ 'contentAlignX',
24
+ 'contentAlignY',
25
25
 
26
- "beforeContentDirection",
27
- "beforeContentAlignX",
28
- "beforeContentAlignY",
26
+ 'beforeContentDirection',
27
+ 'beforeContentAlignX',
28
+ 'beforeContentAlignY',
29
29
 
30
- "afterContentDirection",
31
- "afterContentAlignX",
32
- "afterContentAlignY",
30
+ 'afterContentDirection',
31
+ 'afterContentAlignX',
32
+ 'afterContentAlignY',
33
33
  ] as const
34
34
 
35
35
  /**
@@ -1,5 +1,5 @@
1
- import component from "./component"
2
- import type { Props, PyreonElement } from "./types"
1
+ import component from './component'
2
+ import type { Props, PyreonElement } from './types'
3
3
 
4
4
  export type { Props as ElementProps, PyreonElement }
5
5
 
@@ -1,5 +1,5 @@
1
- import type { ComponentFn, PyreonHTMLAttributes } from "@pyreon/core"
2
- import type { HTMLTags } from "@pyreon/ui-core"
1
+ import type { ComponentFn, PyreonHTMLAttributes } from '@pyreon/core'
2
+ import type { HTMLTags } from '@pyreon/ui-core'
3
3
  import type {
4
4
  AlignX,
5
5
  AlignY,
@@ -10,7 +10,7 @@ import type {
10
10
  PyreonStatic,
11
11
  Responsive,
12
12
  ResponsiveBoolType,
13
- } from "../types"
13
+ } from '../types'
14
14
 
15
15
  export type Props = Partial<{
16
16
  /**
@@ -1,4 +1,4 @@
1
- import { EMPTY_ELEMENTS, INLINE_ELEMENTS } from "./constants"
1
+ import { EMPTY_ELEMENTS, INLINE_ELEMENTS } from './constants'
2
2
 
3
3
  type GetValue = (tag?: string) => boolean
4
4
 
@@ -5,13 +5,13 @@
5
5
  * is wrapped in an Element that receives all non-iterator props (e.g.,
6
6
  * layout, alignment, css), allowing the list to be styled as a single block.
7
7
  */
8
- import { omit, pick } from "@pyreon/ui-core"
9
- import { PKG_NAME } from "../constants"
10
- import type { ElementProps, PyreonElement } from "../Element"
11
- import { Element } from "../Element"
12
- import type { Props as IteratorProps } from "../helpers/Iterator"
13
- import Iterator from "../helpers/Iterator"
14
- import type { MergeTypes } from "../types"
8
+ import { omit, pick } from '@pyreon/ui-core'
9
+ import { PKG_NAME } from '../constants'
10
+ import type { ElementProps, PyreonElement } from '../Element'
11
+ import { Element } from '../Element'
12
+ import type { Props as IteratorProps } from '../helpers/Iterator'
13
+ import Iterator from '../helpers/Iterator'
14
+ import type { MergeTypes } from '../types'
15
15
 
16
16
  type ListProps = {
17
17
  /**
package/src/List/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { Props } from "./component"
2
- import component from "./component"
1
+ import type { Props } from './component'
2
+ import component from './component'
3
3
 
4
4
  export type { Props as ListProps }
5
5
  export { component as List }
@@ -6,18 +6,18 @@
6
6
  * a dropdown inside another dropdown) via blocked-state propagation.
7
7
  */
8
8
 
9
- import type { VNodeChild } from "@pyreon/core"
10
- import { onMount, Portal } from "@pyreon/core"
11
- import { render } from "@pyreon/ui-core"
12
- import { PKG_NAME } from "../constants"
13
- import type { Content, PyreonComponent } from "../types"
14
- import useOverlay, { type UseOverlayProps } from "./useOverlay"
9
+ import type { VNodeChild } from '@pyreon/core'
10
+ import { onMount, Portal } from '@pyreon/core'
11
+ import { render } from '@pyreon/ui-core'
12
+ import { PKG_NAME } from '../constants'
13
+ import type { Content, PyreonComponent } from '../types'
14
+ import useOverlay, { type UseOverlayProps } from './useOverlay'
15
15
 
16
- const IS_BROWSER = typeof window !== "undefined"
16
+ const IS_BROWSER = typeof window !== 'undefined'
17
17
 
18
- type Align = "bottom" | "top" | "left" | "right"
19
- type AlignX = "left" | "center" | "right"
20
- type AlignY = "bottom" | "top" | "center"
18
+ type Align = 'bottom' | 'top' | 'left' | 'right'
19
+ type AlignX = 'left' | 'center' | 'right'
20
+ type AlignY = 'bottom' | 'top' | 'center'
21
21
 
22
22
  type TriggerRenderer = (
23
23
  props: Partial<{
@@ -50,8 +50,8 @@ const Component: PyreonComponent<Props> = ({
50
50
  children,
51
51
  trigger,
52
52
  DOMLocation,
53
- triggerRefName = "ref",
54
- contentRefName = "ref",
53
+ triggerRefName = 'ref',
54
+ contentRefName = 'ref',
55
55
  ...props
56
56
  }) => {
57
57
  const {
@@ -71,16 +71,16 @@ const Component: PyreonComponent<Props> = ({
71
71
  const { openOn, closeOn, type } = props
72
72
 
73
73
  const passHandlers =
74
- openOn === "manual" || closeOn === "manual" || closeOn === "clickOutsideContent"
74
+ openOn === 'manual' || closeOn === 'manual' || closeOn === 'clickOutsideContent'
75
75
 
76
76
  const ariaHasPopup = (() => {
77
77
  switch (type) {
78
- case "modal":
79
- return "dialog" as const
80
- case "tooltip":
81
- return "true" as const
78
+ case 'modal':
79
+ return 'dialog' as const
80
+ case 'tooltip':
81
+ return 'true' as const
82
82
  default:
83
- return "menu" as const
83
+ return 'menu' as const
84
84
  }
85
85
  })()
86
86
 
@@ -95,8 +95,8 @@ const Component: PyreonComponent<Props> = ({
95
95
  {render(trigger, {
96
96
  [triggerRefName]: triggerRef,
97
97
  active: active(),
98
- "aria-expanded": active(),
99
- "aria-haspopup": ariaHasPopup,
98
+ 'aria-expanded': active(),
99
+ 'aria-haspopup': ariaHasPopup,
100
100
  ...(passHandlers ? { showContent, hideContent } : {}),
101
101
  })}
102
102
 
@@ -106,8 +106,8 @@ const Component: PyreonComponent<Props> = ({
106
106
  <Provider {...ctx}>
107
107
  {render(children, {
108
108
  [contentRefName]: contentRef,
109
- role: type === "modal" ? "dialog" : undefined,
110
- "aria-modal": type === "modal" ? true : undefined,
109
+ role: type === 'modal' ? 'dialog' : undefined,
110
+ 'aria-modal': type === 'modal' ? true : undefined,
111
111
  active: active(),
112
112
  align,
113
113
  alignX: alignX(),
@@ -4,8 +4,8 @@
4
4
  * closing in response to click/hover events that belong to the child.
5
5
  */
6
6
 
7
- import type { VNodeChild } from "@pyreon/core"
8
- import { createContext, provide, useContext } from "@pyreon/core"
7
+ import type { VNodeChild } from '@pyreon/core'
8
+ import { createContext, provide, useContext } from '@pyreon/core'
9
9
 
10
10
  export interface OverlayContext {
11
11
  blocked: boolean | (() => boolean)
@@ -1,6 +1,6 @@
1
- import component, { type Props } from "./component"
2
- import OverlayProvider from "./context"
3
- import useOverlay, { type UseOverlayProps } from "./useOverlay"
1
+ import component, { type Props } from './component'
2
+ import OverlayProvider from './context'
3
+ import useOverlay, { type UseOverlayProps } from './useOverlay'
4
4
 
5
5
  export type { Props as OverlayProps, UseOverlayProps }
6
6