@veracity/vui 0.0.4 → 0.0.6

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.
@@ -24,7 +24,7 @@ exports.AlertButton = core_1.forwardRef(function (props, ref) {
24
24
  var alertProps = (_a = context_1.useAlert()) !== null && _a !== void 0 ? _a : {};
25
25
  var mergedProps = __assign(__assign({}, alertProps), props);
26
26
  var styles = core_1.useStyleConfig('Alert', mergedProps);
27
- return (react_1.default.createElement(button_1.default, __assign({ className: "vui-alertButton", colorScheme: mergedProps.colorScheme, ml: 0.5, mr: -0.5, ref: ref, size: "sm" }, styles.button, props)));
27
+ return (react_1.default.createElement(button_1.default, __assign({ className: "vui-alertButton", colorScheme: mergedProps.colorScheme, ml: 1, mr: -0.5, ref: ref, size: "sm" }, styles.button, props)));
28
28
  });
29
29
  exports.AlertButton.displayName = 'AlertButton';
30
30
  exports.default = exports.AlertButton;
@@ -1,4 +1,5 @@
1
1
  import { HTMLAttributes } from 'react';
2
+ import { ChangeEventHandler, FocusEventHandler } from '../core';
2
3
  import { IconProp } from '../icon';
3
4
  import { BackgroundColorProps, BordersProps, FlexboxesProps, SizingProps, SpaceProps, TransitionsProps } from '../system';
4
5
  import { ThemingProps } from '../theme';
@@ -14,9 +15,9 @@ export interface CheckboxProps extends CheckboxStyleProps, ThemingProps<'Checkbo
14
15
  isIndeterminate?: boolean;
15
16
  label?: string;
16
17
  name?: string;
17
- onBlur?: (event: React.ChangeEvent<HTMLInputElement>) => void;
18
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
19
- onFocus?: (event: React.ChangeEvent<HTMLInputElement>) => void;
18
+ onBlur?: FocusEventHandler;
19
+ onChange?: ChangeEventHandler;
20
+ onFocus?: FocusEventHandler;
20
21
  required?: boolean;
21
22
  value?: number | string;
22
23
  }
@@ -1,13 +1,13 @@
1
- /// <reference types="react" />
1
+ import { ChangeEventHandler, FocusEventHandler } from '../core';
2
2
  import { FlexboxesProps, SizingProps, SpaceProps } from '../system';
3
3
  import { ThemingProps } from '../theme';
4
4
  export interface CheckboxGroupProps extends CheckboxGroupStyleProps, ThemingProps<'Checkbox'> {
5
5
  colorScheme?: 'blue' | 'green' | 'prussian' | 'red';
6
6
  disabled?: boolean;
7
7
  name?: string;
8
- onBlur?: (event: React.ChangeEvent<HTMLInputElement>) => void;
9
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
10
- onFocus?: (event: React.ChangeEvent<HTMLInputElement>) => void;
8
+ onBlur?: FocusEventHandler;
9
+ onChange?: ChangeEventHandler;
10
+ onFocus?: FocusEventHandler;
11
11
  row?: boolean;
12
12
  }
