@teselagen/ui 0.7.1 → 0.7.2

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,3 @@
1
+ export function FormSeparator({ label }?: {
2
+ label?: string | undefined;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,19 @@
1
1
  export default TgSuggest;
2
- declare function TgSuggest(props: any): import("react/jsx-runtime").JSX.Element;
2
+ declare function TgSuggest({ disabled, inputProps: _inputProps, intent, isLoading, isSimpleSearch, multi, noResultsText, notCreateable, onBlur, onChange, optionRenderer, options, placeholder, popoverProps: _popoverProps, value, ...rest }: {
3
+ [x: string]: any;
4
+ disabled: any;
5
+ inputProps: any;
6
+ intent: any;
7
+ isLoading: any;
8
+ isSimpleSearch: any;
9
+ multi: any;
10
+ noResultsText: any;
11
+ notCreateable: any;
12
+ onBlur: any;
13
+ onChange: any;
14
+ optionRenderer: any;
15
+ options: any;
16
+ placeholder: any;
17
+ popoverProps: any;
18
+ value: any;
19
+ }): import("react/jsx-runtime").JSX.Element;
package/index.cjs.js CHANGED
@@ -3071,6 +3071,9 @@ const LoadingDots = /* @__PURE__ */ __name(() => {
3071
3071
  }, []);
3072
3072
  return /* @__PURE__ */ React$1.createElement("span", null, dots);
3073
3073
  }, "LoadingDots");
