@xh/hoist 64.0.3 → 64.0.5

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.
@@ -5,11 +5,14 @@ export interface IconProps extends HoistProps, Partial<Omit<FontAwesomeIconProps
5
5
  /** Name of the icon in FontAwesome. */
6
6
  iconName?: string;
7
7
  /**
8
- * Prefix or weight of the icon. By default, 'far' for the standard
9
- * variant of each icon. Pass a value of either 'fas' for a heavier-weight/solid variant
10
- * or 'fal' for a lighter-weight variant.
8
+ * Prefix / weight of the icon (or "fab" if your app has imported the free-brand-icons pkg).
9
+ * - far - Regular
10
+ * - fas - Solid
11
+ * - fal - Light
12
+ * - fat - Thin (yes, unfortunate)
13
+ * - fab - Brand (requires optional import, see Toolbox)
11
14
  */
12
- prefix?: 'far' | 'fas' | 'fal' | 'fab';
15
+ prefix?: 'far' | 'fas' | 'fal' | 'fat' | 'fab';
13
16
  intent?: Intent;
14
17
  /** Optional tooltip string. */
15
18
  title?: string;
@@ -1,4 +1,4 @@
1
- import { HoistProps, LayoutProps } from '@xh/hoist/core';
1
+ import { LayoutProps, PlainObject } from '@xh/hoist/core';
2
2
  /**
3
3
  * These utils support accepting the CSS styles enumerated below as top-level props of a Component,
4
4
  * and are typically accessed via the `@LayoutSupport` mixin (for class-based components) or the
@@ -31,12 +31,12 @@ import { HoistProps, LayoutProps } from '@xh/hoist/core';
31
31
  * that afforded by the underlying flexbox styles. In particular, it accepts flex and sizing props
32
32
  * as raw numbers rather than strings.
33
33
  */
34
- export declare function getLayoutProps(props: HoistProps): LayoutProps;
34
+ export declare function getLayoutProps(props: PlainObject): LayoutProps;
35
35
  /**
36
36
  * Return all non-layout related props found in props.
37
37
  */
38
- export declare function getNonLayoutProps<T extends HoistProps>(props: T): T;
38
+ export declare function getNonLayoutProps<T extends PlainObject>(props: T): T;
39
39
  /**
40
40
  * Split a set of props into layout and non-layout props.
41
41
  */
42
- export declare function splitLayoutProps<T extends HoistProps>(props: T): [LayoutProps, T];
42
+ export declare function splitLayoutProps<T extends PlainObject>(props: T): [LayoutProps, T];
@@ -262,6 +262,11 @@
262
262
  }
263
263
  }
264
264
 
265
+ // TODO find better place to put this
266
+ .xh-grid-clear-background-color:not(.ag-row-selected) {
267
+ background-color: unset !important;
268
+ }
269
+
265
270
  // Suppress default indenting when grid is in tree mode but no root records have children.
