@ndlib/component-library 0.0.32 → 0.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,13 +10,15 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import SearchOffIcon from '@mui/icons-material/SearchOff';
13
+ import _SearchOffIcon from '@mui/icons-material/SearchOff';
14
14
  import { Row } from '../../elements/layout/Row';
15
15
  import { Column } from '../../elements/layout/Column';
16
16
  import { PARAGRAPH_SIZE, Paragraph } from '../../elements/text/Paragraph';
17
17
  import { COLOR } from '../../../theme/colors';
18
18
  import { Icon } from '../../elements/Icon';
19
19
  import { FONT_SIZE } from '../../../theme/typography';
20
+ import { importedDefaultComponentShim } from '../../../utils/misc';
21
+ const SearchOffIcon = importedDefaultComponentShim(_SearchOffIcon);
20
22
  export const DEFAULT_MESSAGE = 'No results found.';
21
23
  export const EmptyState = (_a) => {
22
24
  var { icon, message, sx } = _a, rest = __rest(_a, ["icon", "message", "sx"]);
@@ -40,6 +40,8 @@ export declare const Button: React.ForwardRefExoticComponent<{
40
40
  accessibleLabel?: string | undefined;
41
41
  loading?: boolean | undefined;
42
42
  disabled?: boolean | undefined;
43
+ } & {
44
+ htmlFor?: string | undefined;
43
45
  } & React.RefAttributes<HTMLButtonElement>>;
44
46
  type LinkButtonProps = Omit<ButtonProps, 'type' | 'color' | 'textColor'>;
45
47
  export declare const LinkButton: React.FC<LinkButtonProps>;
@@ -4,3 +4,4 @@ declare const meta: Meta<typeof Select>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Select>;
6
6
  export declare const Default: Story;
7
+ export declare const WithLabel: Story;
@@ -28,5 +28,8 @@ const StatefulSelect = (props) => {
28
28
  return (_jsx(Select, Object.assign({ options: options }, props, { value: value, onSelectOption: setValue, placeholder: "Select A Fruit..." })));
29
29
  };
30
30
  export const Default = {
31
- render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, Object.assign({ size: HEADING_SIZE.MD }, { children: size.label })), _jsx(StatefulSelect, { size: size.size, leftIcon: AppleIcon, sx: { mt: 1 } })] }))) })),
31
+ render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, Object.assign({ size: HEADING_SIZE.MD }, { children: size.label })), _jsx(StatefulSelect, { size: size.size, leftIcon: AppleIcon, sx: { mt: 2 } })] }))) })),
32
+ };
33
+ export const WithLabel = {
34
+ render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, Object.assign({ size: HEADING_SIZE.MD }, { children: size.label })), _jsx(StatefulSelect, { size: size.size, leftIcon: AppleIcon, sx: { mt: 2 }, label: "Fruit" })] }))) })),
32
35
  };
@@ -7,10 +7,11 @@ type SelectProps<Value extends Key, Option extends BasicOption<Value>> = StyledE
7
7
  size?: INPUT_SIZE;
8
8
  leftIcon?: React.FC<any>;
9
9
  value: Value;
10
+ label?: string;
10
11
  onSelectOption: (value: Value) => void;
11
12
  options: Option[];
12
13
  renderOption: RenderOption<Value, Option>;
13
14
  renderOptionLabel: RenderOptionLabel<Option>;
14
15
  }, string>;
15
- export declare function Select<Value extends Key, Option extends BasicOption<Value>>({ size: sizeParam, placeholder, leftIcon, value, onSelectOption, options, renderOption, renderOptionLabel: renderOptionLabelParam, sx, }: SelectProps<Value, Option>): import("react/jsx-runtime").JSX.Element;
16
+ export declare function Select<Value extends Key, Option extends BasicOption<Value>>({ size: sizeParam, placeholder, leftIcon, value, label, onSelectOption, options, renderOption, renderOptionLabel: renderOptionLabelParam, sx, }: SelectProps<Value, Option>): import("react/jsx-runtime").JSX.Element;
16
17
  export {};
@@ -1,16 +1,18 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo, useState } from 'react';
3
3
  import _ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
4
4
  import { useFloating, size as sizeMiddleware, offset, autoPlacement, } from '@floating-ui/react';
