@servicetitan/anvil2-ext-common 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import './index.css';export { default as ExampleComponent } from './ExampleComponent.js';
2
+ export { S as Suggestions } from './Suggestions-ChGGcGuO.js';
2
3
  export { u as useConfirmDialog } from './useConfirmDialog-DaQ5Golt.js';
3
4
  export { C as CommitTrigger, u as useInputGuards } from './useInputGuards-CNyYcrvq.js';
4
5
  export { default as ExampleProvider } from './ExampleProvider.js';
@@ -25196,35 +25197,6 @@ const VirtualizedOptionsPanel = forwardRef(
25196
25197
  );
25197
25198
  VirtualizedOptionsPanel.displayName = "VirtualizedOptionsPanel";
25198
25199
 
25199
- function useDebouncedCallback(callback, delay = 300) {
25200
- const timeoutRef = useRef(null);
25201
- const callbackRef = useRef(callback);
25202
- useEffect(() => {
25203
- callbackRef.current = callback;
25204
- }, [callback]);
25205
- useEffect(() => {
25206
- return () => {
25207
- if (timeoutRef.current) {
25208
- clearTimeout(timeoutRef.current);
25209
- timeoutRef.current = null;
25210
- }
25211
- };
25212
- }, [delay]);
25213
- const debouncedCallback = useCallback(
25214
- ((...args) => {
25215
- if (timeoutRef.current) {
25216
- clearTimeout(timeoutRef.current);
25217
- }
25218
- timeoutRef.current = setTimeout(() => {
25219
- callbackRef.current(...args);
25220
- timeoutRef.current = null;
25221
- }, delay);
25222
- }),
25223
- [delay]
25224
- );
25225
- return debouncedCallback;
25226
- }
25227
-
25228
25200
  const DEFAULT_CACHE_SIZE = 15;
25229
25201
  const STATIC_CACHE_KEY = "__static__";
