@musecat/uikit 0.1.3 → 0.2.1
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/.agents/references/Components/Box.md +1 -1
- package/.agents/references/Components/Button.md +1 -1
- package/.agents/references/Components/Card.md +1 -1
- package/.agents/references/Components/Checkbox.md +1 -1
- package/.agents/references/Components/CodeBox.md +1 -1
- package/.agents/references/Components/ContextMenu.md +1 -1
- package/.agents/references/Components/ContributionGraph.md +1 -1
- package/.agents/references/Components/DatePicker.md +1 -1
- package/.agents/references/Components/Divider.md +1 -1
- package/.agents/references/Components/Header.md +3 -3
- package/.agents/references/Components/Icon.md +1 -1
- package/.agents/references/Components/Input.md +1 -1
- package/.agents/references/Components/Label.md +2 -2
- package/.agents/references/Components/Layout.md +2 -2
- package/.agents/references/Components/Maps.md +1 -1
- package/.agents/references/Components/Nav.md +1 -1
- package/.agents/references/Components/Pagination.md +1 -1
- package/.agents/references/Components/Pill.md +1 -1
- package/.agents/references/Components/Profile.md +1 -1
- package/.agents/references/Components/Progress.md +2 -2
- package/.agents/references/Components/Radio.md +2 -2
- package/.agents/references/Components/Select.md +1 -1
- package/.agents/references/Components/Skeleton.md +1 -1
- package/.agents/references/Components/Spinner.md +1 -1
- package/.agents/references/Components/Text.md +1 -1
- package/.agents/references/Components/TimePicker.md +1 -1
- package/.agents/references/Components/Timeline.md +2 -2
- package/.agents/references/Frameworks/DNDView.md +1 -1
- package/.agents/references/Frameworks/Dialog.md +2 -2
- package/.agents/references/Frameworks/EdgeEffect.md +2 -2
- package/.agents/references/Frameworks/HScrollView.md +2 -2
- package/.agents/references/Frameworks/ImageView.md +1 -1
- package/.agents/references/Frameworks/Motion.md +1 -1
- package/.agents/references/Frameworks/Pressable.md +1 -1
- package/.agents/references/Frameworks/Squircle.md +1 -1
- package/.agents/references/Frameworks/Theme.md +1 -1
- package/.agents/references/Frameworks/Toaster.md +2 -2
- package/.agents/references/Frameworks/View.md +1 -1
- package/.agents/references/Frameworks/_shared.md +3 -3
- package/README.md +25 -1
- package/global.d.ts +6 -0
- package/i18n/messages/en/uikit.json +50 -0
- package/i18n/messages/jp/uikit.json +50 -0
- package/i18n/messages/kr/uikit.json +50 -0
- package/i18n/request.ts +17 -0
- package/i18n/shared.ts +54 -0
- package/index.ts +86 -66
- package/package.json +33 -10
- package/packages/Components/Box/Box.tsx +7 -7
- package/packages/Components/Box/Box.types.ts +7 -7
- package/packages/Components/Button/Button.tsx +6 -6
- package/packages/Components/Button/Button.types.ts +6 -6
- package/packages/Components/Card/Card.default.tsx +13 -11
- package/packages/Components/Card/Card.foldable.tsx +16 -14
- package/packages/Components/Card/Card.tsx +3 -3
- package/packages/Components/Card/Card.types.ts +5 -5
- package/packages/Components/Card/Card.utils.ts +1 -1
- package/packages/Components/Checkbox/Checkbox.tsx +6 -6
- package/packages/Components/Checkbox/Checkbox.types.ts +4 -4
- package/packages/Components/CodeBox/CodeBox.copy.tsx +3 -3
- package/packages/Components/CodeBox/CodeBox.tsx +6 -5
- package/packages/Components/CodeBox/CodeBox.types.ts +2 -2
- package/packages/Components/ContextMenu/ContextMenu.options.tsx +6 -6
- package/packages/Components/ContextMenu/ContextMenu.tsx +8 -7
- package/packages/Components/ContextMenu/ContextMenu.types.ts +1 -1
- package/packages/Components/ContributionGraph/ContributionGraph.tsx +18 -9
- package/packages/Components/ContributionGraph/ContributionGraph.types.ts +2 -2
- package/packages/Components/DatePicker/DatePicker.calendar.tsx +6 -6
- package/packages/Components/DatePicker/DatePicker.core.tsx +2 -2
- package/packages/Components/DatePicker/DatePicker.tsx +48 -27
- package/packages/Components/DatePicker/DatePicker.types.ts +1 -1
- package/packages/Components/DatePicker/hooks/useCalendar.ts +1 -1
- package/packages/Components/DatePicker/hooks/useSelection.ts +2 -2
- package/packages/Components/Divider/Divider.tsx +2 -2
- package/packages/Components/Divider/Divider.types.ts +1 -1
- package/packages/Components/Header/Header.tsx +4 -4
- package/packages/Components/Icon/Icon.group.tsx +5 -5
- package/packages/Components/Icon/Icon.group.types.ts +4 -4
- package/packages/Components/Icon/Icon.tsx +8 -8
- package/packages/Components/Icon/Icon.types.ts +7 -7
- package/packages/Components/Input/Input.tsx +5 -5
- package/packages/Components/Input/Input.types.ts +1 -1
- package/packages/Components/Label/Label.tsx +7 -7
- package/packages/Components/Label/Label.types.ts +2 -2
- package/packages/Components/Layout/Layout.docs.tsx +6 -6
- package/packages/Components/Layout/Layout.docs.types.ts +2 -2
- package/packages/Components/Layout/Layout.tsx +7 -7
- package/packages/Components/Layout/Layout.types.ts +4 -4
- package/packages/Components/Maps/OSM/MapOSM.tsx +4 -4
- package/packages/Components/Nav/Nav.tsx +8 -8
- package/packages/Components/Nav/Nav.types.ts +5 -5
- package/packages/Components/Nav/hooks/useNavDrag.ts +1 -1
- package/packages/Components/Pagination/Pagination.tsx +8 -7
- package/packages/Components/Pagination/Pagination.types.ts +1 -1
- package/packages/Components/Pill/Pill.tsx +4 -4
- package/packages/Components/Pill/Pill.types.ts +6 -6
- package/packages/Components/Profile/Profile.shared.ts +3 -3
- package/packages/Components/Profile/Profile.tsx +7 -7
- package/packages/Components/Profile/Profile.types.ts +4 -4
- package/packages/Components/Progress/Progress.tsx +5 -5
- package/packages/Components/Progress/Progress.types.ts +2 -2
- package/packages/Components/Radio/Radio.tsx +5 -5
- package/packages/Components/Radio/Radio.types.ts +4 -4
- package/packages/Components/Select/Select.keyboard.tsx +1 -1
- package/packages/Components/Select/Select.trigger.tsx +3 -3
- package/packages/Components/Select/Select.tsx +2 -2
- package/packages/Components/Select/Select.types.ts +1 -1
- package/packages/Components/Select/Select.utils.ts +1 -1
- package/packages/Components/Select/hooks/useSelectNavigation.ts +7 -10
- package/packages/Components/Select/hooks/useSelectSelection.ts +3 -3
- package/packages/Components/Select/hooks/useSelectState.ts +3 -3
- package/packages/Components/Select/select.control.tsx +15 -24
- package/packages/Components/Select/select.inner.tsx +10 -10
- package/packages/Components/Skeleton/Skeleton.tsx +2 -2
- package/packages/Components/Skeleton/Skeleton.types.ts +2 -2
- package/packages/Components/Spinner/Spinner.tsx +5 -5
- package/packages/Components/Spinner/Spinner.types.ts +2 -2
- package/packages/Components/Text/Text.tsx +3 -3
- package/packages/Components/Text/Text.types.ts +2 -2
- package/packages/Components/TimePicker/TimePicker.core.tsx +4 -4
- package/packages/Components/TimePicker/TimePicker.tsx +7 -7
- package/packages/Components/TimePicker/TimePicker.types.ts +1 -1
- package/packages/Components/Timeline/Timeline.tsx +5 -5
- package/packages/Components/Timeline/Timeline.types.ts +3 -3
- package/packages/Components/Title/Title.tsx +7 -7
- package/packages/Components/Title/Title.types.ts +6 -6
- package/packages/Components/Toggle/Toggle.tsx +9 -9
- package/packages/Components/Toggle/Toggle.types.ts +3 -3
- package/packages/Components/Tooltip/Tooltip.tsx +3 -3
- package/packages/Components/Tooltip/Tooltip.types.ts +2 -2
- package/packages/Frameworks/Dialog/Dialog.background.tsx +4 -4
- package/packages/Frameworks/Dialog/Dialog.boot.tsx +2 -2
- package/packages/Frameworks/Dialog/Dialog.store.ts +1 -1
- package/packages/Frameworks/Dialog/Dialog.tsx +6 -5
- package/packages/Frameworks/Dialog/Dialog.types.ts +4 -4
- package/packages/Frameworks/Dialog/contents/Dialog.footer.tsx +4 -4
- package/packages/Frameworks/Dialog/contents/Dialog.funnel.tsx +6 -6
- package/packages/Frameworks/Dialog/contents/Dialog.header.tsx +6 -6
- package/packages/Frameworks/Dialog/hooks/useDialogPosition.ts +2 -2
- package/packages/Frameworks/Dialog/hooks/useSheetDrag.ts +4 -2
- package/packages/Frameworks/Dialog/hooks/useSheetGeometry.ts +5 -3
- package/packages/Frameworks/Dialog/hooks/useSheetProgressive.ts +2 -2
- package/packages/Frameworks/Dialog/renderers/renderModal.tsx +9 -9
- package/packages/Frameworks/Dialog/renderers/renderPopover.tsx +11 -11
- package/packages/Frameworks/Dialog/renderers/renderSheet.tsx +17 -17
- package/packages/Frameworks/EdgeEffect/EdgeEffect.tsx +2 -2
- package/packages/Frameworks/EdgeEffect/EdgeEffect.types.ts +1 -1
- package/packages/Frameworks/Pressable/Pressable.tsx +11 -11
- package/packages/Frameworks/Pressable/Pressable.types.ts +15 -6
- package/packages/Frameworks/Squircle/Squircle.tsx +3 -3
- package/packages/Frameworks/Squircle/Squircle.types.ts +1 -1
- package/packages/Frameworks/Theme/Radius.types.ts +2 -2
- package/packages/Frameworks/Toaster/Toaster.boot.tsx +5 -5
- package/packages/Frameworks/Toaster/Toaster.types.ts +3 -1
- package/packages/Frameworks/View/DNDView/DNDView.tsx +5 -5
- package/packages/Frameworks/View/DNDView/DNDView.types.ts +2 -2
- package/packages/Frameworks/View/HScrollView/HScrollView.tsx +8 -8
- package/packages/Frameworks/View/HScrollView/HScrollView.types.ts +2 -2
- package/packages/Frameworks/View/ImageView/Dialog/ImageDialog.counter.tsx +2 -2
- package/packages/Frameworks/View/ImageView/Dialog/ImageDialog.footer.tsx +8 -4
- package/packages/Frameworks/View/ImageView/Dialog/ImageDialog.header.tsx +3 -3
- package/packages/Frameworks/View/ImageView/Dialog/ImageDialog.list.tsx +5 -5
- package/packages/Frameworks/View/ImageView/Dialog/ImageDialog.slide.tsx +3 -3
- package/packages/Frameworks/View/ImageView/Dialog/ImageDialog.tsx +7 -7
- package/packages/Frameworks/View/ImageView/Image.controls.tsx +1 -1
- package/packages/Frameworks/View/ImageView/Image.tsx +44 -27
- package/packages/Frameworks/View/ImageView/Image.types.ts +2 -2
- package/packages/Frameworks/View/ImageView/Image.utils.ts +2 -2
- package/packages/Frameworks/View/View.tsx +8 -8
- package/packages/Frameworks/View/View.types.ts +5 -5
- package/packages/Frameworks/_shared/Padding.types.ts +2 -4
- package/packages/Frameworks/_shared/StopParentInteraction.tsx +1 -1
- package/packages/Frameworks/_shared/Wind.types.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useCallback, useRef } from "react";
|
|
4
|
-
import type { NavProps } from "
|
|
4
|
+
import type { NavProps } from "../Nav.types";
|
|
5
5
|
|
|
6
6
|
const DRAG_SELECTION_TOUCH_ACTIVATION_DISTANCE = 10;
|
|
7
7
|
const DRAG_SELECTION_TOUCH_HORIZONTAL_RATIO = 1.75;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { useTimeout } from "@musecat/functionkit";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
|
-
import { Word } from "
|
|
6
|
-
import Icon from "
|
|
7
|
-
import type { IconProps } from "
|
|
8
|
-
import type { PaginationProps } from "
|
|
9
|
-
import Text from "
|
|
10
|
-
import type { PressableProps } from "
|
|
11
|
-
import View from "
|
|
5
|
+
import { Word } from "../../../i18n/shared";
|
|
6
|
+
import Icon from "../Icon/Icon";
|
|
7
|
+
import type { IconProps } from "../Icon/Icon.types";
|
|
8
|
+
import type { PaginationProps } from "./Pagination.types";
|
|
9
|
+
import Text from "../Text/Text";
|
|
10
|
+
import type { PressableProps } from "../../Frameworks/Pressable/Pressable.types";
|
|
11
|
+
import View from "../../Frameworks/View/View";
|
|
12
12
|
|
|
13
13
|
function clampPage(page: number, total: number) {
|
|
14
14
|
return Math.min(total, Math.max(1, page));
|
|
@@ -138,6 +138,7 @@ export default function Pagination({
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
return (
|
|
141
|
+
// biome-ignore lint/a11y/useSemanticElements: nav[role="group"] is correct for pagination
|
|
141
142
|
<nav
|
|
142
143
|
aria-label={resolvedNavigationLabel}
|
|
143
144
|
data-color-mode={dataTheme}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
|
-
import Icon from "
|
|
3
|
-
import type { PillProps } from "
|
|
4
|
-
import Text from "
|
|
5
|
-
import Pressable from "
|
|
2
|
+
import Icon from "../Icon/Icon";
|
|
3
|
+
import type { PillProps } from "./Pill.types";
|
|
4
|
+
import Text from "../Text/Text";
|
|
5
|
+
import Pressable from "../../Frameworks/Pressable/Pressable";
|
|
6
6
|
|
|
7
7
|
export function Pill({
|
|
8
8
|
themePreset,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { IconProps } from "
|
|
2
|
-
import type { TextProps } from "
|
|
3
|
-
import type { UIKitSizeValue } from "
|
|
4
|
-
import type { PressableProps } from "
|
|
5
|
-
import type { RadiusProps } from "
|
|
1
|
+
import type { IconProps } from "../Icon/Icon.types";
|
|
2
|
+
import type { TextProps } from "../Text/Text.types";
|
|
3
|
+
import type { UIKitSizeValue } from "../../Frameworks/_shared/sizing";
|
|
4
|
+
import type { PressableProps } from "../../Frameworks/Pressable/Pressable.types";
|
|
5
|
+
import type { RadiusProps } from "../../Frameworks/Theme/Radius.types";
|
|
6
6
|
import type {
|
|
7
7
|
BorderProps,
|
|
8
8
|
ThemeSystemProps,
|
|
9
|
-
} from "
|
|
9
|
+
} from "../../Frameworks/Theme/Theme.types";
|
|
10
10
|
|
|
11
11
|
export interface PillProps extends ThemeSystemProps, RadiusProps, BorderProps {
|
|
12
12
|
"data-color-mode"?: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { IconProps } from "
|
|
2
|
-
import type { ProfileAvatarOptions } from "
|
|
1
|
+
import type { IconProps } from "../Icon/Icon.types";
|
|
2
|
+
import type { ProfileAvatarOptions } from "./Profile.types";
|
|
3
3
|
import {
|
|
4
4
|
Size,
|
|
5
5
|
type UIKitSizeValue,
|
|
6
|
-
} from "
|
|
6
|
+
} from "../../Frameworks/_shared/sizing";
|
|
7
7
|
|
|
8
8
|
const resolveFallbackAvatarIconSize = (
|
|
9
9
|
outerSize: UIKitSizeValue,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import Divider from "
|
|
4
|
-
import Icon from "
|
|
5
|
-
import { getProfileAvatarIconProps } from "
|
|
3
|
+
import Divider from "../Divider/Divider";
|
|
4
|
+
import Icon from "../Icon/Icon";
|
|
5
|
+
import { getProfileAvatarIconProps } from "./Profile.shared";
|
|
6
6
|
import type {
|
|
7
7
|
ProfileProps,
|
|
8
8
|
ProfileRole,
|
|
9
9
|
ProfileSizeOptions,
|
|
10
|
-
} from "
|
|
11
|
-
import Text from "
|
|
12
|
-
import Pressable from "
|
|
13
|
-
import View from "
|
|
10
|
+
} from "./Profile.types";
|
|
11
|
+
import Text from "../Text/Text";
|
|
12
|
+
import Pressable from "../../Frameworks/Pressable/Pressable";
|
|
13
|
+
import View from "../../Frameworks/View/View";
|
|
14
14
|
|
|
15
15
|
type ResolvedProfileSize = Required<
|
|
16
16
|
Pick<ProfileSizeOptions, "avatar" | "textType" | "badge" | "gap">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { IconProps } from "
|
|
2
|
-
import type { TextProps } from "
|
|
3
|
-
import type { UIKitSizeValue } from "
|
|
4
|
-
import type { ThemePaint } from "
|
|
1
|
+
import type { IconProps } from "../Icon/Icon.types";
|
|
2
|
+
import type { TextProps } from "../Text/Text.types";
|
|
3
|
+
import type { UIKitSizeValue } from "../../Frameworks/_shared/sizing";
|
|
4
|
+
import type { ThemePaint } from "../../Frameworks/Theme/Theme.types";
|
|
5
5
|
|
|
6
6
|
export type ProfileAvatarLoading = "eager" | "lazy";
|
|
7
7
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
2
|
import type { CSSProperties } from "react";
|
|
3
|
-
import styles from "
|
|
4
|
-
import type { ProgressProps } from "
|
|
5
|
-
import Spinner from "
|
|
6
|
-
import { resolveThemeClasses } from "
|
|
7
|
-
import View from "
|
|
3
|
+
import styles from "./Progress.module.scss";
|
|
4
|
+
import type { ProgressProps } from "./Progress.types";
|
|
5
|
+
import Spinner from "../Spinner/Spinner";
|
|
6
|
+
import { resolveThemeClasses } from "../../Frameworks/Theme/Theme.types";
|
|
7
|
+
import View from "../../Frameworks/View/View";
|
|
8
8
|
|
|
9
9
|
function clampValue(value: number, min: number, max: number) {
|
|
10
10
|
return Math.max(min, Math.min(max, value));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { CSSProperties } from "react";
|
|
2
|
-
import type { RadiusProps } from "
|
|
2
|
+
import type { RadiusProps } from "../../Frameworks/Theme/Radius.types";
|
|
3
3
|
import type {
|
|
4
4
|
ThemeBackgroundPaint,
|
|
5
5
|
ThemePaint,
|
|
6
|
-
} from "
|
|
6
|
+
} from "../../Frameworks/Theme/Theme.types";
|
|
7
7
|
|
|
8
8
|
export interface ProgressProps extends RadiusProps {
|
|
9
9
|
"data-color-mode"?: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
|
-
import styles from "
|
|
5
|
-
import type { RadioProps } from "
|
|
6
|
-
import Text from "
|
|
7
|
-
import { Size } from "
|
|
8
|
-
import View from "
|
|
4
|
+
import styles from "./Radio.module.scss";
|
|
5
|
+
import type { RadioProps } from "./Radio.types";
|
|
6
|
+
import Text from "../Text/Text";
|
|
7
|
+
import { Size } from "../../Frameworks/_shared/sizing";
|
|
8
|
+
import View from "../../Frameworks/View/View";
|
|
9
9
|
|
|
10
10
|
export default function Radio({
|
|
11
11
|
title,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { TextProps } from "
|
|
2
|
-
import type { UIKitSizeValue } from "
|
|
3
|
-
import type { RadiusProps } from "
|
|
1
|
+
import type { TextProps } from "../Text/Text.types";
|
|
2
|
+
import type { UIKitSizeValue } from "../../Frameworks/_shared/sizing";
|
|
3
|
+
import type { RadiusProps } from "../../Frameworks/Theme/Radius.types";
|
|
4
4
|
import type {
|
|
5
5
|
BorderProps,
|
|
6
6
|
ThemeSystemProps,
|
|
7
|
-
} from "
|
|
7
|
+
} from "../../Frameworks/Theme/Theme.types";
|
|
8
8
|
|
|
9
9
|
export interface RadioProps
|
|
10
10
|
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "color">,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import type { KeyboardEvent, ReactElement } from "react";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import View from "
|
|
3
|
+
import Text from "../Text/Text";
|
|
4
|
+
import Pressable from "../../Frameworks/Pressable/Pressable";
|
|
5
|
+
import View from "../../Frameworks/View/View";
|
|
6
6
|
|
|
7
7
|
interface SelectTriggerProps {
|
|
8
8
|
selectId: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import type { ReactElement } from "react";
|
|
3
|
-
import type { SelectProps } from "
|
|
4
|
-
import SelectInner from "
|
|
3
|
+
import type { SelectProps } from "./Select.types";
|
|
4
|
+
import SelectInner from "./select.inner";
|
|
5
5
|
|
|
6
6
|
export default function Select(props: SelectProps<false>): ReactElement;
|
|
7
7
|
export default function Select(props: SelectProps<true>): ReactElement;
|
|
@@ -18,7 +18,7 @@ export type SelectChangeEvent<Multiple extends boolean = false> =
|
|
|
18
18
|
| React.ChangeEvent<HTMLSelectElement>
|
|
19
19
|
| { target: { value: SelectValue<Multiple> } };
|
|
20
20
|
|
|
21
|
-
import type { LabelSharedProps } from "
|
|
21
|
+
import type { LabelSharedProps } from "../Label/Label.types";
|
|
22
22
|
|
|
23
23
|
export interface SelectProps<Multiple extends boolean = false>
|
|
24
24
|
extends LabelSharedProps {
|
|
@@ -6,19 +6,19 @@ import {
|
|
|
6
6
|
useCallback,
|
|
7
7
|
useEffect,
|
|
8
8
|
} from "react";
|
|
9
|
-
import type { SelectState } from "
|
|
9
|
+
import type { SelectState } from "./useSelectState";
|
|
10
10
|
import {
|
|
11
11
|
handleEndKey,
|
|
12
12
|
handleHomeKey,
|
|
13
13
|
isPrintableCharacter,
|
|
14
14
|
useTypeAhead,
|
|
15
|
-
} from "
|
|
16
|
-
import type { Option } from "
|
|
15
|
+
} from "../Select.keyboard";
|
|
16
|
+
import type { Option } from "../Select.types";
|
|
17
17
|
import {
|
|
18
18
|
findScrollableAncestor,
|
|
19
19
|
lockScrollElementSafe,
|
|
20
20
|
unlockScrollElementSafe,
|
|
21
|
-
} from "
|
|
21
|
+
} from "../Select.utils";
|
|
22
22
|
|
|
23
23
|
export function useSelectNavigation(
|
|
24
24
|
state: SelectState,
|
|
@@ -322,10 +322,7 @@ export function useSelectNavigation(
|
|
|
322
322
|
);
|
|
323
323
|
|
|
324
324
|
const handleControlKeyDown = useCallback(
|
|
325
|
-
(
|
|
326
|
-
e: KeyboardEvent<HTMLInputElement | HTMLButtonElement>,
|
|
327
|
-
allowSpaceSelection: boolean,
|
|
328
|
-
) => {
|
|
325
|
+
(e: KeyboardEvent<Element>, allowSpaceSelection: boolean) => {
|
|
329
326
|
if (e.key === "Tab") {
|
|
330
327
|
setOpen(false);
|
|
331
328
|
return;
|
|
@@ -436,7 +433,7 @@ export function useSelectNavigation(
|
|
|
436
433
|
const handleTriggerClick = useCallback(() => {
|
|
437
434
|
if (Date.now() < suppressClickUntilRef.current) return;
|
|
438
435
|
toggleOpenFromTrigger();
|
|
439
|
-
}, [toggleOpenFromTrigger]);
|
|
436
|
+
}, [toggleOpenFromTrigger, suppressClickUntilRef.current]);
|
|
440
437
|
const handleTriggerPointerUp = useCallback(
|
|
441
438
|
(e: ReactPointerEvent<HTMLButtonElement>) => {
|
|
442
439
|
if (e.pointerType !== "touch") return;
|
|
@@ -444,7 +441,7 @@ export function useSelectNavigation(
|
|
|
444
441
|
suppressClickUntilRef.current = Date.now() + 400;
|
|
445
442
|
toggleOpenFromTrigger();
|
|
446
443
|
},
|
|
447
|
-
[toggleOpenFromTrigger],
|
|
444
|
+
[toggleOpenFromTrigger, suppressClickUntilRef],
|
|
448
445
|
);
|
|
449
446
|
|
|
450
447
|
return {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import type { SelectState } from "
|
|
3
|
+
import type { SelectState } from "./useSelectState";
|
|
4
4
|
import type {
|
|
5
5
|
Option,
|
|
6
6
|
SelectChangeEvent,
|
|
7
7
|
SelectValue,
|
|
8
|
-
} from "
|
|
9
|
-
import { filterOptionsByQuery } from "
|
|
8
|
+
} from "../Select.types";
|
|
9
|
+
import { filterOptionsByQuery } from "../Select.utils";
|
|
10
10
|
|
|
11
11
|
export function useSelectSelection(state: SelectState) {
|
|
12
12
|
const {
|
|
@@ -8,17 +8,17 @@ import {
|
|
|
8
8
|
useRef,
|
|
9
9
|
useState,
|
|
10
10
|
} from "react";
|
|
11
|
-
import { Word } from "
|
|
11
|
+
import { Word } from "../../../../i18n/shared";
|
|
12
12
|
import type {
|
|
13
13
|
Option,
|
|
14
14
|
SelectProps,
|
|
15
|
-
} from "
|
|
15
|
+
} from "../Select.types";
|
|
16
16
|
import {
|
|
17
17
|
filterOptionsByQuery,
|
|
18
18
|
findScrollableAncestor,
|
|
19
19
|
getStringValues,
|
|
20
20
|
isOptGroup,
|
|
21
|
-
} from "
|
|
21
|
+
} from "../Select.utils";
|
|
22
22
|
|
|
23
23
|
export function useSelectState(props: SelectProps<boolean>) {
|
|
24
24
|
const t = Word();
|
|
@@ -4,14 +4,13 @@ import type {
|
|
|
4
4
|
ReactElement,
|
|
5
5
|
MouseEvent as ReactMouseEvent,
|
|
6
6
|
} from "react";
|
|
7
|
-
import Pill from "
|
|
8
|
-
import
|
|
9
|
-
import type {
|
|
10
|
-
import
|
|
11
|
-
import type { SelectValue } from "
|
|
12
|
-
import { filterOptionsByQuery } from "
|
|
13
|
-
import
|
|
14
|
-
import View from "@/packages/Frameworks/View/View";
|
|
7
|
+
import Pill from "../Pill/Pill";
|
|
8
|
+
import type { SelectNavigation } from "./hooks/useSelectNavigation";
|
|
9
|
+
import type { SelectState } from "./hooks/useSelectState";
|
|
10
|
+
import SelectTrigger from "./Select.trigger";
|
|
11
|
+
import type { SelectValue } from "./Select.types";
|
|
12
|
+
import { filterOptionsByQuery } from "./Select.utils";
|
|
13
|
+
import View from "../../Frameworks/View/View";
|
|
15
14
|
|
|
16
15
|
interface SelectControlProps {
|
|
17
16
|
state: SelectState;
|
|
@@ -54,19 +53,10 @@ export default function SelectControl({
|
|
|
54
53
|
visibleOptions,
|
|
55
54
|
} = state;
|
|
56
55
|
|
|
57
|
-
const {
|
|
58
|
-
placeholder,
|
|
59
|
-
title,
|
|
60
|
-
disabled,
|
|
61
|
-
readOnly,
|
|
62
|
-
required,
|
|
63
|
-
} = props;
|
|
56
|
+
const { placeholder, title, disabled, readOnly, required } = props;
|
|
64
57
|
|
|
65
|
-
const {
|
|
66
|
-
|
|
67
|
-
handleTriggerClick,
|
|
68
|
-
handleTriggerPointerUp,
|
|
69
|
-
} = navigation;
|
|
58
|
+
const { handleControlKeyDown, handleTriggerClick, handleTriggerPointerUp } =
|
|
59
|
+
navigation;
|
|
70
60
|
|
|
71
61
|
const selectedPills =
|
|
72
62
|
isMultiple && selectedOptions.length > 0 ? (
|
|
@@ -159,9 +149,7 @@ export default function SelectControl({
|
|
|
159
149
|
}
|
|
160
150
|
value={isMultiple ? query : inputValue}
|
|
161
151
|
placeholder={
|
|
162
|
-
isMultiple && selectedOptions.length > 0
|
|
163
|
-
? undefined
|
|
164
|
-
: placeholderText
|
|
152
|
+
isMultiple && selectedOptions.length > 0 ? undefined : placeholderText
|
|
165
153
|
}
|
|
166
154
|
className="Subheadline"
|
|
167
155
|
onFocus={() => {
|
|
@@ -186,7 +174,10 @@ export default function SelectControl({
|
|
|
186
174
|
const nextQuery = e.target.value;
|
|
187
175
|
setOpenSource("keyboard");
|
|
188
176
|
if (!isMultiple) {
|
|
189
|
-
if (
|
|
177
|
+
if (
|
|
178
|
+
selectedValues.length > 0 &&
|
|
179
|
+
nextQuery !== selectedOptionLabel
|
|
180
|
+
) {
|
|
190
181
|
setSelectedValues([]);
|
|
191
182
|
emitNativeChange("" as SelectValue<boolean>);
|
|
192
183
|
}
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
type MouseEvent as ReactMouseEvent,
|
|
6
6
|
useMemo,
|
|
7
7
|
} from "react";
|
|
8
|
-
import ContextMenu from "
|
|
9
|
-
import Icon from "
|
|
10
|
-
import Label from "
|
|
11
|
-
import { useSelectNavigation } from "
|
|
12
|
-
import { useSelectSelection } from "
|
|
13
|
-
import { useSelectState } from "
|
|
14
|
-
import type { SelectProps } from "
|
|
15
|
-
import { filterOptionsByQuery } from "
|
|
16
|
-
import SelectControl from "
|
|
17
|
-
import View from "
|
|
8
|
+
import ContextMenu from "../ContextMenu/ContextMenu";
|
|
9
|
+
import Icon from "../Icon/Icon";
|
|
10
|
+
import Label from "../Label/Label";
|
|
11
|
+
import { useSelectNavigation } from "./hooks/useSelectNavigation";
|
|
12
|
+
import { useSelectSelection } from "./hooks/useSelectSelection";
|
|
13
|
+
import { useSelectState } from "./hooks/useSelectState";
|
|
14
|
+
import type { SelectProps } from "./Select.types";
|
|
15
|
+
import { filterOptionsByQuery } from "./Select.utils";
|
|
16
|
+
import SelectControl from "./select.control";
|
|
17
|
+
import View from "../../Frameworks/View/View";
|
|
18
18
|
|
|
19
19
|
export default function SelectInner(props: SelectProps<boolean>): ReactElement {
|
|
20
20
|
const state = useSelectState(props);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SkeletonProps } from "
|
|
2
|
-
import View from "
|
|
1
|
+
import type { SkeletonProps } from "./Skeleton.types";
|
|
2
|
+
import View from "../../Frameworks/View/View";
|
|
3
3
|
|
|
4
4
|
export default function Skeleton({
|
|
5
5
|
className,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TextProps } from "
|
|
2
|
-
import type { UIKitSizeValue } from "
|
|
1
|
+
import type { TextProps } from "../Text/Text.types";
|
|
2
|
+
import type { UIKitSizeValue } from "../../Frameworks/_shared/sizing";
|
|
3
3
|
|
|
4
4
|
export interface SkeletonProps {
|
|
5
5
|
"data-color-mode"?: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
2
|
import type { CSSProperties } from "react";
|
|
3
|
-
import styles from "
|
|
4
|
-
import type { SpinnerProps } from "
|
|
5
|
-
import { Size } from "
|
|
6
|
-
import { resolveThemeClasses } from "
|
|
7
|
-
import View from "
|
|
3
|
+
import styles from "./Spinner.module.scss";
|
|
4
|
+
import type { SpinnerProps } from "./Spinner.types";
|
|
5
|
+
import { Size } from "../../Frameworks/_shared/sizing";
|
|
6
|
+
import { resolveThemeClasses } from "../../Frameworks/Theme/Theme.types";
|
|
7
|
+
import View from "../../Frameworks/View/View";
|
|
8
8
|
|
|
9
9
|
const SPINNER_SEGMENTS = 12;
|
|
10
10
|
const SPINNER_VISUAL_SCALE_BY_TYPE = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AriaRole, CSSProperties, SVGAttributes } from "react";
|
|
2
|
-
import type { UIKitSizeValue } from "
|
|
3
|
-
import type { ThemePaint } from "
|
|
2
|
+
import type { UIKitSizeValue } from "../../Frameworks/_shared/sizing";
|
|
3
|
+
import type { ThemePaint } from "../../Frameworks/Theme/Theme.types";
|
|
4
4
|
|
|
5
5
|
export interface SpinnerProps {
|
|
6
6
|
"data-color-mode"?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
|
-
import styles from "
|
|
3
|
-
import type { TextProps } from "
|
|
4
|
-
import { Size } from "
|
|
2
|
+
import styles from "./Text.module.scss";
|
|
3
|
+
import type { TextProps } from "./Text.types";
|
|
4
|
+
import { Size } from "../../Frameworks/_shared/sizing";
|
|
5
5
|
|
|
6
6
|
export default function Text({
|
|
7
7
|
children,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { UIKitSizeValue } from "
|
|
2
|
-
import type { ThemePaint } from "
|
|
1
|
+
import type { UIKitSizeValue } from "../../Frameworks/_shared/sizing";
|
|
2
|
+
import type { ThemePaint } from "../../Frameworks/Theme/Theme.types";
|
|
3
3
|
|
|
4
4
|
export interface TextProps {
|
|
5
5
|
"data-color-mode"?: string;
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
useMemo,
|
|
10
10
|
useRef,
|
|
11
11
|
} from "react";
|
|
12
|
-
import Text from "
|
|
13
|
-
import styles from "
|
|
14
|
-
import Pressable from "
|
|
15
|
-
import View from "
|
|
12
|
+
import Text from "../Text/Text";
|
|
13
|
+
import styles from "./TimePicker.module.scss";
|
|
14
|
+
import Pressable from "../../Frameworks/Pressable/Pressable";
|
|
15
|
+
import View from "../../Frameworks/View/View";
|
|
16
16
|
|
|
17
17
|
type Segment = "hour" | "minute" | "second" | "ampm";
|
|
18
18
|
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
useRef,
|
|
11
11
|
useState,
|
|
12
12
|
} from "react";
|
|
13
|
-
import Icon from "
|
|
14
|
-
import Label from "
|
|
15
|
-
import Text from "
|
|
16
|
-
import styles from "
|
|
17
|
-
import type { TimePickerProps } from "
|
|
18
|
-
import Pressable from "
|
|
19
|
-
import View from "
|
|
13
|
+
import Icon from "../Icon/Icon";
|
|
14
|
+
import Label from "../Label/Label";
|
|
15
|
+
import Text from "../Text/Text";
|
|
16
|
+
import styles from "./TimePicker.module.scss";
|
|
17
|
+
import type { TimePickerProps } from "./TimePicker.types";
|
|
18
|
+
import Pressable from "../../Frameworks/Pressable/Pressable";
|
|
19
|
+
import View from "../../Frameworks/View/View";
|
|
20
20
|
|
|
21
21
|
type Segment = "hour" | "minute" | "second" | "ampm";
|
|
22
22
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import Divider from "
|
|
2
|
-
import Icon from "
|
|
1
|
+
import Divider from "../Divider/Divider";
|
|
2
|
+
import Icon from "../Icon/Icon";
|
|
3
3
|
import type {
|
|
4
4
|
TimelineItemProps,
|
|
5
5
|
TimelineProps,
|
|
6
|
-
} from "
|
|
7
|
-
import Pressable from "
|
|
8
|
-
import View from "
|
|
6
|
+
} from "./Timeline.types";
|
|
7
|
+
import Pressable from "../../Frameworks/Pressable/Pressable";
|
|
8
|
+
import View from "../../Frameworks/View/View";
|
|
9
9
|
|
|
10
10
|
function TimelineItem({
|
|
11
11
|
item,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IconProps } from "
|
|
2
|
-
import type { PressableProps } from "
|
|
3
|
-
import type { ThemeSystemProps } from "
|
|
1
|
+
import type { IconProps } from "../Icon/Icon.types";
|
|
2
|
+
import type { PressableProps } from "../../Frameworks/Pressable/Pressable.types";
|
|
3
|
+
import type { ThemeSystemProps } from "../../Frameworks/Theme/Theme.types";
|
|
4
4
|
|
|
5
5
|
export interface TimelineItemProps {
|
|
6
6
|
children?: React.ReactNode;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import Pill from "
|
|
5
|
-
import Text from "
|
|
2
|
+
import { IconInner } from "../Icon/Icon";
|
|
3
|
+
import IconGroup from "../Icon/Icon.group";
|
|
4
|
+
import Pill from "../Pill/Pill";
|
|
5
|
+
import Text from "../Text/Text";
|
|
6
6
|
import type {
|
|
7
7
|
TitleContextItem,
|
|
8
8
|
TitleContextProps,
|
|
9
9
|
TitleProps,
|
|
10
|
-
} from "
|
|
11
|
-
import Pressable from "
|
|
12
|
-
import View from "
|
|
10
|
+
} from "./Title.types";
|
|
11
|
+
import Pressable from "../../Frameworks/Pressable/Pressable";
|
|
12
|
+
import View from "../../Frameworks/View/View";
|
|
13
13
|
|
|
14
14
|
const buildRenderKeys = <T,>(
|
|
15
15
|
items: T[],
|