3074
+ const FormSeparator = /* @__PURE__ */ __name(({ label = "or" } = {}) => {
3075
+ return /* @__PURE__ */ React$1.createElement("div", { className: "form-separator" }, /* @__PURE__ */ React$1.createElement("p", { style: { opacity: 0.8 } }, label));
3076
+ }, "FormSeparator");
3074
3077
  const AssignDefaultsModeContext = React$1.createContext({
3075
3078
  inAssignDefaultsMode: false,
3076
3079
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -31437,10 +31440,10 @@ const itemRenderer = /* @__PURE__ */ __name((i = "", { index: index2, handleClic
31437
31440
  },
31438
31441
  i
31439
31442
  ), "itemRenderer");
31440
- const TgSuggest = /* @__PURE__ */ __name((props) => {
31441
- const _a = props, {
31443
+ const TgSuggest = /* @__PURE__ */ __name((_e) => {
31444
+ var _f = _e, {
31442
31445
  disabled,
31443
- inputProps,
31446
+ inputProps: _inputProps,
31444
31447
  intent,
31445
31448
  isLoading,
31446
31449
  isSimpleSearch,
@@ -31448,14 +31451,13 @@ const TgSuggest = /* @__PURE__ */ __name((props) => {
31448
31451
  noResultsText,
31449
31452
  notCreateable,
31450
31453
  onBlur,
31451
- onChange: onChange = /* @__PURE__ */ __name(() => {
31452
- }, "onChange"),
31454
+ onChange,
31453
31455
  optionRenderer,
31454
- options: options = [],
31456
+ options: options,
31455
31457
  placeholder,
31456
- popoverProps,
31457
- value = void 0
31458
- } = _a, rest = __objRest(_a, [
31458
+ popoverProps: _popoverProps,
31459
+ value
31460
+ } = _f, rest = __objRest(_f, [
31459
31461
  "disabled",
31460
31462
  "inputProps",
31461
31463
  "intent",
@@ -31465,7 +31467,6 @@ const TgSuggest = /* @__PURE__ */ __name((props) => {
31465
31467
  "noResultsText",
31466
31468
  "notCreateable",
31467
31469
  "onBlur",
31468
- // eslint-disable-next-line @typescript-eslint/no-empty-function
31469
31470
  "onChange",
31470
31471
  "optionRenderer",
31471
31472
  //pull this one out here so it doesn't get passsed along
@@ -31475,42 +31476,66 @@ const TgSuggest = /* @__PURE__ */ __name((props) => {
31475
31476
  "value"
31476
31477
  ]);
31477
31478
  const inputRef = React$1.useRef(null);
31478
- const handleItemSelect = /* @__PURE__ */ __name((item) => {
31479
- inputRef.current && inputRef.current.blur();
31480
- return onChange(item);
31481
- }, "handleItemSelect");
31482
- const _itemListPredicate = /* @__PURE__ */ __name((queryString2, item) => {
31483
- return itemListPredicate(queryString2, item, isSimpleSearch);
31484
- }, "_itemListPredicate");
31479
+ const handleItemSelect = React$1.useCallback(
31480
+ (item) => {
31481
+ inputRef.current && inputRef.current.blur();
31482
+ return onChange == null ? void 0 : onChange(item);
31483
+ },
31484
+ [onChange]
31485
+ );
31486
+ const _itemListPredicate = React$1.useCallback(
31487
+ (queryString2, item) => {
31488
+ return itemListPredicate(queryString2, item, isSimpleSearch);
31489
+ },
31490
+ [isSimpleSearch]
31491
+ );
31492
+ const popoverProps = React$1.useMemo(
31493
+ () => __spreadValues({
31494
+ minimal: true,
31495
+ className: classNames("tg-select", {
31496
+ "tg-single-select": !multi
31497
+ }),
31498
+ wrapperTagName: "div",
31499
+ usePortal: false,
31500
+ canEscapeKeyClose: true
31501
+ }, _popoverProps),
31502
+ [multi, _popoverProps]
31503
+ );
31504
+ const onKeyDown = React$1.useCallback((e2) => {
31505
+ const { which } = e2;
31506
+ if (which === core.Keys.ENTER) {
31507
+ e2.preventDefault();
31508
+ e2.stopPropagation();
31509
+ }
31510
+ if (which === core.Keys.ESCAPE || which === core.Keys.TAB) {
31511
+ if (inputRef.current != null) {
31512
+ inputRef.current.blur();
31513
+ }
31514
+ e2.preventDefault();
31515
+ e2.stopPropagation();
31516
+ }
31517
+ }, []);
31518
+ const inputProps = React$1.useMemo(
31519
+ () => __spreadValues({
31520
+ inputRef: (n2) => {
31521
+ if (n2)
31522
+ inputRef.current = n2;
31523
+ },
31524
+ placeholder: placeholder || "Type here...",
31525
+ disabled,
31526
+ // tg: adding isLoading will cause the input to be blurred when using generic select asReactSelect (don't do it),
31527
+ intent
31528
+ }, _inputProps),
31529
+ [disabled, _inputProps, intent, placeholder]
31530
+ );
31485
31531
  return /* @__PURE__ */ React$1.createElement(
31486
31532
  select.Suggest,
31487
31533
  __spreadValues({
31488
31534
  closeOnSelect: true,
31489
- items: options || [],
31535
+ items: options,
31490
31536
  query: value,
31491
- popoverProps: __spreadValues({
31492
- minimal: true,
31493
- className: classNames("tg-select", {
31494
- "tg-single-select": !multi
31495
- }),
31496
- wrapperTagName: "div",
31497
- usePortal: false,
31498
- canEscapeKeyClose: true
31499
- }, popoverProps),
31500
- onKeyDown: (e2) => {
31501
- const { which } = e2;
31502
- if (which === core.Keys.ENTER) {
31503
- e2.preventDefault();
31504
- e2.stopPropagation();
31505
- }
31506
- if (which === core.Keys.ESCAPE || which === core.Keys.TAB) {
31507
- if (inputRef.current != null) {
31508
- inputRef.current.blur();
31509
- }
31510
- e2.preventDefault();
31511
- e2.stopPropagation();
31512
- }
31513
- },
31537
+ popoverProps,
31538
+ onKeyDown,
31514
31539
  onItemSelect: handleItemSelect,
31515
31540
  noResults: null,
31516
31541
  resetOnSelect: false,
@@ -31519,23 +31544,14 @@ const TgSuggest = /* @__PURE__ */ __name((props) => {
31519
31544
  itemListPredicate: _itemListPredicate,
31520
31545
  selectedItem: value,
31521
31546
  inputValueRenderer: (item) => item,
31522
- inputProps: __spreadValues({
31523
- inputRef: (n2) => {
31524
- if (n2)
31525
- inputRef.current = n2;
31526
- },
31527
- placeholder: placeholder || "Type here...",
31528
- disabled,
31529
- // tg: adding isLoading will cause the input to be blurred when using generic select asReactSelect (don't do it),
31530
- intent
31531
- }, inputProps),
31547
+ inputProps,
31532
31548
  isSimpleSearch,
31533
31549
  onChange
31534
31550
  }, rest)
31535
31551
  );
31536
31552
  }, "TgSuggest");
31537
- const InfoHelper = /* @__PURE__ */ __name((_e) => {
31538
- var _f = _e, {
31553
+ const InfoHelper = /* @__PURE__ */ __name((_g) => {
31554
+ var _h = _g, {
31539
31555
  className,
31540
31556
  content: content2,
31541
31557
  children,
@@ -31551,7 +31567,7 @@ const InfoHelper = /* @__PURE__ */ __name((_e) => {
31551
31567
  disabled,
31552
31568
  displayToSide,
31553
31569
  style
31554
- } = _f, rest = __objRest(_f, [
31570
+ } = _h, rest = __objRest(_h, [
31555
31571
  "className",
31556
31572
  "content",
31557
31573
  "children",
@@ -32003,13 +32019,13 @@ const AbstractInput = /* @__PURE__ */ __name(({
32003
32019
  rightEl
32004
32020
  );
32005
32021
  }, "AbstractInput");
32006
- const renderBlueprintDateInput = /* @__PURE__ */ __name((_g) => {
32007
- var _h = _g, {
32022
+ const renderBlueprintDateInput = /* @__PURE__ */ __name((_i) => {
32023
+ var _j = _i, {
32008
32024
  input,
32009
32025
  intent,
32010
32026
  onFieldSubmit,
32011
32027
  inputProps
32012
- } = _h, rest = __objRest(_h, [
32028
+ } = _j, rest = __objRest(_j, [
32013
32029
  "input",
32014
32030
  "intent",
32015
32031
  "onFieldSubmit",
@@ -32029,13 +32045,13 @@ const renderBlueprintDateInput = /* @__PURE__ */ __name((_g) => {
32029
32045
  })
32030
32046
  );
32031
32047
  }, "renderBlueprintDateInput");
32032
- const renderBlueprintDateRangeInput = /* @__PURE__ */ __name((_i) => {
32033
- var _j = _i, {
32048
+ const renderBlueprintDateRangeInput = /* @__PURE__ */ __name((_k) => {
32049
+ var _l = _k, {
32034
32050
  input,
32035
32051
  intent,
32036
32052
  onFieldSubmit,
32037
32053
  inputProps
32038
- } = _j, rest = __objRest(_j, [
32054
+ } = _l, rest = __objRest(_l, [
32039
32055
  "input",
32040
32056
  "intent",
32041
32057
  "onFieldSubmit",
@@ -32055,8 +32071,8 @@ const renderBlueprintDateRangeInput = /* @__PURE__ */ __name((_i) => {
32055
32071
  })
32056
32072
  );
32057
32073
  }, "renderBlueprintDateRangeInput");
32058
- const RenderBlueprintInput = /* @__PURE__ */ __name((_k) => {
32059
- var _l = _k, {
32074
+ const RenderBlueprintInput = /* @__PURE__ */ __name((_m) => {
32075
+ var _n = _m, {
32060
32076
  input,
32061
32077
  intent: intent,
32062
32078
  onFieldSubmit,
@@ -32064,7 +32080,7 @@ const RenderBlueprintInput = /* @__PURE__ */ __name((_k) => {
32064
32080
  asyncValidating,
32065
32081
  rightElement,
32066
32082
  clickToEdit
32067
- } = _l, rest = __objRest(_l, [
32083
+ } = _n, rest = __objRest(_n, [
32068
32084
  "input",
32069
32085
  // meta = {},
32070
32086
  "intent",
@@ -32153,14 +32169,14 @@ const RenderBlueprintInput = /* @__PURE__ */ __name((_k) => {
32153
32169
  )));
32154
32170
  return inner;
32155
32171
  }, "RenderBlueprintInput");
32156
- const renderBlueprintCheckbox = /* @__PURE__ */ __name((_m) => {
32157
- var _n = _m, {
32172
+ const renderBlueprintCheckbox = /* @__PURE__ */ __name((_o) => {
32173
+ var _p = _o, {
32158
32174
  input,
32159
32175
  label,
32160
32176
  tooltipInfo,
32161
32177
  beforeOnChange,
32162
32178
  onFieldSubmit
32163
- } = _n, rest = __objRest(_n, [
32179
+ } = _p, rest = __objRest(_p, [
32164
32180
  "input",
32165
32181
  "label",
32166
32182
  "tooltipInfo",
@@ -32197,14 +32213,14 @@ const getCheckboxOrSwitchOnChange = /* @__PURE__ */ __name(({
32197
32213
  onFieldSubmit(v2);
32198
32214
  });
32199
32215
  }, "getCheckboxOrSwitchOnChange");
32200
- const renderBlueprintSwitch = /* @__PURE__ */ __name((_o) => {
32201
- var _p = _o, {
32216
+ const renderBlueprintSwitch = /* @__PURE__ */ __name((_q) => {
32217
+ var _r = _q, {
32202
32218
  input,
32203
32219
  label,
32204
32220
  tooltipInfo,
32205
32221
  onFieldSubmit,
32206
32222
  beforeOnChange
32207
- } = _p, rest = __objRest(_p, [
32223
+ } = _r, rest = __objRest(_r, [
32208
32224
  "input",
32209
32225
  "label",
32210
32226
  "tooltipInfo",
@@ -32224,8 +32240,8 @@ const renderBlueprintSwitch = /* @__PURE__ */ __name((_o) => {
32224
32240
  })
32225
32241
  );
32226
32242
  }, "renderBlueprintSwitch");
32227
- const renderFileUpload = /* @__PURE__ */ __name((_q) => {
32228
- var _r = _q, { input, onFieldSubmit } = _r, rest = __objRest(_r, ["input", "onFieldSubmit"]);
32243
+ const renderFileUpload = /* @__PURE__ */ __name((_s) => {
32244
+ var _t = _s, { input, onFieldSubmit } = _t, rest = __objRest(_t, ["input", "onFieldSubmit"]);
32229
32245
  return /* @__PURE__ */ React$1.createElement(
32230
32246
  Uploader,
32231
32247
  __spreadProps(__spreadValues({
@@ -32237,8 +32253,8 @@ const renderFileUpload = /* @__PURE__ */ __name((_q) => {
32237
32253
  })
32238
32254
  );
32239
32255
  }, "renderFileUpload");
32240
- const RenderBlueprintTextarea = /* @__PURE__ */ __name((_s) => {
32241
- var _t = _s, {
32256
+ const RenderBlueprintTextarea = /* @__PURE__ */ __name((_u) => {
32257
+ var _v = _u, {
32242
32258
  input,
32243
32259
  onFieldSubmit,
32244
32260
  onKeyDown,
@@ -32246,7 +32262,7 @@ const RenderBlueprintTextarea = /* @__PURE__ */ __name((_s) => {
32246
32262
  inputClassName,
32247
32263
  clickToEdit,
32248
32264
  disabled
32249
- } = _t, rest = __objRest(_t, [
32265
+ } = _v, rest = __objRest(_v, [
32250
32266
  "input",
32251
32267
  "onFieldSubmit",
32252
32268
  "onKeyDown",
@@ -32446,15 +32462,15 @@ const renderReactSelect = /* @__PURE__ */ __name((props) => {
32446
32462
  const renderSuggest_old = /* @__PURE__ */ __name((props) => {
32447
32463
  return renderReactSelect(__spreadProps(__spreadValues({}, props), { asSuggest: true }));
32448
32464
  }, "renderSuggest_old");
32449
- const renderSuggest = /* @__PURE__ */ __name((_u) => {
32450
- var _v = _u, {
32465
+ const renderSuggest = /* @__PURE__ */ __name((_w) => {
32466
+ var _x = _w, {
32451
32467
  async,
32452
32468
  input: { value, onChange },
32453
32469
  hideValue,
32454
32470
  intent,
32455
32471
  options,
32456
32472
  onFieldSubmit
32457
- } = _v, rest = __objRest(_v, [
32473
+ } = _x, rest = __objRest(_x, [
32458
32474
  "async",
32459
32475
  "input",
32460
32476
  "hideValue",
@@ -32479,12 +32495,12 @@ const renderSuggest = /* @__PURE__ */ __name((_u) => {
32479
32495
  });
32480
32496
  return /* @__PURE__ */ React$1.createElement(TgSuggest, __spreadValues({}, propsToUse));
32481
32497
  }, "renderSuggest");
32482
- const BPSelect = /* @__PURE__ */ __name((_w) => {
32483
- var _x = _w, { value, onChange } = _x, rest = __objRest(_x, ["value", "onChange"]);
32498
+ const BPSelect = /* @__PURE__ */ __name((_y) => {
32499
+ var _z = _y, { value, onChange } = _z, rest = __objRest(_z, ["value", "onChange"]);
32484
32500
  return renderSelect(__spreadProps(__spreadValues({}, rest), { input: { onChange, value } }));
32485
32501
  }, "BPSelect");
32486
- const renderSelect = /* @__PURE__ */ __name((_y) => {
32487
- var _z = _y, {
32502
+ const renderSelect = /* @__PURE__ */ __name((_A) => {
32503
+ var _B = _A, {
32488
32504
  input: { value, onChange },
32489
32505
  hideValue,
32490
32506
  className,
@@ -32494,7 +32510,7 @@ const renderSelect = /* @__PURE__ */ __name((_y) => {
32494
32510
  hidePlaceHolder,
32495
32511
  minimal,
32496
32512
  disabled
32497
- } = _z, rest = __objRest(_z, [
32513
+ } = _B, rest = __objRest(_B, [
32498
32514
  "input",
32499
32515
  "hideValue",
32500
32516
  "className",
@@ -32562,15 +32578,15 @@ const renderSelect = /* @__PURE__ */ __name((_y) => {
32562
32578
  )
32563
32579
  );
32564
32580
  }, "renderSelect");
32565
- const renderBlueprintNumericInput = /* @__PURE__ */ __name((_A) => {
32566
- var _B = _A, {
32581
+ const renderBlueprintNumericInput = /* @__PURE__ */ __name((_C) => {
32582
+ var _D = _C, {
32567
32583
  input,
32568
32584
  hideValue,
32569
32585
  intent,
32570
32586
  inputClassName,
32571
32587
  onFieldSubmit,
32572
32588
  onAnyNumberChange
32573
- } = _B, rest = __objRest(_B, [
32589
+ } = _D, rest = __objRest(_D, [
32574
32590
  "input",
32575
32591
  "hideValue",
32576
32592
  "intent",
@@ -32615,12 +32631,12 @@ const renderBlueprintNumericInput = /* @__PURE__ */ __name((_A) => {
32615
32631
  })
32616
32632
  );
32617
32633
  }, "renderBlueprintNumericInput");
32618
- const renderBlueprintRadioGroup = /* @__PURE__ */ __name((_C) => {
32619
- var _D = _C, {
32634
+ const renderBlueprintRadioGroup = /* @__PURE__ */ __name((_E) => {
32635
+ var _F = _E, {
32620
32636
  input,
32621
32637
  options,
32622
32638
  onFieldSubmit
32623
- } = _D, rest = __objRest(_D, [
32639
+ } = _F, rest = __objRest(_F, [
32624
32640
  "input",
32625
32641
  "options",
32626
32642
  "onFieldSubmit"
@@ -32659,8 +32675,8 @@ const renderBlueprintRadioGroup = /* @__PURE__ */ __name((_C) => {
32659
32675
  })
32660
32676
  );
32661
32677
  }, "renderBlueprintRadioGroup");
32662
- const RenderReactColorPicker = /* @__PURE__ */ __name((_E) => {
32663
- var _F = _E, { input, onFieldSubmit } = _F, rest = __objRest(_F, ["input", "onFieldSubmit"]);
32678
+ const RenderReactColorPicker = /* @__PURE__ */ __name((_G) => {
32679
+ var _H = _G, { input, onFieldSubmit } = _H, rest = __objRest(_H, ["input", "onFieldSubmit"]);
32664
32680
  return /* @__PURE__ */ React$1.createElement(
32665
32681
  core.Popover,
32666
32682
  {
@@ -52385,8 +52401,8 @@ const itemSizeEstimators = {
52385
52401
  normal: () => 33.34,
52386
52402
  comfortable: () => 41.34
52387
52403
  };
52388
- const DataTable = /* @__PURE__ */ __name((_G) => {
52389
- var _H = _G, {
52404
+ const DataTable = /* @__PURE__ */ __name((_I) => {
52405
+ var _J = _I, {
52390
52406
  controlled_pageSize,
52391
52407
  formName = "tgDataTable",
52392
52408
  history,
@@ -52400,7 +52416,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
52400
52416
  tableParams: _tableParams,
52401
52417
  anyTouched,
52402
52418
  blur
52403
- } = _H, ownProps = __objRest(_H, [
52419
+ } = _J, ownProps = __objRest(_J, [
52404
52420
  "controlled_pageSize",
52405
52421
  "formName",
52406
52422
  "history",
@@ -68422,14 +68438,14 @@ function BlueprintError({ error }) {
68422
68438
  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));
68423
68439
  }
68424
68440
  __name(BlueprintError, "BlueprintError");
68425
- function DropdownButton(_I) {
68426
- var _J = _I, {
68441
+ function DropdownButton(_K) {
68442
+ var _L = _K, {
68427
68443
  disabled,
68428
68444
  menu,
68429
68445
  noRightIcon,
68430
68446
  popoverProps,
68431
68447
  className
68432
- } = _J, rest = __objRest(_J, [
68448
+ } = _L, rest = __objRest(_L, [
68433
68449
  "disabled",
68434
68450
  "menu",
68435
68451
  "noRightIcon",
@@ -72110,14 +72126,14 @@ const EnhancedMenuItem = compose(
72110
72126
  }
72111
72127
  }),
72112
72128
  branch(({ navTo }) => navTo, withRouter)
72113
- )(function(_K) {
72114
- var _L = _K, {
72129
+ )(function(_M) {
72130
+ var _N = _M, {
72115
72131
  navTo,
72116
72132
  context,
72117
72133
  staticContext,
72118
72134
  didMount,
72119
72135
  willUnmount
72120
- } = _L, props = __objRest(_L, [
72136
+ } = _N, props = __objRest(_N, [
72121
72137
  "navTo",
72122
72138
  "context",
72123
72139
  "staticContext",
@@ -72341,8 +72357,8 @@ function doesSearchValMatchText(searchVal, justText) {
72341
72357
  );
72342
72358
  }
72343
72359
  __name(doesSearchValMatchText, "doesSearchValMatchText");
72344
- const MenuItemWithTooltip = /* @__PURE__ */ __name((_M) => {
72345
- var _N = _M, { tooltip } = _N, rest = __objRest(_N, ["tooltip"]);
72360
+ const MenuItemWithTooltip = /* @__PURE__ */ __name((_O) => {
72361
+ var _P = _O, { tooltip } = _P, rest = __objRest(_P, ["tooltip"]);
72346
72362
  let out = /* @__PURE__ */ React$1.createElement(core.MenuItem, __spreadValues({}, rest));
72347
72363
  if (tooltip) {
72348
72364
  out = /* @__PURE__ */ React$1.createElement(core.Tooltip, { content: tooltip }, out);
@@ -74754,6 +74770,7 @@ exports.EditableTextField = EditableTextField;
74754
74770
  exports.EnhancedMenuItem = EnhancedMenuItem;
74755
74771
  exports.FileUploadField = FileUploadField;
74756
74772
  exports.FillWindow = FillWindow;
74773
+ exports.FormSeparator = FormSeparator;
74757
74774
  exports.HotkeysDialog = HotkeysDialog;
74758
74775
  exports.InfoHelper = InfoHelper;
74759
74776
  exports.InputField = InputField;
package/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { LoadingDots } from './FormComponents/LoadingDots';
2
+ export { FormSeparator } from './FormComponents/FormSeparator';
2
3
  export * from './AssignDefaultsModeContext';
3
4
  export * from './utils/tgFormValues';
4
5
  export * from './FormComponents';
package/index.es.js CHANGED
@@ -3053,6 +3053,9 @@ const LoadingDots = /* @__PURE__ */ __name(() => {
3053
3053
  }, []);
3054
3054
  return /* @__PURE__ */ React__default.createElement("span", null, dots);
3055
3055
  }, "LoadingDots");
3056
+ const FormSeparator = /* @__PURE__ */ __name(({ label = "or" } = {}) => {
3057
+ return /* @__PURE__ */ React__default.createElement("div", { className: "form-separator" }, /* @__PURE__ */ React__default.createElement("p", { style: { opacity: 0.8 } }, label));
3058
+ }, "FormSeparator");
3056
3059
  const AssignDefaultsModeContext = React__default.createContext({
3057
3060
  inAssignDefaultsMode: false,
3058
3061
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -31419,10 +31422,10 @@ const itemRenderer = /* @__PURE__ */ __name((i = "", { index: index2, handleClic
31419
31422
  },
31420
31423
  i
31421
31424
  ), "itemRenderer");
31422
- const TgSuggest = /* @__PURE__ */ __name((props) => {
31423
- const _a = props, {
31425
+ const TgSuggest = /* @__PURE__ */ __name((_e) => {
31426
+ var _f = _e, {
31424
31427
  disabled,
31425
- inputProps,
31428
+ inputProps: _inputProps,
31426
31429
  intent,
31427
31430
  isLoading,
31428
31431
  isSimpleSearch,
@@ -31430,14 +31433,13 @@ const TgSuggest = /* @__PURE__ */ __name((props) => {
31430
31433
  noResultsText,
31431
31434
  notCreateable,
31432
31435
  onBlur,
31433
- onChange: onChange = /* @__PURE__ */ __name(() => {
31434
- }, "onChange"),
31436
+ onChange,
31435
31437
  optionRenderer,
31436
- options: options = [],
31438
+ options: options,
31437
31439
  placeholder,
31438
- popoverProps,
31439
- value = void 0
31440
- } = _a, rest = __objRest(_a, [
31440
+ popoverProps: _popoverProps,
31441
+ value
31442
+ } = _f, rest = __objRest(_f, [
31441
31443
  "disabled",
31442
31444
  "inputProps",
31443
31445
  "intent",
@@ -31447,7 +31449,6 @@ const TgSuggest = /* @__PURE__ */ __name((props) => {
31447
31449
  "noResultsText",
31448
31450
  "notCreateable",
31449
31451
  "onBlur",
31450
- // eslint-disable-next-line @typescript-eslint/no-empty-function
31451
31452
  "onChange",
31452
31453
  "optionRenderer",
31453
31454
  //pull this one out here so it doesn't get passsed along
@@ -31457,42 +31458,66 @@ const TgSuggest = /* @__PURE__ */ __name((props) => {
31457
31458
  "value"
31458
31459
  ]);
31459
31460
  const inputRef = useRef(null);
31460
- const handleItemSelect = /* @__PURE__ */ __name((item) => {
31461
- inputRef.current && inputRef.current.blur();
31462
- return onChange(item);
31463
- }, "handleItemSelect");
31464
- const _itemListPredicate = /* @__PURE__ */ __name((queryString2, item) => {
31465
- return itemListPredicate(queryString2, item, isSimpleSearch);
31466
- }, "_itemListPredicate");
31461
+ const handleItemSelect = useCallback(
31462
+ (item) => {
31463
+ inputRef.current && inputRef.current.blur();
31464
+ return onChange == null ? void 0 : onChange(item);
31465
+ },
31466
+ [onChange]
31467
+ );
31468
+ const _itemListPredicate = useCallback(
31469
+ (queryString2, item) => {
31470
+ return itemListPredicate(queryString2, item, isSimpleSearch);
31471
+ },
31472
+ [isSimpleSearch]
31473
+ );
31474
+ const popoverProps = useMemo(
31475
+ () => __spreadValues({
31476
+ minimal: true,
31477
+ className: classNames("tg-select", {
31478
+ "tg-single-select": !multi
31479
+ }),
31480
+ wrapperTagName: "div",
31481
+ usePortal: false,
31482
+ canEscapeKeyClose: true
31483
+ }, _popoverProps),
31484
+ [multi, _popoverProps]
31485
+ );
31486
+ const onKeyDown = useCallback((e2) => {
31487
+ const { which } = e2;
31488
+ if (which === Keys.ENTER) {
31489
+ e2.preventDefault();
31490
+ e2.stopPropagation();
31491
+ }
31492
+ if (which === Keys.ESCAPE || which === Keys.TAB) {
31493
+ if (inputRef.current != null) {
31494
+ inputRef.current.blur();
31495
+ }
31496
+ e2.preventDefault();
31497
+ e2.stopPropagation();
31498
+ }
31499
+ }, []);
31500
+ const inputProps = useMemo(
31501
+ () => __spreadValues({
31502
+ inputRef: (n2) => {
31503
+ if (n2)
31504
+ inputRef.current = n2;
31505
+ },
31506
+ placeholder: placeholder || "Type here...",
31507
+ disabled,
31508
+ // tg: adding isLoading will cause the input to be blurred when using generic select asReactSelect (don't do it),
31509
+ intent
31510
+ }, _inputProps),
31511
+ [disabled, _inputProps, intent, placeholder]
31512
+ );
31467
31513
  return /* @__PURE__ */ React__default.createElement(
31468
31514
  Suggest,
31469
31515
  __spreadValues({
31470
31516
  closeOnSelect: true,
31471
- items: options || [],
31517
+ items: options,
31472
31518
  query: value,
31473
- popoverProps: __spreadValues({
31474
- minimal: true,
31475
- className: classNames("tg-select", {
31476
- "tg-single-select": !multi
31477
- }),
31478
- wrapperTagName: "div",
31479
- usePortal: false,
31480
- canEscapeKeyClose: true
31481
- }, popoverProps),
31482
- onKeyDown: (e2) => {
31483
- const { which } = e2;
31484
- if (which === Keys.ENTER) {
31485
- e2.preventDefault();
31486
- e2.stopPropagation();
31487
- }
31488
- if (which === Keys.ESCAPE || which === Keys.TAB) {
31489
- if (inputRef.current != null) {
31490
- inputRef.current.blur();
31491
- }
31492
- e2.preventDefault();
31493
- e2.stopPropagation();
31494
- }
31495
- },
31519
+ popoverProps,
31520
+ onKeyDown,
31496
31521
  onItemSelect: handleItemSelect,
31497
31522
  noResults: null,
31498
31523
  resetOnSelect: false,
@@ -31501,23 +31526,14 @@ const TgSuggest = /* @__PURE__ */ __name((props) => {
31501
31526
  itemListPredicate: _itemListPredicate,
31502
31527
  selectedItem: value,
31503
31528
  inputValueRenderer: (item) => item,
31504
- inputProps: __spreadValues({
31505
- inputRef: (n2) => {
31506
- if (n2)
31507
- inputRef.current = n2;
31508
- },
31509
- placeholder: placeholder || "Type here...",
31510
- disabled,
31511
- // tg: adding isLoading will cause the input to be blurred when using generic select asReactSelect (don't do it),
31512
- intent
31513
- }, inputProps),
31529
+ inputProps,
31514
31530
  isSimpleSearch,
31515
31531
  onChange
31516
31532
  }, rest)
31517
31533
  );
31518
31534
  }, "TgSuggest");
31519
- const InfoHelper = /* @__PURE__ */ __name((_e) => {
31520
- var _f = _e, {
31535
+ const InfoHelper = /* @__PURE__ */ __name((_g) => {
31536
+ var _h = _g, {
31521
31537
  className,
31522
31538
  content: content2,
31523
31539
  children,
@@ -31533,7 +31549,7 @@ const InfoHelper = /* @__PURE__ */ __name((_e) => {
31533
31549
  disabled,
31534
31550
  displayToSide,
31535
31551
  style
31536
- } = _f, rest = __objRest(_f, [
31552
+ } = _h, rest = __objRest(_h, [
31537
31553
  "className",
31538
31554
  "content",
31539
31555
  "children",
@@ -31985,13 +32001,13 @@ const AbstractInput = /* @__PURE__ */ __name(({
31985
32001
  rightEl
31986
32002
  );
31987
32003
  }, "AbstractInput");
31988
- const renderBlueprintDateInput = /* @__PURE__ */ __name((_g) => {
31989
- var _h = _g, {
32004
+ const renderBlueprintDateInput = /* @__PURE__ */ __name((_i) => {
32005
+ var _j = _i, {
31990
32006
  input,
31991
32007
  intent,
31992
32008
  onFieldSubmit,
31993
32009
  inputProps
31994
- } = _h, rest = __objRest(_h, [
32010
+ } = _j, rest = __objRest(_j, [
31995
32011
  "input",
31996
32012
  "intent",
31997
32013
  "onFieldSubmit",
@@ -32011,13 +32027,13 @@ const renderBlueprintDateInput = /* @__PURE__ */ __name((_g) => {
32011
32027
  })
32012
32028
  );
32013
32029
  }, "renderBlueprintDateInput");
32014
- const renderBlueprintDateRangeInput = /* @__PURE__ */ __name((_i) => {
32015
- var _j = _i, {
32030
+ const renderBlueprintDateRangeInput = /* @__PURE__ */ __name((_k) => {
32031
+ var _l = _k, {
32016
32032
  input,
32017
32033
  intent,
32018
32034
  onFieldSubmit,
32019
32035
  inputProps
32020
- } = _j, rest = __objRest(_j, [
32036
+ } = _l, rest = __objRest(_l, [
32021
32037
  "input",
32022
32038
  "intent",
32023
32039
  "onFieldSubmit",
@@ -32037,8 +32053,8 @@ const renderBlueprintDateRangeInput = /* @__PURE__ */ __name((_i) => {
32037
32053
  })
32038
32054
  );
32039
32055
  }, "renderBlueprintDateRangeInput");
32040
- const RenderBlueprintInput = /* @__PURE__ */ __name((_k) => {
32041
- var _l = _k, {
32056
+ const RenderBlueprintInput = /* @__PURE__ */ __name((_m) => {
32057
+ var _n = _m, {
32042
32058
  input,
32043
32059
  intent: intent,
32044
32060
  onFieldSubmit,
@@ -32046,7 +32062,7 @@ const RenderBlueprintInput = /* @__PURE__ */ __name((_k) => {
32046
32062
  asyncValidating,
32047
32063
  rightElement,
32048
32064
  clickToEdit
32049
- } = _l, rest = __objRest(_l, [
32065
+ } = _n, rest = __objRest(_n, [
32050
32066
  "input",
32051
32067
  // meta = {},
32052
32068
  "intent",
@@ -32135,14 +32151,14 @@ const RenderBlueprintInput = /* @__PURE__ */ __name((_k) => {
32135
32151
  )));
32136
32152
  return inner;
32137
32153
  }, "RenderBlueprintInput");
32138
- const renderBlueprintCheckbox = /* @__PURE__ */ __name((_m) => {
32139
- var _n = _m, {
32154
+ const renderBlueprintCheckbox = /* @__PURE__ */ __name((_o) => {
32155
+ var _p = _o, {
32140
32156
  input,
32141
32157
  label,
32142
32158
  tooltipInfo,
32143
32159
  beforeOnChange,
32144
32160
  onFieldSubmit
32145
- } = _n, rest = __objRest(_n, [
32161
+ } = _p, rest = __objRest(_p, [
32146
32162
  "input",
32147
32163
  "label",
32148
32164
  "tooltipInfo",
@@ -32179,14 +32195,14 @@ const getCheckboxOrSwitchOnChange = /* @__PURE__ */ __name(({
32179
32195
  onFieldSubmit(v2);
32180
32196
  });
32181
32197
  }, "getCheckboxOrSwitchOnChange");
32182
- const renderBlueprintSwitch = /* @__PURE__ */ __name((_o) => {
32183
- var _p = _o, {
32198
+ const renderBlueprintSwitch = /* @__PURE__ */ __name((_q) => {
32199
+ var _r = _q, {
32184
32200
  input,
32185
32201
  label,
32186
32202
  tooltipInfo,
32187
32203
  onFieldSubmit,
32188
32204
  beforeOnChange
32189
- } = _p, rest = __objRest(_p, [
32205
+ } = _r, rest = __objRest(_r, [
32190
32206
  "input",
32191
32207
  "label",
32192
32208
  "tooltipInfo",
@@ -32206,8 +32222,8 @@ const renderBlueprintSwitch = /* @__PURE__ */ __name((_o) => {
32206
32222
  })
32207
32223
  );
32208
32224
  }, "renderBlueprintSwitch");
32209
- const renderFileUpload = /* @__PURE__ */ __name((_q) => {
32210
- var _r = _q, { input, onFieldSubmit } = _r, rest = __objRest(_r, ["input", "onFieldSubmit"]);
32225
+ const renderFileUpload = /* @__PURE__ */ __name((_s) => {
32226
+ var _t = _s, { input, onFieldSubmit } = _t, rest = __objRest(_t, ["input", "onFieldSubmit"]);
32211
32227
  return /* @__PURE__ */ React__default.createElement(
32212
32228
  Uploader,
32213
32229
  __spreadProps(__spreadValues({
@@ -32219,8 +32235,8 @@ const renderFileUpload = /* @__PURE__ */ __name((_q) => {
32219
32235
  })
32220
32236
  );
32221
32237
  }, "renderFileUpload");
32222
- const RenderBlueprintTextarea = /* @__PURE__ */ __name((_s) => {
32223
- var _t = _s, {
32238
+ const RenderBlueprintTextarea = /* @__PURE__ */ __name((_u) => {
32239
+ var _v = _u, {
32224
32240
  input,
32225
32241
  onFieldSubmit,
32226
32242
  onKeyDown,
@@ -32228,7 +32244,7 @@ const RenderBlueprintTextarea = /* @__PURE__ */ __name((_s) => {
32228
32244
  inputClassName,
32229
32245
  clickToEdit,
32230
32246
  disabled
32231
- } = _t, rest = __objRest(_t, [
32247
+ } = _v, rest = __objRest(_v, [
32232
32248
  "input",
32233
32249
  "onFieldSubmit",
32234
32250
  "onKeyDown",
@@ -32428,15 +32444,15 @@ const renderReactSelect = /* @__PURE__ */ __name((props) => {
32428
32444
  const renderSuggest_old = /* @__PURE__ */ __name((props) => {
32429
32445
  return renderReactSelect(__spreadProps(__spreadValues({}, props), { asSuggest: true }));
32430
32446
  }, "renderSuggest_old");
32431
- const renderSuggest = /* @__PURE__ */ __name((_u) => {
32432
- var _v = _u, {
32447
+ const renderSuggest = /* @__PURE__ */ __name((_w) => {
32448
+ var _x = _w, {
32433
32449
  async,
32434
32450
  input: { value, onChange },
32435
32451
  hideValue,
32436
32452
  intent,
32437
32453
  options,
32438
32454
  onFieldSubmit
32439
- } = _v, rest = __objRest(_v, [
32455
+ } = _x, rest = __objRest(_x, [
32440
32456
  "async",
32441
32457
  "input",
32442
32458
  "hideValue",
@@ -32461,12 +32477,12 @@ const renderSuggest = /* @__PURE__ */ __name((_u) => {
32461
32477
  });
32462
32478
  return /* @__PURE__ */ React__default.createElement(TgSuggest, __spreadValues({}, propsToUse));
32463
32479
  }, "renderSuggest");
32464
- const BPSelect = /* @__PURE__ */ __name((_w) => {
32465
- var _x = _w, { value, onChange } = _x, rest = __objRest(_x, ["value", "onChange"]);
32480
+ const BPSelect = /* @__PURE__ */ __name((_y) => {
32481
+ var _z = _y, { value, onChange } = _z, rest = __objRest(_z, ["value", "onChange"]);
32466
32482
  return renderSelect(__spreadProps(__spreadValues({}, rest), { input: { onChange, value } }));
32467
32483
  }, "BPSelect");
32468
- const renderSelect = /* @__PURE__ */ __name((_y) => {
32469
- var _z = _y, {
32484
+ const renderSelect = /* @__PURE__ */ __name((_A) => {
32485
+ var _B = _A, {
32470
32486
  input: { value, onChange },
32471
32487
  hideValue,
32472
32488
  className,
@@ -32476,7 +32492,7 @@ const renderSelect = /* @__PURE__ */ __name((_y) => {
32476
32492
  hidePlaceHolder,
32477
32493
  minimal,
32478
32494
  disabled
32479
- } = _z, rest = __objRest(_z, [
32495
+ } = _B, rest = __objRest(_B, [
32480
32496
  "input",
32481
32497
  "hideValue",
32482
32498
  "className",
@@ -32544,15 +32560,15 @@ const renderSelect = /* @__PURE__ */ __name((_y) => {
32544
32560
  )
32545
32561
  );
32546
32562
  }, "renderSelect");
32547
- const renderBlueprintNumericInput = /* @__PURE__ */ __name((_A) => {
32548
- var _B = _A, {
32563
+ const renderBlueprintNumericInput = /* @__PURE__ */ __name((_C) => {
32564
+ var _D = _C, {
32549
32565
  input,
32550
32566
  hideValue,
32551
32567
  intent,
32552
32568
  inputClassName,
32553
32569
  onFieldSubmit,
32554
32570
  onAnyNumberChange
32555
- } = _B, rest = __objRest(_B, [
32571
+ } = _D, rest = __objRest(_D, [
32556
32572
  "input",
32557
32573
  "hideValue",
32558
32574
  "intent",
@@ -32597,12 +32613,12 @@ const renderBlueprintNumericInput = /* @__PURE__ */ __name((_A) => {
32597
32613
  })
32598
32614
  );
32599
32615
  }, "renderBlueprintNumericInput");
32600
- const renderBlueprintRadioGroup = /* @__PURE__ */ __name((_C) => {
32601
- var _D = _C, {
32616
+ const renderBlueprintRadioGroup = /* @__PURE__ */ __name((_E) => {
32617
+ var _F = _E, {
32602
32618
  input,
32603
32619
  options,
32604
32620
  onFieldSubmit
32605
- } = _D, rest = __objRest(_D, [
32621
+ } = _F, rest = __objRest(_F, [
32606
32622
  "input",
32607
32623
  "options",
32608
32624
  "onFieldSubmit"
@@ -32641,8 +32657,8 @@ const renderBlueprintRadioGroup = /* @__PURE__ */ __name((_C) => {
32641
32657
  })
32642
32658
  );
32643
32659
  }, "renderBlueprintRadioGroup");
32644
- const RenderReactColorPicker = /* @__PURE__ */ __name((_E) => {
32645
- var _F = _E, { input, onFieldSubmit } = _F, rest = __objRest(_F, ["input", "onFieldSubmit"]);
32660
+ const RenderReactColorPicker = /* @__PURE__ */ __name((_G) => {
32661
+ var _H = _G, { input, onFieldSubmit } = _H, rest = __objRest(_H, ["input", "onFieldSubmit"]);
32646
32662
  return /* @__PURE__ */ React__default.createElement(
32647
32663
  Popover,
32648
32664
  {
@@ -52367,8 +52383,8 @@ const itemSizeEstimators = {
52367
52383
  normal: () => 33.34,
52368
52384
  comfortable: () => 41.34
52369
52385
  };
52370
- const DataTable = /* @__PURE__ */ __name((_G) => {
52371
- var _H = _G, {
52386
+ const DataTable = /* @__PURE__ */ __name((_I) => {
52387
+ var _J = _I, {
52372
52388
  controlled_pageSize,
52373
52389
  formName = "tgDataTable",
52374
52390
  history,
@@ -52382,7 +52398,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
52382
52398
  tableParams: _tableParams,
52383
52399
  anyTouched,
52384
52400
  blur
52385
- } = _H, ownProps = __objRest(_H, [
52401
+ } = _J, ownProps = __objRest(_J, [
52386
52402
  "controlled_pageSize",
52387
52403
  "formName",
52388
52404
  "history",
@@ -68404,14 +68420,14 @@ function BlueprintError({ error }) {
68404
68420
  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));
68405
68421
  }
68406
68422
  __name(BlueprintError, "BlueprintError");
68407
- function DropdownButton(_I) {
68408
- var _J = _I, {
68423
+ function DropdownButton(_K) {
68424
+ var _L = _K, {
68409
68425
  disabled,
68410
68426
  menu,
68411
68427
  noRightIcon,
68412
68428
  popoverProps,
68413
68429
  className
68414
- } = _J, rest = __objRest(_J, [
68430
+ } = _L, rest = __objRest(_L, [
68415
68431
  "disabled",
68416
68432
  "menu",
68417
68433
  "noRightIcon",
@@ -72092,14 +72108,14 @@ const EnhancedMenuItem = compose(
72092
72108
  }
72093
72109
  }),
72094
72110
  branch(({ navTo }) => navTo, withRouter)
72095
- )(function(_K) {
72096
- var _L = _K, {
72111
+ )(function(_M) {
72112
+ var _N = _M, {
72097
72113
  navTo,
72098
72114
  context,
72099
72115
  staticContext,
72100
72116
  didMount,
72101
72117
  willUnmount
72102
- } = _L, props = __objRest(_L, [
72118
+ } = _N, props = __objRest(_N, [
72103
72119
  "navTo",
72104
72120
  "context",
72105
72121
  "staticContext",
@@ -72323,8 +72339,8 @@ function doesSearchValMatchText(searchVal, justText) {
72323
72339
  );
72324
72340
  }
72325
72341
  __name(doesSearchValMatchText, "doesSearchValMatchText");
72326
- const MenuItemWithTooltip = /* @__PURE__ */ __name((_M) => {
72327
- var _N = _M, { tooltip } = _N, rest = __objRest(_N, ["tooltip"]);
72342
+ const MenuItemWithTooltip = /* @__PURE__ */ __name((_O) => {
72343
+ var _P = _O, { tooltip } = _P, rest = __objRest(_P, ["tooltip"]);
72328
72344
  let out = /* @__PURE__ */ React__default.createElement(MenuItem, __spreadValues({}, rest));
72329
72345
  if (tooltip) {
72330
72346
  out = /* @__PURE__ */ React__default.createElement(Tooltip, { content: tooltip }, out);
@@ -74737,6 +74753,7 @@ export {
74737
74753
  EnhancedMenuItem,
74738
74754
  FileUploadField,
74739
74755
  FillWindow,
74756
+ FormSeparator,
74740
74757
  HotkeysDialog,
74741
74758
  InfoHelper,
74742
74759
  InputField,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ui",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "main": "./src/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import "./style.css";
3
+ export const FormSeparator = ({ label = "or" } = {}) => {
4
+ return (
5
+ <div className="form-separator">
6
+ <p style={{ opacity: 0.8 }}>{label}</p>
7
+ </div>
8
+ );
9
+ };
@@ -249,3 +249,27 @@
249
249
  .bp3-dark .tg-color-picker-selector input {
250
250
  color: #222222;
251
251
  }
252
+
253
+ .form-separator {
254
+ p {
255
+ display: flex;
256
+ align-items: center;
257
+ width: 100%;
258
+ }
259
+ p::before {
260
+ content: "";
261
+ display: block;
262
+ width: 100%;
263
+ height: 1px;
264
+ background-color: #e1e4e8;
265
+ margin-right: 16px;
266
+ }
267
+ p::after {
268
+ content: "";
269
+ display: block;
270
+ width: 100%;
271
+ height: 1px;
272
+ background-color: #e1e4e8;
273
+ margin-left: 16px;
274
+ }
275
+ }
@@ -1,6 +1,6 @@
1
1
  import { Suggest } from "@blueprintjs/select";
2
2
  import { Keys } from "@blueprintjs/core";
3
- import React, { useRef } from "react";
3
+ import React, { useCallback, useMemo, useRef } from "react";
4
4
  import classNames from "classnames";
5
5
  import { itemListPredicate } from "../TgSelect";
6
6
 
@@ -19,69 +19,92 @@ const itemRenderer = (i = "", { index, handleClick, modifiers }) => (
19
19
  </div>
20
20
  );
21
21
 
22
- const TgSuggest = props => {
23
- const {
24
- disabled,
25
- inputProps,
26
- intent,
27
- isLoading,
28
- isSimpleSearch,
29
- multi,
30
- noResultsText,
31
- notCreateable,
32
- onBlur,
33
- // eslint-disable-next-line @typescript-eslint/no-empty-function
34
- onChange = () => {},
35
- optionRenderer, //pull this one out here so it doesn't get passsed along
36
- options = [],
37
- placeholder,
38
- popoverProps,
39
- value = undefined,
40
- ...rest
41
- } = props;
42
-
22
+ const TgSuggest = ({
23
+ disabled,
24
+ inputProps: _inputProps,
25
+ intent,
26
+ isLoading,
27
+ isSimpleSearch,
28
+ multi,
29
+ noResultsText,
30
+ notCreateable,
31
+ onBlur,
32
+ onChange,
33
+ optionRenderer, //pull this one out here so it doesn't get passsed along
34
+ options,
35
+ placeholder,
36
+ popoverProps: _popoverProps,
37
+ value,
38
+ ...rest
39
+ }) => {
43
40
  const inputRef = useRef(null);
44
41
 
45
- const handleItemSelect = item => {
46
- inputRef.current && inputRef.current.blur();
47
- return onChange(item);
48
- };
42
+ const handleItemSelect = useCallback(
43
+ item => {
44
+ inputRef.current && inputRef.current.blur();
45
+ return onChange?.(item);
46
+ },
47
+ [onChange]
48
+ );
49
49
 
50
- const _itemListPredicate = (queryString, item) => {
51
- return itemListPredicate(queryString, item, isSimpleSearch);
52
- };
50
+ const _itemListPredicate = useCallback(
51
+ (queryString, item) => {
52
+ return itemListPredicate(queryString, item, isSimpleSearch);
53
+ },
54
+ [isSimpleSearch]
55
+ );
56
+
57
+ const popoverProps = useMemo(
58
+ () => ({
59
+ minimal: true,
60
+ className: classNames("tg-select", {
61
+ "tg-single-select": !multi
62
+ }),
63
+ wrapperTagName: "div",
64
+ usePortal: false,
65
+ canEscapeKeyClose: true,
66
+ ..._popoverProps
67
+ }),
68
+ [multi, _popoverProps]
69
+ );
70
+
71
+ const onKeyDown = useCallback(e => {
72
+ const { which } = e;
73
+ if (which === Keys.ENTER) {
74
+ e.preventDefault();
75
+ e.stopPropagation(); //this prevents the dialog it is in from closing
76
+ }
77
+ if (which === Keys.ESCAPE || which === Keys.TAB) {
78
+ // By default the escape key will not trigger a blur on the
79
+ // input element. It must be done explicitly.
80
+ if (inputRef.current != null) {
81
+ inputRef.current.blur();
82
+ }
83
+ e.preventDefault();
84
+ e.stopPropagation(); //this prevents dialog's it is in from closing
85
+ }
86
+ }, []);
87
+
88
+ const inputProps = useMemo(
89
+ () => ({
90
+ inputRef: n => {
91
+ if (n) inputRef.current = n;
92
+ },
93
+ placeholder: placeholder || "Type here...",
94
+ disabled: disabled, // tg: adding isLoading will cause the input to be blurred when using generic select asReactSelect (don't do it),
95
+ intent: intent,
96
+ ..._inputProps
97
+ }),
98
+ [disabled, _inputProps, intent, placeholder]
99
+ );
53
100
 
54
101
  return (
55
102
  <Suggest
56
103
  closeOnSelect
57
- items={options || []}
104
+ items={options}
58
105
  query={value}
59
- popoverProps={{
60
- minimal: true,
61
- className: classNames("tg-select", {
62
- "tg-single-select": !multi
63
- }),
64
- wrapperTagName: "div",
65
- usePortal: false,
66
- canEscapeKeyClose: true,
67
- ...popoverProps
68
- }}
69
- onKeyDown={e => {
70
- const { which } = e;
71
- if (which === Keys.ENTER) {
72
- e.preventDefault();
73
- e.stopPropagation(); //this prevents the dialog it is in from closing
74
- }
75
- if (which === Keys.ESCAPE || which === Keys.TAB) {
76
- // By default the escape key will not trigger a blur on the
77
- // input element. It must be done explicitly.
78
- if (inputRef.current != null) {
79
- inputRef.current.blur();
80
- }
81
- e.preventDefault();
82
- e.stopPropagation(); //this prevents dialog's it is in from closing
83
- }
84
- }}
106
+ popoverProps={popoverProps}
107
+ onKeyDown={onKeyDown}
85
108
  onItemSelect={handleItemSelect}
86
109
  noResults={null}
87
110
  resetOnSelect={false}
@@ -90,15 +113,7 @@ const TgSuggest = props => {
90
113
  itemListPredicate={_itemListPredicate}
91
114
  selectedItem={value}
92
115
  inputValueRenderer={item => item}
93
- inputProps={{
94
- inputRef: n => {
95
- if (n) inputRef.current = n;
96
- },
97
- placeholder: placeholder || "Type here...",
98
- disabled: disabled, // tg: adding isLoading will cause the input to be blurred when using generic select asReactSelect (don't do it),
99
- intent: intent,
100
- ...inputProps
101
- }}
116
+ inputProps={inputProps}
102
117
  isSimpleSearch={isSimpleSearch}
103
118
  onChange={onChange}
104
119
  {...rest}
package/src/index.js CHANGED
@@ -4,6 +4,7 @@ import "@blueprintjs/icons/lib/css/blueprint-icons.css";
4
4
  import "./style.css";
5
5
  import "./autoTooltip";
6
6
  export { LoadingDots } from "./FormComponents/LoadingDots";
7
+ export { FormSeparator } from "./FormComponents/FormSeparator";
7
8
  export * from "./AssignDefaultsModeContext";
8
9
  export { default as Uploader } from "./FormComponents/Uploader";
9
10
  export { mergeSchemas } from "./DataTable/utils/convertSchema";
package/style.css CHANGED
@@ -9081,11 +9081,7 @@ button:not(:disabled):active {
9081
9081
  .bp3-popover[style*="transform-origin"][style*="right"] .bp3-popover-arrow {
9082
9082
  transform: translate(-0.5px, 0);
9083
9083
  }
9084
- .tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}.rg-celleditor-input,
9085
- .rg-celleditor input {
9086
- border: none;
9087
- }
9088
- .tg-flex-form-content .bp3-form-content {
9084
+ .tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}.tg-flex-form-content .bp3-form-content {
9089
9085
  display: flex;
9090
9086
  }
9091
9087
 
@@ -9336,6 +9332,34 @@ button:not(:disabled):active {
9336
9332
  .bp3-dark .tg-color-picker-selector input {
9337
9333
  color: #222222;
9338
9334
  }
9335
+
9336
+ .form-separator {
9337
+ p {
9338
+ display: flex;
9339
+ align-items: center;
9340
+ width: 100%;
9341
+ }
9342
+ p::before {
9343
+ content: "";
9344
+ display: block;
9345
+ width: 100%;
9346
+ height: 1px;
9347
+ background-color: #e1e4e8;
9348
+ margin-right: 16px;
9349
+ }
9350
+ p::after {
9351
+ content: "";
9352
+ display: block;
9353
+ width: 100%;
9354
+ height: 1px;
9355
+ background-color: #e1e4e8;
9356
+ margin-left: 16px;
9357
+ }
9358
+ }
9359
+ .rg-celleditor-input,
9360
+ .rg-celleditor input {
9361
+ border: none;
9362
+ }
9339
9363
  .tg-select {
9340
9364
  width: 100%;
9341
9365
  min-width: 170px;