@codebit-programando-solucoes/codebit-web-antd 1.1.26 → 1.1.30

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.
@@ -8,14 +8,57 @@ import { FC } from 'react';
8
8
  *
9
9
  * **Color tokens:**
10
10
  *
11
- * - --antd-color-bg-container (Background for containers)
12
- * - --antd-color-bg-elevated (Background for elevated surfaces)
13
- * - --antd-color-bg-layout (Background for layout)
14
- * - --antd-color-border (Border color)
11
+ * - --antd-color-bg-base (Base background color - page background)
12
+ * - --antd-color-bg-container (Background for containers like cards and panels)
13
+ * - --antd-color-bg-elevated (Background for elevated surfaces like modals)
14
+ * - --antd-color-bg-layout (Background for layout components)
15
+ * - --antd-color-bg-mask (Overlay mask background)
16
+ * - --antd-color-bg-spotlight (Spotlight background for focus rings)
17
+ * - --antd-color-border (Base border color)
18
+ * - --antd-color-border-secondary (Secondary border color)
19
+ * - --antd-color-border-hover (Border color on hover state)
20
+ * - --antd-color-border-disabled (Disabled border color)
15
21
  * - --antd-color-primary (Primary brand color)
22
+ * - --antd-color-success (Success state color)
23
+ * - --antd-color-success-bg (Success background color)
24
+ * - --antd-color-success-border (Success border color)
25
+ * - --antd-color-success-text (Success text color)
26
+ * - --antd-color-error (Error state color)
27
+ * - --antd-color-error-bg (Error background color)
28
+ * - --antd-color-error-border (Error border color)
29
+ * - --antd-color-error-text (Error text color)
30
+ * - --antd-color-warning (Warning state color)
31
+ * - --antd-color-warning-bg (Warning background color)
32
+ * - --antd-color-warning-border (Warning border color)
33
+ * - --antd-color-warning-text (Warning text color)
34
+ * - --antd-color-info (Informational state color)
35
+ * - --antd-color-info-bg (Info background color)
36
+ * - --antd-color-info-border (Info border color)
37
+ * - --antd-color-info-text (Info text color)
16
38
  * - --antd-color-text (Main text color)
17
39
  * - --antd-color-text-secondary (Secondary text color)
40
+ * - --antd-color-text-tertiary (Tertiary text color)
41
+ * - --antd-color-text-quaternary (Quaternary text color)
42
+ * - --antd-color-text-disabled (Disabled text color)
18
43
  * - --antd-color-split (Split/divider color)
44
+ * - --antd-color-link (Link color)
45
+ * - --antd-color-link-hover (Link hover color)
46
+ * - --antd-color-link-active (Link active color)
47
+ * - --antd-color-fill (General fill color for interactions)
48
+ * - --antd-color-fill-secondary (Secondary fill color for subtle backgrounds)
49
+ * - --antd-color-fill-tertiary (Tertiary fill color for very subtle backgrounds)
50
+ * - --antd-color-fill-quaternary (Quaternary fill color for minimal backgrounds)
51
+ * - --antd-color-fill-content (Content fill color)
52
+ * - --antd-color-fill-content-hover (Content fill hover state)
53
+ * - --antd-color-fill-content-selected (Content fill selected state)
54
+ * - --antd-color-fill-alter (Alternate fill color for alternating rows)
55
+ * - --antd-color-fill-alter-hover (Alternate fill hover state)
56
+ * - --antd-color-fill-alter-active (Alternate fill active state)
57
+ * - --antd-color-fill-alter-selected (Alternate fill selected state)
58
+ * - --antd-color-fill-alter-disabled (Alternate fill disabled state)
59
+ * - --antd-color-fill-disabled (General fill disabled state)
60
+ * - --antd-color-white (Pure white)
61
+ * - --antd-color-black (Pure black)
19
62
  *
20
63
  * **Margin tokens:**
21
64
  *
