reactive-bulma 1.14.0 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { InputProps } from '../../../interfaces/atomProps';
3
+ declare const Input: React.FC<InputProps>;
4
+ export default Input;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { TextAreaProps } from '../../../interfaces/atomProps';
3
+ declare const TextArea: React.FC<TextAreaProps>;
4
+ export default TextArea;
@@ -6,3 +6,5 @@ export { default as Tag } from './Tag';
6
6
  export { default as Box } from './Box';
7
7
  export { default as Title } from './Title';
8
8
  export { default as Icon } from './Icon';
9
+ export { default as Input } from './Input';
10
+ export { default as TextArea } from './TextArea';
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- import { basicColorType, columnOffsetType, columnSizeType, fixedImageSizeType, iconColorModeType, sizeType, textColorType, titleSize } from '../types/styleTypes';
2
+ import { basicColorType, columnOffsetType, columnSizeType, fixedImageSizeType, iconColorModeType, basicSizeType, textColorType, titleSizeType } from '../types/styleTypes';
3
+ import { inputTypes } from '../types/domTypes';
3
4
  interface BasicProps {
4
5
  testId?: string;
5
6
  style?: React.CSSProperties;
@@ -20,7 +21,7 @@ export interface ButtonProps extends BasicProps, React.ComponentPropsWithoutRef<
20
21
  isLoading?: boolean;
21
22
  isDisabled?: boolean;
22
23
  isStatic?: boolean;
23
- size?: sizeType;
24
+ size?: basicSizeType;
24
25
  onClick?: () => void;
25
26
  }
26
27
  export interface ProgressBarProps extends BasicProps, React.ComponentPropsWithoutRef<'progress'> {
@@ -28,7 +29,7 @@ export interface ProgressBarProps extends BasicProps, React.ComponentPropsWithou
28
29
  max?: number;
29
30
  style?: React.CSSProperties;
30
31
  color?: basicColorType;
31
- size?: sizeType;
32
+ size?: basicSizeType;
32
33
  isLoading?: boolean;
33
34
  }
34
35
  export interface BlockProps extends BasicProps, React.ComponentPropsWithoutRef<'section'> {
@@ -39,7 +40,7 @@ export interface TagProps extends BasicProps, React.ComponentPropsWithoutRef<'sp
39
40
  color?: basicColorType;
40
41
  isLight?: boolean;
41
42
  isRounded?: boolean;
42
- size?: Exclude<sizeType, 'is-normal'>;
43
+ size?: Exclude<basicSizeType, 'is-normal'>;
43
44
  withDelete?: boolean;
44
45
  withAddon?: boolean;
45
46
  addonText?: string;
@@ -55,7 +56,7 @@ export interface BoxProps extends BasicProps, React.ComponentPropsWithoutRef<'se
55
56
  }
56
57
  export interface TitleSectionProps extends BasicProps, React.ComponentPropsWithoutRef<'p'> {
57
58
  text: string;
58
- size?: titleSize;
59
+ size?: titleSizeType;
59
60
  prop: 'title' | 'subtitle';
60
61
  isSpaced?: boolean;
61
62
  }
@@ -67,8 +68,26 @@ export interface IconProps extends BasicProps {
67
68
  iconLabel: string;
68
69
  text?: string;
69
70
  color?: textColorType;
70
- size?: Exclude<sizeType, 'is-normal'>;
71
+ size?: Exclude<basicSizeType, 'is-normal'>;
71
72
  colorMode?: iconColorModeType;
72
73
  isSpinning?: boolean;
73
74
  }
75
+ export interface InputProps extends BasicProps {
76
+ type: inputTypes;
77
+ text?: string;
78
+ isDisabled?: boolean;
79
+ isReadonly?: boolean;
80
+ color?: basicColorType;
81
+ size?: basicSizeType;
82
+ isRounded?: boolean;
83
+ isHovered?: boolean;
84
+ isFocused?: boolean;
85
+ onClick?: () => void;
86
+ onChange?: () => void;
87
+ }
88
+ export interface TextAreaProps extends Omit<InputProps, 'isRounded' | 'type'> {
89
+ cols?: number;
90
+ rows?: number;
91
+ isFixedSize?: boolean;
92
+ }
74
93
  export {};
