@try-at-software/input-elements 1.2.0-alpha.26 → 1.2.0-alpha.30

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.
Files changed (22) hide show
  1. package/lib/DynamicListInputElement/Menu/DynamicListMenu.js +5 -5
  2. package/lib/Presentations/PresentationRenderers.js +2 -2
  3. package/lib/SingleValueInputElements/DropdownInputElement/DropdownInput.js +3 -3
  4. package/lib/SingleValueInputElements/DropdownInputElement/MultiValueDropdownInput.js +23 -21
  5. package/lib/SingleValueInputElements/ISingleValueInputElement.d.ts +1 -1
  6. package/lib/SingleValueInputElements/IdentityPickerInputElement/IIdentityPickerProps.d.ts +1 -1
  7. package/lib/SingleValueInputElements/IdentityPickerInputElement/IdentityPicker.d.ts +1 -1
  8. package/lib/SingleValueInputElements/IdentityPickerInputElement/IdentityPicker.js +4 -4
  9. package/lib/SingleValueInputElements/NumberInputElement/NumberInput.js +18 -25
  10. package/lib/SingleValueInputElements/SingleValueInputElement.d.ts +1 -1
  11. package/lib/SingleValueInputElements/TextInputElement/LongTextInput.js +3 -3
  12. package/lib/SingleValueInputElements/TextInputElement/TextInput.js +3 -3
  13. package/lib/SingleValueInputElements/TimePickerInputElement/TimePicker.js +4 -4
  14. package/lib/Subscriptions/ValueChangeSubscription.d.ts +1 -1
  15. package/lib/Utilities/DropdownHelper.d.ts +1 -1
  16. package/lib/Utilities/DropdownHelper.js +4 -4
  17. package/lib/Utilities/FormHelper.js +8 -2
  18. package/package.json +11 -10
  19. package/lib/SingleValueInputElements/DependentInputElement/DependentInputElementInitializer.d.ts +0 -0
  20. package/lib/SingleValueInputElements/DependentInputElement/DependentInputElementInitializer.js +0 -51
  21. package/lib/SingleValueInputElements/DependentInputElement/index.d.ts +0 -0
  22. package/lib/SingleValueInputElements/DependentInputElement/index.js +0 -1
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DynamicListMenu = void 0;
4
4
  const React = require("react");
