@kwiz/fluentui 1.0.5 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,13 +7,11 @@ import { useKWIZFluentContextContext } from '../helpers/context';
7
7
  export const DatePickerEx = (props) => {
8
8
  const ctx = useKWIZFluentContextContext();
9
9
  const [showClear, setShowClear] = React.useState(isDate(props.value));
10
- const [v, setV] = React.useState(0);
11
10
  const reset = React.useCallback(() => {
12
11
  setShowClear(false);
13
- setV(v + 1);
14
12
  if (isFunction(props.onSelectDate))
15
13
  props.onSelectDate(undefined);
16
- }, [v]);
14
+ }, [showClear]);
17
15
  return (_jsx(DatePicker, Object.assign({ appearance: ctx.inputAppearance, mountNode: ctx.mountNode }, props, { onSelectDate: (date) => {
18
16
  setShowClear(isDate(date));
19
17
  if (isFunction(props.onSelectDate))
@@ -29,6 +27,6 @@ export const DatePickerEx = (props) => {
29
27
  else if (isFunction(props.onCancel) && e.key === "Escape")
30
28
  props.onCancel();
31
29
  }
32
- : undefined, contentBefore: showClear && _jsx(CalendarCancelRegular, { title: 'Clear', onClick: () => reset() }) }), `v${v}`));
30
+ : undefined, contentBefore: showClear && _jsx(CalendarCancelRegular, { title: 'Clear', onClick: () => reset() }) })));
33
31
  };
34
32
  //# sourceMappingURL=date.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/controls/date.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAOjE,MAAM,CAAC,MAAM,YAAY,GAA6D,CAAC,KAAK,EAAE,EAAE;IAC5F,MAAM,GAAG,GAAG,2BAA2B,EAAE,CA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_jsxs } from "react/jsx-runtime";
2
2
  import { Dialog, DialogActions, DialogBody, DialogContent, DialogSurface, DialogTitle, DialogTrigger } from '@fluentui/react-components';
3
3
  import { isNullOrEmptyString } from '@kwiz/common';
4
4
  import React from 'react';
5
+ import { useKWIZFluentContextContext } from '../helpers/context';
5
6
  import { ButtonEXSecondary } from './button';
