@entry-ui/qwik 0.1.0 → 0.2.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.
- package/lib/_internal/components/index.d.ts +1 -0
- package/lib/_internal/components/primitive/index.d.ts +2 -0
- package/lib/_internal/components/primitive/primitive.d.ts +25 -0
- package/lib/_internal/components/primitive/primitive.qwik.mjs +48 -0
- package/lib/_internal/components/primitive/primitive.types.d.ts +9 -0
- package/lib/_internal/index.d.ts +1 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/separator/index.d.ts +1 -0
- package/lib/components/separator/index.qwik.mjs +4 -0
- package/lib/components/separator/parts/index.d.ts +2 -0
- package/lib/components/separator/parts/index.qwik.mjs +4 -0
- package/lib/components/separator/parts/separator-root/index.d.ts +2 -0
- package/lib/components/separator/parts/separator-root/separator-root.d.ts +7 -0
- package/lib/components/separator/parts/separator-root/separator-root.qwik.mjs +30 -0
- package/lib/components/separator/parts/separator-root/separator-root.types.d.ts +24 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.qwik.mjs +4 -1
- package/package.json +6 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './primitive';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { PrimitiveProps } from './primitive.types';
|
|
2
|
+
import type { Component } from '@qwik.dev/core';
|
|
3
|
+
/**
|
|
4
|
+
* List of HTML elements that can be created as primitive components.
|
|
5
|
+
* Each node in this array will have a corresponding component in the `Primitive` object.
|
|
6
|
+
*/
|
|
7
|
+
declare const NODES: readonly ["div", "span"];
|
|
8
|
+
/**
|
|
9
|
+
* A factory function that creates a polymorphic Qwik component for a specific HTML tag.
|
|
10
|
+
*/
|
|
11
|
+
export declare const createPrimitive: <Node extends (typeof NODES)[number]>(node: Node) => Component<PrimitiveProps<Node>>;
|
|
12
|
+
/**
|
|
13
|
+
* A collection of polymorphic primitive components.
|
|
14
|
+
*
|
|
15
|
+
* Each property represents a pre-built component for a specific HTML element
|
|
16
|
+
* that supports the `as` prop for component composition.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Self-closing tags (`<area>`, `<img>`, `<input>`) are automatically handled without slot content.
|
|
20
|
+
*/
|
|
21
|
+
export declare const Primitive: {
|
|
22
|
+
div: Component<PrimitiveProps<"div">>;
|
|
23
|
+
span: Component<PrimitiveProps<"span">>;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx } from "@qwik.dev/core/jsx-runtime";
|
|
2
|
+
import { component$, Slot } from "@qwik.dev/core";
|
|
3
|
+
const NODES = [
|
|
4
|
+
"div",
|
|
5
|
+
"span"
|
|
6
|
+
];
|
|
7
|
+
const SELF_CLOSING_TAGS = [
|
|
8
|
+
"area",
|
|
9
|
+
"base",
|
|
10
|
+
"br",
|
|
11
|
+
"col",
|
|
12
|
+
"embed",
|
|
13
|
+
"hr",
|
|
14
|
+
"img",
|
|
15
|
+
"input",
|
|
16
|
+
"link",
|
|
17
|
+
"meta",
|
|
18
|
+
"source",
|
|
19
|
+
"track",
|
|
20
|
+
"wbr"
|
|
21
|
+
];
|
|
22
|
+
const createPrimitive = (node) => {
|
|
23
|
+
return component$((props) => {
|
|
24
|
+
const { as, ...others } = props;
|
|
25
|
+
const element = as ?? node;
|
|
26
|
+
const Comp = element;
|
|
27
|
+
if (typeof element === "string" && SELF_CLOSING_TAGS.includes(element)) {
|
|
28
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
29
|
+
...others
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
33
|
+
...others,
|
|
34
|
+
children: /* @__PURE__ */ jsx(Slot, {})
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const Primitive = NODES.reduce((primitive, node) => {
|
|
39
|
+
const Node = createPrimitive(node);
|
|
40
|
+
return {
|
|
41
|
+
...primitive,
|
|
42
|
+
[node]: Node
|
|
43
|
+
};
|
|
44
|
+
}, {});
|
|
45
|
+
export {
|
|
46
|
+
Primitive,
|
|
47
|
+
createPrimitive
|
|
48
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Component, PropsOf } from '@qwik.dev/core';
|
|
2
|
+
export type PrimitiveProps<Node> = {
|
|
3
|
+
/**
|
|
4
|
+
* The element or component this component should render as.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link https://github.com/ZAHON/entry-ui/tree/main/packages/qwik/docs/guides/composition.md Composition} guide for more details.
|
|
7
|
+
*/
|
|
8
|
+
as?: string | Component;
|
|
9
|
+
} & PropsOf<Node>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './separator';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as Separator from './parts';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SeparatorRootProps } from './separator-root.types';
|
|
2
|
+
/**
|
|
3
|
+
* A horizontal or vertical line that visually and semantically separates content.
|
|
4
|
+
*
|
|
5
|
+
* Renders a `<div>` element.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SeparatorRoot: import("@qwik.dev/core").Component<SeparatorRootProps>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from "@qwik.dev/core/jsx-runtime";
|
|
2
|
+
import { component$, Slot } from "@qwik.dev/core";
|
|
3
|
+
import { Primitive } from "../../../../_internal/components/primitive/primitive.qwik.mjs";
|
|
4
|
+
const SeparatorRoot = component$((props) => {
|
|
5
|
+
const { as = "div", orientation = "horizontal", decorative = false, ...others } = props;
|
|
6
|
+
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
7
|
+
as,
|
|
8
|
+
/*
|
|
9
|
+
* When `decorative` is `true`, we use `aria-hidden="true"` and remove the `role` entirely
|
|
10
|
+
* to ensure the element is completely invisible to the accessibility tree.
|
|
11
|
+
* This is preferred over `role="none"` as it provides a more robust guarantee
|
|
12
|
+
* that assistive technologies will ignore the element and its potential children.
|
|
13
|
+
*/
|
|
14
|
+
role: decorative ? void 0 : "separator",
|
|
15
|
+
"aria-hidden": decorative ? "true" : void 0,
|
|
16
|
+
/*
|
|
17
|
+
* According to WAI-ARIA, the `"separator"` role has an implicit `aria-orientation` of `"horizontal"`.
|
|
18
|
+
* We explicitly set it here to ensure consistency with the component's internal state.
|
|
19
|
+
* When `decorative` is `true`, we remove it as the element no longer has a semantic role.
|
|
20
|
+
*/
|
|
21
|
+
"aria-orientation": decorative ? void 0 : orientation,
|
|
22
|
+
"data-entry-ui-qwik-separator-root": "",
|
|
23
|
+
"data-orientation": orientation,
|
|
24
|
+
...others,
|
|
25
|
+
children: /* @__PURE__ */ jsx(Slot, {})
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
SeparatorRoot
|
|
30
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Component, PropsOf } from '@qwik.dev/core';
|
|
2
|
+
export interface SeparatorRootProps extends PropsOf<'div'> {
|
|
3
|
+
/**
|
|
4
|
+
* The element or component this component should render as.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link https://github.com/ZAHON/entry-ui/tree/main/packages/qwik/docs/guides/composition.md Composition} guide for more details.
|
|
7
|
+
*
|
|
8
|
+
* @default "div"
|
|
9
|
+
*/
|
|
10
|
+
as?: string | Component;
|
|
11
|
+
/**
|
|
12
|
+
* The orientation of the separator.
|
|
13
|
+
*
|
|
14
|
+
* @default "horizontal"
|
|
15
|
+
*/
|
|
16
|
+
orientation?: 'horizontal' | 'vertical';
|
|
17
|
+
/**
|
|
18
|
+
* Whether or not the component is purely decorative. When `true`, accessibility-related
|
|
19
|
+
* attributes are updated so that the rendered element is removed from the accessibility tree.
|
|
20
|
+
*
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
decorative?: boolean;
|
|
24
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
package/lib/index.qwik.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entry-ui/qwik",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/ZAHON/entry-ui#readme",
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
".": {
|
|
15
15
|
"types": "./lib/index.d.ts",
|
|
16
16
|
"import": "./lib/index.qwik.mjs"
|
|
17
|
+
},
|
|
18
|
+
"./separator": {
|
|
19
|
+
"types": "./lib/components/separator/index.d.ts",
|
|
20
|
+
"import": "./lib/components/separator/index.qwik.mjs"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
"files": [
|
|
@@ -22,7 +26,7 @@
|
|
|
22
26
|
"sideEffects": false,
|
|
23
27
|
"repository": {
|
|
24
28
|
"type": "git",
|
|
25
|
-
"url": "https://github.com/ZAHON/entry-ui",
|
|
29
|
+
"url": "git+https://github.com/ZAHON/entry-ui.git",
|
|
26
30
|
"directory": "packages/qwik"
|
|
27
31
|
},
|
|
28
32
|
"bugs": {
|