@mikezimm/fps-library-v2 1.0.80 → 1.0.81

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +9 -2
  2. package/lib/components/atoms/TeachBubble/IMinTeachBubble.d.ts +19 -0
  3. package/lib/components/atoms/TeachBubble/IMinTeachBubble.d.ts.map +1 -0
  4. package/lib/components/atoms/TeachBubble/IMinTeachBubble.js +12 -0
  5. package/lib/components/atoms/TeachBubble/IMinTeachBubble.js.map +1 -0
  6. package/lib/components/atoms/TeachBubble/SampleTeachBubbles.d.ts +3 -0
  7. package/lib/components/atoms/TeachBubble/SampleTeachBubbles.d.ts.map +1 -0
  8. package/lib/components/atoms/TeachBubble/SampleTeachBubbles.js +17 -0
  9. package/lib/components/atoms/TeachBubble/SampleTeachBubbles.js.map +1 -0
  10. package/lib/components/atoms/TeachBubble/component.d.ts +4 -0
  11. package/lib/components/atoms/TeachBubble/component.d.ts.map +1 -0
  12. package/lib/components/atoms/TeachBubble/component.js +17 -0
  13. package/lib/components/atoms/TeachBubble/component.js.map +1 -0
  14. package/lib/components/atoms/WhoDunItRow/getWhoDunIt.d.ts +18 -0
  15. package/lib/components/atoms/WhoDunItRow/getWhoDunIt.d.ts.map +1 -0
  16. package/lib/components/atoms/WhoDunItRow/getWhoDunIt.js +22 -0
  17. package/lib/components/atoms/WhoDunItRow/getWhoDunIt.js.map +1 -0
  18. package/lib/components/molecules/FadeCarousel/SelectDots/component.d.ts +19 -0
  19. package/lib/components/molecules/FadeCarousel/SelectDots/component.d.ts.map +1 -0
  20. package/lib/components/molecules/FadeCarousel/SelectDots/component.js +38 -0
  21. package/lib/components/molecules/FadeCarousel/SelectDots/component.js.map +1 -0
  22. package/lib/components/molecules/FadeCarousel/component.d.ts +36 -0
  23. package/lib/components/molecules/FadeCarousel/component.d.ts.map +1 -0
  24. package/lib/components/molecules/FadeCarousel/component.js +71 -0
  25. package/lib/components/molecules/FadeCarousel/component.js.map +1 -0
  26. package/lib/logic/Arrays/thinOutArray.d.ts +44 -0
  27. package/lib/logic/Arrays/thinOutArray.d.ts.map +1 -0
  28. package/lib/logic/Arrays/thinOutArray.js +122 -0
  29. package/lib/logic/Arrays/thinOutArray.js.map +1 -0
  30. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -5,17 +5,24 @@ npm run build
5
5
  npm version major/minor/patch
6
6
  npm publish --access=public
7
7
 
8
- npm install @mikezimm/fps-library-v2@1.0.80
8
+ npm install @mikezimm/fps-library-v2@1.0.81
9
9
 
10
10
  # Changelog
11
11
 
12
12
  NOTE: TURN BACK ON STRICT NULL CHECKS - turned off for PropPaneCols
13
13
 
14
+ ## 1.0.81 - 2023-Jan-03: ALVFinMan components
15
+ - added makeBubbleElementFromBubbles, IMinTeachBubble to src/components/atoms/TeachBubble
16
+ - refactored bubbles to include content element
17
+ - Add FadeCarousel and SelectDots under src/components/molecules/FadeCarousel ( from test-fps-test/ALVFinMan web part )
18
+ - relocated thinArray and getSpreadIndexes to src/logic/Arrays/thinOutArray.ts
19
+ - created getWhoDunItElements in src/components/atoms/WhoDunItRow/getWhoDunIt.tsx to build Peope/Dates row
20
+
14
21
  ## 1.0.80 - 2022-Dec-31: clean up console.logs, ALVFinMan fetches
15
22
  - remove unneccessary console.logs
16
23
  - fix a couple check4Gulp imports that pull in pnp2
17
24
  - update PinMeGroup to only auto-expand on PageInfo for now
18
- - add getNextIndex function from FadeCarousel component to src\logic\Arrays\searching\getNextIndex.ts
25
+ - add getNextIndex function from FadeCarousel component to src/logic/Arrays/searching/getNextIndex.ts
19
26
  - update getSourceItems to automatically create expandColumns from selectColumns if it is empty - ALVFinMan
20
27
  - add fetchFpsPageAsXML and fetchFpsItemAsXML to fetch Modern Page content
