@charpente-ui/vue 2.1.2 → 2.2.1
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/README.md +14 -0
- package/dist/{src/components → components}/BaseField.d.ts +4 -1
- package/dist/components/BaseField.js +8 -2
- package/dist/{src/components → components}/internal/field.d.ts +3 -1
- package/dist/index.d.ts +13 -1
- package/package.json +1 -1
- package/dist/src/index.d.ts +0 -13
- /package/dist/{src/components → components}/BaseButton.d.ts +0 -0
- /package/dist/{src/components → components}/BaseCheckbox.d.ts +0 -0
- /package/dist/{src/components → components}/BaseCheckboxGroup.d.ts +0 -0
- /package/dist/{src/components → components}/BaseFile.d.ts +0 -0
- /package/dist/{src/components → components}/BaseForm.d.ts +0 -0
- /package/dist/{src/components → components}/BaseInput.d.ts +0 -0
- /package/dist/{src/components → components}/BaseLabel.d.ts +0 -0
- /package/dist/{src/components → components}/BaseRadio.d.ts +0 -0
- /package/dist/{src/components → components}/BaseRadioGroup.d.ts +0 -0
- /package/dist/{src/components → components}/BaseSelect.d.ts +0 -0
- /package/dist/{src/components → components}/BaseSupportingText.d.ts +0 -0
- /package/dist/{src/components → components}/BaseTextarea.d.ts +0 -0
- /package/dist/{src/components → components}/internal/keys.d.ts +0 -0
- /package/dist/{src/components → components}/internal/modifiers.d.ts +0 -0
package/README.md
CHANGED
|
@@ -248,6 +248,20 @@ messages for free. Charpente UI exposes that instead of reinventing it — opt i
|
|
|
248
248
|
- Without `validate`, nothing changes — bring your own validation library if you need cross-field or async rules.
|
|
249
249
|
Native escapes still work: `formnovalidate` on a submit button skips validation for that button.
|
|
250
250
|
|
|
251
|
+
`CField` stays zero-CSS: it never applies a class itself. If you need custom styling beyond `[aria-invalid]` or
|
|
252
|
+
`:invalid` selectors, its default slot exposes `invalid` and `message` so you can drive your own classes:
|
|
253
|
+
|
|
254
|
+
```vue
|
|
255
|
+
<CField v-slot="{ invalid, message }">
|
|
256
|
+
<CLabel>Email</CLabel>
|
|
257
|
+
<CInput v-model="email" type="email" required :class="{ 'is-invalid': invalid }"/>
|
|
258
|
+
<span v-if="invalid" class="error">{{ message }}</span>
|
|
259
|
+
</CField>
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
This only reaches elements placed directly inside `CField`'s default slot — a custom component nested deeper won't
|
|
263
|
+
receive `invalid`/`message` automatically; pass them down as props if you need that.
|
|
264
|
+
|
|
251
265
|
## Components
|
|
252
266
|
|
|
253
267
|
| Name | Core Logic | Tag | Status |
|
|
@@ -28,13 +28,19 @@ var d = /*@__PURE__*/ r({
|
|
|
28
28
|
h.value = !0, m.value = e.target.validationMessage;
|
|
29
29
|
}
|
|
30
30
|
function S(e) {
|
|
31
|
-
|
|
31
|
+
if (h.value) {
|
|
32
|
+
let t = e.target;
|
|
33
|
+
h.value = !t.validity.valid, m.value = t.validationMessage;
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
36
|
return (e, t) => (a(), n("div", i(b.value, {
|
|
34
37
|
onInvalidCapture: x,
|
|
35
38
|
onInputCapture: S,
|
|
36
39
|
onChangeCapture: S
|
|
37
|
-
}), [c(e.$slots, "default"
|
|
40
|
+
}), [c(e.$slots, "default", {
|
|
41
|
+
invalid: h.value,
|
|
42
|
+
message: m.value
|
|
43
|
+
})], 16));
|
|
38
44
|
}
|
|
39
45
|
});
|
|
40
46
|
//#endregion
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
type AriaInvalid = boolean | 'true' | 'false' | 'grammar' | 'spelling' | undefined;
|
|
1
2
|
export declare function useFieldControl(): {
|
|
2
3
|
controlId: import('vue').ComputedRef<string>;
|
|
3
4
|
describedBy: import('vue').ComputedRef<string | undefined>;
|
|
4
|
-
ariaInvalid: import('vue').ComputedRef<
|
|
5
|
+
ariaInvalid: import('vue').ComputedRef<AriaInvalid>;
|
|
5
6
|
};
|
|
7
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export { default as CButton } from './components/BaseButton';
|
|
2
|
+
export { default as CCheckbox } from './components/BaseCheckbox';
|
|
3
|
+
export { default as CCheckboxGroup } from './components/BaseCheckboxGroup';
|
|
4
|
+
export { default as CField } from './components/BaseField';
|
|
5
|
+
export { default as CFile } from './components/BaseFile';
|
|
6
|
+
export { default as CForm } from './components/BaseForm';
|
|
7
|
+
export { default as CInput } from './components/BaseInput';
|
|
8
|
+
export { default as CLabel } from './components/BaseLabel';
|
|
9
|
+
export { default as CRadio } from './components/BaseRadio';
|
|
10
|
+
export { default as CRadioGroup } from './components/BaseRadioGroup';
|
|
11
|
+
export { default as CSelect } from './components/BaseSelect';
|
|
12
|
+
export { default as CSupportingText } from './components/BaseSupportingText';
|
|
13
|
+
export { default as CTextarea } from './components/BaseTextarea';
|
package/package.json
CHANGED
package/dist/src/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { default as CButton } from './components/BaseButton';
|
|
2
|
-
export { default as CCheckbox } from './components/BaseCheckbox';
|
|
3
|
-
export { default as CCheckboxGroup } from './components/BaseCheckboxGroup';
|
|
4
|
-
export { default as CField } from './components/BaseField';
|
|
5
|
-
export { default as CFile } from './components/BaseFile';
|
|
6
|
-
export { default as CForm } from './components/BaseForm';
|
|
7
|
-
export { default as CInput } from './components/BaseInput';
|
|
8
|
-
export { default as CLabel } from './components/BaseLabel';
|
|
9
|
-
export { default as CRadio } from './components/BaseRadio';
|
|
10
|
-
export { default as CRadioGroup } from './components/BaseRadioGroup';
|
|
11
|
-
export { default as CSelect } from './components/BaseSelect';
|
|
12
|
-
export { default as CSupportingText } from './components/BaseSupportingText';
|
|
13
|
-
export { default as CTextarea } from './components/BaseTextarea';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|