@activecollab/components 1.0.381 → 1.0.383
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/EditableHours/EditableHours.js.map +1 -1
- package/dist/cjs/components/HoursWrapper/HoursWrapper.js +5 -2
- package/dist/cjs/components/HoursWrapper/HoursWrapper.js.map +1 -1
- package/dist/cjs/components/Input/InputHours.js +3 -1
- package/dist/cjs/components/Input/InputHours.js.map +1 -1
- package/dist/cjs/components/Stopwatch/Stopwatch.js +61 -0
- package/dist/cjs/components/Stopwatch/Stopwatch.js.map +1 -0
- package/dist/cjs/components/Stopwatch/Stopwatch.style.js +25 -0
- package/dist/cjs/components/Stopwatch/Stopwatch.style.js.map +1 -0
- package/dist/cjs/components/Stopwatch/index.js +17 -0
- package/dist/cjs/components/Stopwatch/index.js.map +1 -0
- package/dist/cjs/utils/index.js +9 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/esm/components/EditableHours/EditableHours.d.ts +1 -0
- package/dist/esm/components/EditableHours/EditableHours.d.ts.map +1 -1
- package/dist/esm/components/EditableHours/EditableHours.js.map +1 -1
- package/dist/esm/components/HoursWrapper/HoursWrapper.d.ts.map +1 -1
- package/dist/esm/components/HoursWrapper/HoursWrapper.js +5 -2
- package/dist/esm/components/HoursWrapper/HoursWrapper.js.map +1 -1
- package/dist/esm/components/Input/InputHours.d.ts.map +1 -1
- package/dist/esm/components/Input/InputHours.js +3 -1
- package/dist/esm/components/Input/InputHours.js.map +1 -1
- package/dist/esm/components/Stopwatch/Stopwatch.d.ts +6 -0
- package/dist/esm/components/Stopwatch/Stopwatch.d.ts.map +1 -0
- package/dist/esm/components/Stopwatch/Stopwatch.js +43 -0
- package/dist/esm/components/Stopwatch/Stopwatch.js.map +1 -0
- package/dist/esm/components/Stopwatch/Stopwatch.style.d.ts +5 -0
- package/dist/esm/components/Stopwatch/Stopwatch.style.d.ts.map +1 -0
- package/dist/esm/components/Stopwatch/Stopwatch.style.js +15 -0
- package/dist/esm/components/Stopwatch/Stopwatch.style.js.map +1 -0
- package/dist/esm/components/Stopwatch/index.d.ts +2 -0
- package/dist/esm/components/Stopwatch/index.d.ts.map +1 -0
- package/dist/esm/components/Stopwatch/index.js +2 -0
- package/dist/esm/components/Stopwatch/index.js.map +1 -0
- package/dist/esm/utils/index.d.ts +1 -0
- package/dist/esm/utils/index.d.ts.map +1 -1
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/index.js +102 -96
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { StyledStopwatch, StyledStopwatchCenterWrapper, StyledTrigger } from "./Stopwatch.style";
|
|
3
|
+
import { IconButton } from "../IconButton";
|
|
4
|
+
import { CloseIcon, NoteIcon, PauseSmallIcon, PlaySmallIcon, UploadIcon } from "../Icons";
|
|
5
|
+
import { EditableHours } from "../EditableHours";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
export var Stopwatch = function Stopwatch() {
|
|
8
|
+
var _useState = useState(false),
|
|
9
|
+
isActive = _useState[0],
|
|
10
|
+
setIsActive = _useState[1];
|
|
11
|
+
return /*#__PURE__*/React.createElement(StyledStopwatch, {
|
|
12
|
+
className: classNames("", {
|
|
13
|
+
"tw-bg-red-100": isActive,
|
|
14
|
+
"tw-bg-gray-100": !isActive
|
|
15
|
+
})
|
|
16
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
17
|
+
onClick: function onClick() {
|
|
18
|
+
return setIsActive(!isActive);
|
|
19
|
+
},
|
|
20
|
+
className: classNames("tw-shadow-none hover:tw-shadow-none", {
|
|
21
|
+
"tw-bg-red-400 hover:bg-red-500": isActive,
|
|
22
|
+
"tw-bg-indigo-400 hover:bg-indigo-400": !isActive
|
|
23
|
+
})
|
|
24
|
+
}, !isActive ? /*#__PURE__*/React.createElement(PlaySmallIcon, null) : /*#__PURE__*/React.createElement(PauseSmallIcon, null)), /*#__PURE__*/React.createElement(StyledStopwatchCenterWrapper, null, /*#__PURE__*/React.createElement(EditableHours, {
|
|
25
|
+
value: "00:00"
|
|
26
|
+
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
27
|
+
size: "small",
|
|
28
|
+
variant: "tertiary"
|
|
29
|
+
}, /*#__PURE__*/React.createElement(NoteIcon, {
|
|
30
|
+
width: 20
|
|
31
|
+
})), true && /*#__PURE__*/React.createElement(IconButton, {
|
|
32
|
+
size: "small",
|
|
33
|
+
variant: "tertiary"
|
|
34
|
+
}, /*#__PURE__*/React.createElement(CloseIcon, {
|
|
35
|
+
width: 20
|
|
36
|
+
}))), /*#__PURE__*/React.createElement(StyledTrigger, {
|
|
37
|
+
onClick: function onClick() {
|
|
38
|
+
return setIsActive(!isActive);
|
|
39
|
+
}
|
|
40
|
+
}, /*#__PURE__*/React.createElement(UploadIcon, null)));
|
|
41
|
+
};
|
|
42
|
+
Stopwatch.displayName = "Stopwatch";
|
|
43
|
+
//# sourceMappingURL=Stopwatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stopwatch.js","names":["React","useState","StyledStopwatch","StyledStopwatchCenterWrapper","StyledTrigger","IconButton","CloseIcon","NoteIcon","PauseSmallIcon","PlaySmallIcon","UploadIcon","EditableHours","classNames","Stopwatch","isActive","setIsActive","displayName"],"sources":["../../../../src/components/Stopwatch/Stopwatch.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport {\n StyledStopwatch,\n StyledStopwatchCenterWrapper,\n StyledTrigger,\n} from \"./Stopwatch.style\";\nimport { IconButton } from \"../IconButton\";\nimport {\n CloseIcon,\n NoteIcon,\n PauseSmallIcon,\n PlaySmallIcon,\n UploadIcon,\n} from \"../Icons\";\nimport { EditableHours } from \"../EditableHours\";\nimport classNames from \"classnames\";\n\nexport const Stopwatch = () => {\n const [isActive, setIsActive] = useState<boolean>(false);\n\n return (\n <StyledStopwatch\n className={classNames(\"\", {\n \"tw-bg-red-100\": isActive,\n \"tw-bg-gray-100\": !isActive,\n })}\n >\n <IconButton\n onClick={() => setIsActive(!isActive)}\n className={classNames(\"tw-shadow-none hover:tw-shadow-none\", {\n \"tw-bg-red-400 hover:bg-red-500\": isActive,\n \"tw-bg-indigo-400 hover:bg-indigo-400\": !isActive,\n })}\n >\n {!isActive ? <PlaySmallIcon /> : <PauseSmallIcon />}\n </IconButton>\n <StyledStopwatchCenterWrapper>\n <EditableHours value=\"00:00\" />\n <IconButton size=\"small\" variant=\"tertiary\">\n <NoteIcon width={20} />\n </IconButton>\n {true && (\n <IconButton size=\"small\" variant=\"tertiary\">\n <CloseIcon width={20} />\n </IconButton>\n )}\n </StyledStopwatchCenterWrapper>\n <StyledTrigger onClick={() => setIsActive(!isActive)}>\n <UploadIcon />\n </StyledTrigger>\n </StyledStopwatch>\n );\n};\n\nStopwatch.displayName = \"Stopwatch\";\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SACEC,eAAe,EACfC,4BAA4B,EAC5BC,aAAa,QACR,mBAAmB;AAC1B,SAASC,UAAU,QAAQ,eAAe;AAC1C,SACEC,SAAS,EACTC,QAAQ,EACRC,cAAc,EACdC,aAAa,EACbC,UAAU,QACL,UAAU;AACjB,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAO,IAAMC,SAAS,GAAG,SAAZA,SAAS,GAAS;EAC7B,gBAAgCZ,QAAQ,CAAU,KAAK,CAAC;IAAjDa,QAAQ;IAAEC,WAAW;EAE5B,oBACE,oBAAC,eAAe;IACd,SAAS,EAAEH,UAAU,CAAC,EAAE,EAAE;MACxB,eAAe,EAAEE,QAAQ;MACzB,gBAAgB,EAAE,CAACA;IACrB,CAAC;EAAE,gBAEH,oBAAC,UAAU;IACT,OAAO,EAAE;MAAA,OAAMC,WAAW,CAAC,CAACD,QAAQ,CAAC;IAAA,CAAC;IACtC,SAAS,EAAEF,UAAU,CAAC,qCAAqC,EAAE;MAC3D,gCAAgC,EAAEE,QAAQ;MAC1C,sCAAsC,EAAE,CAACA;IAC3C,CAAC;EAAE,GAEF,CAACA,QAAQ,gBAAG,oBAAC,aAAa,OAAG,gBAAG,oBAAC,cAAc,OAAG,CACxC,eACb,oBAAC,4BAA4B,qBAC3B,oBAAC,aAAa;IAAC,KAAK,EAAC;EAAO,EAAG,eAC/B,oBAAC,UAAU;IAAC,IAAI,EAAC,OAAO;IAAC,OAAO,EAAC;EAAU,gBACzC,oBAAC,QAAQ;IAAC,KAAK,EAAE;EAAG,EAAG,CACZ,EACZ,IAAI,iBACH,oBAAC,UAAU;IAAC,IAAI,EAAC,OAAO;IAAC,OAAO,EAAC;EAAU,gBACzC,oBAAC,SAAS;IAAC,KAAK,EAAE;EAAG,EAAG,CAE3B,CAC4B,eAC/B,oBAAC,aAAa;IAAC,OAAO,EAAE;MAAA,OAAMC,WAAW,CAAC,CAACD,QAAQ,CAAC;IAAA;EAAC,gBACnD,oBAAC,UAAU,OAAG,CACA,CACA;AAEtB,CAAC;AAEDD,SAAS,CAACG,WAAW,GAAG,WAAW"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledStopwatch: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const StyledStopwatchCenterWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const StyledTrigger: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "form" | "slot" | "style" | "title" | "key" | "css" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "cs" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "tw"> & import("react").RefAttributes<HTMLButtonElement>>, any, {}, never>;
|
|
5
|
+
//# sourceMappingURL=Stopwatch.style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stopwatch.style.d.ts","sourceRoot":"","sources":["../../../../src/components/Stopwatch/Stopwatch.style.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,eAAe,oEAS3B,CAAC;AAEF,eAAO,MAAM,4BAA4B,oEAKxC,CAAC;AAEF,eAAO,MAAM,aAAa,46JAiBzB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { Trigger } from "../Trigger";
|
|
3
|
+
export var StyledStopwatch = styled.div.withConfig({
|
|
4
|
+
displayName: "Stopwatchstyle__StyledStopwatch",
|
|
5
|
+
componentId: "sc-h5uscw-0"
|
|
6
|
+
})(["background-color:var(--color-theme-300);border-radius:21px;padding:4px;max-width:320px;height:34px;display:flex;align-items:center;"]);
|
|
7
|
+
export var StyledStopwatchCenterWrapper = styled.div.withConfig({
|
|
8
|
+
displayName: "Stopwatchstyle__StyledStopwatchCenterWrapper",
|
|
9
|
+
componentId: "sc-h5uscw-1"
|
|
10
|
+
})(["flex-grow:1;display:flex;align-items:center;justify-content:center;"]);
|
|
11
|
+
export var StyledTrigger = styled(Trigger).withConfig({
|
|
12
|
+
displayName: "Stopwatchstyle__StyledTrigger",
|
|
13
|
+
componentId: "sc-h5uscw-2"
|
|
14
|
+
})(["width:32px;height:32px;border-radius:9999px;display:flex;justify-content:center;align-items:center;svg{fill:var(--color-theme-700);}&:hover{svg{fill:var(--color-theme-900);}}"]);
|
|
15
|
+
//# sourceMappingURL=Stopwatch.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stopwatch.style.js","names":["styled","Trigger","StyledStopwatch","div","StyledStopwatchCenterWrapper","StyledTrigger"],"sources":["../../../../src/components/Stopwatch/Stopwatch.style.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { Trigger } from \"../Trigger\";\n\nexport const StyledStopwatch = styled.div`\n background-color: var(--color-theme-300);\n border-radius: 21px;\n padding: 4px;\n max-width: 320px;\n height: 34px;\n\n display: flex;\n align-items: center;\n`;\n\nexport const StyledStopwatchCenterWrapper = styled.div`\n flex-grow: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nexport const StyledTrigger = styled(Trigger)`\n width: 32px;\n height: 32px;\n border-radius: 9999px;\n display: flex;\n justify-content: center;\n align-items: center;\n\n svg {\n fill: var(--color-theme-700);\n }\n\n &:hover {\n svg {\n fill: var(--color-theme-900);\n }\n }\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AACtC,SAASC,OAAO,QAAQ,YAAY;AAEpC,OAAO,IAAMC,eAAe,GAAGF,MAAM,CAACG,GAAG;EAAA;EAAA;AAAA,2IASxC;AAED,OAAO,IAAMC,4BAA4B,GAAGJ,MAAM,CAACG,GAAG;EAAA;EAAA;AAAA,2EAKrD;AAED,OAAO,IAAME,aAAa,GAAGL,MAAM,CAACC,OAAO,CAAC;EAAA;EAAA;AAAA,sLAiB3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Stopwatch/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/Stopwatch/index.ts"],"sourcesContent":["export * from \"./Stopwatch\";\n"],"mappings":"AAAA,cAAc,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","useForkRef","useResizeObserver"],"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from \"./layers\";\nexport * from \"./validation\";\nexport { default as useForkRef } from \"./useForkRef\";\nexport { default as useResizeObserver } from \"./useResizeObserver\";\n"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,SAASA,OAAO,IAAIC,UAAU,QAAQ,cAAc;AACpD,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,qBAAqB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","useForkRef","useResizeObserver","decimalToHours"],"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from \"./layers\";\nexport * from \"./validation\";\nexport { default as useForkRef } from \"./useForkRef\";\nexport { default as useResizeObserver } from \"./useResizeObserver\";\nexport { decimalToHours } from \"./timeUtils\";\n"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,SAASA,OAAO,IAAIC,UAAU,QAAQ,cAAc;AACpD,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,qBAAqB;AAClE,SAASC,cAAc,QAAQ,aAAa"}
|
package/dist/index.js
CHANGED
|
@@ -478,6 +478,99 @@
|
|
|
478
478
|
};
|
|
479
479
|
var useResizeObserver$1 = useResizeObserver;
|
|
480
480
|
|
|
481
|
+
// export const decimalToHours = (decimal: string) => {
|
|
482
|
+
// // we round it on two decimals first, to eliminate quirks, eg, 5.99999999 will return 5:59 instead of 6:00
|
|
483
|
+
// decimal = parseFloat(decimal).toFixed(2);
|
|
484
|
+
// decimal = decimal + "";
|
|
485
|
+
// let hours;
|
|
486
|
+
// let minutes_decimal;
|
|
487
|
+
//
|
|
488
|
+
// if (decimal.indexOf(".") < 0) {
|
|
489
|
+
// hours = parseInt(decimal);
|
|
490
|
+
// minutes_decimal = 0;
|
|
491
|
+
// } else {
|
|
492
|
+
// hours = parseInt(decimal.substring(0, decimal.indexOf(".")));
|
|
493
|
+
// minutes_decimal = decimal.substring(decimal.indexOf(".") + 1);
|
|
494
|
+
// minutes_decimal = minutes_decimal.substring(0, 2);
|
|
495
|
+
// if (minutes_decimal.length === 1) {
|
|
496
|
+
// minutes_decimal += "0";
|
|
497
|
+
// } // if
|
|
498
|
+
// minutes_decimal = parseInt(minutes_decimal);
|
|
499
|
+
// } // if
|
|
500
|
+
//
|
|
501
|
+
// const minutes = Math.round((minutes_decimal / 100) * 60);
|
|
502
|
+
//
|
|
503
|
+
// if (hours < 10) {
|
|
504
|
+
// hours = `0${hours}`;
|
|
505
|
+
// }
|
|
506
|
+
// return {
|
|
507
|
+
// hours: hours,
|
|
508
|
+
// minutes: minutes,
|
|
509
|
+
// };
|
|
510
|
+
// };
|
|
511
|
+
|
|
512
|
+
var decimalToHours = function decimalToHours(num) {
|
|
513
|
+
var withLeadingZeroHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
514
|
+
if (!num) {
|
|
515
|
+
return "";
|
|
516
|
+
}
|
|
517
|
+
if (typeof num === "string" && !num) {
|
|
518
|
+
return withLeadingZeroHours ? "00:00" : "0:00";
|
|
519
|
+
}
|
|
520
|
+
if (typeof num === "string" && num.indexOf(":") >= 0) {
|
|
521
|
+
//eslint-disable-next-line
|
|
522
|
+
var _num$split = num.split(":"),
|
|
523
|
+
_num$split2 = _slicedToArray(_num$split, 2),
|
|
524
|
+
_hours = _num$split2[0],
|
|
525
|
+
_minutes = _num$split2[1];
|
|
526
|
+
if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {
|
|
527
|
+
_minutes = "".concat(Number(_minutes), "0");
|
|
528
|
+
}
|
|
529
|
+
if (_hours && _minutes) {
|
|
530
|
+
if (withLeadingZeroHours) {
|
|
531
|
+
return "".concat(withLeadingZero(_hours), ":").concat(_minutes);
|
|
532
|
+
}
|
|
533
|
+
return "".concat(_hours, ":").concat(_minutes);
|
|
534
|
+
} else if (!_hours && _minutes) {
|
|
535
|
+
return withLeadingZeroHours ? "00:".concat(_minutes) : "0:".concat(_minutes);
|
|
536
|
+
} else if (!_minutes && _hours) {
|
|
537
|
+
return withLeadingZeroHours ? "".concat(withLeadingZero(_hours), ":00") : "".concat(_hours, ":00");
|
|
538
|
+
} else {
|
|
539
|
+
return withLeadingZeroHours ? "00:00" : "0:00";
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (typeof num === "string" && num.indexOf(",") >= 0) {
|
|
543
|
+
num = num.replace(",", ".");
|
|
544
|
+
}
|
|
545
|
+
var input = typeof num === "string" ? parseFloat(num) : num;
|
|
546
|
+
if (!isDecimal(input)) {
|
|
547
|
+
if (withLeadingZeroHours) {
|
|
548
|
+
return "".concat(withLeadingZero(input), ":00");
|
|
549
|
+
}
|
|
550
|
+
return "".concat(input, ":00");
|
|
551
|
+
}
|
|
552
|
+
var decimal = input.toFixed(2);
|
|
553
|
+
var time = decimal.toString().split(".");
|
|
554
|
+
var hours = time[0];
|
|
555
|
+
if (withLeadingZeroHours) {
|
|
556
|
+
hours = withLeadingZero(hours);
|
|
557
|
+
}
|
|
558
|
+
var minutes = time[1];
|
|
559
|
+
var minutes_formatted = Math.round(parseInt(minutes, 10) / 100 * 60);
|
|
560
|
+
return "".concat(hours, ":").concat(withLeadingZero(minutes_formatted));
|
|
561
|
+
};
|
|
562
|
+
var withLeadingZero = function withLeadingZero(num) {
|
|
563
|
+
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
564
|
+
var s = "".concat(num);
|
|
565
|
+
while (s.length < size) {
|
|
566
|
+
s = "0" + s;
|
|
567
|
+
}
|
|
568
|
+
return s;
|
|
569
|
+
};
|
|
570
|
+
var isDecimal = function isDecimal(num) {
|
|
571
|
+
return !Number.isInteger(num);
|
|
572
|
+
};
|
|
573
|
+
|
|
481
574
|
var MenuContext = /*#__PURE__*/React.createContext({});
|
|
482
575
|
var MenuContextProvider = MenuContext.Provider;
|
|
483
576
|
MenuContext.Consumer;
|
|
@@ -12276,99 +12369,6 @@
|
|
|
12276
12369
|
});
|
|
12277
12370
|
InputAdornment.displayName = "InputAdornment";
|
|
12278
12371
|
|
|
12279
|
-
// export const decimalToHours = (decimal: string) => {
|
|
12280
|
-
// // we round it on two decimals first, to eliminate quirks, eg, 5.99999999 will return 5:59 instead of 6:00
|
|
12281
|
-
// decimal = parseFloat(decimal).toFixed(2);
|
|
12282
|
-
// decimal = decimal + "";
|
|
12283
|
-
// let hours;
|
|
12284
|
-
// let minutes_decimal;
|
|
12285
|
-
//
|
|
12286
|
-
// if (decimal.indexOf(".") < 0) {
|
|
12287
|
-
// hours = parseInt(decimal);
|
|
12288
|
-
// minutes_decimal = 0;
|
|
12289
|
-
// } else {
|
|
12290
|
-
// hours = parseInt(decimal.substring(0, decimal.indexOf(".")));
|
|
12291
|
-
// minutes_decimal = decimal.substring(decimal.indexOf(".") + 1);
|
|
12292
|
-
// minutes_decimal = minutes_decimal.substring(0, 2);
|
|
12293
|
-
// if (minutes_decimal.length === 1) {
|
|
12294
|
-
// minutes_decimal += "0";
|
|
12295
|
-
// } // if
|
|
12296
|
-
// minutes_decimal = parseInt(minutes_decimal);
|
|
12297
|
-
// } // if
|
|
12298
|
-
//
|
|
12299
|
-
// const minutes = Math.round((minutes_decimal / 100) * 60);
|
|
12300
|
-
//
|
|
12301
|
-
// if (hours < 10) {
|
|
12302
|
-
// hours = `0${hours}`;
|
|
12303
|
-
// }
|
|
12304
|
-
// return {
|
|
12305
|
-
// hours: hours,
|
|
12306
|
-
// minutes: minutes,
|
|
12307
|
-
// };
|
|
12308
|
-
// };
|
|
12309
|
-
|
|
12310
|
-
var decimalToHours = function decimalToHours(num) {
|
|
12311
|
-
var withLeadingZeroHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
12312
|
-
if (!num) {
|
|
12313
|
-
return "";
|
|
12314
|
-
}
|
|
12315
|
-
if (typeof num === "string" && !num) {
|
|
12316
|
-
return withLeadingZeroHours ? "00:00" : "0:00";
|
|
12317
|
-
}
|
|
12318
|
-
if (typeof num === "string" && num.indexOf(":") >= 0) {
|
|
12319
|
-
//eslint-disable-next-line
|
|
12320
|
-
var _num$split = num.split(":"),
|
|
12321
|
-
_num$split2 = _slicedToArray(_num$split, 2),
|
|
12322
|
-
_hours = _num$split2[0],
|
|
12323
|
-
_minutes = _num$split2[1];
|
|
12324
|
-
if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {
|
|
12325
|
-
_minutes = "".concat(Number(_minutes), "0");
|
|
12326
|
-
}
|
|
12327
|
-
if (_hours && _minutes) {
|
|
12328
|
-
if (withLeadingZeroHours) {
|
|
12329
|
-
return "".concat(withLeadingZero(_hours), ":").concat(_minutes);
|
|
12330
|
-
}
|
|
12331
|
-
return "".concat(_hours, ":").concat(_minutes);
|
|
12332
|
-
} else if (!_hours && _minutes) {
|
|
12333
|
-
return withLeadingZeroHours ? "00:".concat(_minutes) : "0:".concat(_minutes);
|
|
12334
|
-
} else if (!_minutes && _hours) {
|
|
12335
|
-
return withLeadingZeroHours ? "".concat(withLeadingZero(_hours), ":00") : "".concat(_hours, ":00");
|
|
12336
|
-
} else {
|
|
12337
|
-
return withLeadingZeroHours ? "00:00" : "0:00";
|
|
12338
|
-
}
|
|
12339
|
-
}
|
|
12340
|
-
if (typeof num === "string" && num.indexOf(",") >= 0) {
|
|
12341
|
-
num = num.replace(",", ".");
|
|
12342
|
-
}
|
|
12343
|
-
var input = typeof num === "string" ? parseFloat(num) : num;
|
|
12344
|
-
if (!isDecimal(input)) {
|
|
12345
|
-
if (withLeadingZeroHours) {
|
|
12346
|
-
return "".concat(withLeadingZero(input), ":00");
|
|
12347
|
-
}
|
|
12348
|
-
return "".concat(input, ":00");
|
|
12349
|
-
}
|
|
12350
|
-
var decimal = input.toFixed(2);
|
|
12351
|
-
var time = decimal.toString().split(".");
|
|
12352
|
-
var hours = time[0];
|
|
12353
|
-
if (withLeadingZeroHours) {
|
|
12354
|
-
hours = withLeadingZero(hours);
|
|
12355
|
-
}
|
|
12356
|
-
var minutes = time[1];
|
|
12357
|
-
var minutes_formatted = Math.round(parseInt(minutes, 10) / 100 * 60);
|
|
12358
|
-
return "".concat(hours, ":").concat(withLeadingZero(minutes_formatted));
|
|
12359
|
-
};
|
|
12360
|
-
var withLeadingZero = function withLeadingZero(num) {
|
|
12361
|
-
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
12362
|
-
var s = "".concat(num);
|
|
12363
|
-
while (s.length < size) {
|
|
12364
|
-
s = "0" + s;
|
|
12365
|
-
}
|
|
12366
|
-
return s;
|
|
12367
|
-
};
|
|
12368
|
-
var isDecimal = function isDecimal(num) {
|
|
12369
|
-
return !Number.isInteger(num);
|
|
12370
|
-
};
|
|
12371
|
-
|
|
12372
12372
|
var StyledDiv = styled__default["default"].div.withConfig({
|
|
12373
12373
|
displayName: "Styles__StyledDiv",
|
|
12374
12374
|
componentId: "sc-1wapx2a-0"
|
|
@@ -12456,6 +12456,7 @@
|
|
|
12456
12456
|
value = _ref.value,
|
|
12457
12457
|
onCancel = _ref.onCancel,
|
|
12458
12458
|
onSave = _ref.onSave,
|
|
12459
|
+
onEnterKeyPress = _ref.onEnterKeyPress,
|
|
12459
12460
|
allowEmptyValue = _ref.allowEmptyValue,
|
|
12460
12461
|
_ref$withLeadingZero = _ref.withLeadingZero,
|
|
12461
12462
|
withLeadingZero = _ref$withLeadingZero === void 0 ? true : _ref$withLeadingZero,
|
|
@@ -12565,6 +12566,7 @@
|
|
|
12565
12566
|
var handleKeyDown = React.useCallback(function (e) {
|
|
12566
12567
|
if (e.key === "Enter") {
|
|
12567
12568
|
e.target.blur();
|
|
12569
|
+
onEnterKeyPress && onEnterKeyPress();
|
|
12568
12570
|
}
|
|
12569
12571
|
if (e.key === "ArrowLeft") {
|
|
12570
12572
|
return;
|
|
@@ -12633,7 +12635,7 @@
|
|
|
12633
12635
|
return;
|
|
12634
12636
|
}
|
|
12635
12637
|
}
|
|
12636
|
-
}, [handleIncrementDecrement, onCancel, validation, withLeadingZero]);
|
|
12638
|
+
}, [handleIncrementDecrement, onCancel, onEnterKeyPress, validation, withLeadingZero]);
|
|
12637
12639
|
var handleChange = React.useCallback(function (e) {
|
|
12638
12640
|
setCurrentValue(e.target.value);
|
|
12639
12641
|
}, []);
|
|
@@ -12663,7 +12665,8 @@
|
|
|
12663
12665
|
onKeyDown: handleKeyDown,
|
|
12664
12666
|
onChange: handleChange,
|
|
12665
12667
|
onClick: handleClick,
|
|
12666
|
-
onDoubleClick: handleDoubleClick
|
|
12668
|
+
onDoubleClick: handleDoubleClick,
|
|
12669
|
+
onEnterKeyPress: onEnterKeyPress
|
|
12667
12670
|
};
|
|
12668
12671
|
if (!children) {
|
|
12669
12672
|
console.error("No children provided!");
|
|
@@ -12684,11 +12687,12 @@
|
|
|
12684
12687
|
});
|
|
12685
12688
|
HoursWrapper.displayName = "HoursWrapper";
|
|
12686
12689
|
|
|
12687
|
-
var _excluded$G = ["value", "onCancel", "onSave", "allowEmptyValue", "withLeadingZero", "validation", "incrementOnlySelected", "minuteIncrement", "className"];
|
|
12690
|
+
var _excluded$G = ["value", "onCancel", "onSave", "onEnterKeyPress", "allowEmptyValue", "withLeadingZero", "validation", "incrementOnlySelected", "minuteIncrement", "className"];
|
|
12688
12691
|
var InputHours = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
|
12689
12692
|
var value = _ref.value,
|
|
12690
12693
|
onCancel = _ref.onCancel,
|
|
12691
12694
|
onSave = _ref.onSave,
|
|
12695
|
+
onEnterKeyPress = _ref.onEnterKeyPress,
|
|
12692
12696
|
allowEmptyValue = _ref.allowEmptyValue,
|
|
12693
12697
|
_ref$withLeadingZero = _ref.withLeadingZero,
|
|
12694
12698
|
withLeadingZero = _ref$withLeadingZero === void 0 ? true : _ref$withLeadingZero,
|
|
@@ -12706,6 +12710,7 @@
|
|
|
12706
12710
|
value: value,
|
|
12707
12711
|
onCancel: onCancel,
|
|
12708
12712
|
onSave: onSave,
|
|
12713
|
+
onEnterKeyPress: onEnterKeyPress,
|
|
12709
12714
|
incrementOnlySelected: incrementOnlySelected,
|
|
12710
12715
|
minuteIncrement: minuteIncrement,
|
|
12711
12716
|
allowEmptyValue: allowEmptyValue,
|
|
@@ -18060,6 +18065,7 @@
|
|
|
18060
18065
|
exports._CommandPalette = _CommandPalette;
|
|
18061
18066
|
exports._Dialog = _Dialog;
|
|
18062
18067
|
exports._List = _List;
|
|
18068
|
+
exports.decimalToHours = decimalToHours;
|
|
18063
18069
|
exports.isOptionGroup = isOptionGroup;
|
|
18064
18070
|
exports.layers = layers;
|
|
18065
18071
|
exports.signifierTypes = signifierTypes;
|