13
13
  export interface CheckboxGroupStyleProps extends FlexboxesProps, SizingProps, SpaceProps {
package/core/resetCSS.js CHANGED
@@ -5,5 +5,5 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  var styled_components_1 = require("styled-components");
8
- exports.default = styled_components_1.createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\nhtml {\n\tbox-sizing: border-box;\n\tline-height: 1.5;\n\t-webkit-text-size-adjust: 100%;\n}\n\n*, *::before, *::after {\n\tborder-style: solid;\n\tborder-width: 0;\n\tbox-sizing: inherit;\n}\n\nbody {\n\tmargin: 0;\n}\n\na {\n\tbackground-color: transparent;\n\ttext-decoration: none;\n}\n\nabbr[title] {\n\tborder-bottom: none;\n\ttext-decoration: underline dotted;\n}\n\nb, strong {\n\tfont-weight: bolder;\n}\n\nbutton {\n\tcursor: pointer;\n\t-webkit-appearance: button;\n}\n\nbutton, input, optgroup, select, textarea {\n\tfont-family: inherit;\n\tfont-size: 100%;\n\tmargin: 0;\n}\n\nbutton, select {\n\ttext-transform: none;\n}\n\ncode, kbd, pre, samp {\n\tfont-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;\n\tfont-size: 1em;\n}\n\ndetails {\n\tdisplay: block;\n}\n\nfieldset {\n\tpadding: 0.35em 0.75em 0.625em;\n}\n\nh1, h2, h3, h4, h5, h6, p, hr, dl, dd, blockquote, figure, pre {\n\tmargin: 0;\n}\n\nh1, h2, h3, h4, h5, h6 {\n\tfont-size: inherit;\n\tfont-weight: inherit;\n}\n\nhr {\n\tcolor: inherit;\n\theight: 0;\n}\n\nimg {\n\tborder-style: none;\n}\n\nimg, svg, video, canvas, audio, iframe, embed, object {\n\tdisplay: block;\n}\n\nlegend {\n\tcolor: inherit;\n\tdisplay: table;\n\tmax-width: 100%;\n\tpadding: 0;\n\twhite-space: normal;\n}\n\nmain {\n\tdisplay: block;\n}\n\nol, ul {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\nprogress {\n\tvertical-align: baseline;\n}\n\nsummary {\n\tdisplay: list-item;\n}\n\nsmall {\n\tfont-size: 80%;\n}\n\nsub, sup {\n\tfont-size: 75%;\n\tline-height: 0;\n\tposition: relative;\n\tvertical-align: baseline;\n}\n\nsub {\n\tbottom: -0.25em;\n}\n\nsup {\n\ttop: -0.5em;\n}\n\ntable {\n\ttext-indent: 0;\n\tborder-color: inherit;\n}\n\ntemplate {\n\tdisplay: none;\n}\n\ntextarea {\n\toverflow: auto;\n}\n\n::-moz-focus-inner {\n\tborder-style: none;\n\tpadding: 0;\n}\n\n::-webkit-file-upload-button {\n\tfont: inherit;\n\t-webkit-appearance: button;\n}\n\n[type=checkbox], [type=radio] {\n\tpadding: 0;\n}\n\n[type=number]::-webkit-inner-spin-button,\n[type=number]::-webkit-outer-spin-button {\n\theight: auto;\n}\n\n[type=search] {\n\toutline-offset: -2px;\n\t-webkit-appearance: textfield;\n}\n\n[type=search]::-webkit-search-decoration {\n\t-webkit-appearance: none;\n}\n\n[hidden] {\n\tdisplay: none;\n}\n"], ["\nhtml {\n\tbox-sizing: border-box;\n\tline-height: 1.5;\n\t-webkit-text-size-adjust: 100%;\n}\n\n*, *::before, *::after {\n\tborder-style: solid;\n\tborder-width: 0;\n\tbox-sizing: inherit;\n}\n\nbody {\n\tmargin: 0;\n}\n\na {\n\tbackground-color: transparent;\n\ttext-decoration: none;\n}\n\nabbr[title] {\n\tborder-bottom: none;\n\ttext-decoration: underline dotted;\n}\n\nb, strong {\n\tfont-weight: bolder;\n}\n\nbutton {\n\tcursor: pointer;\n\t-webkit-appearance: button;\n}\n\nbutton, input, optgroup, select, textarea {\n\tfont-family: inherit;\n\tfont-size: 100%;\n\tmargin: 0;\n}\n\nbutton, select {\n\ttext-transform: none;\n}\n\ncode, kbd, pre, samp {\n\tfont-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;\n\tfont-size: 1em;\n}\n\ndetails {\n\tdisplay: block;\n}\n\nfieldset {\n\tpadding: 0.35em 0.75em 0.625em;\n}\n\nh1, h2, h3, h4, h5, h6, p, hr, dl, dd, blockquote, figure, pre {\n\tmargin: 0;\n}\n\nh1, h2, h3, h4, h5, h6 {\n\tfont-size: inherit;\n\tfont-weight: inherit;\n}\n\nhr {\n\tcolor: inherit;\n\theight: 0;\n}\n\nimg {\n\tborder-style: none;\n}\n\nimg, svg, video, canvas, audio, iframe, embed, object {\n\tdisplay: block;\n}\n\nlegend {\n\tcolor: inherit;\n\tdisplay: table;\n\tmax-width: 100%;\n\tpadding: 0;\n\twhite-space: normal;\n}\n\nmain {\n\tdisplay: block;\n}\n\nol, ul {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\nprogress {\n\tvertical-align: baseline;\n}\n\nsummary {\n\tdisplay: list-item;\n}\n\nsmall {\n\tfont-size: 80%;\n}\n\nsub, sup {\n\tfont-size: 75%;\n\tline-height: 0;\n\tposition: relative;\n\tvertical-align: baseline;\n}\n\nsub {\n\tbottom: -0.25em;\n}\n\nsup {\n\ttop: -0.5em;\n}\n\ntable {\n\ttext-indent: 0;\n\tborder-color: inherit;\n}\n\ntemplate {\n\tdisplay: none;\n}\n\ntextarea {\n\toverflow: auto;\n}\n\n::-moz-focus-inner {\n\tborder-style: none;\n\tpadding: 0;\n}\n\n::-webkit-file-upload-button {\n\tfont: inherit;\n\t-webkit-appearance: button;\n}\n\n[type=checkbox], [type=radio] {\n\tpadding: 0;\n}\n\n[type=number]::-webkit-inner-spin-button,\n[type=number]::-webkit-outer-spin-button {\n\theight: auto;\n}\n\n[type=search] {\n\toutline-offset: -2px;\n\t-webkit-appearance: textfield;\n}\n\n[type=search]::-webkit-search-decoration {\n\t-webkit-appearance: none;\n}\n\n[hidden] {\n\tdisplay: none;\n}\n"])));
8
+ exports.default = styled_components_1.createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\nhtml {\n\tbox-sizing: border-box;\n\tline-height: 1.4;\n\t-webkit-text-size-adjust: 100%;\n}\n\n*, *::before, *::after {\n\tborder-style: solid;\n\tborder-width: 0;\n\tbox-sizing: inherit;\n}\n\nbody {\n\tmargin: 0;\n}\n\na {\n\tbackground-color: transparent;\n\tcolor: inherit;\n\ttext-decoration: none;\n}\n\nabbr[title] {\n\tborder-bottom: none;\n\ttext-decoration: underline dotted;\n}\n\nb, strong {\n\tfont-weight: bolder;\n}\n\nbutton {\n\tcursor: pointer;\n\t-webkit-appearance: button;\n}\n\nbutton, input, optgroup, select, textarea {\n\tfont-family: inherit;\n\tfont-size: 100%;\n\tmargin: 0;\n}\n\nbutton, select {\n\ttext-transform: none;\n}\n\ncode, kbd, pre, samp {\n\tfont-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;\n\tfont-size: 1em;\n}\n\ndetails {\n\tdisplay: block;\n}\n\nfieldset {\n\tpadding: 0.35em 0.75em 0.625em;\n}\n\nh1, h2, h3, h4, h5, h6, p, hr, dl, dd, blockquote, figure, pre {\n\tmargin: 0;\n}\n\nh1, h2, h3, h4, h5, h6 {\n\tfont-size: inherit;\n\tfont-weight: inherit;\n}\n\nhr {\n\tcolor: inherit;\n\theight: 0;\n}\n\nimg {\n\tborder-style: none;\n}\n\nimg, svg, video, canvas, audio, iframe, embed, object {\n\tdisplay: block;\n}\n\nlegend {\n\tcolor: inherit;\n\tdisplay: table;\n\tmax-width: 100%;\n\tpadding: 0;\n\twhite-space: normal;\n}\n\nmain {\n\tdisplay: block;\n}\n\nol, ul {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\nprogress {\n\tvertical-align: baseline;\n}\n\nsummary {\n\tdisplay: list-item;\n}\n\nsmall {\n\tfont-size: 80%;\n}\n\nsub, sup {\n\tfont-size: 75%;\n\tline-height: 0;\n\tposition: relative;\n\tvertical-align: baseline;\n}\n\nsub {\n\tbottom: -0.25em;\n}\n\nsup {\n\ttop: -0.5em;\n}\n\ntable {\n\ttext-indent: 0;\n\tborder-color: inherit;\n}\n\ntemplate {\n\tdisplay: none;\n}\n\ntextarea {\n\toverflow: auto;\n}\n\n::-moz-focus-inner {\n\tborder-style: none;\n\tpadding: 0;\n}\n\n::-webkit-file-upload-button {\n\tfont: inherit;\n\t-webkit-appearance: button;\n}\n\n[type=checkbox], [type=radio] {\n\tpadding: 0;\n}\n\n[type=number]::-webkit-inner-spin-button,\n[type=number]::-webkit-outer-spin-button {\n\theight: auto;\n}\n\n[type=search] {\n\toutline-offset: -2px;\n\t-webkit-appearance: textfield;\n}\n\n[type=search]::-webkit-search-decoration {\n\t-webkit-appearance: none;\n}\n\n[hidden] {\n\tdisplay: none;\n}\n"], ["\nhtml {\n\tbox-sizing: border-box;\n\tline-height: 1.4;\n\t-webkit-text-size-adjust: 100%;\n}\n\n*, *::before, *::after {\n\tborder-style: solid;\n\tborder-width: 0;\n\tbox-sizing: inherit;\n}\n\nbody {\n\tmargin: 0;\n}\n\na {\n\tbackground-color: transparent;\n\tcolor: inherit;\n\ttext-decoration: none;\n}\n\nabbr[title] {\n\tborder-bottom: none;\n\ttext-decoration: underline dotted;\n}\n\nb, strong {\n\tfont-weight: bolder;\n}\n\nbutton {\n\tcursor: pointer;\n\t-webkit-appearance: button;\n}\n\nbutton, input, optgroup, select, textarea {\n\tfont-family: inherit;\n\tfont-size: 100%;\n\tmargin: 0;\n}\n\nbutton, select {\n\ttext-transform: none;\n}\n\ncode, kbd, pre, samp {\n\tfont-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;\n\tfont-size: 1em;\n}\n\ndetails {\n\tdisplay: block;\n}\n\nfieldset {\n\tpadding: 0.35em 0.75em 0.625em;\n}\n\nh1, h2, h3, h4, h5, h6, p, hr, dl, dd, blockquote, figure, pre {\n\tmargin: 0;\n}\n\nh1, h2, h3, h4, h5, h6 {\n\tfont-size: inherit;\n\tfont-weight: inherit;\n}\n\nhr {\n\tcolor: inherit;\n\theight: 0;\n}\n\nimg {\n\tborder-style: none;\n}\n\nimg, svg, video, canvas, audio, iframe, embed, object {\n\tdisplay: block;\n}\n\nlegend {\n\tcolor: inherit;\n\tdisplay: table;\n\tmax-width: 100%;\n\tpadding: 0;\n\twhite-space: normal;\n}\n\nmain {\n\tdisplay: block;\n}\n\nol, ul {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\nprogress {\n\tvertical-align: baseline;\n}\n\nsummary {\n\tdisplay: list-item;\n}\n\nsmall {\n\tfont-size: 80%;\n}\n\nsub, sup {\n\tfont-size: 75%;\n\tline-height: 0;\n\tposition: relative;\n\tvertical-align: baseline;\n}\n\nsub {\n\tbottom: -0.25em;\n}\n\nsup {\n\ttop: -0.5em;\n}\n\ntable {\n\ttext-indent: 0;\n\tborder-color: inherit;\n}\n\ntemplate {\n\tdisplay: none;\n}\n\ntextarea {\n\toverflow: auto;\n}\n\n::-moz-focus-inner {\n\tborder-style: none;\n\tpadding: 0;\n}\n\n::-webkit-file-upload-button {\n\tfont: inherit;\n\t-webkit-appearance: button;\n}\n\n[type=checkbox], [type=radio] {\n\tpadding: 0;\n}\n\n[type=number]::-webkit-inner-spin-button,\n[type=number]::-webkit-outer-spin-button {\n\theight: auto;\n}\n\n[type=search] {\n\toutline-offset: -2px;\n\t-webkit-appearance: textfield;\n}\n\n[type=search]::-webkit-search-decoration {\n\t-webkit-appearance: none;\n}\n\n[hidden] {\n\tdisplay: none;\n}\n"])));
9
9
  var templateObject_1;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ /** Merges component/element base props, custom props and 'as' prop */
3
+ export declare type ComponentProps<C extends React.ElementType, Props = {}> = RightJoinProps<React.ComponentPropsWithRef<C>, Props>;
4
+ /** Merges props definitions, overriding source keys */
5
+ export declare type RightJoinProps<SourceProps, OverrideProps> = OverrideProps & Omit<SourceProps, keyof OverrideProps>;
6
+ /** VUI Component definition supporting custom props, 'as' props and 'ref' */
7
+ export interface VuiComponent<C extends React.ElementType, Props = {}> {
8
+ <AsC extends React.ElementType>(props: ComponentProps<AsC, Props> & {
9
+ as: AsC;
10
+ }): JSX.Element;
11
+ <AsC extends React.ElementType>(props: ComponentProps<AsC, Props> & {
12
+ forwardedAs: AsC;
13
+ }): JSX.Element;
14
+ (props: ComponentProps<C, Props>): JSX.Element;
15
+ defaultProps?: Partial<ComponentProps<C, Props>>;
16
+ displayName?: string;
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface CreateContextOptions {
3
+ /** Message displayed when context is used outside of the provider */
4
+ errorMessage?: string;
5
+ /** Accessing context outside of provider won't throw error */
6
+ isOptional?: boolean;
7
+ /** Name of the context */
8
+ name?: string;
9
+ }
10
+ export declare type CreateContextReturn<T> = [React.Provider<T>, () => T];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ /** Type of change event defaulted to input element */
3
+ export declare type ChangeEvent<T = HTMLInputElement> = React.ChangeEvent<T>;
4
+ /** Type of change event handler defaulted to input element */
5
+ export declare type ChangeEventHandler<T = HTMLInputElement> = React.ChangeEventHandler<T>;
6
+ /** Type of blur/focus event defaulted to any html element */
7
+ export declare type FocusEvent<T = HTMLElement> = React.FocusEvent<T>;
8
+ /** Type of blur/focus event handler defaulted to any html element */
9
+ export declare type FocusEventHandler<T = HTMLElement> = React.FocusEventHandler<T>;
10
+ /** Type of mouse event defaulted to any html element */
11
+ export declare type MouseEvent<T = HTMLElement> = React.MouseEvent<T>;
12
+ /** Type of mouse event handler defaulted to any html element */
13
+ export declare type MouseEventHandler<T = HTMLElement> = React.MouseEventHandler<T>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from './component';
2
+ export * from './context';
3
+ export * from './events';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./component"), exports);
14
+ __exportStar(require("./context"), exports);
15
+ __exportStar(require("./events"), exports);
package/core/types.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  import React from 'react';
2
+ /** Type of change event defaulted to input element */
3
+ export declare type ChangeEvent<T = HTMLInputElement> = React.ChangeEvent<T>;
4
+ /** Type of change event handler defaulted to input element */
5
+ export declare type ChangeEventHandler<T = HTMLInputElement> = React.ChangeEventHandler<T>;
2
6
  export interface CreateContextOptions {
3
7
  /** Message displayed when context is used outside of the provider */
4
8
  errorMessage?: string;
@@ -16,7 +20,12 @@ export declare type ComponentProps<C extends React.ElementType, Props = {}> = Ri
16
20
  /** Merges component/element base props, custom props, 'as' prop and 'ref' */
17
21
  export declare type ComponentPropsWithRef<C extends React.ElementType, Props = {}> = RightJoinProps<React.ComponentPropsWithRef<C>, Props & {
18
22
  as?: C;
23
+ forwardedAs?: C;
19
24
  }>;
25
+ /** Type of blur/focus event defaulted to input element */
26
+ export declare type FocusEvent<T = HTMLInputElement> = React.FocusEvent<T>;
27
+ /** Type of blur/focus event handler defaulted to input element */
28
+ export declare type FocusEventHandler<T = HTMLInputElement> = React.FocusEventHandler<T>;
20
29
  /** Strips call signature from ForwardRefExoticComponent */
21
30
  export declare type ForwardRefExoticBase<P> = Pick<React.ForwardRefExoticComponent<P>, keyof React.ForwardRefExoticComponent<any>>;
22
31
  /** Merges two props definitions without conflicts */
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { inputLengths } from './consts';
3
+ import { ChangeEventHandler, FocusEventHandler } from '../core';
3
4
  import { IconProp } from '../icon';
4
5
  import { BackgroundColorProps, BordersProps, ColorProps, EffectsProps, FontSizeProps, SizingProps, SpaceProps, TransitionsProps } from '../system';
5
6
  import { ThemingProps } from '../theme';
@@ -21,9 +22,9 @@ export interface InputProps extends InputStyleProps, ThemingProps<'Input'> {
21
22
  itemRight?: React.ReactNode;
22
23
  length?: InputLength;
23
24
  name?: string;
24
- onBlur?: (event: React.ChangeEvent<HTMLInputElement>) => void;
25
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
26
- onFocus?: (event: React.ChangeEvent<HTMLInputElement>) => void;
25
+ onBlur?: FocusEventHandler;
26
+ onChange?: ChangeEventHandler;
27
+ onFocus?: FocusEventHandler;
27
28
  placeholder?: string;
28
29
  readOnly?: boolean;
29
30
  required?: boolean;
package/list/list.js CHANGED
@@ -57,7 +57,7 @@ var listIcon_1 = __importDefault(require("./listIcon"));
57
57
  var listItem_1 = __importDefault(require("./listItem"));
58
58
  var core_1 = require("../core");
59
59
  var utils_1 = require("../utils");
60
- var generator = styled_components_1.compose(styled_components_1.sizing, styled_components_1.space, styled_components_1.typography);
60
+ var generator = styled_components_1.compose(styled_components_1.flexboxes, styled_components_1.sizing, styled_components_1.space, styled_components_1.typography);
61
61
  exports.ListBase = styled_components_2.default.ul.withConfig(core_1.forwardPropConfig(generator))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t", "\n"], ["\n\t", "\n"])), generator);
62
62
  exports.List = core_1.forwardRef(function (props, ref) {
63
63
  var children = props.children, className = props.className, colorScheme = props.colorScheme, isInteractive = props.isInteractive, size = props.size, subheader = props.subheader, variant = props.variant, rest = __rest(props, ["children", "className", "colorScheme", "isInteractive", "size", "subheader", "variant"]);
@@ -1,4 +1,4 @@
1
- import { SizingProps, SpaceProps, TransitionsProps, TypographyProps } from '../system';
1
+ import { FlexboxesProps, SizingProps, SpaceProps, TransitionsProps, TypographyProps } from '../system';
2
2
  import { ThemingProps } from '../theme';
3
3
  export interface ListProps extends ListStyleProps, ThemingProps<'List'> {
4
4
  colorScheme?: 'blue' | 'grey';
@@ -6,5 +6,5 @@ export interface ListProps extends ListStyleProps, ThemingProps<'List'> {
6
6
  isInteractive?: boolean;
7
7
  subheader?: string;
8
8
  }
9
- export interface ListStyleProps extends SizingProps, SpaceProps, TransitionsProps, TypographyProps {
9
+ export interface ListStyleProps extends FlexboxesProps, SizingProps, SpaceProps, TransitionsProps, TypographyProps {
10
10
  }
package/list/listItem.js CHANGED
@@ -38,17 +38,20 @@ var listIcon_1 = __importDefault(require("./listIcon"));
38
38
  var core_1 = require("../core");
39
39
  var utils_1 = require("../utils");
40
40
  var generator = styled_components_1.compose(styled_components_1.backgroundColor, styled_components_1.borders, styled_components_1.flexboxes, styled_components_1.interactivity, styled_components_1.sizing, styled_components_1.space, styled_components_1.transitions, styled_components_1.typography);
41
- exports.ListItemBase = styled_components_2.default.li.withConfig(core_1.forwardPropConfig(generator))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: flex;\n\tline-height: normal;\n\toutline: none;\n\n\t&.disabled {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t\tuser-select: none;\n\t}\n\n\t", "\n"], ["\n\talign-items: center;\n\tdisplay: flex;\n\tline-height: normal;\n\toutline: none;\n\n\t&.disabled {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t\tuser-select: none;\n\t}\n\n\t", "\n"])), generator);
41
+ exports.ListItemBase = styled_components_2.default.li.withConfig(core_1.forwardPropConfig(generator))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tline-height: normal;\n\toutline: none;\n\n\t&[data-disabled='true'] {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t\tuser-select: none;\n\t}\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tline-height: normal;\n\toutline: none;\n\n\t&[data-disabled='true'] {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t\tuser-select: none;\n\t}\n\n\t", "\n"])), generator);
42
42
  exports.ListItem = core_1.forwardRef(function (props, ref) {
43
43
  var listProps = context_1.useList();
44
44
  var mergedProps = __assign(__assign({}, listProps), props);
45
- var children = mergedProps.children, className = mergedProps.className, disabled = mergedProps.disabled, iconRight = mergedProps.iconRight, iconLeft = mergedProps.iconLeft, _a = mergedProps.isInteractive, isInteractive = _a === void 0 ? props.onClick !== undefined : _a, isSelected = mergedProps.isSelected, onClick = mergedProps.onClick, rest = __rest(mergedProps, ["children", "className", "disabled", "iconRight", "iconLeft", "isInteractive", "isSelected", "onClick"]);
45
+ var children = mergedProps.children, center = mergedProps.center, centerH = mergedProps.centerH, _a = mergedProps.centerV, centerV = _a === void 0 ? true : _a, className = mergedProps.className, column = mergedProps.column, disabled = mergedProps.disabled, iconRight = mergedProps.iconRight, iconLeft = mergedProps.iconLeft, _b = mergedProps.isInteractive, isInteractive = _b === void 0 ? props.onClick !== undefined : _b, isSelected = mergedProps.isSelected, onClick = mergedProps.onClick, rest = __rest(mergedProps, ["children", "center", "centerH", "centerV", "className", "column", "disabled", "iconRight", "iconLeft", "isInteractive", "isSelected", "onClick"]);
46
46
  var styles = core_1.useStyleConfig('List', mergedProps);
47
- var _b = styles.item, activeBg = _b.activeBg, hoverBg = _b.hoverBg, itemStyles = __rest(_b, ["activeBg", "hoverBg"]);
47
+ var _c = styles.item, activeBg = _c.activeBg, hoverBg = _c.hoverBg, itemStyles = __rest(_c, ["activeBg", "hoverBg"]);
48
+ var alignItems = (center || (column ? centerH : centerV)) && 'center';
49
+ var flexDirection = column && 'column';
50
+ var justifyContent = (center || (column ? centerV : centerH)) && 'center';
48
51
  var interactiveProps = !disabled && isInteractive
49
52
  ? {
50
53
  cursor: 'pointer',
51
- focusVisibleRing: 3,
54
+ focusVisibleRing: 2,
52
55
  hoverBg: hoverBg,
53
56
  activeBg: activeBg,
54
57
  tabIndex: 0,
@@ -56,9 +59,13 @@ exports.ListItem = core_1.forwardRef(function (props, ref) {
56
59
  }
57
60
  : {};
58
61
  var aliasedProps = utils_1.filterUndefined({
59
- bg: isSelected ? hoverBg : undefined
62
+ alignItems: alignItems,
63
+ bg: isSelected ? hoverBg : undefined,
64
+ 'data-disabled': disabled,
65
+ flexDirection: flexDirection,
66
+ justifyContent: justifyContent
60
67
  });
61
- return (react_1.default.createElement(exports.ListItemBase, __assign({ className: utils_1.cs('vui-listItem', className, disabled && 'disabled'), onClick: !disabled ? onClick : undefined, px: 1, ref: ref, transitionDuration: "fast" }, itemStyles, interactiveProps, aliasedProps, rest),
68
+ return (react_1.default.createElement(exports.ListItemBase, __assign({ className: utils_1.cs('vui-listItem', className), onClick: !disabled ? onClick : undefined, px: 1, ref: ref, transitionDuration: "fast" }, itemStyles, interactiveProps, aliasedProps, rest),
62
69
  iconLeft && react_1.default.createElement(listIcon_1.default, { icon: iconLeft, mr: 1 }),
63
70
  children,
64
71
  iconRight && react_1.default.createElement(listIcon_1.default, { icon: iconRight, ml: "auto" })));
@@ -2,7 +2,11 @@ import { IconProp } from '../icon';
2
2
  import { BackgroundColorProps, FlexboxesProps, InteractivityProps, SizingProps, SpaceProps, TransitionsProps, TypographyProps } from '../system';
3
3
  import { ThemingProps } from '../theme';
4
4
  export interface ListItemProps extends ListItemStyleProps, ThemingProps<'List'> {
5
+ center?: boolean;
6
+ centerH?: boolean;
7
+ centerV?: boolean;
5
8
  colorScheme?: 'blue' | 'grey';
9
+ column?: boolean;
6
10
  disabled?: boolean;
7
11
  iconLeft?: IconProp;
8
12
  iconRight?: IconProp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veracity/vui",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Veracity UI components library based on Styled Components and @xstyled",
5
5
  "main": "index.js",
6
6
  "author": "Veracity",
@@ -1,4 +1,5 @@
1
1
  import { HTMLAttributes } from 'react';
2
+ import { ChangeEventHandler, FocusEventHandler } from '../core';
2
3
  import { IconProp } from '../icon';
3
4
  import { BackgroundColorProps, BordersProps, FlexboxesProps, SizingProps, SpaceProps, TransitionsProps } from '../system';
4
5
  import { ThemingProps } from '../theme';
@@ -12,9 +13,9 @@ export interface RadioProps extends RadioStyleProps, ThemingProps<'Radio'> {
12
13
  inputRef?: React.MutableRefObject<HTMLInputElement | null> | null;
13
14
  label?: string;
14
15
  name?: string;
15
- onBlur?: (event: React.ChangeEvent<HTMLInputElement>) => void;
16
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
17
- onFocus?: (event: React.ChangeEvent<HTMLInputElement>) => void;
16
+ onBlur?: FocusEventHandler;
17
+ onChange?: ChangeEventHandler;
18
+ onFocus?: FocusEventHandler;
18
19
  required?: boolean;
19
20
  value?: number | string;
20
21
  }
@@ -1,13 +1,13 @@
1
- /// <reference types="react" />
1
+ import { ChangeEventHandler, FocusEventHandler } from '../core';
2
2
  import { FlexboxesProps, SizingProps, SpaceProps } from '../system';
3
3
  import { ThemingProps } from '../theme';
4
4
  export interface RadioGroupProps extends RadioGroupStyleProps, ThemingProps<'Radio'> {
5
5
  colorScheme?: 'blue' | 'green' | 'prussian' | 'red';
6
6
  disabled?: boolean;
7
7
  name?: string;
8
- onBlur?: (event: React.ChangeEvent<HTMLInputElement>) => void;
9
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
10
- onFocus?: (event: React.ChangeEvent<HTMLInputElement>) => void;
8
+ onBlur?: FocusEventHandler;
9
+ onChange?: ChangeEventHandler;
10
+ onFocus?: FocusEventHandler;
11
11
  row?: boolean;
12
12
  value?: number | string;
13
13
  }
@@ -1,4 +1,5 @@
1
1
  import { HTMLAttributes } from 'react';
2
+ import { ChangeEventHandler, FocusEventHandler } from '../core';
2
3
  import { FlexboxesProps, SizingProps, SpaceProps, TransitionsProps } from '../system';
3
4
  import { ThemingProps } from '../theme';
4
5
  export interface SwitchProps extends SwitchStyleProps, ThemingProps<'Switch'> {
@@ -12,9 +13,9 @@ export interface SwitchProps extends SwitchStyleProps, ThemingProps<'Switch'> {
12
13
  labelLeft?: React.ReactElement | string;
13
14
  labelRight?: React.ReactElement | string;
14
15
  name?: string;
15
- onBlur?: (event: React.ChangeEvent<HTMLInputElement>) => void;
16
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
17
- onFocus?: (event: React.ChangeEvent<HTMLInputElement>) => void;
16
+ onBlur?: FocusEventHandler;
17
+ onChange?: ChangeEventHandler;
18
+ onFocus?: FocusEventHandler;
18
19
  required?: boolean;
19
20
  value?: number | string;
20
21
  }
@@ -1,4 +1,5 @@
1
1
  import { HTMLAttributes } from 'react';
2
+ import { ChangeEventHandler, FocusEventHandler } from '../core';
2
3
  import { BackgroundColorProps, BordersProps, ColorProps, FontSizeProps, SizingProps, SpaceProps, TransformsProps, TransitionsProps } from '../system';
3
4
  import { ThemingProps } from '../theme';
4
5
  export interface SwitchButtonProps extends SwitchThumbStyleProps, ThemingProps<'Switch'> {
@@ -10,9 +11,9 @@ export interface SwitchButtonProps extends SwitchThumbStyleProps, ThemingProps<'
10
11
  inputProps?: HTMLAttributes<HTMLInputElement>;
11
12
  inputRef?: React.MutableRefObject<HTMLInputElement | null> | null;
12
13
  name?: string;
13
- onBlur?: (event: React.ChangeEvent<HTMLInputElement>) => void;
14
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
15
- onFocus?: (event: React.ChangeEvent<HTMLInputElement>) => void;
14
+ onBlur?: FocusEventHandler;
15
+ onChange?: ChangeEventHandler;
16
+ onFocus?: FocusEventHandler;
16
17
  required?: boolean;
17
18
  value?: number | string;
18
19
  }