Skip to content

Commit

Permalink
enhancement #260 - Updates for alert manager (#261)
Browse files Browse the repository at this point in the history
Closes #260
  • Loading branch information
nancy-dassana authored Mar 16, 2021
1 parent d644269 commit 225ed85
Show file tree
Hide file tree
Showing 15 changed files with 480 additions and 449 deletions.
870 changes: 435 additions & 435 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dassana-io/web-components",
"version": "0.10.2",
"version": "0.10.3",
"publishConfig": {
"registry": "https://npm.pkg.github.com/dassana-io"
},
Expand Down
2 changes: 2 additions & 0 deletions src/__snapshots__/storybook.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2273,6 +2273,7 @@ exports[`Storyshots Select Full Width 1`] = `
>
<div
className="option-0-2-123"
style={Object {}}
>
<span
className="optionText-0-2-124"
Expand Down Expand Up @@ -2382,6 +2383,7 @@ exports[`Storyshots Select Icon 1`] = `
>
<div
className="option-0-2-123"
style={Object {}}
>
<span
className="icon-0-2-122"
Expand Down
3 changes: 2 additions & 1 deletion src/components/Input/InputSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ const useInputStyles = createUseStyles({
}
})

interface InputSkeletonProps extends Pick<BaseFormElementProps, 'fullWidth'> {
interface InputSkeletonProps
extends Pick<BaseFormElementProps<HTMLInputElement>, 'fullWidth'> {
width?: string | number
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/Input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const useStyles = createUseStyles({
}
})

export interface InputProps extends BaseFormElementProps {
export interface InputProps extends BaseFormElementProps<HTMLInputElement> {
addonAfter?: string
addonBefore?: string
inputRef?: RefObject<AntDInput>
Expand Down
5 changes: 4 additions & 1 deletion src/components/MultipleChoice/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export interface MultipleChoiceItemConfig {
}

export interface SharedProps
extends Pick<BaseFormElementProps, 'classes' | 'dataTag' | 'loading'> {
extends Pick<
BaseFormElementProps<HTMLSelectElement>,
'classes' | 'dataTag' | 'loading'
> {
/**
* Optional callback that returns ref of element to which attach event listener to. By default, it's attached to the window
*/
Expand Down
4 changes: 2 additions & 2 deletions src/components/Select/BaseSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const BaseSelect: FC<BaseSelectProps> = (props: BaseSelectProps) => {
{...multiSelectProps}
{...singleSelectProps}
>
{options.map(({ iconKey, text, value }) => (
{options.map(({ iconKey, text, style, value }) => (
<Option
className={componentClasses.option}
key={value}
Expand All @@ -155,7 +155,7 @@ export const BaseSelect: FC<BaseSelectProps> = (props: BaseSelectProps) => {
<OptionChildren
iconKey={iconKey}
key={value}
optionsConfig={optionsConfig}
optionsConfig={{ ...optionsConfig, style }}
text={text}
/>
</Option>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Select/OptionChildren.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const OptionChildren: FC<OptionChildrenProps> = ({
}: OptionChildrenProps) => {
const [hasTooltip, setHasTooltip] = useState(false)
const classes = useOptionChildrenStyles()
const { style = {} } = optionsConfig

const renderIcon = (
iconKey: IconName,
Expand All @@ -63,7 +64,7 @@ export const OptionChildren: FC<OptionChildrenProps> = ({
}

return (
<div className={classes.option}>
<div className={classes.option} style={style}>
{children && children}
{iconKey && renderIcon(iconKey, optionsConfig)}
<span
Expand Down
5 changes: 4 additions & 1 deletion src/components/Select/SingleSelect/SelectSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ const useStyles = createUseStyles({
}
})

export type SelectSkeletonProps = Pick<BaseFormElementProps, 'fullWidth'>
export type SelectSkeletonProps = Pick<
BaseFormElementProps<HTMLSelectElement>,
'fullWidth'
>

export const SelectSkeleton: FC<SelectSkeletonProps> = (
props: SelectSkeletonProps
Expand Down
5 changes: 4 additions & 1 deletion src/components/Select/SingleSelect/types.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { BaseFormElementProps } from '../../types'
import { CSSProperties } from 'react'
import { IconName } from '../../Icon'

export interface SelectOption {
iconKey?: IconName
style?: CSSProperties
text: string
value: string
}

export interface SelectOptionsConfig {
iconMap?: Record<string, string>
style?: CSSProperties
}

export interface SelectProps extends BaseFormElementProps {
export interface SelectProps extends BaseFormElementProps<HTMLSelectElement> {
/**
* Default value for select component. Without this, the select dropdown will be blank until an option is selected
*/
Expand Down
3 changes: 3 additions & 0 deletions src/components/Select/SingleSelect/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ const generateThemedSelectedItemStyles = (themeType: ThemeType) => {
} = themedStyles[themeType]

return {
'&.ant-select-single .ant-select-selector .ant-select-selection-item > div:first-child': {
paddingLeft: '0 !important'
},
'&.ant-select-single.ant-select-open .ant-select-selection-item': {
color
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/TableDrawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ const useStyles = createUseStyles({
export interface TableDrawerProps<DataType> {
columns: ColumnType[]
data: DataType[]
drawerContainerClasses?: string[]
loading: boolean
renderDrawerCmp: (id: Key, rowData: DataType) => ReactNode
renderTableControls?: () => ReactNode
tableContainerClasses?: string[]
}

export const TableDrawer = <DataType extends DataId>({
Expand Down
6 changes: 5 additions & 1 deletion src/components/TimeInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import React, { FC, FocusEvent } from 'react'
export type TimeFormat = 'unix' | 'hours'

export interface TimeInputProps
extends Omit<BaseFormElementProps, 'fullWidth' | 'onChange' | 'value'> {
extends Omit<
BaseFormElementProps<HTMLElement>,
'fullWidth' | 'onChange' | 'value'
> {
defaultValue?: number
/** moment display format to format date. Defaults to 'hh:mm A' which will display 08:54 PM
* @default 'hh:mm A'
Expand Down Expand Up @@ -102,6 +105,7 @@ export const TimeInput: FC<TimeInputProps> = (props: TimeInputProps) => {
minuteStep={minuteStep}
onBlur={onBlur}
onFocus={(e: FocusEvent<HTMLInputElement>) => {
1
onTimeInputFocus(e)
onFocus(e)
}}
Expand Down
11 changes: 10 additions & 1 deletion src/components/assets/styles/styleguide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,16 @@ export const styleguide = {
h1: { fontSize: 32, lineHeight: '40px' }
},
fontWeight: { light: 300, regular: 400, bold: 500 },
spacing: { xs: 4, s: 8, m: 16, l: 24, xl: 32 },
spacing: {
xs: 4,
s: 8,
's+': 12,
m: 16,
'm+': 20,
l: 24,
'l+': 28,
xl: 32
},
/* eslint-enable sort-keys */
topNavHeight: 64
}
6 changes: 3 additions & 3 deletions src/components/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ChangeEventHandler } from 'react'

export interface BaseFormElementProps extends CommonComponentProps {
export interface BaseFormElementProps<Element> extends CommonComponentProps {
/**
* Array of classes to pass to element
* @default []
Expand Down Expand Up @@ -30,12 +30,12 @@ export interface BaseFormElementProps extends CommonComponentProps {
* Callback that runs when element loses focus
* @default () => {}
*/
onBlur?: ChangeEventHandler
onBlur?: ChangeEventHandler<Element>
/**
* Callback that runs when element is updated
* @default () => {}
*/
onChange?: ChangeEventHandler
onChange?: ChangeEventHandler<Element>
/**
* Describes expected value of element
*/
Expand Down

0 comments on commit 225ed85

Please sign in to comment.