From f61e4f08a414fce74caf9471ae08a35dbc579743 Mon Sep 17 00:00:00 2001 From: louistiti Date: Thu, 29 Jun 2023 22:18:46 +0800 Subject: [PATCH] feat(web app): import Aurora --- app/src/js/aurora/button.tsx | 9 -- .../js/aurora/components/button/button.sass | 61 ++++++++ .../js/aurora/components/button/button.tsx | 85 +++++++++++ app/src/js/aurora/components/button/index.ts | 1 + app/src/js/aurora/components/card/card.sass | 12 ++ app/src/js/aurora/components/card/card.tsx | 21 +++ app/src/js/aurora/components/card/index.ts | 1 + .../aurora/components/checkbox/checkbox.sass | 40 +++++ .../aurora/components/checkbox/checkbox.tsx | 53 +++++++ .../js/aurora/components/checkbox/index.ts | 1 + .../circular-progress/circular-progress.sass | 28 ++++ .../circular-progress/circular-progress.tsx | 35 +++++ .../components/circular-progress/index.ts | 1 + .../js/aurora/components/flexbox/flexbox.sass | 92 ++++++++++++ .../js/aurora/components/flexbox/flexbox.tsx | 63 ++++++++ app/src/js/aurora/components/flexbox/index.ts | 1 + .../components/icon-button/icon-button.sass | 70 +++++++++ .../components/icon-button/icon-button.tsx | 82 +++++++++++ .../js/aurora/components/icon-button/index.ts | 1 + app/src/js/aurora/components/icon/icon.sass | 115 +++++++++++++++ app/src/js/aurora/components/icon/icon.tsx | 68 +++++++++ app/src/js/aurora/components/icon/index.ts | 1 + app/src/js/aurora/components/image/image.sass | 76 ++++++++++ app/src/js/aurora/components/image/image.tsx | 52 +++++++ app/src/js/aurora/components/image/index.ts | 1 + app/src/js/aurora/components/index.ts | 22 +++ app/src/js/aurora/components/input/index.ts | 1 + .../aurora/components/input/text-input.sass | 83 +++++++++++ .../js/aurora/components/input/text-input.tsx | 105 +++++++++++++ app/src/js/aurora/components/link/index.ts | 1 + app/src/js/aurora/components/link/link.sass | 14 ++ app/src/js/aurora/components/link/link.tsx | 21 +++ app/src/js/aurora/components/lists/index.ts | 3 + .../components/lists/list-header/index.ts | 1 + .../lists/list-header/list-header.tsx | 21 +++ .../components/lists/list-item/index.ts | 1 + .../components/lists/list-item/list-item.tsx | 39 +++++ .../js/aurora/components/lists/list/index.ts | 1 + .../js/aurora/components/lists/list/list.sass | 54 +++++++ .../js/aurora/components/lists/list/list.tsx | 11 ++ app/src/js/aurora/components/loader/index.ts | 1 + .../js/aurora/components/loader/loader.sass | 29 ++++ .../js/aurora/components/loader/loader.tsx | 20 +++ .../js/aurora/components/progress/index.ts | 1 + .../aurora/components/progress/progress.sass | 34 +++++ .../aurora/components/progress/progress.tsx | 32 ++++ app/src/js/aurora/components/radios/index.ts | 2 + .../components/radios/radio-group/index.ts | 1 + .../radios/radio-group/radio-group.sass | 50 +++++++ .../radios/radio-group/radio-group.tsx | 32 ++++ .../aurora/components/radios/radio/index.ts | 1 + .../aurora/components/radios/radio/radio.tsx | 22 +++ .../components/scroll-container/index.ts | 1 + .../scroll-container/scroll-container.sass | 31 ++++ .../scroll-container/scroll-container.tsx | 34 +++++ app/src/js/aurora/components/selects/index.ts | 2 + .../components/selects/select-option/index.ts | 1 + .../selects/select-option/select-option.tsx | 19 +++ .../aurora/components/selects/select/index.ts | 1 + .../components/selects/select/select.sass | 78 ++++++++++ .../components/selects/select/select.tsx | 72 +++++++++ app/src/js/aurora/components/slider/index.ts | 1 + .../js/aurora/components/slider/slider.sass | 70 +++++++++ .../js/aurora/components/slider/slider.tsx | 89 +++++++++++ app/src/js/aurora/components/status/index.ts | 1 + .../js/aurora/components/status/status.sass | 62 ++++++++ .../js/aurora/components/status/status.tsx | 43 ++++++ app/src/js/aurora/components/switch/index.ts | 1 + .../js/aurora/components/switch/switch.sass | 48 ++++++ .../js/aurora/components/switch/switch.tsx | 44 ++++++ app/src/js/aurora/components/tabs/index.ts | 4 + .../components/tabs/tab-content/index.ts | 1 + .../tabs/tab-content/tab-content.tsx | 15 ++ .../aurora/components/tabs/tab-group/index.ts | 1 + .../components/tabs/tab-group/tab-group.sass | 38 +++++ .../components/tabs/tab-group/tab-group.tsx | 25 ++++ .../aurora/components/tabs/tab-list/index.ts | 1 + .../components/tabs/tab-list/tab-list.tsx | 19 +++ .../js/aurora/components/tabs/tab/index.ts | 1 + app/src/js/aurora/components/tabs/tab/tab.tsx | 13 ++ app/src/js/aurora/components/text/index.ts | 1 + app/src/js/aurora/components/text/text.sass | 42 ++++++ app/src/js/aurora/components/text/text.tsx | 47 ++++++ .../aurora/components/widget-wrapper/index.ts | 1 + .../widget-wrapper/widget-wrapper.sass | 23 +++ .../widget-wrapper/widget-wrapper.tsx | 36 +++++ app/src/js/aurora/index.ts | 3 + app/src/js/aurora/lib/types.ts | 20 +++ app/src/js/aurora/lib/utils.ts | 0 .../aurora/styles/_includes/animations.sass | 5 + .../js/aurora/styles/_includes/variables.sass | 139 ++++++++++++++++++ app/src/js/aurora/styles/main.sass | 21 +++ app/src/js/client.js | 2 +- core/skills-endpoints.json | 101 +++++++------ package.json | 3 + .../widget-playground/src/actions/run.ts | 12 +- 96 files changed, 2681 insertions(+), 64 deletions(-) delete mode 100644 app/src/js/aurora/button.tsx create mode 100644 app/src/js/aurora/components/button/button.sass create mode 100644 app/src/js/aurora/components/button/button.tsx create mode 100644 app/src/js/aurora/components/button/index.ts create mode 100644 app/src/js/aurora/components/card/card.sass create mode 100644 app/src/js/aurora/components/card/card.tsx create mode 100644 app/src/js/aurora/components/card/index.ts create mode 100644 app/src/js/aurora/components/checkbox/checkbox.sass create mode 100644 app/src/js/aurora/components/checkbox/checkbox.tsx create mode 100644 app/src/js/aurora/components/checkbox/index.ts create mode 100644 app/src/js/aurora/components/circular-progress/circular-progress.sass create mode 100644 app/src/js/aurora/components/circular-progress/circular-progress.tsx create mode 100644 app/src/js/aurora/components/circular-progress/index.ts create mode 100644 app/src/js/aurora/components/flexbox/flexbox.sass create mode 100644 app/src/js/aurora/components/flexbox/flexbox.tsx create mode 100644 app/src/js/aurora/components/flexbox/index.ts create mode 100644 app/src/js/aurora/components/icon-button/icon-button.sass create mode 100644 app/src/js/aurora/components/icon-button/icon-button.tsx create mode 100644 app/src/js/aurora/components/icon-button/index.ts create mode 100644 app/src/js/aurora/components/icon/icon.sass create mode 100644 app/src/js/aurora/components/icon/icon.tsx create mode 100644 app/src/js/aurora/components/icon/index.ts create mode 100644 app/src/js/aurora/components/image/image.sass create mode 100644 app/src/js/aurora/components/image/image.tsx create mode 100644 app/src/js/aurora/components/image/index.ts create mode 100644 app/src/js/aurora/components/index.ts create mode 100644 app/src/js/aurora/components/input/index.ts create mode 100644 app/src/js/aurora/components/input/text-input.sass create mode 100644 app/src/js/aurora/components/input/text-input.tsx create mode 100644 app/src/js/aurora/components/link/index.ts create mode 100644 app/src/js/aurora/components/link/link.sass create mode 100644 app/src/js/aurora/components/link/link.tsx create mode 100644 app/src/js/aurora/components/lists/index.ts create mode 100644 app/src/js/aurora/components/lists/list-header/index.ts create mode 100644 app/src/js/aurora/components/lists/list-header/list-header.tsx create mode 100644 app/src/js/aurora/components/lists/list-item/index.ts create mode 100644 app/src/js/aurora/components/lists/list-item/list-item.tsx create mode 100644 app/src/js/aurora/components/lists/list/index.ts create mode 100644 app/src/js/aurora/components/lists/list/list.sass create mode 100644 app/src/js/aurora/components/lists/list/list.tsx create mode 100644 app/src/js/aurora/components/loader/index.ts create mode 100644 app/src/js/aurora/components/loader/loader.sass create mode 100644 app/src/js/aurora/components/loader/loader.tsx create mode 100644 app/src/js/aurora/components/progress/index.ts create mode 100644 app/src/js/aurora/components/progress/progress.sass create mode 100644 app/src/js/aurora/components/progress/progress.tsx create mode 100644 app/src/js/aurora/components/radios/index.ts create mode 100644 app/src/js/aurora/components/radios/radio-group/index.ts create mode 100644 app/src/js/aurora/components/radios/radio-group/radio-group.sass create mode 100644 app/src/js/aurora/components/radios/radio-group/radio-group.tsx create mode 100644 app/src/js/aurora/components/radios/radio/index.ts create mode 100644 app/src/js/aurora/components/radios/radio/radio.tsx create mode 100644 app/src/js/aurora/components/scroll-container/index.ts create mode 100644 app/src/js/aurora/components/scroll-container/scroll-container.sass create mode 100644 app/src/js/aurora/components/scroll-container/scroll-container.tsx create mode 100644 app/src/js/aurora/components/selects/index.ts create mode 100644 app/src/js/aurora/components/selects/select-option/index.ts create mode 100644 app/src/js/aurora/components/selects/select-option/select-option.tsx create mode 100644 app/src/js/aurora/components/selects/select/index.ts create mode 100644 app/src/js/aurora/components/selects/select/select.sass create mode 100644 app/src/js/aurora/components/selects/select/select.tsx create mode 100644 app/src/js/aurora/components/slider/index.ts create mode 100644 app/src/js/aurora/components/slider/slider.sass create mode 100644 app/src/js/aurora/components/slider/slider.tsx create mode 100644 app/src/js/aurora/components/status/index.ts create mode 100644 app/src/js/aurora/components/status/status.sass create mode 100644 app/src/js/aurora/components/status/status.tsx create mode 100644 app/src/js/aurora/components/switch/index.ts create mode 100644 app/src/js/aurora/components/switch/switch.sass create mode 100644 app/src/js/aurora/components/switch/switch.tsx create mode 100644 app/src/js/aurora/components/tabs/index.ts create mode 100644 app/src/js/aurora/components/tabs/tab-content/index.ts create mode 100644 app/src/js/aurora/components/tabs/tab-content/tab-content.tsx create mode 100644 app/src/js/aurora/components/tabs/tab-group/index.ts create mode 100644 app/src/js/aurora/components/tabs/tab-group/tab-group.sass create mode 100644 app/src/js/aurora/components/tabs/tab-group/tab-group.tsx create mode 100644 app/src/js/aurora/components/tabs/tab-list/index.ts create mode 100644 app/src/js/aurora/components/tabs/tab-list/tab-list.tsx create mode 100644 app/src/js/aurora/components/tabs/tab/index.ts create mode 100644 app/src/js/aurora/components/tabs/tab/tab.tsx create mode 100644 app/src/js/aurora/components/text/index.ts create mode 100644 app/src/js/aurora/components/text/text.sass create mode 100644 app/src/js/aurora/components/text/text.tsx create mode 100644 app/src/js/aurora/components/widget-wrapper/index.ts create mode 100644 app/src/js/aurora/components/widget-wrapper/widget-wrapper.sass create mode 100644 app/src/js/aurora/components/widget-wrapper/widget-wrapper.tsx create mode 100644 app/src/js/aurora/index.ts create mode 100644 app/src/js/aurora/lib/types.ts create mode 100644 app/src/js/aurora/lib/utils.ts create mode 100644 app/src/js/aurora/styles/_includes/animations.sass create mode 100644 app/src/js/aurora/styles/_includes/variables.sass create mode 100644 app/src/js/aurora/styles/main.sass diff --git a/app/src/js/aurora/button.tsx b/app/src/js/aurora/button.tsx deleted file mode 100644 index 8e428e55..00000000 --- a/app/src/js/aurora/button.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import type React from 'react' - -interface Props { - children: React.ReactNode -} - -export function Button({ children }: Props) { - return -} diff --git a/app/src/js/aurora/components/button/button.sass b/app/src/js/aurora/components/button/button.sass new file mode 100644 index 00000000..9cb907e9 --- /dev/null +++ b/app/src/js/aurora/components/button/button.sass @@ -0,0 +1,61 @@ +@import '../../styles/main.sass' + +.aurora-button + position: relative + display: inline-block + font-size: var(--a-font-size-md) + line-height: var(--a-line-height-md) + font-weight: var(--a-font-weight-semi-bold) + border-radius: var(--a-border-radius-md) + height: var(--a-button-size-md) + border: none + cursor: pointer + padding: 0 var(--a-space-lg) + box-shadow: 0 0 10px 2px transparent + transition: opacity var(--a-transition-duration-main) var(--a-transition-timing-main), transform var(--a-transition-duration-main), background-color var(--a-transition-duration-main) var(--a-transition-timing-main), border-color var(--a-transition-duration-main) var(--a-transition-timing-main), color var(--a-transition-duration-main) var(--a-transition-timing-main), box-shadow var(--a-transition-duration-main) var(--a-transition-timing-main) + &:hover:not(&--disabled, &--loading) + transform: scale3d(1.01, 1.01, 1.01) + &:active:not(&--disabled, &--loading) + transform: scale3d(.96, .96, .96) + + &--primary + color: var(--a-color-text) + background-color: var(--a-color-accent) + &:hover:not(.aurora-button--disabled, .aurora-button--loading) + background-color: var(--a-color-accent-hover) + + &--secondary + background-color: transparent + color: var(--a-color-accent) + border: 1px solid var(--a-color-accent) + &:hover:not(.aurora-button--disabled, .aurora-button--loading), &:hover:not(.aurora-button--disabled, .aurora-button--loading) .aurora-icon + border-color: var(--a-color-accent-hover) + color: var(--a-color-accent-hover) + .aurora-icon + color: var(--a-color-accent) + + &--danger + background-color: var(--a-color-background-danger) + color: var(--a-color-text-danger) + &:hover:not(.aurora-button--disabled, .aurora-button--loading) + background-color: var(--a-color-danger-hover) + + &--light + background-color: transparent + color: var(--a-color-accent) + &:hover:not(.aurora-button--disabled, .aurora-button--loading), &:hover:not(.aurora-button--disabled, .aurora-button--loading) .aurora-icon + color: var(--a-color-accent-hover) + .aurora-icon + color: var(--a-color-accent) + + &--disabled + opacity: var(--a-opacity-disabled) + cursor: not-allowed + + &--loading + opacity: var(--a-opacity-disabled) + cursor: wait + + .aurora-loader + &::before, &::after + background-color: var(--a-color-white) diff --git a/app/src/js/aurora/components/button/button.tsx b/app/src/js/aurora/components/button/button.tsx new file mode 100644 index 00000000..8b113e54 --- /dev/null +++ b/app/src/js/aurora/components/button/button.tsx @@ -0,0 +1,85 @@ +import type React from 'react' +import classNames from 'classnames' + +import { Flexbox, Icon, Loader } from '..' + +import './button.sass' + +interface Props { + children?: React.ReactNode + type?: 'button' | 'submit' | 'reset' + iconName?: string + iconPosition?: 'left' | 'right' + secondary?: boolean + danger?: boolean + light?: boolean + disabled?: boolean + loading?: boolean + onClick?: () => void +} + +export function Button({ + children, + type = 'button', + iconName, + iconPosition = 'left', + secondary, + danger, + light, + disabled, + loading, + onClick +}: Props) { + let variant = 'primary' + + if (secondary) { + variant = 'secondary' + } else if (danger) { + variant = 'danger' + } else if (light) { + variant = 'light' + } + + return ( + + ) +} diff --git a/app/src/js/aurora/components/button/index.ts b/app/src/js/aurora/components/button/index.ts new file mode 100644 index 00000000..14757e72 --- /dev/null +++ b/app/src/js/aurora/components/button/index.ts @@ -0,0 +1 @@ +export * from './button' diff --git a/app/src/js/aurora/components/card/card.sass b/app/src/js/aurora/components/card/card.sass new file mode 100644 index 00000000..c870f935 --- /dev/null +++ b/app/src/js/aurora/components/card/card.sass @@ -0,0 +1,12 @@ +@import '../../styles/main.sass' + +.aurora-card + position: relative + display: inline-block + width: auto + padding: var(--a-space-md) + background-color: var(--a-color-background-surface-secondary) + border-radius: var(--a-border-radius-md) + + &--full-width + width: 100% diff --git a/app/src/js/aurora/components/card/card.tsx b/app/src/js/aurora/components/card/card.tsx new file mode 100644 index 00000000..52ac1435 --- /dev/null +++ b/app/src/js/aurora/components/card/card.tsx @@ -0,0 +1,21 @@ +import type React from 'react' +import classNames from 'classnames' + +import './card.sass' + +interface Props { + children: React.ReactNode + fullWidth?: boolean +} + +export function Card({ children, fullWidth }: Props) { + return ( +
+ {children} +
+ ) +} diff --git a/app/src/js/aurora/components/card/index.ts b/app/src/js/aurora/components/card/index.ts new file mode 100644 index 00000000..efb32937 --- /dev/null +++ b/app/src/js/aurora/components/card/index.ts @@ -0,0 +1 @@ +export * from './card' diff --git a/app/src/js/aurora/components/checkbox/checkbox.sass b/app/src/js/aurora/components/checkbox/checkbox.sass new file mode 100644 index 00000000..d2cc89d7 --- /dev/null +++ b/app/src/js/aurora/components/checkbox/checkbox.sass @@ -0,0 +1,40 @@ +@import '../../styles/main.sass' + +.aurora-checkbox + display: flex + align-items: center + gap: var(--a-space-sm) + cursor: pointer + &[data-disabled] + cursor: not-allowed + +.aurora-checkbox-placeholder + width: var(--a-checkbox-radio-size) + height: var(--a-checkbox-radio-size) + +.aurora-checkbox-control + display: flex + justify-content: center + align-items: center + width: var(--a-checkbox-radio-size) + height: var(--a-checkbox-radio-size) + border-radius: var(--a-border-radius-xs) + border: 1px solid var(--a-color-input-border) + background-color: var(--a-color-input-background) + transition: background-color var(--a-transition-duration-main) var(--a-transition-timing-main), border-color var(--a-transition-duration-main) var(--a-transition-timing-main) + + &[data-hover]:not([data-checked]) + border-color: var(--a-color-input-border-hover) + background-color: var(--a-color-input-background-hover) + &[data-checked] + border-color: transparent + background-color: var(--a-color-input-border-focus) + &[data-disabled] + opacity: var(--a-opacity-disabled) + +.aurora-checkbox-label + color: var(--a-color-text) + font-size: var(--a-font-size-md) + &[data-disabled] + opacity: var(--a-opacity-disabled) + color: inherit diff --git a/app/src/js/aurora/components/checkbox/checkbox.tsx b/app/src/js/aurora/components/checkbox/checkbox.tsx new file mode 100644 index 00000000..143a1ffd --- /dev/null +++ b/app/src/js/aurora/components/checkbox/checkbox.tsx @@ -0,0 +1,53 @@ +import React, { useState } from 'react' +import { + Checkbox as ArkCheckbox, + CheckboxLabel, + CheckboxInput, + CheckboxControl, + type CheckboxProps +} from '@ark-ui/react' + +import { Icon } from '../icon' + +import './checkbox.sass' + +interface Props + extends Pick { + label?: string +} + +export function Checkbox({ label, checked, value, disabled, onChange }: Props) { + const [isChecked, setIsChecked] = useState(checked) + + return ( + { + setIsChecked(e.checked) + + if (onChange) { + onChange(e) + } + }} + > + {(state) => ( + <> + + + {state.isChecked ? ( + + ) : ( +
+ )} + + + {label} + + + )} + + ) +} diff --git a/app/src/js/aurora/components/checkbox/index.ts b/app/src/js/aurora/components/checkbox/index.ts new file mode 100644 index 00000000..31d76895 --- /dev/null +++ b/app/src/js/aurora/components/checkbox/index.ts @@ -0,0 +1 @@ +export * from './checkbox' diff --git a/app/src/js/aurora/components/circular-progress/circular-progress.sass b/app/src/js/aurora/components/circular-progress/circular-progress.sass new file mode 100644 index 00000000..cc7b82fb --- /dev/null +++ b/app/src/js/aurora/components/circular-progress/circular-progress.sass @@ -0,0 +1,28 @@ +.aurora-circular-progress + position: relative + + &--sm + width: 64px + height: 64px + &--md + width: 128px + height: 128px + &--lg + width: 256px + height: 256px + + path + transition: stroke-dashoffset var(--a-transition-duration-main) var(--a-transition-timing-main) + &:nth-child(1) + stroke: var(--a-color-background-surface-secondary) + stroke-width: 32px + &:nth-child(2) + stroke: var(--a-color-accent) + stroke-width: 12px + stroke-linecap: round + +.aurora-circular-progress-content + position: absolute + top: 50% + left: 50% + transform: translate(-50%, -50%) diff --git a/app/src/js/aurora/components/circular-progress/circular-progress.tsx b/app/src/js/aurora/components/circular-progress/circular-progress.tsx new file mode 100644 index 00000000..1dcb9dc6 --- /dev/null +++ b/app/src/js/aurora/components/circular-progress/circular-progress.tsx @@ -0,0 +1,35 @@ +import React from 'react' +import classNames from 'classnames' + +import { type Size } from '../../lib/types' + +import './circular-progress.sass' + +interface Props { + value: number + children?: React.ReactNode + size?: 'sm' | 'md' | 'lg' +} + +export function CircularProgress({ value, children, size = 'md' }: Props) { + const total = 100 + + return ( +
+ + + + +
{children}
+
+ ) +} diff --git a/app/src/js/aurora/components/circular-progress/index.ts b/app/src/js/aurora/components/circular-progress/index.ts new file mode 100644 index 00000000..985e8a5d --- /dev/null +++ b/app/src/js/aurora/components/circular-progress/index.ts @@ -0,0 +1 @@ +export * from './circular-progress' diff --git a/app/src/js/aurora/components/flexbox/flexbox.sass b/app/src/js/aurora/components/flexbox/flexbox.sass new file mode 100644 index 00000000..872e3a21 --- /dev/null +++ b/app/src/js/aurora/components/flexbox/flexbox.sass @@ -0,0 +1,92 @@ +@import '../../styles/main.sass' + +.aurora-flexbox + position: relative + display: flex + flex-direction: column + height: 100% + + &--padding + padding: var(--a-space-xl) var(--a-space-md) + &--padding-x + padding-left: var(--a-space-md) + padding-right: var(--a-space-md) + &--padding-y + padding-top: var(--a-space-xl) + padding-bottom: var(--a-space-xl) + + &--full-width + width: 100% + + &--flex + display: flex + &--inline-flex + display: inline-flex + + &--row + flex-direction: row + &--row-reverse + flex-direction: row-reverse + &--column + flex-direction: column + &--column-reverse + flex-direction: column-reverse + + &--align-flex-start + align-items: flex-start + &--align-center + align-items: center + &--align-flex-end + align-items: flex-end + &--align-stretch + align-items: stretch + &--align-baseline + align-items: baseline + + &--justify-flex-start + justify-content: flex-start + &--justify-center + justify-content: center + &--justify-flex-end + justify-content: flex-end + &--justify-space-between + justify-content: space-between + &--justify-space-around + justify-content: space-around + &--justify-space-evenly + justify-content: space-evenly + &--justify-stretch + justify-content: stretch + + &--gap-xs + gap: var(--a-space-xs) + &--gap-sm + gap: var(--a-space-sm) + &--gap-md + gap: var(--a-space-md) + &--gap-lg + gap: var(--a-space-lg) + &--gap-xl + gap: var(--a-space-xl) + + &--row-gap-xs + row-gap: var(--a-space-xs) + &--row-gap-sm + row-gap: var(--a-space-sm) + &--row-gap-md + row-gap: var(--a-space-md) + &--row-gap-lg + row-gap: var(--a-space-lg) + &--row-gap-xl + row-gap: var(--a-space-xl) + + &--column-gap-xs + column-gap: var(--a-space-xs) + &--column-gap-sm + column-gap: var(--a-space-sm) + &--column-gap-md + column-gap: var(--a-space-md) + &--column-gap-lg + column-gap: var(--a-space-lg) + &--column-gap-xl + column-gap: var(--a-space-xl) diff --git a/app/src/js/aurora/components/flexbox/flexbox.tsx b/app/src/js/aurora/components/flexbox/flexbox.tsx new file mode 100644 index 00000000..a04413b5 --- /dev/null +++ b/app/src/js/aurora/components/flexbox/flexbox.tsx @@ -0,0 +1,63 @@ +import type React from 'react' +import classNames from 'classnames' + +import { type Size } from '../../lib/types' + +import './flexbox.sass' + +interface Props { + children: React.ReactNode + fullWidth?: boolean + display?: 'flex' | 'inline-flex' + alignItems?: 'center' | 'flex-start' | 'flex-end' | 'baseline' | 'stretch' + justifyContent?: + | 'center' + | 'flex-start' + | 'flex-end' + | 'space-between' + | 'space-around' + | 'space-evenly' + | 'stretch' + flexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse' + gap?: Size + rowGap?: Size + columnGap?: Size + padding?: boolean + paddingX?: boolean + paddingY?: boolean +} + +export function Flexbox({ + children, + fullWidth, + display, + alignItems, + justifyContent, + flexDirection, + gap, + rowGap, + columnGap, + padding, + paddingX, + paddingY +}: Props) { + return ( +
+ {children} +
+ ) +} diff --git a/app/src/js/aurora/components/flexbox/index.ts b/app/src/js/aurora/components/flexbox/index.ts new file mode 100644 index 00000000..b258a661 --- /dev/null +++ b/app/src/js/aurora/components/flexbox/index.ts @@ -0,0 +1 @@ +export * from './flexbox' diff --git a/app/src/js/aurora/components/icon-button/icon-button.sass b/app/src/js/aurora/components/icon-button/icon-button.sass new file mode 100644 index 00000000..de439191 --- /dev/null +++ b/app/src/js/aurora/components/icon-button/icon-button.sass @@ -0,0 +1,70 @@ +@import '../../styles/main.sass' + +.aurora-icon-button + position: relative + width: var(--a-button-size-md) + height: var(--a-button-size-md) + display: flex + align-items: center + justify-content: center + padding: 0 + text-align: center + &.aurora-button:hover:not(.aurora-button--disabled, .aurora-button--loading) + transform: scale3d(1.03, 1.03, 1.03) + &.aurora-button:active:not(.aurora-button--disabled, .aurora-button--loading) + transform: scale3d(.96, .96, .96) + &.aurora-button.aurora-button--light:hover:not(.aurora-button--disabled, .aurora-button--loading) + transform: scale3d(1.06, 1.06, 1.06) + &.aurora-button.aurora-button--light:active:not(.aurora-button--disabled, .aurora-button--loading) + transform: scale3d(.96, .96, .96) + + &--square + width: var(--a-button-size-md) + height: var(--a-button-size-md) + border-radius: var(--a-border-radius-md) + &--circle + width: var(--a-button-size-md) + height: var(--a-button-size-md) + border-radius: 50% + + &--xs + width: 22px + height: 22px + &--sm + width: 30px + height: 30px + &--md + width: var(--a-button-size-md) + height: var(--a-button-size-md) + &--lg + width: 56px + height: 56px + &--xl + width: 96px + height: 96px + &--xxl + width: 164px + height: 164px + + &.aurora-button--light .aurora-icon + color: var(--a-color-text) + + &.aurora-button--secondary:hover, &.aurora-button--light:hover + background-color: transparent + + + &.aurora-button--light:hover .aurora-icon + color: var(--a-color-text) + + &.aurora-button--light.aurora-button--secondary + background-color: transparent + border: none + .aurora-icon + color: var(--a-color-white-secondary) + &:hover:not(.aurora-button--disabled, .aurora-button--loading) .aurora-icon + color: var(--a-color-text) + &:hover.aurora-icon-button--activated .aurora-icon + color: var(--a-color-accent) + + &.aurora-button--light.aurora-icon-button--activated .aurora-icon + color: var(--a-color-accent) diff --git a/app/src/js/aurora/components/icon-button/icon-button.tsx b/app/src/js/aurora/components/icon-button/icon-button.tsx new file mode 100644 index 00000000..69030edc --- /dev/null +++ b/app/src/js/aurora/components/icon-button/icon-button.tsx @@ -0,0 +1,82 @@ +import React, { useState } from 'react' +import classNames from 'classnames' + +import { Icon, Loader } from '..' +import { type Props as IconProps } from '../icon' + +import './icon-button.sass' + +interface Props { + name: string + type?: 'button' | 'submit' | 'reset' + iconType?: IconProps['type'] + size?: IconProps['size'] + shape?: IconProps['bgShape'] + activated?: boolean + secondary?: boolean + danger?: boolean + light?: boolean + disabled?: boolean + loading?: boolean + onClick?: (isActivated: boolean) => void +} + +export function IconButton({ + name, + type = 'button', + iconType = 'line', + size, + shape, + activated, + secondary, + danger, + light, + disabled, + loading, + onClick +}: Props) { + const [isActivated, setIsActivated] = useState(activated || false) + + let variant = 'primary' + + if (danger) { + variant = 'danger' + } + + return ( + + ) +} diff --git a/app/src/js/aurora/components/icon-button/index.ts b/app/src/js/aurora/components/icon-button/index.ts new file mode 100644 index 00000000..876ec6f0 --- /dev/null +++ b/app/src/js/aurora/components/icon-button/index.ts @@ -0,0 +1 @@ +export * from './icon-button' diff --git a/app/src/js/aurora/components/icon/icon.sass b/app/src/js/aurora/components/icon/icon.sass new file mode 100644 index 00000000..29c30297 --- /dev/null +++ b/app/src/js/aurora/components/icon/icon.sass @@ -0,0 +1,115 @@ +@import '../../styles/main.sass' + +.aurora-icon + position: relative + display: inline-flex + align-items: center + justify-content: center + border-radius: var(--a-border-radius-xs) + color: var(--a-color-white) + font-size: var(--a-font-size-md) + background-color: transparent + padding: var(--a-space-xs) + transition: opacity var(--a-transition-duration-main) var(--a-transition-timing-main), color var(--a-transition-duration-main) var(--a-transition-timing-main), background-color var(--a-transition-duration-main) var(--a-transition-timing-main), transform var(--a-transition-duration-main) var(--a-transition-timing-main) + + &--animated + opacity: 0 + animation: aurora-animation-fade-in var(--a-transition-duration-main) var(--a-transition-timing-main) var(--a-transition-duration-main) forwards + + &--xs + width: 12px + height: 12px + font-size: var(--a-font-size-xs) + border-radius: var(--a-border-radius-xs) + &--sm + width: 20px + height: 20px + font-size: var(--a-font-size-sm) + border-radius: var(--a-border-radius-xs) + &--md + width: 28px + height: 28px + font-size: var(--a-font-size-md) + border-radius: var(--a-border-radius-xs) + &--lg + width: 56px + height: 56px + font-size: var(--a-font-size-lg) + border-radius: var(--a-border-radius-md) + &--xl + width: 96px + height: 96px + font-size: var(--a-font-size-xl) + border-radius: var(--a-border-radius-md) + &--xxl + width: 128px + height: 128px + font-size: var(--a-font-size-xxl) + border-radius: var(--a-border-radius-md) + + &--square + border-radius: var(--a-border-radius-xs) + &--circle + border-radius: var(--a-border-radius-circle) + + &--white + color: var(--a-color-white) + &--transparent-white + color: var(--a-color-transparent-white) + &--black + color: var(--a-color-black) + &--blue + color: var(--a-color-blue) + &--secondary-blue + color: var(--a-color-secondary-blue) + &--transparent-blue + color: var(--a-color-transparent-blue) + &--red + color: var(--a-color-red) + &--secondary-red + color: var(--a-color-secondary-red) + &--transparent-red + color: var(--a-color-transparent-red) + &--green + color: var(--a-color-green) + &--secondary-green + color: var(--a-color-secondary-green) + &--transparent-green + color: var(--a-color-transparent-green) + &--yellow + color: var(--a-color-yellow) + &--secondary-yellow + color: var(--a-color-secondary-yellow) + &--transparent-yellow + color: var(--a-color-transparent-yellow) + + &--bg-white + background-color: var(--a-color-white) + &--bg-transparent-white + background-color: var(--a-color-transparent-white) + &--bg-black + background-color: var(--a-color-black) + &--bg-blue + background-color: var(--a-color-blue) + &--bg-secondary-blue + background-color: var(--a-color-secondary-blue) + &--bg-transparent-blue + background-color: var(--a-color-transparent-blue) + &--bg-red + background-color: var(--a-color-red) + &--bg-secondary-red + background-color: var(--a-color-secondary-red) + &--bg-transparent-red + background-color: var(--a-color-transparent-red) + &--bg-green + background-color: var(--a-color-green) + &--bg-secondary-green + background-color: var(--a-color-secondary-green) + &--bg-transparent-green + background-color: var(--a-color-transparent-green) + &--bg-yellow + background-color: var(--a-color-yellow) + &--bg-secondary-yellow + background-color: var(--a-color-secondary-yellow) + &--bg-transparent-yellow + background-color: var(--a-color-transparent-yellow) diff --git a/app/src/js/aurora/components/icon/icon.tsx b/app/src/js/aurora/components/icon/icon.tsx new file mode 100644 index 00000000..e2c3f785 --- /dev/null +++ b/app/src/js/aurora/components/icon/icon.tsx @@ -0,0 +1,68 @@ +import React from 'react' +import classNames from 'classnames' + +import type { Color, Size, IconType } from '../../lib/types' + +import './icon.sass' + +export interface Props { + name?: string + svg?: React.ReactNode + type?: IconType + color?: Color + size?: Size | 'xxl' + bgShape?: 'square' | 'circle' + bgColor?: Color + animated?: boolean +} + +const REMIX_SIZE_MAPPING = { + xs: 'xs', + sm: 'sm', + md: '1x', + lg: 'lg', + xl: 'xl', + xxl: '2x' +} + +/** + * @see https://remixicon.com/ + */ +export function Icon({ + name, + svg, + type = 'line', + color, + size = 'md', + bgShape, + bgColor, + animated +}: Props) { + let iconClassName = `ri-${name}` + + if (type) { + iconClassName = `${iconClassName}-${type}` + } + + return ( +
+ {svg ? ( + svg + ) : ( + + )} +
+ ) +} diff --git a/app/src/js/aurora/components/icon/index.ts b/app/src/js/aurora/components/icon/index.ts new file mode 100644 index 00000000..0af80388 --- /dev/null +++ b/app/src/js/aurora/components/icon/index.ts @@ -0,0 +1 @@ +export * from './icon' diff --git a/app/src/js/aurora/components/image/image.sass b/app/src/js/aurora/components/image/image.sass new file mode 100644 index 00000000..9a8b87d8 --- /dev/null +++ b/app/src/js/aurora/components/image/image.sass @@ -0,0 +1,76 @@ +@import '../../styles/main.sass' + +.aurora-image + position: relative + border-radius: var(--a-border-radius-md) + background-repeat: no-repeat + background-size: cover + background-position: center center + + &--overlay + &::before + content: '' + position: absolute + width: 100% + height: 100% + background-color: rgba(0, 0, 0, .2) + transition: background-color var(--a-transition-duration-main) var(--a-transition-timing-main) + &:hover + &::before + background-color: rgba(0, 0, 0, 0) + + &--gradient + &::after + content: '' + position: absolute + top: auto + bottom: 0 + width: 100% + height: 64px + background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), var(--a-color-background-surface)) + &--gradient-top + &::after + top: 0 + bottom: auto + background-image: linear-gradient(to top, rgba(0, 0, 0, 0), var(--a-color-background-surface)) + &--gradient-bottom + &::after + top: auto + bottom: 0 + background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), var(--a-color-background-surface)) + &--gradient-left + &::after + left: 0 + top: 0 + bottom: 0 + width: 64px + height: 100% + background-image: linear-gradient(to left, rgba(0, 0, 0, 0), var(--a-color-background-surface)) + &--gradient-right + &::after + right: 0 + top: 0 + bottom: 0 + width: 64px + height: 100% + background-image: linear-gradient(to right, rgba(0, 0, 0, 0), var(--a-color-background-surface)) + + &--cover + background-size: cover + &--contain + background-size: contain + + &--square + border-radius: var(--a-border-radius-md) + &--circle + border-radius: var(--a-border-radius-circle) + + &--blue-border + border: 1px solid var(--a-color-blue) + &--white-border + border: 1px solid var(--a-color-white) + + &--radius-top + border-radius: var(--a-border-radius-md) var(--a-border-radius-md) 0 0 + &--radius-bottom + border-radius: 0 0 var(--a-border-radius-md) var(--a-border-radius-md) diff --git a/app/src/js/aurora/components/image/image.tsx b/app/src/js/aurora/components/image/image.tsx new file mode 100644 index 00000000..d9825e19 --- /dev/null +++ b/app/src/js/aurora/components/image/image.tsx @@ -0,0 +1,52 @@ +import type React from 'react' +import classNames from 'classnames' + +import './image.sass' + +interface Props { + src: string + width?: number | string + height?: number | string + shape?: 'circle' | 'square' + borderColor?: 'white' | 'blue' + backgroundSize?: 'cover' | 'contain' + radiusTop?: boolean + radiusBottom?: boolean + overlay?: boolean + gradient?: boolean + gradientPosition?: 'top' | 'bottom' | 'left' | 'right' +} + +export function Image({ + src, + width, + height, + shape, + borderColor, + backgroundSize, + radiusTop, + radiusBottom, + overlay, + gradient, + gradientPosition +}: Props) { + return ( +
+ ) +} diff --git a/app/src/js/aurora/components/image/index.ts b/app/src/js/aurora/components/image/index.ts new file mode 100644 index 00000000..556dbfdf --- /dev/null +++ b/app/src/js/aurora/components/image/index.ts @@ -0,0 +1 @@ +export * from './image' diff --git a/app/src/js/aurora/components/index.ts b/app/src/js/aurora/components/index.ts new file mode 100644 index 00000000..7e50d008 --- /dev/null +++ b/app/src/js/aurora/components/index.ts @@ -0,0 +1,22 @@ +export * from './button' +export * from './card' +export * from './checkbox' +export * from './circular-progress' +export * from './flexbox' +export * from './icon' +export * from './icon-button' +export * from './image' +export * from './link' +export * from './lists' +export * from './loader' +export * from './input' +export * from './progress' +export * from './radios' +export * from './scroll-container' +export * from './selects' +export * from './slider' +export * from './status' +export * from './switch' +export * from './tabs' +export * from './text' +export * from './widget-wrapper' diff --git a/app/src/js/aurora/components/input/index.ts b/app/src/js/aurora/components/input/index.ts new file mode 100644 index 00000000..e0612dd1 --- /dev/null +++ b/app/src/js/aurora/components/input/index.ts @@ -0,0 +1 @@ +export * from './text-input' diff --git a/app/src/js/aurora/components/input/text-input.sass b/app/src/js/aurora/components/input/text-input.sass new file mode 100644 index 00000000..ad0e0d60 --- /dev/null +++ b/app/src/js/aurora/components/input/text-input.sass @@ -0,0 +1,83 @@ +@import '../../styles/main.sass' + +.aurora-text-input-container + --a-icon-container-width: calc(var(--a-input-size-md) + var(--a-space-sm)) + + position: relative + display: flex + flex-direction: column + +.aurora-text-input + position: relative + display: inline-block + color: var(--a-color-text) + background-color: var(--a-color-input-background) + font-size: var(--a-font-size-md) + border: 1px solid var(--a-color-input-border) + border-radius: var(--a-border-radius-md) + height: var(--a-input-size-md) + padding: 0 var(--a-space-md) + width: 100% + outline: none + transition: background-color var(--a-transition-duration-main) var(--a-transition-timing-main), border-color var(--a-transition-duration-main) var(--a-transition-timing-main) + &:hover + border-color: var(--a-color-input-border-hover) + background-color: var(--a-color-input-background-hover) + &:hover:not([disabled]) ~ .aurora-text-input-icon-container + border-color: var(--a-color-input-border-hover) + &:focus + border-color: var(--a-color-input-border-focus) + background-color: var(--a-color-input-background-hover) + &:focus:not([disabled]) + &~ .aurora-text-input-icon-container + border-color: var(--a-color-input-border-focus) + i + color: var(--a-color-accent) + &:placeholder-shown ~ .aurora-text-input-icon-container i + color: var(--color-secondary-white) + + &--multiline + height: calc(var(--a-input-size-md) * 2) + padding: var(--a-space-sm) var(--a-space-md) + resize: vertical + min-height: calc(var(--a-input-size-md) * 2) + max-height: 512px + &~ .aurora-text-input-icon-container + height: 100% + + &--disabled, &--disabled:hover + opacity: var(--a-opacity-disabled) + color: inherit + background-color: var(--a-color-input-background) + border-color: var(--a-color-input-border) + cursor: not-allowed + &--disabled ~ .aurora-text-input-icon-container + opacity: var(--a-opacity-disabled) + i + color: inherit + opacity: var(--a-opacity-disabled) + + &--with-icon + padding-left: calc(var(--a-icon-container-width) + var(--a-space-md)) + +.aurora-text-input-icon-container + position: absolute + left: 0 + top: 0 + bottom: 0 + display: flex + align-items: center + justify-content: center + color: var(--a-color-text) + pointer-events: none + border-right: 1px solid var(--a-color-input-border) + width: var(--a-icon-container-width) + height: var(--a-input-size-md) + transition: background-color var(--a-transition-duration-main) var(--a-transition-timing-main), border-color var(--a-transition-duration-main) var(--a-transition-timing-main) + i + color: var(--a-color-text) + transition: color var(--a-transition-duration-main) var(--a-transition-timing-main) + +.aurora-text-input-hint-container + padding-left: var(--a-space-md) + margin-top: var(--a-space-xs) diff --git a/app/src/js/aurora/components/input/text-input.tsx b/app/src/js/aurora/components/input/text-input.tsx new file mode 100644 index 00000000..61bf7c90 --- /dev/null +++ b/app/src/js/aurora/components/input/text-input.tsx @@ -0,0 +1,105 @@ +import React, { useState } from 'react' +import classNames from 'classnames' + +import { Text, Icon } from '..' + +import './text-input.sass' + +interface Props { + placeholder: string + value?: string + type?: 'text' | 'password' | 'email' | 'tel' | 'url' + iconName?: string + hint?: string + disabled?: boolean + height?: number | 'auto' + maxLength?: number + multiline?: boolean + autofocus?: boolean + onChange?: (value: string) => void +} + +export function TextInput({ + placeholder, + type = 'text', + iconName, + hint, + value, + disabled, + height = 'auto', + maxLength, + multiline, + autofocus, + onChange +}: Props) { + const [inputValue, setInputValue] = useState(value || '') + + if (!multiline) { + if (!maxLength) { + maxLength = 64 + } + + if (height !== 'auto') { + height = 'auto' + } + } + + return ( +
+ {multiline ? ( +