@fibery/ui-kit 1.37.0 → 1.38.0
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/CHANGELOG.md +14 -0
- package/package.json +8 -5
- package/src/actions-menu/actions-menu-item.tsx +18 -6
- package/src/actions-menu/actions-menu-props.tsx +4 -0
- package/src/actions-menu/actions-menu-sub-command-menu.tsx +7 -4
- package/src/actions-menu/actions-menu-sub-menu.tsx +9 -3
- package/src/actions-menu/actions-menu.tsx +24 -8
- package/src/actions-panel.tsx +12 -2
- package/src/axis-header.tsx +136 -76
- package/src/box.tsx +1 -1
- package/src/breadcrumb.tsx +78 -0
- package/src/button/actions-button-compact.tsx +4 -1
- package/src/button/base-button.tsx +5 -3
- package/src/button/button-group.tsx +1 -1
- package/src/button/button.tsx +31 -0
- package/src/button/icon-button.tsx +9 -0
- package/src/button/select-button.tsx +4 -0
- package/src/card-container.tsx +7 -4
- package/src/color-picker/swatch.tsx +1 -0
- package/src/command-menu/index.tsx +3 -3
- package/src/context-menu/index.tsx +10 -1
- package/src/date-picker/date-range-picker.tsx +6 -3
- package/src/date-picker/relative-date-picker.tsx +6 -2
- package/src/date-picker/single-date-picker.tsx +8 -5
- package/src/date-picker/styles.ts +32 -26
- package/src/date-picker/types.ts +3 -1
- package/src/day-select/day-select.tsx +21 -75
- package/src/day-select/iso-week-day-select.tsx +1 -1
- package/src/day-select/mount-day-select.tsx +2 -2
- package/src/day-select/week-day-select.tsx +1 -5
- package/src/design-system.ts +21 -12
- package/src/dropdown-menu/index.tsx +8 -1
- package/src/emoji-picker/app-icon-picker.tsx +6 -4
- package/src/emoji-picker/emoji-picker-preview-footer.tsx +1 -1
- package/src/emoji-picker/emoji-picker.tsx +3 -0
- package/src/emoji-picker/emoji.tsx +2 -1
- package/src/emoji-picker/icon-emoji-picker.tsx +10 -1
- package/src/emoji-picker/primitives/footer.tsx +0 -1
- package/src/emoji-picker/primitives/skin-tone.tsx +1 -0
- package/src/emoji-picker/use-responsive-emoji-size.ts +11 -0
- package/src/emoji-picker/utils/emoji-set.ts +2 -1
- package/src/empty-state/empty-state.tsx +6 -0
- package/src/field-icon.tsx +4 -1
- package/src/file-item.tsx +164 -47
- package/src/html-styles.ts +8 -0
- package/src/icons/ast/ActivityFilled.ts +8 -0
- package/src/icons/ast/AiAssistantFilled.ts +8 -0
- package/src/icons/ast/CollapseAllHorizontal.ts +8 -0
- package/src/icons/ast/DateRange.ts +1 -1
- package/src/icons/ast/EntityCreateFilled.ts +8 -0
- package/src/icons/ast/ExpandAllHorizontal.ts +8 -0
- package/src/icons/ast/GlobeUnpublish.ts +8 -0
- package/src/icons/ast/HomeFilled.ts +8 -0
- package/src/icons/ast/KeyboardHideDown.ts +8 -0
- package/src/icons/ast/LayoutMultiple.ts +8 -0
- package/src/icons/ast/RicheditorHistoryRedo.ts +1 -1
- package/src/icons/ast/RicheditorHistoryUndo.ts +1 -1
- package/src/icons/ast/SearchFilled.ts +8 -0
- package/src/icons/ast/SettingsFilled.ts +8 -0
- package/src/icons/ast/SlideMenuFilled.ts +8 -0
- package/src/icons/ast/TypeDate.ts +1 -1
- package/src/icons/ast/index.tsx +12 -0
- package/src/icons/react/ActivityFilled.tsx +13 -0
- package/src/icons/react/AiAssistantFilled.tsx +13 -0
- package/src/icons/react/CollapseAllHorizontal.tsx +13 -0
- package/src/icons/react/EntityCreateFilled.tsx +13 -0
- package/src/icons/react/ExpandAllHorizontal.tsx +13 -0
- package/src/icons/react/GlobeUnpublish.tsx +13 -0
- package/src/icons/react/HomeFilled.tsx +13 -0
- package/src/icons/react/KeyboardHideDown.tsx +13 -0
- package/src/icons/react/LayoutMultiple.tsx +13 -0
- package/src/icons/react/SearchFilled.tsx +13 -0
- package/src/icons/react/SettingsFilled.tsx +13 -0
- package/src/icons/react/SlideMenuFilled.tsx +13 -0
- package/src/icons/react/index.tsx +12 -0
- package/src/icons/svg/activity-filled.svg +4 -0
- package/src/icons/svg/ai-assistant-filled.svg +3 -0
- package/src/icons/svg/collapse-all-horizontal.svg +3 -0
- package/src/icons/svg/date-range.svg +3 -3
- package/src/icons/svg/entity-create-filled.svg +4 -0
- package/src/icons/svg/expand-all-horizontal.svg +3 -0
- package/src/icons/svg/globe-unpublish.svg +4 -0
- package/src/icons/svg/home-filled.svg +3 -0
- package/src/icons/svg/keyboard-hide-down.svg +1 -0
- package/src/icons/svg/layout-multiple.svg +3 -0
- package/src/icons/svg/richeditor/history/redo.svg +3 -2
- package/src/icons/svg/richeditor/history/undo.svg +3 -2
- package/src/icons/svg/search-filled.svg +3 -0
- package/src/icons/svg/settings-filled.svg +3 -0
- package/src/icons/svg/slide-menu-filled.svg +1 -0
- package/src/icons/svg/type/date.svg +3 -2
- package/src/images-gallery/images-gallery.tsx +254 -0
- package/src/images-gallery/zoom.tsx +112 -0
- package/src/is-in-popup.ts +1 -1
- package/src/layout-styles.ts +21 -1
- package/src/lists/actions-menu-row-surface.tsx +3 -1
- package/src/lists/list-row-surface.tsx +7 -1
- package/src/mobile-keyboard-aware-popup.tsx +87 -0
- package/src/mobile-styles.ts +8 -0
- package/src/modal-menu/contexts/modal-menu-context.tsx +22 -0
- package/src/modal-menu/contexts/modal-submenu-context.tsx +16 -0
- package/src/modal-menu/index.tsx +14 -0
- package/src/modal-menu/modal-menu-content.tsx +68 -0
- package/src/modal-menu/modal-menu-group.tsx +10 -0
- package/src/modal-menu/modal-menu-item.tsx +37 -0
- package/src/modal-menu/modal-menu-label.tsx +24 -0
- package/src/modal-menu/modal-menu-root.tsx +57 -0
- package/src/modal-menu/modal-menu-separator.tsx +14 -0
- package/src/modal-menu/modal-menu-trigger.tsx +37 -0
- package/src/modal-menu/modal-submenu-content.tsx +49 -0
- package/src/modal-menu/modal-submenu-trigger.tsx +34 -0
- package/src/modal-menu/modal-submenu.tsx +17 -0
- package/src/online-users.tsx +3 -3
- package/src/palette.ts +1 -1
- package/src/popover/index.tsx +687 -0
- package/src/popover/mobile-popup-context.tsx +29 -0
- package/src/{popup → popover}/modifiers.tsx +0 -7
- package/src/{popup → popover}/popup-modifiers-context.ts +3 -3
- package/src/reactions/reaction-button.tsx +30 -45
- package/src/reactions/reaction-picker.tsx +39 -45
- package/src/select/index.tsx +8 -4
- package/src/select/select-in-popover.tsx +21 -33
- package/src/tab-nav/tab-nav.tsx +35 -9
- package/src/toast/primitives.tsx +8 -1
- package/src/toggle-button/round-toggle-button.tsx +23 -0
- package/src/toggle-button/toggle-button-group.tsx +34 -0
- package/src/toggle-button/toggle-button.tsx +164 -0
- package/src/toggle.tsx +3 -3
- package/src/tooltip.tsx +2 -2
- package/src/unit/styles.ts +2 -2
- package/src/use-is-phone.tsx +28 -3
- package/src/use-is-support-hover.ts +1 -1
- package/src/use-on-screen-keyboard-data.tsx +66 -0
- package/src/workflow-progress-icon.tsx +16 -22
- package/src/popup/index.tsx +0 -383
- /package/src/{popup → popover}/popup-stack-context.tsx +0 -0
- /package/src/{popup → popover}/reference.ts +0 -0
- /package/src/{popup → popover}/styles.ts +0 -0
- /package/src/{popup → popover}/use-click-outside.ts +0 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import {css, cx} from "@linaria/core";
|
|
2
|
+
import {Toggle, ToggleProps} from "@radix-ui/react-toggle";
|
|
3
|
+
import {forwardRef} from "react";
|
|
4
|
+
import {border, space, textStyles, themeVars} from "../design-system";
|
|
5
|
+
import {iconColorVar, iconSizeVar} from "../icons/Icon";
|
|
6
|
+
|
|
7
|
+
export const toggleButtonCss = css`
|
|
8
|
+
button:where(&) {
|
|
9
|
+
all: unset;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
padding-inline: ${space.s6}px;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
min-height: 24px;
|
|
17
|
+
font-size: ${textStyles.small.fontSize}px;
|
|
18
|
+
border-radius: ${border.radius8}px;
|
|
19
|
+
|
|
20
|
+
transition-property: border, background-color, color, opacity, box-shadow;
|
|
21
|
+
transition-duration: 0.15s;
|
|
22
|
+
|
|
23
|
+
color: ${themeVars.textColor};
|
|
24
|
+
${iconColorVar}: ${themeVars.colorIconButtonGhostNeutral};
|
|
25
|
+
|
|
26
|
+
${iconSizeVar}: 16px;
|
|
27
|
+
|
|
28
|
+
border: 1.5px solid ${themeVars.colorBorderReactionsHover};
|
|
29
|
+
background-color: ${themeVars.colorBgReactionsDefault};
|
|
30
|
+
|
|
31
|
+
&[aria-readonly="true"] {
|
|
32
|
+
background-color: ${themeVars.colorBgReactionsHover};
|
|
33
|
+
border-color: ${themeVars.colorBgReactionsHover};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
line-height: 16px;
|
|
38
|
+
user-select: none;
|
|
39
|
+
|
|
40
|
+
&[data-size="medium"] {
|
|
41
|
+
min-height: 28px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&[data-size="large"] {
|
|
45
|
+
min-height: 32px;
|
|
46
|
+
padding-inline: 7px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:not(:disabled, [aria-readonly="true"]) {
|
|
50
|
+
&:hover {
|
|
51
|
+
background-color: ${themeVars.colorBgReactionsHover};
|
|
52
|
+
border-color: ${themeVars.colorBorderReactionsHover};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:is(:active, [aria-expanded="true"]) {
|
|
56
|
+
background-color: ${themeVars.colorBgReactionsHover};
|
|
57
|
+
border-color: ${themeVars.colorBorderReactionsHover};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&:disabled,
|
|
62
|
+
&[aria-readonly="true"] {
|
|
63
|
+
cursor: default;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:focus {
|
|
67
|
+
outline: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&:focus-visible {
|
|
71
|
+
background-color: ${themeVars.colorBgReactionsHover};
|
|
72
|
+
outline: 2px solid ${themeVars.colorBorderReactionsHover};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&:is([aria-pressed="true"], [aria-checked="true"]) {
|
|
76
|
+
color: ${themeVars.colorTextReactionsSelected};
|
|
77
|
+
${iconColorVar}: ${themeVars.colorIconButtonGhostAccent};
|
|
78
|
+
background-color: ${themeVars.colorBgReactionsSelectedDefault};
|
|
79
|
+
border-color: ${themeVars.colorBorderReactionsSelectedDefault};
|
|
80
|
+
|
|
81
|
+
&[aria-readonly="true"] {
|
|
82
|
+
background-color: ${themeVars.colorBgReactionsSelectedDefault};
|
|
83
|
+
border-color: ${themeVars.colorBgReactionsSelectedDefault};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&:not(:disabled, [aria-readonly="true"]) {
|
|
87
|
+
&:hover {
|
|
88
|
+
background-color: ${themeVars.colorBgReactionsSelectedHover};
|
|
89
|
+
border-color: ${themeVars.colorBorderReactionsSelectedHover};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&:active {
|
|
93
|
+
background-color: ${themeVars.colorBgReactionsSelectedDefault};
|
|
94
|
+
border-color: ${themeVars.colorBorderReactionsSelectedHover};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
|
|
100
|
+
export const toggleButtonCssWithIconStart = css`
|
|
101
|
+
padding-left: ${space.s4}px;
|
|
102
|
+
`;
|
|
103
|
+
|
|
104
|
+
export const toggleButtonContent = css`
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
gap: ${space.s4}px;
|
|
108
|
+
height: 100%;
|
|
109
|
+
|
|
110
|
+
transition-property: opacity;
|
|
111
|
+
transition-duration: 0.15s;
|
|
112
|
+
|
|
113
|
+
.${toggleButtonCss}:is(:active, [aria-expanded="true"]) > & {
|
|
114
|
+
opacity: 0.8;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.${toggleButtonCss}:disabled > & {
|
|
118
|
+
opacity: 0.6;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
export type ToggleButtonVariant = "outline";
|
|
125
|
+
export type ToggleButtonSize = "small" | "medium" | "large";
|
|
126
|
+
|
|
127
|
+
export type ToggleButtonProps = {
|
|
128
|
+
iconStart?: React.ReactNode;
|
|
129
|
+
variant?: ToggleButtonVariant;
|
|
130
|
+
size?: ToggleButtonSize;
|
|
131
|
+
readOnly?: boolean;
|
|
132
|
+
} & Omit<ToggleProps, "asChild">;
|
|
133
|
+
|
|
134
|
+
export const ToggleButton = forwardRef<HTMLButtonElement, ToggleButtonProps>(
|
|
135
|
+
(
|
|
136
|
+
{
|
|
137
|
+
className,
|
|
138
|
+
iconStart,
|
|
139
|
+
size = "small",
|
|
140
|
+
variant = "outline",
|
|
141
|
+
children,
|
|
142
|
+
"aria-readonly": ariaReadonly,
|
|
143
|
+
readOnly = ariaReadonly,
|
|
144
|
+
...props
|
|
145
|
+
},
|
|
146
|
+
ref
|
|
147
|
+
): JSX.Element => {
|
|
148
|
+
return (
|
|
149
|
+
<Toggle
|
|
150
|
+
ref={ref}
|
|
151
|
+
className={cx(toggleButtonCss, iconStart && toggleButtonCssWithIconStart, className)}
|
|
152
|
+
data-variant={variant}
|
|
153
|
+
data-size={size}
|
|
154
|
+
aria-readonly={readOnly}
|
|
155
|
+
{...props}
|
|
156
|
+
>
|
|
157
|
+
<div className={toggleButtonContent}>
|
|
158
|
+
{iconStart}
|
|
159
|
+
{children}
|
|
160
|
+
</div>
|
|
161
|
+
</Toggle>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
);
|
package/src/toggle.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import {css, cx} from "@linaria/core";
|
|
|
2
2
|
import {styled} from "@linaria/react";
|
|
3
3
|
import chroma from "chroma-js";
|
|
4
4
|
import {ComponentProps, FC, ReactNode} from "react";
|
|
5
|
-
import {
|
|
5
|
+
import {space, textStyles, transition} from "./design-system";
|
|
6
6
|
import _ from "lodash";
|
|
7
7
|
import SpinnerIcon from "./icons/react/Spinner";
|
|
8
8
|
|
|
@@ -26,7 +26,8 @@ const Input = styled.input<{outlineColor: string}>`
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
&:focus-visible {
|
|
29
|
-
|
|
29
|
+
outline: ${({outlineColor}) => `2px solid ${outlineColor}`};
|
|
30
|
+
outline-offset: 1px;
|
|
30
31
|
}
|
|
31
32
|
`;
|
|
32
33
|
|
|
@@ -34,7 +35,6 @@ const Label = styled.div<{labelPosition: "last" | "first"; disabled?: boolean}>`
|
|
|
34
35
|
margin-left: ${({labelPosition}) => (labelPosition === "last" ? `${space.s8}px` : 0)};
|
|
35
36
|
margin-right: ${({labelPosition}) => (labelPosition === "first" ? `${space.s8}px` : 0)};
|
|
36
37
|
opacity: ${({disabled}) => (disabled ? 0.5 : 1)};
|
|
37
|
-
line-height: ${layout.checkboxSize}px;
|
|
38
38
|
width: 100%;
|
|
39
39
|
min-width: 0;
|
|
40
40
|
`;
|
package/src/tooltip.tsx
CHANGED
|
@@ -24,10 +24,10 @@ const descriptionStyle = css`
|
|
|
24
24
|
`;
|
|
25
25
|
|
|
26
26
|
export const tooltipStyle = css`
|
|
27
|
-
font-size:
|
|
27
|
+
font-size: 12px;
|
|
28
28
|
color: ${themeVars.whiteColor};
|
|
29
29
|
z-index: 100000;
|
|
30
|
-
min-height:
|
|
30
|
+
min-height: 28px;
|
|
31
31
|
max-width: 300px;
|
|
32
32
|
background-color: ${themeVars.tooltipBgColor};
|
|
33
33
|
padding: ${space.s6}px ${space.s8}px;
|
package/src/unit/styles.ts
CHANGED
|
@@ -146,14 +146,14 @@ export const unitContentContainerClassName = css`
|
|
|
146
146
|
`;
|
|
147
147
|
|
|
148
148
|
export const unitDescriptionClassName = css`
|
|
149
|
-
margin-bottom: ${space.
|
|
149
|
+
margin-bottom: ${space.s1}px;
|
|
150
150
|
`;
|
|
151
151
|
|
|
152
152
|
export const fullUnitWrapperClassName = css`
|
|
153
153
|
display: flex;
|
|
154
154
|
align-items: center;
|
|
155
155
|
padding: ${space.s6}px;
|
|
156
|
-
border-radius: ${space.
|
|
156
|
+
border-radius: ${space.s5}px;
|
|
157
157
|
background-color: ${themeVars.cardBg};
|
|
158
158
|
margin-bottom: ${space.s4}px;
|
|
159
159
|
`;
|
package/src/use-is-phone.tsx
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
|
-
import {useIsMediaQueryMatched} from "./use-is-media-query-matched";
|
|
2
|
-
import {createContext} from "@fibery/react/src/create-context";
|
|
3
1
|
import {ReactNode} from "react";
|
|
2
|
+
import {createContext} from "@fibery/react/src/create-context";
|
|
3
|
+
import {useIsMediaQueryMatched} from "./use-is-media-query-matched";
|
|
4
|
+
import {getMediaQueryList} from "./media-query-utils";
|
|
4
5
|
|
|
5
6
|
const [Provider, useIsPhone] = createContext<boolean>("PhoneContext", false);
|
|
6
7
|
|
|
7
8
|
export {useIsPhone};
|
|
8
9
|
|
|
10
|
+
declare global {
|
|
11
|
+
const __DISABLE_VERTICAL_MOBILE_BREAKPOINT__: boolean | undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function isVerticalMobileBreakpointDisabled() {
|
|
15
|
+
// noinspection PointlessBooleanExpressionJS
|
|
16
|
+
if (
|
|
17
|
+
typeof __DISABLE_VERTICAL_MOBILE_BREAKPOINT__ !== "undefined" &&
|
|
18
|
+
__DISABLE_VERTICAL_MOBILE_BREAKPOINT__ === true
|
|
19
|
+
) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
23
|
+
return urlParams.has("no-vertical-mobile-breakpoint");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const phoneMediaQuery = isVerticalMobileBreakpointDisabled()
|
|
27
|
+
? "(max-width: 440px)"
|
|
28
|
+
: "(max-width: 440px), (max-height: 440px)";
|
|
29
|
+
|
|
30
|
+
export function isPhoneMode() {
|
|
31
|
+
return getMediaQueryList(phoneMediaQuery).matches;
|
|
32
|
+
}
|
|
33
|
+
|
|
9
34
|
export function IsPhoneProvider({children}: {children: ReactNode}) {
|
|
10
|
-
const isPhone = useIsMediaQueryMatched(
|
|
35
|
+
const isPhone = useIsMediaQueryMatched(phoneMediaQuery);
|
|
11
36
|
return <Provider value={isPhone}>{children}</Provider>;
|
|
12
37
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {ReactNode, useEffect, useState} from "react";
|
|
2
|
+
import {createContext} from "@fibery/react/src/create-context";
|
|
3
|
+
import _ from "lodash";
|
|
4
|
+
import {useIsPhone} from "./use-is-phone";
|
|
5
|
+
import {keyboardHeightVar, mobileKeyboardOpenClassName} from "./mobile-styles";
|
|
6
|
+
|
|
7
|
+
const defaultKeyboardHeight = 350;
|
|
8
|
+
|
|
9
|
+
const [OnScreenKeyboardHeightValueProvider, useOnScreenKeyboardHeight] = createContext<number>(
|
|
10
|
+
"OnScreenKeyboardHeightProvider",
|
|
11
|
+
defaultKeyboardHeight
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const [IsOnScreenKeyboardOpenedValueProvider, useIsOnScreenKeyboardOpened] = createContext<boolean>(
|
|
15
|
+
"IsOnScreenKeyboardOpenedValueProvider",
|
|
16
|
+
false
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export function OnScreenKeyboardContextProvider({children}: {children: ReactNode}) {
|
|
20
|
+
const isPhone = useIsPhone();
|
|
21
|
+
const [keyboardHeight, setKeyboardHeight] = useState<number>(defaultKeyboardHeight);
|
|
22
|
+
const [keyboardVisible, setKeyboardVisible] = useState<boolean>(false);
|
|
23
|
+
const [initialViewPortHeight] = useState(() => window.visualViewport?.height || 0);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const viewport = window.visualViewport;
|
|
26
|
+
if (!viewport || !isPhone) {
|
|
27
|
+
return _.noop;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function viewportHandler() {
|
|
31
|
+
if (viewport) {
|
|
32
|
+
// console.log({height: viewport.height, initialViewPortHeight, windowHeight: window.innerHeight});
|
|
33
|
+
// Calculate keyboard height as difference between window height and viewport height
|
|
34
|
+
const calculatedHeight = Math.max(0, initialViewPortHeight - viewport.height);
|
|
35
|
+
if (calculatedHeight && keyboardHeight !== calculatedHeight && calculatedHeight > 200) {
|
|
36
|
+
setKeyboardHeight(calculatedHeight);
|
|
37
|
+
document.body.style.setProperty(keyboardHeightVar, `${calculatedHeight}px`);
|
|
38
|
+
}
|
|
39
|
+
if (viewport.height !== initialViewPortHeight && !keyboardVisible) {
|
|
40
|
+
const htmlElement = document.querySelector("html");
|
|
41
|
+
htmlElement?.classList.add(mobileKeyboardOpenClassName);
|
|
42
|
+
setKeyboardVisible(true);
|
|
43
|
+
} else if (viewport.height === initialViewPortHeight && keyboardVisible) {
|
|
44
|
+
setKeyboardVisible(false);
|
|
45
|
+
const htmlElement = document.querySelector("html");
|
|
46
|
+
htmlElement?.classList.remove(mobileKeyboardOpenClassName);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
viewport.addEventListener("resize", viewportHandler);
|
|
52
|
+
// Initial calculation
|
|
53
|
+
viewportHandler();
|
|
54
|
+
|
|
55
|
+
return () => {
|
|
56
|
+
viewport.removeEventListener("resize", viewportHandler);
|
|
57
|
+
};
|
|
58
|
+
}, [initialViewPortHeight, isPhone, keyboardHeight, keyboardVisible]);
|
|
59
|
+
return (
|
|
60
|
+
<OnScreenKeyboardHeightValueProvider value={keyboardHeight}>
|
|
61
|
+
<IsOnScreenKeyboardOpenedValueProvider value={keyboardVisible}>{children}</IsOnScreenKeyboardOpenedValueProvider>
|
|
62
|
+
</OnScreenKeyboardHeightValueProvider>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export {useOnScreenKeyboardHeight, useIsOnScreenKeyboardOpened};
|
|
@@ -29,31 +29,25 @@ export const WorkflowProgressIcon: FC<WorkflowProgressIcon> = ({
|
|
|
29
29
|
<svg
|
|
30
30
|
width={size}
|
|
31
31
|
height={size}
|
|
32
|
-
viewBox={`0 0
|
|
32
|
+
viewBox={`0 0 16 16`}
|
|
33
33
|
className={css`
|
|
34
34
|
display: block;
|
|
35
35
|
`}
|
|
36
36
|
>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<>
|
|
52
|
-
<path d={getPath(total, total, size)} fill={fillBackground} />
|
|
53
|
-
<path d={getPath(index, total, size)} fill={fillProgress} />
|
|
54
|
-
</>
|
|
55
|
-
)}
|
|
56
|
-
</g>
|
|
37
|
+
{isDone ? (
|
|
38
|
+
<>
|
|
39
|
+
<circle cx="8" cy="8" r="8" fill={doneFillColor} fillOpacity="0.8" />
|
|
40
|
+
<path
|
|
41
|
+
d="M6.93229 11.98C7.25645 11.98 7.5091 11.8562 7.68071 11.5941L12.1236 4.80535C12.2476 4.61478 12.3 4.43852 12.3 4.27178C12.3 3.82395 11.9663 3.5 11.5086 3.5C11.1941 3.5 10.9986 3.61434 10.8079 3.91447L6.90845 10.0601L4.93012 7.60661C4.75374 7.39699 4.56306 7.30171 4.2961 7.30171C3.8337 7.30171 3.5 7.63042 3.5 8.07824C3.5 8.27832 3.56197 8.45464 3.73358 8.64992L6.19339 11.6274C6.39838 11.8704 6.62719 11.98 6.93229 11.98Z"
|
|
42
|
+
fill={doneStrokeColor}
|
|
43
|
+
/>
|
|
44
|
+
</>
|
|
45
|
+
) : (
|
|
46
|
+
<g transform={`translate(8, 8)`}>
|
|
47
|
+
<path d={getPath(total, total, 16)} fill={fillBackground} />
|
|
48
|
+
<path d={getPath(index, total, 16)} fill={fillProgress} />
|
|
49
|
+
</g>
|
|
50
|
+
)}
|
|
57
51
|
</svg>
|
|
58
52
|
);
|
|
59
53
|
};
|
|
@@ -63,7 +57,7 @@ const getPath = _.memoize(
|
|
|
63
57
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
64
58
|
// @ts-ignore bad d3-shape typings
|
|
65
59
|
return arc()
|
|
66
|
-
.innerRadius(size /
|
|
60
|
+
.innerRadius(size / 2.75)
|
|
67
61
|
.outerRadius(size / 2)
|
|
68
62
|
.startAngle(0)
|
|
69
63
|
.endAngle(2 * (index / total) * Math.PI)
|