@maratus-registry/field 0.2.1 → 0.3.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.
@@ -48,7 +48,7 @@
48
48
  color: var(--ara-field-label-fg--loading);
49
49
  }
50
50
 
51
- .maratus__Field__control {
51
+ .maratus__Field__fieldControl {
52
52
  background-color: var(--ara-field-control-bg);
53
53
  border-color: var(--ara-field-control-detail);
54
54
  border-style: var(--ara-field-control-border-style);
@@ -58,18 +58,18 @@
58
58
  padding-inline: var(--ara-field-control-padding-inline);
59
59
  }
60
60
 
61
- .maratus__Field__control[aria-invalid='true'] {
61
+ .maratus__Field__fieldControl[aria-invalid='true'] {
62
62
  border-color: var(--ara-field-control-detail--invalid);
63
63
  color: var(--ara-field-control-fg--invalid);
64
64
  }
65
65
 
66
- .maratus__Field__control[data-loading] {
66
+ .maratus__Field__fieldControl[data-loading] {
67
67
  border-color: var(--ara-field-control-detail--loading);
68
68
  color: var(--ara-field-control-fg--loading);
69
69
  }
70
70
 
71
- .maratus__Field__control:read-only,
72
- .maratus__Field__control[aria-readonly='true'] {
71
+ .maratus__Field__fieldControl[readonly],
72
+ .maratus__Field__fieldControl[aria-readonly='true'] {
73
73
  color: var(--ara-field-control-fg--readonly);
74
74
  }
75
75
 
@@ -1,18 +1,18 @@
1
1
  import type {
2
- ControlRenderArgs,
3
2
  ErrorMessageItemProps,
4
3
  FieldErrorKey,
4
+ FieldControlRenderArgs,
5
5
  FieldErrorPolicy,
6
- UseControlOptions,
7
6
  UseDescriptionOptions,
8
7
  UseErrorMessageOptions,
8
+ UseFieldControlOptions,
9
9
  UseLabelOptions,
10
10
  } from './Field.types'
11
11
  import type { ComponentPropsWithRef, ElementType, ReactNode } from 'react'
12
12
  import { FieldProvider } from './FieldContext'
13
- import { useControl } from './useControl'
14
13
  import { useDescription } from './useDescription'
15
14
  import { useErrorMessage } from './useErrorMessage'
15
+ import { useFieldControl } from './useFieldControl'
16
16
  import { useFieldRoot } from './useFieldRoot'
17
17
  import { useLabel } from './useLabel'
18
18
 
@@ -73,13 +73,13 @@ export function Label(props: LabelProps) {
73
73
  return <label {...labelProps} />
74
74
  }
75
75
 
76
- export type ControlProps = UseControlOptions & {
77
- children: (props: ControlRenderArgs) => ReactNode
76
+ export type FieldControlProps = UseFieldControlOptions & {
77
+ children: (props: FieldControlRenderArgs) => ReactNode
78
78
  }
79
79
 
80
- export function Control(props: ControlProps) {
80
+ export function FieldControl(props: FieldControlProps) {
81
81
  const { children, ...hookProps } = props
82
- const control = useControl(hookProps)
82
+ const control = useFieldControl(hookProps)
83
83
 
84
84
  return children(control)
85
85
  }
@@ -1,12 +1,13 @@
1
1
  import type {
2
2
  AriaAttributes,
3
- ChangeEventHandler,
3
+ ChangeEvent,
4
4
  ComponentPropsWithRef,
5
- FocusEventHandler,
5
+ FocusEvent,
6
6
  HTMLAttributes,
7
- ReactEventHandler,
8
7
  ReactNode,
9
8
  Ref,
9
+ RefCallback,
10
+ SyntheticEvent,
10
11
  } from 'react'
11
12
 
12
13
  export type ValidityErrorKey = Exclude<keyof ValidityState, 'valid'>
@@ -48,7 +49,7 @@ export type FieldContextValue = {
48
49
  errorMap?: ReadonlyMap<FieldErrorKey, ReactNode>
49
50
  updateValidityState(
50
51
  event: FieldErrorPolicyArgs['event'],
51
- control: { validity: ValidityState },
52
+ report: ValidityReport,
52
53
  ): void
53
54
  isLoading: boolean
54
55
  isReadOnly: boolean
@@ -56,6 +57,7 @@ export type FieldContextValue = {
56
57
  label: ReactNode
57
58
  labelId: string
58
59
  name: string
60
+ validityReporterRef: RefCallback<ControlElement>
59
61
  visibleErrors: readonly FieldErrorKey[]
60
62
  }
61
63
 
@@ -85,8 +87,8 @@ export type UseFieldRootResult = {
85
87
  fieldRootProps: FieldRootRenderProps
86
88
  }
87
89
 
88
- // GPRD-006, REQ-002 and REQ-004: Field owns label relationship wiring so
89
- // consumers cannot override the generated label id or control association.
90
+ // Field owns label relationship wiring so consumers cannot override the
91
+ // generated label id or control association.
90
92
  export type UseLabelOptions = Omit<
91
93
  ComponentPropsWithRef<'label'>,
92
94
  'htmlFor' | 'id'
@@ -108,12 +110,12 @@ export type ControlElement =
108
110
  | HTMLSelectElement
109
111
  | HTMLTextAreaElement
110
112
 
111
- type ControlElementProps = Omit<
113
+ type FieldControlElementProps = Omit<
112
114
  HTMLAttributes<ControlElement>,
113
- 'onBlur' | 'onChange' | 'onFocus' | 'onInput' | 'onInvalid'
115
+ 'onBlur' | 'onChange' | 'onFocus' | 'onInput' | 'onInvalid' | 'role'
114
116
  >
115
117
 
116
- export type ControlRenderProps = ControlElementProps & {
118
+ export type FieldControlRenderProps = FieldControlElementProps & {
117
119
  'aria-busy'?: AriaAttributes['aria-busy']
118
120
  'aria-describedby'?: AriaAttributes['aria-describedby']
119
121
  'aria-disabled'?: AriaAttributes['aria-disabled']
@@ -122,78 +124,78 @@ export type ControlRenderProps = ControlElementProps & {
122
124
  'aria-readonly'?: AriaAttributes['aria-readonly']
123
125
  'aria-required'?: AriaAttributes['aria-required']
124
126
  'data-loading'?: ''
125
- disabled?: boolean
126
127
  id: string
127
- name?: string
128
- onBlur?: FocusEventHandler<ControlElement>
129
- onChange?: ChangeEventHandler<ControlElement>
130
- onFocus?: FocusEventHandler<ControlElement>
131
- onInput?: ReactEventHandler<ControlElement>
132
- onInvalid?: ReactEventHandler<ControlElement>
133
- readOnly?: boolean
134
- ref?: Ref<any>
135
- required?: boolean
136
- role?: ControlRole
137
- }
138
-
139
- export type ControlRenderArgs = {
140
- controlProps: ControlRenderProps
141
- withValidity: WithValidity
142
- }
143
-
144
- export type ControlRole =
145
- | 'checkbox'
146
- | 'combobox'
147
- | 'listbox'
148
- | 'searchbox'
149
- | 'spinbutton'
150
- | 'textbox'
151
-
152
- export type UseControlOptions = Omit<
153
- ControlRenderProps,
154
- | 'aria-describedby'
155
- | 'aria-busy'
156
- | 'aria-disabled'
157
- | 'aria-errormessage'
158
- | 'aria-invalid'
159
- | 'aria-readonly'
160
- | 'aria-required'
161
- | 'children'
162
- | 'data-loading'
163
- | 'disabled'
164
- | 'id'
165
- | 'name'
166
- | 'readOnly'
167
- | 'required'
168
- | 'role'
169
- > & {
170
- role?: ControlRole
171
- }
172
-
173
- export type UseControlResult = {
174
- controlProps: ControlRenderProps
175
- withValidity: WithValidity
176
- }
177
-
178
- export type WithValidity = <TEvent extends { currentTarget: EventTarget }>(
179
- event: TEvent,
180
- validity: Partial<ValidityState>,
181
- ) => TEvent & {
182
- currentTarget: TEvent['currentTarget'] & {
183
- validity: ValidityState
184
- }
128
+ ref?: RefCallback<ControlElement>
129
+ }
130
+
131
+ // A custom root passes the control's validity as the second argument. Native
132
+ // controls leave it out, so the field reads the element's own ValidityState.
133
+ // Method signatures keep the handlers assignable to React's event props.
134
+ export type ValidityHandlerProps<TElement extends Element = ControlElement> = {
135
+ onBlur(event: FocusEvent<TElement>, validity?: Partial<ValidityState>): void
136
+ onChange(
137
+ event: ChangeEvent<TElement>,
138
+ validity?: Partial<ValidityState>,
139
+ ): void
140
+ onFocus(event: FocusEvent<TElement>, validity?: Partial<ValidityState>): void
141
+ onInput(
142
+ event: SyntheticEvent<TElement>,
143
+ validity?: Partial<ValidityState>,
144
+ ): void
145
+ onInvalid(
146
+ event: SyntheticEvent<TElement>,
147
+ validity?: Partial<ValidityState>,
148
+ ): void
185
149
  }
186
150
 
187
- // GPRD-006 and REQ-005: Field owns the description id because Control uses it
188
- // for aria-describedby.
151
+ // Spread on each reporting input. The ref lets the field drop a removed
152
+ // input's report; merge it with a consumer ref through mergeRefs.
153
+ export type ValidityReporterProps<TElement extends Element = ControlElement> =
154
+ ValidityHandlerProps<TElement> & {
155
+ ref: RefCallback<TElement>
156
+ }
157
+
158
+ export type FieldControlRenderArgs = {
159
+ fieldControlProps: FieldControlRenderProps
160
+ validityHandlerProps: ValidityReporterProps
161
+ }
162
+
163
+ export type UseFieldControlOptions<TElement extends Element = ControlElement> =
164
+ Omit<
165
+ FieldControlRenderProps,
166
+ | 'aria-describedby'
167
+ | 'aria-busy'
168
+ | 'aria-disabled'
169
+ | 'aria-errormessage'
170
+ | 'aria-invalid'
171
+ | 'aria-readonly'
172
+ | 'aria-required'
173
+ | 'children'
174
+ | 'data-loading'
175
+ | 'id'
176
+ | 'ref'
177
+ > &
178
+ Partial<ValidityHandlerProps<TElement>> & {
179
+ ref?: Ref<TElement>
180
+ }
181
+
182
+ export type UseFieldControlResult = FieldControlRenderArgs
183
+
184
+ export type ValidityReport = {
185
+ reporter: EventTarget | symbol
186
+ validity: ValidityState | null
187
+ }
188
+
189
+ // Field owns the description id because FieldControl
190
+ // uses it for aria-describedby.
189
191
  export type UseDescriptionOptions = Omit<ComponentPropsWithRef<'div'>, 'id'>
190
192
 
191
193
  export type UseDescriptionResult = {
192
194
  descriptionProps: ComponentPropsWithRef<'div'>
193
195
  }
194
196
 
195
- // GPRD-006 and REQ-007: Field owns the error id because Control uses it for
196
- // aria-errormessage when errors are visible.
197
+ // Field owns the error id because FieldControl uses it
198
+ // for aria-errormessage when errors are visible.
197
199
  export type UseErrorMessageOptions = Omit<
198
200
  ComponentPropsWithRef<'div'>,
199
201
  'children' | 'id'
@@ -6,9 +6,14 @@ import type {
6
6
  FieldErrorPolicyFieldState,
7
7
  FieldErrorPolicyFormState,
8
8
  FieldProviderProps,
9
- ValidityErrorKey,
10
9
  } from './Field.types'
11
- import { createContext, useId, useState } from 'react'
10
+ import type { ValidityReports } from './fieldValidity'
11
+ import { createContext, useCallback, useId, useRef, useState } from 'react'
12
+ import {
13
+ getReportedErrorKeys,
14
+ pruneDisconnectedReporters,
15
+ recordValidityReport,
16
+ } from './fieldValidity'
12
17
 
13
18
  type FieldNativeState = {
14
19
  errors: readonly FieldErrorKey[]
@@ -59,6 +64,21 @@ function useFieldProviderValue({
59
64
  },
60
65
  isErrorVisible: false,
61
66
  })
67
+ const validityReports = useRef<ValidityReports>(new Map())
68
+ // A reporting input can unmount without a validity event. Its ref cleanup
69
+ // runs before React removes the node, so the prune waits for a microtask.
70
+ const validityReporterRef = useCallback(
71
+ () => () => {
72
+ queueMicrotask(() => {
73
+ if (!pruneDisconnectedReporters(validityReports.current)) return
74
+
75
+ const errors = getReportedErrorKeys(validityReports.current)
76
+ setNativeState((state) => ({ ...state, errors }))
77
+ })
78
+ },
79
+ [],
80
+ )
81
+
62
82
  const generatedId = useId()
63
83
  const resolvedControlId = controlId ?? `${generatedId}-control`
64
84
  const currentErrors = activeErrors ?? new Set(nativeState.errors)
@@ -77,20 +97,25 @@ function useFieldProviderValue({
77
97
  descriptionId: `${generatedId}-description`,
78
98
  errorId: `${generatedId}-error`,
79
99
  errorMap,
80
- updateValidityState: (event, control) => {
81
- const nextErrors = getValidityErrorKeys(control.validity)
100
+ updateValidityState: (event, report) => {
101
+ recordValidityReport(validityReports.current, report)
102
+ const nextErrors = getReportedErrorKeys(validityReports.current)
82
103
  const nextActiveErrors = activeErrors ?? new Set(nextErrors)
83
104
 
84
- setNativeState((currentNativeState) =>
85
- getNextNativeState({
105
+ setNativeState((currentNativeState) => {
106
+ const nextNativeState = getNextNativeState({
86
107
  currentNativeState,
87
108
  errorPolicy,
88
109
  event,
89
110
  isErrorVisible,
90
111
  nextActiveErrors,
91
112
  nextErrors,
92
- }),
93
- )
113
+ })
114
+
115
+ return isSameNativeState(currentNativeState, nextNativeState)
116
+ ? currentNativeState
117
+ : nextNativeState
118
+ })
94
119
  },
95
120
  isLoading,
96
121
  isReadOnly,
@@ -98,6 +123,7 @@ function useFieldProviderValue({
98
123
  label,
99
124
  labelId: `${generatedId}-label`,
100
125
  name,
126
+ validityReporterRef,
101
127
  visibleErrors,
102
128
  }
103
129
  }
@@ -155,23 +181,21 @@ function getNextNativeState({
155
181
  }
156
182
  }
157
183
 
158
- const validityErrorKeys = [
159
- 'badInput',
160
- 'customError',
161
- 'patternMismatch',
162
- 'rangeOverflow',
163
- 'rangeUnderflow',
164
- 'stepMismatch',
165
- 'tooLong',
166
- 'tooShort',
167
- 'typeMismatch',
168
- 'valueMissing',
169
- ] as const satisfies readonly ValidityErrorKey[]
170
-
171
- function getValidityErrorKeys(
172
- validity: ValidityState,
173
- ): readonly ValidityErrorKey[] {
174
- return validity.valid ? [] : validityErrorKeys.filter((key) => validity[key])
184
+ function isSameNativeState(
185
+ current: FieldNativeState,
186
+ next: FieldNativeState,
187
+ ): boolean {
188
+ const fieldKeys = Object.keys(
189
+ current.field,
190
+ ) as (keyof FieldErrorPolicyFieldState)[]
191
+
192
+ return (
193
+ current.event === next.event &&
194
+ current.isErrorVisible === next.isErrorVisible &&
195
+ current.errors.length === next.errors.length &&
196
+ current.errors.every((key, index) => key === next.errors[index]) &&
197
+ fieldKeys.every((key) => current.field[key] === next.field[key])
198
+ )
175
199
  }
176
200
 
177
201
  function resolveVisibleErrors({
@@ -0,0 +1,62 @@
1
+ import type { ValidityErrorKey, ValidityReport } from './Field.types'
2
+
3
+ // Native ValidityState objects are live, so a radio checked after its
4
+ // sibling reported still clears that sibling's valueMissing.
5
+ export type ValidityReports = Map<ValidityReport['reporter'], ValidityState>
6
+
7
+ // Reported validity describes the whole control, so every report shares one key.
8
+ export const CONTROL_REPORTER = Symbol('control')
9
+
10
+ export const validityErrorKeys = [
11
+ 'badInput',
12
+ 'customError',
13
+ 'patternMismatch',
14
+ 'rangeOverflow',
15
+ 'rangeUnderflow',
16
+ 'stepMismatch',
17
+ 'tooLong',
18
+ 'tooShort',
19
+ 'typeMismatch',
20
+ 'valueMissing',
21
+ ] as const satisfies readonly ValidityErrorKey[]
22
+
23
+ export function recordValidityReport(
24
+ reports: ValidityReports,
25
+ report: ValidityReport,
26
+ ): void {
27
+ if (report.validity) reports.set(report.reporter, report.validity)
28
+ pruneDisconnectedReporters(reports)
29
+ }
30
+
31
+ export function pruneDisconnectedReporters(reports: ValidityReports): boolean {
32
+ let removed = false
33
+ for (const reporter of reports.keys()) {
34
+ if (isDisconnected(reporter)) {
35
+ reports.delete(reporter)
36
+ removed = true
37
+ }
38
+ }
39
+ return removed
40
+ }
41
+
42
+ function isDisconnected(reporter: ValidityReport['reporter']): boolean {
43
+ if (typeof reporter === 'symbol') return false
44
+
45
+ return 'isConnected' in reporter && reporter.isConnected === false
46
+ }
47
+
48
+ export function getReportedErrorKeys(
49
+ reports: ValidityReports,
50
+ ): readonly ValidityErrorKey[] {
51
+ const reportedKeys = new Set(
52
+ [...reports.values()].flatMap((validity) => getValidityErrorKeys(validity)),
53
+ )
54
+
55
+ return validityErrorKeys.filter((key) => reportedKeys.has(key))
56
+ }
57
+
58
+ function getValidityErrorKeys(
59
+ validity: ValidityState,
60
+ ): readonly ValidityErrorKey[] {
61
+ return validity.valid ? [] : validityErrorKeys.filter((key) => validity[key])
62
+ }
@@ -1,35 +1,43 @@
1
1
  export type {
2
- ControlProps,
3
2
  DescriptionProps,
4
3
  ErrorMessageProps,
4
+ FieldControlProps,
5
5
  FieldRootProps,
6
6
  LabelProps,
7
7
  } from './Field'
8
8
  export type {
9
- ControlRenderArgs,
10
- ControlRenderProps,
11
- ControlRole,
12
9
  FieldContextValue,
10
+ FieldControlRenderArgs,
11
+ FieldControlRenderProps,
13
12
  FieldErrorKey,
14
13
  FieldErrorPolicy,
15
14
  FieldProviderProps,
16
15
  UseDescriptionOptions,
17
16
  UseDescriptionResult,
18
- UseControlOptions,
19
- UseControlResult,
20
17
  UseErrorMessageOptions,
21
18
  UseErrorMessageResult,
19
+ UseFieldControlOptions,
20
+ UseFieldControlResult,
22
21
  UseFieldRootOptions,
23
22
  UseFieldRootResult,
24
23
  UseLabelOptions,
25
24
  UseLabelResult,
26
25
  ValidityErrorKey,
27
- WithValidity,
26
+ ValidityHandlerProps,
27
+ ValidityReport,
28
+ ValidityReporterProps,
28
29
  } from './Field.types'
29
- export { Control, Description, ErrorMessage, FieldRoot, Label } from './Field'
30
+ export {
31
+ Description,
32
+ ErrorMessage,
33
+ FieldControl,
34
+ FieldRoot,
35
+ Label,
36
+ } from './Field'
30
37
  export { FieldProvider } from './FieldContext'
31
- export { useControl } from './useControl'
32
38
  export { useDescription } from './useDescription'
33
39
  export { useErrorMessage } from './useErrorMessage'
40
+ export { useFieldContext } from './useFieldContext'
41
+ export { useFieldControl } from './useFieldControl'
34
42
  export { useFieldRoot } from './useFieldRoot'
35
43
  export { useLabel } from './useLabel'
@@ -0,0 +1,80 @@
1
+ import type {
2
+ FieldContextValue,
3
+ UseFieldControlOptions,
4
+ UseFieldControlResult,
5
+ ValidityHandlerProps,
6
+ } from './Field.types'
7
+ import { mergeRefs } from '@maratus-lib/props'
8
+ import clsx from 'clsx'
9
+ import { useFieldContext } from './useFieldContext'
10
+ import { getValidityReport } from './validityReport'
11
+ import './Field.css'
12
+
13
+ export function useFieldControl(
14
+ options: UseFieldControlOptions = {},
15
+ ): UseFieldControlResult {
16
+ const {
17
+ className,
18
+ onBlur,
19
+ onChange,
20
+ onFocus,
21
+ onInput,
22
+ onInvalid,
23
+ ref,
24
+ ...fieldControlRootProps
25
+ } = options
26
+ const field = useFieldContext('FieldControl')
27
+
28
+ return {
29
+ fieldControlProps: {
30
+ ...fieldControlRootProps,
31
+ 'aria-busy': field.isLoading ? true : undefined,
32
+ 'aria-describedby': field.description ? field.descriptionId : undefined,
33
+ 'aria-disabled': field.isLoading ? true : undefined,
34
+ 'aria-errormessage':
35
+ field.visibleErrors.length > 0 ? field.errorId : undefined,
36
+ 'aria-invalid': field.visibleErrors.length > 0 ? true : undefined,
37
+ className: clsx('maratus__Field__fieldControl', className),
38
+ 'data-loading': field.isLoading ? '' : undefined,
39
+ id: field.controlId,
40
+ ...(ref ? { ref: mergeRefs(ref) } : {}),
41
+ ...(field.isReadOnly ? { 'aria-readonly': true } : {}),
42
+ ...(field.isRequired ? { 'aria-required': true } : {}),
43
+ },
44
+ validityHandlerProps: {
45
+ ...composeValidityHandlerProps(
46
+ { onBlur, onChange, onFocus, onInput, onInvalid },
47
+ field.updateValidityState,
48
+ ),
49
+ ref: field.validityReporterRef,
50
+ },
51
+ }
52
+ }
53
+
54
+ function composeValidityHandlerProps(
55
+ userHandlers: Partial<ValidityHandlerProps>,
56
+ updateValidityState: FieldContextValue['updateValidityState'],
57
+ ): ValidityHandlerProps {
58
+ return {
59
+ onBlur: (event, validity) => {
60
+ userHandlers.onBlur?.(event)
61
+ updateValidityState('blur', getValidityReport(event, validity))
62
+ },
63
+ onChange: (event, validity) => {
64
+ userHandlers.onChange?.(event)
65
+ updateValidityState('change', getValidityReport(event, validity))
66
+ },
67
+ onFocus: (event, validity) => {
68
+ userHandlers.onFocus?.(event)
69
+ updateValidityState('focus', getValidityReport(event, validity))
70
+ },
71
+ onInput: (event, validity) => {
72
+ userHandlers.onInput?.(event)
73
+ updateValidityState('input', getValidityReport(event, validity))
74
+ },
75
+ onInvalid: (event, validity) => {
76
+ userHandlers.onInvalid?.(event)
77
+ updateValidityState('invalid', getValidityReport(event, validity))
78
+ },
79
+ }
80
+ }
@@ -0,0 +1,41 @@
1
+ import type { ValidityReport } from './Field.types'
2
+ import { CONTROL_REPORTER, validityErrorKeys } from './fieldValidity'
3
+
4
+ // Reported validity wins; otherwise the event's element reports its own
5
+ // ValidityState, or only field history when it has none.
6
+ export function getValidityReport(
7
+ event: { currentTarget: EventTarget },
8
+ validity: Partial<ValidityState> | undefined,
9
+ ): ValidityReport {
10
+ if (validity) {
11
+ return {
12
+ reporter: CONTROL_REPORTER,
13
+ validity: createValidityState(validity),
14
+ }
15
+ }
16
+
17
+ return {
18
+ reporter: event.currentTarget,
19
+ validity: hasValidityState(event.currentTarget)
20
+ ? event.currentTarget.validity
21
+ : null,
22
+ }
23
+ }
24
+
25
+ function hasValidityState(
26
+ target: EventTarget,
27
+ ): target is EventTarget & { validity: ValidityState } {
28
+ return 'validity' in target
29
+ }
30
+
31
+ function createValidityState(validity: Partial<ValidityState>): ValidityState {
32
+ const errors = Object.fromEntries(
33
+ validityErrorKeys.map((key) => [key, validity[key] ?? false]),
34
+ ) as Record<(typeof validityErrorKeys)[number], boolean>
35
+
36
+ return {
37
+ ...errors,
38
+ valid:
39
+ validity.valid ?? validityErrorKeys.every((key) => errors[key] === false),
40
+ }
41
+ }
@@ -45,7 +45,7 @@
45
45
  color: var(--ara-field-label-fg--loading);
46
46
  }
47
47
 
48
- .control {
48
+ .fieldControl {
49
49
  background-color: var(--ara-field-control-bg);
50
50
  border-color: var(--ara-field-control-detail);
51
51
  border-style: var(--ara-field-control-border-style);
@@ -55,18 +55,18 @@
55
55
  padding-inline: var(--ara-field-control-padding-inline);
56
56
  }
57
57
 
58
- .control[aria-invalid='true'] {
58
+ .fieldControl[aria-invalid='true'] {
59
59
  border-color: var(--ara-field-control-detail--invalid);
60
60
  color: var(--ara-field-control-fg--invalid);
61
61
  }
62
62
 
63
- .control[data-loading] {
63
+ .fieldControl[data-loading] {
64
64
  border-color: var(--ara-field-control-detail--loading);
65
65
  color: var(--ara-field-control-fg--loading);
66
66
  }
67
67
 
68
- .control:read-only,
69
- .control[aria-readonly='true'] {
68
+ .fieldControl[readonly],
69
+ .fieldControl[aria-readonly='true'] {
70
70
  color: var(--ara-field-control-fg--readonly);
71
71
  }
72
72