6
7
  export const Prompter = (props) => {
8
+ const ctx = useKWIZFluentContextContext();
7
9
  let okProps = Object.assign(Object.assign({}, (props.okButtonProps || {})), { onClick: () => props.onOK(), title: props.okButtonText || 'yes' });
8
10
  let cancelProps = Object.assign(Object.assign({}, (props.cancelButtonProps || {})), { onClick: () => props.onCancel(), title: props.cancelButtonText || 'no' });
9
11
  React.useEffect(() => {
@@ -16,6 +18,6 @@ export const Prompter = (props) => {
16
18
  document.addEventListener("keydown", handler);
17
19
  return () => document.removeEventListener("keydown", handler);
18
20
  });
19
- return (_jsx(Dialog, { open: true, children: _jsxs(DialogSurface, { children: [!isNullOrEmptyString(props.title) && _jsx(DialogTitle, { children: props.title }), _jsxs(DialogBody, { children: [_jsx(DialogContent, { children: props.children }), _jsxs(DialogActions, { children: [props.hideOk ? undefined : _jsx(DialogTrigger, { disableButtonEnhancement: true, children: _jsx(ButtonEXSecondary, Object.assign({}, okProps)) }), props.hideCancel ? undefined : _jsx(DialogTrigger, { disableButtonEnhancement: true, children: _jsx(ButtonEXSecondary, Object.assign({}, cancelProps)) })] })] })] }) }));
21
+ return (_jsx(Dialog, { open: true, children: _jsxs(DialogSurface, { mountNode: ctx.mountNode, children: [!isNullOrEmptyString(props.title) && _jsx(DialogTitle, { children: props.title }), _jsxs(DialogBody, { children: [_jsx(DialogContent, { children: props.children }), _jsxs(DialogActions, { children: [props.hideOk ? undefined : _jsx(DialogTrigger, { disableButtonEnhancement: true, children: _jsx(ButtonEXSecondary, Object.assign({}, okProps)) }), props.hideCancel ? undefined : _jsx(DialogTrigger, { disableButtonEnhancement: true, children: _jsx(ButtonEXSecondary, Object.assign({}, cancelProps)) })] })] })] }) }));
20
22
  };
21
23
  //# sourceMappingURL=prompt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/controls/prompt.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACzI,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAiB,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAe5D,MAAM,CAAC,MAAM,QAAQ,GAAqE,CAAC,KAAK,EAAE,EAAE;IAChG,IAAI,OAAO,mCACJ,CAAC,KAAK,CAAC,aAAoB,IAAI,EAAE,CAAC,KACrC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,EAC3B,KAAK,EAAE,KAAK,CAAC,YAAY,IAAI,KAAK,GACrC,CAAC;IACF,IAAI,WAAW,mCACR,CAAC,KAAK,CAAC,iBAAwB,IAAI,EAAE,CAAC,KACzC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,EAC/B,KAAK,EAAE,KAAK,CAAC,gBAAgB,IAAI,IAAI,GACxC,CAAC;IACF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IAAI,OAAO,GAAG,CAAC,CAAgB,EAAE,EAAE;YAC/B,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO;gBAAE,KAAK,CAAC,IAAI,EAAE,CAAC;iBAC/B,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ;gBAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;QAElD,CAAC,CAAC;QACF,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,m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BAAwB,kBACnE,KAAC,iBAAiB,oBAAK,WAAW,EAAI,GAC1B,IACJ,IACP,IACD,GACX,CACZ,CAAC;AACN,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwiz/fluentui",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "KWIZ common controls for FluentUI",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,15 +12,13 @@ interface IProps extends DatePickerProps {
12
12
  export const DatePickerEx: React.FunctionComponent<React.PropsWithChildren<IProps>> = (props) => {
13
13
  const ctx = useKWIZFluentContextContext();
14
14
  const [showClear, setShowClear] = React.useState(isDate(props.value));
15
- const [v, setV] = React.useState(0);
16
15
  const reset = React.useCallback(() => {
17
16
  setShowClear(false);
18
- setV(v + 1);
19
17
  if (isFunction(props.onSelectDate)) props.onSelectDate(undefined);
20
- }, [v]);
18
+ }, [showClear]);
21
19
 
22
20
  return (
23
- <DatePicker key={`v${v}`} appearance={ctx.inputAppearance} mountNode={ctx.mountNode} {...props}
21
+ <DatePicker appearance={ctx.inputAppearance} mountNode={ctx.mountNode} {...props}
24
22
  onSelectDate={(date) => {
25
23
  setShowClear(isDate(date));
26
24
  if (isFunction(props.onSelectDate)) props.onSelectDate(date);
@@ -1,6 +1,7 @@
1
1
  import { Dialog, DialogActions, DialogBody, DialogContent, DialogSurface, DialogTitle, DialogTrigger } from '@fluentui/react-components';
2
2
  import { isNullOrEmptyString } from '@kwiz/common';
3
3
  import React from 'react';
4
+ import { useKWIZFluentContextContext } from '../helpers/context';
4
5
  import { ButtonEXProps, ButtonEXSecondary } from './button';
5
6
 
6
7
  export interface IPrompterProps {
@@ -17,6 +18,8 @@ export interface IPrompterProps {
17
18
  children?: JSX.Element;
18
19
  }
19
20
  export const Prompter: React.FunctionComponent<React.PropsWithChildren<IPrompterProps>> = (props) => {
21
+ const ctx = useKWIZFluentContextContext();
22
+
20
23
  let okProps: ButtonEXProps = {
21
24
  ...(props.okButtonProps as any || {}),
22
25
  onClick: () => props.onOK(),
@@ -38,7 +41,7 @@ export const Prompter: React.FunctionComponent<React.PropsWithChildren<IPrompter
38
41
  });
39
42
  return (
40
43
  <Dialog open>
41
- <DialogSurface>
44
+ <DialogSurface mountNode={ctx.mountNode}>
42
45
  {!isNullOrEmptyString(props.title) && <DialogTitle>{props.title}</DialogTitle>}
43
46
  <DialogBody>
44
47
  <DialogContent>