@lightningjs/solid-ui
Advanced tools
Comparing version
@@ -19,32 +19,17 @@ /* | ||
import theme from 'theme'; | ||
import { type NodeStyles } from '@lightningjs/solid'; | ||
import type { Tone } from '../../types/types.js'; | ||
import type { ComponentStyleConfig, NodeStyleSet, TextStyleSet } from '../../types/types.js'; | ||
import { makeComponentStyles } from '../../utils/index.js'; | ||
import type { BadgeConfig, BadgeStyles } from './Badge.types.js'; | ||
export interface BadgeStyles { | ||
tone: Tone; | ||
Container: NodeStyleSet<{ padding: number[] }>; | ||
Icon: NodeStyleSet; | ||
Text: TextStyleSet; | ||
} | ||
type BadgeStyleProperties = Partial<{ | ||
backgroundColor: NodeStyles['color']; | ||
textColor: NodeStyles['color']; | ||
iconColor: NodeStyles['color']; | ||
strokeColor: NodeStyles['color']; // TODO do we use this? | ||
borderColor: NodeStyles['color']; | ||
}>; | ||
type BadgeConfig = ComponentStyleConfig<BadgeStyleProperties>; | ||
/* @ts-expect-error next-line themes are supplied by client applications so this setup is necessary */ | ||
const { Badge: { defaultTone, ...themeStyles } = { themeStyles: {} } } = theme?.componentConfig; | ||
const { Badge: { defaultTone, ...themeStyles } = { themeStyles: {} } } = theme.componentConfig; | ||
const container: BadgeConfig = { | ||
themeKeys: { | ||
color: 'backgroundColor' | ||
color: 'backgroundColor', | ||
borderRadius: 'radius', | ||
gap: 'contentSpacing' | ||
}, | ||
base: { | ||
// TODO clew uses strokeColor, but we currently don't account for nested properties (border.color) | ||
// TODO clew uses strokeWidth, but we currently don't account for nested properties (border.width) | ||
color: theme.color.fillInverseSecondary, | ||
@@ -56,2 +41,3 @@ borderRadius: theme.radius.sm, // borderRadius must be applied _before_ border to prevent the node from breaking | ||
}, | ||
gap: theme.spacer.xs, | ||
display: 'flex', | ||
@@ -58,0 +44,0 @@ justifyContent: 'spaceEvenly', |
@@ -17,3 +17,4 @@ /* | ||
*/ | ||
export { default as default, type BadgeProps } from './Badge.jsx'; | ||
export { default as badgeStyles, type BadgeStyles } from './Badge.styles.js'; | ||
export { default as default } from './Badge.jsx'; | ||
export { default as badgeStyles } from './Badge.styles.js'; | ||
export type { BadgeProps, BadgeStyles } from './Badge.types.js'; |
{ | ||
"name": "@lightningjs/solid-ui", | ||
"version": "0.16.2", | ||
"version": "0.17.0", | ||
"description": "A shared library of components for the LightningJS Solid Framework.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2198443
0.17%128
0.79%26263
0.23%