5
5
  import { TYPOGRAPHY_TYPE, getTypographyStyles, } from '../../../../theme/typography';
6
6
  import { useTheme } from '../../../../theme';
7
- import { INPUT_SIZE } from '../TextInput';
7
+ import { INPUT_SIZE, labelOffsetMap, labelTypographyMap } from '../TextInput';
8
8
  import { ListBox } from '../../ListBox';
9
9
  import { BUTTON_SIZE, BUTTON_TYPE, Button } from '../../Button';
10
10
  import { defaultRenderOptionLabel, getOptionId, } from '../option';
11
11
  import { useUniqueHtmlId } from '../../../../utils/hooks/useUniqueHtmlId';
12
12
  import { KEY_CODES, importedDefaultComponentShim } from '../../../../utils/misc';
13
13
  import { COLOR } from '../../../../theme/colors';
14
+ import { Box } from '../../layout/Box';
15
+ import { Label } from '../../text/Label';
14
16
  const ArrowDropDownIcon = importedDefaultComponentShim(_ArrowDropDownIcon);
15
17
  const typographyMap = {
16
18
  [INPUT_SIZE.SM]: TYPOGRAPHY_TYPE.PARAGRAPH_SMALL,
@@ -28,9 +30,10 @@ const buttonSizeMap = {
28
30
  [INPUT_SIZE.LG]: BUTTON_SIZE.LG,
29
31
  };
30
32
  const DEFAULT_WIDTH = '16rem';
31
- export function Select({ size: sizeParam, placeholder, leftIcon, value, onSelectOption, options, renderOption, renderOptionLabel: renderOptionLabelParam, sx, }) {
33
+ export function Select({ size: sizeParam, placeholder, leftIcon, value, label, onSelectOption, options, renderOption, renderOptionLabel: renderOptionLabelParam, sx, }) {
32
34
  const theme = useTheme();
33
35
  const listboxId = useUniqueHtmlId('select-list-box');
36
+ const inputId = useUniqueHtmlId('select-input');
34
37
  const [isOpen, setIsOpen] = useState(false);
35
38
  const [stagedOptionValue, setStagedOptionValue] = useState();
36
39
  const currentOption = useMemo(() => {
@@ -113,7 +116,16 @@ export function Select({ size: sizeParam, placeholder, leftIcon, value, onSelect
113
116
  const typography = typographyMap[size];
114
117
  const typographyStyles = getTypographyStyles(typography);
115
118
  const renderOptionLabel = renderOptionLabelParam || defaultRenderOptionLabel;
116
- return (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ ref: refs.setReference,
119
+ return (_jsxs(Box, Object.assign({ sx: { position: 'relative' } }, { children: [_jsx(Label, Object.assign({ htmlFor: inputId, typography: labelTypographyMap[size], sx: {
120
+ position: 'absolute',
121
+ color: COLOR.ND_PROVOST_BLUE,
122
+ backgroundColor: COLOR.WHITE,
123
+ left: '0.5rem',
124
+ lineHeight: 1,
125
+ zIndex: theme.zIndex.LABEL,
126
+ px: size === INPUT_SIZE.SM ? 1 : 2,
127
+ top: labelOffsetMap[size],
128
+ } }, { children: label })), _jsx(Button, Object.assign({ ref: refs.setReference,
117
129
  // A11y attributes
118
130
  role: "combobox", "aria-controls": listboxId, "aria-expanded": isOpen, "aria-autocomplete": "none", "aria-activedescendant": isOpen && stagedOptionValue
119
131
  ? getOptionId(stagedOptionValue)
@@ -133,5 +145,7 @@ export function Select({ size: sizeParam, placeholder, leftIcon, value, onSelect
133
145
  } }, typographyStyles), sx), leftIcon: leftIcon, rightIcon: ArrowDropDownIcon }, { children: currentOption ? renderOptionLabel(currentOption) : placeholder })), isOpen && (_jsx(ListBox, { id: listboxId, options: options, selected: value, focused: stagedOptionValue, selectOption: (option) => {
134
146
  onSelectOption && onSelectOption(option.value);
135
147
  close();
136
- }, ref: refs.setFloating, renderOption: renderOption, style: Object.assign(Object.assign({ minWidth: dropdownMinWidth }, floatingStyles), { zIndex: 1 }) }))] }));
148
+ }, ref: refs.setFloating, renderOption: renderOption, sx: {
149
+ zIndex: theme.zIndex.DROPDOWN,
150
+ }, style: Object.assign(Object.assign({ minWidth: dropdownMinWidth }, floatingStyles), { zIndex: 1 }) }))] })));
137
151
  }