21
28
 
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ export interface IMinTeachBubble {
3
+ step?: number;
4
+ target: string;
5
+ headline: string;
6
+ message?: string;
7
+ content?: JSX.Element;
8
+ }
9
+ /**
10
+ * This is an example of how to set the ID of a PivotItem so it can be referenced.
11
+ * Just use the getTabId callback.
12
+
13
+ <Pivot
14
+ getTabId={ ( itemKey, index ) => { return `ALVFMMainPivot${itemKey}`} }
15
+ styles={ mainPivotStyles }
16
+ >
17
+ *
18
+ */
19
+ //# sourceMappingURL=IMinTeachBubble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IMinTeachBubble.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/TeachBubble/IMinTeachBubble.tsx"],"names":[],"mappings":";AACA,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CAEvB;AAED;;;;;;;;;GASG"}
@@ -0,0 +1,12 @@
1
+ export {};
2
+ /**
3
+ * This is an example of how to set the ID of a PivotItem so it can be referenced.
4
+ * Just use the getTabId callback.
5
+
6
+ <Pivot
7
+ getTabId={ ( itemKey, index ) => { return `ALVFMMainPivot${itemKey}`} }
8
+ styles={ mainPivotStyles }
9
+ >
10
+ *
11
+ */
12
+ //# sourceMappingURL=IMinTeachBubble.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IMinTeachBubble.js","sourceRoot":"","sources":["../../../../src/components/atoms/TeachBubble/IMinTeachBubble.tsx"],"names":[],"mappings":";AAYA;;;;;;;;;GASG"}
@@ -0,0 +1,3 @@
1
+ import { IMinTeachBubble } from "./IMinTeachBubble";
2
+ export declare function getHomeTeachBubbles(wpId: string): IMinTeachBubble[];
3
+ //# sourceMappingURL=SampleTeachBubbles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SampleTeachBubbles.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/TeachBubble/SampleTeachBubbles.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE,CAenE"}
@@ -0,0 +1,17 @@
1
+ export function getHomeTeachBubbles(wpId) {
2
+ return [
3
+ {
4
+ // step: 0,
5
+ // NOTE: Target must start with # for Id and prefer to end with a unique webpart instance ID
6
+ target: `#ALVFMHomeTour${wpId}`,
7
+ headline: `Want a tour of this web part?`,
8
+ message: `If you find a 'Map' icon like this, you can click on it and get a Tour of a feature. In all Tours, Click 'Next' to continue. You can press the X button to close this tour at any time :).`,
9
+ }, {
10
+ // step: 0,
11
+ target: `#ALVFMMainPivotGeneral${wpId}`,
12
+ headline: `'GENERAL' tab`,
13
+ message: `General information about the manual, not tied to any specific Policy, Instruction or process.`,
14
+ },
15
+ ];
16
+ }
17
+ //# sourceMappingURL=SampleTeachBubbles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SampleTeachBubbles.js","sourceRoot":"","sources":["../../../../src/components/atoms/TeachBubble/SampleTeachBubbles.tsx"],"names":[],"mappings":"AAGA,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO;QACL;YACE,WAAW;YACX,6FAA6F;YAC7F,MAAM,EAAE,iBAAiB,IAAI,EAAE;YAC/B,QAAQ,EAAE,+BAA+B;YACzC,OAAO,EAAE,8LAA8L;SACxM,EAAE;YACD,WAAW;YACX,MAAM,EAAE,yBAAyB,IAAI,EAAE;YACvC,QAAQ,EAAE,eAAe;YACzB,OAAO,EAAE,gGAAgG;SAC1G;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { IMinTeachBubble } from './IMinTeachBubble';
3
+ export declare function makeBubbleElementFromBubbles(teachBubble: number, TeachBubbleArray: IMinTeachBubble[], setTeachBubble: any, closeTour: any): JSX.Element;
4
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/TeachBubble/component.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,wBAAgB,4BAA4B,CAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAC,eAAe,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAK,GAAG,CAAC,OAAO,CAyBzJ"}
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { TeachingBubble } from 'office-ui-fabric-react/lib/TeachingBubble';
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ export function makeBubbleElementFromBubbles(teachBubble, TeachBubbleArray, setTeachBubble, closeTour) {
5
+ if (teachBubble === null)
6
+ return null;
7
+ const theBubble = TeachBubbleArray[teachBubble];
8
+ const nextBubble = teachBubble === TeachBubbleArray.length - 1 ? 0 : teachBubble + 1;
9
+ const prevBubble = teachBubble === 0 ? TeachBubbleArray.length - 1 : teachBubble - 1;
10
+ console.log(`HomeTeachingBubbles:`, teachBubble, nextBubble, prevBubble);
11
+ const Bubble = React.createElement("div", null,
12
+ React.createElement(TeachingBubble, { target: theBubble.target, hasCloseButton: true, headline: theBubble.headline, onDismiss: () => { closeTour(); }, primaryButtonProps: { text: `${'Next'}`, onClick: () => setTeachBubble(nextBubble) }, secondaryButtonProps: { text: `${'Previous'}`, onClick: () => setTeachBubble(prevBubble) }, footerContent: `${teachBubble + 1} of ${TeachBubbleArray.length}` },
13
+ !theBubble.message ? null : React.createElement("div", null, `${theBubble.message}`),
14
+ !theBubble.content ? null : React.createElement("div", null, `${theBubble.content}`)));
15
+ return Bubble;
16
+ }
17
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/components/atoms/TeachBubble/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,C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CAAO,GAAI,SAAS,CAAC,OAAQ,EAAE,CAAQ;YACnE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,iCAAO,GAAI,SAAS,CAAC,OAAQ,EAAE,CAAQ,CACtD,CACf,CAAA;IAEN,OAAO,MAAM,CAAC;AAEhB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ export interface IWhoDunItItem extends Partial<any> {
3
+ Author?: any;
4
+ Editor?: any;
5
+ FirstPublishedDate?: any;
6
+ createdLoc?: string;
7
+ "Author/Title"?: string;
8
+ modifiedLoc?: string;
9
+ "Editor/Title"?: string;
10
+ }
11
+ export interface IWhoDunItRow {
12
+ item: IWhoDunItItem;
13
+ showCreated?: boolean;
14
+ showPublished?: boolean;
15
+ showModified?: boolean;
16
+ }
17
+ export declare function getWhoDunItElements(props: IWhoDunItRow): JSX.Element;
18
+ //# sourceMappingURL=getWhoDunIt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getWhoDunIt.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/WhoDunItRow/getWhoDunIt.tsx"],"names":[],"mappings":";AAKA,MAAM,WAAW,aAAc,SAAQ,OAAO,CAAC,GAAG,CAAC;IACjD,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,MAAM,CAAC,EAAE,GAAG,CAAC;IAEb,kBAAkB,CAAC,EAAE,GAAG,CAAC;IAEzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CAEzB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,aAAa,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,mBAAmB,CAAE,KAAK,EAAE,YAAY,GAAI,GAAG,CAAC,OAAO,CA0BtE"}
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ export function getWhoDunItElements(props) {
3
+ const { item, showCreated, showModified, showPublished } = props;
4
+ const modifiedString = showModified === true ? `Modified${item.modifiedLoc} - ${item['Editor/Title']}` : '';
5
+ const WhoDates = React.createElement("div", { className: 'whoDateStamps' },
6
+ showCreated !== true || item.FirstPublishedDate ? null :
7
+ React.createElement("div", { className: 'dateStamps', title: modifiedString },
8
+ React.createElement("div", null, "Created"),
9
+ " ",
10
+ React.createElement("div", null, item.createdLoc),
11
+ " ",
12
+ React.createElement("div", null, item['Author/Title'])),
13
+ showPublished !== true ? null :
14
+ React.createElement("div", { className: 'dateStamps', title: modifiedString },
15
+ React.createElement("div", null, "Published"),
16
+ " ",
17
+ React.createElement("div", null, item.FirstPublishedDate ? item.FirstPublishedDate : 'NOT YET PUBLISHED'),
18
+ " ",
19
+ React.createElement("div", null)));
20
+ return WhoDates;
21
+ }
22
+ //# sourceMappingURL=getWhoDunIt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getWhoDunIt.js","sourceRoot":"","sources":["../../../../src/components/atoms/WhoDunItRow/getWhoDunIt.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwB/B,MAAM,UAAU,mBAAmB,CAAE,KAAmB;IAEtD,MAAM,EAAG,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAElE,MAAM,cAAc,GAAW,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,WAAY,IAAI,CAAC,WAAY,MAAO,IAAI,CAAC,cAAc,CAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAExH,MAAM,QAAQ,GAAG,6BAAK,SAAS,EAAG,eAAe;QAC7C,WAAW,KAAK,IAAI,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACxD,6BAAK,SAAS,EAAG,YAAY,EAAG,KAAK,EAAK,cAAc;gBACtD,2CAAkB;;gBAAC,iCAAO,IAAI,CAAC,UAAU,CAAQ;;gBAAC,iCAAO,IAAI,CAAC,cAAc,CAAC,CAAQ,CACjF;QAEN,aAAa,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC/B,6BAAK,SAAS,EAAG,YAAY,EAAG,KAAK,EAAK,cAAc;gBAEtD,6CAAoB;;gBAAC,iCAAO,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,mBAAmB,CAAQ;;gBAAC,gCAAe,CACvH,CAOJ,CAAC;IAEP,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ export interface IDotsHookWPProps {
3
+ maxDots: number;
4
+ titleProp?: string;
5
+ selectedLabel?: string;
6
+ containerStyle?: React.CSSProperties;
7
+ constainerClass?: string;
8
+ labelStyle?: React.CSSProperties;
9
+ iconStyle?: React.CSSProperties;
10
+ }
11
+ export interface IDotsHookProps {
12
+ items: any[];
13
+ current: number;
14
+ selectCallback: any;
15
+ dotsWPProps: IDotsHookWPProps;
16
+ }
17
+ declare const DotsHook: React.FC<IDotsHookProps>;
18
+ export default DotsHook;
19
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/FadeCarousel/SelectDots/component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACjC,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CACjC;AAED,MAAM,WAAW,cAAc;IAE7B,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAEhB,cAAc,EAAE,GAAG,CAAC;IACpB,WAAW,EAAE,gBAAgB,CAAC;CAC/B;AAID,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA6CtC,CAAA;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,38 @@
1
+ import * as React from 'react';
2
+ import { useState, useEffect } from 'react';
3
+ import { Icon } from 'office-ui-fabric-react/lib/Icon';
4
+ import { getSpreadIndexes, } from '../../../../logic/Arrays/thinOutArray';
5
+ require('@mikezimm/fps-styles/dist/selectDots.css');
6
+ const defaultMessage = `Currently showing item: {current} of {count}`;
7
+ const DotsHook = (props) => {
8
+ const { items, current, selectCallback, } = props;
9
+ const { maxDots, titleProp, selectedLabel, containerStyle, labelStyle, iconStyle, constainerClass } = props.dotsWPProps;
10
+ const [dotsToShow, setDotsToShow] = useState([]);
11
+ // useEffect NOTES: Start with anonomous function
12
+ useEffect(() => {
13
+ // useEffect NOTES: Be sure to wrap this in an anonomous function or it will keep rendering over and over
14
+ (() => {
15
+ const showDots = getSpreadIndexes(items.length, maxDots);
16
+ console.log('showDots: ', showDots);
17
+ setDotsToShow(showDots);
18
+ // useEffect NOTES: Be sure to add () at the end of the function to call it correctly
19
+ })();
20
+ // useEffect NOTES: init has , []) at the end
21
+ }, []);
22
+ const dots = [];
23
+ items.map((item, index) => {
24
+ const selectDot = index === current ? 'fpsSelectDot' : 'fpsUnSelectDot';
25
+ if (dotsToShow.indexOf(index) > -1)
26
+ dots.push(React.createElement(Icon, { title: `#${index + 1} of ${items.length} ${titleProp ? ` - ${item[titleProp]}` : ''}`, onClick: () => selectCallback(index), className: `fpsFadeDots ${selectDot}`, iconName: 'CircleShapeSolid', style: iconStyle }));
27
+ });
28
+ const baseLabel = selectedLabel ? selectedLabel : selectedLabel !== '' ? defaultMessage : '';
29
+ const dotLabel = baseLabel.replace(`{Title}`, items[current] ? items[current][titleProp] : '')
30
+ .replace(`{current}`, (current + 1).toFixed())
31
+ .replace(`{count}`, (items.length).toFixed());
32
+ const dotsElement = React.createElement("div", { className: `fpsDotsContainer ${constainerClass}`, style: containerStyle },
33
+ React.createElement("div", { className: 'fadeInDots' }, dots),
34
+ React.createElement("div", { className: 'dotLabel', style: labelStyle }, dotLabel));
35
+ return (dotsElement);
36
+ };
37
+ export default DotsHook;
38
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../../src/components/molecules/FadeCarousel/SelectDots/component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,gBAAgB,GAAG,MAAM,uCAAuC,CAAC;AAE1E,OAAO,CAAE,0CAA0C,CAAC,CAAC;AAsBrD,MAAM,cAAc,GAAW,8CAA8C,CAAC;AAE9E,MAAM,QAAQ,GAA6B,CAAE,KAAK,EAAG,EAAE;IAErD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,GAAG,GAAG,KAAK,CAAC;IAClD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC;IACxH,MAAM,CAAE,UAAU,EAAE,aAAa,CAAE,GAAG,QAAQ,CAAY,EAAE,CAAE,CAAC;IAE/D,kDAAkD;IAClD,SAAS,CAAC,GAAG,EAAE;QACb,0GAA0G;QAC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AAO,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC3F,OAAO,CAAC,WAAW,EAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,CAAE;SAC7C,OAAO,CAAC,SAAS,EAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAE,CAAC;IAEhD,MAAM,WAAW,GAAG,6BAAK,SAAS,EAAE,oBAAoB,eAAe,EAAE,EAAE,KAAK,EAAI,cAAc;QAChG,6BAAK,SAAS,EAAG,YAAY,IACzB,IAAI,CACF;QACN,6BAAK,SAAS,EAAG,UAAU,EAAE,KAAK,EAAI,UAAU,IAC5C,QAAQ,CACN,CACF,CAAC;IAEP,OAAO,CAAE,WAAW,CAAE,CAAC;AACzB,CAAC,CAAA;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,36 @@
1
+ import * as React from 'react';
2
+ import { IDotsHookProps } from './SelectDots/component';
3
+ export interface ICarouselItem extends Partial<any> {
4
+ imageSrc?: string;
5
+ title?: string;
6
+ location?: string;
7
+ href?: string;
8
+ target?: string;
9
+ FirstPublishedDate?: any;
10
+ createdLoc?: string;
11
+ "Author/Title"?: string;
12
+ modifiedLoc?: string;
13
+ "Editor/Title"?: string;
14
+ }
15
+ export interface ICarouselProps {
16
+ items: ICarouselItem[];
17
+ firstXItems?: number;
18
+ titleField?: string;
19
+ descriptionField?: string;
20
+ hrefField?: string;
21
+ imageUrlField?: string;
22
+ noImage?: boolean;
23
+ showCreated?: boolean;
24
+ showPublished?: boolean;
25
+ showModified?: boolean;
26
+ constainerStyles?: React.CSSProperties;
27
+ constainerClass?: string;
28
+ }
29
+ export interface IFadeCarouselProps {
30
+ carouselProps: ICarouselProps;
31
+ dotProps?: IDotsHookProps;
32
+ }
33
+ export declare function getNextIndex(length: number, current: number, back?: boolean): number;
34
+ declare const FadeCarousel: React.FC<IFadeCarouselProps>;
35
+ export default FadeCarousel;
36
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/FadeCarousel/component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAiB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAOjE,MAAM,WAAW,aAAc,SAAQ,OAAO,CAAC,GAAG,CAAC;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,GAAG,CAAC;IAEzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CAExB;AAEF,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAGD,wBAAgB,YAAY,CAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,OAAe,GAAI,MAAM,CAM7F;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA4E9C,CAAA;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,71 @@
1
+ import * as React from 'react';
2
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3
+ import { useState } from 'react';
4
+ import { Icon } from 'office-ui-fabric-react/lib/Icon';
5
+ import DotsHook from './SelectDots/component';
6
+ import { getWhoDunItElements } from '../../atoms/WhoDunItRow/getWhoDunIt';
7
+ require('@mikezimm/fps-styles/dist/fadeCarouselStyles.css');
8
+ require('@mikezimm/fps-styles/dist/fadeCarouselArrows.css');
9
+ // getNextIndex copied to fps-library-v2 here: src\logic\Arrays\searching\getNextIndex.ts
10
+ export function getNextIndex(length, current, back = false) {
11
+ if (back === false) {
12
+ return current === length - 1 ? 0 : current + 1;
13
+ }
14
+ else {
15
+ return current === 0 ? length - 1 : current - 1;
16
+ }
17
+ }
18
+ const FadeCarousel = (props) => {
19
+ const { items, titleField, descriptionField, hrefField, imageUrlField, constainerStyles, constainerClass, noImage, firstXItems, showCreated, showModified, showPublished } = props.carouselProps;
20
+ const [currentSlide, setCurrentSlide] = useState(0);
21
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
+ const [showItems, setShowItems] = useState(firstXItems && firstXItems > 0 ? items.slice(0, firstXItems) : items);
23
+ const titleProp = titleField ? titleField : 'Title';
24
+ const slides = showItems.map((item, index) => {
25
+ const inOrOut = index === currentSlide ? 'fpsFadeIn' : 'fpsFadeOut';
26
+ const imageLink = imageUrlField ? item[imageUrlField] : item.BannerImageUrl ? item.BannerImageUrl.Url.replace('tenant', 'mcclickster') : '';
27
+ const openLink = `${window.location.origin}${item[hrefField ? hrefField : 'FileRef']}`;
28
+ const WhoDates = getWhoDunItElements({ item: item, showCreated: showCreated, showModified: showModified, showPublished: showPublished });
29
+ // const modifiedString: string = showModified === true ? `Modified${ item.modifiedLoc } - ${ item['Editor/Title'] }` : '';
30
+ // const WhoDates = <div className={ 'whoDateStamps' }>
31
+ // { showCreated !== true || item.FirstPublishedDate ? null :
32
+ // <div className={ 'dateStamps' } title = { modifiedString } >
33
+ // <div>Created</div> <div>{ item.createdLoc }</div> <div>{ item['Author/Title'] }</div>
34
+ // </div>
35
+ // }
36
+ // { showPublished !== true ? null :
37
+ // <div className={ 'dateStamps' } title = { modifiedString } >
38
+ // {/* <div>Published</div> <div>{ item.FirstPublishedDate.toLocalTime() }</div> <div>{ item['Author/Title'] }</div> */}
39
+ // <div>Published</div> <div>{ item.FirstPublishedDate ? item.FirstPublishedDate : 'NOT YET PUBLISHED' }</div> <div>{ }</div>
40
+ // </div>
41
+ // }
42
+ // {/* { showModified !== true ? null :
43
+ // <div className={ 'dateStamps' }>
44
+ // <div>Modified</div> <div>{ item.modifiedLoc }</div> <div>{ item['Editor/Title'] }</div>
45
+ // </div>
46
+ // } */}
47
+ // </div>;
48
+ return (React.createElement("div", { key: index, onClick: () => window.open(openLink, '_blank'), className: `fpsFadeElement ${inOrOut}` },
49
+ !imageLink || noImage === true ? null : React.createElement("img", { src: imageLink.replace('tenant', 'mcclickster') }),
50
+ React.createElement("h3", null, item[titleProp]),
51
+ React.createElement("p", null, item[descriptionField ? descriptionField : 'Description']),
52
+ WhoDates));
53
+ });
54
+ const slider = React.createElement("div", { className: `fpsFadeContainer ${constainerClass}`, style: constainerStyles },
55
+ React.createElement("div", { className: 'fpsFadeArrow fpsFadeArrowL', onClick: () => setCurrentSlide(getNextIndex(showItems.length, currentSlide, true)) },
56
+ React.createElement(Icon, { iconName: "ChevronLeft" })),
57
+ slides,
58
+ React.createElement("div", { className: 'fpsFadeArrow fpsFadeArrowR', onClick: () => setCurrentSlide(getNextIndex(showItems.length, currentSlide)) },
59
+ React.createElement(Icon, { iconName: "ChevronRight" })),
60
+ React.createElement(DotsHook, { items: showItems, current: currentSlide, selectCallback: setCurrentSlide, dotsWPProps: { ...{
61
+ maxDots: firstXItems ? firstXItems : 7,
62
+ titleProp: titleProp,
63
+ // selectedLabel = { `This is a new {count} label from {current} based on {Title}` }
64
+ // containerStyle = {{ fontSize: '48px', color: 'darkred', padding: '10px', }}
65
+ // iconStyle = {{ fontSize: '18px', color: 'darkgreen', padding: '3px', }}
66
+ // labelStyle = {{ fontSize: '22px', color: 'purple', padding: '5px', }}
67
+ }, ...props.dotProps } }));
68
+ return (slider);
69
+ };
70
+ export default FadeCarousel;
71
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/components/molecules/FadeCarousel/component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,6DAA6D;AAC7D,OAAO,EAAE,QAAQ,EAAa,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAEvD,OAAO,QAA4B,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,CAAE,kDAAkD,CAAC,CAAC;AAC7D,OAAO,CAAE,kDAAkD,CAAC,CAAC;AAwC7D,0FAA0F;AAC1F,MAAM,UAAU,YAAY,CAAE,MAAc,EAAE,OAAe,EAAE,OAAgB,KAAK;IAClF,IAAK,IAAI,KAAK,KAAK,EAAG;QACpB,OAAO,OAAO,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC;KACjD;SAAM;QACL,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC;KACjD;AACH,CAAC;AAED,MAAM,YAAY,GAAiC,CAAE,KAAK,EAAG,EAAE;IAE7D,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CAAE,SAAS,CAAC,MAAM,EAAE,YAAY,CAAE,CAAC;YAC7H,oBAAC,IAAI,IAAC,QAAQ,EAAC,cAAc,GAAG,CAC5B;QAEN,oBAAC,QAAQ,IACP,KAAK,EAAG,SAAS,EACjB,OAAO,EAAG,YAAY,EACtB,cAAc,EAAI,eAAe,EACjC,WAAW,EAAI,EAAC,GAAG;oBACjB,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;oBACtC,SAAS,EAAE,SAAS;oBACpB,oFAAoF;oBACpF,8EAA8E;oBAC9E,0EAA0E;oBAC1E,yEAAyE;iBAC1E,EAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,GAErB,CACE,CAAC;IAEP,OAAO,CAAE,MAAM,CAAE,CAAC;AAEpB,CAAC,CAAA;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * thinArray will take an array of elements and
3
+ * return 'relatively' evenly spaced elements at for total of 'count' items.
4
+ * NOTE that the spacing may not seem very even when the length is smaller
5
+ *
6
+ * example: array = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], count === 2:
7
+ * return: [ 0, 9 ]
8
+ * if count === 3: return: [0,4,9]
9
+ * if count === 4: return: [0,2,5,9]
10
+ *
11
+ * FRINGE CASE:
12
+ * Added pushEven for when 1 < ratio < 2 where it would return [0] instead of every other element.
13
+ As an example if length === 99 and count === 51, it would return [0] but of count were 50 it would give every other item.
14
+ So now, if the ratio of length / count < 2, it will just return the first, every other one and the last.
15
+ So if you had an array of length 99 and asked for 98 back, it would only give you an array with 50 items... 0,2,4,6,8,10..., 98 so every other item.
16
+ This means in this case, you could get far less items back than the count, but then the logic would not have to decide which ones to skip.
17
+ *
18
+ *
19
+ * @param array
20
+ * @param count
21
+ * @returns
22
+ */
23
+ export declare function thinArray(array: any[], count?: number): any[];
24
+ /**
25
+ * getSpreadIndexes will take the length (of an array) and
26
+ * return evenly spaced zero-based indexes for total of 'count' indexes.
27
+ *
28
+ * example: array = [ A, B, C, D, E, F, G, H, I, J, ] ( length === 10 ), count === 2:
29
+ * return: [ 0, 9 ] =>>> if you map these indexes, the result would be: [ A, J ]
30
+ * if count === 3: return: [0,4,9] =>>> if you map these indexes, the result would be: [ A, E, J ]
31
+ * if count === 4: return: [0,2,5,9] =>>> if you map these indexes, the result would be: [ A, C, F, J ]
32
+ *
33
+ * NOTE FRINGE CASE MENTIONED IN thinArray function where the 1 < ( length / count ) < 2
34
+ * You may not get the total count of items back in that case. but every other item instead.
35
+ *
36
+ * @param array
37
+ * @param count
38
+ * @returns
39
+ */
40
+ export declare function getSpreadIndexes(arrayLength: number, count: number): number[];
41
+ /**
42
+ * The following commented code is what I tested in code pen for reference and testing if needed
43
+ */
44
+ //# sourceMappingURL=thinOutArray.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thinOutArray.d.ts","sourceRoot":"","sources":["../../../src/logic/Arrays/thinOutArray.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,wBAAgB,SAAS,CAAE,KAAK,EAAE,GAAG,EAAE,EAAE,KAAK,GAAE,MAAU,GAAG,GAAG,EAAE,CAmCjE;AAED;;;;;;;;;;;;;;;GAeG;AAGH,wBAAgB,gBAAgB,CAAE,WAAW,EAAE,MAAM,EAAG,KAAK,EAAE,MAAM,GAAI,MAAM,EAAE,CAchF;AAGD;;GAEG"}
@@ -0,0 +1,122 @@
1
+ // Function based on this post: https://codereview.stackexchange.com/a/56627
2
+ /**
3
+ * thinArray will take an array of elements and
4
+ * return 'relatively' evenly spaced elements at for total of 'count' items.
5
+ * NOTE that the spacing may not seem very even when the length is smaller
6
+ *
7
+ * example: array = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], count === 2:
8
+ * return: [ 0, 9 ]
9
+ * if count === 3: return: [0,4,9]
10
+ * if count === 4: return: [0,2,5,9]
11
+ *
12
+ * FRINGE CASE:
13
+ * Added pushEven for when 1 < ratio < 2 where it would return [0] instead of every other element.
14
+ As an example if length === 99 and count === 51, it would return [0] but of count were 50 it would give every other item.
15
+ So now, if the ratio of length / count < 2, it will just return the first, every other one and the last.
16
+ So if you had an array of length 99 and asked for 98 back, it would only give you an array with 50 items... 0,2,4,6,8,10..., 98 so every other item.
17
+ This means in this case, you could get far less items back than the count, but then the logic would not have to decide which ones to skip.
18
+ *
19
+ *
20
+ * @param array
21
+ * @param count
22
+ * @returns
23
+ */
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ export function thinArray(array, count = 2) {
26
+ const originalLength = array.length;
27
+ if (originalLength === 0) {
28
+ return [];
29
+ }
30
+ else if (originalLength <= count) {
31
+ return array;
32
+ }
33
+ else if (count === 2) {
34
+ return [array[0], array[originalLength - 1]];
35
+ }
36
+ const targetSections = count - 1;
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ const output = [];
39
+ const ratio = originalLength / targetSections;
40
+ array.map((e, i) => {
41
+ const iPush = Math.floor(output.length * (ratio) - 1);
42
+ // Added pushEven for when 1 < ratio < 2 where it would return [0] instead of every other element.
43
+ // As an example if length === 99 and count === 51, it would return [0] but of count were 50 it would give every other item.
44
+ const isEven = (i % 2) === 0 ? true : false;
45
+ const pushEven = ratio < 2 && isEven === true ? true : false;
46
+ if (iPush === i || i === 0 || i === array.length || pushEven === true) {
47
+ output.push(e);
48
+ }
49
+ });
50
+ return output;
51
+ }
52
+ /**
53
+ * getSpreadIndexes will take the length (of an array) and
54
+ * return evenly spaced zero-based indexes for total of 'count' indexes.
55
+ *
56
+ * example: array = [ A, B, C, D, E, F, G, H, I, J, ] ( length === 10 ), count === 2:
57
+ * return: [ 0, 9 ] =>>> if you map these indexes, the result would be: [ A, J ]
58
+ * if count === 3: return: [0,4,9] =>>> if you map these indexes, the result would be: [ A, E, J ]
59
+ * if count === 4: return: [0,2,5,9] =>>> if you map these indexes, the result would be: [ A, C, F, J ]
60
+ *
61
+ * NOTE FRINGE CASE MENTIONED IN thinArray function where the 1 < ( length / count ) < 2
62
+ * You may not get the total count of items back in that case. but every other item instead.
63
+ *
64
+ * @param array
65
+ * @param count
66
+ * @returns
67
+ */
68
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
+ export function getSpreadIndexes(arrayLength, count) {
70
+ if (arrayLength === 0) {
71
+ return [];
72
+ }
73
+ const indexes = Array.from({ length: arrayLength }, (_, i) => i);
74
+ if (arrayLength <= count) {
75
+ return indexes;
76
+ }
77
+ else {
78
+ const keepIndexes = thinArray(indexes, count);
79
+ return keepIndexes;
80
+ }
81
+ }
82
+ /**
83
+ * The following commented code is what I tested in code pen for reference and testing if needed
84
+ */
85
+ // const arrLength = 99;
86
+ // const numbers = Array.from({ length: arrLength }, (_, i) => i );
87
+ // function thinArray(array, count ) {
88
+ // const originalLength = array.length;
89
+ // if (originalLength === 0) {
90
+ // console.log('first if')
91
+ // return [];
92
+ // } else if (originalLength <= count) {
93
+ // console.log('first else')
94
+ // return array;
95
+ // } else if ( count === 2 ) {
96
+ // console.log('second else')
97
+ // return [ array[0], array[ originalLength - 1] ];
98
+ // }
99
+ // const targetSections = count -1;
100
+ // // eslint-disable-next-line @typescript-eslint/no-explicit-any
101
+ // const output= [];
102
+ // const ratio = originalLength / targetSections;
103
+ // console.log('test',targetSections);
104
+ // array.map( ( e, i ) => {
105
+ // const iPush = Math.floor(output.length * ( ratio ) -1);
106
+ // const isEven = (i % 2) == 0 ? true : false;
107
+ // const iPushEven = ratio < 2 && isEven === true ? true : false;
108
+ // if ( iPush === i || i === 0 || i === array.length || iPushEven === true ) {
109
+ // output.push( e );
110
+ // }
111
+ // console.log( 'iPush',iPushEven, i, iPush, output )
112
+ // });
113
+ // console.log( 'ratio',ratio )
114
+ // return output;
115
+ // }
116
+ // const base = 51;
117
+ // const result = thinArray( numbers,base)
118
+ // console.log( `${( arrLength + 1 )} / ${base-1}`, ( arrLength + 1 ) / ( base-1 ) )
119
+ // console.log(`${( arrLength + 1 )} / ${base}`, ( arrLength + 1 ) / base)
120
+ // console.log( `${( arrLength + 1 )} / ${base+1}`, ( arrLength + 1 ) / ( base + 1 ) )
121
+ // console.log( result )
122
+ //# sourceMappingURL=thinOutArray.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thinOutArray.js","sourceRoot":"","sources":["../../../src/logic/Arrays/thinOutArray.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAE7E;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,8DAA8D;AAC9D,MAAM,UAAU,SAAS,CAAE,KAAY,EAAE,QAAgB,CAAC;IAExD,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC;IAEpC,IAAI,cAAc,KAAK,CAAC,EAAE;QACtB,OAAO,EAAE,CAAC;KAEb;SAAM,IAAI,cAAc,IAAI,KAAK,EAAE;QAChC,OAAO,KAAK,CAAC;KAEhB;SAAM,IAAK,KAAK,KAAK,CAAC,EAAG;QACxB,OAAO,CAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAE,cAAc,GAAG,CAAC,CAAC,CAAE,CAAC;KAEjD;IAED,MAAM,cAAc,GAAG,KAAK,GAAE,CAAC,CAAC;IAChC,8DAA8D;IAC9D,MAAM,MAAM,GAAS,EAAE,CAAC;IACxB,MAAM,KAAK,GAAG,cAAc,GAAG,cAAc,CAAC;IAE9C,KAAK,CAAC,GAAG,CAAE,CAAE,CAAC,EAAE,CAAC,EAAG,EAAE;QACpB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAE,KAAK,CAAE,GAAE,CAAC,CAAC,CAAC;QAEvD,kGAAkG;QAClG,4HAA4H;QAC5H,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5C,MAAM,QAAQ,GAAG,KAAK,GAAG,CAAC,IAAI,MAAM,KAAK,IAA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B,IAAI;AAEJ,mBAAmB;AAEnB,0CAA0C;AAE1C,oFAAoF;AACpF,0EAA0E;AAC1E,sFAAsF;AACtF,wBAAwB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikezimm/fps-library-v2",
3
- "version": "1.0.80",
3
+ "version": "1.0.81",
4
4
  "description": "Library of reusable typescript/javascript functions, interfaces and constants",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@microsoft/sp-property-pane": "^1.15.2",
43
43
  "@mikezimm/fps-pnp2": "^1.0.27",
44
- "@mikezimm/fps-styles": "^1.0.11",
44
+ "@mikezimm/fps-styles": "^1.0.12",
45
45
  "@pnp/spfx-controls-react": "3.12.0",
46
46
  "@pnp/spfx-property-controls": "^3.6.0",
47
47
  "office-ui-fabric-react": "^7.199.1",