@@ -40,18 +83,18 @@ import { FC } from 'react';
40
83
  *
41
84
  * **Font size tokens:**
42
85
  *
43
- * - --antd-font-size-xxs: 8px (Micro text, accessibility disclaimers, disabled elements)
44
- * - --antd-font-size-xs: 10px (Extra small text, fine print, legal disclaimers)
86
+ * - --antd-font-size-xxs: 8px (Micro text, accessibility disclaimers)
87
+ * - --antd-font-size-xs: 10px (Extra small text, fine print)
45
88
  * - --antd-font-size-sm: 12px (Small text, captions, labels)
46
89
  * - --antd-font-size: 14px (Base font size, body text)
47
90
  * - --antd-font-size-lg: 16px (Large text, emphasis)
48
91
  * - --antd-font-size-xl: 20px (Extra large text, subheadings)
49
- * - --antd-font-size-xxl: 24px (Largest base text size for prominent content)
50
- * - --antd-font-size-heading1: 38px (Primary heading - main page titles)
51
- * - --antd-font-size-heading2: 30px (Secondary heading - section titles)
52
- * - --antd-font-size-heading3: 24px (Tertiary heading - subsections)
53
- * - --antd-font-size-heading4: 20px (Quaternary heading - component titles)
54
- * - --antd-font-size-heading5: 16px (Quinary heading - labels and captions)
92
+ * - --antd-font-size-xxl: 24px (Largest base text size)
93
+ * - --antd-font-size-heading1: 38px (Primary heading)
94
+ * - --antd-font-size-heading2: 30px (Secondary heading)
95
+ * - --antd-font-size-heading3: 24px (Tertiary heading)
96
+ * - --antd-font-size-heading4: 20px (Quaternary heading)
97
+ * - --antd-font-size-heading5: 16px (Quinary heading)
55
98
  *
56
99
  * **Line height tokens:**
57
100
  *
@@ -72,7 +115,6 @@ import { FC } from 'react';
72
115
  *
73
116
  * @example
74
117
  * ```tsx
75
- *
76
118
  * // Place this component at the root level of your app
77
119
  * function App() {
78
120
  * return (
@@ -86,13 +128,14 @@ import { FC } from 'react';
86
128
  *
87
129
  * @example
88
130
  * ```css
131
+ * // Use the exposed CSS variables
132
+ * .table-row:nth-child(odd) {
133
+ * background-color: var(--antd-color-fill-alter);
134
+ * }
89
135
  *