@@ -4,3 +4,4 @@ declare const meta: Meta<typeof TextInput>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof TextInput>;
6
6
  export declare const Default: Story;
7
+ export declare const WithLabel: Story;
@@ -18,8 +18,11 @@ const sizes = [
18
18
  ];
19
19
  const StatefulInput = (props) => {
20
20
  const [value, setValue] = useState('');
21
- return (_jsx(TextInput, Object.assign({ value: value, onChange: setValue, placeholder: "test" }, props)));
21
+ return _jsx(TextInput, Object.assign({ value: value, onChange: setValue }, props));
22
22
  };
23
23
  export const Default = {
24
- render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, Object.assign({ size: HEADING_SIZE.MD }, { children: size.label })), _jsx(StatefulInput, { size: size.size, leftIcon: SearchIcon, placeholder: "Placeholder", sx: { mt: 1 } })] }))) })),
24
+ render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, Object.assign({ size: HEADING_SIZE.MD }, { children: size.label })), _jsx(StatefulInput, { size: size.size, leftIcon: SearchIcon, placeholder: "Placeholder", sx: { mt: 2 } })] }))) })),
25
+ };
26
+ export const WithLabel = {
27
+ render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, Object.assign({ size: HEADING_SIZE.MD }, { children: size.label })), _jsx(StatefulInput, { size: size.size, leftIcon: SearchIcon, label: "Search", sx: { mt: 2 } })] }))) })),
25
28
  };
@@ -1,15 +1,27 @@
1
1
  /** @jsxImportSource theme-ui */
2
2
  import React from 'react';
3
+ import { TYPOGRAPHY_TYPE } from '../../../../theme/typography';
3
4
  import { StyledElementProps } from '../../../../theme';
4
5
  export declare enum INPUT_SIZE {
5
6
  SM = "sm",
6
7
  MD = "md",
7
8
  LG = "lg"
8
9
  }
