From 65793feaf8734e832c10c7f43dfaf355a4f8a826 Mon Sep 17 00:00:00 2001 From: enesozturk Date: Thu, 21 Nov 2024 20:47:56 +0300 Subject: [PATCH 1/3] feat: new chip button component --- apps/gallery-new/utils/PresetUtils.ts | 2 +- .../ui-new/src/assets/svg/arrow-top-right.ts | 4 +- .../ui-new/src/assets/svg/external-link.ts | 9 +- .../src/composites/wui-chip-button/index.ts | 22 +-- .../src/composites/wui-chip-button/styles.ts | 127 +++++++----------- packages/ui-new/src/utils/TypeUtil.ts | 4 +- 6 files changed, 64 insertions(+), 104 deletions(-) diff --git a/apps/gallery-new/utils/PresetUtils.ts b/apps/gallery-new/utils/PresetUtils.ts index 20fd11851a..03e0af592c 100644 --- a/apps/gallery-new/utils/PresetUtils.ts +++ b/apps/gallery-new/utils/PresetUtils.ts @@ -279,7 +279,7 @@ export const logoOptions: LogoType[] = [ export const placementOptions: PlacementType[] = ['top', 'right', 'bottom', 'left'] -export const chipButtonVariants: ChipButtonVariant[] = ['main', 'accent', 'shade', 'gray', 'shade'] +export const chipButtonVariants: ChipButtonVariant[] = ['main', 'accent', 'primary'] export const chipVariants: ChipType[] = [ 'fill', diff --git a/packages/ui-new/src/assets/svg/arrow-top-right.ts b/packages/ui-new/src/assets/svg/arrow-top-right.ts index dd47822ab3..27352299a6 100644 --- a/packages/ui-new/src/assets/svg/arrow-top-right.ts +++ b/packages/ui-new/src/assets/svg/arrow-top-right.ts @@ -1,5 +1,5 @@ import { svg } from 'lit' -export const arrowTopRightSvg = svg` - +export const arrowTopRightSvg = svg` + ` diff --git a/packages/ui-new/src/assets/svg/external-link.ts b/packages/ui-new/src/assets/svg/external-link.ts index d3268edfdb..abe0429b29 100644 --- a/packages/ui-new/src/assets/svg/external-link.ts +++ b/packages/ui-new/src/assets/svg/external-link.ts @@ -1,10 +1,5 @@ import { svg } from 'lit' -export const externalLinkSvg = svg` - +export const externalLinkSvg = svg` + ` diff --git a/packages/ui-new/src/composites/wui-chip-button/index.ts b/packages/ui-new/src/composites/wui-chip-button/index.ts index 29204328ab..b92cf5daa1 100644 --- a/packages/ui-new/src/composites/wui-chip-button/index.ts +++ b/packages/ui-new/src/composites/wui-chip-button/index.ts @@ -4,10 +4,16 @@ import '../../components/wui-icon/index.js' import '../../components/wui-image/index.js' import '../../components/wui-text/index.js' import { elementStyles, resetStyles } from '../../utils/ThemeUtil.js' -import type { ChipButtonVariant, IconType } from '../../utils/TypeUtil.js' +import type { ChipButtonSize, ChipButtonVariant, IconType } from '../../utils/TypeUtil.js' import { customElement } from '../../utils/WebComponentsUtil.js' import styles from './styles.js' +// -- Constants --------------------------------------------------------------- // +const FONT_SIZE = { + sm: 'sm-regular', + md: 'md-regular' +} + @customElement('wui-chip-button') export class WuiChipButton extends LitElement { public static override styles = [resetStyles, elementStyles, styles] @@ -15,28 +21,22 @@ export class WuiChipButton extends LitElement { // -- State & Properties -------------------------------- // @property() public variant: ChipButtonVariant = 'accent' + @property() public size: ChipButtonSize = 'md' + @property() public imageSrc = '' @property({ type: Boolean }) public disabled = false @property() public icon: IconType = 'externalLink' - @property() public size: 'sm' | 'md' = 'md' - @property() public text = '' // -- Render -------------------------------------------- // public override render() { - const textVariant = this.size === 'sm' ? 'small-600' : 'paragraph-600' - return html` -