@seed-design/lynx-react 0.7.1 → 0.8.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/lib/components/Accordion/Accordion.jsx +2 -2
- package/lib/components/ActionButton/ActionButton.jsx +1 -1
- package/lib/components/AlertDialog/AlertDialog.d.ts +64 -0
- package/lib/components/AlertDialog/AlertDialog.d.ts.map +1 -0
- package/lib/components/AlertDialog/AlertDialog.jsx +138 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.d.ts +2 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.d.ts.map +1 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.js +17 -0
- package/lib/components/AlertDialog/index.d.ts +3 -0
- package/lib/components/AlertDialog/index.d.ts.map +1 -0
- package/lib/components/AppBar/AppBar.d.ts +14 -1
- package/lib/components/AppBar/AppBar.d.ts.map +1 -1
- package/lib/components/AppBar/AppBar.jsx +39 -8
- package/lib/components/AppBar/AppBar.namespace.d.ts +1 -1
- package/lib/components/AppBar/AppBar.namespace.d.ts.map +1 -1
- package/lib/components/AppBar/index.d.ts +1 -1
- package/lib/components/AppBar/index.d.ts.map +1 -1
- package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts +182 -0
- package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts.map +1 -0
- package/lib/components/AttachmentDisplay/AttachmentDisplay.jsx +444 -0
- package/lib/components/AttachmentDisplay/index.d.ts +2 -0
- package/lib/components/AttachmentDisplay/index.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInput.d.ts +179 -0
- package/lib/components/AttachmentInput/AttachmentInput.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInput.jsx +520 -0
- package/lib/components/AttachmentInput/index.d.ts +2 -0
- package/lib/components/AttachmentInput/index.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/components/BottomSheet/BottomSheet.jsx +1 -7
- package/lib/components/Callout/Callout.jsx +2 -2
- package/lib/components/Checkbox/Checkbox.jsx +2 -2
- package/lib/components/Chip/Chip.jsx +2 -2
- package/lib/components/ChipTabs/ChipTabs.d.ts +41 -0
- package/lib/components/ChipTabs/ChipTabs.d.ts.map +1 -0
- package/lib/components/ChipTabs/ChipTabs.jsx +39 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.d.ts +2 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.d.ts.map +1 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.js +13 -0
- package/lib/components/ChipTabs/index.d.ts +3 -0
- package/lib/components/ChipTabs/index.d.ts.map +1 -0
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts +18 -0
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts.map +1 -0
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.jsx +113 -0
- package/lib/components/ContextualFloatingButton/index.d.ts +2 -0
- package/lib/components/ContextualFloatingButton/index.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.d.ts +87 -0
- package/lib/components/Dialog/Dialog.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.jsx +147 -0
- package/lib/components/Dialog/Dialog.namespace.d.ts +2 -0
- package/lib/components/Dialog/Dialog.namespace.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.namespace.js +18 -0
- package/lib/components/Dialog/index.d.ts +3 -0
- package/lib/components/Dialog/index.d.ts.map +1 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.d.ts +23 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.d.ts.map +1 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.jsx +76 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts +2 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts.map +1 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.namespace.js +10 -0
- package/lib/components/FloatingActionButton/index.d.ts +3 -0
- package/lib/components/FloatingActionButton/index.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts +67 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.jsx +600 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.d.ts +2 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.js +18 -0
- package/lib/components/HelpBubble/index.d.ts +3 -0
- package/lib/components/HelpBubble/index.d.ts.map +1 -0
- package/lib/components/Icon/Icon.d.ts +1 -0
- package/lib/components/Icon/Icon.d.ts.map +1 -1
- package/lib/components/Icon/Icon.jsx +2 -1
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts +28 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts.map +1 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.jsx +37 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts +2 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts.map +1 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.js +9 -0
- package/lib/components/IdentityPlaceholder/identity-placeholder-business.js +4 -0
- package/lib/components/IdentityPlaceholder/identity-placeholder-person.js +4 -0
- package/lib/components/IdentityPlaceholder/index.d.ts +3 -0
- package/lib/components/IdentityPlaceholder/index.d.ts.map +1 -0
- package/lib/components/InputButton/InputButton.d.ts +2 -0
- package/lib/components/InputButton/InputButton.d.ts.map +1 -1
- package/lib/components/InputButton/InputButton.jsx +40 -8
- package/lib/components/List/List.d.ts +1 -1
- package/lib/components/List/List.d.ts.map +1 -1
- package/lib/components/List/List.jsx +26 -12
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.jsx +15 -5
- package/lib/components/PageBanner/PageBanner.d.ts +3 -0
- package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
- package/lib/components/PageBanner/PageBanner.jsx +49 -11
- package/lib/components/QuantityPicker/QuantityPicker.d.ts +53 -0
- package/lib/components/QuantityPicker/QuantityPicker.d.ts.map +1 -0
- package/lib/components/QuantityPicker/QuantityPicker.jsx +282 -0
- package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts +2 -0
- package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts.map +1 -0
- package/lib/components/QuantityPicker/QuantityPicker.namespace.js +11 -0
- package/lib/components/QuantityPicker/index.d.ts +3 -0
- package/lib/components/QuantityPicker/index.d.ts.map +1 -0
- package/lib/components/RadioGroup/RadioGroup.jsx +2 -2
- package/lib/components/ReactionButton/ReactionButton.d.ts +1 -1
- package/lib/components/ReactionButton/ReactionButton.d.ts.map +1 -1
- package/lib/components/ReactionButton/ReactionButton.jsx +22 -13
- package/lib/components/ScrollFog/ScrollFog.d.ts +41 -0
- package/lib/components/ScrollFog/ScrollFog.d.ts.map +1 -0
- package/lib/components/ScrollFog/ScrollFog.jsx +65 -0
- package/lib/components/ScrollFog/index.d.ts +2 -0
- package/lib/components/ScrollFog/index.d.ts.map +1 -0
- package/lib/components/SegmentedControl/SegmentedControl.jsx +2 -2
- package/lib/components/Select/Select.d.ts +112 -0
- package/lib/components/Select/Select.d.ts.map +1 -0
- package/lib/components/Select/Select.jsx +885 -0
- package/lib/components/Select/Select.namespace.d.ts +2 -0
- package/lib/components/Select/Select.namespace.d.ts.map +1 -0
- package/lib/components/Select/Select.namespace.js +23 -0
- package/lib/components/Select/index.d.ts +3 -0
- package/lib/components/Select/index.d.ts.map +1 -0
- package/lib/components/Skeleton/Skeleton.d.ts +15 -0
- package/lib/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/lib/components/Skeleton/Skeleton.jsx +18 -0
- package/lib/components/Skeleton/index.d.ts +2 -0
- package/lib/components/Skeleton/index.d.ts.map +1 -0
- package/lib/components/Slider/Slider.d.ts +101 -0
- package/lib/components/Slider/Slider.d.ts.map +1 -0
- package/lib/components/Slider/Slider.jsx +573 -0
- package/lib/components/Slider/Slider.namespace.d.ts +2 -0
- package/lib/components/Slider/Slider.namespace.d.ts.map +1 -0
- package/lib/components/Slider/Slider.namespace.js +19 -0
- package/lib/components/Slider/Slider.utils.d.ts +19 -0
- package/lib/components/Slider/Slider.utils.d.ts.map +1 -0
- package/lib/components/Slider/Slider.utils.js +106 -0
- package/lib/components/Slider/index.d.ts +3 -0
- package/lib/components/Slider/index.d.ts.map +1 -0
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.d.ts.map +1 -1
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.jsx +22 -8
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.jsx +5 -3
- package/lib/components/Tabs/Tabs.d.ts +34 -2
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.jsx +186 -56
- package/lib/components/Tabs/Tabs.utils.d.ts +14 -1
- package/lib/components/Tabs/Tabs.utils.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.utils.js +24 -3
- package/lib/components/Tabs/index.d.ts +1 -1
- package/lib/components/Tabs/index.d.ts.map +1 -1
- package/lib/components/index.d.ts +14 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/hooks/useControllableState.d.ts +1 -14
- package/lib/hooks/useControllableState.d.ts.map +1 -1
- package/lib/hooks/usePressTap.d.ts +1 -27
- package/lib/hooks/usePressTap.d.ts.map +1 -1
- package/lib/index.js +29 -6
- package/lib/{hooks/useControllableState.js → packages/lynx-react-headless/use-controllable-state/lib/index.js} +2 -3
- package/lib/{hooks/usePressTap.js → packages/lynx-react-headless/use-press-tap/lib/index.js} +13 -10
- package/lib/types.d.ts +1 -0
- package/lib/types.d.ts.map +1 -1
- package/package.json +9 -5
- package/src/components/AlertDialog/AlertDialog.namespace.ts +22 -0
- package/src/components/AlertDialog/AlertDialog.test.tsx +226 -0
- package/src/components/AlertDialog/AlertDialog.tsx +374 -0
- package/src/components/AlertDialog/index.ts +24 -0
- package/src/components/AppBar/AppBar.namespace.ts +1 -0
- package/src/components/AppBar/AppBar.test.tsx +231 -0
- package/src/components/AppBar/AppBar.tsx +105 -13
- package/src/components/AppBar/index.ts +1 -0
- package/src/components/AttachmentDisplay/AttachmentDisplay.tsx +886 -0
- package/src/components/AttachmentDisplay/index.ts +48 -0
- package/src/components/AttachmentInput/AttachmentInput.tsx +1001 -0
- package/src/components/AttachmentInput/index.ts +49 -0
- package/src/components/BottomSheet/BottomSheet.test.tsx +22 -7
- package/src/components/BottomSheet/BottomSheet.tsx +1 -19
- package/src/components/ChipTabs/ChipTabs.namespace.ts +14 -0
- package/src/components/ChipTabs/ChipTabs.tsx +119 -0
- package/src/components/ChipTabs/index.ts +16 -0
- package/src/components/ContextualFloatingButton/ContextualFloatingButton.test.tsx +63 -0
- package/src/components/ContextualFloatingButton/ContextualFloatingButton.tsx +232 -0
- package/src/components/ContextualFloatingButton/index.ts +4 -0
- package/src/components/Dialog/Dialog.namespace.ts +24 -0
- package/src/components/Dialog/Dialog.test.tsx +172 -0
- package/src/components/Dialog/Dialog.tsx +373 -0
- package/src/components/Dialog/index.ts +26 -0
- package/src/components/FloatingActionButton/FloatingActionButton.namespace.ts +8 -0
- package/src/components/FloatingActionButton/FloatingActionButton.test.tsx +59 -0
- package/src/components/FloatingActionButton/FloatingActionButton.tsx +207 -0
- package/src/components/FloatingActionButton/index.ts +10 -0
- package/src/components/HelpBubble/HelpBubble.namespace.ts +24 -0
- package/src/components/HelpBubble/HelpBubble.tsx +998 -0
- package/src/components/HelpBubble/index.ts +26 -0
- package/src/components/Icon/Icon.test.tsx +0 -3
- package/src/components/Icon/Icon.tsx +11 -1
- package/src/components/IdentityPlaceholder/IdentityPlaceholder.namespace.ts +6 -0
- package/src/components/IdentityPlaceholder/IdentityPlaceholder.tsx +103 -0
- package/src/components/IdentityPlaceholder/assets.d.ts +4 -0
- package/src/components/IdentityPlaceholder/identity-placeholder-business.webp +0 -0
- package/src/components/IdentityPlaceholder/identity-placeholder-person.webp +0 -0
- package/src/components/IdentityPlaceholder/index.ts +8 -0
- package/src/components/InputButton/InputButton.test.tsx +128 -1
- package/src/components/InputButton/InputButton.tsx +60 -9
- package/src/components/List/List.test.tsx +54 -2
- package/src/components/List/List.tsx +43 -10
- package/src/components/Menu/Menu.tsx +14 -4
- package/src/components/Menu/__tests__/Menu.test.tsx +34 -0
- package/src/components/PageBanner/PageBanner.test.tsx +110 -3
- package/src/components/PageBanner/PageBanner.tsx +83 -19
- package/src/components/QuantityPicker/QuantityPicker.namespace.ts +10 -0
- package/src/components/QuantityPicker/QuantityPicker.test.tsx +235 -0
- package/src/components/QuantityPicker/QuantityPicker.tsx +605 -0
- package/src/components/QuantityPicker/index.ts +14 -0
- package/src/components/ReactionButton/ReactionButton.feedback.test.tsx +50 -0
- package/src/components/ReactionButton/ReactionButton.test.tsx +5 -3
- package/src/components/ReactionButton/ReactionButton.tsx +20 -12
- package/src/components/ScrollFog/ScrollFog.test.tsx +222 -0
- package/src/components/ScrollFog/ScrollFog.tsx +172 -0
- package/src/components/ScrollFog/index.ts +1 -0
- package/src/components/Select/Select.namespace.ts +34 -0
- package/src/components/Select/Select.test.tsx +297 -0
- package/src/components/Select/Select.tsx +1483 -0
- package/src/components/Select/index.ts +39 -0
- package/src/components/Skeleton/Skeleton.test.tsx +64 -0
- package/src/components/Skeleton/Skeleton.tsx +45 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Slider/Slider.namespace.ts +26 -0
- package/src/components/Slider/Slider.test.tsx +260 -0
- package/src/components/Slider/Slider.tsx +897 -0
- package/src/components/Slider/Slider.utils.ts +167 -0
- package/src/components/Slider/index.ts +30 -0
- package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.test.tsx +21 -1
- package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.tsx +30 -7
- package/src/components/Switch/Switch.tsx +14 -13
- package/src/components/Tabs/Tabs.test.tsx +218 -1
- package/src/components/Tabs/Tabs.tsx +346 -75
- package/src/components/Tabs/Tabs.utils.ts +51 -1
- package/src/components/Tabs/index.ts +17 -1
- package/src/components/index.ts +14 -0
- package/src/hooks/useControllableState.ts +1 -43
- package/src/hooks/usePressTap.test.ts +23 -11
- package/src/hooks/usePressTap.ts +1 -60
- package/src/types.ts +1 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { QuantityPickerVariantProps } from '@seed-design/lynx-css/recipes/quantity-picker';
|
|
2
|
+
import { LynxAccessibilityProps, LynxStyledElementProps, LynxTouchProps } from '../../types';
|
|
3
|
+
import * as React from "@lynx-js/react";
|
|
4
|
+
export type QuantityPickerLoading = boolean | {
|
|
5
|
+
decrement?: boolean;
|
|
6
|
+
increment?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type QuantityPickerGetValueText = (valueText: string, value: number | string) => React.ReactNode;
|
|
9
|
+
type QuantityPickerRootBaseProps = Omit<LynxStyledElementProps, "children"> & LynxAccessibilityProps & {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
min: number;
|
|
12
|
+
max: number;
|
|
13
|
+
step?: number;
|
|
14
|
+
value?: number;
|
|
15
|
+
defaultValue?: number;
|
|
16
|
+
onValueChange?: (value: number) => void;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
invalid?: boolean;
|
|
19
|
+
readOnly?: boolean;
|
|
20
|
+
loading?: QuantityPickerLoading;
|
|
21
|
+
onRemove?: () => void;
|
|
22
|
+
getValueText?: QuantityPickerGetValueText;
|
|
23
|
+
dir?: "ltr" | "rtl";
|
|
24
|
+
layout?: QuantityPickerVariantProps["layout"];
|
|
25
|
+
size?: QuantityPickerVariantProps["size"];
|
|
26
|
+
};
|
|
27
|
+
type QuantityPickerRemovableProps = {
|
|
28
|
+
removable: true;
|
|
29
|
+
removeAccessibilityLabel: string;
|
|
30
|
+
onRemove: () => void;
|
|
31
|
+
};
|
|
32
|
+
type QuantityPickerNonRemovableProps = {
|
|
33
|
+
removable?: false;
|
|
34
|
+
removeAccessibilityLabel?: string;
|
|
35
|
+
};
|
|
36
|
+
export type QuantityPickerRootProps = QuantityPickerRootBaseProps & (QuantityPickerRemovableProps | QuantityPickerNonRemovableProps);
|
|
37
|
+
export interface QuantityPickerDecrementButtonProps extends LynxStyledElementProps, LynxTouchProps, LynxAccessibilityProps {
|
|
38
|
+
icon?: React.ReactNode;
|
|
39
|
+
loadingIndicator?: React.ReactNode;
|
|
40
|
+
removeIcon?: React.ReactNode;
|
|
41
|
+
}
|
|
42
|
+
export interface QuantityPickerValueDisplayProps extends Omit<LynxStyledElementProps, "children">, LynxAccessibilityProps {
|
|
43
|
+
}
|
|
44
|
+
export interface QuantityPickerIncrementButtonProps extends LynxStyledElementProps, LynxTouchProps, LynxAccessibilityProps {
|
|
45
|
+
icon?: React.ReactNode;
|
|
46
|
+
loadingIndicator?: React.ReactNode;
|
|
47
|
+
}
|
|
48
|
+
export declare const QuantityPickerRoot: React.ForwardRefExoticComponent<QuantityPickerRootProps & React.RefAttributes<unknown>>;
|
|
49
|
+
export declare const QuantityPickerDecrementButton: React.ForwardRefExoticComponent<QuantityPickerDecrementButtonProps & React.RefAttributes<unknown>>;
|
|
50
|
+
export declare const QuantityPickerValueDisplay: React.ForwardRefExoticComponent<QuantityPickerValueDisplayProps & React.RefAttributes<unknown>>;
|
|
51
|
+
export declare const QuantityPickerIncrementButton: React.ForwardRefExoticComponent<QuantityPickerIncrementButtonProps & React.RefAttributes<unknown>>;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=QuantityPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuantityPicker.d.ts","sourceRoot":"","sources":["../../../src/components/QuantityPicker/QuantityPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,+CAA+C,CAAC;AAEvD,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAKxC,OAAO,KAAK,EACV,sBAAsB,EAEtB,sBAAsB,EACtB,cAAc,EAEf,MAAM,aAAa,CAAC;AAIrB,MAAM,MAAM,qBAAqB,GAC7B,OAAO,GACP;IACE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEN,MAAM,MAAM,0BAA0B,GAAG,CACvC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GAAG,MAAM,KACnB,KAAK,CAAC,SAAS,CAAC;AAIrB,KAAK,2BAA2B,GAAG,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,GACzE,sBAAsB,GAAG;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,CAAC,EAAE,0BAA0B,CAAC;IAC1C,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,MAAM,CAAC,EAAE,0BAA0B,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,CAAC,EAAE,0BAA0B,CAAC,MAAM,CAAC,CAAC;CAC3C,CAAC;AAEJ,KAAK,4BAA4B,GAAG;IAClC,SAAS,EAAE,IAAI,CAAC;IAChB,wBAAwB,EAAE,MAAM,CAAC;IACjC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,KAAK,+BAA+B,GAAG;IACrC,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,2BAA2B,GAC/D,CAAC,4BAA4B,GAAG,+BAA+B,CAAC,CAAC;AAEnE,MAAM,WAAW,kCACf,SAAQ,sBAAsB,EAC5B,cAAc,EACd,sBAAsB;IACxB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,+BACf,SAAQ,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,EAC9C,sBAAsB;CAAG;AAE7B,MAAM,WAAW,kCACf,SAAQ,sBAAsB,EAC5B,cAAc,EACd,sBAAsB;IACxB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC;AAiMD,eAAO,MAAM,kBAAkB,yFAoJ9B,CAAC;AAGF,eAAO,MAAM,6BAA6B,oGAsExC,CAAC;AAGH,eAAO,MAAM,0BAA0B,iGA6BrC,CAAC;AAGH,eAAO,MAAM,6BAA6B,oGAkExC,CAAC"}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { useControllableState } from "../../packages/lynx-react-headless/use-controllable-state/lib/index.js";
|
|
2
|
+
import { usePressTap } from "../../packages/lynx-react-headless/use-press-tap/lib/index.js";
|
|
3
|
+
import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
|
|
4
|
+
import { mergeProps } from "../../utils/merge-props.js";
|
|
5
|
+
import { InternalIcon } from "../Icon/Icon.jsx";
|
|
6
|
+
import * as React from "@lynx-js/react";
|
|
7
|
+
import clsx from "clsx";
|
|
8
|
+
import { quantityPicker } from "@seed-design/lynx-css/recipes/quantity-picker";
|
|
9
|
+
//#region src/components/QuantityPicker/QuantityPicker.tsx
|
|
10
|
+
var defaultGetValueText = (valueText) => valueText;
|
|
11
|
+
var QuantityPickerContext = React.createContext(null);
|
|
12
|
+
function useQuantityPickerContext(consumer) {
|
|
13
|
+
const context = React.useContext(QuantityPickerContext);
|
|
14
|
+
if (!context) throw new Error(`<${consumer}/> must be rendered inside <QuantityPickerRoot/>.`);
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
function assertSafeInteger(value, name) {
|
|
18
|
+
if (!Number.isSafeInteger(value)) throw new Error(`QuantityPicker: ${name} must be a safe integer.`);
|
|
19
|
+
}
|
|
20
|
+
function validateProps({ defaultValue, max, min, step, value }) {
|
|
21
|
+
assertSafeInteger(min, "min");
|
|
22
|
+
assertSafeInteger(max, "max");
|
|
23
|
+
assertSafeInteger(step, "step");
|
|
24
|
+
if (min > max) throw new Error("QuantityPicker: min must be less than or equal to max.");
|
|
25
|
+
if (step <= 0) throw new Error("QuantityPicker: step must be greater than 0.");
|
|
26
|
+
for (const [name, candidate] of [["value", value], ["defaultValue", defaultValue]]) {
|
|
27
|
+
if (candidate === void 0) continue;
|
|
28
|
+
assertSafeInteger(candidate, name);
|
|
29
|
+
if (candidate < min || candidate > max) throw new Error(`QuantityPicker: ${name} must be between min and max.`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function getLoadingState(loading) {
|
|
33
|
+
if (loading === true) return {
|
|
34
|
+
decrement: true,
|
|
35
|
+
increment: true
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
decrement: typeof loading === "object" ? loading?.decrement ?? false : false,
|
|
39
|
+
increment: typeof loading === "object" ? loading?.increment ?? false : false
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function getValueDisplayPlaceholder(min, max) {
|
|
43
|
+
const boundary = String(min).length > String(max).length ? min : max;
|
|
44
|
+
return String(boundary).replace(/\d/g, "0");
|
|
45
|
+
}
|
|
46
|
+
function getAccessibleText(valueText, value) {
|
|
47
|
+
return typeof valueText === "string" || typeof valueText === "number" ? String(valueText) : String(value);
|
|
48
|
+
}
|
|
49
|
+
function recipeProps(context, pressed = false) {
|
|
50
|
+
return {
|
|
51
|
+
layout: context.layout,
|
|
52
|
+
size: context.size,
|
|
53
|
+
invalid: context.invalid,
|
|
54
|
+
disabled: context.disabled,
|
|
55
|
+
pressed,
|
|
56
|
+
loading: context.loading ?? false
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function isQuantityPickerButton(child) {
|
|
60
|
+
return React.isValidElement(child) && (child.type === QuantityPickerDecrementButton || child.type === QuantityPickerIncrementButton);
|
|
61
|
+
}
|
|
62
|
+
function isQuantityPickerValueDisplay(child) {
|
|
63
|
+
return React.isValidElement(child) && child.type === QuantityPickerValueDisplay;
|
|
64
|
+
}
|
|
65
|
+
function flattenQuantityPickerChildren(children) {
|
|
66
|
+
if (children == null || typeof children === "boolean") return [];
|
|
67
|
+
if (Array.isArray(children)) return children.flatMap(flattenQuantityPickerChildren);
|
|
68
|
+
if (React.isValidElement(children) && children.type === React.Fragment) return flattenQuantityPickerChildren(children.props.children);
|
|
69
|
+
return [children];
|
|
70
|
+
}
|
|
71
|
+
function withDividers(children, dividerClassName) {
|
|
72
|
+
const childArray = flattenQuantityPickerChildren(children);
|
|
73
|
+
return childArray.flatMap((child, index) => {
|
|
74
|
+
const nextChild = childArray[index + 1];
|
|
75
|
+
if (!(isQuantityPickerButton(child) && isQuantityPickerValueDisplay(nextChild) || isQuantityPickerValueDisplay(child) && isQuantityPickerButton(nextChild))) return [child];
|
|
76
|
+
return [child, <view key={isQuantityPickerValueDisplay(child) ? "quantity-picker-divider-after-value" : "quantity-picker-divider-before-value"} accessibility-elements-hidden={true} className={dividerClassName} />];
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function renderActionContent(icon, loadingIndicator, children, className, loading) {
|
|
80
|
+
if (loading) {
|
|
81
|
+
const content = loadingIndicator ?? children;
|
|
82
|
+
return <view className={className} accessibility-elements-hidden={true}>
|
|
83
|
+
{typeof content === "string" || typeof content === "number" ? <text>{content}</text> : content}
|
|
84
|
+
</view>;
|
|
85
|
+
}
|
|
86
|
+
if (icon == null) return typeof children === "string" || typeof children === "number" ? <text className={className}>{children}</text> : children;
|
|
87
|
+
if (typeof icon === "string" || typeof icon === "number") return <text className={className}>{icon}</text>;
|
|
88
|
+
if (!React.isValidElement(icon)) return icon;
|
|
89
|
+
return <InternalIcon icon={icon} className={className} accessibility-elements-hidden={true} />;
|
|
90
|
+
}
|
|
91
|
+
var QuantityPickerRoot = React.forwardRef((props, ref) => {
|
|
92
|
+
const { loading, ...propsWithoutLoading } = props;
|
|
93
|
+
const [variantProps, otherProps] = quantityPicker.splitVariantProps(propsWithoutLoading);
|
|
94
|
+
const { disabled = false, invalid = false, layout: layoutProp = "hug", size: sizeProp = "medium" } = variantProps;
|
|
95
|
+
const { children, className, min, max, step: stepProp = 1, value: valueProp, defaultValue, onValueChange, readOnly = false, onRemove, getValueText = defaultGetValueText, dir = "ltr", removable = false, removeAccessibilityLabel, "accessibility-element": accessibilityElement = true, "accessibility-role-description": accessibilityRoleDescription = "quantity picker", "accessibility-traits": accessibilityTraits, "accessibility-value": accessibilityValue, ...nativeProps } = otherProps;
|
|
96
|
+
validateProps({
|
|
97
|
+
min,
|
|
98
|
+
max,
|
|
99
|
+
step: stepProp,
|
|
100
|
+
value: valueProp,
|
|
101
|
+
defaultValue
|
|
102
|
+
});
|
|
103
|
+
const initialValue = defaultValue ?? min;
|
|
104
|
+
assertSafeInteger(initialValue, "defaultValue");
|
|
105
|
+
if (initialValue < min || initialValue > max) throw new Error("QuantityPicker: defaultValue must be between min and max.");
|
|
106
|
+
const [value, setValue] = useControllableState({
|
|
107
|
+
value: valueProp,
|
|
108
|
+
defaultValue: initialValue,
|
|
109
|
+
onChange: onValueChange
|
|
110
|
+
});
|
|
111
|
+
const loadingState = getLoadingState(loading);
|
|
112
|
+
const isAtMin = value === min;
|
|
113
|
+
const isAtMax = value === max;
|
|
114
|
+
const isRemoveButton = removable && isAtMin;
|
|
115
|
+
const decrementDisabled = disabled || !isRemoveButton && isAtMin;
|
|
116
|
+
const incrementDisabled = disabled || isAtMax;
|
|
117
|
+
const decrementBlocked = decrementDisabled || readOnly || loadingState.decrement;
|
|
118
|
+
const incrementBlocked = incrementDisabled || readOnly || loadingState.increment;
|
|
119
|
+
const decrement = React.useCallback(() => {
|
|
120
|
+
"background only";
|
|
121
|
+
if (isRemoveButton) {
|
|
122
|
+
if (!decrementBlocked) onRemove?.();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (!decrementBlocked) setValue(Math.max(value - stepProp, min));
|
|
126
|
+
}, [
|
|
127
|
+
decrementBlocked,
|
|
128
|
+
isRemoveButton,
|
|
129
|
+
min,
|
|
130
|
+
onRemove,
|
|
131
|
+
setValue,
|
|
132
|
+
stepProp,
|
|
133
|
+
value
|
|
134
|
+
]);
|
|
135
|
+
const increment = React.useCallback(() => {
|
|
136
|
+
"background only";
|
|
137
|
+
if (!incrementBlocked) setValue(Math.min(value + stepProp, max));
|
|
138
|
+
}, [
|
|
139
|
+
incrementBlocked,
|
|
140
|
+
max,
|
|
141
|
+
setValue,
|
|
142
|
+
stepProp,
|
|
143
|
+
value
|
|
144
|
+
]);
|
|
145
|
+
const classes = quantityPicker(recipeProps({
|
|
146
|
+
layout: layoutProp,
|
|
147
|
+
size: sizeProp,
|
|
148
|
+
invalid,
|
|
149
|
+
disabled,
|
|
150
|
+
loading: loadingState.decrement || loadingState.increment
|
|
151
|
+
}));
|
|
152
|
+
const displayValue = getValueText(String(value), value);
|
|
153
|
+
const contextValue = React.useMemo(() => ({
|
|
154
|
+
layout: layoutProp,
|
|
155
|
+
size: sizeProp,
|
|
156
|
+
invalid,
|
|
157
|
+
disabled,
|
|
158
|
+
readOnly,
|
|
159
|
+
loading: loadingState.decrement || loadingState.increment,
|
|
160
|
+
value,
|
|
161
|
+
min,
|
|
162
|
+
max,
|
|
163
|
+
step: stepProp,
|
|
164
|
+
dir,
|
|
165
|
+
removable,
|
|
166
|
+
isAtMin,
|
|
167
|
+
isAtMax,
|
|
168
|
+
isRemoveButton,
|
|
169
|
+
removeAccessibilityLabel,
|
|
170
|
+
getValueText,
|
|
171
|
+
decrementLoading: loadingState.decrement,
|
|
172
|
+
incrementLoading: loadingState.increment,
|
|
173
|
+
decrementBlocked,
|
|
174
|
+
incrementBlocked,
|
|
175
|
+
decrement,
|
|
176
|
+
increment,
|
|
177
|
+
onRemove,
|
|
178
|
+
classes
|
|
179
|
+
}), [
|
|
180
|
+
classes,
|
|
181
|
+
decrement,
|
|
182
|
+
decrementBlocked,
|
|
183
|
+
disabled,
|
|
184
|
+
dir,
|
|
185
|
+
getValueText,
|
|
186
|
+
increment,
|
|
187
|
+
incrementBlocked,
|
|
188
|
+
invalid,
|
|
189
|
+
isAtMax,
|
|
190
|
+
isAtMin,
|
|
191
|
+
isRemoveButton,
|
|
192
|
+
loadingState.decrement,
|
|
193
|
+
loadingState.increment,
|
|
194
|
+
max,
|
|
195
|
+
min,
|
|
196
|
+
onRemove,
|
|
197
|
+
readOnly,
|
|
198
|
+
removeAccessibilityLabel,
|
|
199
|
+
removable,
|
|
200
|
+
layoutProp,
|
|
201
|
+
sizeProp,
|
|
202
|
+
value
|
|
203
|
+
]);
|
|
204
|
+
const orderedChildren = flattenQuantityPickerChildren(children);
|
|
205
|
+
if (dir === "rtl") orderedChildren.reverse();
|
|
206
|
+
return <QuantityPickerContext.Provider value={contextValue}>
|
|
207
|
+
<view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classes.root, className)} accessibility-element={accessibilityElement} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits ?? (disabled ? "disabled" : void 0)} accessibility-value={accessibilityValue ?? getAccessibleText(displayValue, value)}>
|
|
208
|
+
{withDividers(orderedChildren, classes.divider)}
|
|
209
|
+
</view>
|
|
210
|
+
</QuantityPickerContext.Provider>;
|
|
211
|
+
});
|
|
212
|
+
QuantityPickerRoot.displayName = "QuantityPickerRoot";
|
|
213
|
+
var QuantityPickerDecrementButton = React.forwardRef((props, ref) => {
|
|
214
|
+
const context = useQuantityPickerContext("QuantityPickerDecrementButton");
|
|
215
|
+
const { children, className, style, icon, loadingIndicator, removeIcon, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-role-description": accessibilityRoleDescription = "button", "accessibility-traits": accessibilityTraits, ...nativeProps } = props;
|
|
216
|
+
const { pressed, bindtouchstart, bindtouchend, bindtouchcancel, ...pressHandlers } = usePressTap({
|
|
217
|
+
disabled: context.decrementBlocked,
|
|
218
|
+
onTap: (...args) => {
|
|
219
|
+
context.decrement();
|
|
220
|
+
bindtap?.(...args);
|
|
221
|
+
},
|
|
222
|
+
mainThreadOnTap: mainThreadBindtap
|
|
223
|
+
});
|
|
224
|
+
const classes = quantityPicker(recipeProps({
|
|
225
|
+
...context,
|
|
226
|
+
loading: context.decrementLoading,
|
|
227
|
+
disabled: context.decrementBlocked
|
|
228
|
+
}, pressed && !context.decrementBlocked));
|
|
229
|
+
const scaleFeedback = useScaleFeedback({
|
|
230
|
+
disabled: context.decrementBlocked,
|
|
231
|
+
onTouchStart: bindtouchstart,
|
|
232
|
+
onTouchEnd: bindtouchend,
|
|
233
|
+
onTouchCancel: bindtouchcancel
|
|
234
|
+
});
|
|
235
|
+
const iconContent = context.isRemoveButton ? removeIcon ?? icon : icon;
|
|
236
|
+
return <view {...mergeProps(ref ? { ref } : {}, scaleFeedback.scaleFeedbackTargetProps, scaleFeedback.scaleFeedbackTriggerProps, pressHandlers, nativeProps)} className={clsx(classes.decrementButton, className)} style={style} accessibility-element={accessibilityElement} accessibility-label={context.isRemoveButton ? context.removeAccessibilityLabel : accessibilityLabel} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits ?? (context.decrementBlocked ? "disabled" : "button")}>
|
|
237
|
+
{renderActionContent(iconContent, loadingIndicator, children, classes.decrementIcon, context.decrementLoading)}
|
|
238
|
+
</view>;
|
|
239
|
+
});
|
|
240
|
+
QuantityPickerDecrementButton.displayName = "QuantityPickerDecrementButton";
|
|
241
|
+
var QuantityPickerValueDisplay = React.forwardRef((props, ref) => {
|
|
242
|
+
const context = useQuantityPickerContext("QuantityPickerValueDisplay");
|
|
243
|
+
const { className, style, "accessibility-elements-hidden": accessibilityElementsHidden = true, ...nativeProps } = props;
|
|
244
|
+
const valueText = context.getValueText(String(context.value), context.value);
|
|
245
|
+
const placeholderText = getValueDisplayPlaceholder(context.min, context.max);
|
|
246
|
+
return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(quantityPicker(recipeProps(context)).valueDisplay, className)} style={style} accessibility-elements-hidden={accessibilityElementsHidden}>
|
|
247
|
+
<text accessibility-elements-hidden={true} className={quantityPicker(recipeProps(context)).valueDisplayPlaceholder}>
|
|
248
|
+
{context.getValueText(placeholderText, placeholderText)}
|
|
249
|
+
</text>
|
|
250
|
+
<text className={quantityPicker(recipeProps(context)).valueDisplayText}>{valueText}</text>
|
|
251
|
+
</view>;
|
|
252
|
+
});
|
|
253
|
+
QuantityPickerValueDisplay.displayName = "QuantityPickerValueDisplay";
|
|
254
|
+
var QuantityPickerIncrementButton = React.forwardRef((props, ref) => {
|
|
255
|
+
const context = useQuantityPickerContext("QuantityPickerIncrementButton");
|
|
256
|
+
const { children, className, style, icon, loadingIndicator, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-role-description": accessibilityRoleDescription = "button", "accessibility-traits": accessibilityTraits, ...nativeProps } = props;
|
|
257
|
+
const { pressed, bindtouchstart, bindtouchend, bindtouchcancel, ...pressHandlers } = usePressTap({
|
|
258
|
+
disabled: context.incrementBlocked,
|
|
259
|
+
onTap: (...args) => {
|
|
260
|
+
context.increment();
|
|
261
|
+
bindtap?.(...args);
|
|
262
|
+
},
|
|
263
|
+
mainThreadOnTap: mainThreadBindtap
|
|
264
|
+
});
|
|
265
|
+
const classes = quantityPicker(recipeProps({
|
|
266
|
+
...context,
|
|
267
|
+
loading: context.incrementLoading,
|
|
268
|
+
disabled: context.incrementBlocked
|
|
269
|
+
}, pressed && !context.incrementBlocked));
|
|
270
|
+
const scaleFeedback = useScaleFeedback({
|
|
271
|
+
disabled: context.incrementBlocked,
|
|
272
|
+
onTouchStart: bindtouchstart,
|
|
273
|
+
onTouchEnd: bindtouchend,
|
|
274
|
+
onTouchCancel: bindtouchcancel
|
|
275
|
+
});
|
|
276
|
+
return <view {...mergeProps(ref ? { ref } : {}, scaleFeedback.scaleFeedbackTargetProps, scaleFeedback.scaleFeedbackTriggerProps, pressHandlers, nativeProps)} className={clsx(classes.incrementButton, className)} style={style} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits ?? (context.incrementBlocked ? "disabled" : "button")}>
|
|
277
|
+
{renderActionContent(icon, loadingIndicator, children, classes.incrementIcon, context.incrementLoading)}
|
|
278
|
+
</view>;
|
|
279
|
+
});
|
|
280
|
+
QuantityPickerIncrementButton.displayName = "QuantityPickerIncrementButton";
|
|
281
|
+
//#endregion
|
|
282
|
+
export { QuantityPickerDecrementButton, QuantityPickerIncrementButton, QuantityPickerRoot, QuantityPickerValueDisplay };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { QuantityPickerRoot as Root, QuantityPickerDecrementButton as DecrementButton, QuantityPickerValueDisplay as ValueDisplay, QuantityPickerIncrementButton as IncrementButton, type QuantityPickerRootProps as RootProps, type QuantityPickerDecrementButtonProps as DecrementButtonProps, type QuantityPickerValueDisplayProps as ValueDisplayProps, type QuantityPickerIncrementButtonProps as IncrementButtonProps, } from './QuantityPicker';
|
|
2
|
+
//# sourceMappingURL=QuantityPicker.namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuantityPicker.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/QuantityPicker/QuantityPicker.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,IAAI,IAAI,EAC1B,6BAA6B,IAAI,eAAe,EAChD,0BAA0B,IAAI,YAAY,EAC1C,6BAA6B,IAAI,eAAe,EAChD,KAAK,uBAAuB,IAAI,SAAS,EACzC,KAAK,kCAAkC,IAAI,oBAAoB,EAC/D,KAAK,+BAA+B,IAAI,iBAAiB,EACzD,KAAK,kCAAkC,IAAI,oBAAoB,GAChE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { QuantityPickerDecrementButton, QuantityPickerIncrementButton, QuantityPickerRoot, QuantityPickerValueDisplay } from "./QuantityPicker.jsx";
|
|
3
|
+
//#region src/components/QuantityPicker/QuantityPicker.namespace.ts
|
|
4
|
+
var QuantityPicker_namespace_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
DecrementButton: () => QuantityPickerDecrementButton,
|
|
6
|
+
IncrementButton: () => QuantityPickerIncrementButton,
|
|
7
|
+
Root: () => QuantityPickerRoot,
|
|
8
|
+
ValueDisplay: () => QuantityPickerValueDisplay
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { QuantityPicker_namespace_exports };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { QuantityPickerRoot, QuantityPickerDecrementButton, QuantityPickerValueDisplay, QuantityPickerIncrementButton, type QuantityPickerRootProps, type QuantityPickerDecrementButtonProps, type QuantityPickerValueDisplayProps, type QuantityPickerIncrementButtonProps, type QuantityPickerLoading, type QuantityPickerGetValueText, } from './QuantityPicker';
|
|
2
|
+
export * as QuantityPicker from './QuantityPicker.namespace';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/QuantityPicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,kCAAkC,EACvC,KAAK,+BAA+B,EACpC,KAAK,kCAAkC,EACvC,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,GAChC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useControllableState } from "../../
|
|
2
|
-
import { usePressTap } from "../../
|
|
1
|
+
import { useControllableState } from "../../packages/lynx-react-headless/use-controllable-state/lib/index.js";
|
|
2
|
+
import { usePressTap } from "../../packages/lynx-react-headless/use-press-tap/lib/index.js";
|
|
3
3
|
import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
|
|
4
4
|
import { mergeProps } from "../../utils/merge-props.js";
|
|
5
5
|
import { InternalIcon } from "../Icon/Icon.jsx";
|
|
@@ -9,7 +9,7 @@ import * as React from "@lynx-js/react";
|
|
|
9
9
|
* - 키보드 focus / focusVisible
|
|
10
10
|
* - `asChild`
|
|
11
11
|
*/
|
|
12
|
-
export interface ReactionButtonProps extends Omit<ReactionButtonVariantProps, "selected" | "pressed" | "disabled" | "loading">, LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps {
|
|
12
|
+
export interface ReactionButtonProps extends Omit<ReactionButtonVariantProps, "selected" | "pressed" | "disabled" | "loading">, Omit<LynxStyledElementProps, "flatten">, LynxPressableProps, LynxAccessibilityProps {
|
|
13
13
|
pressed?: boolean;
|
|
14
14
|
defaultPressed?: boolean;
|
|
15
15
|
onPressedChange?: (pressed: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactionButton.d.ts","sourceRoot":"","sources":["../../../src/components/ReactionButton/ReactionButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAEhG,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ReactionButton.d.ts","sourceRoot":"","sources":["../../../src/components/ReactionButton/ReactionButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAEhG,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAOxC,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,aAAa,CAAC;AAMrB;;;;;;;GAOG;AACH,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,0BAA0B,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC,EACvF,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,EACvC,kBAAkB,EAClB,sBAAsB;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,qFAwGzB,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { useControllableState } from "../../
|
|
2
|
-
import { usePressTap } from "../../
|
|
1
|
+
import { useControllableState } from "../../packages/lynx-react-headless/use-controllable-state/lib/index.js";
|
|
2
|
+
import { usePressTap } from "../../packages/lynx-react-headless/use-press-tap/lib/index.js";
|
|
3
|
+
import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
|
|
3
4
|
import { toArray } from "../../utils/children.js";
|
|
5
|
+
import { mergeProps } from "../../utils/merge-props.js";
|
|
4
6
|
import { IconSlotProvider, getIconSlotName } from "../Icon/Icon.jsx";
|
|
5
7
|
import { ProgressCircleRange, ProgressCircleRoot } from "../ProgressCircle/ProgressCircle.jsx";
|
|
6
8
|
import { isCountElement } from "../Count/Count.jsx";
|
|
@@ -18,18 +20,25 @@ var ReactionButton = React.forwardRef((props, ref) => {
|
|
|
18
20
|
defaultValue: defaultPressed,
|
|
19
21
|
onChange: onPressedChange
|
|
20
22
|
});
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
const handleTap = React.useCallback((...args) => {
|
|
24
|
+
setSelected(!selected);
|
|
25
|
+
bindtap?.(...args);
|
|
26
|
+
}, [
|
|
27
|
+
bindtap,
|
|
28
|
+
selected,
|
|
29
|
+
setSelected
|
|
30
|
+
]);
|
|
31
|
+
const { pressed, bindtouchstart, bindtouchend, bindtouchcancel, ...pressHandlers } = usePressTap({
|
|
32
|
+
disabled: disabled || loading,
|
|
33
|
+
onTap: handleTap,
|
|
31
34
|
mainThreadOnTap: mainThreadBindtap
|
|
32
35
|
});
|
|
36
|
+
const { scaleFeedbackTriggerProps, scaleFeedbackTargetProps } = useScaleFeedback({
|
|
37
|
+
disabled: disabled || loading,
|
|
38
|
+
onTouchStart: bindtouchstart,
|
|
39
|
+
onTouchEnd: bindtouchend,
|
|
40
|
+
onTouchCancel: bindtouchcancel
|
|
41
|
+
});
|
|
33
42
|
const classNames = reactionButton({
|
|
34
43
|
...variantProps,
|
|
35
44
|
selected,
|
|
@@ -69,7 +78,7 @@ var ReactionButton = React.forwardRef((props, ref) => {
|
|
|
69
78
|
labelChildren.push(child);
|
|
70
79
|
}
|
|
71
80
|
return <IconSlotProvider value={iconSlotContextValue}>
|
|
72
|
-
<view {...ref ? { ref } : {}} {
|
|
81
|
+
<view {...mergeProps(ref ? { ref } : {}, scaleFeedbackTargetProps, scaleFeedbackTriggerProps, pressHandlers, nativeProps)} flatten={false} className={clsx(classNames.root, className)} style={style} accessibility-element={accessibilityElement} accessibility-traits={disabled ? "disabled" : selected ? "selected" : accessibilityTraits ?? "button"}>
|
|
73
82
|
<view className={classNames.content}>
|
|
74
83
|
{prefixIconChildren}
|
|
75
84
|
{labelChildren.length > 0 ? <text className={classNames.label}>{labelChildren}</text> : null}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, PropsWithoutRef, ReactNode, RefAttributes } from '@lynx-js/react';
|
|
2
|
+
import { IntrinsicElements, NodesRef } from '@lynx-js/types';
|
|
3
|
+
type NativeViewProps = Omit<IntrinsicElements["view"], `main-thread:${string}`>;
|
|
4
|
+
type LynxForwardRefComponent<T, P> = ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
|
|
5
|
+
type ScrollFogPlacement = "top" | "bottom" | "left" | "right";
|
|
6
|
+
type SizesConfig = {
|
|
7
|
+
top?: number;
|
|
8
|
+
bottom?: number;
|
|
9
|
+
left?: number;
|
|
10
|
+
right?: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @platform Lynx
|
|
14
|
+
*
|
|
15
|
+
* A two-axis scroll area with independently configurable edge masks.
|
|
16
|
+
*/
|
|
17
|
+
export interface ScrollFogProps extends Omit<NativeViewProps, "children" | "className" | "style"> {
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
className?: NativeViewProps["className"];
|
|
20
|
+
style?: NativeViewProps["style"];
|
|
21
|
+
/**
|
|
22
|
+
* Fog 효과를 표시할 방향입니다.
|
|
23
|
+
* @defaultValue ["top", "bottom"]
|
|
24
|
+
*/
|
|
25
|
+
placement?: ScrollFogPlacement[];
|
|
26
|
+
/**
|
|
27
|
+
* Fog 효과의 크기입니다. 숫자는 px 단위로 처리합니다.
|
|
28
|
+
* @defaultValue 20
|
|
29
|
+
*/
|
|
30
|
+
size?: number | string;
|
|
31
|
+
/** 방향별 Fog 효과의 크기입니다. 숫자는 px 단위로 처리합니다. */
|
|
32
|
+
sizes?: SizesConfig;
|
|
33
|
+
/**
|
|
34
|
+
* Native scroll indicator를 숨깁니다.
|
|
35
|
+
* @defaultValue false
|
|
36
|
+
*/
|
|
37
|
+
hideScrollBar?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare const ScrollFog: LynxForwardRefComponent<NodesRef, ScrollFogProps>;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=ScrollFog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollFog.d.ts","sourceRoot":"","sources":["../../../src/components/ScrollFog/ScrollFog.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,yBAAyB,EACzB,eAAe,EACf,SAAS,EACT,aAAa,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAGlE,KAAK,eAAe,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,eAAe,MAAM,EAAE,CAAC,CAAC;AAChF,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,yBAAyB,CAC5D,eAAe,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CACtC,CAAC;AAEF,KAAK,kBAAkB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9D,KAAK,WAAW,GAAG;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA8BF;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;IAC/F,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACzC,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACjC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,SAAS,EAAE,uBAAuB,CAAC,QAAQ,EAAE,cAAc,CAwFtE,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from "@lynx-js/react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { scrollFog } from "@seed-design/lynx-css/vars/component";
|
|
4
|
+
import { scrollFog as scrollFog$1 } from "@seed-design/lynx-css/recipes/scroll-fog";
|
|
5
|
+
//#region src/components/ScrollFog/ScrollFog.tsx
|
|
6
|
+
var DEFAULT_SIZE = scrollFog.base.enabled.root.size;
|
|
7
|
+
function normalizeSize(size) {
|
|
8
|
+
return typeof size === "number" ? `${size}px` : size;
|
|
9
|
+
}
|
|
10
|
+
function createRootStyle(style, sizes) {
|
|
11
|
+
const variables = {
|
|
12
|
+
"--scroll-fog-size-top": sizes.top,
|
|
13
|
+
"--scroll-fog-size-bottom": sizes.bottom,
|
|
14
|
+
"--scroll-fog-size-left": sizes.left,
|
|
15
|
+
"--scroll-fog-size-right": sizes.right
|
|
16
|
+
};
|
|
17
|
+
if (typeof style === "string") return `${style}; ${Object.entries(variables).map(([property, value]) => `${property}: ${value}`).join("; ")}`;
|
|
18
|
+
return {
|
|
19
|
+
...style,
|
|
20
|
+
...variables
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
var ScrollFog = React.forwardRef((props, forwardedRef) => {
|
|
24
|
+
const { children, className, style, placement = ["top", "bottom"], size = DEFAULT_SIZE, sizes, hideScrollBar = false, ...rootProps } = props;
|
|
25
|
+
const normalizedSize = normalizeSize(size);
|
|
26
|
+
const topSize = sizes?.top ? normalizeSize(sizes.top) : normalizedSize;
|
|
27
|
+
const bottomSize = sizes?.bottom ? normalizeSize(sizes.bottom) : normalizedSize;
|
|
28
|
+
const leftSize = sizes?.left ? normalizeSize(sizes.left) : normalizedSize;
|
|
29
|
+
const rightSize = sizes?.right ? normalizeSize(sizes.right) : normalizedSize;
|
|
30
|
+
const scrollBarEnabled = !hideScrollBar;
|
|
31
|
+
const classNames = scrollFog$1({
|
|
32
|
+
top: placement.includes("top"),
|
|
33
|
+
bottom: placement.includes("bottom"),
|
|
34
|
+
left: placement.includes("left"),
|
|
35
|
+
right: placement.includes("right")
|
|
36
|
+
});
|
|
37
|
+
let content = <scroll-view enable-nested-scroll scroll-bar-enable={scrollBarEnabled} scroll-orientation="vertical" className={classNames.verticalScroll}>
|
|
38
|
+
<scroll-view enable-nested-scroll scroll-bar-enable={scrollBarEnabled} scroll-orientation="horizontal" className={classNames.horizontalScroll}>
|
|
39
|
+
{children}
|
|
40
|
+
</scroll-view>
|
|
41
|
+
</scroll-view>;
|
|
42
|
+
if (placement.includes("right")) content = <view flatten={false} className={classNames.rightMask}>
|
|
43
|
+
{content}
|
|
44
|
+
</view>;
|
|
45
|
+
if (placement.includes("left")) content = <view flatten={false} className={classNames.leftMask}>
|
|
46
|
+
{content}
|
|
47
|
+
</view>;
|
|
48
|
+
if (placement.includes("bottom")) content = <view flatten={false} className={classNames.bottomMask}>
|
|
49
|
+
{content}
|
|
50
|
+
</view>;
|
|
51
|
+
if (placement.includes("top")) content = <view flatten={false} className={classNames.topMask}>
|
|
52
|
+
{content}
|
|
53
|
+
</view>;
|
|
54
|
+
return <view {...forwardedRef ? { ref: forwardedRef } : {}} {...rootProps} className={clsx(classNames.root, className)} style={createRootStyle(style, {
|
|
55
|
+
top: topSize,
|
|
56
|
+
bottom: bottomSize,
|
|
57
|
+
left: leftSize,
|
|
58
|
+
right: rightSize
|
|
59
|
+
})}>
|
|
60
|
+
{content}
|
|
61
|
+
</view>;
|
|
62
|
+
});
|
|
63
|
+
ScrollFog.displayName = "ScrollFog";
|
|
64
|
+
//#endregion
|
|
65
|
+
export { ScrollFog };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScrollFog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useControllableState } from "../../
|
|
2
|
-
import { usePressTap } from "../../
|
|
1
|
+
import { useControllableState } from "../../packages/lynx-react-headless/use-controllable-state/lib/index.js";
|
|
2
|
+
import { usePressTap } from "../../packages/lynx-react-headless/use-press-tap/lib/index.js";
|
|
3
3
|
import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
|
|
4
4
|
import { mergeProps } from "../../utils/merge-props.js";
|
|
5
5
|
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|