From 052f081226132d6df12062641f9eb6f2810d0162 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 12 Sep 2022 09:40:51 -0300 Subject: [PATCH 1/5] feat(apps-menu): update tokens --- .../Layout/Topbar/Apps/Dropdown/index.tsx | 38 +++++++++---------- .../ui-components/Layout/Topbar/index.tsx | 5 ++- src/pages/ui-components/Layout/context.ts | 2 +- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/pages/ui-components/Layout/Topbar/Apps/Dropdown/index.tsx b/src/pages/ui-components/Layout/Topbar/Apps/Dropdown/index.tsx index ee7ca5299..ba3937c62 100644 --- a/src/pages/ui-components/Layout/Topbar/Apps/Dropdown/index.tsx +++ b/src/pages/ui-components/Layout/Topbar/Apps/Dropdown/index.tsx @@ -41,7 +41,7 @@ const AppsDropdown = React.memo( return (
- Lista de Apps + Menu de Apps @@ -54,6 +54,7 @@ const AppsDropdown = React.memo(
)} + {applications?.map(app => { const isCurrent = app.application === currentApplication; @@ -110,12 +111,11 @@ const descriptionAnimation = keyframes` export default styled(AppsDropdown, { label: 'houston-topbar-apps-dropdown' })( ({ theme }) => css` - width: ${TOPBAR_DROPDOWN_WIDTH}px; + width: ${theme.pxToRem(TOPBAR_DROPDOWN_WIDTH)}rem; position: fixed; - background: #fff; box-shadow: ${theme.shadow.level[2]}; - top: ${TOPBAR_HEIGHT}px; + top: ${theme.pxToRem(TOPBAR_HEIGHT)}rem; left: ${theme.spacing.inline.nano}; border-radius: ${theme.border.radius.sm}; z-index: 105; @@ -146,11 +146,11 @@ export default styled(AppsDropdown, { label: 'houston-topbar-apps-dropdown' })( .houston-topbar-apps-dropdown__list-apps { display: grid; grid-template-columns: repeat(3, 1fr); - grid-gap: ${theme.spacing.nano}; + grid-gap: ${theme.spacing.stack.nano} ${theme.spacing.inline.nano}; flex-wrap: wrap; justify-items: center; box-sizing: border-box; - padding: ${theme.spacing.xxxs}; + padding: ${theme.spacing.inset.xs}; .houston-topbar-apps-dropdown__loader { display: flex; @@ -173,8 +173,8 @@ export default styled(AppsDropdown, { label: 'houston-topbar-apps-dropdown' })( display: block; .houston-topbar-apps-dropdown__icon { - max-width: 40px; - max-height: 40px; + max-width: ${theme.pxToRem(40)}rem; + max-height: ${theme.pxToRem(40)}rem; margin-bottom: ${theme.spacing.nano}; } @@ -200,7 +200,7 @@ export default styled(AppsDropdown, { label: 'houston-topbar-apps-dropdown' })( } .houston-topbar-apps-dropdown__expand .houston-topbar-apps-dropdown__expand-button { - margin: ${theme.spacing.nano}; + margin: ${theme.spacing.inset.xs}; } &.--expanded { @@ -216,7 +216,7 @@ export default styled(AppsDropdown, { label: 'houston-topbar-apps-dropdown' })( align-items: center; justify-content: space-between; width: 100%; - padding: 0 ${theme.spacing.nano} 0 ${theme.spacing.xxxs}; + padding: ${theme.spacing.nano} ${theme.spacing.inset.md}; border-bottom: ${theme.border.width.xs} solid ${theme.hexToRgba(theme.neutralColor.low.pure, theme.opacity.level[3])}; } @@ -233,8 +233,8 @@ export default styled(AppsDropdown, { label: 'houston-topbar-apps-dropdown' })( .houston-topbar-apps-dropdown__item { height: 100%; display: grid; - grid-template-columns: 25px 1fr; - grid-template-rows: 25px auto; + grid-template-columns: ${theme.pxToRem(25)}rem 1fr; + grid-template-rows: ${theme.pxToRem(25)}rem auto; grid-gap: ${theme.spacing.nano}; text-align: left; padding: ${theme.spacing.xxs}; @@ -243,8 +243,8 @@ export default styled(AppsDropdown, { label: 'houston-topbar-apps-dropdown' })( align-items: center; .houston-topbar-apps-dropdown__icon { - max-width: 25px; - max-height: 25px; + max-width: ${theme.pxToRem(25)}rem; + max-height: ${theme.pxToRem(25)}rem; grid-column: 1; grid-row: 1; margin-bottom: 0; @@ -264,7 +264,7 @@ export default styled(AppsDropdown, { label: 'houston-topbar-apps-dropdown' })( } ${theme.breakpoints.up('md')} { - padding: ${theme.spacing.xxs}; + padding: ${theme.spacing.inset.md}; grid-template-columns: repeat(2, 1fr); grid-gap: ${theme.spacing.xxs}; @@ -272,17 +272,17 @@ export default styled(AppsDropdown, { label: 'houston-topbar-apps-dropdown' })( margin: auto; border: ${theme.border.width.xs} solid ${theme.hexToRgba(theme.neutralColor.low.pure, theme.opacity.level[3])}; - grid-template-columns: 60px 1fr; + grid-template-columns: ${theme.pxToRem(60)} 1fr; grid-template-rows: 20px auto; - padding: ${theme.spacing.xxxs}; + padding: ${theme.spacing.inset.xs}; grid-gap: ${theme.spacing.quarck}; align-items: start; .houston-topbar-apps-dropdown__icon { grid-row-start: 1; grid-row-end: 3; - max-width: 50px; - max-height: 50px; + max-width: ${theme.pxToRem(50)}rem; + max-height: ${theme.pxToRem(50)}rem; } .houston-topbar-apps-dropdown__description { diff --git a/src/pages/ui-components/Layout/Topbar/index.tsx b/src/pages/ui-components/Layout/Topbar/index.tsx index 8daa66b76..c47502505 100644 --- a/src/pages/ui-components/Layout/Topbar/index.tsx +++ b/src/pages/ui-components/Layout/Topbar/index.tsx @@ -24,6 +24,7 @@ import UserMenuGroup from './UserMenu/ItemGroup'; export interface TopbarProps extends StyledProp { children?: React.ReactNode; + disableApps?: boolean; logo?: string; logoMobile?: string; currentApplication?: string; @@ -41,7 +42,7 @@ export interface TopbarProps extends StyledProp { } const Topbar = React.memo( - ({ children, currentApplication, logo, logoMobile, className, blackMode, user }) => { + ({ children, currentApplication, logo, logoMobile, className, blackMode, user, disableApps }) => { const theme = useHoustonTheme(); const register = useContextSelector(LayoutContext, context => context.topbar.register); const sidebarToogleOpened = useContextSelector(LayoutContext, context => context.sidebar.toogleOpened); @@ -76,7 +77,7 @@ const Topbar = React.memo( onClick={sidebarToogleOpened} /> - + {!disableApps && }
Date: Mon, 12 Sep 2022 10:13:43 -0300 Subject: [PATCH 2/5] fix: add icons to documentation --- src/pages/icons/index.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/pages/icons/index.tsx b/src/pages/icons/index.tsx index 7824d3b0a..f03ccaa4a 100644 --- a/src/pages/icons/index.tsx +++ b/src/pages/icons/index.tsx @@ -9,13 +9,12 @@ export { default as ArrowRight } from './ArrowRight'; export { default as ArrowUp } from './ArrowUp'; export { default as AvatarOutline } from './AvatarOutline'; export { default as AvatarSolid } from './AvatarSolid'; -export { default as Banksplip } from './Bankslip'; +export { default as Bankslip } from './Bankslip'; export { default as Belt } from './Belt'; export { default as BetaTester } from './BetaTester'; export { default as BoxOutline } from './BoxOutline'; export { default as BoxSolid } from './BoxSolid'; export { default as Bullet } from './Bullet'; -export { default as CadsSolid } from './CardsSolid'; export { default as Calendar } from './Calendar'; export { default as CameraFrontOutline } from './CameraFrontOutline'; export { default as CameraFrontSolid } from './CameraFrontSolid'; @@ -23,13 +22,16 @@ export { default as CameraOutline } from './CameraOutline'; export { default as CameraSolid } from './CameraSolid'; export { default as Cancel } from './Cancel'; export { default as CardOutline } from './CardOutline'; +export { default as CardSolid } from './CardSolid'; export { default as CardsOutline } from './CardsOutline'; +export { default as CardsSolid } from './CardsSolid'; export { default as CartOutline } from './CartOutline'; +export { default as CartSolid } from './CartSolid'; +export { default as ChevronDoubleLeft } from './ChevronDoubleLeft'; +export { default as ChevronDoubleRight } from './ChevronDoubleRight'; export { default as ChevronDown } from './ChevronDown'; export { default as ChevronLeft } from './ChevronLeft'; -export { default as ChevronDoubleLeft } from './ChevronDoubleLeft'; export { default as ChevronRight } from './ChevronRight'; -export { default as ChevronDoubleRight } from './ChevronDoubleRight'; export { default as ChevronUp } from './ChevronUp'; export { default as CopyOutline } from './CopyOutline'; export { default as CopySolid } from './CopySolid'; @@ -61,12 +63,12 @@ export { default as EyeOffOutline } from './EyeOffOutline'; export { default as EyeOffSolid } from './EyeOffSolid'; export { default as EyeOnOutline } from './EyeOnOutline'; export { default as EyeOnSolid } from './EyeOnSolid'; -export { default as FacebookOutline } from './FacebookOutline'; -export { default as FacebookSolid } from './FacebookSolid'; export { default as FaceHappyOutline } from './FaceHappyOutline'; export { default as FaceHappySolid } from './FaceHappySolid'; export { default as FaceSadOutline } from './FaceSadOutline'; export { default as FaceSadSolid } from './FaceSadSolid'; +export { default as FacebookOutline } from './FacebookOutline'; +export { default as FacebookSolid } from './FacebookSolid'; export { default as FileOutline } from './FileOutline'; export { default as FileSolid } from './FileSolid'; export { default as FilterOutline } from './FilterOutline'; @@ -113,6 +115,7 @@ export { default as MenuRight } from './MenuRight'; export { default as MessageOutline } from './MessageOutline'; export { default as MessageRoundOutline } from './MessageRoundOutline'; export { default as MessageRoundSolid } from './MessageRoundSolid'; +export { default as MessageSolid } from './MessageSolid'; export { default as MicrophoneOutline } from './MicrophoneOutline'; export { default as MicrophoneSolid } from './MicrophoneSolid'; export { default as Mobile } from './Mobile'; @@ -145,6 +148,9 @@ export { default as SearchSolid } from './SearchSolid'; export { default as SettingsOutline } from './SettingsOutline'; export { default as SettingsSolid } from './SettingsSolid'; export { default as Share } from './Share'; +export { default as StarOutline } from './StarOutline'; +export { default as StarSolid } from './StarSolid'; +export { default as Store } from './Store'; export { default as TagOutline } from './TagOutline'; export { default as TagSolid } from './TagSolid'; export { default as Telegram } from './Telegram'; From 3289b94b77164a9eb2303cbd92acee451c5c6d09 Mon Sep 17 00:00:00 2001 From: Miguel Date: Tue, 13 Sep 2022 14:20:03 -0300 Subject: [PATCH 3/5] feat: date picker now handle typing --- .../ui-components/Forms/DatePicker/index.tsx | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/pages/ui-components/Forms/DatePicker/index.tsx b/src/pages/ui-components/Forms/DatePicker/index.tsx index 0596c673d..f2d15b910 100644 --- a/src/pages/ui-components/Forms/DatePicker/index.tsx +++ b/src/pages/ui-components/Forms/DatePicker/index.tsx @@ -2,6 +2,7 @@ import 'rc-picker/assets/index.css'; import * as React from 'react'; +import isValid from 'date-fns/isValid'; import Picker from 'rc-picker'; import generateConfig from 'rc-picker/lib/generate/dateFns'; import locale from 'rc-picker/lib/locale/pt_BR'; @@ -80,6 +81,26 @@ const DatePicker = ({ fullWidth = true, ...inputProps }: DatePickerProps) => { + const disableDate = React.useCallback( + (date: Date | null) => { + if (!date) return true; + if (minDate) return date < minDate; + if (maxDate) return date > maxDate; + return false; + }, + [maxDate, minDate] + ); + + const internalInputOnBlur = React.useCallback( + (value: string) => { + const [day, month, year] = value.split('/'); + const date = new Date(+year, +month - 1, +day); + if (disableDate(date) || !isValid(date)) return; + onChange && onChange(date); + }, + [disableDate, onChange] + ); + const inputRender = React.useCallback( (props: React.InputHTMLAttributes) => { return ( @@ -88,33 +109,16 @@ const DatePicker = ({ {...props} id={id} size='default' + onBlur={internalInputOnBlur} fullWidth={fullWidth} disabled={disabled} nativeChangeEvent - readOnly name={undefined} endAdornment={} /> ); }, - [id, disabled, inputProps, fullWidth] - ); - - const disableDate = React.useCallback( - (date: Date | undefined) => { - if (!date) return true; - - if (minDate) { - return date < minDate; - } - - if (maxDate) { - return date > maxDate; - } - - return false; - }, - [maxDate, minDate] + [id, disabled, inputProps, fullWidth, internalInputOnBlur] ); return ( From 478d62fb2ea880ec1890260d3465721e26a7de6c Mon Sep 17 00:00:00 2001 From: Miguel Date: Tue, 13 Sep 2022 17:57:07 -0300 Subject: [PATCH 4/5] feat: add id to components --- .../ui-components/Breadcrumb/Item/index.tsx | 5 ++- .../ui-components/Breadcrumb/Link/index.tsx | 1 + src/pages/ui-components/Breadcrumb/index.tsx | 6 +-- src/pages/ui-components/Collapse/index.tsx | 5 ++- src/pages/ui-components/Divider/index.tsx | 6 +-- .../ui-components/Forms/Checkbox/Group.tsx | 14 +++++-- .../Forms/ErrorMessage/index.tsx | 9 ++++- src/pages/ui-components/Forms/Radio/Group.tsx | 7 ++-- src/pages/ui-components/Grid/Column/index.tsx | 11 ++++-- .../ui-components/Grid/Container/index.tsx | 14 ++++--- src/pages/ui-components/Grid/Row/index.tsx | 25 ++++++++----- src/pages/ui-components/Layout/Layout.tsx | 13 ++++--- .../Layout/Topbar/Action/index.tsx | 23 ++++++------ .../Layout/Topbar/Apps/Dropdown/index.tsx | 17 +++++---- .../Layout/Topbar/Apps/index.tsx | 26 ++++++------- .../Layout/Topbar/UserMenu/Divider/index.tsx | 8 ++-- .../Layout/Topbar/UserMenu/Item/index.tsx | 18 ++++++++- .../Topbar/UserMenu/ItemGroup/index.tsx | 13 ++++--- .../Layout/Topbar/UserMenu/index.tsx | 13 ++++--- .../ui-components/Layout/Topbar/index.tsx | 37 ++++++++++--------- .../ui-components/Loaders/Line/index.tsx | 19 +++++----- .../ui-components/Loaders/Spinner/index.tsx | 19 +++++++--- src/pages/ui-components/Overlay/index.tsx | 4 +- .../ui-components/Progress/Bar/index.tsx | 10 +++-- .../Showcase/ControlDots/index.tsx | 6 ++- .../ui-components/Showcase/Text/index.tsx | 6 +-- .../ui-components/Showcase/Title/index.tsx | 6 +-- .../ui-components/Table/Action/index.tsx | 10 ++++- src/pages/ui-components/Table/Body/index.tsx | 9 +++-- .../ui-components/Table/Collapse/index.tsx | 3 ++ .../Table/Column/SortLabel/index.tsx | 4 +- .../ui-components/Table/Column/index.tsx | 1 + .../ui-components/Table/Header/index.tsx | 5 ++- src/pages/ui-components/Tabs/index.tsx | 3 ++ 34 files changed, 229 insertions(+), 147 deletions(-) diff --git a/src/pages/ui-components/Breadcrumb/Item/index.tsx b/src/pages/ui-components/Breadcrumb/Item/index.tsx index 65785da33..69181bda1 100644 --- a/src/pages/ui-components/Breadcrumb/Item/index.tsx +++ b/src/pages/ui-components/Breadcrumb/Item/index.tsx @@ -6,6 +6,7 @@ import { useBreadcrumb } from '../context'; import LongTextToolTip from '../internals/LongTextToolTip'; export interface BreadcrumbItemProps extends StyledProp { + id?: string; isActive?: boolean; onClick?: () => void; children?: React.ReactNode; @@ -17,11 +18,11 @@ const SeparatorIcon = () => ( ); -const BreadcrumbItem = ({ children, className, isActive }: BreadcrumbItemProps) => { +const BreadcrumbItem = ({ id, children, className, isActive }: BreadcrumbItemProps) => { const { separator } = useBreadcrumb(); return ( -
  • +
  • {children} diff --git a/src/pages/ui-components/Breadcrumb/Link/index.tsx b/src/pages/ui-components/Breadcrumb/Link/index.tsx index a3cf47da7..710e91330 100644 --- a/src/pages/ui-components/Breadcrumb/Link/index.tsx +++ b/src/pages/ui-components/Breadcrumb/Link/index.tsx @@ -19,6 +19,7 @@ type BreadcrumbLinkProps = { * Redirect path. */ href?: string; + id?: string; icon?: React.ReactNode; children?: React.ReactNode; }; diff --git a/src/pages/ui-components/Breadcrumb/index.tsx b/src/pages/ui-components/Breadcrumb/index.tsx index 431be0496..922c08290 100644 --- a/src/pages/ui-components/Breadcrumb/index.tsx +++ b/src/pages/ui-components/Breadcrumb/index.tsx @@ -7,15 +7,15 @@ import { BreadcrumbProvider } from './context'; import Item from './Item'; import Link from './Link'; -export interface BreadcrumbProps extends StyledProp { +export interface BreadcrumbProps extends StyledProp, React.HTMLAttributes { separator?: React.ReactNode; children: React.ReactNode; } -const Breadcrumb = ({ children, className, separator }: BreadcrumbProps) => { +const Breadcrumb = ({ children, className, separator, ...rest }: BreadcrumbProps) => { return ( -