reactive-bulma 1.18.0 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -16,6 +16,7 @@ Component library based on React, Bulma, Typescript and Rollup
16
16
  ## Table of contents
17
17
 
18
18
  - [Status](#status)
19
+ - [Purpose](#purpose)
19
20
  - [Dependencies](#dependencies)
20
21
  - [Quick start](#quick-start)
21
22
  - [Folder structure](#folder-structure)
@@ -27,6 +28,9 @@ Component library based on React, Bulma, Typescript and Rollup
27
28
  - [Credit](#credit)
28
29
  - [License](#license)
29
30
 
31
+ ## Purpose
32
+ After studying [a Udemy course about Typescript](https://github.com/NicolasOmar/typescript-practice), I wanted to start a new project to practice my new knowledge in a meaningful tool. Therefore, I started this project to understand how to create a component library and investigate the best ways to maintain and nourish it as any professional-level alternatives.
33
+
30
34
  ## Status
31
35
 
32
36
  ![Npm Version][badge-npm-version]
package/dist/cjs/index.js CHANGED
@@ -3065,11 +3065,46 @@ const Select = ({ testId = null, showOptions = 1, options = [], isMultiple = fal
3065
3065
  React.createElement("select", { multiple: isMultiple, size: showOptions, "data-testid": selectTestId }, options.map(({ id, name, selected }, i) => (React.createElement("option", { "data-testid": `${selectTestId}-option-${i}`, key: id.toString(), selected: selected !== null && selected !== void 0 ? selected : false, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, name))))));
3066
3066
  };
3067
3067
 
3068
+ const File = ({ testId = null, fileName = null, uploadIcon = { iconLabel: 'upload' }, uploadText = 'Choose a file…', style = null, buttonOnRight = false, isFullWidth = false, isBoxed = false, color = null, size = null, onClick = null }) => {
3069
+ const fileClasses = parseClasses([
3070
+ 'file',
3071
+ fileName ? 'has-name' : null,
3072
+ buttonOnRight ? 'is-right' : null,
3073
+ isFullWidth ? 'is-fullwidth' : null,
3074
+ isBoxed ? 'is-boxed' : null,
3075
+ color,
3076
+ size
3077
+ ]);
3078
+ const fileTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
3079
+ tag: 'file',
3080
+ parsedClasses: fileClasses,
3081
+ rules: [
3082
+ {
3083
+ usedRegExp: /has/gm,
3084
+ regExpReplacer: '-has'
3085
+ },
3086
+ {
3087
+ usedRegExp: /is|file/gm,
3088
+ regExpReplacer: ''
3089
+ }
3090
+ ]
3091
+ });
3092
+ const fileInputTestId = `${fileTestId}-input`;
3093
+ return (React.createElement("section", { "data-testid": fileTestId, className: fileClasses, style: style !== null && style !== void 0 ? style : undefined },
3094
+ React.createElement("label", { className: 'file-label' },
3095
+ React.createElement("input", { "data-testid": fileInputTestId, className: 'file-input', type: 'file', name: 'resume', onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }),
3096
+ React.createElement("span", { className: 'file-cta' },
3097
+ uploadIcon ? React.createElement(Icon, Object.assign({}, uploadIcon)) : null,
3098
+ React.createElement("span", { className: 'file-label' }, uploadText)),
3099
+ fileName ? React.createElement("span", { className: 'file-name' }, fileName) : null)));
3100
+ };
3101
+
3068
3102
  exports.Block = Block;
3069
3103
  exports.Box = Box;
3070
3104
  exports.Button = Button;
3071
3105
  exports.Column = Column;
3072
3106
  exports.Delete = Delete;
3107
+ exports.File = File;
3073
3108
  exports.Icon = Icon;
3074
3109
  exports.Input = Input;
3075
3110
  exports.ProgressBar = ProgressBar;