@@ -1 +1,2 @@
1
1
  export type buttonType = 'submit' | 'reset' | 'button';
2
+ export type inputTypes = 'text' | 'password' | 'email' | 'tel';
@@ -1,8 +1,8 @@
1
1
  export type columnSizeType = 'is-three-quarters' | 'is-two-thirds' | 'is-half' | 'is-one-third' | 'is-one-quarter' | 'is-full' | 'is-four-fifths' | 'is-three-fifths' | 'is-two-fifths' | 'is-one-fifth' | 'is-1' | 'is-2' | 'is-3' | 'is-4' | 'is-5' | 'is-6' | 'is-7' | 'is-8' | 'is-9' | 'is-10' | 'is-11' | 'is-12';
2
- export type titleSize = 'is-1' | 'is-2' | 'is-3' | 'is-4' | 'is-5' | 'is-6';
2
+ export type titleSizeType = 'is-1' | 'is-2' | 'is-3' | 'is-4' | 'is-5' | 'is-6';
3
3
  export type columnOffsetType = 'is-offset-1' | 'is-offset-2' | 'is-offset-3' | 'is-offset-4' | 'is-offset-5' | 'is-offset-6' | 'is-offset-7' | 'is-offset-8' | 'is-offset-9' | 'is-offset-10' | 'is-offset-11' | 'is-offset-12';
4
4
  export type basicColorType = 'is-white' | 'is-light' | 'is-dark' | 'is-black' | 'is-text' | 'is-ghost' | 'is-primary' | 'is-link' | 'is-info' | 'is-success' | 'is-warning' | 'is-danger';
5
5
  export type textColorType = 'has-text-white' | 'has-text-black' | 'has-text-light' | 'has-text-dark' | 'has-text-primary' | 'has-text-link' | 'has-text-info' | 'has-text-success' | 'has-text-warning' | 'has-text-danger';
6
6
  export type fixedImageSizeType = 'is-16x16' | 'is-24x24' | 'is-32x32' | 'is-48x48' | 'is-64x64' | 'is-96x96' | 'is-128x128' | 'is-square' | 'is-1by1' | 'is-5by4' | 'is-4by3' | 'is-3by2' | 'is-5by3' | 'is-16by9' | 'is-2by1' | 'is-3by1' | 'is-4by5' | 'is-3by4' | 'is-2by3' | 'is-3by5' | 'is-9by16' | 'is-1by2' | 'is-1by3';
7
- export type sizeType = 'is-small' | 'is-normal' | 'is-medium' | 'is-large';
7
+ export type basicSizeType = 'is-small' | 'is-normal' | 'is-medium' | 'is-large';
8
8
  export type iconColorModeType = 'light' | 'dark';
package/dist/esm/index.js CHANGED
@@ -2884,7 +2884,7 @@ const Column = ({ testId = null, style = null, size = null, offset = null, isNar
2884
2884
  isNarrow ? 'is-narrow' : null
2885
2885
  ]);
2886
2886
  const _testId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'column', parsedClasses: columnClasses });
2887
- return (React.createElement("section", { "data-testid": _testId, className: columnClasses, style: style || undefined }, children));
2887
+ return (React.createElement("section", { "data-testid": _testId, className: columnClasses, style: style !== null && style !== void 0 ? style : undefined }, children));
2888
2888
  };
2889
2889
 
