@prosistemas/sca-web-kit 3.3.12 → 3.4.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.
@@ -1,8 +1,11 @@
1
1
  import { IconProps, IconWeight } from '@phosphor-icons/react';
2
+ import { HTMLAttributeAnchorTarget } from 'react';
2
3
  interface InfoHeaderProps {
3
4
  className?: string;
4
5
  tagLabel?: string;
5
6
  tagLabelClassName?: string;
7
+ tagLabelHref?: string;
8
+ tagLabelTarget?: HTMLAttributeAnchorTarget;
6
9
  tagLabelLeadingIcon?: React.ComponentType<IconProps>;
7
10
  tagLabelLeadingIconSize?: number;
8
11
  tagLabelLeadingIconColor?: string;
@@ -26,5 +29,5 @@ interface InfoHeaderProps {
26
29
  gap?: string;
27
30
  dark?: boolean;
28
31
  }
29
- export default function InfoHeader({ className, tagLabel, tagLabelClassName, tagLabelLeadingIcon, tagLabelLeadingIconSize, tagLabelLeadingIconColor, tagLabelLeadingIconWeight, tagLabelLeadingIconClassName, tagLabelTrailingIcon, tagLabelTrailingIconSize, tagLabelTrailingIconColor, tagLabelTrailingIconWeight, tagLabelTrailingIconClassName, title, titleClassName, titleH1, subtitle, subtitleClassName, buttonLabel, buttonClassName, buttonHref, buttonInternalHref, buttonTarget, gap, dark, }: InfoHeaderProps): import("react/jsx-runtime").JSX.Element;
32
+ export default function InfoHeader({ className, tagLabel, tagLabelClassName, tagLabelHref, tagLabelTarget, tagLabelLeadingIcon, tagLabelLeadingIconSize, tagLabelLeadingIconColor, tagLabelLeadingIconWeight, tagLabelLeadingIconClassName, tagLabelTrailingIcon, tagLabelTrailingIconSize, tagLabelTrailingIconColor, tagLabelTrailingIconWeight, tagLabelTrailingIconClassName, title, titleClassName, titleH1, subtitle, subtitleClassName, buttonLabel, buttonClassName, buttonHref, buttonInternalHref, buttonTarget, gap, dark, }: InfoHeaderProps): import("react/jsx-runtime").JSX.Element;
30
33
  export {};
@@ -4,11 +4,11 @@ import TagLabel from '../../ui/tag-label/tag-label';
4
4
  import Title from '../../ui/title/title';
5
5
  import Subtitle from '../../ui/subtitle/subtitle';
6
6
  import Button from '../../ui/button/button';
7
- export default function InfoHeader({ className, tagLabel, tagLabelClassName, tagLabelLeadingIcon, tagLabelLeadingIconSize, tagLabelLeadingIconColor, tagLabelLeadingIconWeight, tagLabelLeadingIconClassName, tagLabelTrailingIcon, tagLabelTrailingIconSize, tagLabelTrailingIconColor, tagLabelTrailingIconWeight, tagLabelTrailingIconClassName, title, titleClassName, titleH1 = false, subtitle, subtitleClassName, buttonLabel, buttonClassName, buttonHref, buttonInternalHref, buttonTarget, gap, dark, }) {
7
+ export default function InfoHeader({ className, tagLabel, tagLabelClassName, tagLabelHref, tagLabelTarget, tagLabelLeadingIcon, tagLabelLeadingIconSize, tagLabelLeadingIconColor, tagLabelLeadingIconWeight, tagLabelLeadingIconClassName, tagLabelTrailingIcon, tagLabelTrailingIconSize, tagLabelTrailingIconColor, tagLabelTrailingIconWeight, tagLabelTrailingIconClassName, title, titleClassName, titleH1 = false, subtitle, subtitleClassName, buttonLabel, buttonClassName, buttonHref, buttonInternalHref, buttonTarget, gap, dark, }) {
8
8
  return (_jsxs("div", { className: `${styles['info-header']} ${className}`, style: {
9
9
  gap: gap,
10
10
  }, children: [tagLabel &&
11
- _jsx(TagLabel, { className: `${tagLabelClassName} ${styles['tag-label']}`, label: tagLabel, dark: dark, leadingIcon: tagLabelLeadingIcon, leadingIconSize: tagLabelLeadingIconSize, leadingIconColor: tagLabelLeadingIconColor, leadingIconWeight: tagLabelLeadingIconWeight, leadingIconClassName: tagLabelLeadingIconClassName, trailingIcon: tagLabelTrailingIcon, trailingIconSize: tagLabelTrailingIconSize, trailingIconColor: tagLabelTrailingIconColor, trailingIconWeight: tagLabelTrailingIconWeight, trailingIconClassName: tagLabelTrailingIconClassName }), _jsx(Title, { className: `${titleClassName} ${styles['title']}`, h1: titleH1, text: title, dark: dark }), subtitle &&
11
+ _jsx(TagLabel, { className: `${tagLabelClassName} ${styles['tag-label']}`, label: tagLabel, dark: dark, href: tagLabelHref, target: tagLabelTarget, leadingIcon: tagLabelLeadingIcon, leadingIconSize: tagLabelLeadingIconSize, leadingIconColor: tagLabelLeadingIconColor, leadingIconWeight: tagLabelLeadingIconWeight, leadingIconClassName: tagLabelLeadingIconClassName, trailingIcon: tagLabelTrailingIcon, trailingIconSize: tagLabelTrailingIconSize, trailingIconColor: tagLabelTrailingIconColor, trailingIconWeight: tagLabelTrailingIconWeight, trailingIconClassName: tagLabelTrailingIconClassName }), _jsx(Title, { className: `${titleClassName} ${styles['title']}`, h1: titleH1, text: title, dark: dark }), subtitle &&
12
12
  _jsx(Subtitle, { className: `${subtitleClassName} ${styles['subtitle']}`, text: subtitle, dark: dark }), buttonLabel &&
13
13
  _jsx(Button, { className: `${buttonClassName} ${styles['button']}`, label: buttonLabel, href: buttonHref, internalHref: buttonInternalHref, target: buttonTarget })] }));
14
14
  }
@@ -1,7 +1,7 @@
1
1
  export default function NewsletterStrip({ buttonLabel, onButtonClick, onFormSubmit, buttonLoading, buttonDisabled, emailValue, onEmailChange, nameValue, onNameChange, }: {
2
2
  buttonLabel?: string;
3
3
  onButtonClick?: () => void;
4
- onFormSubmit?: (e: React.FormEvent<HTMLFormElement>) => void;
4
+ onFormSubmit?: React.SubmitEventHandler<HTMLFormElement>;
5
5
  buttonLoading?: boolean;
6
6
  buttonDisabled?: boolean;
7
7
  emailValue?: string;
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import styles from './newsletter-strip.module.scss';
3
4
  import scaGradientLogo from '@prosistemas/sca-web-kit/assets/logos/sca/s-blur.svg';
@@ -5,6 +6,7 @@ import newsletterIcon from '@prosistemas/sca-web-kit/assets/icons/newsletter.svg
5
6
  import InfoHeader from '../info-header/info-header';
6
7
  import Button from '../../ui/button/button';
7
8
  import Image from 'next/image';
9
+ import Input from '../../ui/input/input';
8
10
  export default function NewsletterStrip({ buttonLabel, onButtonClick, onFormSubmit, buttonLoading = false, buttonDisabled = false, emailValue, onEmailChange, nameValue, onNameChange, }) {
9
- return (_jsxs("div", { className: styles['newsletter-strip'], children: [_jsx(Image, { className: styles['icon'], src: newsletterIcon, width: 46, height: 46, alt: '' }), _jsx(InfoHeader, { className: styles['info-header'], titleClassName: styles['title'], subtitleClassName: styles['subtitle'], title: 'Os melhores conte\u00FAdos de tecnologia e fitness', subtitle: 'Assine e receba novidades toda semana em sua caixa de entrada.', dark: true }), _jsxs("form", { className: styles['input-wrapper'], onSubmit: onFormSubmit, children: [_jsx("input", { className: `${styles['name']} `, id: "name", type: "text", name: "text", placeholder: "Insira seu nome", value: nameValue, onChange: onNameChange, required: true }), _jsx("input", { className: `${styles['email']}`, id: "email", type: "email", name: "email", placeholder: "Insira seu e-mail", value: emailValue, onChange: onEmailChange, required: true }), _jsx(Button, { className: styles['button'], label: buttonLabel ?? "Assinar", onClick: onButtonClick, loading: buttonLoading, disabled: buttonDisabled, type: 'submit' }), _jsx("div", { className: styles['blue-hue'] })] }), _jsx("div", { className: styles['background-logo'], children: _jsx(Image, { className: styles['logo'], src: scaGradientLogo, fill: true, alt: '' }) })] }));
11
+ return (_jsxs("div", { className: styles['newsletter-strip'], children: [_jsx(Image, { className: styles['icon'], src: newsletterIcon, width: 46, height: 46, alt: '' }), _jsx(InfoHeader, { className: styles['info-header'], titleClassName: styles['title'], subtitleClassName: styles['subtitle'], title: 'Os melhores conte\u00FAdos de tecnologia e fitness', subtitle: 'Assine e receba novidades toda semana em sua caixa de entrada.', dark: true }), _jsxs("form", { className: styles['input-wrapper'], onSubmit: onFormSubmit, children: [_jsx(Input, { inputClassName: styles['name'], id: 'name', placeholder: 'Insira seu nome', onChange: onNameChange, required: true }), _jsx(Input, { inputClassName: styles['email'], id: 'email', placeholder: 'Insira seu e-mail', onChange: onEmailChange, required: true }), _jsx(Button, { className: styles['button'], label: buttonLabel ?? "Assinar", loading: buttonLoading, disabled: buttonDisabled, onClick: onButtonClick, type: 'submit' })] }), _jsx("div", { className: styles['background-logo'], children: _jsx(Image, { className: styles['logo'], src: scaGradientLogo, fill: true, alt: '' }) })] }));
10
12
  }
@@ -62,7 +62,6 @@
62
62
  height: 56px;
63
63
 
64
64
  background: white;
65
- border: none;
66
65
  outline: none;
67
66
 
68
67
  border-radius: 8px;
@@ -0,0 +1,16 @@
1
+ import { ChangeEventHandler, HTMLInputTypeAttribute } from 'react';
2
+ export default function Input({ id, label, placeholder, className, inputClassName, defaultValue, autoFocus, required, disabled, error, errorMsg, type, onChange, }: {
3
+ id?: string;
4
+ label?: string;
5
+ placeholder?: string;
6
+ className?: string;
7
+ inputClassName?: string;
8
+ defaultValue?: string;
9
+ autoFocus?: boolean;
10
+ required?: boolean;
11
+ disabled?: boolean;
12
+ error?: boolean;
13
+ errorMsg?: string;
14
+ type?: HTMLInputTypeAttribute;
15
+ onChange?: ChangeEventHandler<HTMLInputElement, HTMLInputElement>;
16
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styles from './input.module.scss';
3
+ import { EyeIcon, EyeSlashIcon } from '@phosphor-icons/react/dist/ssr';
4
+ import { useState } from 'react';
5
+ export default function Input({ id, label, placeholder, className, inputClassName, defaultValue, autoFocus, required, disabled, error, errorMsg, type = 'text', onChange, }) {
6
+ const [inputType, setInputType] = useState(type);
7
+ return (_jsxs("div", { className: `${styles['input-wrapper']} ${className}`, children: [label &&
8
+ _jsx("label", { className: styles['label'], children: label }), _jsxs("div", { className: styles['wrapper'], children: [_jsx("input", { id: id, className: `
9
+ ${styles['input']}
10
+ ${styles[type]}
11
+ ${inputClassName}
12
+ ${error && styles['input-error']}
13
+ `, placeholder: placeholder, autoFocus: autoFocus, required: required, disabled: disabled, defaultValue: defaultValue, type: inputType, onChange: onChange }), type === 'password' &&
14
+ _jsxs("button", { className: styles['reveal-password'], onClick: () => {
15
+ if (inputType === 'text')
16
+ setInputType('password');
17
+ else
18
+ setInputType('text');
19
+ }, children: [inputType === 'password' && _jsx(EyeSlashIcon, { className: styles['icon'], size: 22.5 }), inputType === 'text' && _jsx(EyeIcon, { className: styles['icon'], size: 22.5 })] })] }), error && errorMsg &&
20
+ _jsx("p", { className: styles['error-message'], children: errorMsg })] }));
21
+ }
@@ -0,0 +1,82 @@
1
+ .input-wrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 6px;
5
+
6
+ min-width: 0;
7
+
8
+ .label {
9
+ font-size: 14px;
10
+ font-weight: 500;
11
+ color: var(--neutral500);
12
+ line-height: 150%;
13
+ min-width: 0;
14
+ }
15
+
16
+ .wrapper {
17
+ position: relative;
18
+
19
+ .input {
20
+ width: 100%;
21
+
22
+ font-family: Inter;
23
+ outline: none;
24
+ min-width: 0;
25
+
26
+ padding: 16px 24px;
27
+ border: 1px solid var(--light200);
28
+ border-radius: 8px;
29
+
30
+ transition: border .3s;
31
+ }
32
+
33
+ .input-error {
34
+ border: 1px solid var(--auxiliary-red);
35
+ }
36
+
37
+ .input:hover {
38
+ border: 1px solid var(--auxiliary-orange);
39
+ }
40
+
41
+ .input::placeholder {
42
+ font-size: 14px;
43
+ font-weight: 400;
44
+ color: #A6A5C3;
45
+ line-height: 150%;
46
+ text-overflow: ellipsis;
47
+ min-width: 0;
48
+ }
49
+
50
+ .input:focus {
51
+ border: 1px solid var(--light200);
52
+ }
53
+
54
+ .password {
55
+ padding-right: 48px;
56
+ }
57
+
58
+ .reveal-password {
59
+ all: unset;
60
+
61
+ width: 22.5px;
62
+ height: 22.5px;
63
+
64
+ position: absolute;
65
+ right: 16px;
66
+ top: 50%;
67
+ transform: translateY(-50%);
68
+
69
+ cursor: pointer;
70
+
71
+ .icon {
72
+ color: var(--neutral400);
73
+ }
74
+ }
75
+ }
76
+
77
+ .error-message {
78
+ color: var(--auxiliary-red);
79
+ font-size: 14px;
80
+ font-weight: 500;
81
+ }
82
+ }
@@ -1,8 +1,11 @@
1
1
  import { IconProps, IconWeight } from '@phosphor-icons/react';
2
+ import { HTMLAttributeAnchorTarget } from 'react';
2
3
  interface TagLabelProps {
3
4
  label: string;
4
5
  className?: string;
5
6
  dark?: boolean;
7
+ href?: string;
8
+ target?: HTMLAttributeAnchorTarget;
6
9
  leadingIcon?: React.ComponentType<IconProps>;
7
10
  leadingIconSize?: number;
8
11
  leadingIconColor?: string;
@@ -14,5 +17,5 @@ interface TagLabelProps {
14
17
  trailingIconWeight?: IconWeight;
15
18
  trailingIconClassName?: string;
16
19
  }
17
- export default function TagLabel({ label, className, dark, leadingIcon: LeadingIcon, leadingIconSize, leadingIconColor, leadingIconWeight, leadingIconClassName, trailingIcon: TrailingIcon, trailingIconSize, trailingIconColor, trailingIconWeight, trailingIconClassName, }: TagLabelProps): import("react/jsx-runtime").JSX.Element;
20
+ export default function TagLabel({ label, className, dark, href, target, leadingIcon: LeadingIcon, leadingIconSize, leadingIconColor, leadingIconWeight, leadingIconClassName, trailingIcon: TrailingIcon, trailingIconSize, trailingIconColor, trailingIconWeight, trailingIconClassName, }: TagLabelProps): import("react/jsx-runtime").JSX.Element;
18
21
  export {};
@@ -1,15 +1,25 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import styles from './tag-label.module.scss';
3
3
  import { montserrat } from '../../../fonts';
4
- export default function TagLabel({ label, className, dark, leadingIcon: LeadingIcon, leadingIconSize, leadingIconColor, leadingIconWeight, leadingIconClassName, trailingIcon: TrailingIcon, trailingIconSize, trailingIconColor, trailingIconWeight, trailingIconClassName, }) {
5
- const darkStyle = !dark ? {} : {
6
- border: '1px solid var(--dark900)',
7
- background: 'var(--dark800)',
8
- color: 'white',
9
- };
10
- return (_jsxs("div", { style: darkStyle, className: `${styles['tag-label']} ${montserrat.className} ${className}`, children: [LeadingIcon && (
4
+ import Link from 'next/link';
5
+ export default function TagLabel({ label, className, dark, href, target, leadingIcon: LeadingIcon, leadingIconSize, leadingIconColor, leadingIconWeight, leadingIconClassName, trailingIcon: TrailingIcon, trailingIconSize, trailingIconColor, trailingIconWeight, trailingIconClassName, }) {
6
+ const content = (_jsxs(_Fragment, { children: [LeadingIcon && (
11
7
  // Ícone da esquerda
12
8
  _jsx(LeadingIcon, { size: leadingIconSize, color: leadingIconColor, weight: leadingIconWeight, className: leadingIconClassName })), label, TrailingIcon && (
13
9
  // Ícone da direita
14
10
  _jsx(TrailingIcon, { size: trailingIconSize, color: trailingIconColor, weight: trailingIconWeight, className: trailingIconClassName }))] }));
11
+ if (href)
12
+ return (_jsx(Link, { href: href, target: target, className: `
13
+ ${styles['tag-label']}
14
+ ${styles['link']}
15
+ ${montserrat.className}
16
+ ${className}
17
+ ${dark && styles['dark']}
18
+ `, children: content }));
19
+ return (_jsx("div", { className: `
20
+ ${styles['tag-label']}
21
+ ${montserrat.className}
22
+ ${className}
23
+ ${dark && styles['dark']}
24
+ `, children: content }));
15
25
  }
@@ -14,4 +14,20 @@
14
14
  color: var(--dark700);
15
15
  font-size: 14px;
16
16
  font-weight: 600;
17
+
18
+ transition: border .3s;
19
+ }
20
+
21
+ .link:hover {
22
+ border: 1px solid var(--light400);
23
+ }
24
+
25
+ .dark {
26
+ border: 1px solid var(--dark900);
27
+ background: var(--dark800);
28
+ color: white;
29
+ }
30
+
31
+ .dark:hover {
32
+ border: 1px solid var(--dark900);
17
33
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import './styles/variables.scss';
2
+ export { default as Input } from './components/ui/input/input';
2
3
  export { default as Title } from './components/ui/title/title';
3
4
  export { default as Button } from './components/ui/button/button';
4
5
  export { default as Subtitle } from './components/ui/subtitle/subtitle';
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import './styles/variables.scss';
2
2
  // UI
3
+ export { default as Input } from './components/ui/input/input';
3
4
  export { default as Title } from './components/ui/title/title';
4
5
  export { default as Button } from './components/ui/button/button';
5
6
  export { default as Subtitle } from './components/ui/subtitle/subtitle';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosistemas/sca-web-kit",
3
- "version": "3.3.12",
3
+ "version": "3.4.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@phosphor-icons/react": "^2.1.10",
19
- "@prosistemas/sca-web-kit": "^3.3.8",
19
+ "@prosistemas/sca-web-kit": "^3.3.12",
20
20
  "@radix-ui/react-accordion": "^1.2.12",
21
21
  "@radix-ui/react-avatar": "^1.1.11",
22
22
  "@radix-ui/react-dialog": "^1.1.15",
@@ -25,12 +25,12 @@
25
25
  "react-spinners": "^0.17.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@eslint/eslintrc": "^3.3.3",
29
- "@types/node": "^20.19.31",
30
- "@types/react": "^19.2.11",
28
+ "@eslint/eslintrc": "^3.3.5",
29
+ "@types/node": "^20.19.37",
30
+ "@types/react": "^19.2.14",
31
31
  "@types/react-dom": "^19.2.3",
32
32
  "cpy-cli": "^5.0.0",
33
- "eslint": "^9.39.2",
33
+ "eslint": "^9.39.4",
34
34
  "eslint-config-next": "15.2.2",
35
35
  "typescript": "^5.9.3"
36
36
  },