foldkit 0.44.0 → 0.45.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/dist/test/query.d.ts +2 -1
- package/dist/test/query.d.ts.map +1 -1
- package/dist/test/query.js +5 -4
- package/dist/ui/input/index.d.ts +0 -2
- package/dist/ui/input/index.d.ts.map +1 -1
- package/dist/ui/input/index.js +2 -5
- package/dist/ui/input/public.d.ts +1 -1
- package/dist/ui/input/public.d.ts.map +1 -1
- package/dist/ui/input/public.js +1 -1
- package/dist/ui/select/index.d.ts +0 -2
- package/dist/ui/select/index.d.ts.map +1 -1
- package/dist/ui/select/index.js +2 -5
- package/dist/ui/select/public.d.ts +1 -1
- package/dist/ui/select/public.d.ts.map +1 -1
- package/dist/ui/select/public.js +1 -1
- package/dist/ui/textarea/index.d.ts +0 -2
- package/dist/ui/textarea/index.d.ts.map +1 -1
- package/dist/ui/textarea/index.js +2 -5
- package/dist/ui/textarea/public.d.ts +1 -1
- package/dist/ui/textarea/public.d.ts.map +1 -1
- package/dist/ui/textarea/public.js +1 -1
- package/package.json +1 -1
package/dist/test/query.d.ts
CHANGED
|
@@ -47,7 +47,8 @@ export declare const getByText: (target: string, options?: Readonly<{
|
|
|
47
47
|
/** Finds the first element with the given placeholder attribute. */
|
|
48
48
|
export declare const getByPlaceholder: (placeholderValue: string) => (html: VNode) => Option.Option<VNode>;
|
|
49
49
|
/** Finds the first element with the given label text. Checks `aria-label`
|
|
50
|
-
* first, then `<label for="id">` association, then `<label>` nesting
|
|
50
|
+
* first, then `<label for="id">` association, then `<label>` nesting,
|
|
51
|
+
* then `aria-labelledby` reverse lookup. */
|
|
51
52
|
export declare const getByLabel: (labelValue: string) => (html: VNode) => Option.Option<VNode>;
|
|
52
53
|
/** A deferred element query that resolves against a VNode tree. Callable as a
|
|
53
54
|
* function (`locator(html)`) so it composes directly in `flow` and `pipe` chains.
|
package/dist/test/query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/test/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EAMP,MAAM,QAAQ,CAAA;AAIf,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,KAAK,SAAS,GAAG,OAAO,GAAG,YAAY,CAAA;AAEvC,KAAK,gBAAgB,GAAG,QAAQ,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC5B,IAAI,EAAE,SAAS,CAAA;CAChB,CAAC,CAAA;AAEF,KAAK,cAAc,GAAG,QAAQ,CAAC;IAC7B,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC1B,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACzB,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC9B,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAA;CAC5C,CAAC,CAAA;AAEF,KAAK,QAAQ,GAAG,aAAa,CAAC,cAAc,CAAC,CAAA;AAmI7C,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,QAc7C,CAAA;
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/test/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EAMP,MAAM,QAAQ,CAAA;AAIf,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,KAAK,SAAS,GAAG,OAAO,GAAG,YAAY,CAAA;AAEvC,KAAK,gBAAgB,GAAG,QAAQ,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC5B,IAAI,EAAE,SAAS,CAAA;CAChB,CAAC,CAAA;AAEF,KA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AW,GAAI,kBAAkB,MAAM,KAAG,OAIpD,CAAA;AAEH,6DAA6D;AAC7D,eAAO,MAAM,KAAK,GAAI,YAAY,MAAM,KAAG,OACmB,CAAA;AAE9D,8FAA8F;AAC9F,eAAO,MAAM,IAAI,GACf,QAAQ,MAAM,EACd,UAAU,QAAQ,CAAC;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,KACtC,OAAsE,CAAA;AAEzE;kDACkD;AAClD,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,KAAG,OACsB,CAAA;AAE7D;;yDAEyD;AACzD,eAAO,MAAM,MAAM,EAAE;IACnB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAA;IAC1C,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAA;CAQ/C,CAAA;AAED,+EAA+E;AAC/E,eAAO,MAAM,aAAa,GACxB,MAAM,KAAK,EACX,QAAQ,MAAM,GAAG,OAAO,KACvB,QAAQ,CAAC;IAAE,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAQtE,CAAA"}
|
package/dist/test/query.js
CHANGED
|
@@ -127,13 +127,13 @@ const implicitRole = (vnode) => pipe(vnode.sel, Option.fromNullable, Option.flat
|
|
|
127
127
|
const resolveRole = (vnode) => pipe(vnode, lookupStringAttribute('role'), Option.orElse(() => implicitRole(vnode)));
|
|
128
128
|
// ACCESSIBLE NAME
|
|
129
129
|
const nonEmptyString = (value) => Option.filter(Option.some(String(value)), String_.isNonEmpty);
|
|
130
|
-
const nameFromLabelledBy = (
|
|
130
|
+
const nameFromLabelledBy = (root) => (vnode) => pipe(vnode, lookupAttribute('aria-labelledby'), Option.flatMap(nonEmptyString), Option.map(labelledBy => pipe(labelledBy, String_.split(WHITESPACE_PATTERN), Array.filterMap(flow(findById(root), Option.map(textContent))), Array.join(' '))), Option.filter(String_.isNonEmpty));
|
|
131
131
|
const nameFromAriaLabel = (vnode) => pipe(vnode, lookupAttribute('aria-label'), Option.flatMap(nonEmptyString));
|
|
132
132
|
const nameFromLabelFor = (vnode, root) => pipe(vnode, lookupStringAttribute('id'), Option.flatMap(idString => pipe([root, ...collectDescendants(root)], Array.findFirst(node => node.sel === 'label' &&
|
|
133
133
|
pipe(node, lookupStringAttribute('for'), Option.exists(Equal.equals(idString)))), Option.map(textContent))));
|
|
134
134
|
const nameFromTextContent = (vnode) => Option.filter(Option.some(textContent(vnode)), String_.isNonEmpty);
|
|
135
135
|
const nameFromTitle = (vnode) => pipe(vnode, lookupAttribute('title'), Option.flatMap(nonEmptyString));
|
|
136
|
-
const accessibleName = (vnode, root) => pipe(
|
|
136
|
+
const accessibleName = (vnode, root) => pipe(vnode, nameFromLabelledBy(root), Option.orElse(() => nameFromAriaLabel(vnode)), Option.orElse(() => nameFromLabelFor(vnode, root)), Option.orElse(() => nameFromTextContent(vnode)), Option.orElse(() => nameFromTitle(vnode)), Option.getOrElse(() => ''));
|
|
137
137
|
// PUBLIC API
|
|
138
138
|
const findAllImpl = (selectorString) => (html) => {
|
|
139
139
|
const selector = parseSelector(selectorString);
|
|
@@ -190,10 +190,11 @@ export const getByText = (target, options) => (html) => {
|
|
|
190
190
|
/** Finds the first element with the given placeholder attribute. */
|
|
191
191
|
export const getByPlaceholder = (placeholderValue) => (html) => Array.findFirst([html, ...collectDescendants(html)], flow(lookupStringAttribute('placeholder'), Option.exists(Equal.equals(placeholderValue))));
|
|
192
192
|
/** Finds the first element with the given label text. Checks `aria-label`
|
|
193
|
-
* first, then `<label for="id">` association, then `<label>` nesting
|
|
193
|
+
* first, then `<label for="id">` association, then `<label>` nesting,
|
|
194
|
+
* then `aria-labelledby` reverse lookup. */
|
|
194
195
|
export const getByLabel = (labelValue) => (html) => {
|
|
195
196
|
const allNodes = [html, ...collectDescendants(html)];
|
|
196
|
-
return pipe(Array.findFirst(allNodes, flow(lookupStringAttribute('aria-label'), Option.exists(Equal.equals(labelValue)))), Option.orElse(() => pipe(Array.filter(allNodes, node => node.sel === 'label' && textContent(node) === labelValue), Array.filterMap(labelNode => pipe(lookupStringAttribute('for')(labelNode), Option.flatMap(findById(html)), Option.orElse(() => Array.findFirst(collectDescendants(labelNode), isFormControl)))), Array.head)));
|
|
197
|
+
return pipe(Array.findFirst(allNodes, flow(lookupStringAttribute('aria-label'), Option.exists(Equal.equals(labelValue)))), Option.orElse(() => pipe(Array.filter(allNodes, node => node.sel === 'label' && textContent(node) === labelValue), Array.filterMap(labelNode => pipe(lookupStringAttribute('for')(labelNode), Option.flatMap(findById(html)), Option.orElse(() => Array.findFirst(collectDescendants(labelNode), isFormControl)))), Array.head)), Option.orElse(() => Array.findFirst(allNodes, flow(nameFromLabelledBy(html), Option.exists(Equal.equals(labelValue))))));
|
|
197
198
|
};
|
|
198
199
|
const makeLocator = (resolve, description) => Object.assign(resolve, { description });
|
|
199
200
|
/** Creates a Locator that finds an element by ARIA role and optional accessible name. */
|
package/dist/ui/input/index.d.ts
CHANGED
|
@@ -19,8 +19,6 @@ export type ViewConfig<Message> = Readonly<{
|
|
|
19
19
|
type?: string;
|
|
20
20
|
placeholder?: string;
|
|
21
21
|
}>;
|
|
22
|
-
/** Generates the label element ID from the input's base ID. */
|
|
23
|
-
export declare const labelId: (id: string) => string;
|
|
24
22
|
/** Generates the description element ID from the input's base ID. */
|
|
25
23
|
export declare const descriptionId: (id: string) => string;
|
|
26
24
|
/** Renders an accessible input by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/input/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAItC,yFAAyF;AACzF,MAAM,MA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AA;CAC/C,CAAC,CAAA;AAEF,wDAAwD;AACxD,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACtD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC,CAAA;AAEF,qEAAqE;AACrE,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,MAA6B,CAAA;AAExE,+HAA+H;AAC/H,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IAyE3D,CAAA"}
|
package/dist/ui/input/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Predicate } from 'effect';
|
|
2
2
|
import { html } from '../../html';
|
|
3
|
-
/** Generates the label element ID from the input's base ID. */
|
|
4
|
-
export const labelId = (id) => `${id}-label`;
|
|
5
3
|
/** Generates the description element ID from the input's base ID. */
|
|
6
4
|
export const descriptionId = (id) => `${id}-description`;
|
|
7
5
|
/** Renders an accessible input by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
|
|
8
6
|
export const view = (config) => {
|
|
9
|
-
const { AriaDescribedBy, AriaDisabled, AriaInvalid,
|
|
7
|
+
const { AriaDescribedBy, AriaDisabled, AriaInvalid, Autofocus, DataAttribute, Disabled, For, Id, Name, OnInput, Placeholder, Type, Value, } = html();
|
|
10
8
|
const { toView, id, onInput, value, isDisabled = false, isInvalid = false, isAutofocus = false, name, type = 'text', placeholder, } = config;
|
|
11
9
|
const disabledAttributes = isDisabled
|
|
12
10
|
? [AriaDisabled(true), Disabled(true), DataAttribute('disabled', '')]
|
|
@@ -24,7 +22,6 @@ export const view = (config) => {
|
|
|
24
22
|
const allInputAttributes = [
|
|
25
23
|
Id(id),
|
|
26
24
|
Type(type),
|
|
27
|
-
AriaLabelledBy(labelId(id)),
|
|
28
25
|
AriaDescribedBy(descriptionId(id)),
|
|
29
26
|
...disabledAttributes,
|
|
30
27
|
...invalidAttributes,
|
|
@@ -34,7 +31,7 @@ export const view = (config) => {
|
|
|
34
31
|
...nameAttributes,
|
|
35
32
|
...placeholderAttributes,
|
|
36
33
|
];
|
|
37
|
-
const labelAttributes = [
|
|
34
|
+
const labelAttributes = [For(id)];
|
|
38
35
|
const descriptionAttributes = [Id(descriptionId(id))];
|
|
39
36
|
return toView({
|
|
40
37
|
input: allInputAttributes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/input/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/input/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7C,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/ui/input/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { view,
|
|
1
|
+
export { view, descriptionId } from './index';
|
|
@@ -17,8 +17,6 @@ export type ViewConfig<Message> = Readonly<{
|
|
|
17
17
|
isAutofocus?: boolean;
|
|
18
18
|
name?: string;
|
|
19
19
|
}>;
|
|
20
|
-
/** Generates the label element ID from the select's base ID. */
|
|
21
|
-
export declare const labelId: (id: string) => string;
|
|
22
20
|
/** Generates the description element ID from the select's base ID. */
|
|
23
21
|
export declare const descriptionId: (id: string) => string;
|
|
24
22
|
/** Renders an accessible select by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/select/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAItC,0FAA0F;AAC1F,MAAM,MAAM,gBAAgB,CAAC,OAAO,IAAI,QAAQ,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACzC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF,wDAAwD;AACxD,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACvD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAC,CAAA;AAEF,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/select/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAItC,0FAA0F;AAC1F,MAAM,MAAM,gBAAgB,CAAC,OAAO,IAAI,QAAQ,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACzC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF,wDAAwD;AACxD,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACvD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAC,CAAA;AAEF,sEAAsE;AACtE,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,MAA6B,CAAA;AAExE,gIAAgI;AAChI,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IAiE3D,CAAA"}
|
package/dist/ui/select/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Predicate } from 'effect';
|
|
2
2
|
import { html } from '../../html';
|
|
3
|
-
/** Generates the label element ID from the select's base ID. */
|
|
4
|
-
export const labelId = (id) => `${id}-label`;
|
|
5
3
|
/** Generates the description element ID from the select's base ID. */
|
|
6
4
|
export const descriptionId = (id) => `${id}-description`;
|
|
7
5
|
/** Renders an accessible select by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
|
|
8
6
|
export const view = (config) => {
|
|
9
|
-
const { AriaDescribedBy, AriaDisabled, AriaInvalid,
|
|
7
|
+
const { AriaDescribedBy, AriaDisabled, AriaInvalid, Autofocus, DataAttribute, Disabled, For, Id, Name, OnChange, Value, } = html();
|
|
10
8
|
const { toView, id, onChange, value, isDisabled = false, isInvalid = false, isAutofocus = false, name, } = config;
|
|
11
9
|
const disabledAttributes = isDisabled
|
|
12
10
|
? [AriaDisabled(true), Disabled(true), DataAttribute('disabled', '')]
|
|
@@ -22,7 +20,6 @@ export const view = (config) => {
|
|
|
22
20
|
const nameAttributes = Predicate.isNotUndefined(name) ? [Name(name)] : [];
|
|
23
21
|
const allSelectAttributes = [
|
|
24
22
|
Id(id),
|
|
25
|
-
AriaLabelledBy(labelId(id)),
|
|
26
23
|
AriaDescribedBy(descriptionId(id)),
|
|
27
24
|
...disabledAttributes,
|
|
28
25
|
...invalidAttributes,
|
|
@@ -31,7 +28,7 @@ export const view = (config) => {
|
|
|
31
28
|
...autofocusAttributes,
|
|
32
29
|
...nameAttributes,
|
|
33
30
|
];
|
|
34
|
-
const labelAttributes = [
|
|
31
|
+
const labelAttributes = [For(id)];
|
|
35
32
|
const descriptionAttributes = [Id(descriptionId(id))];
|
|
36
33
|
return toView({
|
|
37
34
|
select: allSelectAttributes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/select/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/select/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7C,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/ui/select/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { view,
|
|
1
|
+
export { view, descriptionId } from './index';
|
|
@@ -19,8 +19,6 @@ export type ViewConfig<Message> = Readonly<{
|
|
|
19
19
|
rows?: number;
|
|
20
20
|
placeholder?: string;
|
|
21
21
|
}>;
|
|
22
|
-
/** Generates the label element ID from the textarea's base ID. */
|
|
23
|
-
export declare const labelId: (id: string) => string;
|
|
24
22
|
/** Generates the description element ID from the textarea's base ID. */
|
|
25
23
|
export declare const descriptionId: (id: string) => string;
|
|
26
24
|
/** Renders an accessible textarea by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/textarea/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAItC,4FAA4F;AAC5F,MAAM,MAAM,kBAAkB,CAAC,OAAO,IAAI,QAAQ,CAAC;IACjD,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3C,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF,0DAA0D;AAC1D,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACzD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW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AAExE,kIAAkI;AAClI,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IA2E3D,CAAA"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Predicate } from 'effect';
|
|
2
2
|
import { html } from '../../html';
|
|
3
|
-
/** Generates the label element ID from the textarea's base ID. */
|
|
4
|
-
export const labelId = (id) => `${id}-label`;
|
|
5
3
|
/** Generates the description element ID from the textarea's base ID. */
|
|
6
4
|
export const descriptionId = (id) => `${id}-description`;
|
|
7
5
|
/** Renders an accessible textarea by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
|
|
8
6
|
export const view = (config) => {
|
|
9
|
-
const { AriaDescribedBy, AriaDisabled, AriaInvalid,
|
|
7
|
+
const { AriaDescribedBy, AriaDisabled, AriaInvalid, Autofocus, DataAttribute, Disabled, For, Id, Name, OnInput, Placeholder, Rows, Value, } = html();
|
|
10
8
|
const { toView, id, onInput, value, isDisabled = false, isInvalid = false, isAutofocus = false, name, rows, placeholder, } = config;
|
|
11
9
|
const disabledAttributes = isDisabled
|
|
12
10
|
? [AriaDisabled(true), Disabled(true), DataAttribute('disabled', '')]
|
|
@@ -24,7 +22,6 @@ export const view = (config) => {
|
|
|
24
22
|
: [];
|
|
25
23
|
const allTextareaAttributes = [
|
|
26
24
|
Id(id),
|
|
27
|
-
AriaLabelledBy(labelId(id)),
|
|
28
25
|
AriaDescribedBy(descriptionId(id)),
|
|
29
26
|
...disabledAttributes,
|
|
30
27
|
...invalidAttributes,
|
|
@@ -35,7 +32,7 @@ export const view = (config) => {
|
|
|
35
32
|
...rowsAttributes,
|
|
36
33
|
...placeholderAttributes,
|
|
37
34
|
];
|
|
38
|
-
const labelAttributes = [
|
|
35
|
+
const labelAttributes = [For(id)];
|
|
39
36
|
const descriptionAttributes = [Id(descriptionId(id))];
|
|
40
37
|
return toView({
|
|
41
38
|
textarea: allTextareaAttributes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/textarea/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/textarea/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7C,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { view,
|
|
1
|
+
export { view, descriptionId } from './index';
|