266
271
  .xh-grid--flat:not(.xh-data-view) {
267
272
  .ag-ltr .ag-row-group-leaf-indent {
@@ -47,15 +47,20 @@ import {
47
47
  /**
48
48
  * Type representing props passed to a HoistComponent's render function.
49
49
  *
50
- * This type removes from its base type several props that are used by HoistComponent itself and
51
- * not provided to the render function.
50
+ * This type removes from its base type several properties that are pulled out by the HoistComponent itself and
51
+ * not provided to the render function. `modelConfig` and `modelRef` are resolved into the `model` property.
52
+ * `ref` is passed as the second argument to the render function.
52
53
  */
54
+
53
55
  export type RenderPropsOf<P extends HoistProps> = P & {
54
56
  /** Pre-processed by HoistComponent internals into a mounted model. Never passed to render. */
55
57
  modelConfig: never;
56
58
 
57
59
  /** Pre-processed by HoistComponent internals and attached to model. Never passed to render. */
58
60
  modelRef: never;
61
+
62
+ /** Pre-processed by HoistComponent internals and passed as second argument to render. */
63
+ ref: never;
59
64
  };
60
65
 
61
66
  /**
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import {HoistModel} from '@xh/hoist/core';
8
8
  import {Property} from 'csstype';
9
- import {CSSProperties, HTMLAttributes, ReactNode, Ref} from 'react';
9
+ import {CSSProperties, HTMLAttributes, LegacyRef, ReactNode, Ref} from 'react';
10
10
 
11
11
  /**
12
12
  * Props interface for Hoist Components.
@@ -43,6 +43,9 @@ export interface HoistProps<M extends HoistModel = HoistModel> {
43
43
 
44
44
  /** React children. */
45
45
  children?: ReactNode;
46
+
47
+ /** React Ref for this component. */
48
+ ref?: LegacyRef<any>;
46
49
  }
47
50
 
48
51
  /**
package/core/elem.ts CHANGED
@@ -8,7 +8,6 @@ import {TEST_ID} from '@xh/hoist/utils/js';
8
8
  import {castArray, isFunction, isNil, isPlainObject} from 'lodash';
9
9
  import {
10
10
  createElement as reactCreateElement,
11
- ForwardedRef,
12
11
  isValidElement,
13
12
  Key,
14
13
  ReactElement,
@@ -55,9 +54,6 @@ export type ElementSpec<P> = P & {
55
54
  //-----------------------------------
56
55
  // Core React attributes
57
56
  //-----------------------------------
58
- /** React Ref for this component. */
59
- ref?: ForwardedRef<any>;
60
-
61
57
  /** React key for this component. */
62
58
  key?: Key;
63
59
 
@@ -37,7 +37,7 @@ export interface FileChooserProps extends HoistProps<FileChooserModel>, BoxProps
37
37
  * True (default) to display the selected file(s) in a grid alongside the dropzone. Note
38
38
  * that, if false, the component will not provide any built-in indication of its selection.
39
39
  */
40
- showFileGrid: boolean;
40
+ showFileGrid?: boolean;
41
41
 
42
42
  /** Intro/help text to display within the dropzone target. */
43
43
  targetText?: ReactNode;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import {HoistInputModel, HoistInputProps, useHoistInputModel} from '@xh/hoist/cmp/input';
8
8
  import {hoistCmp, HoistModel, Intent, XH} from '@xh/hoist/core';
9
- import {Button, buttonGroup, ButtonGroupProps} from '@xh/hoist/desktop/cmp/button';
9
+ import {Button, buttonGroup, ButtonGroupProps, ButtonProps} from '@xh/hoist/desktop/cmp/button';
10
10
  import '@xh/hoist/desktop/register';
11
11
  import {throwIf, warnIf, withDefault} from '@xh/hoist/utils/js';
12
12
  import {getLayoutProps, getNonLayoutProps} from '@xh/hoist/utils/react';
@@ -130,8 +130,9 @@ const cmp = hoistCmp.factory<ButtonGroupInputModel>(({model, className, ...props
130
130
  throw XH.exception('ButtonGroupInput child must be a Button.');
131
131
  }
132
132
 
133
- const {value, intent: btnIntent} = button.props,
134
- btnDisabled = disabled || button.props.disabled;
133
+ const props = button.props as ButtonProps,
134
+ {value, intent: btnIntent} = props,
135
+ btnDisabled = disabled || props.disabled;
135
136
 
136
137
  throwIf(
137
138
  (enableClear || enableMulti) && value == null,
package/icon/Icon.ts CHANGED
@@ -19,11 +19,14 @@ export interface IconProps extends HoistProps, Partial<Omit<FontAwesomeIconProps
19
19
  iconName?: string;
20
20
 
21
21
  /**
22
- * Prefix or weight of the icon. By default, 'far' for the standard
23
- * variant of each icon. Pass a value of either 'fas' for a heavier-weight/solid variant
24
- * or 'fal' for a lighter-weight variant.
22
+ * Prefix / weight of the icon (or "fab" if your app has imported the free-brand-icons pkg).
23
+ * - far - Regular
24
+ * - fas - Solid
25
+ * - fal - Light
26
+ * - fat - Thin (yes, unfortunate)
27
+ * - fab - Brand (requires optional import, see Toolbox)
25
28
  */
26
- prefix?: 'far' | 'fas' | 'fal' | 'fab';
29
+ prefix?: 'far' | 'fas' | 'fal' | 'fat' | 'fab';
27
30
 
28
31
  intent?: Intent;
29
32
 
@@ -4,6 +4,7 @@
4
4
  *
5
5
  * Copyright © 2024 Extremely Heavy Industries Inc.
6
6
  */
7
+ import {ToastModel} from '@xh/hoist/appcontainer/ToastModel';
7
8
  import {ToastSourceModel} from '@xh/hoist/appcontainer/ToastSourceModel';
8
9
  import {hoistCmp, uses} from '@xh/hoist/core';
9
10
  import {wait} from '@xh/hoist/promise';
@@ -20,7 +21,7 @@ export const toastSource = hoistCmp.factory({
20
21
  model: uses(ToastSourceModel),
21
22
 
22
23
  render({model}) {
23
- const pending = model.toastModels.filter(it => it.isOpen),
24
+ const pending: ToastModel[] = model.toastModels.filter(it => it.isOpen),
24
25
  next = head(pending);
25
26
 
26
27
  if (!next) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "64.0.3",
3
+ "version": "64.0.5",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",
@@ -31,9 +31,10 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@auth0/auth0-spa-js": "~2.1.3",
34
- "@azure/msal-browser": "~3.14.0",
35
- "@blueprintjs/core": "^5.10.2",
36
- "@blueprintjs/datetime2": "^2.3.3",
34
+ "@azure/msal-browser": "~3.17.0",
35
+ "@blueprintjs/core": "^5.10.3",
36
+ "@blueprintjs/datetime": "^5.3.5",
37
+ "@blueprintjs/datetime2": "^2.3.5",
37
38
  "@fortawesome/fontawesome-pro": "^6.2.1",
38
39
  "@fortawesome/fontawesome-svg-core": "^6.2.1",
39
40
  "@fortawesome/pro-light-svg-icons": "^6.2.1",
@@ -92,7 +93,7 @@
92
93
  "@ag-grid-community/client-side-row-model": "31.x",
93
94
  "@ag-grid-community/core": "31.x",
94
95
  "@ag-grid-community/react": "31.x",
95
- "@xh/hoist-dev-utils": "^9.0.0-SNAPSHOT",
96
+ "@xh/hoist-dev-utils": "8.x",
96
97
  "csstype": "3.x",
97
98
  "eslint": "8.x",
98
99
  "eslint-config-prettier": "9.x",
@@ -153,8 +153,8 @@ export abstract class BaseOAuthClient<C extends BaseOAuthClientConfig<S>, S> ext
153
153
  * Request a full logout from the underlying OAuth provider.
154
154
  */
155
155
  async logoutAsync(): Promise<void> {
156
- this.setSelectedUsername(null);
157
156
  await this.doLogoutAsync();
157
+ this.setSelectedUsername(null);
158
158
  }
159
159
 
160
160
  /**
@@ -130,8 +130,9 @@ export class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTokenSpec>
130
130
  // to gain a new refreshToken (3rd party cookies required).
131
131
  const accounts = client.getAllAccounts();
132
132
  this.logDebug('Authenticated accounts available', accounts);
133
- this.account = accounts.length == 1 ? accounts[0] : null;
134
- if (this.account) {
133
+ const account = accounts.length == 1 ? accounts[0] : null;
134
+ if (account) {
135
+ this.noteUserAuthenticated(account);
135
136
  try {
136
137
  this.initialTokenLoad = true;
137
138
  this.logDebug('Attempting silent token load.');
@@ -230,11 +231,12 @@ export class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTokenSpec>
230
231
  }
231
232
 
232
233
  protected override async doLogoutAsync(): Promise<void> {
233
- const {postLogoutRedirectUrl, client, account, loginMethod} = this;
234
- await client.clearCache({account});
234
+ const {postLogoutRedirectUrl, client, account, loginMethod} = this,
235
+ opts = {account, postLogoutRedirectUri: postLogoutRedirectUrl};
236
+
235
237
  loginMethod == 'REDIRECT'
236
- ? await client.logoutRedirect({account, postLogoutRedirectUri: postLogoutRedirectUrl})
237
- : await client.logoutPopup({account});
238
+ ? await client.logoutRedirect(opts)
239
+ : await client.logoutPopup(opts);
238
240
  }
239
241
 
240
242
  //------------------------