@leve-ui/field 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/lib/field-description.qwik.cjs +18 -0
- package/lib/field-description.qwik.mjs +18 -0
- package/lib/field-error-message.qwik.cjs +21 -0
- package/lib/field-error-message.qwik.mjs +21 -0
- package/lib/field-input.qwik.cjs +36 -0
- package/lib/field-input.qwik.mjs +36 -0
- package/lib/field-label.qwik.cjs +22 -0
- package/lib/field-label.qwik.mjs +22 -0
- package/lib/field-root.qwik.cjs +27 -0
- package/lib/field-root.qwik.mjs +27 -0
- package/lib/field-textarea.qwik.cjs +30 -0
- package/lib/field-textarea.qwik.mjs +30 -0
- package/lib/field.qwik.cjs +14 -0
- package/lib/field.qwik.mjs +14 -0
- package/lib/index.qwik.cjs +4 -0
- package/lib/index.qwik.mjs +4 -0
- package/lib-types/field-description.d.ts +12 -0
- package/lib-types/field-error-message.d.ts +11 -0
- package/lib-types/field-input.d.ts +15 -0
- package/lib-types/field-label.d.ts +13 -0
- package/lib-types/field-root.d.ts +19 -0
- package/lib-types/field-textarea.d.ts +13 -0
- package/lib-types/field.d.ts +6 -0
- package/lib-types/index.d.ts +7 -0
- package/package.json +58 -3
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 leve-ui contributors
|
|
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.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
|
+
const qwik = require("@builder.io/qwik");
|
|
5
|
+
const utils = require("@leve-ui/utils");
|
|
6
|
+
const FieldDescription = qwik.component$((props) => {
|
|
7
|
+
const field = utils.useFieldContext();
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
9
|
+
...props,
|
|
10
|
+
id: field ? field.ids.description : props.id,
|
|
11
|
+
"data-leve-field-description": "",
|
|
12
|
+
"data-invalid": utils.dataAttr(field?.invalid.value),
|
|
13
|
+
"data-disabled": utils.dataAttr(field?.disabled.value),
|
|
14
|
+
"data-required": utils.dataAttr(field?.required.value),
|
|
15
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
exports.FieldDescription = FieldDescription;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
+
import { component$, Slot } from "@builder.io/qwik";
|
|
3
|
+
import { useFieldContext, dataAttr } from "@leve-ui/utils";
|
|
4
|
+
const FieldDescription = component$((props) => {
|
|
5
|
+
const field = useFieldContext();
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
...props,
|
|
8
|
+
id: field ? field.ids.description : props.id,
|
|
9
|
+
"data-leve-field-description": "",
|
|
10
|
+
"data-invalid": dataAttr(field?.invalid.value),
|
|
11
|
+
"data-disabled": dataAttr(field?.disabled.value),
|
|
12
|
+
"data-required": dataAttr(field?.required.value),
|
|
13
|
+
children: /* @__PURE__ */ jsx(Slot, {})
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
FieldDescription
|
|
18
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
|
+
const qwik = require("@builder.io/qwik");
|
|
5
|
+
const utils = require("@leve-ui/utils");
|
|
6
|
+
const FieldErrorMessage = qwik.component$((props) => {
|
|
7
|
+
const field = utils.useFieldContext();
|
|
8
|
+
if (field && !field.invalid.value) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
12
|
+
...props,
|
|
13
|
+
id: field ? field.ids.errorMessage : props.id,
|
|
14
|
+
"data-leve-field-error-message": "",
|
|
15
|
+
"data-invalid": utils.dataAttr(field?.invalid.value),
|
|
16
|
+
"data-disabled": utils.dataAttr(field?.disabled.value),
|
|
17
|
+
"data-required": utils.dataAttr(field?.required.value),
|
|
18
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
exports.FieldErrorMessage = FieldErrorMessage;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
+
import { component$, Slot } from "@builder.io/qwik";
|
|
3
|
+
import { useFieldContext, dataAttr } from "@leve-ui/utils";
|
|
4
|
+
const FieldErrorMessage = component$((props) => {
|
|
5
|
+
const field = useFieldContext();
|
|
6
|
+
if (field && !field.invalid.value) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return /* @__PURE__ */ jsx("div", {
|
|
10
|
+
...props,
|
|
11
|
+
id: field ? field.ids.errorMessage : props.id,
|
|
12
|
+
"data-leve-field-error-message": "",
|
|
13
|
+
"data-invalid": dataAttr(field?.invalid.value),
|
|
14
|
+
"data-disabled": dataAttr(field?.disabled.value),
|
|
15
|
+
"data-required": dataAttr(field?.required.value),
|
|
16
|
+
children: /* @__PURE__ */ jsx(Slot, {})
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
FieldErrorMessage
|
|
21
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
|
+
const qwik = require("@builder.io/qwik");
|
|
5
|
+
const utils = require("@leve-ui/utils");
|
|
6
|
+
const FieldInput = qwik.component$(({ "bind:value": bindValue, "bind:checked": bindChecked, ...props }) => {
|
|
7
|
+
const control = utils.useFieldControl(props);
|
|
8
|
+
const commonProps = {
|
|
9
|
+
...props,
|
|
10
|
+
id: control.value.id,
|
|
11
|
+
"aria-describedby": control.value.describedBy,
|
|
12
|
+
"aria-invalid": control.value.invalid ? "true" : void 0,
|
|
13
|
+
disabled: control.value.disabled,
|
|
14
|
+
required: control.value.required,
|
|
15
|
+
"data-leve-field-input": "",
|
|
16
|
+
"data-invalid": utils.dataAttr(control.value.invalid),
|
|
17
|
+
"data-disabled": utils.dataAttr(control.value.disabled),
|
|
18
|
+
"data-required": utils.dataAttr(control.value.required)
|
|
19
|
+
};
|
|
20
|
+
if (bindChecked !== void 0) {
|
|
21
|
+
return /* @__PURE__ */ jsxRuntime.jsx("input", {
|
|
22
|
+
...commonProps,
|
|
23
|
+
"bind:checked": bindChecked
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (bindValue !== void 0) {
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsx("input", {
|
|
28
|
+
...commonProps,
|
|
29
|
+
"bind:value": bindValue
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsx("input", {
|
|
33
|
+
...commonProps
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
exports.FieldInput = FieldInput;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
+
import { component$ } from "@builder.io/qwik";
|
|
3
|
+
import { useFieldControl, dataAttr } from "@leve-ui/utils";
|
|
4
|
+
const FieldInput = component$(({ "bind:value": bindValue, "bind:checked": bindChecked, ...props }) => {
|
|
5
|
+
const control = useFieldControl(props);
|
|
6
|
+
const commonProps = {
|
|
7
|
+
...props,
|
|
8
|
+
id: control.value.id,
|
|
9
|
+
"aria-describedby": control.value.describedBy,
|
|
10
|
+
"aria-invalid": control.value.invalid ? "true" : void 0,
|
|
11
|
+
disabled: control.value.disabled,
|
|
12
|
+
required: control.value.required,
|
|
13
|
+
"data-leve-field-input": "",
|
|
14
|
+
"data-invalid": dataAttr(control.value.invalid),
|
|
15
|
+
"data-disabled": dataAttr(control.value.disabled),
|
|
16
|
+
"data-required": dataAttr(control.value.required)
|
|
17
|
+
};
|
|
18
|
+
if (bindChecked !== void 0) {
|
|
19
|
+
return /* @__PURE__ */ jsx("input", {
|
|
20
|
+
...commonProps,
|
|
21
|
+
"bind:checked": bindChecked
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (bindValue !== void 0) {
|
|
25
|
+
return /* @__PURE__ */ jsx("input", {
|
|
26
|
+
...commonProps,
|
|
27
|
+
"bind:value": bindValue
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return /* @__PURE__ */ jsx("input", {
|
|
31
|
+
...commonProps
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
FieldInput
|
|
36
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
|
+
const qwik = require("@builder.io/qwik");
|
|
5
|
+
const utils = require("@leve-ui/utils");
|
|
6
|
+
const FieldLabel = qwik.component$((props) => {
|
|
7
|
+
const field = utils.useFieldContext();
|
|
8
|
+
return (
|
|
9
|
+
// biome-ignore lint/a11y/noLabelWithoutControl: コントロールとの関連付けは Field Context の for 属性で行う
|
|
10
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", {
|
|
11
|
+
...props,
|
|
12
|
+
id: field ? field.ids.label : props.id,
|
|
13
|
+
for: field ? field.ids.control : props.for,
|
|
14
|
+
"data-leve-field-label": "",
|
|
15
|
+
"data-invalid": utils.dataAttr(field?.invalid.value),
|
|
16
|
+
"data-disabled": utils.dataAttr(field?.disabled.value),
|
|
17
|
+
"data-required": utils.dataAttr(field?.required.value),
|
|
18
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
exports.FieldLabel = FieldLabel;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
+
import { component$, Slot } from "@builder.io/qwik";
|
|
3
|
+
import { useFieldContext, dataAttr } from "@leve-ui/utils";
|
|
4
|
+
const FieldLabel = component$((props) => {
|
|
5
|
+
const field = useFieldContext();
|
|
6
|
+
return (
|
|
7
|
+
// biome-ignore lint/a11y/noLabelWithoutControl: コントロールとの関連付けは Field Context の for 属性で行う
|
|
8
|
+
/* @__PURE__ */ jsx("label", {
|
|
9
|
+
...props,
|
|
10
|
+
id: field ? field.ids.label : props.id,
|
|
11
|
+
for: field ? field.ids.control : props.for,
|
|
12
|
+
"data-leve-field-label": "",
|
|
13
|
+
"data-invalid": dataAttr(field?.invalid.value),
|
|
14
|
+
"data-disabled": dataAttr(field?.disabled.value),
|
|
15
|
+
"data-required": dataAttr(field?.required.value),
|
|
16
|
+
children: /* @__PURE__ */ jsx(Slot, {})
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
FieldLabel
|
|
22
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
|
+
const qwik = require("@builder.io/qwik");
|
|
5
|
+
const utils = require("@leve-ui/utils");
|
|
6
|
+
const FieldRoot = qwik.component$(({ ids, invalid, disabled, required, hasDescription, ...props }) => {
|
|
7
|
+
const invalidSignal = qwik.useComputed$(() => !!invalid);
|
|
8
|
+
const disabledSignal = qwik.useComputed$(() => !!disabled);
|
|
9
|
+
const requiredSignal = qwik.useComputed$(() => !!required);
|
|
10
|
+
const hasDescriptionSignal = qwik.useComputed$(() => !!hasDescription);
|
|
11
|
+
const context = utils.useFieldProvider({
|
|
12
|
+
ids,
|
|
13
|
+
invalid: invalidSignal,
|
|
14
|
+
disabled: disabledSignal,
|
|
15
|
+
required: requiredSignal,
|
|
16
|
+
hasDescription: hasDescriptionSignal
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
19
|
+
...props,
|
|
20
|
+
"data-leve-field": "",
|
|
21
|
+
"data-invalid": utils.dataAttr(context.invalid.value),
|
|
22
|
+
"data-disabled": utils.dataAttr(context.disabled.value),
|
|
23
|
+
"data-required": utils.dataAttr(context.required.value),
|
|
24
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
exports.FieldRoot = FieldRoot;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
+
import { component$, useComputed$, Slot } from "@builder.io/qwik";
|
|
3
|
+
import { useFieldProvider, dataAttr } from "@leve-ui/utils";
|
|
4
|
+
const FieldRoot = component$(({ ids, invalid, disabled, required, hasDescription, ...props }) => {
|
|
5
|
+
const invalidSignal = useComputed$(() => !!invalid);
|
|
6
|
+
const disabledSignal = useComputed$(() => !!disabled);
|
|
7
|
+
const requiredSignal = useComputed$(() => !!required);
|
|
8
|
+
const hasDescriptionSignal = useComputed$(() => !!hasDescription);
|
|
9
|
+
const context = useFieldProvider({
|
|
10
|
+
ids,
|
|
11
|
+
invalid: invalidSignal,
|
|
12
|
+
disabled: disabledSignal,
|
|
13
|
+
required: requiredSignal,
|
|
14
|
+
hasDescription: hasDescriptionSignal
|
|
15
|
+
});
|
|
16
|
+
return /* @__PURE__ */ jsx("div", {
|
|
17
|
+
...props,
|
|
18
|
+
"data-leve-field": "",
|
|
19
|
+
"data-invalid": dataAttr(context.invalid.value),
|
|
20
|
+
"data-disabled": dataAttr(context.disabled.value),
|
|
21
|
+
"data-required": dataAttr(context.required.value),
|
|
22
|
+
children: /* @__PURE__ */ jsx(Slot, {})
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
FieldRoot
|
|
27
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
|
+
const qwik = require("@builder.io/qwik");
|
|
5
|
+
const utils = require("@leve-ui/utils");
|
|
6
|
+
const FieldTextarea = qwik.component$(({ "bind:value": bindValue, ...props }) => {
|
|
7
|
+
const control = utils.useFieldControl(props);
|
|
8
|
+
const commonProps = {
|
|
9
|
+
...props,
|
|
10
|
+
id: control.value.id,
|
|
11
|
+
"aria-describedby": control.value.describedBy,
|
|
12
|
+
"aria-invalid": control.value.invalid ? "true" : void 0,
|
|
13
|
+
disabled: control.value.disabled,
|
|
14
|
+
required: control.value.required,
|
|
15
|
+
"data-leve-field-textarea": "",
|
|
16
|
+
"data-invalid": utils.dataAttr(control.value.invalid),
|
|
17
|
+
"data-disabled": utils.dataAttr(control.value.disabled),
|
|
18
|
+
"data-required": utils.dataAttr(control.value.required)
|
|
19
|
+
};
|
|
20
|
+
if (bindValue !== void 0) {
|
|
21
|
+
return /* @__PURE__ */ jsxRuntime.jsx("textarea", {
|
|
22
|
+
...commonProps,
|
|
23
|
+
"bind:value": bindValue
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsx("textarea", {
|
|
27
|
+
...commonProps
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
exports.FieldTextarea = FieldTextarea;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
+
import { component$ } from "@builder.io/qwik";
|
|
3
|
+
import { useFieldControl, dataAttr } from "@leve-ui/utils";
|
|
4
|
+
const FieldTextarea = component$(({ "bind:value": bindValue, ...props }) => {
|
|
5
|
+
const control = useFieldControl(props);
|
|
6
|
+
const commonProps = {
|
|
7
|
+
...props,
|
|
8
|
+
id: control.value.id,
|
|
9
|
+
"aria-describedby": control.value.describedBy,
|
|
10
|
+
"aria-invalid": control.value.invalid ? "true" : void 0,
|
|
11
|
+
disabled: control.value.disabled,
|
|
12
|
+
required: control.value.required,
|
|
13
|
+
"data-leve-field-textarea": "",
|
|
14
|
+
"data-invalid": dataAttr(control.value.invalid),
|
|
15
|
+
"data-disabled": dataAttr(control.value.disabled),
|
|
16
|
+
"data-required": dataAttr(control.value.required)
|
|
17
|
+
};
|
|
18
|
+
if (bindValue !== void 0) {
|
|
19
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
20
|
+
...commonProps,
|
|
21
|
+
"bind:value": bindValue
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
25
|
+
...commonProps
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
FieldTextarea
|
|
30
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fieldDescription = require("./field-description.qwik.cjs");
|
|
4
|
+
const fieldErrorMessage = require("./field-error-message.qwik.cjs");
|
|
5
|
+
const fieldInput = require("./field-input.qwik.cjs");
|
|
6
|
+
const fieldLabel = require("./field-label.qwik.cjs");
|
|
7
|
+
const fieldRoot = require("./field-root.qwik.cjs");
|
|
8
|
+
const fieldTextarea = require("./field-textarea.qwik.cjs");
|
|
9
|
+
exports.Description = fieldDescription.FieldDescription;
|
|
10
|
+
exports.ErrorMessage = fieldErrorMessage.FieldErrorMessage;
|
|
11
|
+
exports.Input = fieldInput.FieldInput;
|
|
12
|
+
exports.Label = fieldLabel.FieldLabel;
|
|
13
|
+
exports.Root = fieldRoot.FieldRoot;
|
|
14
|
+
exports.Textarea = fieldTextarea.FieldTextarea;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FieldDescription } from "./field-description.qwik.mjs";
|
|
2
|
+
import { FieldErrorMessage } from "./field-error-message.qwik.mjs";
|
|
3
|
+
import { FieldInput } from "./field-input.qwik.mjs";
|
|
4
|
+
import { FieldLabel } from "./field-label.qwik.mjs";
|
|
5
|
+
import { FieldRoot } from "./field-root.qwik.mjs";
|
|
6
|
+
import { FieldTextarea } from "./field-textarea.qwik.mjs";
|
|
7
|
+
export {
|
|
8
|
+
FieldDescription as Description,
|
|
9
|
+
FieldErrorMessage as ErrorMessage,
|
|
10
|
+
FieldInput as Input,
|
|
11
|
+
FieldLabel as Label,
|
|
12
|
+
FieldRoot as Root,
|
|
13
|
+
FieldTextarea as Textarea
|
|
14
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type PropsOf } from '@builder.io/qwik';
|
|
2
|
+
export type FieldDescriptionProps = PropsOf<'div'>;
|
|
3
|
+
/**
|
|
4
|
+
* フォームコントロールの説明文です。
|
|
5
|
+
*
|
|
6
|
+
* 該当する APG パターンはないため、ネイティブの `<div>` を使用します。
|
|
7
|
+
* Field の中で使用し、`Field.Root` に `hasDescription` を指定することで
|
|
8
|
+
* コントロールの `aria-describedby` と関連付けられます。
|
|
9
|
+
*/
|
|
10
|
+
export declare const FieldDescription: import("@builder.io/qwik").Component<{
|
|
11
|
+
align?: string | undefined;
|
|
12
|
+
} & import("@builder.io/qwik").HTMLElementAttrs & import("@builder.io/qwik").QwikAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type PropsOf } from '@builder.io/qwik';
|
|
2
|
+
export type FieldErrorMessageProps = PropsOf<'div'>;
|
|
3
|
+
/**
|
|
4
|
+
* フォームコントロールのエラーメッセージです。
|
|
5
|
+
*
|
|
6
|
+
* 該当する APG パターンはないため、ネイティブの `<div>` を使用します。
|
|
7
|
+
* `Field.Root` が `invalid` の場合のみ描画されます。
|
|
8
|
+
*/
|
|
9
|
+
export declare const FieldErrorMessage: import("@builder.io/qwik").Component<{
|
|
10
|
+
align?: string | undefined;
|
|
11
|
+
} & import("@builder.io/qwik").HTMLElementAttrs & import("@builder.io/qwik").QwikAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type PropsOf, type Signal } from '@builder.io/qwik';
|
|
2
|
+
export type FieldInputProps = PropsOf<'input'> & {
|
|
3
|
+
/** 入力値と双方向で同期する Signal です。 */
|
|
4
|
+
'bind:value'?: Signal<string>;
|
|
5
|
+
/** チェック状態と双方向で同期する Signal です(checkbox / radio 用)。 */
|
|
6
|
+
'bind:checked'?: Signal<boolean>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* 1 行のテキスト入力フォームコントロールです。
|
|
10
|
+
*
|
|
11
|
+
* 該当する APG パターンはないため、ネイティブの `<input>` を使用します。
|
|
12
|
+
* Field の中ではラベル、説明文、エラーメッセージと自動的に関連付けられます。
|
|
13
|
+
* Field の外でも単体で使用できます。
|
|
14
|
+
*/
|
|
15
|
+
export declare const FieldInput: import("@builder.io/qwik").Component<FieldInputProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type PropsOf } from '@builder.io/qwik';
|
|
2
|
+
export type FieldLabelProps = PropsOf<'label'>;
|
|
3
|
+
/**
|
|
4
|
+
* フォームコントロールのラベルです。
|
|
5
|
+
*
|
|
6
|
+
* 該当する APG パターンはないため、ネイティブの `<label>` を使用します。
|
|
7
|
+
* Field の中ではコントロールの ID と自動的に関連付けられます。
|
|
8
|
+
*/
|
|
9
|
+
export declare const FieldLabel: import("@builder.io/qwik").Component<{
|
|
10
|
+
form?: string | undefined | undefined;
|
|
11
|
+
for?: string | undefined | undefined;
|
|
12
|
+
htmlFor?: string | undefined | undefined;
|
|
13
|
+
} & import("@builder.io/qwik").HTMLElementAttrs & import("@builder.io/qwik").QwikAttributes<HTMLLabelElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type PropsOf } from '@builder.io/qwik';
|
|
2
|
+
import { type FieldIds } from '@leve-ui/utils';
|
|
3
|
+
export type FieldRootProps = PropsOf<'div'> & {
|
|
4
|
+
/** adr/0024: IDs are overridden only here */
|
|
5
|
+
ids?: Partial<FieldIds>;
|
|
6
|
+
invalid?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
/** Set to true when Field.Description is used */
|
|
10
|
+
hasDescription?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* フォームコントロールにラベル、説明文、エラーメッセージを関連付けるコンテナです。
|
|
14
|
+
*
|
|
15
|
+
* 該当する APG パターンはないため、ネイティブのフォームセマンティクスを使用します。
|
|
16
|
+
* `Field.Description` を使用する場合は `hasDescription` を指定してください(`adr/0024`)。
|
|
17
|
+
* 各パーツの要素 ID を上書きする場合は `ids` プロパティを使用します。
|
|
18
|
+
*/
|
|
19
|
+
export declare const FieldRoot: import("@builder.io/qwik").Component<FieldRootProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type PropsOf, type Signal } from '@builder.io/qwik';
|
|
2
|
+
export type FieldTextareaProps = PropsOf<'textarea'> & {
|
|
3
|
+
/** 入力値と双方向で同期する Signal です。 */
|
|
4
|
+
'bind:value'?: Signal<string>;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* 複数行のテキスト入力フォームコントロールです。
|
|
8
|
+
*
|
|
9
|
+
* 該当する APG パターンはないため、ネイティブの `<textarea>` を使用します。
|
|
10
|
+
* Field の中ではラベル、説明文、エラーメッセージと自動的に関連付けられます。
|
|
11
|
+
* Field の外でも単体で使用できます。
|
|
12
|
+
*/
|
|
13
|
+
export declare const FieldTextarea: import("@builder.io/qwik").Component<FieldTextareaProps>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { FieldDescription as Description } from './field-description';
|
|
2
|
+
export { FieldErrorMessage as ErrorMessage } from './field-error-message';
|
|
3
|
+
export { FieldInput as Input } from './field-input';
|
|
4
|
+
export { FieldLabel as Label } from './field-label';
|
|
5
|
+
export { FieldRoot as Root } from './field-root';
|
|
6
|
+
export { FieldTextarea as Textarea } from './field-textarea';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * as Field from './field';
|
|
2
|
+
export type { FieldDescriptionProps } from './field-description';
|
|
3
|
+
export type { FieldErrorMessageProps } from './field-error-message';
|
|
4
|
+
export type { FieldInputProps } from './field-input';
|
|
5
|
+
export type { FieldLabelProps } from './field-label';
|
|
6
|
+
export type { FieldRootProps } from './field-root';
|
|
7
|
+
export type { FieldTextareaProps } from './field-textarea';
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leve-ui/field",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Headless, WAI-ARIA compliant Field component for Qwik. Bring your own styles.",
|
|
5
|
+
"homepage": "https://github.com/leve-ui/leve-ui#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/leve-ui/leve-ui/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/leve-ui/leve-ui.git",
|
|
12
|
+
"directory": "packages/components/field"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"main": "./lib/index.qwik.cjs",
|
|
18
|
+
"module": "./lib/index.qwik.mjs",
|
|
19
|
+
"qwik": "./lib/index.qwik.mjs",
|
|
20
|
+
"types": "./lib-types/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"@leve-ui/source": "./src/index.ts",
|
|
24
|
+
"types": "./lib-types/index.d.ts",
|
|
25
|
+
"import": "./lib/index.qwik.mjs",
|
|
26
|
+
"require": "./lib/index.qwik.cjs"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"lib",
|
|
31
|
+
"lib-types"
|
|
32
|
+
],
|
|
33
|
+
"keywords": [
|
|
34
|
+
"qwik",
|
|
35
|
+
"headless-ui",
|
|
36
|
+
"accessibility",
|
|
37
|
+
"wai-aria",
|
|
38
|
+
"field"
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@leve-ui/utils": "0.1.0"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@builder.io/qwik": "^1.20.4"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@builder.io/qwik": "1.20.4",
|
|
48
|
+
"typescript": "~5.9.3",
|
|
49
|
+
"vite": "^7.3.8",
|
|
50
|
+
"vitest": "^5.1.0",
|
|
51
|
+
"@leve-ui/tsconfig": "0.0.0",
|
|
52
|
+
"@leve-ui/vite-config": "0.0.0"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "pnpm build:lib && pnpm build:types",
|
|
56
|
+
"build:lib": "vite build --mode lib",
|
|
57
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
58
|
+
"typecheck": "tsc --noEmit",
|
|
59
|
+
"test": "vitest run"
|
|
60
|
+
}
|
|
6
61
|
}
|
package/README.md
DELETED