@cobre-npm/ds-v3 0.144.3 → 0.145.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.
@@ -13,6 +13,7 @@ interface Props {
13
13
  labelSecondary?: string;
14
14
  isLoadingBtnPrimary?: boolean;
15
15
  isDisabledBtnPrimary?: boolean;
16
+ isDisabledBtnSecondary?: boolean;
16
17
  themeBtnPrimary?: ButtonThemes;
17
18
  icon?: IconTypeV3;
18
19
  hasCloseButton?: boolean;
@@ -34,6 +35,7 @@ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {},
34
35
  }>, {
35
36
  hasCloseButton: boolean;
36
37
  isDisabledBtnPrimary: boolean;
38
+ isDisabledBtnSecondary: boolean;
37
39
  themeBtnPrimary: ButtonThemes;
38
40
  showActionsBorder: boolean;
39
41
  subtitleAlignment: "center" | "start" | "end";
@@ -1,19 +1,27 @@
1
1
  /**
2
2
  * CobreFormOtp — a 6-digit OTP entry form built on top of CobreFlowResult.
3
- * Use to collect a one-time code; emits `onComplete` when all 6 digits are filled,
4
- * `submit` with the value on confirm, and `cancel` on the secondary button. Exposes
5
- * `clearInput()` to reset the fields. Provides a `bottom` slot below the OTP inputs.
3
+ * Use to collect a one-time code from users; emits `onComplete` when all 6 digits are filled,
4
+ * `submit` when the primary button is clicked, and `cancel` on the secondary button.
5
+ * Supports dynamic button labels and a `bottom` slot for adding custom UI (e.g., resend/countdown).
6
+ * Exposes `clearInput()` to reset the fields and `otpInput` ref for advanced usage.
7
+ *
8
+ * Button labels are fully customizable and reactive — change the props at any time to update the UI.
9
+ * Each button can also be disabled independently via `isDisabledSubmitButton` / `isDisabledCancelButton`
10
+ * (e.g., disabling "Reenviar código" while a resend cooldown is running).
11
+ * For resend/countdown flows, use the `bottom` slot to add custom buttons and logic below the OTP inputs.
6
12
  */
7
13
  interface Props {
8
14
  title: string;
9
15
  description: string;
10
- textCancelButton: string;
11
16
  textSubmitButton: string;
17
+ textCancelButton: string;
12
18
  errorMsg: string;
13
19
  isLoading?: boolean;
14
20
  hideIcon?: boolean;
15
21
  isInvalidOtp?: boolean;
16
22
  showActionsBorder?: boolean;
23
+ isDisabledSubmitButton?: boolean;
24
+ isDisabledCancelButton?: boolean;
17
25
  }
18
26
  declare var __VLS_20: {};
19
27
  type __VLS_Slots = {} & {
@@ -22,17 +30,19 @@ type __VLS_Slots = {} & {
22
30
  declare const __VLS_component: import("vue").DefineComponent<Props, {
23
31
  clearInput: () => void | undefined;
24
32
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
- cancel: (...args: any[]) => void;
26
- submit: (...args: any[]) => void;
27
- onComplete: (...args: any[]) => void;
33
+ cancel: () => any;
34
+ submit: (value: string) => any;
35
+ onComplete: (value: string) => any;
28
36
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
29
- onCancel?: ((...args: any[]) => any) | undefined;
30
- onSubmit?: ((...args: any[]) => any) | undefined;
31
- onOnComplete?: ((...args: any[]) => any) | undefined;
37
+ onCancel?: (() => any) | undefined;
38
+ onSubmit?: ((value: string) => any) | undefined;
39
+ onOnComplete?: ((value: string) => any) | undefined;
32
40
  }>, {
33
41
  isLoading: boolean;
34
42
  hideIcon: boolean;
35
43
  isInvalidOtp: boolean;
44
+ isDisabledSubmitButton: boolean;
45
+ isDisabledCancelButton: boolean;
36
46
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
47
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
38
48
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobre-npm/ds-v3",
3
- "version": "0.144.3",
3
+ "version": "0.145.1",
4
4
  "type": "module",
5
5
  "packageManager": "pnpm@11.0.4",
6
6
  "engines": {
@@ -12,6 +12,7 @@
12
12
  "module": "./dist/cobre-ds-v3-lib.es.js",
13
13
  "types": "dist/types/index.d.ts",
14
14
  "scripts": {
15
+ "postinstall": "node scripts/install-test-browser.mjs",
15
16
  "dev": "vite",
16
17
  "get-types": "vue-tsc --declaration --emitDeclarationOnly",
17
18
  "build": "vite build && run-p get-types",
@@ -19,13 +20,16 @@
19
20
  "build:qa": "run-p build-only",
20
21
  "build:prod": "run-p build-only && run-p get-types && npm publish",
21
22
  "preview": "vite preview",
22
- "test:unit": "vitest --environment jsdom --root src/",
23
+ "test": "playwright install --with-deps chromium && vitest run --project=stories && vitest run --project=unit --coverage && node scripts/check-invariants.mjs",
24
+ "test:browsers": "playwright install --with-deps chromium",
25
+ "test:stories": "vitest run --project=stories",
26
+ "test:unit": "vitest run --project=unit --coverage",
27
+ "test:invariants": "node scripts/check-invariants.mjs",
23
28
  "build-only": "vite build",
24
29
  "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
25
30
  "storybook": "storybook dev -p 6006 --ci",
26
31
  "storybook-server": "storybook dev -p 8080",
27
- "build-storybook": "storybook build",
28
- "test": "test-storybook"
32
+ "build-storybook": "storybook build"
29
33
  },
30
34
  "dependencies": {
31
35
  "@formkit/drag-and-drop": "^0.6.1",
@@ -47,25 +51,30 @@
47
51
  "@storybook/addon-a11y": "10.1.11",
48
52
  "@storybook/addon-docs": "10.1.11",
49
53
  "@storybook/addon-links": "10.1.11",
50
- "@storybook/test-runner": "^0.24.2",
54
+ "@storybook/addon-vitest": "10.1.11",
51
55
  "@storybook/vue3": "10.1.11",
52
56
  "@storybook/vue3-vite": "10.1.11",
53
57
  "@types/bootstrap": "^5.2.10",
54
58
  "@types/vue-select": "^3.16.8",
55
59
  "@vitejs/plugin-vue": "^5.0.4",
60
+ "@vitest/browser": "^3.2.7",
61
+ "@vitest/coverage-v8": "^3.2.7",
56
62
  "@vue/eslint-config-prettier": "^9.0.0",
57
63
  "@vue/eslint-config-typescript": "^13.0.0",
58
64
  "@vue/tsconfig": "^0.5.1",
59
65
  "eslint": "^8.57.0",
60
66
  "eslint-plugin-storybook": "10.1.11",
61
67
  "eslint-plugin-vue": "^9.22.0",
68
+ "jsdom": "^30.0.1",
62
69
  "npm-run-all": "^4.1.5",
70
+ "playwright": "^1.63.0",
63
71
  "prettier": "^3.3.2",
64
72
  "standard": "^17.1.0",
65
73
  "storybook": "10.1.11",
66
74
  "typescript": "^5.2.2",
67
75
  "vite": "^5.2.0",
68
76
  "vite-plugin-static-copy": "^1.0.5",
77
+ "vitest": "^3.2.7",
69
78
  "vue-tsc": "^2.0.6"
70
79
  },
71
80
  "peerDependencies": {