@teselagen/ui 0.7.16 → 0.7.18

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.
@@ -0,0 +1,5 @@
1
+ export default TgHTMLSelect;
2
+ declare function TgHTMLSelect({ disabled, ...rest }: {
3
+ [x: string]: any;
4
+ disabled: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
package/index.cjs.js CHANGED
@@ -31878,7 +31878,7 @@ const AbstractInput = /* @__PURE__ */ __name(({
31878
31878
  disabled,
31879
31879
  fileLimit,
31880
31880
  inlineLabel,
31881
- input: { name: name2, value },
31881
+ input: { name: name2 },
31882
31882
  intent,
31883
31883
  isLabelTooltip,
31884
31884
  isLoadingDefaultValue,
@@ -31886,7 +31886,7 @@ const AbstractInput = /* @__PURE__ */ __name(({
31886
31886
  label,
31887
31887
  labelStyle,
31888
31888
  leftEl,
31889
- meta: { form, touched, error, warning: warning2 },
31889
+ meta: { form, touched, error, warning: warning2, initial },
31890
31890
  noFillField,
31891
31891
  noMarginBottom,
31892
31892
  noOuterLabel,
@@ -31903,10 +31903,9 @@ const AbstractInput = /* @__PURE__ */ __name(({
31903
31903
  tooltipProps
31904
31904
  }) => {
31905
31905
  const dispatch = reactRedux.useDispatch();
31906
- const initalValuePassed = React$1.useRef(value);
31907
31906
  const onDefaultValChanged = useStableReference(_onDefaultValChanged);
31908
31907
  const onFieldSubmit = useStableReference(_onFieldSubmit);
31909
- const doesNotHaveInitialValue = !isLoadingDefaultValue && !initalValuePassed.current;
31908
+ const doesNotHaveInitialValue = !initial;
31910
31909
  React$1.useEffect(() => {
31911
31910
  if (defaultValue2 !== void 0 && doesNotHaveInitialValue) {
31912
31911
  dispatch(reduxForm.change(form, name2, defaultValue2));
@@ -69638,6 +69637,14 @@ function AdvancedOptions({
69638
69637
  ), isOpen && /* @__PURE__ */ React$1.createElement("div", { style: { marginTop: 10 } }, content2 || children));
69639
69638
  }
69640
69639
  __name(AdvancedOptions, "AdvancedOptions");
69640
+ const TgHTMLSelect = /* @__PURE__ */ __name((_K) => {
69641
+ var _L = _K, { disabled } = _L, rest = __objRest(_L, ["disabled"]);
69642
+ if (disabled) {
69643
+ const opt = rest.options.find((o2) => o2.value === rest.value);
69644
+ return /* @__PURE__ */ React$1.createElement("div", __spreadProps(__spreadValues({}, rest), { className: classNames("bp3-html-select", rest.className) }), opt.label);
69645
+ }
69646
+ return /* @__PURE__ */ React$1.createElement(core.HTMLSelect, __spreadValues({}, rest));
69647
+ }, "TgHTMLSelect");
69641
69648
  const defaultMessagge = "Are you sure you want to leave? There are unsaved changes.";
69642
69649
  const warnBeforeLeave = /* @__PURE__ */ __name((e) => {
69643
69650
  if (window.Cypress) {
@@ -69668,14 +69675,14 @@ function BlueprintError({ error }) {
69668
69675
  return /* @__PURE__ */ React$1.createElement("div", { className: classNames(core.Classes.FORM_GROUP, core.Classes.INTENT_DANGER) }, /* @__PURE__ */ React$1.createElement("div", { className: classNames(core.Classes.FORM_HELPER_TEXT, "preserve-newline") }, error));
69669
69676
  }
69670
69677
  __name(BlueprintError, "BlueprintError");
69671
- function DropdownButton(_K) {
69672
- var _L = _K, {
69678
+ function DropdownButton(_M) {
69679
+ var _N = _M, {
69673
69680
  disabled,
69674
69681
  menu,
69675
69682
  noRightIcon,
69676
69683
  popoverProps,
69677
69684
  className
69678
- } = _L, rest = __objRest(_L, [
69685
+ } = _N, rest = __objRest(_N, [
69679
69686
  "disabled",
69680
69687
  "menu",
69681
69688
  "noRightIcon",
@@ -73356,14 +73363,14 @@ const EnhancedMenuItem = compose(
73356
73363
  }
73357
73364
  }),
73358
73365
  branch(({ navTo }) => navTo, withRouter)
73359
- )(function(_M) {
73360
- var _N = _M, {
73366
+ )(function(_O) {
73367
+ var _P = _O, {
73361
73368
  navTo,
73362
73369
  context,
73363
73370
  staticContext,
73364
73371
  didMount,
73365
73372
  willUnmount
73366
- } = _N, props = __objRest(_N, [
73373
+ } = _P, props = __objRest(_P, [
73367
73374
  "navTo",
73368
73375
  "context",
73369
73376
  "staticContext",
@@ -73587,8 +73594,8 @@ function doesSearchValMatchText(searchVal, justText) {
73587
73594
  );
73588
73595
  }
73589
73596
  __name(doesSearchValMatchText, "doesSearchValMatchText");
73590
- const MenuItemWithTooltip = /* @__PURE__ */ __name((_O) => {
73591
- var _P = _O, { tooltip } = _P, rest = __objRest(_P, ["tooltip"]);
73597
+ const MenuItemWithTooltip = /* @__PURE__ */ __name((_Q) => {
73598
+ var _R = _Q, { tooltip } = _R, rest = __objRest(_R, ["tooltip"]);
73592
73599
  let out = /* @__PURE__ */ React$1.createElement(core.MenuItem, __spreadValues({}, rest));
73593
73600
  if (tooltip) {
73594
73601
  out = /* @__PURE__ */ React$1.createElement(core.Tooltip, { content: tooltip }, out);
@@ -76026,6 +76033,7 @@ exports.SuggestField = SuggestField;
76026
76033
  exports.SwitchField = SwitchField;
76027
76034
  exports.TableFormTrackerContext = TableFormTrackerContext;
76028
76035
  exports.TextareaField = TextareaField;
76036
+ exports.TgHTMLSelect = TgHTMLSelect;
76029
76037
  exports.TgSelect = TgSelect$1;
76030
76038
  exports.Timeline = Timeline;
76031
76039
  exports.TimelineEvent = TimelineEvent;
package/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export { default as Loading } from './Loading';
22
22
  export { throwFormError } from './throwFormError';
23
23
  export { default as AdvancedOptions } from './AdvancedOptions';
24
24
  export { default as TgSelect } from './TgSelect';
25
+ export { default as TgHTMLSelect } from './TgHtmlSelect';
25
26
  export { default as wrapDialog } from './wrapDialog';
26
27
  export { default as PromptUnsavedChanges } from './PromptUnsavedChanges';
27
28
  export { default as BlueprintError } from './BlueprintError';
package/index.es.js CHANGED
@@ -58,7 +58,7 @@ var __async = (__this, __arguments, generator) => {
58
58
  };
59
59
  import * as React$1 from "react";
60
60
  import React__default, { useState, useEffect, forwardRef, useImperativeHandle, Fragment, useMemo, useRef, useReducer, useCallback, createElement, Component, useLayoutEffect, createContext, memo, useContext, isValidElement, PureComponent } from "react";
61
- import { Icon, Classes, Button, Intent, MenuItem, Keys, Tag, Popover, Tooltip, Spinner, InputGroup, Checkbox, Switch, TextArea, EditableText, NumericInput, RadioGroup, Position, FormGroup, Menu, Toaster, MenuDivider, useHotkeys, ContextMenu, Callout, Dialog, Card, Tabs, Tab, Colors, Overlay, KeyCombo, ProgressBar } from "@blueprintjs/core";
61
+ import { Icon, Classes, Button, Intent, MenuItem, Keys, Tag, Popover, Tooltip, Spinner, InputGroup, Checkbox, Switch, TextArea, EditableText, NumericInput, RadioGroup, Position, FormGroup, Menu, Toaster, MenuDivider, useHotkeys, ContextMenu, Callout, Dialog, Card, Tabs, Tab, Colors, HTMLSelect, Overlay, KeyCombo, ProgressBar } from "@blueprintjs/core";
62
62
  import { formValueSelector, initialize, change, Field, reduxForm, SubmissionError, destroy, touch, FormName, Fields } from "redux-form";
63
63
  import require$$2$1, { unstable_batchedUpdates, createPortal, flushSync } from "react-dom";
64
64
  import { connect, useDispatch, useSelector, useStore } from "react-redux";
@@ -31860,7 +31860,7 @@ const AbstractInput = /* @__PURE__ */ __name(({
31860
31860
  disabled,
31861
31861
  fileLimit,
31862
31862
  inlineLabel,
31863
- input: { name: name2, value },
31863
+ input: { name: name2 },
31864
31864
  intent,
31865
31865
  isLabelTooltip,
31866
31866
  isLoadingDefaultValue,
@@ -31868,7 +31868,7 @@ const AbstractInput = /* @__PURE__ */ __name(({
31868
31868
  label,
31869
31869
  labelStyle,
31870
31870
  leftEl,
31871
- meta: { form, touched, error, warning: warning2 },
31871
+ meta: { form, touched, error, warning: warning2, initial },
31872
31872
  noFillField,
31873
31873
  noMarginBottom,
31874
31874
  noOuterLabel,
@@ -31885,10 +31885,9 @@ const AbstractInput = /* @__PURE__ */ __name(({
31885
31885
  tooltipProps
31886
31886
  }) => {
31887
31887
  const dispatch = useDispatch();
31888
- const initalValuePassed = useRef(value);
31889
31888
  const onDefaultValChanged = useStableReference(_onDefaultValChanged);
31890
31889
  const onFieldSubmit = useStableReference(_onFieldSubmit);
31891
- const doesNotHaveInitialValue = !isLoadingDefaultValue && !initalValuePassed.current;
31890
+ const doesNotHaveInitialValue = !initial;
31892
31891
  useEffect(() => {
31893
31892
  if (defaultValue2 !== void 0 && doesNotHaveInitialValue) {
31894
31893
  dispatch(change(form, name2, defaultValue2));
@@ -69620,6 +69619,14 @@ function AdvancedOptions({
69620
69619
  ), isOpen && /* @__PURE__ */ React__default.createElement("div", { style: { marginTop: 10 } }, content2 || children));
69621
69620
  }
69622
69621
  __name(AdvancedOptions, "AdvancedOptions");
69622
+ const TgHTMLSelect = /* @__PURE__ */ __name((_K) => {
69623
+ var _L = _K, { disabled } = _L, rest = __objRest(_L, ["disabled"]);
69624
+ if (disabled) {
69625
+ const opt = rest.options.find((o2) => o2.value === rest.value);
69626
+ return /* @__PURE__ */ React__default.createElement("div", __spreadProps(__spreadValues({}, rest), { className: classNames("bp3-html-select", rest.className) }), opt.label);
69627
+ }
69628
+ return /* @__PURE__ */ React__default.createElement(HTMLSelect, __spreadValues({}, rest));
69629
+ }, "TgHTMLSelect");
69623
69630
  const defaultMessagge = "Are you sure you want to leave? There are unsaved changes.";
69624
69631
  const warnBeforeLeave = /* @__PURE__ */ __name((e) => {
69625
69632
  if (window.Cypress) {
@@ -69650,14 +69657,14 @@ function BlueprintError({ error }) {
69650
69657
  return /* @__PURE__ */ React__default.createElement("div", { className: classNames(Classes.FORM_GROUP, Classes.INTENT_DANGER) }, /* @__PURE__ */ React__default.createElement("div", { className: classNames(Classes.FORM_HELPER_TEXT, "preserve-newline") }, error));
69651
69658
  }
69652
69659
  __name(BlueprintError, "BlueprintError");
69653
- function DropdownButton(_K) {
69654
- var _L = _K, {
69660
+ function DropdownButton(_M) {
69661
+ var _N = _M, {
69655
69662
  disabled,
69656
69663
  menu,
69657
69664
  noRightIcon,
69658
69665
  popoverProps,
69659
69666
  className
69660
- } = _L, rest = __objRest(_L, [
69667
+ } = _N, rest = __objRest(_N, [
69661
69668
  "disabled",
69662
69669
  "menu",
69663
69670
  "noRightIcon",
@@ -73338,14 +73345,14 @@ const EnhancedMenuItem = compose(
73338
73345
  }
73339
73346
  }),
73340
73347
  branch(({ navTo }) => navTo, withRouter)
73341
- )(function(_M) {
73342
- var _N = _M, {
73348
+ )(function(_O) {
73349
+ var _P = _O, {
73343
73350
  navTo,
73344
73351
  context,
73345
73352
  staticContext,
73346
73353
  didMount,
73347
73354
  willUnmount
73348
- } = _N, props = __objRest(_N, [
73355
+ } = _P, props = __objRest(_P, [
73349
73356
  "navTo",
73350
73357
  "context",
73351
73358
  "staticContext",
@@ -73569,8 +73576,8 @@ function doesSearchValMatchText(searchVal, justText) {
73569
73576
  );
73570
73577
  }
73571
73578
  __name(doesSearchValMatchText, "doesSearchValMatchText");
73572
- const MenuItemWithTooltip = /* @__PURE__ */ __name((_O) => {
73573
- var _P = _O, { tooltip } = _P, rest = __objRest(_P, ["tooltip"]);
73579
+ const MenuItemWithTooltip = /* @__PURE__ */ __name((_Q) => {
73580
+ var _R = _Q, { tooltip } = _R, rest = __objRest(_R, ["tooltip"]);
73574
73581
  let out = /* @__PURE__ */ React__default.createElement(MenuItem, __spreadValues({}, rest));
73575
73582
  if (tooltip) {
73576
73583
  out = /* @__PURE__ */ React__default.createElement(Tooltip, { content: tooltip }, out);
@@ -76009,6 +76016,7 @@ export {
76009
76016
  SwitchField,
76010
76017
  TableFormTrackerContext,
76011
76018
  TextareaField,
76019
+ TgHTMLSelect,
76012
76020
  TgSelect$1 as TgSelect,
76013
76021
  Timeline,
76014
76022
  TimelineEvent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ui",
3
- "version": "0.7.16",
3
+ "version": "0.7.18",
4
4
  "main": "./src/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -7,7 +7,6 @@ import React, {
7
7
  useContext,
8
8
  useEffect,
9
9
  useMemo,
10
- useRef,
11
10
  useState
12
11
  } from "react";
13
12
  import { Field, change } from "redux-form";
@@ -137,7 +136,7 @@ const AbstractInput = ({
137
136
  disabled,
138
137
  fileLimit,
139
138
  inlineLabel,
140
- input: { name, value },
139
+ input: { name },
141
140
  intent,
142
141
  isLabelTooltip,
143
142
  isLoadingDefaultValue,
@@ -145,7 +144,7 @@ const AbstractInput = ({
145
144
  label,
146
145
  labelStyle,
147
146
  leftEl,
148
- meta: { form, touched, error, warning },
147
+ meta: { form, touched, error, warning, initial },
149
148
  noFillField,
150
149
  noMarginBottom,
151
150
  noOuterLabel,
@@ -162,11 +161,9 @@ const AbstractInput = ({
162
161
  tooltipProps
163
162
  }) => {
164
163
  const dispatch = useDispatch();
165
- const initalValuePassed = useRef(value);
166
164
  const onDefaultValChanged = useStableReference(_onDefaultValChanged);
167
165
  const onFieldSubmit = useStableReference(_onFieldSubmit);
168
- const doesNotHaveInitialValue =
169
- !isLoadingDefaultValue && !initalValuePassed.current;
166
+ const doesNotHaveInitialValue = !initial;
170
167
  // This only takes care that the default Value is changed when it is changed in the parent component
171
168
  useEffect(() => {
172
169
  //if the input already has an initial value being passed to it, we don't want to override it with the default value
@@ -0,0 +1,20 @@
1
+ import { HTMLSelect } from "@blueprintjs/core";
2
+ import React from "react";
3
+ import classNames from "classnames";
4
+
5
+ // so far this component just makes the styling of the disabled html select
6
+ // look like a regular html select with the selected option displayed
7
+ // (instead of greyed out and without the ability to have tooltips working)
8
+ const TgHTMLSelect = ({ disabled, ...rest }) => {
9
+ if (disabled) {
10
+ const opt = rest.options.find(o => o.value === rest.value);
11
+ return (
12
+ <div {...rest} className={classNames("bp3-html-select", rest.className)}>
13
+ {opt.label}
14
+ </div>
15
+ );
16
+ }
17
+ return <HTMLSelect {...rest}></HTMLSelect>;
18
+ };
19
+
20
+ export default TgHTMLSelect;
package/src/index.js CHANGED
@@ -30,6 +30,7 @@ export { default as Loading } from "./Loading";
30
30
  export { throwFormError } from "./throwFormError";
31
31
  export { default as AdvancedOptions } from "./AdvancedOptions";
32
32
  export { default as TgSelect } from "./TgSelect";
33
+ export { default as TgHTMLSelect } from "./TgHtmlSelect";
33
34
  export { default as wrapDialog } from "./wrapDialog";
34
35
  export { default as PromptUnsavedChanges } from "./PromptUnsavedChanges";
35
36
  export { default as BlueprintError } from "./BlueprintError";