@umbra.ui/core 0.1.26 → 0.2.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/components/controls/Button/Button.vue +0 -3
- package/dist/components/controls/IconButton/IconButton.vue +0 -3
- package/dist/components/inputs/InputSecure/InputSecure.vue +65 -7
- package/dist/components/models/Popover/Popover.vue +146 -14
- package/dist/components/models/Popover/theme.css +2 -7
- package/dist/components/navigation/adaptive/AdaptiveLayout.vue +26 -5
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts +3 -3
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts.map +1 -1
- package/dist/components/navigation/adaptive/useViewAnimation.js +28 -20
- package/dist/components/navigation/adaptive/useViewAnimation.ts +35 -20
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/package.json +4 -4
- package/src/components/controls/Button/Button.vue +0 -3
- package/src/components/controls/IconButton/IconButton.vue +0 -3
- package/src/components/inputs/InputSecure/InputSecure.vue +65 -7
- package/src/components/models/Popover/Popover.vue +146 -14
- package/src/components/models/Popover/theme.css +2 -7
- package/src/components/navigation/adaptive/AdaptiveLayout.vue +26 -5
- package/src/components/navigation/adaptive/useViewAnimation.ts +35 -20
- package/src/index.ts +3 -0
|
@@ -14,7 +14,7 @@ export const useViewAnimation = (views, instanceKey, containerDimensions, paddin
|
|
|
14
14
|
/*
|
|
15
15
|
* Basic animation function
|
|
16
16
|
*/
|
|
17
|
-
const animate = async (targets, manipulateDOMFn, updateDataFn) => {
|
|
17
|
+
const animate = async (targets, manipulateDOMFn, updateDataFn, animated = true) => {
|
|
18
18
|
if (animationInProgress.value) {
|
|
19
19
|
console.warn("Animation already in progress");
|
|
20
20
|
return;
|
|
@@ -25,17 +25,25 @@ export const useViewAnimation = (views, instanceKey, containerDimensions, paddin
|
|
|
25
25
|
// Step 2: Manipulate DOM
|
|
26
26
|
manipulateDOMFn();
|
|
27
27
|
// Step 3: Animate
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
if (animated) {
|
|
29
|
+
return Flip.from(state, {
|
|
30
|
+
duration: 0.3,
|
|
31
|
+
ease: "power1.inOut",
|
|
32
|
+
absolute: true,
|
|
33
|
+
onComplete: () => {
|
|
34
|
+
animationInProgress.value = false;
|
|
35
|
+
},
|
|
36
|
+
}).then(() => {
|
|
37
|
+
// Step 5: Update Data
|
|
38
|
+
updateDataFn();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Update Data
|
|
37
43
|
updateDataFn();
|
|
38
|
-
|
|
44
|
+
// Step 5: Complete
|
|
45
|
+
animationInProgress.value = false;
|
|
46
|
+
}
|
|
39
47
|
};
|
|
40
48
|
/*
|
|
41
49
|
Utility Functions
|
|
@@ -164,11 +172,11 @@ export const useViewAnimation = (views, instanceKey, containerDimensions, paddin
|
|
|
164
172
|
const getFirstViewInOverlay = () => {
|
|
165
173
|
return views.value.find((v) => v.location === "overlay");
|
|
166
174
|
};
|
|
167
|
-
const splitViewShow = async (id) => {
|
|
175
|
+
const splitViewShow = async (id, animated = true) => {
|
|
168
176
|
const view = views.value.find((v) => v.id === id);
|
|
169
177
|
if (view?.location === "onscreen")
|
|
170
178
|
return;
|
|
171
|
-
await splitViewNavigate(id, "show");
|
|
179
|
+
await splitViewNavigate(id, "show", animated);
|
|
172
180
|
};
|
|
173
181
|
const splitViewHide = async (id) => {
|
|
174
182
|
// Prevent hiding the last view (would result in nothing being shown)
|
|
@@ -214,7 +222,7 @@ export const useViewAnimation = (views, instanceKey, containerDimensions, paddin
|
|
|
214
222
|
return;
|
|
215
223
|
}
|
|
216
224
|
};
|
|
217
|
-
const splitViewNavigate = async (id, type) => {
|
|
225
|
+
const splitViewNavigate = async (id, type, animated = true) => {
|
|
218
226
|
const elements = getViewElements();
|
|
219
227
|
// Get the appropriate view elements based on type
|
|
220
228
|
let viewElements = [];
|
|
@@ -337,7 +345,7 @@ export const useViewAnimation = (views, instanceKey, containerDimensions, paddin
|
|
|
337
345
|
}
|
|
338
346
|
}
|
|
339
347
|
};
|
|
340
|
-
await animate(elements, manipulateDOM, updateData);
|
|
348
|
+
await animate(elements, manipulateDOM, updateData, animated);
|
|
341
349
|
};
|
|
342
350
|
/*
|
|
343
351
|
* Internal Functions: Slideover
|
|
@@ -347,7 +355,7 @@ export const useViewAnimation = (views, instanceKey, containerDimensions, paddin
|
|
|
347
355
|
- push presents another view to the overlay from the left.
|
|
348
356
|
- pop dismisses a view from the overlay to the left.
|
|
349
357
|
*/
|
|
350
|
-
const slideoverShow = async (id) => {
|
|
358
|
+
const slideoverShow = async (id, animated = true) => {
|
|
351
359
|
// Get the view with the given id AND all views after it that have location "leading"
|
|
352
360
|
const currentView = views.value.find((v) => v.id === id);
|
|
353
361
|
if (currentView?.location === "onscreen") {
|
|
@@ -496,9 +504,9 @@ export const useViewAnimation = (views, instanceKey, containerDimensions, paddin
|
|
|
496
504
|
- push presents next view fullscreen from the right, and dismisses current view to the left.
|
|
497
505
|
- pop dismisses current view to the right, and pushes preceeding view fullscreen from the left.
|
|
498
506
|
*/
|
|
499
|
-
const navstackShow = async (id) => {
|
|
507
|
+
const navstackShow = async (id, animated = true) => {
|
|
500
508
|
const index = views.value.findIndex((view) => view.id === id);
|
|
501
|
-
navstackNavigateTo(index);
|
|
509
|
+
navstackNavigateTo(index, animated);
|
|
502
510
|
};
|
|
503
511
|
const navstackPush = async () => {
|
|
504
512
|
const currentIndex = views.value.findIndex((view) => view.location === "onscreen");
|
|
@@ -508,7 +516,7 @@ export const useViewAnimation = (views, instanceKey, containerDimensions, paddin
|
|
|
508
516
|
const currentIndex = views.value.findIndex((view) => view.location === "onscreen");
|
|
509
517
|
navstackNavigateTo(currentIndex - 1);
|
|
510
518
|
};
|
|
511
|
-
const navstackNavigateTo = async (index) => {
|
|
519
|
+
const navstackNavigateTo = async (index, animated = true) => {
|
|
512
520
|
const onscreen = document.getElementById(getOnscreenId());
|
|
513
521
|
const offscreenLeading = document.getElementById(getOffscreenLeadingId());
|
|
514
522
|
const offscreenTrailing = document.getElementById(getOffscreenTrailingId());
|
|
@@ -557,7 +565,7 @@ export const useViewAnimation = (views, instanceKey, containerDimensions, paddin
|
|
|
557
565
|
currentView.style.width = "";
|
|
558
566
|
nextView.style.width = "";
|
|
559
567
|
};
|
|
560
|
-
await animate(targets, manipulateDOM, updateData);
|
|
568
|
+
await animate(targets, manipulateDOM, updateData, animated);
|
|
561
569
|
};
|
|
562
570
|
/*
|
|
563
571
|
State
|
|
@@ -29,7 +29,8 @@ export const useViewAnimation = (
|
|
|
29
29
|
const animate = async (
|
|
30
30
|
targets: HTMLElement[],
|
|
31
31
|
manipulateDOMFn: () => void,
|
|
32
|
-
updateDataFn: () => void
|
|
32
|
+
updateDataFn: () => void,
|
|
33
|
+
animated: boolean = true
|
|
33
34
|
) => {
|
|
34
35
|
if (animationInProgress.value) {
|
|
35
36
|
console.warn("Animation already in progress");
|
|
@@ -43,17 +44,24 @@ export const useViewAnimation = (
|
|
|
43
44
|
manipulateDOMFn();
|
|
44
45
|
|
|
45
46
|
// Step 3: Animate
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
if (animated) {
|
|
48
|
+
return Flip.from(state, {
|
|
49
|
+
duration: 0.3,
|
|
50
|
+
ease: "power1.inOut",
|
|
51
|
+
absolute: true,
|
|
52
|
+
onComplete: () => {
|
|
53
|
+
animationInProgress.value = false;
|
|
54
|
+
},
|
|
55
|
+
}).then(() => {
|
|
56
|
+
// Step 5: Update Data
|
|
57
|
+
updateDataFn();
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
// Update Data
|
|
55
61
|
updateDataFn();
|
|
56
|
-
|
|
62
|
+
// Step 5: Complete
|
|
63
|
+
animationInProgress.value = false;
|
|
64
|
+
}
|
|
57
65
|
};
|
|
58
66
|
|
|
59
67
|
/*
|
|
@@ -235,10 +243,10 @@ export const useViewAnimation = (
|
|
|
235
243
|
|
|
236
244
|
type NavigationType = "push" | "pop" | "show" | "hide";
|
|
237
245
|
|
|
238
|
-
const splitViewShow = async (id: string) => {
|
|
246
|
+
const splitViewShow = async (id: string, animated: boolean = true) => {
|
|
239
247
|
const view = views.value.find((v) => v.id === id);
|
|
240
248
|
if (view?.location === "onscreen") return;
|
|
241
|
-
await splitViewNavigate(id, "show");
|
|
249
|
+
await splitViewNavigate(id, "show", animated);
|
|
242
250
|
};
|
|
243
251
|
|
|
244
252
|
const splitViewHide = async (id: string) => {
|
|
@@ -287,7 +295,11 @@ export const useViewAnimation = (
|
|
|
287
295
|
}
|
|
288
296
|
};
|
|
289
297
|
|
|
290
|
-
const splitViewNavigate = async (
|
|
298
|
+
const splitViewNavigate = async (
|
|
299
|
+
id: string,
|
|
300
|
+
type: NavigationType,
|
|
301
|
+
animated: boolean = true
|
|
302
|
+
) => {
|
|
291
303
|
const elements = getViewElements();
|
|
292
304
|
|
|
293
305
|
// Get the appropriate view elements based on type
|
|
@@ -439,7 +451,7 @@ export const useViewAnimation = (
|
|
|
439
451
|
}
|
|
440
452
|
};
|
|
441
453
|
|
|
442
|
-
await animate(elements, manipulateDOM, updateData);
|
|
454
|
+
await animate(elements, manipulateDOM, updateData, animated);
|
|
443
455
|
};
|
|
444
456
|
|
|
445
457
|
/*
|
|
@@ -451,7 +463,7 @@ export const useViewAnimation = (
|
|
|
451
463
|
- pop dismisses a view from the overlay to the left.
|
|
452
464
|
*/
|
|
453
465
|
|
|
454
|
-
const slideoverShow = async (id: string) => {
|
|
466
|
+
const slideoverShow = async (id: string, animated: boolean = true) => {
|
|
455
467
|
// Get the view with the given id AND all views after it that have location "leading"
|
|
456
468
|
const currentView = views.value.find((v) => v.id === id);
|
|
457
469
|
if (currentView?.location === "onscreen") {
|
|
@@ -607,9 +619,9 @@ export const useViewAnimation = (
|
|
|
607
619
|
- pop dismisses current view to the right, and pushes preceeding view fullscreen from the left.
|
|
608
620
|
*/
|
|
609
621
|
|
|
610
|
-
const navstackShow = async (id: string) => {
|
|
622
|
+
const navstackShow = async (id: string, animated: boolean = true) => {
|
|
611
623
|
const index = views.value.findIndex((view) => view.id === id);
|
|
612
|
-
navstackNavigateTo(index);
|
|
624
|
+
navstackNavigateTo(index, animated);
|
|
613
625
|
};
|
|
614
626
|
|
|
615
627
|
const navstackPush = async () => {
|
|
@@ -626,7 +638,10 @@ export const useViewAnimation = (
|
|
|
626
638
|
navstackNavigateTo(currentIndex - 1);
|
|
627
639
|
};
|
|
628
640
|
|
|
629
|
-
const navstackNavigateTo = async (
|
|
641
|
+
const navstackNavigateTo = async (
|
|
642
|
+
index: number,
|
|
643
|
+
animated: boolean = true
|
|
644
|
+
) => {
|
|
630
645
|
const onscreen = document.getElementById(getOnscreenId());
|
|
631
646
|
const offscreenLeading = document.getElementById(getOffscreenLeadingId());
|
|
632
647
|
const offscreenTrailing = document.getElementById(getOffscreenTrailingId());
|
|
@@ -685,7 +700,7 @@ export const useViewAnimation = (
|
|
|
685
700
|
currentView.style.width = "";
|
|
686
701
|
nextView.style.width = "";
|
|
687
702
|
};
|
|
688
|
-
await animate(targets, manipulateDOM, updateData);
|
|
703
|
+
await animate(targets, manipulateDOM, updateData, animated);
|
|
689
704
|
};
|
|
690
705
|
|
|
691
706
|
/*
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,sCAAsC,CAAC;AAC9C,OAAO,qCAAqC,CAAC;AAG7C,cAAc,kBAAkB,CAAC;A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,EAC5B,KAAK,mBAAmB,GACzB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qDAAqD,CAAC;AAChG,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,gEAAgE,CAAC;AACtH,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,+DAA+D,CAAC;AACpH,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAG5F,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,EACd,eAAe,EACf,SAAS,EACT,OAAO,GACR,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbra.ui/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Core components for Umbra UI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"license": "MIT",
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@floating-ui/vue": "^1.1.7",
|
|
46
|
-
"@umbra.ui/colors": "^0.
|
|
47
|
-
"@umbra.ui/icons": "^0.
|
|
48
|
-
"@umbra.ui/typography": "^0.
|
|
46
|
+
"@umbra.ui/colors": "^0.2.0",
|
|
47
|
+
"@umbra.ui/icons": "^0.2.0",
|
|
48
|
+
"@umbra.ui/typography": "^0.2.0",
|
|
49
49
|
"autosize": "^6.0.1",
|
|
50
50
|
"@types/autosize": "^4.0.3",
|
|
51
51
|
"gsap": "^3.13.0",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { RippleAnimOutlineIcon } from "@umbra.ui/icons";
|
|
4
|
-
import type { TooltipConfig } from "../../indicators/Tooltip/types";
|
|
5
4
|
import "./theme.css";
|
|
6
5
|
|
|
7
6
|
export interface Props {
|
|
@@ -18,7 +17,6 @@ export interface Props {
|
|
|
18
17
|
buttonSize?: "compact" | "regular" | "large";
|
|
19
18
|
state?: "normal" | "active" | "disabled";
|
|
20
19
|
title?: string;
|
|
21
|
-
tooltip?: string | TooltipConfig;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
const emit = defineEmits(["update:state", "click"]);
|
|
@@ -88,7 +86,6 @@ const buttonColorWithOpacity = computed(() => {
|
|
|
88
86
|
|
|
89
87
|
<template>
|
|
90
88
|
<div
|
|
91
|
-
v-tooltip="tooltip"
|
|
92
89
|
@click="handleClick"
|
|
93
90
|
:class="[
|
|
94
91
|
$style.container,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { CircleAnimOutlineIcon, icons, type IconKey } from "@umbra.ui/icons";
|
|
4
|
-
import type { TooltipConfig } from "../../indicators/Tooltip/types";
|
|
5
4
|
import "./theme.css";
|
|
6
5
|
|
|
7
6
|
interface Props {
|
|
@@ -10,7 +9,6 @@ interface Props {
|
|
|
10
9
|
buttonStyle?: "primary" | "secondary" | "tertiary" | "quaternary" | string;
|
|
11
10
|
state?: "normal" | "active" | "disabled";
|
|
12
11
|
buttonSize?: number;
|
|
13
|
-
tooltip?: string | TooltipConfig;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -70,7 +68,6 @@ const IconComponent = computed(() => {
|
|
|
70
68
|
|
|
71
69
|
<template>
|
|
72
70
|
<div
|
|
73
|
-
v-tooltip="tooltip"
|
|
74
71
|
@click="handleClick"
|
|
75
72
|
:class="[
|
|
76
73
|
$style.container,
|
|
@@ -9,10 +9,12 @@ import {
|
|
|
9
9
|
import "../theme.css";
|
|
10
10
|
|
|
11
11
|
export interface Props {
|
|
12
|
+
usage: "create" | "confirm" | "enter";
|
|
12
13
|
value?: string;
|
|
13
14
|
placeholder?: string;
|
|
14
15
|
showStrength?: boolean;
|
|
15
16
|
allowGenerate?: boolean;
|
|
17
|
+
allowCopy?: boolean;
|
|
16
18
|
showRequirements?: boolean;
|
|
17
19
|
minLength?: number;
|
|
18
20
|
requireUppercase?: boolean;
|
|
@@ -21,13 +23,16 @@ export interface Props {
|
|
|
21
23
|
requireSpecialChars?: boolean;
|
|
22
24
|
preventCommon?: boolean;
|
|
23
25
|
state?: "normal" | "active" | "disabled" | "readonly" | "error";
|
|
26
|
+
validate?: (value: string) => boolean | { valid: boolean; message?: string };
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
const props = withDefaults(defineProps<Props>(), {
|
|
30
|
+
usage: "create",
|
|
27
31
|
value: "",
|
|
28
32
|
placeholder: "Enter password",
|
|
29
33
|
showStrength: true,
|
|
30
34
|
allowGenerate: true,
|
|
35
|
+
allowCopy: true,
|
|
31
36
|
showRequirements: true,
|
|
32
37
|
minLength: 8,
|
|
33
38
|
requireUppercase: true,
|
|
@@ -36,6 +41,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
36
41
|
requireSpecialChars: true,
|
|
37
42
|
preventCommon: true,
|
|
38
43
|
state: "normal",
|
|
44
|
+
// validate is undefined by default, triggering fallback to requirements
|
|
39
45
|
});
|
|
40
46
|
|
|
41
47
|
const emit = defineEmits<{
|
|
@@ -44,6 +50,30 @@ const emit = defineEmits<{
|
|
|
44
50
|
"update:strength": [value: number];
|
|
45
51
|
}>();
|
|
46
52
|
|
|
53
|
+
// computed props
|
|
54
|
+
const showGenerationUI = computed(() => {
|
|
55
|
+
if (props.usage === "confirm") return false;
|
|
56
|
+
if (props.usage === "enter") return false;
|
|
57
|
+
if (props.state === "active" || props.state === "readonly") return false;
|
|
58
|
+
return props.allowGenerate;
|
|
59
|
+
});
|
|
60
|
+
const showCopyUI = computed(() => {
|
|
61
|
+
if (props.usage === "confirm") return false;
|
|
62
|
+
if (props.usage === "enter") return false;
|
|
63
|
+
if (props.state === "active" || props.state === "readonly") return false;
|
|
64
|
+
return props.allowCopy;
|
|
65
|
+
});
|
|
66
|
+
const showStrengthUI = computed(() => {
|
|
67
|
+
if (props.usage === "confirm") return false;
|
|
68
|
+
if (props.usage === "enter") return false;
|
|
69
|
+
return props.showStrength;
|
|
70
|
+
});
|
|
71
|
+
const showRequirementsUI = computed(() => {
|
|
72
|
+
if (props.usage === "confirm") return false;
|
|
73
|
+
if (props.usage === "enter") return false;
|
|
74
|
+
return props.showRequirements;
|
|
75
|
+
});
|
|
76
|
+
|
|
47
77
|
const showInput = ref<boolean>(false);
|
|
48
78
|
const internalValue = ref(props.value);
|
|
49
79
|
const isFocused = ref(false);
|
|
@@ -116,9 +146,24 @@ const requirements = computed(() => {
|
|
|
116
146
|
|
|
117
147
|
// Check if all requirements are met
|
|
118
148
|
const isValid = computed(() => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
149
|
+
if (props.validate) {
|
|
150
|
+
const result = props.validate(internalValue.value);
|
|
151
|
+
return typeof result === "boolean" ? result : result.valid;
|
|
152
|
+
}
|
|
153
|
+
// Fallback to existing requirements validation
|
|
154
|
+
if (props.usage === "create") {
|
|
155
|
+
return Object.values(requirements.value)
|
|
156
|
+
.filter((req) => req.required)
|
|
157
|
+
.every((req) => req.met);
|
|
158
|
+
}
|
|
159
|
+
return true;
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const customValidationMessage = computed(() => {
|
|
163
|
+
if (!props.validate) return undefined;
|
|
164
|
+
|
|
165
|
+
const result = props.validate(internalValue.value);
|
|
166
|
+
return typeof result === "object" ? result.message : undefined;
|
|
122
167
|
});
|
|
123
168
|
|
|
124
169
|
// Calculate password strength (0-4)
|
|
@@ -291,7 +336,7 @@ const getPlaceholder = computed(() => {
|
|
|
291
336
|
>
|
|
292
337
|
<!-- Generate password button -->
|
|
293
338
|
<button
|
|
294
|
-
v-if="
|
|
339
|
+
v-if="showGenerationUI"
|
|
295
340
|
type="button"
|
|
296
341
|
:class="[$style.icon_button, $style.generate_button]"
|
|
297
342
|
@click="generatePassword"
|
|
@@ -317,7 +362,7 @@ const getPlaceholder = computed(() => {
|
|
|
317
362
|
<div :class="$style.actions">
|
|
318
363
|
<!-- Copy button (only show when there's a password) -->
|
|
319
364
|
<button
|
|
320
|
-
v-if="
|
|
365
|
+
v-if="showCopyUI"
|
|
321
366
|
type="button"
|
|
322
367
|
:class="$style.icon_button"
|
|
323
368
|
@click="copyToClipboard"
|
|
@@ -343,7 +388,7 @@ const getPlaceholder = computed(() => {
|
|
|
343
388
|
|
|
344
389
|
<!-- Password strength indicator -->
|
|
345
390
|
<div
|
|
346
|
-
v-if="
|
|
391
|
+
v-if="showStrengthUI && internalValue"
|
|
347
392
|
:class="$style.strength_container"
|
|
348
393
|
>
|
|
349
394
|
<div :class="$style.strength_bar">
|
|
@@ -366,7 +411,7 @@ const getPlaceholder = computed(() => {
|
|
|
366
411
|
<!-- Requirements list -->
|
|
367
412
|
<transition name="slide-fade">
|
|
368
413
|
<div
|
|
369
|
-
v-if="
|
|
414
|
+
v-if="showRequirementsUI && (isFocused || !isValid) && internalValue"
|
|
370
415
|
:class="$style.requirements"
|
|
371
416
|
>
|
|
372
417
|
<div
|
|
@@ -394,6 +439,15 @@ const getPlaceholder = computed(() => {
|
|
|
394
439
|
</div>
|
|
395
440
|
</div>
|
|
396
441
|
</transition>
|
|
442
|
+
|
|
443
|
+
<transition name="slide-fade">
|
|
444
|
+
<p
|
|
445
|
+
v-if="!isValid && isFocused && customValidationMessage"
|
|
446
|
+
:class="[$style.error_message, 'footnote']"
|
|
447
|
+
>
|
|
448
|
+
{{ customValidationMessage }}
|
|
449
|
+
</p>
|
|
450
|
+
</transition>
|
|
397
451
|
</div>
|
|
398
452
|
</template>
|
|
399
453
|
|
|
@@ -637,6 +691,10 @@ const getPlaceholder = computed(() => {
|
|
|
637
691
|
color: var(--input-disabled-placeholder);
|
|
638
692
|
}
|
|
639
693
|
|
|
694
|
+
.error_message {
|
|
695
|
+
color: var(--error);
|
|
696
|
+
}
|
|
697
|
+
|
|
640
698
|
/* Responsive */
|
|
641
699
|
@media (max-width: 480px) {
|
|
642
700
|
.input_container input {
|