@pyreon/elements 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +194 -0
- package/lib/index.d.ts +426 -0
- package/lib/index.js +1147 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present Vit Bokisch
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# @pyreon/elements
|
|
2
|
+
|
|
3
|
+
Foundational UI components for Pyreon with responsive props.
|
|
4
|
+
|
|
5
|
+
Five composable components for building buttons, cards, lists, dropdowns, tooltips, and modals. Every layout prop is responsive — pass a single value, a mobile-first array, or a breakpoint object.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Element** — three-section flex layout (beforeContent / content / afterContent)
|
|
10
|
+
- **Text** — semantic text rendering with auto paragraph wrapping
|
|
11
|
+
- **List** — data-driven rendering with positional metadata (first, last, odd, even)
|
|
12
|
+
- **Overlay** — headless trigger+content pattern
|
|
13
|
+
- **Portal** — stub (runtime-dom provides actual portal)
|
|
14
|
+
- **Responsive everything** — single value, array, or breakpoint object on every layout prop
|
|
15
|
+
- **Equal before/after** — `equalBeforeAfter` prop on Element to equalize slot dimensions
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bun add @pyreon/elements
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Components
|
|
24
|
+
|
|
25
|
+
### Element
|
|
26
|
+
|
|
27
|
+
The core layout primitive. Renders a three-section flex container with optional beforeContent and afterContent slots around the main content.
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { Element } from '@pyreon/elements'
|
|
31
|
+
|
|
32
|
+
Element({
|
|
33
|
+
tag: 'button',
|
|
34
|
+
beforeContent: Icon({ name: 'star' }),
|
|
35
|
+
afterContent: Icon({ name: 'chevron-right' }),
|
|
36
|
+
direction: 'inline',
|
|
37
|
+
alignX: 'center',
|
|
38
|
+
alignY: 'center',
|
|
39
|
+
gap: 8,
|
|
40
|
+
children: 'Click me',
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
When only content is present (no beforeContent/afterContent), Element optimizes by skipping the inner wrapper layer.
|
|
45
|
+
|
|
46
|
+
**Content props** (rendered in priority order: children > content > label):
|
|
47
|
+
|
|
48
|
+
| Prop | Type | Description |
|
|
49
|
+
| ---- | ---- | ----------- |
|
|
50
|
+
| children | `VNode` | Standard children |
|
|
51
|
+
| content | `VNode` | Alternative to children |
|
|
52
|
+
| label | `VNode` | Alternative to children/content |
|
|
53
|
+
| beforeContent | `VNode` | Content rendered before the main slot |
|
|
54
|
+
| afterContent | `VNode` | Content rendered after the main slot |
|
|
55
|
+
|
|
56
|
+
**Layout props** (all responsive):
|
|
57
|
+
|
|
58
|
+
| Prop | Type | Default | Description |
|
|
59
|
+
| ---- | ---- | ------- | ----------- |
|
|
60
|
+
| tag | `HTMLTags` | `'div'` | HTML element tag |
|
|
61
|
+
| block | `boolean` | — | `flex` vs `inline-flex` |
|
|
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 |
|
|
67
|
+
|
|
68
|
+
Each section (content, beforeContent, afterContent) has its own direction, alignX, and alignY props prefixed with the section name:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
Element({
|
|
72
|
+
contentDirection: 'rows',
|
|
73
|
+
contentAlignX: 'center',
|
|
74
|
+
beforeContentAlignY: 'top',
|
|
75
|
+
afterContentDirection: 'inline',
|
|
76
|
+
})
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Text
|
|
80
|
+
|
|
81
|
+
Semantic text component with optional paragraph auto-wrapping.
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { Text } from '@pyreon/elements'
|
|
85
|
+
|
|
86
|
+
Text({ tag: 'h1', children: 'Heading' })
|
|
87
|
+
Text({ paragraph: true, children: 'This renders as a p tag.' })
|
|
88
|
+
Text({ tag: 'strong', label: 'Bold text' })
|
|
89
|
+
```
|
|
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 |
|
|
97
|
+
|
|
98
|
+
### List
|
|
99
|
+
|
|
100
|
+
Data-driven list renderer with positional metadata.
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { List, Element } from '@pyreon/elements'
|
|
104
|
+
|
|
105
|
+
// Simple string data
|
|
106
|
+
List({
|
|
107
|
+
component: Element,
|
|
108
|
+
data: ['Apple', 'Banana', 'Cherry'],
|
|
109
|
+
valueName: 'label',
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
// Object data with positional metadata
|
|
113
|
+
List({
|
|
114
|
+
component: ListItem,
|
|
115
|
+
data: [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }],
|
|
116
|
+
itemKey: 'id',
|
|
117
|
+
itemProps: (item, { first, last, odd, even, index }) => ({
|
|
118
|
+
highlighted: first,
|
|
119
|
+
separator: !last,
|
|
120
|
+
}),
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
// With root Element wrapper
|
|
124
|
+
List({
|
|
125
|
+
rootElement: true,
|
|
126
|
+
direction: 'rows',
|
|
127
|
+
gap: 8,
|
|
128
|
+
component: Card,
|
|
129
|
+
data: items,
|
|
130
|
+
})
|
|
131
|
+
```
|
|
132
|
+
|
|
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.) |
|
|
142
|
+
|
|
143
|
+
**Positional metadata** passed to `itemProps` callback:
|
|
144
|
+
|
|
145
|
+
`index`, `first`, `last`, `odd`, `even`, `position` (1-based)
|
|
146
|
+
|
|
147
|
+
### Overlay
|
|
148
|
+
|
|
149
|
+
Headless trigger+content pattern for dropdowns, tooltips, and modals.
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
import { Overlay } from '@pyreon/elements'
|
|
153
|
+
|
|
154
|
+
Overlay({
|
|
155
|
+
openOn: 'click',
|
|
156
|
+
closeOn: 'clickOutsideContent',
|
|
157
|
+
align: 'bottom',
|
|
158
|
+
alignX: 'left',
|
|
159
|
+
trigger: Button({ label: 'Open menu' }),
|
|
160
|
+
children: DropdownMenu({}),
|
|
161
|
+
})
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Portal
|
|
165
|
+
|
|
166
|
+
Stub component — the actual portal implementation is provided by `@pyreon/core`'s runtime-dom.
|
|
167
|
+
|
|
168
|
+
## Responsive Values
|
|
169
|
+
|
|
170
|
+
Every layout prop (direction, alignX, alignY, gap, block, equalCols) supports three formats:
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
// Single value — all breakpoints
|
|
174
|
+
Element({ direction: 'inline' })
|
|
175
|
+
|
|
176
|
+
// Array — mobile-first, maps to breakpoints by position
|
|
177
|
+
Element({ direction: ['rows', 'inline'] })
|
|
178
|
+
|
|
179
|
+
// Object — explicit breakpoints
|
|
180
|
+
Element({ direction: { xs: 'rows', md: 'inline', lg: 'inline' } })
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Peer Dependencies
|
|
184
|
+
|
|
185
|
+
| Package | Version |
|
|
186
|
+
| ------- | ------- |
|
|
187
|
+
| @pyreon/core | >= 0.0.1 |
|
|
188
|
+
| @pyreon/reactivity | >= 0.0.1 |
|
|
189
|
+
| @pyreon/ui-core | >= 0.0.1 |
|
|
190
|
+
| @pyreon/unistyle | >= 0.0.1 |
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
MIT
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import { Provider } from "@pyreon/unistyle";
|
|
2
|
+
import * as _pyreon_core0 from "@pyreon/core";
|
|
3
|
+
import { ComponentFn, VNodeChild } from "@pyreon/core";
|
|
4
|
+
import { BreakpointKeys, HTMLTags, HTMLTextTags, config, render } from "@pyreon/ui-core";
|
|
5
|
+
import * as _pyreon_reactivity0 from "@pyreon/reactivity";
|
|
6
|
+
|
|
7
|
+
//#region src/types.d.ts
|
|
8
|
+
type ExtractNullableKeys<T> = { [P in keyof T as T[P] extends null | undefined ? never : P]: T[P] };
|
|
9
|
+
type Id<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;
|
|
10
|
+
type SpreadTwo<L, R> = Id<Pick<L, Exclude<keyof L, keyof R>> & R>;
|
|
11
|
+
type Spread<A extends readonly [...any]> = A extends [infer L, ...infer R] ? SpreadTwo<L, Spread<R>> : unknown;
|
|
12
|
+
type MergeTypes<A extends readonly [...any]> = ExtractNullableKeys<Spread<A>>;
|
|
13
|
+
type InnerRef = HTMLElement | ((el: HTMLElement | null) => void) | null;
|
|
14
|
+
type CssCallback = (css: typeof config.css) => ReturnType<typeof css>;
|
|
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";
|
|
20
|
+
type ContentBoolean = boolean;
|
|
21
|
+
type ContentSimpleValue = string | number;
|
|
22
|
+
type AlignY = ContentAlignY | ContentAlignY[] | Partial<Record<BreakpointKeys, ContentAlignY>>;
|
|
23
|
+
type AlignX = ContentAlignX | ContentAlignX[] | Partial<Record<BreakpointKeys, ContentAlignX>>;
|
|
24
|
+
type Direction = ContentDirection | ContentDirection[] | Partial<Record<BreakpointKeys, ContentDirection>>;
|
|
25
|
+
type ResponsiveBoolType = ContentBoolean | ContentBoolean[] | Partial<Record<BreakpointKeys, ContentBoolean>>;
|
|
26
|
+
type Responsive = ContentSimpleValue | ContentSimpleValue[] | Partial<Record<BreakpointKeys, number | string>>;
|
|
27
|
+
type ExtendCss = Css | Css[] | Partial<Record<BreakpointKeys, Css>>;
|
|
28
|
+
type PyreonComponent<P extends Record<string, any> = Record<string, unknown>> = ComponentFn<P> & PyreonStatic;
|
|
29
|
+
interface PyreonStatic {
|
|
30
|
+
displayName?: string | undefined;
|
|
31
|
+
pkgName?: string;
|
|
32
|
+
PYREON__COMPONENT?: `@pyreon/${string}`;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/Element/types.d.ts
|
|
36
|
+
type Props = Partial<{
|
|
37
|
+
/**
|
|
38
|
+
* Valid HTML Tag
|
|
39
|
+
*/
|
|
40
|
+
tag: HTMLTags;
|
|
41
|
+
/**
|
|
42
|
+
* Ref prop, alternative to `ref`
|
|
43
|
+
*/
|
|
44
|
+
innerRef: InnerRef;
|
|
45
|
+
/**
|
|
46
|
+
* Valid `children`
|
|
47
|
+
*/
|
|
48
|
+
children: Content;
|
|
49
|
+
/**
|
|
50
|
+
* Alternative prop to `children`
|
|
51
|
+
* It is recommended to pass only one of `children`, `content` or `label` props
|
|
52
|
+
*
|
|
53
|
+
* The prioritization of rendering is following: `children` → `content` → `label`
|
|
54
|
+
*/
|
|
55
|
+
content: Content;
|
|
56
|
+
/**
|
|
57
|
+
* Alternative prop to `children`
|
|
58
|
+
* It is recommended to pass only one of `children`, `content` or `label` props
|
|
59
|
+
*
|
|
60
|
+
* The prioritization of rendering is following: `children` → `content` → `label`
|
|
61
|
+
*/
|
|
62
|
+
label: Content;
|
|
63
|
+
/**
|
|
64
|
+
* Valid `children` to be rendered inside _beforeContent_ wrapper
|
|
65
|
+
*/
|
|
66
|
+
beforeContent: Content;
|
|
67
|
+
/**
|
|
68
|
+
* Valid `children` to be rendered inside _afterContent_ wrapper
|
|
69
|
+
*/
|
|
70
|
+
afterContent: Content;
|
|
71
|
+
/**
|
|
72
|
+
* A boolean type to define whether **Element** should behave
|
|
73
|
+
* as an inline or block element (`flex` vs. `inline-flex`)
|
|
74
|
+
*/
|
|
75
|
+
block: ResponsiveBoolType;
|
|
76
|
+
/**
|
|
77
|
+
* A boolean type to define whether inner wrappers should be equal
|
|
78
|
+
* (have the same width or height)
|
|
79
|
+
*/
|
|
80
|
+
equalCols: ResponsiveBoolType;
|
|
81
|
+
/**
|
|
82
|
+
* When true, measures the `beforeContent` and `afterContent` slot wrappers
|
|
83
|
+
* after render and sets both to the larger dimension so they match.
|
|
84
|
+
*/
|
|
85
|
+
equalBeforeAfter: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Defines a `gap` spacing between inner wrappers
|
|
88
|
+
*/
|
|
89
|
+
gap: Responsive;
|
|
90
|
+
/**
|
|
91
|
+
* Defines direction of inner wrappers
|
|
92
|
+
*/
|
|
93
|
+
direction: Direction;
|
|
94
|
+
/**
|
|
95
|
+
* Defines flow of `children` elements within its inner wrapper.
|
|
96
|
+
*/
|
|
97
|
+
contentDirection: Direction;
|
|
98
|
+
/**
|
|
99
|
+
* Defines flow of `beforeContent` elements within its inner wrapper.
|
|
100
|
+
*/
|
|
101
|
+
beforeContentDirection: Direction;
|
|
102
|
+
/**
|
|
103
|
+
* Defines flow of `afterContent` elements within its inner wrapper.
|
|
104
|
+
*/
|
|
105
|
+
afterContentDirection: Direction;
|
|
106
|
+
/**
|
|
107
|
+
* Define alignment horizontally.
|
|
108
|
+
*/
|
|
109
|
+
alignX: AlignX;
|
|
110
|
+
/**
|
|
111
|
+
* Defines how `content` children are aligned horizontally.
|
|
112
|
+
*/
|
|
113
|
+
contentAlignX: AlignX;
|
|
114
|
+
/**
|
|
115
|
+
* Defines how `beforeContent` children are aligned horizontally.
|
|
116
|
+
*/
|
|
117
|
+
beforeContentAlignX: AlignX;
|
|
118
|
+
/**
|
|
119
|
+
* Defines how `afterContent` children are aligned horizontally.
|
|
120
|
+
*/
|
|
121
|
+
afterContentAlignX: AlignX;
|
|
122
|
+
/**
|
|
123
|
+
* Define alignment vertically.
|
|
124
|
+
*/
|
|
125
|
+
alignY: AlignY;
|
|
126
|
+
/**
|
|
127
|
+
* Defines how `content` children are aligned vertically.
|
|
128
|
+
*/
|
|
129
|
+
contentAlignY: AlignY;
|
|
130
|
+
/**
|
|
131
|
+
* Defines how `beforeContent` children are aligned vertically.
|
|
132
|
+
*/
|
|
133
|
+
beforeContentAlignY: AlignY;
|
|
134
|
+
/**
|
|
135
|
+
* Defines how `afterContent` children are aligned vertically.
|
|
136
|
+
*/
|
|
137
|
+
afterContentAlignY: AlignY;
|
|
138
|
+
/**
|
|
139
|
+
* `dangerouslySetInnerHTML` prop
|
|
140
|
+
*/
|
|
141
|
+
dangerouslySetInnerHTML: {
|
|
142
|
+
__html: string;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* An additional prop for extending styling of the **root** wrapper element
|
|
146
|
+
*/
|
|
147
|
+
css: ExtendCss;
|
|
148
|
+
/**
|
|
149
|
+
* An additional prop for extending styling of the **content** wrapper element.
|
|
150
|
+
*/
|
|
151
|
+
contentCss: ExtendCss;
|
|
152
|
+
/**
|
|
153
|
+
* An additional prop for extending styling of the **beforeContent** wrapper element.
|
|
154
|
+
*/
|
|
155
|
+
beforeContentCss: ExtendCss;
|
|
156
|
+
/**
|
|
157
|
+
* An additional prop for extending styling of the **afterContent** wrapper element.
|
|
158
|
+
*/
|
|
159
|
+
afterContentCss: ExtendCss;
|
|
160
|
+
}>;
|
|
161
|
+
type PyreonElement<P extends Record<string, unknown> = Record<string, unknown>> = ComponentFn<Props & P> & PyreonStatic;
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/Element/component.d.ts
|
|
164
|
+
declare const Component: PyreonElement;
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/helpers/Iterator/types.d.ts
|
|
167
|
+
type MaybeNull = undefined | null;
|
|
168
|
+
type TObj = Record<string, unknown>;
|
|
169
|
+
type SimpleValue = string | number;
|
|
170
|
+
type ObjectValue = Partial<{
|
|
171
|
+
id: SimpleValue;
|
|
172
|
+
key: SimpleValue;
|
|
173
|
+
itemId: SimpleValue;
|
|
174
|
+
component: ElementType;
|
|
175
|
+
}> & Record<string, unknown>;
|
|
176
|
+
type ElementType<T extends Record<string, unknown> = any> = ComponentFn<T> | HTMLTags;
|
|
177
|
+
type ExtendedProps = {
|
|
178
|
+
index: number;
|
|
179
|
+
first: boolean;
|
|
180
|
+
last: boolean;
|
|
181
|
+
odd: boolean;
|
|
182
|
+
even: boolean;
|
|
183
|
+
position: number;
|
|
184
|
+
};
|
|
185
|
+
type PropsCallback = TObj | ((itemProps: Record<string, never> | Record<string, SimpleValue> | ObjectValue, extendedProps: ExtendedProps) => TObj);
|
|
186
|
+
type Props$1 = Partial<{
|
|
187
|
+
/**
|
|
188
|
+
* Valid children
|
|
189
|
+
*/
|
|
190
|
+
children: VNodeChild;
|
|
191
|
+
/**
|
|
192
|
+
* Array of data passed to `component` prop
|
|
193
|
+
*/
|
|
194
|
+
data: Array<SimpleValue | ObjectValue | MaybeNull>;
|
|
195
|
+
/**
|
|
196
|
+
* A component to be rendered within list
|
|
197
|
+
*/
|
|
198
|
+
component: ElementType;
|
|
199
|
+
/**
|
|
200
|
+
* Defines name of the prop to be passed to the iteration component
|
|
201
|
+
* when **data** prop is type of `string[]`, `number[]` or combination
|
|
202
|
+
* of both. Otherwise ignored.
|
|
203
|
+
*/
|
|
204
|
+
valueName: string;
|
|
205
|
+
/**
|
|
206
|
+
* A component to be rendered within list. `wrapComponent`
|
|
207
|
+
* wraps `component`. Therefore it can be used to enhance the behavior
|
|
208
|
+
* of the list component
|
|
209
|
+
*/
|
|
210
|
+
wrapComponent: ElementType;
|
|
211
|
+
/**
|
|
212
|
+
* Extension of **item** `component` props to be passed
|
|
213
|
+
*/
|
|
214
|
+
itemProps: PropsCallback;
|
|
215
|
+
/**
|
|
216
|
+
* Extension of **item** `wrapComponent` props to be passed
|
|
217
|
+
*/
|
|
218
|
+
wrapProps?: PropsCallback;
|
|
219
|
+
/**
|
|
220
|
+
* Extension of **item** `wrapComponent` props to be passed
|
|
221
|
+
*/
|
|
222
|
+
itemKey?: keyof ObjectValue | ((item: SimpleValue | Omit<ObjectValue, "component">, index: number) => SimpleValue);
|
|
223
|
+
}>;
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/helpers/Iterator/component.d.ts
|
|
226
|
+
declare const _default: ((props: Props$1) => VNodeChild) & {
|
|
227
|
+
isIterator: true;
|
|
228
|
+
RESERVED_PROPS: readonly ["children", "component", "wrapComponent", "data", "itemKey", "valueName", "itemProps", "wrapProps"];
|
|
229
|
+
};
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/List/component.d.ts
|
|
232
|
+
type ListProps = {
|
|
233
|
+
/**
|
|
234
|
+
* A boolean value. When set to `false`, component returns fragment.
|
|
235
|
+
* When set to `true`, component returns as the **root** element `Element`
|
|
236
|
+
* component.
|
|
237
|
+
*/
|
|
238
|
+
rootElement?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Label prop from `Element` component is being ignored.
|
|
241
|
+
*/
|
|
242
|
+
label: never;
|
|
243
|
+
/**
|
|
244
|
+
* Content prop from `Element` component is being ignored.
|
|
245
|
+
*/
|
|
246
|
+
content: never;
|
|
247
|
+
};
|
|
248
|
+
type Props$2 = MergeTypes<[Props$1, ListProps]>;
|
|
249
|
+
declare const Component$1: PyreonElement<Props$2>;
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/Overlay/context.d.ts
|
|
252
|
+
interface OverlayContext {
|
|
253
|
+
blocked: boolean | (() => boolean);
|
|
254
|
+
setBlocked: () => void;
|
|
255
|
+
setUnblocked: () => void;
|
|
256
|
+
}
|
|
257
|
+
declare const Component$3: ({
|
|
258
|
+
children,
|
|
259
|
+
blocked,
|
|
260
|
+
setBlocked,
|
|
261
|
+
setUnblocked
|
|
262
|
+
}: OverlayContext & {
|
|
263
|
+
children: VNodeChild;
|
|
264
|
+
}) => any;
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/Overlay/useOverlay.d.ts
|
|
267
|
+
/**
|
|
268
|
+
* Core hook powering the Overlay component. Manages open/close state, DOM
|
|
269
|
+
* event listeners (click, hover, scroll, resize, ESC key), and dynamic
|
|
270
|
+
* positioning of overlay content relative to its trigger. Supports dropdown,
|
|
271
|
+
* tooltip, popover, and modal types with automatic edge-of-viewport flipping.
|
|
272
|
+
* Event handlers are throttled for performance, and nested overlay blocking
|
|
273
|
+
* is coordinated through the overlay context.
|
|
274
|
+
*/
|
|
275
|
+
type Align$1 = "bottom" | "top" | "left" | "right";
|
|
276
|
+
type AlignX$2 = "left" | "center" | "right";
|
|
277
|
+
type AlignY$2 = "bottom" | "top" | "center";
|
|
278
|
+
type UseOverlayProps = Partial<{
|
|
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";
|
|
284
|
+
align: Align$1;
|
|
285
|
+
alignX: AlignX$2;
|
|
286
|
+
alignY: AlignY$2;
|
|
287
|
+
offsetX: number;
|
|
288
|
+
offsetY: number;
|
|
289
|
+
throttleDelay: number;
|
|
290
|
+
parentContainer: HTMLElement | null;
|
|
291
|
+
closeOnEsc: boolean;
|
|
292
|
+
hoverDelay: number;
|
|
293
|
+
disabled: boolean;
|
|
294
|
+
onOpen: () => void;
|
|
295
|
+
onClose: () => void;
|
|
296
|
+
}>;
|
|
297
|
+
declare const useOverlay: ({
|
|
298
|
+
isOpen,
|
|
299
|
+
openOn,
|
|
300
|
+
closeOn,
|
|
301
|
+
type,
|
|
302
|
+
position,
|
|
303
|
+
align,
|
|
304
|
+
alignX: propAlignX,
|
|
305
|
+
alignY: propAlignY,
|
|
306
|
+
offsetX,
|
|
307
|
+
offsetY,
|
|
308
|
+
throttleDelay,
|
|
309
|
+
parentContainer,
|
|
310
|
+
closeOnEsc,
|
|
311
|
+
hoverDelay,
|
|
312
|
+
disabled,
|
|
313
|
+
onOpen,
|
|
314
|
+
onClose
|
|
315
|
+
}?: Partial<UseOverlayProps>) => {
|
|
316
|
+
triggerRef: (node: HTMLElement | null) => void;
|
|
317
|
+
contentRef: (node: HTMLElement | null) => void;
|
|
318
|
+
active: _pyreon_reactivity0.Signal<boolean>;
|
|
319
|
+
align: Align$1;
|
|
320
|
+
alignX: _pyreon_reactivity0.Signal<AlignX$2>;
|
|
321
|
+
alignY: _pyreon_reactivity0.Signal<AlignY$2>;
|
|
322
|
+
showContent: () => void;
|
|
323
|
+
hideContent: () => void;
|
|
324
|
+
blocked: () => boolean;
|
|
325
|
+
setBlocked: () => void;
|
|
326
|
+
setUnblocked: () => void;
|
|
327
|
+
setupListeners: () => () => void;
|
|
328
|
+
Provider: ({
|
|
329
|
+
children,
|
|
330
|
+
blocked,
|
|
331
|
+
setBlocked,
|
|
332
|
+
setUnblocked
|
|
333
|
+
}: OverlayContext & {
|
|
334
|
+
children: _pyreon_core0.VNodeChild;
|
|
335
|
+
}) => any;
|
|
336
|
+
};
|
|
337
|
+
//#endregion
|
|
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";
|
|
342
|
+
type TriggerRenderer = (props: Partial<{
|
|
343
|
+
active: boolean;
|
|
344
|
+
showContent: () => void;
|
|
345
|
+
hideContent: () => void;
|
|
346
|
+
}>) => VNodeChild;
|
|
347
|
+
type ContentRenderer = (props: Partial<{
|
|
348
|
+
active: boolean;
|
|
349
|
+
showContent: () => void;
|
|
350
|
+
hideContent: () => void;
|
|
351
|
+
align: Align;
|
|
352
|
+
alignX: AlignX$1;
|
|
353
|
+
alignY: AlignY$1;
|
|
354
|
+
}>) => VNodeChild;
|
|
355
|
+
type Props$3 = {
|
|
356
|
+
children: ContentRenderer | Content;
|
|
357
|
+
trigger: TriggerRenderer | Content;
|
|
358
|
+
DOMLocation?: HTMLElement;
|
|
359
|
+
triggerRefName?: string;
|
|
360
|
+
contentRefName?: string;
|
|
361
|
+
} & UseOverlayProps;
|
|
362
|
+
declare const Component$2: PyreonComponent<Props$3>;
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region src/Portal/component.d.ts
|
|
365
|
+
interface Props$4 {
|
|
366
|
+
/**
|
|
367
|
+
* Defines a HTML DOM where children to be appended.
|
|
368
|
+
*/
|
|
369
|
+
DOMLocation?: HTMLElement;
|
|
370
|
+
/**
|
|
371
|
+
* Children to be rendered within **Portal** component.
|
|
372
|
+
*/
|
|
373
|
+
children: VNodeChild;
|
|
374
|
+
/**
|
|
375
|
+
* Valid HTML Tag
|
|
376
|
+
*/
|
|
377
|
+
tag?: string;
|
|
378
|
+
}
|
|
379
|
+
declare const Component$4: PyreonComponent<Props$4>;
|
|
380
|
+
//#endregion
|
|
381
|
+
//#region src/Text/component.d.ts
|
|
382
|
+
type Props$5 = Partial<{
|
|
383
|
+
/**
|
|
384
|
+
* Label can be used instead of children for inline syntax. But **children** prop takes a precedence
|
|
385
|
+
*/
|
|
386
|
+
label: VNodeChild;
|
|
387
|
+
/**
|
|
388
|
+
* Children to be rendered within **Text** component.
|
|
389
|
+
*/
|
|
390
|
+
children: VNodeChild;
|
|
391
|
+
/**
|
|
392
|
+
* Defines whether should behave as a block text element. Automatically adds **p** HTML tag
|
|
393
|
+
*/
|
|
394
|
+
paragraph: boolean;
|
|
395
|
+
/**
|
|
396
|
+
* Defines what kind of HTML tag should be rendered
|
|
397
|
+
*/
|
|
398
|
+
tag: HTMLTextTags;
|
|
399
|
+
/**
|
|
400
|
+
* If an additional styling needs to be added, it can be do so via injecting styles using this property.
|
|
401
|
+
*/
|
|
402
|
+
css: ExtendCss;
|
|
403
|
+
}> & Record<string, unknown>;
|
|
404
|
+
declare const Component$5: PyreonComponent<Props$5> & {
|
|
405
|
+
isText?: true;
|
|
406
|
+
};
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region src/Util/component.d.ts
|
|
409
|
+
interface Props$6 {
|
|
410
|
+
/**
|
|
411
|
+
* Children to be rendered within **Util** component.
|
|
412
|
+
*/
|
|
413
|
+
children: VNodeChild;
|
|
414
|
+
/**
|
|
415
|
+
* Class name(s) to be added to children component.
|
|
416
|
+
*/
|
|
417
|
+
className?: string | string[] | undefined;
|
|
418
|
+
/**
|
|
419
|
+
* Style property to extend children component inline styles
|
|
420
|
+
*/
|
|
421
|
+
style?: Record<string, unknown> | undefined;
|
|
422
|
+
}
|
|
423
|
+
declare const Component$6: PyreonComponent<Props$6>;
|
|
424
|
+
//#endregion
|
|
425
|
+
export { type AlignX, type AlignY, type Content, type ContentBoolean, type Direction, Component as Element, type Props as ElementProps, type ElementType, type ExtendCss, type ExtendedProps, type InnerRef, _default as Iterator, type Props$1 as IteratorProps, Component$1 as List, type Props$2 as ListProps, type ObjectValue, Component$2 as Overlay, type Props$3 as OverlayProps, Component$3 as OverlayProvider, Component$4 as Portal, type Props$4 as PortalProps, type PropsCallback, Provider, type PyreonElement, type PyreonStatic, type Responsive, type ResponsiveBoolType, type SimpleValue, Component$5 as Text, type Props$5 as TextProps, type UseOverlayProps, Component$6 as Util, type Props$6 as UtilProps, useOverlay };
|
|
426
|
+
//# sourceMappingURL=index2.d.ts.map
|