@linzjs/lui 12.0.1 → 12.1.3

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ ## [12.1.3](https://github.com/linz/lui/compare/v12.1.2...v12.1.3) (2022-01-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * LuiTextInput mandatory star style ([#526](https://github.com/linz/lui/issues/526)) ([7cabbd0](https://github.com/linz/lui/commit/7cabbd0537b194d2a8884ea601da8918a10d7111))
7
+
8
+ ## [12.1.2](https://github.com/linz/lui/compare/v12.1.1...v12.1.2) (2022-01-17)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * FileInputBox not updating on error ([#498](https://github.com/linz/lui/issues/498)) ([7efa723](https://github.com/linz/lui/commit/7efa723f42cc15ceacb5f432d3d048f4447553f2))
14
+
15
+ ## [12.1.1](https://github.com/linz/lui/compare/v12.1.0...v12.1.1) (2022-01-17)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Fix for importing svg path breaking downstream projects ([#523](https://github.com/linz/lui/issues/523)) ([6c1e84c](https://github.com/linz/lui/commit/6c1e84c2e28561ee56a442f7adb567de45e81206))
21
+
22
+ # [12.1.0](https://github.com/linz/lui/compare/v12.0.1...v12.1.0) (2022-01-17)
23
+
24
+
25
+ ### Features
26
+
27
+ * **LuiComboSelect:** Added the createable option on LuiComboSelect ([#519](https://github.com/linz/lui/issues/519)) ([3aad990](https://github.com/linz/lui/commit/3aad9908a519e466151cb68ba192b4d94e740fe1))
28
+
1
29
  ## [12.0.1](https://github.com/linz/lui/compare/v12.0.0...v12.0.1) (2022-01-14)
2
30
 
3
31
 
@@ -1,4 +1,4 @@
1
- export interface Props {
1
+ export interface LuiFileInputBoxProps {
2
2
  fileDescription: string;
3
3
  acceptedExtensions: string[];
4
4
  fileFormatText?: string;
@@ -8,7 +8,7 @@ export interface Props {
8
8
  width?: number;
9
9
  height?: number;
10
10
  }
11
- export declare const LuiFileInputBox: (props: Props) => JSX.Element;
11
+ export declare const LuiFileInputBox: (props: LuiFileInputBoxProps) => JSX.Element;
12
12
  export interface FileUploadInfoProps {
13
13
  fileName: string | undefined;
14
14
  fileDescription: string;
@@ -18,8 +18,8 @@ export declare const FileUploadInfo: (props: FileUploadInfoProps) => JSX.Element
18
18
  /**
19
19
  * Get the extension from a filename in upper-case.
20
20
  *
21
- * @param fileName File-name to get extension from.
22
- * @return fileName extension in upper-case if found else empty string.
21
+ * @param fileName File-name to get extension from
22
+ * @return fileName extension in upper-case if found else empty string
23
23
  */
24
24
  export declare const getFileNameExtension: (fileName: string) => string;
25
25
  /**
@@ -1,6 +1,6 @@
1
1
  import { ComponentStory } from '@storybook/react';
2
2
  import { FileUploadInfo, LuiFileInputBox } from './LuiFileInputBox';
3
- declare const _default: import("@storybook/react").Meta<import("./LuiFileInputBox").Props>;
3
+ declare const _default: import("@storybook/react").Meta<import("./LuiFileInputBox").LuiFileInputBoxProps>;
4
4
  export default _default;
5
5
  export declare const LuiFileInputWithExtensionFilterDefaultSize: ComponentStory<typeof LuiFileInputBox>;
6
6
  export declare const LuiFileInputWithExtensionFilterLargeWithExistingError: ComponentStory<typeof LuiFileInputBox>;
@@ -3,6 +3,8 @@ import { GroupBase, Props, SelectInstance } from 'react-select';
3
3
  export declare type LuiComboSelectProps<Option extends LuiComboSelectOption = LuiComboSelectOption, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>> = Partial<Props<Option, IsMulti, Group>> & {
4
4
  label: JSX.Element | string;
5
5
  hideLabel?: boolean;
6
+ isCreateable?: boolean;
7
+ error?: string;
6
8
  };
7
9
  export declare type LuiComboSelectOption = {
8
10
  label: string;
@@ -14,4 +16,6 @@ export declare type LuiComboSelectOption = {
14
16
  export declare const LuiComboSelect: React.ForwardRefExoticComponent<Partial<Props<LuiComboSelectOption, boolean, GroupBase<any>>> & {
15
17
  label: JSX.Element | string;
16
18
  hideLabel?: boolean | undefined;
19
+ isCreateable?: boolean | undefined;
20
+ error?: string | undefined;
17
21
  } & React.RefAttributes<SelectInstance<LuiComboSelectOption, boolean, GroupBase<any>>>>;
@@ -2,63 +2,105 @@ import React from 'react';
2
2
  declare const _default: import("@storybook/react").Meta<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
3
3
  label: string | JSX.Element;
4
4
  hideLabel?: boolean | undefined;
5
+ isCreateable?: boolean | undefined;
6
+ error?: string | undefined;
5
7
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
6
8
  export default _default;
7
9
  export declare const blank: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
8
10
  label: string | JSX.Element;
9
11
  hideLabel?: boolean | undefined;
12
+ isCreateable?: boolean | undefined;
13
+ error?: string | undefined;
10
14
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
11
15
  export declare const withoutLabel: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
12
16
  label: string | JSX.Element;
13
17
  hideLabel?: boolean | undefined;
18
+ isCreateable?: boolean | undefined;
19
+ error?: string | undefined;
14
20
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
15
21
  export declare const focus: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
16
22
  label: string | JSX.Element;
17
23
  hideLabel?: boolean | undefined;
24
+ isCreateable?: boolean | undefined;
25
+ error?: string | undefined;
18
26
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
19
27
  export declare const open: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
20
28
  label: string | JSX.Element;
21
29
  hideLabel?: boolean | undefined;
30
+ isCreateable?: boolean | undefined;
31
+ error?: string | undefined;
22
32
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
23
33
  export declare const autocomplete: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
24
34
  label: string | JSX.Element;
25
35
  hideLabel?: boolean | undefined;
36
+ isCreateable?: boolean | undefined;
37
+ error?: string | undefined;
26
38
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
27
39
  export declare const foundNone: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
28
40
  label: string | JSX.Element;
29
41
  hideLabel?: boolean | undefined;
42
+ isCreateable?: boolean | undefined;
43
+ error?: string | undefined;
30
44
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
31
45
  export declare const loadingSpinner: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
32
46
  label: string | JSX.Element;
33
47
  hideLabel?: boolean | undefined;
48
+ isCreateable?: boolean | undefined;
49
+ error?: string | undefined;
34
50
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
35
51
  export declare const selected: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
36
52
  label: string | JSX.Element;
37
53
  hideLabel?: boolean | undefined;
54
+ isCreateable?: boolean | undefined;
55
+ error?: string | undefined;
38
56
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
39
57
  export declare const selectedOpen: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
40
58
  label: string | JSX.Element;
41
59
  hideLabel?: boolean | undefined;
60
+ isCreateable?: boolean | undefined;
61
+ error?: string | undefined;
42
62
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
43
63
  export declare const disabledBlank: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
44
64
  label: string | JSX.Element;
45
65
  hideLabel?: boolean | undefined;
66
+ isCreateable?: boolean | undefined;
67
+ error?: string | undefined;
46
68
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
47
69
  export declare const disabledSelected: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
48
70
  label: string | JSX.Element;
49
71
  hideLabel?: boolean | undefined;
72
+ isCreateable?: boolean | undefined;
73
+ error?: string | undefined;
50
74
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
51
75
  export declare const disabledWhileLoading: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
52
76
  label: string | JSX.Element;
53
77
  hideLabel?: boolean | undefined;
78
+ isCreateable?: boolean | undefined;
79
+ error?: string | undefined;
54
80
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
55
81
  export declare const groupedOptions: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
56
82
  label: string | JSX.Element;
57
83
  hideLabel?: boolean | undefined;
84
+ isCreateable?: boolean | undefined;
85
+ error?: string | undefined;
58
86
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
59
87
  export declare const isMulti: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
60
88
  label: string | JSX.Element;
61
89
  hideLabel?: boolean | undefined;
90
+ isCreateable?: boolean | undefined;
91
+ error?: string | undefined;
92
+ } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
93
+ export declare const createable: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
94
+ label: string | JSX.Element;
95
+ hideLabel?: boolean | undefined;
96
+ isCreateable?: boolean | undefined;
97
+ error?: string | undefined;
98
+ } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
99
+ export declare const error: import("@storybook/react").Story<Partial<import("react-select").Props<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>> & {
100
+ label: string | JSX.Element;
101
+ hideLabel?: boolean | undefined;
102
+ isCreateable?: boolean | undefined;
103
+ error?: string | undefined;
62
104
  } & React.RefAttributes<import("react-select").SelectInstance<import("./LuiComboSelect").LuiComboSelectOption, boolean, import("react-select").GroupBase<any>>>>;
63
105
  export declare const compareToInput: {
64
106
  (): JSX.Element;
@@ -8,4 +8,3 @@ declare const _default: {
8
8
  };
9
9
  export default _default;
10
10
  export declare const TooltipTopBottom: Story<{}>;
11
- export declare const TooltipLeftRight: Story<{}>;
@@ -14,6 +14,7 @@ var uuid = require('uuid');
14
14
  var camelcase = _interopDefault(require('camelcase'));
15
15
  var Select = _interopDefault(require('react-select'));
16
16
  var Lottie = _interopDefault(require('lottie-react'));
17
+ var CreatableSelect = _interopDefault(require('react-select/creatable'));
17
18
  var Modal = _interopDefault(require('react-modal'));
18
19
  var reactQuery = require('react-query');
19
20
  var tippy = _interopDefault(require('tippy.js'));
@@ -977,7 +978,7 @@ var LuiTextInput = function LuiTextInput(props) {
977
978
 
978
979
  var id = useGenerateOrDefaultId((_props$inputProps = props.inputProps) == null ? void 0 : _props$inputProps.id);
979
980
  return React__default.createElement("div", {
980
- className: clsx('LuiTextInput', props.error ? 'LuiTextInput-error' : '')
981
+ className: clsx('LuiTextInput', props.error && 'hasError')
981
982
  }, React__default.createElement("label", {
982
983
  className: 'LuiTextInput-label',
983
984
  htmlFor: id
@@ -1065,20 +1066,6 @@ var LuiFileInputBox = function LuiFileInputBox(props) {
1065
1066
  }
1066
1067
  };
1067
1068
 
1068
- var FileFormatErrorDetails = function FileFormatErrorDetails() {
1069
- return React__default.createElement("div", {
1070
- className: "LuiFileInputBox-upload-container"
1071
- }, React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
1072
- className: 'LuiFileInputBox-upload-icon-error'
1073
- }, React__default.createElement(LuiIcon, {
1074
- name: "ic_error_outline",
1075
- size: 'ns',
1076
- alt: "Error"
1077
- })), props.customFileErrorMessage ? React__default.createElement("p", null, props.customFileErrorMessage) : React__default.createElement("p", {
1078
- className: "LuiFileInputBox-upload-text"
1079
- }, "You must select a file with extension of", ' ', extensionsAsHumanReadableList(props.acceptedExtensions), ".")));
1080
- };
1081
-
1082
1069
  var hasError = hasFileFormatError || props.showMustSelectFileError === true;
1083
1070
  return React__default.createElement("div", {
1084
1071
  className: clsx('LuiFileInputBox-upload', hasError && 'LuiFileInputBox-upload-error'),
@@ -1095,7 +1082,17 @@ var LuiFileInputBox = function LuiFileInputBox(props) {
1095
1082
  return "." + extension;
1096
1083
  }).join(','),
1097
1084
  onChange: onChange
1098
- }), React__default.createElement(React__default.Fragment, null, hasError ? React__default.createElement(FileFormatErrorDetails, null) : React__default.createElement(FileUploadInfo, {
1085
+ }), React__default.createElement(React__default.Fragment, null, hasError ? React__default.createElement("div", {
1086
+ className: "LuiFileInputBox-upload-container"
1087
+ }, React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
1088
+ className: 'LuiFileInputBox-upload-icon-error'
1089
+ }, React__default.createElement(LuiIcon, {
1090
+ name: "ic_error_outline",
1091
+ size: 'ns',
1092
+ alt: "Error"
1093
+ })), props.customFileErrorMessage ? React__default.createElement("p", null, props.customFileErrorMessage) : React__default.createElement("p", {
1094
+ className: "LuiFileInputBox-upload-text"
1095
+ }, "You must select a file with extension of", ' ', extensionsAsHumanReadableList(props.acceptedExtensions), "."))) : React__default.createElement(FileUploadInfo, {
1099
1096
  fileName: file == null ? void 0 : file.name,
1100
1097
  fileFormatText: props.fileFormatText,
1101
1098
  fileDescription: props.fileDescription
@@ -1140,8 +1137,8 @@ var FileUploadInfo = function FileUploadInfo(props) {
1140
1137
  /**
1141
1138
  * Get the extension from a filename in upper-case.
1142
1139
  *
1143
- * @param fileName File-name to get extension from.
1144
- * @return fileName extension in upper-case if found else empty string.
1140
+ * @param fileName File-name to get extension from
1141
+ * @return fileName extension in upper-case if found else empty string
1145
1142
  */
1146
1143
 
1147
1144
  var getFileNameExtension = function getFileNameExtension(fileName) {
@@ -18132,18 +18129,15 @@ function LuiComboSelectActual(givenProps, ref) {
18132
18129
  }, givenProps);
18133
18130
  props.components = _extends({
18134
18131
  LoadingIndicator: LuiLoadingIndicator
18135
- }, props.components);
18132
+ }, props.components); // box-shadow: "-8px 0px 0 0 #cc0000";
18133
+ // border-radius: "4px";
18134
+
18136
18135
  var id = useGenerateOrDefaultId(props == null ? void 0 : props.id);
18137
- return React__default.createElement("label", {
18138
- htmlFor: id,
18139
- className: "LuiComboSelect-label"
18140
- }, React__default.createElement("span", {
18141
- className: clsx('LuiSelect-label-text', props.hideLabel ? 'LuiScreenReadersOnly' : '')
18142
- }, props.label), React__default.createElement(Select, Object.assign({
18143
- inputId: id,
18144
- ref: ref
18136
+
18137
+ var selectProp = _extends({
18138
+ inputId: id
18145
18139
  }, props, {
18146
- classNamePrefix: "LuiComboSelect",
18140
+ classNamePrefix: 'LuiComboSelect',
18147
18141
  theme: function theme(_theme) {
18148
18142
  return _extends({}, _theme, {
18149
18143
  colors: _extends({}, _theme.colors, {
@@ -18213,7 +18207,30 @@ function LuiComboSelectActual(givenProps, ref) {
18213
18207
  });
18214
18208
  }
18215
18209
  }
18216
- })));
18210
+ });
18211
+
18212
+ return React__default.createElement("label", {
18213
+ htmlFor: id,
18214
+ className: clsx('LuiComboSelect-label', props.error && 'hasError')
18215
+ }, React__default.createElement("span", {
18216
+ className: clsx('LuiSelect-label-text', props.hideLabel ? 'LuiScreenReadersOnly' : '')
18217
+ }, props.label), props.isCreateable ? React__default.createElement(CreatableSelect, Object.assign({
18218
+ formatCreateLabel: function formatCreateLabel(inputValue) {
18219
+ return inputValue;
18220
+ },
18221
+ createOptionPosition: "first",
18222
+ ref: ref
18223
+ }, selectProp)) : React__default.createElement(Select, Object.assign({
18224
+ ref: ref
18225
+ }, selectProp)), props.error && React__default.createElement("span", {
18226
+ className: "LuiComboSelect-error"
18227
+ }, React__default.createElement(LuiIcon, {
18228
+ alt: 'Error',
18229
+ name: "ic_error",
18230
+ className: "LuiComboSelect-error-icon",
18231
+ size: "sm",
18232
+ status: "error"
18233
+ }), props.error));
18217
18234
  }
18218
18235
 
18219
18236
  var LuiShadow = function LuiShadow(props) {