@fibery/ui-kit 1.34.4 → 1.34.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/ui-kit",
3
- "version": "1.34.4",
3
+ "version": "1.34.5",
4
4
  "private": false,
5
5
  "files": [
6
6
  "src/antd/styles.ts",
@@ -28,10 +28,12 @@
28
28
  "src/a11y-color.ts",
29
29
  "src/integration-compact-info-button.tsx",
30
30
  "src/dropdown-menu",
31
- "src/shortcut-badge",
32
- "src/tsfixme",
31
+ "src/shortcut-badge.tsx",
32
+ "src/tsfixme.ts",
33
33
  "src/toggle.tsx",
34
- "src/toggle-on-off.tsx"
34
+ "src/toggle-on-off.tsx",
35
+ "src/use-is-support-hardware-keyboard.ts",
36
+ "src/use-is-phone.ts"
35
37
  ],
36
38
  "license": "UNLICENSED",
37
39
  "dependencies": {
@@ -0,0 +1,28 @@
1
+ import {css, cx} from "@linaria/core";
2
+ import {textStyles, border, space, lineHeight, themeVars} from "./design-system";
3
+ import {useIsSupportHardwareKeyboard} from "./use-is-support-hardware-keyboard";
4
+
5
+ export const shortcutCss = css`
6
+ ${{
7
+ ...textStyles.small,
8
+ borderRadius: border.radius4,
9
+ border: themeVars.shortcutBorderColor,
10
+ color: themeVars.shortcutTextColor,
11
+ paddingTop: space.s2,
12
+ paddingBottom: space.s2,
13
+ paddingLeft: space.s4,
14
+ paddingRight: space.s4,
15
+ lineHeight: lineHeight.nowrap,
16
+ whiteSpace: "nowrap",
17
+ display: "inline-block",
18
+ userSelect: "none",
19
+ }}
20
+ `;
21
+
22
+ export const ShortcutBadge = ({className, shortcut}: {className?: string; shortcut: string}): JSX.Element | null => {
23
+ const isSupportHardwareKeyboard = useIsSupportHardwareKeyboard();
24
+ if (!isSupportHardwareKeyboard) {
25
+ return null;
26
+ }
27
+ return <div className={cx(shortcutCss, className)}>{shortcut}</div>;
28
+ };
package/src/tsfixme.ts ADDED
@@ -0,0 +1,2 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
+ export type $TSFixMe = any;
@@ -0,0 +1,5 @@
1
+ import {useIsMediaQueryMatched} from "./use-is-media-query-matched";
2
+
3
+ export function useIsPhone() {
4
+ return useIsMediaQueryMatched("(max-width: 420px), (max-height: 420px)");
5
+ }
@@ -0,0 +1,6 @@
1
+ import {useIsPhone} from "./use-is-phone";
2
+
3
+ export function useIsSupportHardwareKeyboard() {
4
+ // now we don't have media query for hardware keyboard support https://github.com/w3c/csswg-drafts/issues/3871
5
+ return !useIsPhone();
6
+ }