@rcarls/rc-field 0.0.0 → 0.7.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/CHANGELOG.md +139 -0
- package/README.md +116 -6
- package/dist/custom-elements.json +1099 -0
- package/dist/rc-field-T33bxLJH.js +375 -0
- package/dist/rc-field-T33bxLJH.js.map +1 -0
- package/dist/rc-field-define.js +6 -0
- package/dist/rc-field-define.js.map +1 -0
- package/dist/rc-field.js +5 -0
- package/dist/rc-field.js.map +1 -0
- package/dist/types/packages/rc-field/src/define.d.ts +1 -0
- package/dist/types/packages/rc-field/src/index.d.ts +1 -0
- package/dist/types/packages/rc-field/src/rc-field.d.ts +187 -0
- package/dist/types/packages/rc-field/src/rc-field.styles.d.ts +2 -0
- package/package.json +58 -7
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# @rcarls/rc-field
|
|
2
|
+
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 079e025: Standardize component styling contracts for the breaking 0.7 release.
|
|
8
|
+
|
|
9
|
+
BREAKING CHANGE: Rename the Markdown editor's `--rme-*` properties to
|
|
10
|
+
`--rc-markdown-editor-*`, `--rc-app-bar-background` to `--rc-app-bar-bg`,
|
|
11
|
+
`--rc-textarea-radius` to `--rc-textarea-border-radius`, the transfer-list
|
|
12
|
+
`--rc-transfer-list-panel-*` properties to `--rc-transfer-list-listbox-*`,
|
|
13
|
+
`--rc-chip-group-webkit-scrollbar-display` to
|
|
14
|
+
`--rc-chip-group-scrollbar-display`, and `--rc-text` to `--rc-field-text`.
|
|
15
|
+
Compatibility aliases are intentionally not provided.
|
|
16
|
+
|
|
17
|
+
BREAKING CHANGE: Replace `--rc-select-chip-padding-inline` and
|
|
18
|
+
`--rc-combobox-chip-padding-inline` with explicit `*-padding-inline-start` and
|
|
19
|
+
`*-padding-inline-end` tokens. Generated removable chips now reserve the full
|
|
20
|
+
remove target and its edge offset, so their indicator cannot overlap label text.
|
|
21
|
+
|
|
22
|
+
Add canonical app-bar elevation, transfer-list listbox radius, and textarea
|
|
23
|
+
line-action tokens. Add logical `rc-chip` inline-padding properties so themes
|
|
24
|
+
can implement Material's icon-aware spacing without overriding authored child
|
|
25
|
+
styles. Make `rc-field` consume the shared semantic token layer,
|
|
26
|
+
and place the `rc-chip` and `rc-search-bar` light-DOM structural styles in the
|
|
27
|
+
`rc-base` cascade layer so normal consumer rules override them.
|
|
28
|
+
|
|
29
|
+
Prevent decorative, `aria-hidden` trailing list content from intercepting a
|
|
30
|
+
whole-row action target, and keep segmented-list item geometry from leaking
|
|
31
|
+
into nested standard lists.
|
|
32
|
+
|
|
33
|
+
Remove unused Material navigation-rail toggle tokens and obsolete list-item
|
|
34
|
+
theme tokens. Register the segmented-button private theme seam and enforce
|
|
35
|
+
token ownership, documentation, removed-name, selector-budget, and cascade
|
|
36
|
+
layer contracts through the component architecture audit.
|
|
37
|
+
|
|
38
|
+
- 19278d4: Group several native controls into one `rc-field` with a direct `<fieldset>`. Its `<legend>` names
|
|
39
|
+
the group and shows as the field label, each control keeps its own accessible name, and supporting
|
|
40
|
+
text describes the fieldset. The first text-like input or textarea is the primary control behind
|
|
41
|
+
`control`, `focus()`, and `data-populated`; focus moving between grouped controls keeps the field
|
|
42
|
+
focused; and `data-disabled`, `data-required`, and `data-invalid` reflect the whole group. New
|
|
43
|
+
read-only `group` and `controls` properties and a `data-group` host attribute support the mode.
|
|
44
|
+
|
|
45
|
+
The primary control grows and other controls attach before or after it. In Material, the legend uses
|
|
46
|
+
the floating label mechanics: it rests on the input line while the group is idle and its primary
|
|
47
|
+
input empty, and floats on focus or once that input has a value; a group with a control before its
|
|
48
|
+
primary input keeps it floated. Grouped placeholders wait for focus. Substrate colors an invalid
|
|
49
|
+
group's legend, and Win31 spaces it like a single field's label.
|
|
50
|
+
|
|
51
|
+
- 9ab269c: Support `<select>` as a field control, both as a plain direct child and wrapped by an
|
|
52
|
+
enhancing control provider (the same contract `rc-textarea` already uses). Populated state for
|
|
53
|
+
a multiple select comes from `selectedOptions` rather than `.value`, which only reflects the
|
|
54
|
+
first selected option in tree order and can read empty even with a real selection.
|
|
55
|
+
- e23a39c: Add an accessible native input and textarea field wrapper with Material 3 filled and outlined
|
|
56
|
+
theme treatments, including an explicit provider contract for enhanced native controls.
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- 5c006de: Ship component CSS minified. Package builds now run the CSS in Lit `css` styles
|
|
61
|
+
and light-DOM structural styles through Lightning CSS, removing comments and
|
|
62
|
+
whitespace while keeping source maps that resolve to each template. Rendered
|
|
63
|
+
styles are unchanged.
|
|
64
|
+
|
|
65
|
+
`@rcarls/rc-common` adds `cssText`, an identity tag that marks a plain CSS
|
|
66
|
+
string for minification. `rc-chip`, `rc-disclosure`, and `rc-accordion` now
|
|
67
|
+
depend on `@rcarls/rc-common` for it.
|
|
68
|
+
|
|
69
|
+
- 011f3c6: Keep combobox chips clear of their trailing toggle, reset native selects inside
|
|
70
|
+
`rc-field`, keep controlled carousel accessibility state synchronized, and align
|
|
71
|
+
Material chips, menus, lists, disclosures, nested editors, and bottom-sheet
|
|
72
|
+
motion with their MD3 defaults.
|
|
73
|
+
- c5b62c9: Fix an empty `leading`/`trailing`/`prefix`/`suffix` slot silently keeping its layout box (and any
|
|
74
|
+
margin meant for the non-empty case), eating into the control's available width. The `.empty-slot`
|
|
75
|
+
class could never win against the id-selector rule setting its `display`, regardless of source
|
|
76
|
+
order.
|
|
77
|
+
- f4c0244: Prefer a control provider's own `disabled` property over its raw native control when both are
|
|
78
|
+
present. A provider disabling its control for an internal reason unrelated to the field's real
|
|
79
|
+
enabled/disabled intent (confirmed with `rc-select`'s GeckoView picker guard) no longer leaks
|
|
80
|
+
into `data-disabled` and the field's dimmed styling.
|
|
81
|
+
- f6eea6f: Suppress Chromium's tap-highlight flash on the native control. Firefox has no
|
|
82
|
+
equivalent behavior, so an unstyled control only flashed on Chrome despite the
|
|
83
|
+
existing focus-outline reset.
|
|
84
|
+
- 77f9c63: Fix three theme gaps where a token fell through to a system color.
|
|
85
|
+
|
|
86
|
+
**Substrate had no error color.** `--rc-field-error-color` fell through to `rc-field`'s own
|
|
87
|
+
default of `Mark`, the system color for the background of highlighted text, which renders as
|
|
88
|
+
pure yellow and measured 1.07:1 against the field. Validation worked, the message was in the
|
|
89
|
+
accessibility tree, and it could not be read. Substrate now ships `--substrate-error`, held
|
|
90
|
+
at hue 25 so it reads as red rather than as a darker shade of the orange primary at hue 48,
|
|
91
|
+
and the bridge maps it. Both modes clear 7:1.
|
|
92
|
+
|
|
93
|
+
Every remaining error fallback of `Mark`, in `rc-field` and in the Material field styles, now
|
|
94
|
+
falls back to the validation red a user agent uses for an invalid control. The `Mark` usages
|
|
95
|
+
inside `forced-colors` blocks are unchanged, where a system color is correct.
|
|
96
|
+
|
|
97
|
+
**Material never set `--rc-button-text`.** `rc-select`, `rc-combobox`, and `rc-menu-button`
|
|
98
|
+
read it directly for text drawn over `--rc-button-bg`, which Material sets to the primary
|
|
99
|
+
fill, so the `ButtonText` fallback gave 3.26:1 in light and 1.70:1 in dark. It now follows
|
|
100
|
+
`--md-sys-color-on-primary` alongside `--rc-button-color`, giving 6.44:1 and 7.71:1.
|
|
101
|
+
|
|
102
|
+
**Substrate referenced three tokens it never declared.** `--substrate-inverse-surface`,
|
|
103
|
+
`--substrate-inverse-on-surface`, and `--substrate-radius-pill` were used by the bridge and
|
|
104
|
+
component styles but missing from `defaults.css`, leaving `rc-snackbar` on system colors and
|
|
105
|
+
the bottom sheet handle on a literal. All three are declared, and a `defaults` test now
|
|
106
|
+
asserts that every referenced token exists.
|
|
107
|
+
|
|
108
|
+
- Updated dependencies [e3dfa59]
|
|
109
|
+
- Updated dependencies [50d5610]
|
|
110
|
+
- Updated dependencies [9ee769c]
|
|
111
|
+
- Updated dependencies [1179f24]
|
|
112
|
+
- Updated dependencies [595fe37]
|
|
113
|
+
- Updated dependencies [38cd00c]
|
|
114
|
+
- Updated dependencies [5c006de]
|
|
115
|
+
- Updated dependencies [a6553ff]
|
|
116
|
+
- Updated dependencies [2205478]
|
|
117
|
+
- Updated dependencies [4341311]
|
|
118
|
+
- Updated dependencies [899bb5e]
|
|
119
|
+
- Updated dependencies [25fcfe0]
|
|
120
|
+
- Updated dependencies [51f6403]
|
|
121
|
+
- Updated dependencies [9caca6b]
|
|
122
|
+
- Updated dependencies [b764a3c]
|
|
123
|
+
- Updated dependencies [54d9ead]
|
|
124
|
+
- Updated dependencies [b9175e9]
|
|
125
|
+
- Updated dependencies [c8b762b]
|
|
126
|
+
- Updated dependencies [55e1e7f]
|
|
127
|
+
- Updated dependencies [f1ca82d]
|
|
128
|
+
- Updated dependencies [b87f27b]
|
|
129
|
+
- Updated dependencies [32ebead]
|
|
130
|
+
- Updated dependencies [bfefedd]
|
|
131
|
+
- Updated dependencies [c130173]
|
|
132
|
+
- Updated dependencies [11680b6]
|
|
133
|
+
- Updated dependencies [223d36c]
|
|
134
|
+
- Updated dependencies [7b91a44]
|
|
135
|
+
- Updated dependencies [aa04ead]
|
|
136
|
+
- Updated dependencies [ac65b5b]
|
|
137
|
+
- Updated dependencies [afcfef8]
|
|
138
|
+
- Updated dependencies [11ef1ad]
|
|
139
|
+
- @rcarls/rc-common@0.7.0
|
package/README.md
CHANGED
|
@@ -1,8 +1,118 @@
|
|
|
1
|
-
#
|
|
1
|
+
# rc-field
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
npm so a Trusted Publisher can be configured for it before any real release. It contains no code.
|
|
3
|
+
Accessible field wrapper for a native input, textarea, or select with labels and supporting text.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Docs: [https://richardcarls.github.io/rc-webcomponents/components/rc-field](https://richardcarls.github.io/rc-webcomponents/components/rc-field).
|
|
6
|
+
|
|
7
|
+
`rc-field` keeps the native control in light DOM as the source of truth for value, validation,
|
|
8
|
+
autofill, labels, and form submission. It adds layout, state hooks, accessible hint/error wiring,
|
|
9
|
+
and theme affordances without replacing the browser's control behavior.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @rcarls/rc-field
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
yarn add @rcarls/rc-field
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Use
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import '@rcarls/rc-field/define';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<rc-field counter>
|
|
29
|
+
<label slot="label" for="recipe-title">Recipe title</label>
|
|
30
|
+
<input id="recipe-title" name="title" maxlength="80" required />
|
|
31
|
+
<small slot="hint">Use the title printed on the recipe.</small>
|
|
32
|
+
<small slot="error">Enter a recipe title.</small>
|
|
33
|
+
</rc-field>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The control must be a direct child. Use an explicit `for` and `id` pair when the label should work
|
|
37
|
+
before custom-element upgrade. A slotted native label without `for` is associated automatically
|
|
38
|
+
after upgrade; an ancestor native label can wrap the complete field instead. Native `input`,
|
|
39
|
+
`change`, and `invalid` events are not replaced or duplicated.
|
|
40
|
+
|
|
41
|
+
Call `sync()` after changing `.value` programmatically. Native input events, constraint attributes,
|
|
42
|
+
form reset, and control replacement synchronize automatically.
|
|
43
|
+
|
|
44
|
+
## Grouped controls
|
|
45
|
+
|
|
46
|
+
A `<fieldset>` placed directly inside the field groups several native controls into one field, such
|
|
47
|
+
as an amount and its unit. The `<legend>` names the group and shows as the field label, and each
|
|
48
|
+
control keeps its own accessible name, so a screen reader announces the group and then each
|
|
49
|
+
control. Supporting text describes the fieldset.
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<rc-field>
|
|
53
|
+
<fieldset>
|
|
54
|
+
<legend>Serving size</legend>
|
|
55
|
+
<input type="number" name="amount" aria-label="Amount" />
|
|
56
|
+
<select name="unit" aria-label="Unit">
|
|
57
|
+
<option value="g">g</option>
|
|
58
|
+
<option value="cup">cups</option>
|
|
59
|
+
</select>
|
|
60
|
+
</fieldset>
|
|
61
|
+
<small slot="hint">Optional</small>
|
|
62
|
+
</rc-field>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The first text-like input or textarea is the primary control: `control` returns it, `focus()`
|
|
66
|
+
moves to it, and `data-populated` follows its value. The field stays focused while focus moves
|
|
67
|
+
between its controls. `data-disabled` follows the fieldset's `disabled`, `data-required` any
|
|
68
|
+
required control, and `data-invalid` any control that fails validation, which also gets
|
|
69
|
+
`aria-invalid`. Use `controls` for every grouped control and `group` for the fieldset.
|
|
70
|
+
|
|
71
|
+
The primary control grows to fill the row. Selects and enhanced controls such as `rc-select` keep
|
|
72
|
+
their own width and attach before or after it in source order.
|
|
73
|
+
|
|
74
|
+
## Material theme
|
|
75
|
+
|
|
76
|
+
Import `@rcarls/rc-theme-material/theme.css` and place the field under `.rc-theme-material`.
|
|
77
|
+
Filled is the default treatment; add `class="rc-field--outlined"` for the outlined variant.
|
|
78
|
+
|
|
79
|
+
An enhancing control may wrap the native control when the direct child is explicitly marked as
|
|
80
|
+
the field control provider. The native control must remain its direct child:
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<rc-field>
|
|
84
|
+
<label slot="label" for="notes">Notes</label>
|
|
85
|
+
<rc-textarea data-rc-field-control>
|
|
86
|
+
<textarea id="notes" name="notes"></textarea>
|
|
87
|
+
</rc-textarea>
|
|
88
|
+
</rc-field>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`select` is a supported control shape too, either as a plain direct child:
|
|
92
|
+
|
|
93
|
+
```html
|
|
94
|
+
<rc-field>
|
|
95
|
+
<label slot="label" for="unit">Unit</label>
|
|
96
|
+
<select id="unit" name="unit">
|
|
97
|
+
<option value="oz">oz</option>
|
|
98
|
+
<option value="mL">mL</option>
|
|
99
|
+
</select>
|
|
100
|
+
</rc-field>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
or wrapped by an enhancing control provider the same way as `rc-textarea`:
|
|
104
|
+
|
|
105
|
+
```html
|
|
106
|
+
<rc-field>
|
|
107
|
+
<label slot="label" for="categories">Categories</label>
|
|
108
|
+
<rc-combobox data-rc-field-control multiple allow-create>
|
|
109
|
+
<select id="categories" name="categories" multiple>
|
|
110
|
+
<option value="braiser">Braiser</option>
|
|
111
|
+
<option value="chicken">Chicken</option>
|
|
112
|
+
</select>
|
|
113
|
+
</rc-combobox>
|
|
114
|
+
</rc-field>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
A multiple select's populated state comes from `selectedOptions`, not `.value` (which only ever
|
|
118
|
+
reflects the first _selected_ option in tree order and can read empty even with a real selection).
|