2890
2890
  const ProgressBar = ({ value = 0, max = 100, testId = null, style = null, color = 'is-primary', size = null, isLoading = false }) => {
@@ -2897,7 +2897,7 @@ const ProgressBar = ({ value = 0, max = 100, testId = null, style = null, color
2897
2897
  return (React.createElement("progress", { "data-testid": _testId, className: progressClasses, style: style !== null && style !== void 0 ? style : undefined, value: isLoading ? undefined : value, max: max }, `${isLoading ? 0 : fixedValue}%`));
2898
2898
  };
2899
2899
 
2900
- const Block = ({ testId = 'test-block', style = null, children = null }) => children ? (React.createElement("section", { "data-testid": testId, className: 'block', style: style || undefined }, children)) : null;
2900
+ const Block = ({ testId = 'test-block', style = null, children = null }) => children ? (React.createElement("section", { "data-testid": testId, className: 'block', style: style !== null && style !== void 0 ? style : undefined }, children)) : null;
2901
2901
 
2902
2902
  const Tag = ({ text, testId = null, style = null, color = null, isLight = null, isRounded = null, size = null, withDelete = false, withAddon = false, addonText = null, addonColor = null, onDeleteClick = null }) => {
2903
2903
  const tagLabel = withAddon ? 'tags' : 'tag';
@@ -2919,14 +2919,14 @@ const Tag = ({ text, testId = null, style = null, color = null, isLight = null,
2919
2919
  parsedClasses: withAddon ? tagsWrapperClasses : tagClasses,
2920
2920
  separator: withAddon ? '-' : ''
2921
2921
  });
2922
- return withAddon ? (React.createElement("section", { "data-testid": _testId, style: style || undefined, className: tagsWrapperClasses },
2922
+ return withAddon ? (React.createElement("section", { "data-testid": _testId, style: style !== null && style !== void 0 ? style : undefined, className: tagsWrapperClasses },
2923
2923
  React.createElement("span", { className: tagClasses }, text),
2924
- withDelete ? (React.createElement("a", { "data-testid": `${_testId}-delete`, className: 'tag is-delete', onClick: onDeleteClick || undefined })) : (React.createElement("span", { className: addonTagClasses }, addonText)))) : (React.createElement("span", { "data-testid": _testId, style: style || undefined, className: tagClasses },
2924
+ withDelete ? (React.createElement("a", { "data-testid": `${_testId}-delete`, className: 'tag is-delete', onClick: onDeleteClick || undefined })) : (React.createElement("span", { className: addonTagClasses }, addonText)))) : (React.createElement("span", { "data-testid": _testId, style: style !== null && style !== void 0 ? style : undefined, className: tagClasses },
2925
2925
  text,
2926
2926
  withDelete ? (React.createElement("button", { "data-testid": `${_testId}-delete`, className: 'delete', onClick: onDeleteClick || undefined })) : null));
2927
2927
  };
2928
2928
 
2929
- const Box = ({ testId = 'test-box', style = null, children = null }) => children ? (React.createElement("section", { "data-testid": testId, className: 'box', style: style || undefined }, children)) : null;
2929
+ const Box = ({ testId = 'test-box', style = null, children = null }) => children ? (React.createElement("section", { "data-testid": testId, className: 'box', style: style !== null && style !== void 0 ? style : undefined }, children)) : null;
2930
2930
 
2931
2931
  const renderTitleSection = (section) => {
2932
2932
  var _a, _b;
@@ -2948,7 +2948,21 @@ var IconSizeEnum;
2948
2948
  IconSizeEnum[IconSizeEnum["is-large"] = 48] = "is-large";
2949
2949
  })(IconSizeEnum || (IconSizeEnum = {}));
2950
2950
 
2951
- const generateIconContainer = (icon, color) => React.createElement("span", { className: `icon-text${color ? ` ${color}` : ''}` }, icon);
2951
+ const generateIconContainer = (icon, color) => {
2952
+ var _a;
2953
+ const containerClasses = color ? `icon-text-${color}` : 'icon-text';
2954
+ const containerTestId = parseTestId({
2955
+ tag: 'icon-container',
2956
+ parsedClasses: (_a = color === null || color === void 0 ? void 0 : color.toString()) !== null && _a !== void 0 ? _a : '',
2957
+ rules: [
2958
+ {
2959
+ usedRegExp: /has-text/gm,
2960
+ regExpReplacer: ''
2961
+ }
2962
+ ]
2963
+ });
2964
+ return (React.createElement("span", { "data-testid": containerTestId, className: containerClasses }, icon));
2965
+ };
2952
2966
  const Icon = ({ iconLabel, testId = null, text = null, style = null, color = null, size = null, colorMode = null, isSpinning = false }) => {
2953
2967
  const iconSpanClasses = parseClasses(['icon', color, size]);
2954
2968
  const iconClasses = parseClasses([
@@ -2974,11 +2988,53 @@ const Icon = ({ iconLabel, testId = null, text = null, style = null, color = nul
2974
2988
  separator: '-'
2975
2989
  });
2976
2990
  const _internalTestId = `${_testId}-i`;
2977
- const iconComponent = (React.createElement("span", { "data-testid": _testId, style: style || undefined, className: iconSpanClasses },
2991
+ const iconComponent = (React.createElement("span", { "data-testid": _testId, style: style !== null && style !== void 0 ? style : undefined, className: iconSpanClasses },
2978
2992
  React.createElement("i", { "data-testid": _internalTestId, className: iconClasses }),
2979
2993
  text ? React.createElement("span", null, text) : null));
2980
2994
  return text ? generateIconContainer(iconComponent, color) : iconComponent;
2981
2995
  };
2982
2996
 
2983
- export { Block, Box, Button, Column, Icon, ProgressBar, Tag, Title };
2997
+ const Input = ({ testId = null, type, text = null, isDisabled = false, isReadonly = false, style = null, color = null, size = null, isRounded = null, isHovered = null, isFocused = null, onClick = null, onChange = null }) => {
2998
+ const inputClasses = parseClasses([
2999
+ 'input',
3000
+ color,
3001
+ size,
3002
+ isRounded ? 'is-rounded' : null,
3003
+ isHovered ? 'is-hovered' : null,
3004
+ isFocused ? 'is-focused' : null
3005
+ ]);
3006
+ const _testId = testId !== null && testId !== void 0 ? testId : parseTestId({
3007
+ tag: 'input',
3008
+ parsedClasses: inputClasses
3009
+ });
3010
+ return (React.createElement("input", { "data-testid": _testId, type: type, defaultValue: text !== null && text !== void 0 ? text : undefined, disabled: isDisabled, readOnly: isReadonly, style: style !== null && style !== void 0 ? style : undefined, className: inputClasses, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined, onChange: onChange !== null && onChange !== void 0 ? onChange : undefined }));
3011
+ };
3012
+
3013
+ const TextArea = ({ testId = null, text = null, cols = null, rows = null, isDisabled = false, isReadonly = false, isFixedSize = false, style = null, color = null, size = null, isHovered = null, isFocused = null, onClick = null, onChange = null }) => {
3014
+ const textAreaClasses = parseClasses([
3015
+ 'textarea',
3016
+ color,
3017
+ size,
3018
+ isHovered ? 'is-hovered' : null,
3019
+ isFocused ? 'is-focused' : null,
3020
+ isFixedSize ? 'has-fixed-size' : null
3021
+ ]);
3022
+ const _testId = testId !== null && testId !== void 0 ? testId : parseTestId({
3023
+ tag: 'textarea',
3024
+ parsedClasses: textAreaClasses,
3025
+ rules: [
3026
+ {
3027
+ usedRegExp: /textarea/gm,
3028
+ regExpReplacer: ''
3029
+ },
3030
+ {
3031
+ usedRegExp: /is-|has-/gm,
3032
+ regExpReplacer: '-'
3033
+ }
3034
+ ]
3035
+ });
3036
+ return (React.createElement("textarea", { "data-testid": _testId, defaultValue: text !== null && text !== void 0 ? text : undefined, cols: cols !== null && cols !== void 0 ? cols : undefined, rows: rows !== null && rows !== void 0 ? rows : undefined, disabled: isDisabled, readOnly: isReadonly, style: style !== null && style !== void 0 ? style : undefined, className: textAreaClasses, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined, onChange: onChange !== null && onChange !== void 0 ? onChange : undefined }));
3037
+ };
3038
+
3039
+ export { Block, Box, Button, Column, Icon, Input, ProgressBar, Tag, TextArea, Title };
2984
3040
  //# sourceMappingURL=index.js.map