@finsemble/finsemble-ui 6.6.0-beta.2 → 6.6.0-beta.3
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/index.d.ts +1 -0
- package/package.json +4 -3
- package/react/actions/smartDesktopDesignerActions.d.ts +3 -3
- package/react/actions/smartDesktopDesignerActions.js.map +1 -1
- package/react/assets/css/toolbar.css +0 -4
- package/react/assets/css/userPreferences.css +35 -6
- package/react/components/common/DropdownButton.js.map +1 -1
- package/react/components/common/FinsembleToggle.d.ts +3 -1
- package/react/components/common/FinsembleToggle.js +12 -4
- package/react/components/common/FinsembleToggle.js.map +1 -1
- package/react/components/common/TimeSelect.d.ts +16 -0
- package/react/components/common/TimeSelect.js +143 -0
- package/react/components/common/TimeSelect.js.map +1 -0
- package/react/components/common/css/accordion.css +3 -5
- package/react/components/common/css/time-select.css +8 -0
- package/react/components/common/css/toggle.css +39 -3
- package/react/components/common/stories/FinsembleToggle.stories.d.ts +3 -1
- package/react/components/common/stories/FinsembleToggle.stories.js +12 -0
- package/react/components/common/stories/FinsembleToggle.stories.js.map +1 -1
- package/react/components/common/stories/TimeSelect.stories.d.ts +11 -0
- package/react/components/common/stories/TimeSelect.stories.js +20 -0
- package/react/components/common/stories/TimeSelect.stories.js.map +1 -0
- package/react/components/common/tests/FinsembleToggle.spec.js +6 -1
- package/react/components/common/tests/FinsembleToggle.spec.js.map +1 -1
- package/react/components/{sdd/tests/Preloads.spec.d.ts → common/tests/TimeSelect.spec.d.ts} +0 -0
- package/react/components/common/tests/TimeSelect.spec.js +71 -0
- package/react/components/common/tests/TimeSelect.spec.js.map +1 -0
- package/react/components/sdd/AppEditPage.js +7 -1
- package/react/components/sdd/AppEditPage.js.map +1 -1
- package/react/components/sdd/Application.d.ts +1 -2
- package/react/components/sdd/Application.js +1 -2
- package/react/components/sdd/Application.js.map +1 -1
- package/react/components/sdd/Applications.js +2 -2
- package/react/components/sdd/Applications.js.map +1 -1
- package/react/components/sdd/EditPreload.d.ts +5 -7
- package/react/components/sdd/EditPreload.js +96 -109
- package/react/components/sdd/EditPreload.js.map +1 -1
- package/react/components/sdd/OptionalSettingsView.d.ts +1 -3
- package/react/components/sdd/OptionalSettingsView.js +22 -37
- package/react/components/sdd/OptionalSettingsView.js.map +1 -1
- package/react/components/sdd/Preloads.d.ts +2 -4
- package/react/components/sdd/Preloads.js +15 -17
- package/react/components/sdd/Preloads.js.map +1 -1
- package/react/components/sdd/SmartDesktopDesigner.d.ts +1 -0
- package/react/components/sdd/SmartDesktopDesigner.js +1 -0
- package/react/components/sdd/SmartDesktopDesigner.js.map +1 -1
- package/react/components/sdd/common/setPreloadDefaults.d.ts +1 -0
- package/react/components/sdd/common/setPreloadDefaults.js +21 -0
- package/react/components/sdd/common/setPreloadDefaults.js.map +1 -0
- package/react/components/sdd/common/views.js +2 -4
- package/react/components/sdd/common/views.js.map +1 -1
- package/react/components/sdd/fixtures/apps.js +6 -6
- package/react/components/sdd/fixtures/apps.js.map +1 -1
- package/react/components/sdd/fixtures/preloads.d.ts +3 -22
- package/react/components/sdd/fixtures/preloads.js +40 -23
- package/react/components/sdd/fixtures/preloads.js.map +1 -1
- package/react/components/sdd/stories/OptionalSettingsView.stories.d.ts +3 -2
- package/react/components/sdd/stories/OptionalSettingsView.stories.js +14 -15
- package/react/components/sdd/stories/OptionalSettingsView.stories.js.map +1 -1
- package/react/components/sdd/stories/SmartDesktopDesigner.stories.js +1 -0
- package/react/components/sdd/stories/SmartDesktopDesigner.stories.js.map +1 -1
- package/react/components/sdd/tests/EditPreload.spec.js +8 -10
- package/react/components/sdd/tests/EditPreload.spec.js.map +1 -1
- package/react/components/{userPreferences/tests/ScheduledRestart.spec.d.ts → sdd/tests/OptionalSettingsView.spec.d.ts} +0 -0
- package/react/components/sdd/tests/OptionalSettingsView.spec.js +22 -0
- package/react/components/sdd/tests/OptionalSettingsView.spec.js.map +1 -0
- package/react/components/sdd/tests/SmartDesktopDesigner.spec.js +1 -1
- package/react/components/sdd/tests/SmartDesktopDesigner.spec.js.map +1 -1
- package/react/components/shared/DefaultDropdownButton.js +5 -4
- package/react/components/shared/DefaultDropdownButton.js.map +1 -1
- package/react/components/shared/tests/DefaultDropdownButton.spec.js +9 -0
- package/react/components/shared/tests/DefaultDropdownButton.spec.js.map +1 -1
- package/react/components/toolbar/advancedAppLauncher/components/AppActionsMenu.js +2 -1
- package/react/components/toolbar/advancedAppLauncher/components/AppActionsMenu.js.map +1 -1
- package/react/components/userPreferences/UserPreferenceTypes.d.ts +3 -2
- package/react/components/userPreferences/UserPreferenceTypes.js.map +1 -1
- package/react/components/userPreferences/components/content/General.d.ts +2 -5
- package/react/components/userPreferences/components/content/General.js +31 -11
- package/react/components/userPreferences/components/content/General.js.map +1 -1
- package/react/components/userPreferences/components/general/ScheduledClose.d.ts +10 -0
- package/react/components/userPreferences/components/general/ScheduledClose.js +95 -0
- package/react/components/userPreferences/components/general/ScheduledClose.js.map +1 -0
- package/react/components/userPreferences/stores/UserPreferencesStore.d.ts +5 -2
- package/react/components/userPreferences/stores/UserPreferencesStore.js +9 -3
- package/react/components/userPreferences/stores/UserPreferencesStore.js.map +1 -1
- package/react/components/userPreferences/stories/General.stories.d.ts +6 -2
- package/react/components/userPreferences/stories/ScheduledClose.stories.d.ts +12 -0
- package/react/components/userPreferences/stories/ScheduledClose.stories.js +53 -0
- package/react/components/userPreferences/stories/ScheduledClose.stories.js.map +1 -0
- package/react/components/userPreferences/tests/General.spec.js +4 -17
- package/react/components/userPreferences/tests/General.spec.js.map +1 -1
- package/react/components/userPreferences/tests/ScheduledClose.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/ScheduledClose.spec.js +47 -0
- package/react/components/userPreferences/tests/ScheduledClose.spec.js.map +1 -0
- package/react/reducers/rootReducer.d.ts +1 -1
- package/react/reducers/smartDesktopDesignerReducer.js +1 -1
- package/react/reducers/smartDesktopDesignerReducer.js.map +1 -1
- package/react/store.d.ts +2 -2
- package/react/types/smartDesktopDesignerTypes.d.ts +9 -1
- package/react/types/smartDesktopDesignerTypes.js.map +1 -1
- package/react/components/sdd/stories/EditPreload.stories.d.ts +0 -11
- package/react/components/sdd/stories/EditPreload.stories.js +0 -35
- package/react/components/sdd/stories/EditPreload.stories.js.map +0 -1
- package/react/components/sdd/stories/Preloads.stories.d.ts +0 -11
- package/react/components/sdd/stories/Preloads.stories.js +0 -31
- package/react/components/sdd/stories/Preloads.stories.js.map +0 -1
- package/react/components/sdd/tests/Preloads.spec.js +0 -47
- package/react/components/sdd/tests/Preloads.spec.js.map +0 -1
- package/react/components/userPreferences/components/general/ScheduledRestart.d.ts +0 -29
- package/react/components/userPreferences/components/general/ScheduledRestart.js +0 -198
- package/react/components/userPreferences/components/general/ScheduledRestart.js.map +0 -1
- package/react/components/userPreferences/tests/ScheduledRestart.spec.js +0 -70
- package/react/components/userPreferences/tests/ScheduledRestart.spec.js.map +0 -1
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// There is no typedef file for this module. A blank typedef file is necessary to avoid this compiler error: https://github.com/microsoft/TypeScript/issues/27956
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finsemble/finsemble-ui",
|
|
3
|
-
"version": "6.6.0-beta.
|
|
3
|
+
"version": "6.6.0-beta.3",
|
|
4
4
|
"description": "Ready-made React components to give you a head-start building your SmartDesktop.",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"files": [
|
|
7
|
+
"index.d.ts",
|
|
7
8
|
"react"
|
|
8
9
|
],
|
|
9
10
|
"scripts": {
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
"build-storybook": "build-storybook"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@finsemble/finsemble-api": "6.6.0-beta.
|
|
30
|
+
"@finsemble/finsemble-api": "6.6.0-beta.3",
|
|
30
31
|
"@q42/floating-focus-a11y": "^1.3.3",
|
|
31
32
|
"@reduxjs/toolkit": "^1.5.0",
|
|
32
33
|
"@svgr/webpack": "^5.5.0",
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
"@types/chai": "4.3.0",
|
|
35
36
|
"@types/lodash": "4.14.178",
|
|
36
37
|
"@types/mime-types": "^2.1.0",
|
|
37
|
-
"@types/mocha": "9.
|
|
38
|
+
"@types/mocha": "9.1.0",
|
|
38
39
|
"@types/react": "17.0.38",
|
|
39
40
|
"@types/react-dom": "17.0.11",
|
|
40
41
|
"@types/react-input-autosize": "2.2.1",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnionOf } from "unionize";
|
|
2
|
-
import { AuthenticationProvider, MenuType, PreloadType, ProjectError, ProjectSaveData } from "../types/smartDesktopDesignerTypes";
|
|
2
|
+
import { AuthenticationProvider, MenuType, PreloadMap, PreloadType, ProjectError, ProjectSaveData } from "../types/smartDesktopDesignerTypes";
|
|
3
3
|
import { services, FEA } from "@finsemble/finsemble-api";
|
|
4
4
|
export declare const SmartDesktopDesignerActions: import("unionize").Unionized<{
|
|
5
5
|
change_view: string;
|
|
@@ -9,7 +9,7 @@ export declare const SmartDesktopDesignerActions: import("unionize").Unionized<{
|
|
|
9
9
|
update_app: services.Interop.types.AppDefinition;
|
|
10
10
|
delete_app: string;
|
|
11
11
|
update_menus: MenuType;
|
|
12
|
-
update_preloads:
|
|
12
|
+
update_preloads: PreloadMap;
|
|
13
13
|
set_current_preload: PreloadType | null;
|
|
14
14
|
set_deploy_info: FEA.DeployInfo | null;
|
|
15
15
|
set_publish_error: string | null;
|
|
@@ -29,7 +29,7 @@ export declare const SmartDesktopDesignerActions: import("unionize").Unionized<{
|
|
|
29
29
|
update_app: services.Interop.types.AppDefinition;
|
|
30
30
|
delete_app: string;
|
|
31
31
|
update_menus: MenuType;
|
|
32
|
-
update_preloads:
|
|
32
|
+
update_preloads: PreloadMap;
|
|
33
33
|
set_current_preload: PreloadType | null;
|
|
34
34
|
set_deploy_info: FEA.DeployInfo | null;
|
|
35
35
|
set_publish_error: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smartDesktopDesignerActions.js","sourceRoot":"","sources":["../../src/actions/smartDesktopDesignerActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAW,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"smartDesktopDesignerActions.js","sourceRoot":"","sources":["../../src/actions/smartDesktopDesignerActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAW,MAAM,UAAU,CAAC;AAerD,MAAM,CAAC,MAAM,2BAA2B,GAAG,QAAQ,CAClD;IACC,WAAW,EAAE,MAAM,EAAU;IAC7B,WAAW,EAAE,MAAM,EAAmB;IACtC,OAAO,EAAE,MAAM,EAAiB;IAChC,kBAAkB,EAAE,MAAM,EAAiB;IAC3C,UAAU,EAAE,MAAM,EAAiB;IACnC,UAAU,EAAE,MAAM,EAAU;IAC5B,YAAY,EAAE,MAAM,EAAY;IAChC,eAAe,EAAE,MAAM,EAAc;IACrC,mBAAmB,EAAE,MAAM,EAAsB;IACjD,eAAe,EAAE,MAAM,EAAqB;IAC5C,iBAAiB,EAAE,MAAM,EAAiB;IAC1C,iBAAiB,EAAE,MAAM,EAAW;IACpC,gBAAgB,EAAE,MAAM,EAAmB;IAC3C,sBAAsB,EAAE,MAAM,EAAW;IACzC,oBAAoB,EAAE,MAAM,EAA0B;IACtD,oBAAoB,EAAE,MAAM,EAAU;IACtC,iBAAiB,EAAE,MAAM,EAAgB;IACzC,oBAAoB,EAAE,MAAM,EAAgB;IAC5C,4BAA4B,EAAE,MAAM,EAAW;CAC/C,EACD,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CACjC,CAAC","sourcesContent":["import { unionize, ofType, UnionOf } from \"unionize\";\nimport {\n\tAuthenticationProvider,\n\tMenuType,\n\tPreloadMap,\n\tPreloadType,\n\tProjectError,\n\tProjectSaveData,\n} from \"../types/smartDesktopDesignerTypes\";\n\nimport { services, FEA } from \"@finsemble/finsemble-api\";\n\ntype AppDefinition = services.Interop.types.AppDefinition;\ntype DeployInfo = FEA.DeployInfo;\n\nexport const SmartDesktopDesignerActions = unionize(\n\t{\n\t\tchange_view: ofType<string>(),\n\t\tupdate_apps: ofType<AppDefinition[]>(),\n\t\tnew_app: ofType<string | null>(),\n\t\tset_current_app_id: ofType<string | null>(),\n\t\tupdate_app: ofType<AppDefinition>(),\n\t\tdelete_app: ofType<string>(),\n\t\tupdate_menus: ofType<MenuType>(),\n\t\tupdate_preloads: ofType<PreloadMap>(),\n\t\tset_current_preload: ofType<PreloadType | null>(),\n\t\tset_deploy_info: ofType<DeployInfo | null>(),\n\t\tset_publish_error: ofType<string | null>(),\n\t\tset_is_publishing: ofType<boolean>(),\n\t\tset_project_info: ofType<ProjectSaveData>(),\n\t\tset_is_getting_started: ofType<boolean>(),\n\t\tupdate_auth_provider: ofType<AuthenticationProvider>(),\n\t\tenable_auth_provider: ofType<string>(),\n\t\tset_project_error: ofType<ProjectError>(),\n\t\tdelete_project_error: ofType<ProjectError>(),\n\t\tset_reviewing_project_errors: ofType<boolean>(),\n\t},\n\t{ tag: \"type\", value: \"payload\" }\n);\n\nexport type SmartDesktopDesignerActionsTypes = UnionOf<typeof SmartDesktopDesignerActions>;\n"]}
|
|
@@ -371,10 +371,39 @@ img {
|
|
|
371
371
|
margin-top: 0.5em;
|
|
372
372
|
}
|
|
373
373
|
|
|
374
|
-
.
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
margin-
|
|
374
|
+
.close-toggle-container {
|
|
375
|
+
display: flex;
|
|
376
|
+
vertical-align: middle;
|
|
377
|
+
margin-bottom: 10px;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.close-toggle-container .complex-menu-checkbox-wrapper {
|
|
381
|
+
margin-top: 0;
|
|
382
|
+
width: 90px;
|
|
383
|
+
margin-right: 15px;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.time-selectors {
|
|
387
|
+
margin-left: 9em;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.daily-select {
|
|
391
|
+
display: flex;
|
|
392
|
+
align-items: center;
|
|
393
|
+
margin-bottom: 10px;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.daily-select-label {
|
|
397
|
+
display: inline-block;
|
|
398
|
+
padding-right: 10px;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.daily-select-dropdown {
|
|
402
|
+
width: 100px;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.daily-select.disabled {
|
|
406
|
+
color: var(--content-nav-highlighter);
|
|
378
407
|
}
|
|
379
408
|
|
|
380
409
|
.disabled-restart {
|
|
@@ -537,8 +566,8 @@ option:focus {
|
|
|
537
566
|
width: 20%;
|
|
538
567
|
}
|
|
539
568
|
|
|
540
|
-
.
|
|
569
|
+
.general-row {
|
|
541
570
|
display: flex;
|
|
542
571
|
margin-top: 8px;
|
|
543
|
-
margin-left:
|
|
572
|
+
margin-left: 10px;
|
|
544
573
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownButton.js","sourceRoot":"","sources":["../../../src/components/common/DropdownButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,6BAA6B,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"DropdownButton.js","sourceRoot":"","sources":["../../../src/components/common/DropdownButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,6BAA6B,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAa9E,MAAM,cAAc,GAAiE,CAAC,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L,QAAQ,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAC,wCAAwC,IAAE,OAAO,CAAO,CAAC,CAAC,CAAC,IAAI,CACrF,CACN,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import React, { useState, useRef } from \"react\";\nimport \"../../assets/css/button.css\";\nimport { useOutsideClickDetector } from \"../../hooks/useOutsideClickDetector\";\nimport { IFinsembleButtonProps } from \"../shared/Button\";\n\nexport interface IFinsembleDropdownActionButtonProps {\n\tbuttonLabel: string;\n\tbuttonOptions: Array<IFinsembleButtonProps>;\n\tmainAction: Function;\n}\n\n/**\n * @TODO: Consolidate this and DefaultDropDownButton and change all usages to use DefaultDropDownButton.\n * @deprecated Use DefaultDropDownButton instead.\n */\nconst DropdownButton: React.FunctionComponent<IFinsembleDropdownActionButtonProps> = ({\n\tbuttonLabel = \"Label\",\n\tbuttonOptions = [],\n\tmainAction,\n}: IFinsembleDropdownActionButtonProps) => {\n\tconst wrapperRef = useRef<HTMLDivElement>(null);\n\tconst [expanded, setExpanded] = useState(false);\n\n\tuseOutsideClickDetector(wrapperRef, () => setExpanded(false));\n\n\tconst options = buttonOptions.map((option, index) => (\n\t\t<div\n\t\t\tkey={index}\n\t\t\tclassName=\"finsemble-dropdown-action__btn-option\"\n\t\t\tonClick={() => {\n\t\t\t\toption.clickHandler();\n\t\t\t\tsetExpanded(false);\n\t\t\t}}\n\t\t>\n\t\t\t{option.buttonLabel}\n\t\t</div>\n\t));\n\n\tconst buttonAction = () => {\n\t\tif (expanded) {\n\t\t\tsetExpanded(false);\n\t\t\treturn;\n\t\t}\n\n\t\tif (mainAction) {\n\t\t\tmainAction();\n\t\t} else {\n\t\t\t() => setExpanded(!expanded);\n\t\t}\n\t};\n\n\treturn (\n\t\t<div ref={wrapperRef} className=\"finsemble-dropdown-action__btn-container\">\n\t\t\t<div className=\"finsemble-dropdown-action__btn\">\n\t\t\t\t<span className=\"btn-label\" onClick={buttonAction}>\n\t\t\t\t\t{buttonLabel}\n\t\t\t\t</span>\n\t\t\t\t<span className=\"separator\"></span>\n\t\t\t\t<div className=\"expand-options\" onClick={() => setExpanded(!expanded)}>\n\t\t\t\t\t<span className=\"caret\"></span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{expanded ? <div className=\"finsemble-dropdown-action__btn-options\">{options}</div> : null}\n\t\t</div>\n\t);\n};\n\nexport default DropdownButton;\n"]}
|
|
@@ -3,6 +3,8 @@ import "./css/toggle.css";
|
|
|
3
3
|
export interface FinsembleToggleProps {
|
|
4
4
|
label?: string;
|
|
5
5
|
checked: boolean;
|
|
6
|
+
textToggle?: [onLabel: string, offLabel: string];
|
|
6
7
|
onChange: (selected: boolean) => void;
|
|
8
|
+
enabled?: boolean;
|
|
7
9
|
}
|
|
8
|
-
export declare const FinsembleToggle: ({ checked, onChange, label }: FinsembleToggleProps) => JSX.Element;
|
|
10
|
+
export declare const FinsembleToggle: ({ checked, onChange, label, enabled, textToggle }: FinsembleToggleProps) => JSX.Element;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
2
|
import "./css/toggle.css";
|
|
3
3
|
import { FinsembleIcon } from "./FinsembleIcon";
|
|
4
|
-
export const FinsembleToggle = ({ checked, onChange, label }) => {
|
|
4
|
+
export const FinsembleToggle = ({ checked, onChange, label, enabled = true, textToggle }) => {
|
|
5
5
|
const [selected, setSelected] = useState(checked);
|
|
6
6
|
function doSetSelected(newValue) {
|
|
7
7
|
onChange(newValue);
|
|
8
8
|
setSelected(newValue);
|
|
9
9
|
}
|
|
10
|
+
const [yesLabel, noLabel] = textToggle !== null && textToggle !== void 0 ? textToggle : [];
|
|
10
11
|
useEffect(() => {
|
|
11
12
|
setSelected(checked);
|
|
12
13
|
}, [checked]);
|
|
13
|
-
return (React.createElement("span", { className: [
|
|
14
|
-
|
|
14
|
+
return (React.createElement("span", { className: [
|
|
15
|
+
"finsembleToggle",
|
|
16
|
+
selected ? "finsembleToggle-on" : "finsembleToggle-off",
|
|
17
|
+
!enabled ? "disabled" : "",
|
|
18
|
+
].join(" ") },
|
|
19
|
+
!textToggle && React.createElement(FinsembleIcon, { className: "finsembleToggle-icon", icon: selected ? "toggle-on" : "toggle-off" }),
|
|
20
|
+
textToggle && (React.createElement("span", { className: "toggle-text-label-wrapper" },
|
|
21
|
+
React.createElement("span", { className: "toggle-text-label toggle-text-label_on" }, yesLabel),
|
|
22
|
+
React.createElement("span", { className: "toggle-text-label toggle-text-label_off" }, noLabel))),
|
|
15
23
|
React.createElement("input", Object.assign({ type: "checkbox", onChange: (e) => {
|
|
16
24
|
doSetSelected(e.target.checked);
|
|
17
|
-
}, checked: selected }, (label ? { "aria-label": label } : "")))));
|
|
25
|
+
}, checked: selected, disabled: !enabled }, (label ? { "aria-label": label } : "")))));
|
|
18
26
|
};
|
|
19
27
|
//# sourceMappingURL=FinsembleToggle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FinsembleToggle.js","sourceRoot":"","sources":["../../../src/components/common/FinsembleToggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"FinsembleToggle.js","sourceRoot":"","sources":["../../../src/components/common/FinsembleToggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAUhD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,EAAE,UAAU,EAAwB,EAAE,EAAE;IACjH,MAAM,C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I,CACP,CAAC;AACH,CAAC,CAAC","sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport \"./css/toggle.css\";\nimport { FinsembleIcon } from \"./FinsembleIcon\";\n\nexport interface FinsembleToggleProps {\n\tlabel?: string;\n\tchecked: boolean;\n\ttextToggle?: [onLabel: string, offLabel: string];\n\tonChange: (selected: boolean) => void;\n\tenabled?: boolean;\n}\n\nexport const FinsembleToggle = ({ checked, onChange, label, enabled = true, textToggle }: FinsembleToggleProps) => {\n\tconst [selected, setSelected] = useState(checked);\n\n\tfunction doSetSelected(newValue: boolean) {\n\t\tonChange(newValue);\n\t\tsetSelected(newValue);\n\t}\n\tconst [yesLabel, noLabel] = textToggle ?? [];\n\n\tuseEffect(() => {\n\t\tsetSelected(checked);\n\t}, [checked]);\n\n\treturn (\n\t\t<span\n\t\t\tclassName={[\n\t\t\t\t\"finsembleToggle\",\n\t\t\t\tselected ? \"finsembleToggle-on\" : \"finsembleToggle-off\",\n\t\t\t\t!enabled ? \"disabled\" : \"\",\n\t\t\t].join(\" \")}\n\t\t>\n\t\t\t{!textToggle && <FinsembleIcon className=\"finsembleToggle-icon\" icon={selected ? \"toggle-on\" : \"toggle-off\"} />}\n\t\t\t{textToggle && (\n\t\t\t\t<span className=\"toggle-text-label-wrapper\">\n\t\t\t\t\t<span className={\"toggle-text-label toggle-text-label_on\"}>{yesLabel}</span>\n\t\t\t\t\t<span className={\"toggle-text-label toggle-text-label_off\"}>{noLabel}</span>\n\t\t\t\t</span>\n\t\t\t)}\n\t\t\t<input\n\t\t\t\ttype=\"checkbox\"\n\t\t\t\tonChange={(e) => {\n\t\t\t\t\tdoSetSelected(e.target.checked);\n\t\t\t\t}}\n\t\t\t\tchecked={selected}\n\t\t\t\tdisabled={!enabled}\n\t\t\t\t{...(label ? { \"aria-label\": label } : \"\")}\n\t\t\t/>\n\t\t</span>\n\t);\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./css/time-select.css";
|
|
3
|
+
export interface TimeSelectProps {
|
|
4
|
+
label?: string;
|
|
5
|
+
initialTime?: TimeSelectTime;
|
|
6
|
+
onChange?: (time: TimeSelectTime) => void;
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
minuteInterval?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare type TimeSelectTime = {
|
|
12
|
+
hour: number;
|
|
13
|
+
minute: number;
|
|
14
|
+
meridiem?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const TimeSelect: React.FunctionComponent<TimeSelectProps>;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import "./css/time-select.css";
|
|
3
|
+
import DefaultDropdownButton from "../shared/DefaultDropdownButton";
|
|
4
|
+
const DEFAULT_VALUE = {
|
|
5
|
+
hour: 4,
|
|
6
|
+
minute: 0,
|
|
7
|
+
meridiem: "AM",
|
|
8
|
+
};
|
|
9
|
+
export const TimeSelect = ({ initialTime, enabled = true, label = "Time:", onChange, className = "", minuteInterval = 15, }) => {
|
|
10
|
+
const [changed, setChanged] = useState(false);
|
|
11
|
+
const [time, setTime] = useState(initialTime !== null && initialTime !== void 0 ? initialTime : DEFAULT_VALUE);
|
|
12
|
+
let wrapClasses = `time-select ${className}`;
|
|
13
|
+
if (!enabled) {
|
|
14
|
+
wrapClasses = `${wrapClasses} disabled-time-select`;
|
|
15
|
+
}
|
|
16
|
+
let HOURS = [];
|
|
17
|
+
for (let i = 1; i < 13; i++) {
|
|
18
|
+
HOURS.push(i);
|
|
19
|
+
}
|
|
20
|
+
let MINUTES = ["00"];
|
|
21
|
+
for (let i = 1; i < 60; i++) {
|
|
22
|
+
if (i % minuteInterval == 0) {
|
|
23
|
+
MINUTES.push(i);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const setHour = (e) => {
|
|
27
|
+
let hour = Number(e);
|
|
28
|
+
if (hour < 12 && time.meridiem === "PM") {
|
|
29
|
+
hour = hour + 12;
|
|
30
|
+
}
|
|
31
|
+
else if (hour > 12 && time.meridiem === "AM") {
|
|
32
|
+
hour = hour - 12;
|
|
33
|
+
}
|
|
34
|
+
else if (time.meridiem === "AM" && hour === 12) {
|
|
35
|
+
hour = 0;
|
|
36
|
+
}
|
|
37
|
+
setTime(Object.assign(Object.assign({}, time), { hour }));
|
|
38
|
+
};
|
|
39
|
+
const setMinute = (e) => {
|
|
40
|
+
const minute = Number(e);
|
|
41
|
+
time.minute = minute;
|
|
42
|
+
setTime(Object.assign(Object.assign({}, time), { minute }));
|
|
43
|
+
};
|
|
44
|
+
const setMeridiem = (e) => {
|
|
45
|
+
const meridiem = e;
|
|
46
|
+
setTime(Object.assign(Object.assign({}, time), { meridiem }));
|
|
47
|
+
};
|
|
48
|
+
const correctMeridiem = () => {
|
|
49
|
+
if (!time.meridiem) {
|
|
50
|
+
let localMeridiem = "AM";
|
|
51
|
+
if (time.hour > 12 || (time.hour == 0 && time.minute == 0)) {
|
|
52
|
+
localMeridiem = "PM";
|
|
53
|
+
}
|
|
54
|
+
setMeridiem(localMeridiem);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
setHour(time.hour);
|
|
59
|
+
}, [time.meridiem]);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
correctMeridiem();
|
|
62
|
+
if (enabled && onChange && changed) {
|
|
63
|
+
onChange(time);
|
|
64
|
+
}
|
|
65
|
+
}, [time.hour, time.minute]);
|
|
66
|
+
const hourOptions = HOURS.map((hour) => {
|
|
67
|
+
return {
|
|
68
|
+
optionLabel: hour,
|
|
69
|
+
optionValue: hour,
|
|
70
|
+
clickHandler: () => {
|
|
71
|
+
setChanged(true);
|
|
72
|
+
setHour(hour);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
const minuteOptions = MINUTES.map((minute) => {
|
|
77
|
+
return {
|
|
78
|
+
optionLabel: minute,
|
|
79
|
+
optionValue: minute,
|
|
80
|
+
clickHandler: () => {
|
|
81
|
+
setChanged(true);
|
|
82
|
+
setMinute(minute);
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
const getDisplayHour = () => {
|
|
87
|
+
if (time.meridiem === "AM" && time.hour === 0) {
|
|
88
|
+
return 12;
|
|
89
|
+
}
|
|
90
|
+
else if (time.meridiem === "PM" && time.hour > 12) {
|
|
91
|
+
return time.hour - 12;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return time.hour;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
return (React.createElement("div", { className: wrapClasses, style: { display: "flex" } },
|
|
98
|
+
React.createElement("span", { className: "time-select-label" }, label),
|
|
99
|
+
React.createElement("div", { className: "row-section", style: { width: "10px", marginRight: "40px" } },
|
|
100
|
+
React.createElement(DefaultDropdownButton, { classNames: "push-right", allowEmpty: false, caretLocation: "right", buttonOptions: hourOptions, defaultSelection: {
|
|
101
|
+
optionLabel: getDisplayHour().toString(),
|
|
102
|
+
optionValue: getDisplayHour(),
|
|
103
|
+
clickHandler: () => {
|
|
104
|
+
setHour(getDisplayHour());
|
|
105
|
+
},
|
|
106
|
+
}, enabled: enabled })),
|
|
107
|
+
React.createElement("div", { className: "row-section", style: { marginLeft: 30, marginRight: 10, marginTop: 5 } }, "\u00A0:\u00A0"),
|
|
108
|
+
React.createElement("div", { style: { width: "10px", marginRight: "65px" } },
|
|
109
|
+
React.createElement(DefaultDropdownButton, { classNames: "push-right", allowEmpty: false, caretLocation: "right", buttonOptions: minuteOptions, defaultSelection: {
|
|
110
|
+
optionLabel: (time.minute === 0 ? "00" : time.minute),
|
|
111
|
+
optionValue: time.minute,
|
|
112
|
+
clickHandler: () => {
|
|
113
|
+
setMinute(time.minute);
|
|
114
|
+
},
|
|
115
|
+
}, enabled: enabled })),
|
|
116
|
+
"\u00A0",
|
|
117
|
+
React.createElement("div", { className: "row-section", style: { width: "10px" } },
|
|
118
|
+
React.createElement(DefaultDropdownButton, { classNames: "push-right", allowEmpty: false, caretLocation: "right", buttonOptions: [
|
|
119
|
+
{
|
|
120
|
+
optionLabel: "AM",
|
|
121
|
+
optionValue: "AM",
|
|
122
|
+
clickHandler: () => {
|
|
123
|
+
setChanged(true);
|
|
124
|
+
setMeridiem("AM");
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
optionLabel: "PM",
|
|
129
|
+
optionValue: "PM",
|
|
130
|
+
clickHandler: () => {
|
|
131
|
+
setChanged(true);
|
|
132
|
+
setMeridiem("PM");
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
], defaultSelection: {
|
|
136
|
+
optionLabel: time.meridiem,
|
|
137
|
+
optionValue: time.meridiem,
|
|
138
|
+
clickHandler: () => {
|
|
139
|
+
setHour(time.meridiem);
|
|
140
|
+
},
|
|
141
|
+
}, enabled: enabled }))));
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=TimeSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeSelect.js","sourceRoot":"","sources":["../../../src/components/common/TimeSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,MAAM,iCAAiC,CAAC;AAiBpE,MAAM,aAAa,GAAmB;IACrC,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,IAAI;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAA6C,CAAC,EACpE,WAAW,EACX,OAAO,GAAG,IAAI,EACd,KAAK,GAAG,OAAO,EACf,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,cAAc,GAAG,EAAE,GACnB,EAAE,EAAE;IAIJ,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,KAA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,IAAI,CAAC,CAAC;4BACjB,WAAW,CAAC,IAAI,CAAC,CAAC;wBACnB,CAAC;qBACD;iBACD,EACD,gBAAgB,EAAE;oBACjB,WAAW,EAAE,IAAI,CAAC,QAAkB;oBACpC,WAAW,EAAE,IAAI,CAAC,QAAQ;oBAC1B,YAAY,EAAE,GAAG,EAAE;wBAClB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBACxB,CAAC;iBACD,EACD,OAAO,EAAE,OAAO,GACf,CACG,CACD,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport \"./css/time-select.css\";\nimport DefaultDropdownButton from \"../shared/DefaultDropdownButton\";\n\nexport interface TimeSelectProps {\n\tlabel?: string;\n\tinitialTime?: TimeSelectTime;\n\tonChange?: (time: TimeSelectTime) => void;\n\tenabled?: boolean;\n\tclassName?: string;\n\tminuteInterval?: number;\n}\n\nexport type TimeSelectTime = {\n\thour: number;\n\tminute: number;\n\tmeridiem?: string;\n};\n\nconst DEFAULT_VALUE: TimeSelectTime = {\n\thour: 4,\n\tminute: 0,\n\tmeridiem: \"AM\",\n};\n\nexport const TimeSelect: React.FunctionComponent<TimeSelectProps> = ({\n\tinitialTime,\n\tenabled = true,\n\tlabel = \"Time:\",\n\tonChange,\n\tclassName = \"\",\n\tminuteInterval = 15,\n}) => {\n\t/**\n\t * Prevents change event from triggering on initial setup\n\t */\n\tconst [changed, setChanged] = useState<boolean>(false);\n\tconst [time, setTime] = useState<TimeSelectTime>(initialTime ?? DEFAULT_VALUE);\n\n\tlet wrapClasses = `time-select ${className}`;\n\tif (!enabled) {\n\t\twrapClasses = `${wrapClasses} disabled-time-select`;\n\t}\n\n\t// Create an array 1-12.\n\tlet HOURS: Array<number> = [];\n\tfor (let i = 1; i < 13; i++) {\n\t\tHOURS.push(i);\n\t}\n\n\tlet MINUTES: any = [\"00\"];\n\tfor (let i = 1; i < 60; i++) {\n\t\tif (i % minuteInterval == 0) {\n\t\t\tMINUTES.push(i);\n\t\t}\n\t}\n\n\t/**\n\t * This method will transform 8 PM into 20:00. It also handles when the user changes the meridiem.\n\t * e.g., 8PM (20) => 8AM (8).\n\t * Set the minute, then set the 'finsemble.scheduledRestart' preference via the method on the Actions object.\n\t * @param {event} e\n\t */\n\tconst setHour = (e: any) => {\n\t\tlet hour = Number(e);\n\t\tif (hour < 12 && time.meridiem === \"PM\") {\n\t\t\thour = hour + 12;\n\t\t} else if (hour > 12 && time.meridiem === \"AM\") {\n\t\t\thour = hour - 12;\n\t\t} else if (time.meridiem === \"AM\" && hour === 12) {\n\t\t\thour = 0;\n\t\t}\n\n\t\tsetTime({ ...time, hour });\n\t};\n\n\t/**\n\t * Set the minute, then set the 'finsemble.scheduledRestart' preference via the method on the Actions object.\n\t * @param {event} e\n\t */\n\tconst setMinute = (e: any) => {\n\t\tconst minute = Number(e);\n\t\ttime.minute = minute;\n\t\tsetTime({ ...time, minute });\n\t};\n\n\t/**\n\t * Sets the meridiem for the time (AM or PM). This will trigger setHour to be called in a hook\n\t * @param {event} e\n\t */\n\tconst setMeridiem = (e: any) => {\n\t\tconst meridiem = e;\n\t\tsetTime({ ...time, meridiem });\n\t};\n\n\tconst correctMeridiem = () => {\n\t\tif (!time.meridiem) {\n\t\t\tlet localMeridiem = \"AM\";\n\t\t\tif (time.hour > 12 || (time.hour == 0 && time.minute == 0)) {\n\t\t\t\tlocalMeridiem = \"PM\";\n\t\t\t}\n\t\t\tsetMeridiem(localMeridiem);\n\t\t}\n\t};\n\n\t/**\n\t * The meridiem has changed, update the hour\n\t */\n\tuseEffect(() => {\n\t\tsetHour(time.hour);\n\t}, [time.meridiem]);\n\n\t/**\n\t * Call on change when the hour and minute values have changed\n\t */\n\tuseEffect(() => {\n\t\tcorrectMeridiem();\n\t\tif (enabled && onChange && changed) {\n\t\t\tonChange(time);\n\t\t}\n\t}, [time.hour, time.minute]);\n\n\tconst hourOptions: Array<any> = HOURS.map((hour: number) => {\n\t\treturn {\n\t\t\toptionLabel: hour,\n\t\t\toptionValue: hour,\n\t\t\tclickHandler: () => {\n\t\t\t\tsetChanged(true);\n\t\t\t\tsetHour(hour);\n\t\t\t},\n\t\t};\n\t});\n\tconst minuteOptions: Array<any> = MINUTES.map((minute: any) => {\n\t\treturn {\n\t\t\toptionLabel: minute,\n\t\t\toptionValue: minute,\n\t\t\tclickHandler: () => {\n\t\t\t\tsetChanged(true);\n\t\t\t\tsetMinute(minute);\n\t\t\t},\n\t\t};\n\t});\n\n\tconst getDisplayHour = () => {\n\t\tif (time.meridiem === \"AM\" && time.hour === 0) {\n\t\t\treturn 12;\n\t\t} else if (time.meridiem === \"PM\" && time.hour > 12) {\n\t\t\treturn time.hour - 12;\n\t\t} else {\n\t\t\treturn time.hour;\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className={wrapClasses} style={{ display: \"flex\" }}>\n\t\t\t<span className=\"time-select-label\">{label}</span>\n\t\t\t{/* HOURS */}\n\t\t\t<div className=\"row-section\" style={{ width: \"10px\", marginRight: \"40px\" }}>\n\t\t\t\t<DefaultDropdownButton\n\t\t\t\t\tclassNames={\"push-right\"}\n\t\t\t\t\tallowEmpty={false}\n\t\t\t\t\tcaretLocation={\"right\"}\n\t\t\t\t\tbuttonOptions={hourOptions}\n\t\t\t\t\tdefaultSelection={{\n\t\t\t\t\t\toptionLabel: getDisplayHour().toString(),\n\t\t\t\t\t\toptionValue: getDisplayHour(),\n\t\t\t\t\t\tclickHandler: () => {\n\t\t\t\t\t\t\tsetHour(getDisplayHour());\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t\tenabled={enabled}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className=\"row-section\" style={{ marginLeft: 30, marginRight: 10, marginTop: 5 }}>\n\t\t\t\t : \n\t\t\t</div>\n\t\t\t{/* MINUTES */}\n\t\t\t<div style={{ width: \"10px\", marginRight: \"65px\" }}>\n\t\t\t\t<DefaultDropdownButton\n\t\t\t\t\tclassNames={\"push-right\"}\n\t\t\t\t\tallowEmpty={false}\n\t\t\t\t\tcaretLocation={\"right\"}\n\t\t\t\t\tbuttonOptions={minuteOptions}\n\t\t\t\t\tdefaultSelection={{\n\t\t\t\t\t\toptionLabel: (time.minute === 0 ? \"00\" : time.minute) as string,\n\t\t\t\t\t\toptionValue: time.minute,\n\t\t\t\t\t\tclickHandler: () => {\n\t\t\t\t\t\t\tsetMinute(time.minute);\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t\tenabled={enabled}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t \n\t\t\t{/* MERIDIEM */}\n\t\t\t<div className=\"row-section\" style={{ width: \"10px\" }}>\n\t\t\t\t<DefaultDropdownButton\n\t\t\t\t\tclassNames={\"push-right\"}\n\t\t\t\t\tallowEmpty={false}\n\t\t\t\t\tcaretLocation={\"right\"}\n\t\t\t\t\tbuttonOptions={[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\toptionLabel: \"AM\",\n\t\t\t\t\t\t\toptionValue: \"AM\",\n\t\t\t\t\t\t\tclickHandler: () => {\n\t\t\t\t\t\t\t\tsetChanged(true);\n\t\t\t\t\t\t\t\tsetMeridiem(\"AM\");\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\toptionLabel: \"PM\",\n\t\t\t\t\t\t\toptionValue: \"PM\",\n\t\t\t\t\t\t\tclickHandler: () => {\n\t\t\t\t\t\t\t\tsetChanged(true);\n\t\t\t\t\t\t\t\tsetMeridiem(\"PM\");\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t]}\n\t\t\t\t\tdefaultSelection={{\n\t\t\t\t\t\toptionLabel: time.meridiem as string,\n\t\t\t\t\t\toptionValue: time.meridiem,\n\t\t\t\t\t\tclickHandler: () => {\n\t\t\t\t\t\t\tsetHour(time.meridiem);\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t\tenabled={enabled}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n"]}
|
|
@@ -26,14 +26,12 @@
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.accordion > .accordion-summary {
|
|
29
|
-
margin: 0.5em
|
|
30
|
-
margin-top: 0px;
|
|
29
|
+
margin: 0 24px 0.5em;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
.accordion > .accordion-content {
|
|
34
|
-
margin: 0.5em 22px;
|
|
35
|
-
padding-bottom:
|
|
36
|
-
margin-bottom: 0px;
|
|
33
|
+
margin: 0.5em 22px 0;
|
|
34
|
+
padding-bottom: 0;
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
.accordion > button .accordion-caret {
|
|
@@ -5,14 +5,46 @@
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
.finsembleToggle input[type="checkbox"] {
|
|
8
|
-
margin:
|
|
8
|
+
margin: 0;
|
|
9
9
|
width: 100%;
|
|
10
10
|
height: 100%;
|
|
11
11
|
z-index: 1;
|
|
12
12
|
position: absolute;
|
|
13
|
-
top:
|
|
14
|
-
left:
|
|
13
|
+
top: 0;
|
|
14
|
+
left: 0;
|
|
15
15
|
opacity: 0;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.finsembleToggle.disabled input[type="checkbox"] {
|
|
20
|
+
cursor: default;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.toggle-text-label-wrapper {
|
|
24
|
+
display: flex;
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.toggle-text-label {
|
|
29
|
+
background: #22262f;
|
|
30
|
+
padding: 2px 10px;
|
|
31
|
+
border-radius: 2px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.finsembleToggle-on .toggle-text-label_on {
|
|
35
|
+
background-color: #0a8cf4;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.finsembleToggle-off .toggle-text-label_off {
|
|
39
|
+
background-color: #0a8cf4;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.finsembleToggle-on:hover .toggle-text-label_off {
|
|
43
|
+
background-color: #3d4455;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.finsembleToggle-off:hover .toggle-text-label_on {
|
|
47
|
+
background-color: #3d4455;
|
|
16
48
|
}
|
|
17
49
|
|
|
18
50
|
.finsembleToggle-off .finsembleToggle-icon {
|
|
@@ -27,6 +59,10 @@
|
|
|
27
59
|
color: #087ddb;
|
|
28
60
|
}
|
|
29
61
|
|
|
62
|
+
.finsembleToggle.disabled {
|
|
63
|
+
filter: grayscale(10%) brightness(65%);
|
|
64
|
+
}
|
|
65
|
+
|
|
30
66
|
.finsembleToggle .finsembleToggle-icon {
|
|
31
67
|
font-size: 1.7rem;
|
|
32
68
|
}
|
|
@@ -5,8 +5,10 @@ import "../css/styles.css";
|
|
|
5
5
|
import { Story } from "@storybook/react/types-6-0";
|
|
6
6
|
declare const _default: {
|
|
7
7
|
title: string;
|
|
8
|
-
component: ({ checked, onChange, label }: FinsembleToggleProps) => JSX.Element;
|
|
8
|
+
component: ({ checked, onChange, label, enabled, textToggle }: FinsembleToggleProps) => JSX.Element;
|
|
9
9
|
};
|
|
10
10
|
export default _default;
|
|
11
11
|
export declare const Unchecked: Story<FinsembleToggleProps>;
|
|
12
12
|
export declare const Checked: Story<FinsembleToggleProps>;
|
|
13
|
+
export declare const Disabled: Story<FinsembleToggleProps>;
|
|
14
|
+
export declare const TextLabels: Story<FinsembleToggleProps>;
|
|
@@ -20,4 +20,16 @@ Checked.args = {
|
|
|
20
20
|
onChange: action("Selected values"),
|
|
21
21
|
label: "Pre-checked test",
|
|
22
22
|
};
|
|
23
|
+
export const Disabled = Template.bind({});
|
|
24
|
+
Disabled.args = {
|
|
25
|
+
enabled: false,
|
|
26
|
+
label: "Pre-checked test",
|
|
27
|
+
};
|
|
28
|
+
export const TextLabels = Template.bind({});
|
|
29
|
+
TextLabels.args = {
|
|
30
|
+
checked: true,
|
|
31
|
+
onChange: action("Selected values"),
|
|
32
|
+
label: "Pre-checked test",
|
|
33
|
+
textToggle: ["Daily", "Weekly"],
|
|
34
|
+
};
|
|
23
35
|
//# sourceMappingURL=FinsembleToggle.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FinsembleToggle.stories.js","sourceRoot":"","sources":["../../../../src/components/common/stories/FinsembleToggle.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAwB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,mCAAmC,CAAC;AAC3C,OAAO,mBAAmB,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,eAAe;IACd,KAAK,EAAE,wBAAwB;IAC/B,SAAS,EAAE,eAAe;CAC1B,CAAC;AAEF,MAAM,QAAQ,GAAgC,CAAC,IAA0B,EAAE,EAAE,CAAC,oBAAC,eAAe,oBAAK,IAAI,EAAI,CAAC;AAE5G,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3C,SAAS,CAAC,IAAI,GAAG;IAChB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAAC;IACnC,KAAK,EAAE,MAAM;CACb,CAAC;AACF,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzC,OAAO,CAAC,IAAI,GAAG;IACd,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAAC;IACnC,KAAK,EAAE,kBAAkB;CACzB,CAAC","sourcesContent":["import React from \"react\";\nimport { FinsembleToggle, FinsembleToggleProps } from \"../FinsembleToggle\";\nimport \"../../../assets/css/finsemble.css\";\nimport \"../css/styles.css\";\nimport { Story } from \"@storybook/react/types-6-0\";\nimport { action } from \"@storybook/addon-actions\";\n\nexport default {\n\ttitle: \"Common/FinsembleToggle\",\n\tcomponent: FinsembleToggle,\n};\n\nconst Template: Story<FinsembleToggleProps> = (args: FinsembleToggleProps) => <FinsembleToggle {...args} />;\n\nexport const Unchecked = Template.bind({});\nUnchecked.args = {\n\tchecked: false,\n\tonChange: action(\"Selected values\"),\n\tlabel: \"Test\",\n};\nexport const Checked = Template.bind({});\nChecked.args = {\n\tchecked: true,\n\tonChange: action(\"Selected values\"),\n\tlabel: \"Pre-checked test\",\n};\n"]}
|
|
1
|
+
{"version":3,"file":"FinsembleToggle.stories.js","sourceRoot":"","sources":["../../../../src/components/common/stories/FinsembleToggle.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAwB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,mCAAmC,CAAC;AAC3C,OAAO,mBAAmB,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,eAAe;IACd,KAAK,EAAE,wBAAwB;IAC/B,SAAS,EAAE,eAAe;CAC1B,CAAC;AAEF,MAAM,QAAQ,GAAgC,CAAC,IAA0B,EAAE,EAAE,CAAC,oBAAC,eAAe,oBAAK,IAAI,EAAI,CAAC;AAE5G,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3C,SAAS,CAAC,IAAI,GAAG;IAChB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAAC;IACnC,KAAK,EAAE,MAAM;CACb,CAAC;AACF,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzC,OAAO,CAAC,IAAI,GAAG;IACd,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAAC;IACnC,KAAK,EAAE,kBAAkB;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,GAAG;IACf,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,kBAAkB;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5C,UAAU,CAAC,IAAI,GAAG;IACjB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAAC;IACnC,KAAK,EAAE,kBAAkB;IACzB,UAAU,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;CAC/B,CAAC","sourcesContent":["import React from \"react\";\nimport { FinsembleToggle, FinsembleToggleProps } from \"../FinsembleToggle\";\nimport \"../../../assets/css/finsemble.css\";\nimport \"../css/styles.css\";\nimport { Story } from \"@storybook/react/types-6-0\";\nimport { action } from \"@storybook/addon-actions\";\n\nexport default {\n\ttitle: \"Common/FinsembleToggle\",\n\tcomponent: FinsembleToggle,\n};\n\nconst Template: Story<FinsembleToggleProps> = (args: FinsembleToggleProps) => <FinsembleToggle {...args} />;\n\nexport const Unchecked = Template.bind({});\nUnchecked.args = {\n\tchecked: false,\n\tonChange: action(\"Selected values\"),\n\tlabel: \"Test\",\n};\nexport const Checked = Template.bind({});\nChecked.args = {\n\tchecked: true,\n\tonChange: action(\"Selected values\"),\n\tlabel: \"Pre-checked test\",\n};\n\nexport const Disabled = Template.bind({});\nDisabled.args = {\n\tenabled: false,\n\tlabel: \"Pre-checked test\",\n};\n\nexport const TextLabels = Template.bind({});\nTextLabels.args = {\n\tchecked: true,\n\tonChange: action(\"Selected values\"),\n\tlabel: \"Pre-checked test\",\n\ttextToggle: [\"Daily\", \"Weekly\"],\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TimeSelectProps } from "../TimeSelect";
|
|
3
|
+
import { Story } from "@storybook/react/types-6-0";
|
|
4
|
+
import "../../../assets/css/finsemble.css";
|
|
5
|
+
declare const _default: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: React.FunctionComponent<TimeSelectProps>;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
export declare const Default: Story<TimeSelectProps>;
|
|
11
|
+
export declare const Disabled: Story<TimeSelectProps>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TimeSelect } from "../TimeSelect";
|
|
3
|
+
import "../../../assets/css/finsemble.css";
|
|
4
|
+
export default {
|
|
5
|
+
title: "Common/TimeSelect",
|
|
6
|
+
component: TimeSelect,
|
|
7
|
+
};
|
|
8
|
+
const Template = (args) => React.createElement(TimeSelect, Object.assign({}, args));
|
|
9
|
+
export const Default = Template.bind({});
|
|
10
|
+
Default.args = {
|
|
11
|
+
initialTime: {
|
|
12
|
+
hour: 22,
|
|
13
|
+
minute: 15,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export const Disabled = Template.bind({});
|
|
17
|
+
Disabled.args = {
|
|
18
|
+
enabled: false,
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=TimeSelect.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeSelect.stories.js","sourceRoot":"","sources":["../../../../src/components/common/stories/TimeSelect.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAmB,MAAM,eAAe,CAAC;AAE5D,OAAO,mCAAmC,CAAC;AAE3C,eAAe;IACd,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,UAAU;CACrB,CAAC;AAEF,MAAM,QAAQ,GAA2B,CAAC,IAAqB,EAAE,EAAE,CAAC,oBAAC,UAAU,oBAAK,IAAI,EAAI,CAAC;AAE7F,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzC,OAAO,CAAC,IAAI,GAAG;IACd,WAAW,EAAE;QACZ,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,EAAE;KACV;CACD,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,GAAG;IACf,OAAO,EAAE,KAAK;CACd,CAAC","sourcesContent":["import React from \"react\";\nimport { TimeSelect, TimeSelectProps } from \"../TimeSelect\";\nimport { Story } from \"@storybook/react/types-6-0\";\nimport \"../../../assets/css/finsemble.css\";\n\nexport default {\n\ttitle: \"Common/TimeSelect\",\n\tcomponent: TimeSelect,\n};\n\nconst Template: Story<TimeSelectProps> = (args: TimeSelectProps) => <TimeSelect {...args} />;\n\nexport const Default = Template.bind({});\nDefault.args = {\n\tinitialTime: {\n\t\thour: 22,\n\t\tminute: 15,\n\t},\n};\n\nexport const Disabled = Template.bind({});\nDisabled.args = {\n\tenabled: false,\n};\n"]}
|
|
@@ -3,7 +3,7 @@ import { mount } from "enzyme";
|
|
|
3
3
|
import { describe, it } from "mocha";
|
|
4
4
|
import { expect } from "chai";
|
|
5
5
|
import sinon from "sinon";
|
|
6
|
-
import { Checked, Unchecked } from "../stories/FinsembleToggle.stories";
|
|
6
|
+
import { Checked, Unchecked, TextLabels } from "../stories/FinsembleToggle.stories";
|
|
7
7
|
import { accessibilityAssessor } from "../../sdd/tests/a11y_helper";
|
|
8
8
|
import addons, { mockChannel } from "@storybook/addons";
|
|
9
9
|
import { waitTime } from "../../sdd/sdd_helpers";
|
|
@@ -24,5 +24,10 @@ describe("<FinsembleToggle/>", () => {
|
|
|
24
24
|
wrapper.update();
|
|
25
25
|
expect(wrapper.find("input[type='checkbox']").at(0).prop("checked")).to.be.true;
|
|
26
26
|
});
|
|
27
|
+
it("should display checked labels", async () => {
|
|
28
|
+
const wrapper = mount(React.createElement(TextLabels, Object.assign({}, TextLabels.args)));
|
|
29
|
+
expect(wrapper.find(".toggle-text-label").at(0).text()).to.equal("Daily");
|
|
30
|
+
expect(wrapper.find(".toggle-text-label").at(1).text()).to.equal("Weekly");
|
|
31
|
+
});
|
|
27
32
|
});
|
|
28
33
|
//# sourceMappingURL=FinsembleToggle.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FinsembleToggle.spec.js","sourceRoot":"","sources":["../../../../src/components/common/tests/FinsembleToggle.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"FinsembleToggle.spec.js","sourceRoot":"","sources":["../../../../src/components/common/tests/FinsembleToggle.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAGpE,OAAO,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,QAAQ,EA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AAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1E,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import * as React from \"react\";\nimport { mount } from \"enzyme\";\nimport { describe, it } from \"mocha\";\nimport { expect } from \"chai\";\nimport sinon from \"sinon\";\nimport { FinsembleToggleProps } from \"../FinsembleToggle\";\nimport { Checked, Unchecked, TextLabels } from \"../stories/FinsembleToggle.stories\";\nimport { accessibilityAssessor } from \"../../sdd/tests/a11y_helper\";\n\n// Necessary to allow sinon to work with mocked actions (which are shown in the Actions panel in Storybook)\nimport addons, { mockChannel } from \"@storybook/addons\";\nimport { waitTime } from \"../../sdd/sdd_helpers\";\naddons.setChannel(mockChannel());\n\ndescribe(\"<FinsembleToggle/>\", () => {\n\tafterEach(() => {\n\t\tsinon.restore();\n\t});\n\n\tit(\"should pass accessibility scans\", async () => {\n\t\tconst wrapper = mount(<Unchecked {...(Unchecked.args as FinsembleToggleProps)} />);\n\n\t\texpect(await accessibilityAssessor(wrapper)).to.be.true;\n\t});\n\n\tit(\"should be checked items if checked prop is updated after initial render\", async () => {\n\t\tconst wrapper = mount(<Unchecked {...(Unchecked.args as FinsembleToggleProps)} />);\n\n\t\tawait waitTime(10);\n\n\t\twrapper.setProps({ checked: Checked.args?.checked });\n\n\t\twrapper.update();\n\n\t\texpect(wrapper.find(\"input[type='checkbox']\").at(0).prop(\"checked\")).to.be.true;\n\t});\n\n\tit(\"should display checked labels\", async () => {\n\t\tconst wrapper = mount(<TextLabels {...(TextLabels.args as FinsembleToggleProps)} />);\n\t\texpect(wrapper.find(\".toggle-text-label\").at(0).text()).to.equal(\"Daily\");\n\t\texpect(wrapper.find(\".toggle-text-label\").at(1).text()).to.equal(\"Weekly\");\n\t});\n});\n"]}
|
|
File without changes
|