10
+ export declare const labelTypographyMap: {
11
+ sm: TYPOGRAPHY_TYPE;
12
+ md: TYPOGRAPHY_TYPE;
13
+ lg: TYPOGRAPHY_TYPE;
14
+ };
15
+ export declare const labelOffsetMap: {
16
+ sm: string;
17
+ md: string;
18
+ lg: string;
19
+ };
9
20
  export type TextInputProps = StyledElementProps<HTMLInputElement, {
10
21
  size?: INPUT_SIZE;
11
22
  leftIcon?: React.FC<any>;
12
23
  inline?: boolean;
24
+ label?: string;
13
25
  value: string;
14
26
  onChange?: (value: string) => void;
15
27
  onChangeRaw?: (e: string | React.ChangeEvent) => void;
@@ -21,7 +33,10 @@ export declare const TextInput: React.ForwardRefExoticComponent<{
21
33
  size?: INPUT_SIZE | undefined;
22
34
  leftIcon?: React.FC<any> | undefined;
23
35
  inline?: boolean | undefined;
36
+ label?: string | undefined;
24
37
  value: string;
25
38
  onChange?: ((value: string) => void) | undefined;
26
39
  onChangeRaw?: ((e: string | React.ChangeEvent) => void) | undefined;
40
+ } & {
41
+ htmlFor?: string | undefined;
27
42
  } & React.RefAttributes<any>>;
@@ -16,6 +16,8 @@ import { TYPOGRAPHY_TYPE, getIconSize, getTypographyStyles, } from '../../../../
16
16
  import { useTheme } from '../../../../theme';
17
17
  import { Icon } from '../../Icon';
18
18
  import { COLOR } from '../../../../theme/colors';
19
+ import { Label } from '../../text/Label';
20
+ import { useUniqueHtmlId } from '../../../../utils/hooks/useUniqueHtmlId';
19
21
  export var INPUT_SIZE;
20
22
  (function (INPUT_SIZE) {
21
23
  INPUT_SIZE["SM"] = "sm";
@@ -27,18 +29,29 @@ const typographyMap = {
27
29
  [INPUT_SIZE.MD]: TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM,
28
30
  [INPUT_SIZE.LG]: TYPOGRAPHY_TYPE.PARAGRAPH_LARGE,
29
31
  };
32
+ export const labelTypographyMap = {
33
+ [INPUT_SIZE.SM]: TYPOGRAPHY_TYPE.CONTROL_SMALL,
34
+ [INPUT_SIZE.MD]: TYPOGRAPHY_TYPE.CONTROL_SMALL,
35
+ [INPUT_SIZE.LG]: TYPOGRAPHY_TYPE.CONTROL_MEDIUM,
36
+ };
37
+ export const labelOffsetMap = {
38
+ [INPUT_SIZE.SM]: '-0.375rem',
39
+ [INPUT_SIZE.MD]: '-0.45rem',
40
+ [INPUT_SIZE.LG]: '-0.5rem',
41
+ };
30
42
  const defaultPaddingX = {
31
43
  [INPUT_SIZE.SM]: 2,
32
44
  [INPUT_SIZE.MD]: 3,
33
45
  [INPUT_SIZE.LG]: 3,
34
46
  };
35
47
  const defaultHeight = {
36
- [INPUT_SIZE.SM]: '2rem',
48
+ [INPUT_SIZE.SM]: '2.25rem',
37
49
  [INPUT_SIZE.MD]: '2.5rem',
38
50
  [INPUT_SIZE.LG]: '3rem',
39
51
  };
40
52
  export const TextInput = React.forwardRef((_a, ref) => {
41
- var { value, onChange, onChangeRaw, onClick, inline, size: sizeParam, leftIcon, sx } = _a, rest = __rest(_a, ["value", "onChange", "onChangeRaw", "onClick", "inline", "size", "leftIcon", "sx"]);
53
+ var { value, label, onChange, onChangeRaw, onClick, inline, size: sizeParam, leftIcon, sx } = _a, rest = __rest(_a, ["value", "label", "onChange", "onChangeRaw", "onClick", "inline", "size", "leftIcon", "sx"]);
54
+ const id = useUniqueHtmlId('text-input');
42
55
  const theme = useTheme();
43
56
  const size = sizeParam || INPUT_SIZE.MD;
44
57
  const display = inline === false ? 'flex' : 'inline-flex';
@@ -46,8 +59,8 @@ export const TextInput = React.forwardRef((_a, ref) => {
46
59
  const height = defaultHeight[size];
47
60
  const typography = typographyMap[size];
48
61
  const typographyStyles = getTypographyStyles(typography);
49
- return (_jsxs("div", Object.assign({ ref: ref, onClick: onClick, sx: Object.assign(Object.assign({ height,
50
- display, px: paddingX, border: 'solid 1px', borderColor: COLOR.GRAY, borderRadius: '4px', flexDirection: 'row', alignItems: 'center', ':hover': {
62
+ return (_jsxs("div", Object.assign({ ref: ref, onClick: onClick, id: id, sx: Object.assign(Object.assign({ height,
63
+ display, px: paddingX, border: 'solid 1px', borderColor: COLOR.GRAY, borderRadius: '4px', flexDirection: 'row', position: 'relative', alignItems: 'center', ':hover': {
51
64
  boxShadow: theme.boxShadow.NORMAL,
52
65
  }, ':focus': {
53
66
  boxShadow: theme.boxShadow.NORMAL,
@@ -57,7 +70,16 @@ export const TextInput = React.forwardRef((_a, ref) => {
57
70
  } })), _jsx("input", Object.assign({ value: value, onChange: (event) => {
58
71
  onChange && onChange(event.target.value);
59
72
  onChangeRaw && onChangeRaw(event);
60
- }, sx: Object.assign(Object.assign({ px: 0, py: 0, border: 'none' }, typographyStyles), { ':focus': {
73
+ }, sx: Object.assign(Object.assign({ px: 0, py: 0, width: '100%', border: 'none' }, typographyStyles), { ':focus': {
61
74
  outline: 'none',
62
- } }) }, rest))] })));
75
+ } }) }, rest)), label && (_jsx(Label, Object.assign({ htmlFor: id, typography: labelTypographyMap[size], sx: {
76
+ position: 'absolute',
77
+ color: COLOR.ND_PROVOST_BLUE,
78
+ backgroundColor: COLOR.WHITE,
79
+ left: '0.5rem',
80
+ lineHeight: 1,
81
+ zIndex: theme.zIndex.LABEL,
82
+ px: size === INPUT_SIZE.SM ? 1 : 2,
83
+ top: labelOffsetMap[size],
84
+ } }, { children: label })))] })));
63
85
  });
@@ -26,6 +26,8 @@ export declare const ListBox: <Value extends React.Key = string, Option extends
26
26
  onUpPress?: (() => void) | undefined;
27
27
  onSelect?: (() => void) | undefined;
28
28
  onBlur?: (() => void) | undefined;
29
+ } & {
30
+ htmlFor?: string | undefined;
29
31
  } & {
30
32
  ref?: React.ForwardedRef<HTMLDivElement> | undefined;
31
33
  }) => any;
@@ -17,4 +17,6 @@ export declare const Pill: React.ForwardRefExoticComponent<{
17
17
  type?: PILL_TYPE | undefined;
18
18
  color?: COLOR | undefined;
19
19
  icon?: React.FC<any> | undefined;
20
+ } & {
21
+ htmlFor?: string | undefined;
20
22
  } & React.RefAttributes<HTMLButtonElement>>;
@@ -14,6 +14,7 @@ export declare const SIZE_TYPOGRAPHY_MAP: {
14
14
  };
15
15
  type LabelProps = StyledElementProps<HTMLLabelElement, {
16
16
  size?: LABEL_SIZE;
17
+ typography?: TYPOGRAPHY_TYPE;
17
18
  standalone?: boolean;
18
19
  }>;
19
20
  export declare const Label: React.FC<LabelProps>;
@@ -25,10 +25,10 @@ export const SIZE_TYPOGRAPHY_MAP = {
25
25
  [LABEL_SIZE.LG]: TYPOGRAPHY_TYPE.CONTROL_LARGE,
26
26
  };
27
27
  export const Label = (_a) => {
28
- var { sx, size, standalone } = _a, rest = __rest(_a, ["sx", "size", "standalone"]);
28
+ var { sx, size, standalone, typography: typographyParam } = _a, rest = __rest(_a, ["sx", "size", "standalone", "typography"]);
29
29
  const { labelId, labelTargetId, type: groupType } = useGroup();
30
30
  const { flagInDevelopment } = useEnvironment();
31
- const typography = SIZE_TYPOGRAPHY_MAP[size || LABEL_SIZE.MD];
31
+ const typography = typographyParam || SIZE_TYPOGRAPHY_MAP[size || LABEL_SIZE.MD];
32
32
  if (groupType !== GROUP_TYPE.GROUP && !standalone) {
33
33
  flagInDevelopment('Label component should be used within a Group component with property type={GROUP_TYPE.GROUP} or given the standalone flag');
34
34
  }
@@ -1,8 +1,10 @@
1
1
  /** @jsxImportSource theme-ui */
2
2
  import React from 'react';
3
+ import { TYPOGRAPHY_TYPE } from '../../../../theme/typography';
3
4
  import { StyledElementProps } from '../../../../theme';
4
5
  type ParagraphProps = StyledElementProps<HTMLSpanElement, {
5
6
  size?: PARAGRAPH_SIZE;
7
+ typography?: TYPOGRAPHY_TYPE;
6
8
  }>;
7
9
  export declare enum PARAGRAPH_SIZE {
8
10
  SM = "sm",
@@ -23,7 +23,7 @@ const SIZE_TYPOGRAPHY_MAP = {
23
23
  [PARAGRAPH_SIZE.LG]: TYPOGRAPHY_TYPE.PARAGRAPH_LARGE,
24
24
  };
25
25
  export const Paragraph = (_a) => {
26
- var { size, sx } = _a, rest = __rest(_a, ["size", "sx"]);
27
- const typography = SIZE_TYPOGRAPHY_MAP[size || PARAGRAPH_SIZE.MD];
26
+ var { size, typography: typographyParam, sx } = _a, rest = __rest(_a, ["size", "typography", "sx"]);
27
+ const typography = typographyParam || SIZE_TYPOGRAPHY_MAP[size || PARAGRAPH_SIZE.MD];
28
28
  return (_jsx("div", Object.assign({ sx: Object.assign(Object.assign(Object.assign({}, getTypographyStyles(typography)), { my: 1 }), sx) }, rest)));
29
29
  };
@@ -1,5 +1,6 @@
1
1
  export declare enum COLOR {
2
2
  TEXT = "text",
3
+ LIGHT_TEXT = "lightText",
3
4
  BACKGROUND = "background",
4
5
  TRANSPARENT = "transparent",
5
6
  PRIMARY = "primary",
@@ -1,6 +1,7 @@
1
1
  export var COLOR;
2
2
  (function (COLOR) {
3
3
  COLOR["TEXT"] = "text";
4
+ COLOR["LIGHT_TEXT"] = "lightText";
4
5
  COLOR["BACKGROUND"] = "background";
5
6
  COLOR["TRANSPARENT"] = "transparent";
6
7
  COLOR["PRIMARY"] = "primary";
@@ -48,6 +49,7 @@ export var COLOR;
48
49
  })(COLOR || (COLOR = {}));
49
50
  export const colors = {
50
51
  [COLOR.TEXT]: '#333333',
52
+ [COLOR.LIGHT_TEXT]: '#767676',
51
53
  [COLOR.BACKGROUND]: '#ffffff',
52
54
  [COLOR.TRANSPARENT]: 'rgba(0,0,0,0)',
53
55
  [COLOR.PRIMARY]: '#0c2340',
@@ -59,7 +61,7 @@ export const colors = {
59
61
  [COLOR.WHITE]: '#ffffff',
60
62
  [COLOR.BLACK]: '#000000',
61
63
  [COLOR.DARK_GRAY]: '#333333',
62
- [COLOR.GRAY]: '#555555',
64
+ [COLOR.GRAY]: '#767676',
63
65
  [COLOR.LIGHT_GRAY]: '#d2d2d2',
64
66
  [COLOR.EXTRA_LIGHT_GRAY]: '#e2e2e2',
65
67
  [COLOR.EXTRA_EXTRA_LIGHT_GRAY]: '#f2f2f2',
@@ -2,3 +2,8 @@ export declare enum BOX_SHADOW {
2
2
  NORMAL = "0 0 8px #dfdfdf",
3
3
  EMPHASIZED = "0 0 12px #d3d3d3"
4
4
  }
5
+ export declare enum Z_INDEX {
6
+ NORMAL = 1,
7
+ LABEL = 2,
8
+ DROPDOWN = 3
9
+ }
@@ -4,3 +4,9 @@ export var BOX_SHADOW;
4
4
  BOX_SHADOW["NORMAL"] = "0 0 8px #dfdfdf";
5
5
  BOX_SHADOW["EMPHASIZED"] = "0 0 12px #d3d3d3";
6
6
  })(BOX_SHADOW || (BOX_SHADOW = {}));
7
+ export var Z_INDEX;
8
+ (function (Z_INDEX) {
9
+ Z_INDEX[Z_INDEX["NORMAL"] = 1] = "NORMAL";
10
+ Z_INDEX[Z_INDEX["LABEL"] = 2] = "LABEL";
11
+ Z_INDEX[Z_INDEX["DROPDOWN"] = 3] = "DROPDOWN";
12
+ })(Z_INDEX || (Z_INDEX = {}));
@@ -2,12 +2,13 @@ import { PropsWithChildren } from 'react';
2
2
  import { ThemeUICSSObject } from 'theme-ui';
3
3
  import { FONT, FONT_SIZE, FONT_WEIGHT, LINE_HEIGHT } from './typography';
4
4
  import { COLOR } from './colors';
5
- import { BOX_SHADOW } from './custom';
5
+ import { BOX_SHADOW, Z_INDEX } from './custom';
6
6
  export declare const BREAKPOINTS: string[];
7
7
  export declare const SPACING: string[];
8
8
  export declare const theme: {
9
9
  colors: {
10
10
  text: string;
11
+ lightText: string;
11
12
  background: string;
12
13
  transparent: string;
13
14
  primary: string;
@@ -56,6 +57,7 @@ export declare const theme: {
56
57
  space: string[];
57
58
  boxShadow: typeof BOX_SHADOW;
58
59
  breakpoints: string[];
60
+ zIndex: typeof Z_INDEX;
59
61
  fonts: {
60
62
  branded: string;
61
63
  branded2: string;
@@ -90,16 +92,19 @@ export type StylesProp = ThemeUICSSObject & {
90
92
  fontSize?: FONT_SIZE;
91
93
  font?: FONT;
92
94
  fontWeight?: FONT_WEIGHT;
93
- lineHeight?: LINE_HEIGHT;
95
+ lineHeight?: LINE_HEIGHT | number;
94
96
  boxShadow?: BOX_SHADOW;
95
97
  };
96
98
  export type StyledElementProps<E extends Element, CustomProps = object, Children = React.ReactNode> = {
97
99
  sx?: StylesProp;
98
100
  children?: Children;
99
- } & Omit<React.HTMLAttributes<E>, 'children' | 'onChange'> & CustomProps;
101
+ } & Omit<React.HTMLAttributes<E>, 'children' | 'onChange'> & CustomProps & {
102
+ htmlFor?: string;
103
+ };
100
104
  export declare const useTheme: () => {
101
105
  colors: {
102
106
  text: string;
107
+ lightText: string;
103
108
  background: string;
104
109
  transparent: string;
105
110
  primary: string;
@@ -148,6 +153,7 @@ export declare const useTheme: () => {
148
153
  space: string[];
149
154
  boxShadow: typeof BOX_SHADOW;
150
155
  breakpoints: string[];
156
+ zIndex: typeof Z_INDEX;
151
157
  fonts: {
152
158
  branded: string;
153
159
  branded2: string;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ThemeUIProvider, useThemeUI } from 'theme-ui';
3
3
  import { fontStyles, } from './typography';
4
4
  import { colors } from './colors';
5
- import { BOX_SHADOW } from './custom';
5
+ import { BOX_SHADOW, Z_INDEX } from './custom';
6
6
  export const BREAKPOINTS = ['576px', '768px', '992px', '1200px', '1400px'];
7
7
  export const SPACING = [
8
8
  '0rem',
@@ -15,7 +15,7 @@ export const SPACING = [
15
15
  '3rem',
16
16
  '4rem',
17
17
  ];
18
- export const theme = Object.assign(Object.assign({}, fontStyles), { colors, space: SPACING, boxShadow: BOX_SHADOW, breakpoints: BREAKPOINTS });
18
+ export const theme = Object.assign(Object.assign({}, fontStyles), { colors, space: SPACING, boxShadow: BOX_SHADOW, breakpoints: BREAKPOINTS, zIndex: Z_INDEX });
19
19
  export const useTheme = () => {
20
20
  const { theme } = useThemeUI();
21
21
  return theme;
@@ -19,12 +19,12 @@ export var FONT_SIZE;
19
19
  })(FONT_SIZE || (FONT_SIZE = {}));
20
20
  export const getIconSize = (fontSize) => {
21
21
  return {
22
- [FONT_SIZE.XS]: FONT_SIZE.MD,
23
- [FONT_SIZE.SM]: FONT_SIZE.LG,
24
- [FONT_SIZE.MS]: FONT_SIZE.XL,
25
- [FONT_SIZE.MD]: FONT_SIZE.XL,
26
- [FONT_SIZE.ML]: FONT_SIZE.XL,
27
- [FONT_SIZE.LG]: FONT_SIZE.XXL,
22
+ [FONT_SIZE.XS]: FONT_SIZE.SM,
23
+ [FONT_SIZE.SM]: FONT_SIZE.SM,
24
+ [FONT_SIZE.MS]: FONT_SIZE.MD,
25
+ [FONT_SIZE.MD]: FONT_SIZE.MD,
26
+ [FONT_SIZE.ML]: FONT_SIZE.LG,
27
+ [FONT_SIZE.LG]: FONT_SIZE.LG,
28
28
  [FONT_SIZE.XL]: FONT_SIZE.XXL,
29
29
  [FONT_SIZE.XXL]: FONT_SIZE.XXL,
30
30
  }[fontSize];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndlib/component-library",
3
- "version": "0.0.32",
3
+ "version": "0.0.34",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "files": [