5
- const office_ui_fabric_react_1 = require("office-ui-fabric-react");
5
+ const react_1 = require("@fluentui/react");
6
6
  class DynamicListMenu extends React.Component {
7
7
  render() {
8
8
  var _a, _b, _c, _d;
@@ -18,18 +18,18 @@ class DynamicListMenu extends React.Component {
18
18
  text: ((_d = (_c = this.props) === null || _c === void 0 ? void 0 : _c.insertButtonConfig) === null || _d === void 0 ? void 0 : _d.label) || 'Insert'
19
19
  };
20
20
  if (!(addOptions === null || addOptions === void 0 ? void 0 : addOptions.items) || addOptions.items.length <= 0)
21
- return React.createElement(office_ui_fabric_react_1.PrimaryButton, Object.assign({}, commonProps, { disabled: true }));
21
+ return React.createElement(react_1.PrimaryButton, Object.assign({}, commonProps, { disabled: true }));
22
22
  else if (addOptions.items.length === 1) {
23
- return (React.createElement(office_ui_fabric_react_1.CommandButton, Object.assign({}, commonProps, { disabled: false, onClick: () => {
23
+ return (React.createElement(react_1.CommandButton, Object.assign({}, commonProps, { disabled: false, onClick: () => {
24
24
  addOptions.items[0].onClick();
25
25
  } })));
26
26
  }
27
27
  else
28
- return React.createElement(office_ui_fabric_react_1.CommandButton, Object.assign({}, commonProps, { menuProps: addOptions, disabled: false }));
28
+ return React.createElement(react_1.CommandButton, Object.assign({}, commonProps, { menuProps: addOptions, disabled: false }));
29
29
  }
30
30
  renderRemoveButton() {
31
31
  var _a, _b, _c, _d, _e;
32
- return (React.createElement(office_ui_fabric_react_1.CommandButton, { iconProps: { iconName: ((_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.removeButtonConfig) === null || _b === void 0 ? void 0 : _b.iconName) || 'Remove' }, text: ((_d = (_c = this.props) === null || _c === void 0 ? void 0 : _c.removeButtonConfig) === null || _d === void 0 ? void 0 : _d.label) || 'Remove', disabled: !((_e = this.props.removeButtonConfig) === null || _e === void 0 ? void 0 : _e.isEnabled), onClick: () => !!this.props.onRemoveClicked && this.props.onRemoveClicked() }));
32
+ return (React.createElement(react_1.CommandButton, { iconProps: { iconName: ((_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.removeButtonConfig) === null || _b === void 0 ? void 0 : _b.iconName) || 'Remove' }, text: ((_d = (_c = this.props) === null || _c === void 0 ? void 0 : _c.removeButtonConfig) === null || _d === void 0 ? void 0 : _d.label) || 'Remove', disabled: !((_e = this.props.removeButtonConfig) === null || _e === void 0 ? void 0 : _e.isEnabled), onClick: () => !!this.props.onRemoveClicked && this.props.onRemoveClicked() }));
33
33
  }
34
34
  getItems() {
35
35
  return {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PresentationRenderer = void 0;
4
- const office_ui_fabric_react_1 = require("office-ui-fabric-react");
4
+ const react_1 = require("@fluentui/react");
5
5
  const React = require("react");
6
6
  class PresentationRenderer extends React.Component {
7
7
  render() {
@@ -11,7 +11,7 @@ class PresentationRenderer extends React.Component {
11
11
  if (this.props.isLoading) {
12
12
  if (this.props.renderLoadingIndicator)
13
13
  return this.props.renderLoadingIndicator();
14
- return React.createElement(office_ui_fabric_react_1.Spinner, { size: office_ui_fabric_react_1.SpinnerSize.medium });
14
+ return React.createElement(react_1.Spinner, { size: react_1.SpinnerSize.medium });
15
15
  }
16
16
  if (!this.props.renderInternalContent)
17
17
  return null;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DropdownInput = void 0;
4
4
  const React = require("react");
5
- const office_ui_fabric_react_1 = require("office-ui-fabric-react");
5
+ const react_1 = require("@fluentui/react");
6
6
  const Utilities_1 = require("../../Utilities");
7
7
  class DropdownInput extends React.Component {
8
8
  render() {
@@ -11,8 +11,8 @@ class DropdownInput extends React.Component {
11
11
  return null;
12
12
  const normalizedOptions = Utilities_1.DropdownHelper.getNormalizedOptions(this.props.defaultOption, this.props.options);
13
13
  return (React.createElement(React.Fragment, null,
14
- !!((_a = this.props) === null || _a === void 0 ? void 0 : _a.label) && React.createElement(office_ui_fabric_react_1.Label, { required: !!this.props.renderRequiredIndicator }, this.props.label),
15
- React.createElement(office_ui_fabric_react_1.Dropdown, { "data-automationid": "dropdown-input", options: normalizedOptions, onChange: (_event, option) => { var _a; return !!((_a = this.props) === null || _a === void 0 ? void 0 : _a.onChange) && this.props.onChange(option.key); }, errorMessage: (_b = this.props) === null || _b === void 0 ? void 0 : _b.errorMessage, placeholder: (_c = this.props) === null || _c === void 0 ? void 0 : _c.placeholder,
14
+ !!((_a = this.props) === null || _a === void 0 ? void 0 : _a.label) && React.createElement(react_1.Label, { required: !!this.props.renderRequiredIndicator }, this.props.label),
15
+ React.createElement(react_1.Dropdown, { "data-automationid": "dropdown-input", options: normalizedOptions, onChange: (_event, option) => { var _a; return !!((_a = this.props) === null || _a === void 0 ? void 0 : _a.onChange) && this.props.onChange(option.key); }, errorMessage: (_b = this.props) === null || _b === void 0 ? void 0 : _b.errorMessage, placeholder: (_c = this.props) === null || _c === void 0 ? void 0 : _c.placeholder,
16
16
  // This value should never be `undefined`.
17
17
  defaultSelectedKey: ((_d = this.props) === null || _d === void 0 ? void 0 : _d.value) || ((_f = (_e = this.props) === null || _e === void 0 ? void 0 : _e.defaultOption) === null || _f === void 0 ? void 0 : _f.key) || null, disabled: (_g = this.props) === null || _g === void 0 ? void 0 : _g.isDisabled })));
18
18
  }
@@ -2,31 +2,33 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MultiValueDropdownInput = void 0;
4
4
  const React = require("react");
5
- const office_ui_fabric_react_1 = require("office-ui-fabric-react");
5
+ const react_1 = require("@fluentui/react");
6
6
  const Utilities_1 = require("../../Utilities");
7
7
  class MultiValueDropdownInput extends React.Component {
8
8
  render() {
9
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
9
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
10
10
  const normalizedOptions = Utilities_1.DropdownHelper.getNormalizedOptions((_a = this.props) === null || _a === void 0 ? void 0 : _a.defaultOption, (_b = this.props) === null || _b === void 0 ? void 0 : _b.options);
11
- return (React.createElement(office_ui_fabric_react_1.Dropdown, { "data-automationid": "multi-value-dropdown-input", label: (_c = this.props) === null || _c === void 0 ? void 0 : _c.label, options: normalizedOptions, onChange: (_event, option) => {
12
- var _a, _b, _c;
13
- const optionKey = (_a = option === null || option === void 0 ? void 0 : option.key) === null || _a === void 0 ? void 0 : _a.toString();
14
- if (!optionKey)
15
- return;
16
- // We have to re-iterate the passed collection of values here in order to detect changes between the initial and the current values.
17
- let currentValues = [];
18
- if ((_b = this.props) === null || _b === void 0 ? void 0 : _b.value)
19
- currentValues.push(...this.props.value);
20
- // If the current option is selected, add it to the list.
21
- // Else, remove it.
22
- if (option.selected)
23
- currentValues.push(optionKey);
24
- else
25
- currentValues = currentValues.filter((x) => x !== optionKey);
26
- !!((_c = this.props) === null || _c === void 0 ? void 0 : _c.onChange) && this.props.onChange(currentValues);
27
- }, errorMessage: (_d = this.props) === null || _d === void 0 ? void 0 : _d.errorMessage, required: !!((_e = this.props) === null || _e === void 0 ? void 0 : _e.renderRequiredIndicator), placeholder: (_f = this.props) === null || _f === void 0 ? void 0 : _f.placeholder,
28
- // This value should never be `undefined`.
29
- defaultSelectedKeys: ((_g = this.props) === null || _g === void 0 ? void 0 : _g.value) || [(_j = (_h = this.props) === null || _h === void 0 ? void 0 : _h.defaultOption) === null || _j === void 0 ? void 0 : _j.key] || null, disabled: (_k = this.props) === null || _k === void 0 ? void 0 : _k.isDisabled, multiSelect: true }));
11
+ return (React.createElement(React.Fragment, null,
12
+ this.props.label && React.createElement(react_1.Label, { required: this.props.renderRequiredIndicator }, this.props.label),
13
+ React.createElement(react_1.Dropdown, { "data-automationid": "multi-value-dropdown-input", options: normalizedOptions, onChange: (_event, option) => {
14
+ var _a, _b, _c;
15
+ const optionKey = (_a = option === null || option === void 0 ? void 0 : option.key) === null || _a === void 0 ? void 0 : _a.toString();
16
+ if (!optionKey)
17
+ return;
18
+ // We have to re-iterate the passed collection of values here in order to detect changes between the initial and the current values.
19
+ let currentValues = [];
20
+ if ((_b = this.props) === null || _b === void 0 ? void 0 : _b.value)
21
+ currentValues.push(...this.props.value);
22
+ // If the current option is selected, add it to the list.
23
+ // Else, remove it.
24
+ if (option.selected)
25
+ currentValues.push(optionKey);
26
+ else
27
+ currentValues = currentValues.filter((x) => x !== optionKey);
28
+ !!((_c = this.props) === null || _c === void 0 ? void 0 : _c.onChange) && this.props.onChange(currentValues);
29
+ }, errorMessage: (_c = this.props) === null || _c === void 0 ? void 0 : _c.errorMessage, required: !!((_d = this.props) === null || _d === void 0 ? void 0 : _d.renderRequiredIndicator), placeholder: (_e = this.props) === null || _e === void 0 ? void 0 : _e.placeholder,
30
+ // This value should never be `undefined`.
31
+ defaultSelectedKeys: ((_f = this.props) === null || _f === void 0 ? void 0 : _f.value) || [(_h = (_g = this.props) === null || _g === void 0 ? void 0 : _g.defaultOption) === null || _h === void 0 ? void 0 : _h.key] || null, disabled: (_j = this.props) === null || _j === void 0 ? void 0 : _j.isDisabled, multiSelect: true })));
30
32
  }
31
33
  }
32
34
  exports.MultiValueDropdownInput = MultiValueDropdownInput;
@@ -23,5 +23,5 @@ export interface ISingleValueInputElement<TValue, TComponentProps = unknown, TDy
23
23
  changeDynamicProps<K extends keyof TDynamicProps>(dynamicProps: Pick<TDynamicProps, K>): void;
24
24
  subscribeToValueChange(subscription: ValueChangeSubscription<TValue>): void;
25
25
  subscribeToInitialValueChange(subscription: ValueChangeSubscription<TValue>): void;
26
- subscribeToInvalidValueChange(subscription: InvalidValueChangeSubscription<TValue>): void;
26
+ subscribeToInvalidValueChange(subscription: InvalidValueChangeSubscription): void;
27
27
  }
@@ -1,4 +1,4 @@
1
- import { IBasePickerSuggestionsProps, IPersonaProps } from 'office-ui-fabric-react';
1
+ import { IBasePickerSuggestionsProps, IPersonaProps } from '@fluentui/react';
2
2
  import { IBaseInputElementProps } from '../IBaseInputElementProps';
3
3
  export interface IIdentityPickerProps<TIdentity extends IPersonaProps = IPersonaProps> extends IBaseInputElementProps {
4
4
  onResolveSuggestions: (query: string, selectedItems?: TIdentity[]) => Promise<TIdentity[]>;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { IPersonaProps } from 'office-ui-fabric-react';
2
+ import { IPersonaProps } from '@fluentui/react';
3
3
  import { IBaseInputElementDynamicProps } from '../IBaseInputElementDynamicProps';
4
4
  import { IIdentityPickerProps } from './IIdentityPickerProps';
5
5
  import { ISingleValueInputElementProps } from '../ISingleValueInputElementProps';
@@ -2,22 +2,22 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IdentityPicker = void 0;
4
4
  const React = require("react");
5
- const office_ui_fabric_react_1 = require("office-ui-fabric-react");
5
+ const react_1 = require("@fluentui/react");
6
6
  class IdentityPicker extends React.Component {
7
7
  render() {
8
8
  var _a;
9
9
  if (!this.props)
10
10
  return null;
11
11
  return (React.createElement(React.Fragment, null,
12
- this.props.label && React.createElement(office_ui_fabric_react_1.Label, { required: this.props.renderRequiredIndicator }, this.props.label),
12
+ this.props.label && React.createElement(react_1.Label, { required: this.props.renderRequiredIndicator }, this.props.label),
13
13
  React.createElement("div", { "data-automationid": "identity-picker" },
14
- React.createElement(office_ui_fabric_react_1.NormalPeoplePicker, { onResolveSuggestions: this.props.onResolveSuggestions, onEmptyResolveSuggestions: this.props.onEmptyResolveSuggestions, getTextFromItem: this.props.getTextFromItem, pickerSuggestionsProps: this.props.suggestionProps, onRemoveSuggestion: this.props.onRemoveSuggestion, onInputChange: this.props.onInputChange, resolveDelay: this.props.resolveDelay, itemLimit: this.props.itemLimit, disabled: this.props.isDisabled, defaultSelectedItems: this.props.value, inputProps: {
14
+ React.createElement(react_1.NormalPeoplePicker, { onResolveSuggestions: this.props.onResolveSuggestions, onEmptyResolveSuggestions: this.props.onEmptyResolveSuggestions, getTextFromItem: this.props.getTextFromItem, pickerSuggestionsProps: this.props.suggestionProps, onRemoveSuggestion: this.props.onRemoveSuggestion, onInputChange: this.props.onInputChange, resolveDelay: this.props.resolveDelay, itemLimit: this.props.itemLimit, disabled: this.props.isDisabled, defaultSelectedItems: this.props.value, inputProps: {
15
15
  required: this.props.renderRequiredIndicator,
16
16
  placeholder: !!this.props.value && this.props.value.length > 0 ? '' : this.props.placeholder
17
17
  }, onChange: (items) => {
18
18
  this.props.onChange(items);
19
19
  } })),
20
- !!((_a = this.props) === null || _a === void 0 ? void 0 : _a.errorMessage) && React.createElement(office_ui_fabric_react_1.MessageBar, { messageBarType: office_ui_fabric_react_1.MessageBarType.warning }, this.props.errorMessage)));
20
+ !!((_a = this.props) === null || _a === void 0 ? void 0 : _a.errorMessage) && React.createElement(react_1.MessageBar, { messageBarType: react_1.MessageBarType.warning }, this.props.errorMessage)));
21
21
  }
22
22
  }
23
23
  exports.IdentityPicker = IdentityPicker;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NumberInput = void 0;
4
- const office_ui_fabric_react_1 = require("office-ui-fabric-react");
4
+ const react_1 = require("@fluentui/react");
5
5
  const React = require("react");
6
6
  const delimiter = '.';
7
7
  class NumberInput extends React.Component {
@@ -18,30 +18,23 @@ class NumberInput extends React.Component {
18
18
  if (!this.props)
19
19
  return null;
20
20
  return (React.createElement(React.Fragment, null,
21
- this.props.label && React.createElement(office_ui_fabric_react_1.Label, { required: this.props.renderRequiredIndicator }, this.props.label),
22
- React.createElement(office_ui_fabric_react_1.SpinButton, { "data-automationid": "number-input", styles: {
23
- input: {
24
- fontFamily: '"Segoe UI", "Segoe UI Web (West European)"',
25
- fontSize: 14,
26
- fontWeight: 400
27
- }
28
- }, inputProps: {
21
+ this.props.label && React.createElement(react_1.Label, { required: this.props.renderRequiredIndicator }, this.props.label),
22
+ React.createElement(react_1.SpinButton, { "data-automationid": "number-input", inputProps: {
29
23
  autoFocus: this.props.autoFocus,
30
24
  placeholder: this.props.placeholder,
31
- disabled: this.props.isDisabled
32
- }, value: (_a = this.state.intermediateValue) !== null && _a !== void 0 ? _a : '', onChange: (event) => {
33
- var _a;
34
- const value = NumberInput.normalizeData((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value);
35
- if (!value || isNaN(Number(value))) {
36
- this.setState({ intermediateValue: value });
37
- this.props.invalidateInput();
38
- return;
25
+ disabled: this.props.isDisabled,
26
+ onChange: (event) => {
27
+ const newValue = event.target.value;
28
+ const value = NumberInput.normalizeData(newValue);
29
+ if (!value || isNaN(Number(value))) {
30
+ this.setState({ intermediateValue: value, customWarning: 'The provided value is not a valid number.' });
31
+ this.props.invalidateInput();
32
+ return;
33
+ }
34
+ const numericValue = NumberInput.getNumericValue(value);
35
+ this.handleUserInput(numericValue, value);
39
36
  }
40
- const numericValue = NumberInput.getNumericValue(value);
41
- this.handleUserInput(numericValue, value);
42
- },
43
- // We should obligatorily define this function, because there will be a problem with incrementing/decrementing a newly typed value.
44
- onValidate: () => this.state.intermediateValue, onIncrement: (value) => {
37
+ }, value: (_a = this.state.intermediateValue) !== null && _a !== void 0 ? _a : '', onIncrement: (value) => {
45
38
  let numericValue = NumberInput.getNumericValue(value);
46
39
  numericValue += this.getStep();
47
40
  this.handleUserInput(numericValue, numericValue.toString());
@@ -50,8 +43,8 @@ class NumberInput extends React.Component {
50
43
  numericValue -= this.getStep();
51
44
  this.handleUserInput(numericValue, numericValue.toString());
52
45
  } }),
53
- !!((_b = this.props) === null || _b === void 0 ? void 0 : _b.errorMessage) && React.createElement(office_ui_fabric_react_1.MessageBar, { messageBarType: office_ui_fabric_react_1.MessageBarType.warning }, this.props.errorMessage),
54
- !!this.state.customWarning && React.createElement(office_ui_fabric_react_1.MessageBar, { messageBarType: office_ui_fabric_react_1.MessageBarType.warning }, this.state.customWarning)));
46
+ !!((_b = this.props) === null || _b === void 0 ? void 0 : _b.errorMessage) && React.createElement(react_1.MessageBar, { messageBarType: react_1.MessageBarType.warning }, this.props.errorMessage),
47
+ !!this.state.customWarning && React.createElement(react_1.MessageBar, { messageBarType: react_1.MessageBarType.warning }, this.state.customWarning)));
55
48
  }
56
49
  handleUserInput(value, intermediateValue) {
57
50
  const changeResult = this.ensureValueConsistency(value);
@@ -67,7 +60,7 @@ class NumberInput extends React.Component {
67
60
  return { warning: `The maximum value is ${maxValue}`, newValue: undefined };
68
61
  const minValue = this.getMinValue();
69
62
  if (value < minValue)
70
- return { warning: `The minimum value is ${maxValue}`, newValue: undefined };
63
+ return { warning: `The minimum value is ${minValue}`, newValue: undefined };
71
64
  if (!this.props.handleDecimalValues && value % 1 !== 0)
72
65
  return {
73
66
  warning: 'Decimal values are not allowed',
@@ -21,7 +21,7 @@ export declare class SingleValueInputElement<TValue, TComponentProps, TDynamicPr
21
21
  /** @inheritdoc */
22
22
  subscribeToInitialValueChange(subscription: ValueChangeSubscription<TValue>): void;
23
23
  /** @inheritdoc */
24
- subscribeToInvalidValueChange(subscription: InvalidValueChangeSubscription<TValue>): void;
24
+ subscribeToInvalidValueChange(subscription: InvalidValueChangeSubscription): void;
25
25
  /** @inheritdoc */
26
26
  protected setInternalValue(value: TValue, isInitial: boolean): void;
27
27
  /** @inheritdoc */
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LongTextInput = void 0;
4
4
  const React = require("react");
5
- const office_ui_fabric_react_1 = require("office-ui-fabric-react");
5
+ const react_1 = require("@fluentui/react");
6
6
  class LongTextInput extends React.Component {
7
7
  constructor() {
8
8
  super(...arguments);
@@ -19,8 +19,8 @@ class LongTextInput extends React.Component {
19
19
  if (!this.props)
20
20
  return null;
21
21
  return (React.createElement(React.Fragment, null,
22
- !!((_a = this.props) === null || _a === void 0 ? void 0 : _a.label) && React.createElement(office_ui_fabric_react_1.Label, { required: !!this.props.renderRequiredIndicator }, this.props.label),
23
- React.createElement(office_ui_fabric_react_1.TextField, { "data-automationid": "long-text-input", value: this.props.value || '', onChange: (_event, newValue) => {
22
+ !!((_a = this.props) === null || _a === void 0 ? void 0 : _a.label) && React.createElement(react_1.Label, { required: !!this.props.renderRequiredIndicator }, this.props.label),
23
+ React.createElement(react_1.TextField, { "data-automationid": "long-text-input", value: this.props.value || '', onChange: (_event, newValue) => {
24
24
  // Dynamically change the 'isMultiline' state property.
25
25
  const isMultiline = newValue.length > this.multilineThreshold;
26
26
  if (this.state.isMultiline !== isMultiline) {
@@ -2,15 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TextInput = void 0;
4
4
  const React = require("react");
5
- const office_ui_fabric_react_1 = require("office-ui-fabric-react");
5
+ const react_1 = require("@fluentui/react");
6
6
  class TextInput extends React.Component {
7
7
  render() {
8
8
  var _a;
9
9
  if (!this.props)
10
10
  return null;
11
11
  return (React.createElement(React.Fragment, null,
12
- !!((_a = this.props) === null || _a === void 0 ? void 0 : _a.label) && React.createElement(office_ui_fabric_react_1.Label, { required: !!this.props.renderRequiredIndicator }, this.props.label),
13
- React.createElement(office_ui_fabric_react_1.TextField, { "data-automationid": "text-input", value: this.props.value || '', onChange: (_event, newValue) => {
12
+ !!((_a = this.props) === null || _a === void 0 ? void 0 : _a.label) && React.createElement(react_1.Label, { required: !!this.props.renderRequiredIndicator }, this.props.label),
13
+ React.createElement(react_1.TextField, { "data-automationid": "text-input", value: this.props.value || '', onChange: (_event, newValue) => {
14
14
  this.props.onChange(newValue);
15
15
  }, errorMessage: this.props.errorMessage, type: this.props.contentType, placeholder: this.props.placeholder, validateOnFocusOut: true, disabled: this.props.isDisabled, autoFocus: this.props.autoFocus })));
16
16
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimePicker = void 0;
4
4
  const React = require("react");
5
- const office_ui_fabric_react_1 = require("office-ui-fabric-react");
5
+ const react_1 = require("@fluentui/react");
6
6
  class TimePicker extends React.Component {
7
7
  constructor() {
8
8
  super(...arguments);
@@ -16,11 +16,11 @@ class TimePicker extends React.Component {
16
16
  if (!this.props)
17
17
  return null;
18
18
  return (React.createElement(React.Fragment, null,
19
- !!((_a = this.props) === null || _a === void 0 ? void 0 : _a.label) && React.createElement(office_ui_fabric_react_1.Label, { required: !!this.props.renderRequiredIndicator }, this.props.label),
20
- React.createElement(office_ui_fabric_react_1.DatePicker, { "data-automationid": "time-input", placeholder: this.props.placeholder, onSelectDate: this.onChange, textField: {
19
+ !!((_a = this.props) === null || _a === void 0 ? void 0 : _a.label) && React.createElement(react_1.Label, { required: !!this.props.renderRequiredIndicator }, this.props.label),
20
+ React.createElement(react_1.DatePicker, { "data-automationid": "time-input", placeholder: this.props.placeholder, onSelectDate: this.onChange, textField: {
21
21
  errorMessage: this.props.errorMessage,
22
22
  disabled: this.props.isDisabled
23
- }, showGoToToday: !!this.props.showGoToToday, formatDate: this.props.formatDate, firstDayOfWeek: this.props.startWeekOnSunday ? office_ui_fabric_react_1.DayOfWeek.Sunday : office_ui_fabric_react_1.DayOfWeek.Monday, isMonthPickerVisible: !!this.props.showMonthPicker, highlightSelectedMonth: !!this.props.showMonthPicker, value: this.props.value })));
23
+ }, showGoToToday: !!this.props.showGoToToday, formatDate: this.props.formatDate, firstDayOfWeek: this.props.startWeekOnSunday ? react_1.DayOfWeek.Sunday : react_1.DayOfWeek.Monday, isMonthPickerVisible: !!this.props.showMonthPicker, highlightSelectedMonth: !!this.props.showMonthPicker, value: this.props.value })));
24
24
  }
25
25
  }
26
26
  exports.TimePicker = TimePicker;
@@ -1,2 +1,2 @@
1
1
  export declare type ValueChangeSubscription<TValue> = (newValue: TValue) => void;
2
- export declare type InvalidValueChangeSubscription<TValue> = () => void;
2
+ export declare type InvalidValueChangeSubscription = () => void;
@@ -1,4 +1,4 @@
1
- import { IDropdownOption } from 'office-ui-fabric-react';
1
+ import { IDropdownOption } from '@fluentui/react';
2
2
  import { IDropdownInputOption } from '../SingleValueInputElements';
3
3
  export declare class DropdownHelper {
4
4
  static getNormalizedOptions(defaultOption: IDropdownInputOption, allOptions: IDropdownInputOption[]): IDropdownOption[];
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DropdownHelper = void 0;
4
- const office_ui_fabric_react_1 = require("office-ui-fabric-react");
4
+ const react_1 = require("@fluentui/react");
5
5
  const SingleValueInputElements_1 = require("../SingleValueInputElements");
6
6
  class DropdownHelper {
7
7
  static getNormalizedOptions(defaultOption, allOptions) {
@@ -40,13 +40,13 @@ DropdownHelper.toNormalizedDropdownOption = (inputOption) => {
40
40
  if (inputOption.type !== undefined) {
41
41
  switch (inputOption.type) {
42
42
  case SingleValueInputElements_1.DropdownOptionType.Normal:
43
- itemType = office_ui_fabric_react_1.SelectableOptionMenuItemType.Normal;
43
+ itemType = react_1.SelectableOptionMenuItemType.Normal;
44
44
  break;
45
45
  case SingleValueInputElements_1.DropdownOptionType.Divider:
46
- itemType = office_ui_fabric_react_1.SelectableOptionMenuItemType.Divider;
46
+ itemType = react_1.SelectableOptionMenuItemType.Divider;
47
47
  break;
48
48
  case SingleValueInputElements_1.DropdownOptionType.Header:
49
- itemType = office_ui_fabric_react_1.SelectableOptionMenuItemType.Header;
49
+ itemType = react_1.SelectableOptionMenuItemType.Header;
50
50
  break;
51
51
  }
52
52
  }
@@ -8,8 +8,14 @@ function getFormState(inputs) {
8
8
  let hasChanges = false;
9
9
  let index = 0;
10
10
  while ((isValid || !hasChanges) && index < inputs.length) {
11
- isValid = isValid && inputs[index].isValid;
12
- hasChanges = hasChanges || inputs[index].hasChanges;
11
+ const currentInput = inputs[index];
12
+ if (!currentInput) {
13
+ isValid = false;
14
+ }
15
+ else {
16
+ isValid = isValid && currentInput.isValid;
17
+ hasChanges = hasChanges || currentInput.hasChanges;
18
+ }
13
19
  index++;
14
20
  }
15
21
  return {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@try-at-software/input-elements",
3
- "version": "1.2.0-alpha.26",
3
+ "version": "1.2.0-alpha.30",
4
4
  "description": "A package providing different input elements that are extensible and easily configurable for your custom needs.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "scripts": {
8
- "start-dev": "npm run lint && webpack-dev-server --mode development --open",
8
+ "start-dev": "npm run lint && webpack serve --mode development --open",
9
9
  "lint": ".\\node_modules\\.bin\\eslint \"./src/**/*.{js,jsx,ts,tsx}\" && prettier --check \"src/**/*.{ts,tsx,js,jsx,css,less,json}\"",
10
10
  "fix-code-style": "prettier --write \"src/**/*.{ts,tsx,js,jsx,css,less,json}\"",
11
11
  "test": "jest",
@@ -39,12 +39,11 @@
39
39
  "@types/enzyme": "3.10.8",
40
40
  "@types/enzyme-adapter-react-16": "1.0.6",
41
41
  "@types/jest": "26.0.23",
42
- "@types/react": "17.0.8",
42
+ "@types/react": "17.0.34",
43
43
  "@types/react-beautiful-dnd": "13.0.0",
44
44
  "@types/react-dom": "17.0.5",
45
45
  "@typescript-eslint/eslint-plugin": "4.25.0",
46
46
  "@typescript-eslint/parser": "4.25.0",
47
- "awesome-typescript-loader": "5.2.1",
48
47
  "copyfiles": "2.4.1",
49
48
  "css-loader": "5.2.6",
50
49
  "enzyme": "3.11.0",
@@ -57,25 +56,27 @@
57
56
  "html-webpack-plugin": "5.3.1",
58
57
  "jest": "27.0.1",
59
58
  "jest-each": "27.0.1",
59
+ "less": "4.1.2",
60
60
  "less-loader": "9.0.0",
61
+ "@fluentui/react": "8.41.0",
61
62
  "prettier": "2.3.0",
63
+ "react": "17.0.2",
62
64
  "react-dom": "17.0.2",
63
65
  "rimraf": "3.0.2",
64
66
  "source-map-loader": "3.0.0",
65
67
  "style-loader": "2.0.0",
66
68
  "ts-jest": "27.0.1",
69
+ "ts-loader": "9.2.6",
67
70
  "typescript": "4.3.2",
68
- "webpack": "5.37.1",
69
- "webpack-cli": "4.7.0",
70
- "webpack-dev-server": "3.11.2",
71
- "office-ui-fabric-react": "7.165.0",
72
- "react": "16.13.1"
71
+ "webpack": "5.61.0",
72
+ "webpack-cli": "4.9.1",
73
+ "webpack-dev-server": "4.4.0"
73
74
  },
74
75
  "dependencies": {
75
76
  "react-beautiful-dnd": "13.1.0"
76
77
  },
77
78
  "peerDependencies": {
78
- "office-ui-fabric-react": "7.x",
79
+ "@fluentui/react": ">=7.179.1",
79
80
  "react": ">=16.8.0"
80
81
  }
81
82
  }
@@ -1,51 +0,0 @@
1
- // import { ISingleValueInputElement } from '../ISingleValueInputElement';
2
- // import { UpdateType } from '../../UpdateType';
3
- //
4
- // export class DependentInputElementInitializer {
5
- // public static initializeDependency<TDependent, TPrincipal, TDependentProps = unknown, TPrincipalProps = unknown>(
6
- // principal: ISingleValueInputElement<TPrincipal, TPrincipalProps>,
7
- // dependent: ISingleValueInputElement<TDependent, TDependentProps>,
8
- // onPrincipalValueChanged: (newValue: TPrincipal, doneCallback: () => void) => void,
9
- // handleFalsyPrincipalValue?: () => void,
10
- // handleInitialRender?: () => void
11
- // ): void {
12
- // if (!dependent || !principal || !onPrincipalValueChanged) return;
13
- //
14
- // // If the dependent input element is required, this means that the principal should be required as well.
15
- // if (!!dependent.configuration?.isRequired) {
16
- // if (!principal.configuration) principal.configuration = { isRequired: true };
17
- // else principal.configuration.isRequired = true;
18
- // }
19
- //
20
- // const originalUpdateFunction = principal.update;
21
- // principal.update = (updateType: UpdateType): void => {
22
- // if (!!originalUpdateFunction) originalUpdateFunction(updateType);
23
- //
24
- // if (updateType === UpdateType.System) {
25
- // // Handle the system events - loading/ hiding an input element.
26
- // if (principal.isLoading || !principal.isVisible) dependent.hide();
27
- // else dependent.show();
28
- // } else {
29
- // dependent.resetValue();
30
- // if (!!principal.value === false) {
31
- // // If the falsy value is handled explicitly, execute that callback.
32
- // // In every other case, hide the dependent component.
33
- // if (!!handleFalsyPrincipalValue) handleFalsyPrincipalValue();
34
- // else if (dependent.isVisible) dependent.hide();
35
- // } else {
36
- // // Ensure that the dependent input element is visible.
37
- // if (!dependent.isVisible) dependent.show();
38
- //
39
- // dependent.load((finish: () => void): void => {
40
- // onPrincipalValueChanged(principal.value, finish);
41
- // });
42
- // }
43
- // }
44
- // };
45
- //
46
- // // If a callback to handle the initial render is passed, execute it.
47
- // // Else, hide the input element.
48
- // if (!!handleInitialRender) handleInitialRender();
49
- // else dependent.hide();
50
- // }
51
- // }
@@ -1 +0,0 @@
1
- // export * from './DependentInputElementInitializer';