90
- * // Use the exposed CSS variables in your stylesheets
91
- * .my-component {
136
+ * .card {
137
+ * border: 1px solid var(--antd-color-border);
92
138
  * background-color: var(--antd-color-bg-container);
93
- * padding: var(--antd-padding-md);
94
- * color: var(--antd-color-text);
95
- * font-size: var(--antd-font-size);
96
139
  * }
97
140
  * ```;
98
141
  */
package/dist/index.cjs CHANGED
@@ -801,14 +801,57 @@ var __webpack_exports__ = {};
801
801
  const { token } = external_antd_namespaceObject.theme.useToken();
802
802
  (0, external_react_.useLayoutEffect)(()=>{
803
803
  const root = document.documentElement;
804
+ root.style.setProperty('--antd-color-bg-base', token['colorBgBase']);
804
805
  root.style.setProperty('--antd-color-bg-container', token['colorBgContainer']);
805
806
  root.style.setProperty('--antd-color-bg-elevated', token['colorBgElevated']);
806
807
  root.style.setProperty('--antd-color-bg-layout', token['colorBgLayout']);
807
- root.style.setProperty('--antd-color-border', token['colorBorder']);
808
+ root.style.setProperty('--antd-color-bg-mask', token['colorBgMask']);
809
+ root.style.setProperty('--antd-color-bg-spotlight', token['colorBgSpotlight']);
808
810
  root.style.setProperty('--antd-color-primary', token['colorPrimary']);
811
+ root.style.setProperty('--antd-color-success', token['colorSuccess']);
812
+ root.style.setProperty('--antd-color-success-bg', token['colorSuccessBg']);
813
+ root.style.setProperty('--antd-color-success-border', token['colorSuccessBorder']);
814
+ root.style.setProperty('--antd-color-success-text', token['colorSuccessText']);
815
+ root.style.setProperty('--antd-color-warning', token['colorWarning']);
816
+ root.style.setProperty('--antd-color-warning-bg', token['colorWarningBg']);
817
+ root.style.setProperty('--antd-color-warning-border', token['colorWarningBorder']);
818
+ root.style.setProperty('--antd-color-warning-text', token['colorWarningText']);
819
+ root.style.setProperty('--antd-color-error', token['colorError']);
820
+ root.style.setProperty('--antd-color-error-bg', token['colorErrorBg']);
821
+ root.style.setProperty('--antd-color-error-border', token['colorErrorBorder']);
822
+ root.style.setProperty('--antd-color-error-text', token['colorErrorText']);
823
+ root.style.setProperty('--antd-color-info', token['colorInfo']);
824
+ root.style.setProperty('--antd-color-info-bg', token['colorInfoBg']);
825
+ root.style.setProperty('--antd-color-info-border', token['colorInfoBorder']);
826
+ root.style.setProperty('--antd-color-info-text', token['colorInfoText']);
809
827
  root.style.setProperty('--antd-color-text', token['colorText']);
810
828
  root.style.setProperty('--antd-color-text-secondary', token['colorTextSecondary']);
829
+ root.style.setProperty('--antd-color-text-tertiary', token['colorTextTertiary']);
830
+ root.style.setProperty('--antd-color-text-quaternary', token['colorTextQuaternary']);
831
+ root.style.setProperty('--antd-color-text-disabled', token['colorTextDisabled']);
832
+ root.style.setProperty('--antd-color-border', token['colorBorder']);
833
+ root.style.setProperty('--antd-color-border-secondary', token['colorBorderSecondary']);
834
+ root.style.setProperty('--antd-color-border-hover', token['colorBorderHover']);
835
+ root.style.setProperty('--antd-color-border-secondary-hover', token['colorBorderSecondaryHover']);
836
+ root.style.setProperty('--antd-color-border-disabled', token['colorBorderDisabled']);
811
837
  root.style.setProperty('--antd-color-split', token['colorSplit']);
838
+ root.style.setProperty('--antd-color-link', token['colorLink']);
839
+ root.style.setProperty('--antd-color-link-hover', token['colorLinkHover']);
840
+ root.style.setProperty('--antd-color-link-active', token['colorLinkActive']);
841
+ root.style.setProperty('--antd-color-fill', token['colorFill']);
842
+ root.style.setProperty('--antd-color-fill-secondary', token['colorFillSecondary']);
843
+ root.style.setProperty('--antd-color-fill-tertiary', token['colorFillTertiary']);
844
+ root.style.setProperty('--antd-color-fill-quaternary', token['colorFillQuaternary']);
845
+ root.style.setProperty('--antd-color-fill-content', token['colorFillContent']);
846
+ root.style.setProperty('--antd-color-fill-content-hover', token['colorFillContentHover']);
847
+ root.style.setProperty('--antd-color-fill-content-selected', token['colorFillContentSelected']);
848
+ root.style.setProperty('--antd-color-fill-alter', token['colorFillAlter']);
849
+ root.style.setProperty('--antd-color-fill-alter-hover', token['colorFillAlterHover']);
850
+ root.style.setProperty('--antd-color-fill-alter-active', token['colorFillAlterActive']);
851
+ root.style.setProperty('--antd-color-fill-alter-selected', token['colorFillAlterSelected']);
852
+ root.style.setProperty('--antd-color-fill-alter-disabled', token['colorFillAlterDisabled']);
853
+ root.style.setProperty('--antd-color-white', token['colorWhite']);
854
+ root.style.setProperty('--antd-color-black', token['colorBlack']);
812
855
  root.style.setProperty('--antd-margin-xxs', `${token['marginXXS']}px`);
813
856
  root.style.setProperty('--antd-margin-xs', `${token['marginXS']}px`);
814
857
  root.style.setProperty('--antd-margin-sm', `${token['marginSM']}px`);
@@ -1647,7 +1690,7 @@ var __webpack_exports__ = {};
1647
1690
  RECAPTCHA_VALIDATION_FAIL: 'RECAPTCHA_VALIDATION_FAIL',
1648
1691
  SUCCESS: 'SUCCESS'
1649
1692
  });
1650
- const ForgotPassword = ({ navigateToLogin, submitRecoveryPassword })=>{
1693
+ const ForgotPassword = ({ navigateToLogin, submitRecoveryPassword, title })=>{
1651
1694
  const [form] = external_antd_namespaceObject.Form.useForm();
1652
1695
  const { modal } = external_antd_namespaceObject.App.useApp();
1653
1696
  const [loading, setLoading] = (0, external_react_.useState)(false);
@@ -1667,7 +1710,7 @@ var __webpack_exports__ = {};
1667
1710
  switch(result){
1668
1711
  case LocalLoginRecoveryPasswordResult.SUCCESS:
1669
1712
  modal.success({
1670
- title: t('ForgotPassword.title'),
1713
+ title: title || t('ForgotPassword.title'),
1671
1714
  content: t('ForgotPassword.resetSuccessMessage'),
1672
1715
  onOk: handleNavigateToLogin,
1673
1716
  okText: t('Common.ok')
@@ -1685,7 +1728,7 @@ var __webpack_exports__ = {};
1685
1728
  break;
1686
1729
  case LocalLoginRecoveryPasswordResult.RECAPTCHA_VALIDATION_FAIL:
1687
1730
  modal.error({
1688
- title: t('ForgotPassword.title'),
1731
+ title: title || t('ForgotPassword.title'),
1689
1732
  content: t('Common.recaptchaFailed'),
1690
1733
  okText: t('Common.ok')
1691
1734
  });
@@ -1695,7 +1738,7 @@ var __webpack_exports__ = {};
1695
1738
  ForgotPassword_logger.error(error);
1696
1739
  react_namespaceObject.captureException(error);
1697
1740
  modal.error({
1698
- title: t('ForgotPassword.title'),
1741
+ title: title || t('ForgotPassword.title'),
1699
1742
  content: t('Common.genericError'),
1700
1743
  okText: t('Common.ok')
1701
1744
  });
@@ -1704,7 +1747,7 @@ var __webpack_exports__ = {};
1704
1747
  }
1705
1748
  };
1706
1749
  return /*#__PURE__*/ (0, jsx_runtime.jsx)(LoginContainer, {
1707
- title: t('ForgotPassword.title'),
1750
+ title: title || t('ForgotPassword.title'),
1708
1751
  children: /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Form, {
1709
1752
  form: form,
1710
1753
  name: 'forgot-password-form',
@@ -1766,6 +1809,7 @@ var __webpack_exports__ = {};
1766
1809
  });
1767
1810
  };
1768
1811
  ForgotPassword.propTypes = {
1812
+ title: external_prop_types_default().string,
1769
1813
  navigateToLogin: external_prop_types_default().func,
1770
1814
  submitRecoveryPassword: external_prop_types_default().func.isRequired
1771
1815
  };
@@ -1774,7 +1818,7 @@ var __webpack_exports__ = {};
1774
1818
  INVALID_TOKEN: 'INVALID_TOKEN',
1775
1819
  SUCCESS: 'SUCCESS'
1776
1820
  });
1777
- const ChangePassword = ({ navigateToLogin, checkToken, submitChangePassword })=>{
1821
+ const ChangePassword = ({ navigateToLogin, checkToken, submitChangePassword, title })=>{
1778
1822
  const navigate = (0, external_react_router_namespaceObject.useNavigate)();
1779
1823
  const [form] = external_antd_namespaceObject.Form.useForm();
1780
1824
  const { modal } = external_antd_namespaceObject.App.useApp();
@@ -1782,10 +1826,8 @@ var __webpack_exports__ = {};
1782
1826
  const [checkingToken, setCheckingToken] = (0, external_react_.useState)(true);
1783
1827
  const { t } = useCodebitWebAntdTranslation();
1784
1828
  t('');
1785
- const params = (0, external_react_router_namespaceObject.useParams)();
1786
1829
  const context = {
1787
- navigate,
1788
- params
1830
+ navigate
1789
1831
  };
1790
1832
  const handleChangePassword = async (values)=>{
1791
1833
  try {
@@ -1794,7 +1836,7 @@ var __webpack_exports__ = {};
1794
1836
  switch(result){
1795
1837
  case LocalLoginChangePasswordResult.SUCCESS:
1796
1838
  modal.success({
1797
- title: t('ForgotPassword.title'),
1839
+ title: title || t('ChangePassword.title'),
1798
1840
  content: t('ChangePassword.passwordChangedSuccess'),
1799
1841
  onOk: handleNavigateToLogin,
1800
1842
  okText: t('Common.close')
@@ -1802,7 +1844,7 @@ var __webpack_exports__ = {};
1802
1844
  break;
1803
1845
  case LocalLoginChangePasswordResult.INVALID_TOKEN:
1804
1846
  modal.error({
1805
- title: t('ForgotPassword.title'),
1847
+ title: title || t('ChangePassword.title'),
1806
1848
  content: t('ChangePassword.tokenInvalidRecovery'),
1807
1849
  onOk: handleNavigateToLogin,
1808
1850
  okText: t('Common.close')
@@ -1813,7 +1855,7 @@ var __webpack_exports__ = {};
1813
1855
  ChangePassword_logger.error(error);
1814
1856
  react_namespaceObject.captureException(error);
1815
1857
  modal.error({
1816
- title: t('ForgotPassword.title'),
1858
+ title: title || t('ChangePassword.title'),
1817
1859
  content: t('Common.genericError'),
1818
1860
  okText: t('Common.ok')
1819
1861
  });
@@ -1843,7 +1885,7 @@ var __webpack_exports__ = {};
1843
1885
  ChangePassword_logger.error(error);
1844
1886
  react_namespaceObject.captureException(error);
1845
1887
  modal.error({
1846
- title: t('ChangePassword.title'),
1888
+ title: title || t('ChangePassword.title'),
1847
1889
  content: t('Common.genericError'),
1848
1890
  okText: t('Common.ok')
1849
1891
  });
@@ -1856,7 +1898,7 @@ var __webpack_exports__ = {};
1856
1898
  handleCheckToken().then();
1857
1899
  }, []);
1858
1900
  return /*#__PURE__*/ (0, jsx_runtime.jsx)(LoginContainer, {
1859
- title: t('ChangePassword.title'),
1901
+ title: title || t('ChangePassword.title'),
1860
1902
  children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Spin, {
1861
1903
  spinning: checkingToken,
1862
1904
  children: /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Form, {
@@ -1964,7 +2006,8 @@ var __webpack_exports__ = {};
1964
2006
  ChangePassword.propTypes = {
1965
2007
  navigateToLogin: external_prop_types_default().func.isRequired,
1966
2008
  checkToken: external_prop_types_default().func.isRequired,
1967
- submitChangePassword: external_prop_types_default().func.isRequired
2009
+ submitChangePassword: external_prop_types_default().func.isRequired,
2010
+ title: external_prop_types_default().string
1968
2011
  };
1969
2012
  const useErrorModal_logger = new codebit_web_namespaceObject.Logger('useErrorModal');
1970
2013
  function useErrorModal() {
@@ -1,4 +1,5 @@
1
1
  import React = require('react');
2
+ import { LocalLoginConfContext } from './Login';
2
3
 
3
4
  /**
4
5
  * Possible results for password change operations.
@@ -7,27 +8,19 @@ import React = require('react');
7
8
  * Represents the outcome of a password change attempt.
8
9
  */
9
10
  export enum LocalLoginChangePasswordResult {
11
+ /** The provided token is invalid or has expired. */
10
12
  INVALID_TOKEN = 'INVALID_TOKEN',
13
+ /** The password was changed successfully. */
11
14
  SUCCESS = 'SUCCESS',
12
15
  }
13
16
 
14
- /**
15
- * Context interface for login flow navigation and parameters.
16
- *
17
- * @property navigate - Function to redirect to different routes
18
- * @property params - URL parameters from React Router
19
- */
20
- export interface LocalLoginConfContext {
21
- navigate: (to: string) => void;
22
- params: Record<string, string | undefined>;
23
- }
24
-
25
17
  /**
26
18
  * Props for the ChangePassword component.
27
19
  *
28
- * @property navigateToLogin - Callback to redirect to login screen
29
- * @property checkToken - Validates the password reset token
30
- * @property submitChangePassword - Submits new password with token validation
20
+ * @property navigateToLogin - Callback that redirects the user to the login screen.
21
+ * @property checkToken - Function that validates the password‑reset token.
22
+ * @property submitChangePassword - Function that submits the new password together with token validation.
23
+ * @property title - Optional custom title for the page.
31
24
  */
32
25
  export interface ChangePasswordProps {
33
26
  navigateToLogin: (context: LocalLoginConfContext) => Promise<void>;
@@ -36,12 +29,13 @@ export interface ChangePasswordProps {
36
29
  password: string,
37
30
  context: LocalLoginConfContext,
38
31
  ) => Promise<LocalLoginChangePasswordResult>;
32
+ title?: string;
39
33
  }
40
34
 
41
35
  /**
42
36
  * Password change interface component.
43
37
  *
44
38
  * @remarks
45
- * Handles user password reset with token validation and form submission. Requires implementation of all callback functions for authentication flow.
39
+ * Handles user password reset with token validation and form submission. All callback functions must be provided to integrate with the authentication flow.
46
40
  */
47
41
  export declare const ChangePassword: React.FC<ChangePasswordProps>;
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { LocalLoginConfContext } from './Login';
2
3
 
3
4
  /** Enumeration of possible statuses for password recovery operations. */
4
5
  export declare enum LocalLoginRecoveryPasswordResult {
@@ -7,17 +8,6 @@ export declare enum LocalLoginRecoveryPasswordResult {
7
8
  SUCCESS = 'SUCCESS',
8
9
  }
9
10
 
10
- /** Context object used for navigation within authentication flows. Contains navigation functions to redirect between authentication screens. */
11
- export interface LocalLoginConfContext {
12
- /**
13
- * Redirects to the specified route path.
14
- *
15
- * @param path - Target navigation path
16
- * @param ...args - Additional navigation parameters
17
- */
18
- navigate: (path: string, ...args: any[]) => void;
19
- }
20
-
21
11
  /** Properties for the ForgotPassword component. */
22
12
  export interface ForgotPasswordProps {
23
13
  /**
@@ -2,3 +2,4 @@ export * from './Login';
2
2
  export * from './LoginContainer';
3
3
  export * from './HandleError';
4
4
  export * from './ForgotPassword';
5
+ export * from './ChangePassword';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebit-programando-solucoes/codebit-web-antd",
3
- "version": "1.1.26",
3
+ "version": "1.1.30",
4
4
  "main": "./dist/index.cjs",
5
5
  "type": "module",
6
6
  "types": "./src/index.d.ts",