25230
25202
  function cacheSet(sectionCache, key, value, maxSize) {
@@ -25763,10 +25735,10 @@ const SvgInfo = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "
25763
25735
 
25764
25736
  const INLINE_MARKDOWN_REGEX = /\*\*\*(.+?)\*\*\*|\*\*(.+?)\*\*|\*(.+?)\*|==(.+?)==|`(.+?)`/g;
25765
25737
 
25766
- const highlight = "_highlight_1v2if_1";
25738
+ const highlight$2 = "_highlight_1v2if_1";
25767
25739
  const code = "_code_1v2if_7";
25768
25740
  const styles$1$1 = {
25769
- highlight: highlight,
25741
+ highlight: highlight$2,
25770
25742
  code: code
25771
25743
  };
25772
25744
 
@@ -25958,29 +25930,31 @@ const SelectFieldLabel = ({
25958
25930
  return labelContent;
25959
25931
  };
25960
25932
 
25961
- const input$2 = "_input_2e6em_21";
25962
- const error$3 = "_error_2e6em_48";
25963
- const disabled$2 = "_disabled_2e6em_55";
25964
- const small$2 = "_small_2e6em_137";
25965
- const large$2 = "_large_2e6em_143";
25966
- const prefix$2 = "_prefix_2e6em_227";
25967
- const suffix$2 = "_suffix_2e6em_260";
25933
+ const input$2 = "_input_2c5gw_21";
25934
+ const error$3 = "_error_2c5gw_48";
25935
+ const disabled$2 = "_disabled_2c5gw_55";
25936
+ const highlight$1 = "_highlight_2c5gw_64";
25937
+ const small$2 = "_small_2c5gw_140";
25938
+ const large$2 = "_large_2c5gw_146";
25939
+ const prefix$2 = "_prefix_2c5gw_230";
25940
+ const suffix$2 = "_suffix_2c5gw_263";
25968
25941
  const styles$6 = {
25969
- "search-field": "_search-field_2e6em_1",
25970
- "input-wrapper": "_input-wrapper_2e6em_21",
25942
+ "search-field": "_search-field_2c5gw_1",
25943
+ "input-wrapper": "_input-wrapper_2c5gw_21",
25971
25944
  input: input$2,
25972
25945
  error: error$3,
25973
25946
  disabled: disabled$2,
25974
- "fake-placeholder": "_fake-placeholder_2e6em_120",
25975
- "no-clear-button": "_no-clear-button_2e6em_125",
25976
- "no-toggle-button": "_no-toggle-button_2e6em_129",
25947
+ highlight: highlight$1,
25948
+ "fake-placeholder": "_fake-placeholder_2c5gw_123",
25949
+ "no-clear-button": "_no-clear-button_2c5gw_128",
25950
+ "no-toggle-button": "_no-toggle-button_2c5gw_132",
25977
25951
  small: small$2,
25978
25952
  large: large$2,
25979
- "buttons-wrapper": "_buttons-wrapper_2e6em_149",
25980
- "close-button-wrapper": "_close-button-wrapper_2e6em_166",
25981
- "close-button": "_close-button_2e6em_166",
25982
- "toggle-button-wrapper": "_toggle-button-wrapper_2e6em_189",
25983
- "toggle-button": "_toggle-button_2e6em_189",
25953
+ "buttons-wrapper": "_buttons-wrapper_2c5gw_152",
25954
+ "close-button-wrapper": "_close-button-wrapper_2c5gw_169",
25955
+ "close-button": "_close-button_2c5gw_169",
25956
+ "toggle-button-wrapper": "_toggle-button-wrapper_2c5gw_192",
25957
+ "toggle-button": "_toggle-button_2c5gw_192",
25984
25958
  prefix: prefix$2,
25985
25959
  suffix: suffix$2
25986
25960
  };
@@ -31070,32 +31044,63 @@ const FieldMessage = forwardRef(
31070
31044
  );
31071
31045
  FieldMessage.displayName = "FieldMessage";
31072
31046
 
31073
- const input$1 = "_input_1mlsg_26";
31074
- const error$1 = "_error_1mlsg_54";
31075
- const disabled$1 = "_disabled_1mlsg_61";
31076
- const chip$1 = "_chip_1mlsg_140";
31077
- const prefix$1 = "_prefix_1mlsg_230";
31078
- const suffix$1 = "_suffix_1mlsg_231";
31079
- const small$1 = "_small_1mlsg_306";
31080
- const large$1 = "_large_1mlsg_312";
31047
+ function useDebouncedCallback(callback, delay = 300) {
31048
+ const timeoutRef = useRef(null);
31049
+ const callbackRef = useRef(callback);
31050
+ useEffect(() => {
31051
+ callbackRef.current = callback;
31052
+ }, [callback]);
31053
+ useEffect(() => {
31054
+ return () => {
31055
+ if (timeoutRef.current) {
31056
+ clearTimeout(timeoutRef.current);
31057
+ timeoutRef.current = null;
31058
+ }
31059
+ };
31060
+ }, [delay]);
31061
+ const debouncedCallback = useCallback(
31062
+ ((...args) => {
31063
+ if (timeoutRef.current) {
31064
+ clearTimeout(timeoutRef.current);
31065
+ }
31066
+ timeoutRef.current = setTimeout(() => {
31067
+ callbackRef.current(...args);
31068
+ timeoutRef.current = null;
31069
+ }, delay);
31070
+ }),
31071
+ [delay]
31072
+ );
31073
+ return debouncedCallback;
31074
+ }
31075
+
31076
+ const input$1 = "_input_184hn_26";
31077
+ const error$1 = "_error_184hn_54";
31078
+ const disabled$1 = "_disabled_184hn_61";
31079
+ const highlight = "_highlight_184hn_70";
31080
+ const chip$1 = "_chip_184hn_143";
31081
+ const prefix$1 = "_prefix_184hn_233";
31082
+ const suffix$1 = "_suffix_184hn_234";
31083
+ const small$1 = "_small_184hn_309";
31084
+ const large$1 = "_large_184hn_315";
31081
31085
  const styles$3 = {
31082
- "input-wrapper": "_input-wrapper_1mlsg_26",
31086
+ "input-wrapper": "_input-wrapper_184hn_26",
31083
31087
  input: input$1,
31084
31088
  error: error$1,
31085
31089
  disabled: disabled$1,
31086
- "input-flex": "_input-flex_1mlsg_71",
31087
- "rows-wrapper": "_rows-wrapper_1mlsg_129",
31088
- "chip-wrapper": "_chip-wrapper_1mlsg_140",
31090
+ highlight: highlight,
31091
+ "input-flex": "_input-flex_184hn_74",
31092
+ "rows-wrapper": "_rows-wrapper_184hn_132",
31093
+ "chip-wrapper": "_chip-wrapper_184hn_143",
31089
31094
  chip: chip$1,
31090
- "buttons-wrapper": "_buttons-wrapper_1mlsg_152",
31091
- "close-button-wrapper": "_close-button-wrapper_1mlsg_169",
31092
- "close-button": "_close-button_1mlsg_169",
31093
- "toggle-button-wrapper": "_toggle-button-wrapper_1mlsg_192",
31094
- "toggle-button": "_toggle-button_1mlsg_192",
31095
+ "buttons-wrapper": "_buttons-wrapper_184hn_155",
31096
+ "close-button-wrapper": "_close-button-wrapper_184hn_172",
31097
+ "close-button": "_close-button_184hn_172",
31098
+ "toggle-button-wrapper": "_toggle-button-wrapper_184hn_195",
31099
+ "toggle-button": "_toggle-button_184hn_195",
31095
31100
  prefix: prefix$1,
31096
31101
  suffix: suffix$1,
31097
- "no-clear-button": "_no-clear-button_1mlsg_298",
31098
- "no-toggle-button": "_no-toggle-button_1mlsg_302",
31102
+ "no-clear-button": "_no-clear-button_184hn_301",
31103
+ "no-toggle-button": "_no-toggle-button_184hn_305",
31099
31104
  small: small$1,
31100
31105
  large: large$1};
31101
31106
 
@@ -31106,6 +31111,7 @@ const MultiSelectFieldInput = ({
31106
31111
  disableToggleButton,
31107
31112
  disabled,
31108
31113
  readOnly,
31114
+ isHighlighted,
31109
31115
  error,
31110
31116
  onClear,
31111
31117
  id,
@@ -31135,7 +31141,8 @@ const MultiSelectFieldInput = ({
31135
31141
  [styles$3["large"]]: size === "large",
31136
31142
  [styles$3["no-clear-button"]]: disableClearButton,
31137
31143
  [styles$3["no-toggle-button"]]: disableToggleButton,
31138
- [styles$3["disabled"]]: disabled || readOnly
31144
+ [styles$3["disabled"]]: disabled || readOnly,
31145
+ [styles$3["highlight"]]: isHighlighted
31139
31146
  });
31140
31147
  const handleInputKeyDown = (e) => {
31141
31148
  if (e.key === "Backspace" && !inputProps?.value && selectedOptions.length > 0 && onRemoveOption && !disabled && !readOnly) {
@@ -31491,6 +31498,7 @@ const MultiSelectFieldComboboxMode = ({
31491
31498
  isDisabledOrReadOnly,
31492
31499
  disabled,
31493
31500
  readOnly,
31501
+ isHighlighted,
31494
31502
  required,
31495
31503
  placeholder,
31496
31504
  size,
@@ -31629,6 +31637,7 @@ const MultiSelectFieldComboboxMode = ({
31629
31637
  {
31630
31638
  disabled,
31631
31639
  readOnly,
31640
+ isHighlighted,
31632
31641
  disableToggleButton: false,
31633
31642
  placeholder,
31634
31643
  disableClearButton,
@@ -31676,6 +31685,7 @@ const MultiSelectFieldComboboxMode = ({
31676
31685
  {
31677
31686
  disabled,
31678
31687
  readOnly,
31688
+ isHighlighted,
31679
31689
  inputProps: getInputProps(),
31680
31690
  disableToggleButton: true,
31681
31691
  placeholder,
@@ -31743,6 +31753,7 @@ const MultiSelectFieldComboboxMode = ({
31743
31753
  {
31744
31754
  disabled,
31745
31755
  readOnly,
31756
+ isHighlighted,
31746
31757
  inputProps: getInputProps({
31747
31758
  popovertarget: `${id}-popover`,
31748
31759
  "aria-describedby": [hasHelperText && helperUid, moreInfo && moreInfoId].filter(Boolean).join(" ") || void 0,
@@ -31818,6 +31829,7 @@ const MultiSelectFieldTrigger = ({
31818
31829
  disableClearButton,
31819
31830
  disabled,
31820
31831
  readOnly,
31832
+ isHighlighted,
31821
31833
  error,
31822
31834
  onClear,
31823
31835
  id,
@@ -31844,7 +31856,8 @@ const MultiSelectFieldTrigger = ({
31844
31856
  [styles$3["small"]]: size === "small",
31845
31857
  [styles$3["large"]]: size === "large",
31846
31858
  [styles$3["no-clear-button"]]: disableClearButton,
31847
- [styles$3["disabled"]]: disabled || readOnly
31859
+ [styles$3["disabled"]]: disabled || readOnly,
31860
+ [styles$3["highlight"]]: isHighlighted
31848
31861
  });
31849
31862
  return /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
31850
31863
  /* @__PURE__ */ jsxs(
@@ -32093,6 +32106,7 @@ const MultiSelectFieldSelectMode = ({
32093
32106
  isDisabledOrReadOnly,
32094
32107
  disabled,
32095
32108
  readOnly,
32109
+ isHighlighted,
32096
32110
  required,
32097
32111
  placeholder,
32098
32112
  size,
@@ -32222,6 +32236,7 @@ const MultiSelectFieldSelectMode = ({
32222
32236
  {
32223
32237
  disabled,
32224
32238
  readOnly,
32239
+ isHighlighted,
32225
32240
  placeholder,
32226
32241
  disableClearButton,
32227
32242
  toggleButtonProps,
@@ -32311,6 +32326,7 @@ const MultiSelectFieldSelectMode = ({
32311
32326
  {
32312
32327
  disabled,
32313
32328
  readOnly,
32329
+ isHighlighted,
32314
32330
  placeholder,
32315
32331
  disableClearButton,
32316
32332
  toggleButtonProps,
@@ -32399,6 +32415,7 @@ const MultiSelectField = forwardRef((propsWithLayout, ref) => {
32399
32415
  labelAiMark,
32400
32416
  disabled,
32401
32417
  readOnly,
32418
+ isHighlighted,
32402
32419
  prefix,
32403
32420
  suffix,
32404
32421
  selectAll: selectAllProp,
@@ -32499,6 +32516,7 @@ const MultiSelectField = forwardRef((propsWithLayout, ref) => {
32499
32516
  isDisabledOrReadOnly,
32500
32517
  disabled,
32501
32518
  readOnly,
32519
+ isHighlighted,
32502
32520
  required,
32503
32521
  placeholder,
32504
32522
  size,
@@ -32584,6 +32602,7 @@ const SelectFieldInput = ({
32584
32602
  disableToggleButton,
32585
32603
  disabled,
32586
32604
  readOnly,
32605
+ isHighlighted,
32587
32606
  required,
32588
32607
  error,
32589
32608
  onClear,
@@ -32600,7 +32619,8 @@ const SelectFieldInput = ({
32600
32619
  [styles$6["large"]]: size === "large",
32601
32620
  [styles$6["no-clear-button"]]: disableClearButton,
32602
32621
  [styles$6["no-toggle-button"]]: disableToggleButton,
32603
- [styles$6["disabled"]]: disabled || readOnly
32622
+ [styles$6["disabled"]]: disabled || readOnly,
32623
+ [styles$6["highlight"]]: isHighlighted
32604
32624
  });
32605
32625
  return /* @__PURE__ */ jsxs(
32606
32626
  "div",
@@ -32819,6 +32839,7 @@ const SelectFieldComboboxMode = ({
32819
32839
  disabled,
32820
32840
  labelAiMark,
32821
32841
  readOnly,
32842
+ isHighlighted,
32822
32843
  required,
32823
32844
  placeholder,
32824
32845
  size,
@@ -32959,6 +32980,7 @@ const SelectFieldComboboxMode = ({
32959
32980
  {
32960
32981
  disabled,
32961
32982
  readOnly,
32983
+ isHighlighted,
32962
32984
  required,
32963
32985
  disableToggleButton: false,
32964
32986
  placeholder,
@@ -32998,6 +33020,7 @@ const SelectFieldComboboxMode = ({
32998
33020
  {
32999
33021
  disabled,
33000
33022
  readOnly,
33023
+ isHighlighted,
33001
33024
  inputProps: getInputProps(),
33002
33025
  disableToggleButton: true,
33003
33026
  placeholder,
@@ -33063,6 +33086,7 @@ const SelectFieldComboboxMode = ({
33063
33086
  {
33064
33087
  disabled,
33065
33088
  readOnly,
33089
+ isHighlighted,
33066
33090
  required,
33067
33091
  inputProps: getInputProps({
33068
33092
  popovertarget: `${id}-popover`,
@@ -33133,6 +33157,7 @@ const SelectFieldTrigger = ({
33133
33157
  disableClearButton,
33134
33158
  disabled,
33135
33159
  readOnly,
33160
+ isHighlighted,
33136
33161
  error,
33137
33162
  onClear,
33138
33163
  id,
@@ -33149,7 +33174,8 @@ const SelectFieldTrigger = ({
33149
33174
  [styles$6["small"]]: size === "small",
33150
33175
  [styles$6["large"]]: size === "large",
33151
33176
  [styles$6["no-clear-button"]]: disableClearButton,
33152
- [styles$6["disabled"]]: disabled || readOnly
33177
+ [styles$6["disabled"]]: disabled || readOnly,
33178
+ [styles$6["highlight"]]: isHighlighted
33153
33179
  });
33154
33180
  return /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
33155
33181
  /* @__PURE__ */ jsxs(
@@ -33343,6 +33369,7 @@ const SelectFieldSelectMode = ({
33343
33369
  isDisabledOrReadOnly,
33344
33370
  disabled,
33345
33371
  readOnly,
33372
+ isHighlighted,
33346
33373
  placeholder,
33347
33374
  size,
33348
33375
  error,
@@ -33461,6 +33488,7 @@ const SelectFieldSelectMode = ({
33461
33488
  {
33462
33489
  disabled,
33463
33490
  readOnly,
33491
+ isHighlighted,
33464
33492
  placeholder,
33465
33493
  disableClearButton,
33466
33494
  toggleButtonProps,
@@ -33546,6 +33574,7 @@ const SelectFieldSelectMode = ({
33546
33574
  {
33547
33575
  disabled,
33548
33576
  readOnly,
33577
+ isHighlighted,
33549
33578
  placeholder,
33550
33579
  disableClearButton,
33551
33580
  toggleButtonProps,
@@ -33633,6 +33662,7 @@ const SelectField = forwardRef(
33633
33662
  required,
33634
33663
  disabled,
33635
33664
  readOnly,
33665
+ isHighlighted,
33636
33666
  prefix,
33637
33667
  suffix,
33638
33668
  warning,
@@ -33684,6 +33714,7 @@ const SelectField = forwardRef(
33684
33714
  isDisabledOrReadOnly,
33685
33715
  disabled,
33686
33716
  readOnly,
33717
+ isHighlighted,
33687
33718
  required,
33688
33719
  placeholder,
33689
33720
  size,
@@ -35163,6 +35194,7 @@ const TreeSelectFieldInput = ({
35163
35194
  suffix,
35164
35195
  selectedOptions,
35165
35196
  onRemoveOption,
35197
+ getChipProps,
35166
35198
  inputRef,
35167
35199
  inputWrapperRef,
35168
35200
  searchValue,
@@ -35210,6 +35242,7 @@ const TreeSelectFieldInput = ({
35210
35242
  children: /* @__PURE__ */ jsx(
35211
35243
  Chip,
35212
35244
  {
35245
+ ...getChipProps?.(option),
35213
35246
  label: option.label,
35214
35247
  onClose: disabled || readOnly ? void 0 : () => onRemoveOption(option),
35215
35248
  className: styles["chip"],
@@ -35320,6 +35353,7 @@ const TreeSelectField = forwardRef((propsWithLayout, ref) => {
35320
35353
  onSearchChange,
35321
35354
  singleRow,
35322
35355
  maxChips,
35356
+ getChipProps,
35323
35357
  virtualize,
35324
35358
  value,
35325
35359
  onSelectedOptionsChange,
@@ -35555,6 +35589,7 @@ const TreeSelectField = forwardRef((propsWithLayout, ref) => {
35555
35589
  single: isSingleSelect,
35556
35590
  singleRow,
35557
35591
  maxChips,
35592
+ getChipProps,
35558
35593
  prefix,
35559
35594
  suffix,
35560
35595
  selectedOptions: value,
@@ -35624,6 +35659,7 @@ const TreeSelectField = forwardRef((propsWithLayout, ref) => {
35624
35659
  single: isSingleSelect,
35625
35660
  singleRow: true,
35626
35661
  maxChips: 20,
35662
+ getChipProps,
35627
35663
  prefix,
35628
35664
  suffix,
35629
35665
  selectedOptions: value,