ingeniuscliq-core 0.5.12 → 0.5.14

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.
@@ -0,0 +1,19 @@
1
+ import { InputExtendedProps } from '../../ui/input';
2
+ import { BaseStyleProps } from '../../../types/ui/main';
3
+ import { Control, FieldValues, Path } from 'react-hook-form';
4
+ interface FormPasswordProps<T extends FieldValues = FieldValues> extends BaseStyleProps {
5
+ readonly control: Control<T>;
6
+ readonly name: Path<T>;
7
+ readonly label?: string;
8
+ readonly customLabel?: React.ReactNode;
9
+ readonly placeholder?: string;
10
+ readonly inputProps?: React.ComponentProps<"input"> & InputExtendedProps;
11
+ readonly withinLabel?: boolean;
12
+ readonly withinMessage?: boolean;
13
+ readonly withinControl?: boolean;
14
+ readonly required?: boolean;
15
+ readonly withoutPlaceholder?: boolean;
16
+ }
17
+ export declare function FormPassword<T extends FieldValues = FieldValues>({ control, name, label, customLabel, placeholder, className, inputProps, withinLabel, withinMessage, withinControl, required, withoutPlaceholder }: FormPasswordProps<T>): import("react").JSX.Element;
18
+ export {};
19
+ //# sourceMappingURL=FormPassword.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormPassword.d.ts","sourceRoot":"","sources":["../../../../src/components/common/form/FormPassword.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGlE,UAAU,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,CAAE,SAAQ,cAAc;IACrF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC;IACzE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CACvC;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,EAChE,OAAO,EACP,IAAI,EACJ,KAAiB,EACjB,WAAuB,EACvB,WAAgB,EAChB,SAAc,EACd,UAAe,EACf,WAAmB,EACnB,aAAqB,EACrB,aAAqB,EACrB,QAAgB,EAChB,kBAA0B,EAC3B,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BAkDtB"}
@@ -0,0 +1,74 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { CustomFormField } from './CustomFormField.js';
3
+ import { Input } from '../../ui/input.js';
4
+ import { useLanguage } from '../../../hooks/useLanguage.js';
5
+ import { useState, useCallback } from 'react';
6
+ import { EyeOff, Eye } from 'lucide-react';
7
+
8
+ function FormPassword({
9
+ control,
10
+ name,
11
+ label = void 0,
12
+ customLabel = void 0,
13
+ placeholder = "",
14
+ className = "",
15
+ inputProps = {},
16
+ withinLabel = false,
17
+ withinMessage = false,
18
+ withinControl = false,
19
+ required = false,
20
+ withoutPlaceholder = false
21
+ }) {
22
+ const { t } = useLanguage();
23
+ const [showPassword, setShowPassword] = useState(false);
24
+ const getPlaceholder = useCallback(() => {
25
+ if (withoutPlaceholder) return "";
26
+ if (placeholder) return required ? placeholder : `${placeholder} ${t("fields.optional")}`;
27
+ if (name) return required ? t(`fields.${name}`) : `${t("fields." + name)} ${t("fields.fieldLabel.optional")}`;
28
+ return "";
29
+ }, [withoutPlaceholder, placeholder, name, required]);
30
+ const getLabel = useCallback(() => {
31
+ if (withinLabel) return "";
32
+ if (label) return required ? `${label} *` : label;
33
+ if (name) return t(`fields.${name}`);
34
+ return "";
35
+ }, [label, withinLabel, required, name, t]);
36
+ return /* @__PURE__ */ jsx(
37
+ CustomFormField,
38
+ {
39
+ control,
40
+ className,
41
+ name,
42
+ label: getLabel(),
43
+ customLabel,
44
+ withinLabel,
45
+ withinMessage,
46
+ withinControl,
47
+ render: (field) => /* @__PURE__ */ jsxs("div", { className: "relative", children: [
48
+ /* @__PURE__ */ jsx(
49
+ Input,
50
+ {
51
+ placeholder: getPlaceholder(),
52
+ type: showPassword ? "text" : "password",
53
+ required,
54
+ ...field,
55
+ ...inputProps,
56
+ className: inputProps?.className
57
+ }
58
+ ),
59
+ /* @__PURE__ */ jsx(
60
+ "button",
61
+ {
62
+ type: "button",
63
+ onClick: () => setShowPassword(!showPassword),
64
+ className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700 focus:outline-none",
65
+ tabIndex: -1,
66
+ children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { size: 20 }) : /* @__PURE__ */ jsx(Eye, { size: 20 })
67
+ }
68
+ )
69
+ ] })
70
+ }
71
+ );
72
+ }
73
+
74
+ export { FormPassword };
@@ -1,4 +1,5 @@
1
1
  export * from './FormInput';
2
+ export * from './FormPassword';
2
3
  export * from './FormTextArea';
3
4
  export * from './FormSelect';
4
5
  export * from './FormCheckbox';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/common/form/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/common/form/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC"}
@@ -7,13 +7,13 @@ import '../ui/input.js';
7
7
  import 'react-i18next';
8
8
  import '../../i18n/config.js';
9
9
  import 'react';
10
+ import 'lucide-react';
10
11
  import '../ui/textarea.js';
11
12
  import '../ui/select.js';
12
13
  import '../ui/checkbox.js';
13
14
  import '@tanstack/react-router';
14
15
  import '../ui/pagination.js';
15
16
  /* empty css */
16
- import 'lucide-react';
17
17
  import { Toaster } from '../common/toast/Toaster.js';
18
18
  import { CoreBaseLayout } from '../layouts/CoreBaseLayout.js';
19
19
 
@@ -7,13 +7,13 @@ import '../ui/input.js';
7
7
  import 'react-i18next';
8
8
  import '../../i18n/config.js';
9
9
  import 'react';
10
+ import 'lucide-react';
10
11
  import '../ui/textarea.js';
11
12
  import '../ui/select.js';
12
13
  import '../ui/checkbox.js';
13
14
  import '@tanstack/react-router';
14
15
  import '../ui/pagination.js';
15
16
  /* empty css */
16
- import 'lucide-react';
17
17
  import { Toaster } from '../common/toast/Toaster.js';
18
18
  import { CoreBaseLayout } from '../layouts/CoreBaseLayout.js';
19
19
 
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ export { CorePreviewLayout } from './components/templates/CorePreviewLayout.js';
33
33
  export { CustomCarousel } from './components/common/carousel/CustomCarousel.js';
34
34
  export { CustomCarouselSection } from './components/common/carousel/CustomCarouselSection.js';
35
35
  export { FormInput } from './components/common/form/FormInput.js';
36
+ export { FormPassword } from './components/common/form/FormPassword.js';
36
37
  export { FormTextArea } from './components/common/form/FormTextArea.js';
37
38
  export { FormSelect } from './components/common/form/FormSelect.js';
38
39
  export { FormCheckbox } from './components/common/form/FormCheckbox.js';
@@ -1,4 +1,6 @@
1
+ const cash = "Cash";
1
2
  const enTranslations = {
3
+ cash,
2
4
  };
3
5
 
4
- export { enTranslations as default };
6
+ export { cash, enTranslations as default };
@@ -1,4 +1,6 @@
1
+ const cash = "Efectivo";
1
2
  const esTranslations = {
3
+ cash,
2
4
  };
3
5
 
4
- export { esTranslations as default };
6
+ export { cash, esTranslations as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ingeniuscliq-core",
3
- "version": "0.5.12",
3
+ "version": "0.5.14",
4
4
  "description": "IngeniusCliq Core UI y lógica compartida",
5
5
  "license": "MIT",
6
6
  "type": "module",