@aws-amplify/ui-vue 2.4.8 → 2.4.9
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/components/alias-control.vue.d.ts +9 -0
- package/dist/components/alias-control.vue.d.ts.map +1 -1
- package/dist/components/password-control.vue.d.ts +5 -3
- package/dist/components/password-control.vue.d.ts.map +1 -1
- package/dist/components/primitives/base-form-field.vue.d.ts.map +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.js +53 -20
- package/dist/style.css +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -6882,7 +6882,7 @@ var o = { getAmplifyConfig: function() {
|
|
|
6882
6882
|
/[0-9]/.test(n2) || s2.push("Password must have numbers");
|
|
6883
6883
|
break;
|
|
6884
6884
|
case "REQUIRES_SYMBOLS":
|
|
6885
|
-
/[\
|
|
6885
|
+
/[\^$*.[\]{}()?"!@#%&\/\\,><':;|_~`=+\-\ ]/.test(n2) || s2.push("Password must have special characters");
|
|
6886
6886
|
}
|
|
6887
6887
|
}), [2, s2.length !== 0 ? { password: s2 } : null]) : [2, null];
|
|
6888
6888
|
});
|
|
@@ -7993,6 +7993,23 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7993
7993
|
};
|
|
7994
7994
|
}
|
|
7995
7995
|
});
|
|
7996
|
+
let nanoid = (size) => {
|
|
7997
|
+
let id = "";
|
|
7998
|
+
let bytes = crypto.getRandomValues(new Uint8Array(size));
|
|
7999
|
+
while (size--) {
|
|
8000
|
+
let byte2 = bytes[size] & 63;
|
|
8001
|
+
if (byte2 < 36) {
|
|
8002
|
+
id += byte2.toString(36);
|
|
8003
|
+
} else if (byte2 < 62) {
|
|
8004
|
+
id += (byte2 - 26).toString(36).toUpperCase();
|
|
8005
|
+
} else if (byte2 < 63) {
|
|
8006
|
+
id += "_";
|
|
8007
|
+
} else {
|
|
8008
|
+
id += "-";
|
|
8009
|
+
}
|
|
8010
|
+
}
|
|
8011
|
+
return id;
|
|
8012
|
+
};
|
|
7996
8013
|
const _sfc_main$q = {};
|
|
7997
8014
|
const _hoisted_1$8 = { "data-amplify-label": "" };
|
|
7998
8015
|
function _sfc_render$2(_ctx, _cache) {
|
|
@@ -8053,10 +8070,11 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
8053
8070
|
name: null,
|
|
8054
8071
|
label: null,
|
|
8055
8072
|
autocomplete: null,
|
|
8056
|
-
|
|
8073
|
+
hasError: { type: Boolean },
|
|
8057
8074
|
labelHidden: { type: Boolean, default: true },
|
|
8058
8075
|
placeholder: null,
|
|
8059
|
-
required: { type: Boolean, default: true }
|
|
8076
|
+
required: { type: Boolean, default: true },
|
|
8077
|
+
describedBy: null
|
|
8060
8078
|
},
|
|
8061
8079
|
setup(__props) {
|
|
8062
8080
|
var _a2;
|
|
@@ -8066,7 +8084,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
8066
8084
|
const showHideType = ref("password");
|
|
8067
8085
|
const showHideLabel = ref(showPassword);
|
|
8068
8086
|
const random = Math.floor(Math.random() * 999999);
|
|
8069
|
-
const { name, label, autocomplete,
|
|
8087
|
+
const { name, label, autocomplete, hasError, labelHidden, placeholder, required } = toRefs(props);
|
|
8070
8088
|
let password = ref("");
|
|
8071
8089
|
function togglePasswordText() {
|
|
8072
8090
|
showHideLabel.value = showHideLabel.value === showPassword ? hidePassword : showPassword;
|
|
@@ -8099,15 +8117,16 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
8099
8117
|
modelValue: unref(password),
|
|
8100
8118
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(password) ? password.value = $event : password = $event),
|
|
8101
8119
|
class: "amplify-input amplify-field-group__control",
|
|
8102
|
-
"aria-invalid": unref(ariainvalid),
|
|
8103
8120
|
id: "amplify-field-" + unref(random),
|
|
8104
8121
|
"data-amplify-password": "true",
|
|
8105
8122
|
name: unref(name),
|
|
8106
8123
|
autocomplete: unref(autocomplete),
|
|
8107
8124
|
required: (_a4 = unref(required)) != null ? _a4 : true,
|
|
8108
8125
|
placeholder: unref(placeholderValue),
|
|
8109
|
-
type: showHideType.value
|
|
8110
|
-
|
|
8126
|
+
type: showHideType.value,
|
|
8127
|
+
"aria-invalid": unref(hasError),
|
|
8128
|
+
"aria-describedBy": __props.describedBy
|
|
8129
|
+
}), null, 16, ["modelValue", "id", "name", "autocomplete", "required", "placeholder", "type", "aria-invalid", "aria-describedBy"]),
|
|
8111
8130
|
createVNode(_component_base_wrapper, { class: "amplify-field-group__outer-end" }, {
|
|
8112
8131
|
default: withCtx(() => [
|
|
8113
8132
|
createElementVNode("button", {
|
|
@@ -8183,7 +8202,9 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
8183
8202
|
required: { type: Boolean, default: true },
|
|
8184
8203
|
dialCode: null,
|
|
8185
8204
|
dialCodeList: null,
|
|
8186
|
-
type: { default: "text" }
|
|
8205
|
+
type: { default: "text" },
|
|
8206
|
+
hasError: { type: Boolean },
|
|
8207
|
+
describedBy: null
|
|
8187
8208
|
},
|
|
8188
8209
|
setup(__props) {
|
|
8189
8210
|
const props = __props;
|
|
@@ -8256,14 +8277,15 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
8256
8277
|
return [
|
|
8257
8278
|
createVNode(_component_base_input, {
|
|
8258
8279
|
class: "amplify-input amplify-field-group__control",
|
|
8259
|
-
"aria-invalid": "false",
|
|
8260
8280
|
id: "amplify-field-" + unref(random),
|
|
8261
8281
|
autocomplete: unref(autocomplete),
|
|
8262
8282
|
name: unref(name),
|
|
8263
8283
|
required: (_a2 = unref(required)) != null ? _a2 : true,
|
|
8264
8284
|
type: __props.type,
|
|
8265
|
-
placeholder: unref(placeholder)
|
|
8266
|
-
|
|
8285
|
+
placeholder: unref(placeholder),
|
|
8286
|
+
"aria-invalid": __props.hasError,
|
|
8287
|
+
"aria-describedBy": __props.describedBy
|
|
8288
|
+
}, null, 8, ["id", "autocomplete", "name", "required", "type", "placeholder", "aria-invalid", "aria-describedBy"])
|
|
8267
8289
|
];
|
|
8268
8290
|
}),
|
|
8269
8291
|
_: 1
|
|
@@ -8277,7 +8299,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
8277
8299
|
};
|
|
8278
8300
|
}
|
|
8279
8301
|
});
|
|
8280
|
-
const _hoisted_1$4 =
|
|
8302
|
+
const _hoisted_1$4 = ["id"];
|
|
8281
8303
|
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
8282
8304
|
name: "base-form-field",
|
|
8283
8305
|
props: {
|
|
@@ -8290,10 +8312,15 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
8290
8312
|
const useAuthShared = createSharedComposable(useAuthenticator);
|
|
8291
8313
|
const { validationErrors } = toRefs(useAuthShared());
|
|
8292
8314
|
const { type } = formField.value;
|
|
8293
|
-
const errors = computed(() => u$2(validationErrors.value[name.value]));
|
|
8294
8315
|
const isPasswordField = type === "password";
|
|
8295
|
-
|
|
8316
|
+
const errorId = nanoid(12);
|
|
8317
|
+
const errors = computed(() => u$2(validationErrors.value[name.value]));
|
|
8318
|
+
const hasError = computed(() => {
|
|
8296
8319
|
var _a2;
|
|
8320
|
+
return ((_a2 = errors.value) == null ? void 0 : _a2.length) > 0;
|
|
8321
|
+
});
|
|
8322
|
+
const ariaDescribedBy = computed(() => hasError.value ? errorId : void 0);
|
|
8323
|
+
return (_ctx, _cache) => {
|
|
8297
8324
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
8298
8325
|
isPasswordField ? (openBlock(), createBlock(_sfc_main$o, {
|
|
8299
8326
|
key: 0,
|
|
@@ -8303,8 +8330,9 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
8303
8330
|
required: unref(formField).isRequired,
|
|
8304
8331
|
"label-hidden": unref(formField).labelHidden,
|
|
8305
8332
|
autocomplete: unref(formField).autocomplete,
|
|
8306
|
-
|
|
8307
|
-
|
|
8333
|
+
hasError: unref(hasError),
|
|
8334
|
+
describedBy: unref(ariaDescribedBy)
|
|
8335
|
+
}, null, 8, ["name", "label", "placeholder", "required", "label-hidden", "autocomplete", "hasError", "describedBy"])) : (openBlock(), createBlock(_sfc_main$m, {
|
|
8308
8336
|
key: 1,
|
|
8309
8337
|
name: unref(name),
|
|
8310
8338
|
label: unref(formField).label,
|
|
@@ -8314,9 +8342,14 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
8314
8342
|
autocomplete: unref(formField).autocomplete,
|
|
8315
8343
|
"dial-code": unref(formField).dialCode,
|
|
8316
8344
|
"dial-code-list": unref(formField).dialCodeList,
|
|
8317
|
-
type: unref(formField).type
|
|
8318
|
-
|
|
8319
|
-
|
|
8345
|
+
type: unref(formField).type,
|
|
8346
|
+
hasError: unref(hasError),
|
|
8347
|
+
describedBy: unref(ariaDescribedBy)
|
|
8348
|
+
}, null, 8, ["name", "label", "placeholder", "required", "label-hidden", "autocomplete", "dial-code", "dial-code-list", "type", "hasError", "describedBy"])),
|
|
8349
|
+
unref(hasError) ? (openBlock(), createElementBlock("div", {
|
|
8350
|
+
key: 2,
|
|
8351
|
+
id: unref(ariaDescribedBy)
|
|
8352
|
+
}, [
|
|
8320
8353
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(errors), (error2, idx) => {
|
|
8321
8354
|
return openBlock(), createElementBlock("p", {
|
|
8322
8355
|
key: idx,
|
|
@@ -8325,7 +8358,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
8325
8358
|
class: "amplify-text amplify-text--error"
|
|
8326
8359
|
}, toDisplayString(unref(g$1)(error2)), 1);
|
|
8327
8360
|
}), 128))
|
|
8328
|
-
])) : createCommentVNode("", true)
|
|
8361
|
+
], 8, _hoisted_1$4)) : createCommentVNode("", true)
|
|
8329
8362
|
], 64);
|
|
8330
8363
|
};
|
|
8331
8364
|
}
|