@revolut/ui-kit-miniapp 0.0.2 → 0.0.4

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.
Files changed (2) hide show
  1. package/package.json +2 -1
  2. package/types/index.d.ts +364 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revolut/ui-kit-miniapp",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "license": "Apache-2.0",
5
5
  "main": "",
6
6
  "types": "types/index.d.ts",
@@ -20,6 +20,7 @@
20
20
  ],
21
21
  "scripts": {
22
22
  "prebuild": "rimraf types",
23
+ "prepublishOnly": "yarn build",
23
24
  "build": "mkdir -p types && cp ../ui-kit-miniapp/dist/index.d.ts ./types/index.d.ts"
24
25
  },
25
26
  "peerDependencies": {
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { Token as Token$1, IconName, ImageProps as ImageProps$1, DateRange as DateRange$1, IntlMessages, CurrencyDefinition } from '@revolut-internal/ui-kit';
3
+ import { Token as Token$1, IconName, ImageProps as ImageProps$1, DateRange as DateRange$1, Color, IntlMessages, CurrencyDefinition } from '@revolut-internal/ui-kit';
4
4
  export { CurrencyDefinition, DateFormatOptions, DateRangeFormatOptions, DateTimeFormatOptions, DropdownOptions, DropdownState, IconName, IntlMessages, TimeFormatOptions, UseMoneyFormatOptions, copyToClipboard, nodeChain, useDateFormat, useDateRangeFormat, useDateTimeFormat, useDropdown, useIsRTL, useMoneyFormat, useTimeFormat } from '@revolut-internal/ui-kit';
5
5
 
6
6
  declare namespace JSXCompat {
@@ -592,6 +592,10 @@ interface CalendarDateProps {
592
592
  * Label for the next month button.
593
593
  */
594
594
  labelNext?: string;
595
+ /**
596
+ * Whether the calendar navigates with infinite scroll
597
+ */
598
+ infinite?: boolean;
595
599
  }
596
600
  /**
597
601
  * Props for the Calendar component when variant is 'range'.
@@ -630,6 +634,10 @@ interface CalendarRangeProps {
630
634
  * Label for the next month button.
631
635
  */
632
636
  labelNext?: string;
637
+ /**
638
+ * Whether the calendar navigates with infinite scroll
639
+ */
640
+ infinite?: boolean;
633
641
  }
634
642
  type CalendarProps = CalendarDateProps | CalendarRangeProps;
635
643
  /**
@@ -731,6 +739,10 @@ interface CellProps extends NativeDivProps {
731
739
  * Avatar or image displayed at the start of the cell.
732
740
  */
733
741
  avatar?: React.ReactNode;
742
+ /**
743
+ * Alignment for the avatar content, center by default
744
+ */
745
+ avatarAlign?: 'start' | 'center' | 'end';
734
746
  /**
735
747
  * Visual variant of the cell.
736
748
  * - 'default': Standard cell
@@ -863,7 +875,29 @@ interface CellProps extends NativeDivProps {
863
875
  * }
864
876
  * ```
865
877
  */
866
- declare const Cell: ({ as, title, description, side, icon, avatar, variant, active, disabled, onClick, href, target, ...rest }: CellProps) => react_jsx_runtime.JSX.Element;
878
+ declare const Cell: ({ as, title, description, side, icon, avatar, avatarAlign, variant, active, disabled, onClick, href, target, ...rest }: CellProps) => react_jsx_runtime.JSX.Element;
879
+
880
+ /**
881
+ * Cell skeleton component to show a loading state.
882
+ *
883
+ * Provides a cell skeleton to be shown when UI is loading some content.
884
+ *
885
+ * @example
886
+ * ```tsx
887
+ * import { CellSkeleton, Group } from '@revolut/ui-kit-miniapp'
888
+ *
889
+ * function CellSkeletonExample() {
890
+ * return (
891
+ * <Group>
892
+ * <CellSkeleton />
893
+ * <CellSkeleton />
894
+ * <CellSkeleton />
895
+ * </Group>
896
+ * )
897
+ * }
898
+ * ```
899
+ */
900
+ declare const CellSkeleton: () => react_jsx_runtime.JSX.Element;
867
901
 
868
902
  type NativeInputProps$4 = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'className' | 'style' | 'children' | 'checked' | 'defaultChecked' | 'disabled' | 'onChange' | 'type' | 'color'>;
869
903
  /**
@@ -1162,6 +1196,65 @@ interface DetailsCellProps extends NativeDivProps {
1162
1196
  */
1163
1197
  declare const DetailsCell: ({ title, content, note, ...rest }: DetailsCellProps) => react_jsx_runtime.JSX.Element;
1164
1198
 
1199
+ /**
1200
+ * Props for the Dropdown component.
1201
+ *
1202
+ * @example
1203
+ * ```tsx
1204
+ * <Dropdown anchorRef={ref} onClose={handleClose} open>
1205
+ * Dropdown content
1206
+ * </Dropdown>
1207
+ * ```
1208
+ */
1209
+ interface DropdownProps extends NativeDivProps {
1210
+ /**
1211
+ * Element ref where the tooltip is anchored.
1212
+ */
1213
+ anchorRef: React.RefObject<HTMLElement | null>;
1214
+ /**
1215
+ * Callback triggered when the dropdown is closed.
1216
+ */
1217
+ onClose: () => void;
1218
+ /**
1219
+ * Whether the dropdown is shown.
1220
+ */
1221
+ open: boolean;
1222
+ /**
1223
+ * Dropdown content.
1224
+ */
1225
+ children: React.ReactNode;
1226
+ }
1227
+ /**
1228
+ * Dropdown component for displaying content anchored to an element.
1229
+ *
1230
+ * @example
1231
+ * ```tsx
1232
+ * import { Button, Dropdown } from '@revolut/ui-kit-miniapp'
1233
+ *
1234
+ * // Basic usage
1235
+ * function BasicExample() {
1236
+ * const ref = useRef(null)
1237
+ * const [open, setOpen] = useState(false)
1238
+ *
1239
+ * return (
1240
+ * <>
1241
+ * <Button onClick={() => setOpen(false)} ref={ref}>
1242
+ * Click me to show dropdown!
1243
+ * </Button>
1244
+ * <Dropdown
1245
+ * anchorRef={ref}
1246
+ * onClose={() => setOpen(false)}
1247
+ * open={open}
1248
+ * >
1249
+ * Dropdown content
1250
+ * </Dropdown>
1251
+ * </>
1252
+ * )
1253
+ * }
1254
+ * ```
1255
+ */
1256
+ declare const Dropdown: ({ anchorRef, onClose, open, children, }: DropdownProps) => react_jsx_runtime.JSX.Element;
1257
+
1165
1258
  /**
1166
1259
  * Props for the Footnote component.
1167
1260
  *
@@ -1369,7 +1462,7 @@ type NativeInputProps$3 = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'cla
1369
1462
  /**
1370
1463
  * Input type options.
1371
1464
  */
1372
- type InputType = 'text' | 'email' | 'password' | 'tel' | 'url' | 'number' | 'search';
1465
+ type InputType = 'button' | 'text' | 'email' | 'password' | 'tel' | 'url' | 'number' | 'search';
1373
1466
  /**
1374
1467
  * Props for the Input component.
1375
1468
  *
@@ -1440,6 +1533,14 @@ interface InputProps extends NativeInputProps$3 {
1440
1533
  * Callback fired when the clear button is clicked.
1441
1534
  */
1442
1535
  onClear?: () => void;
1536
+ /**
1537
+ * Icon to render at the start of the input content.
1538
+ */
1539
+ icon?: IconName;
1540
+ /**
1541
+ * Icon to render at the end of the input content.
1542
+ */
1543
+ endIcon?: IconName;
1443
1544
  }
1444
1545
  /**
1445
1546
  * Input component for text entry.
@@ -1502,6 +1603,25 @@ interface InputProps extends NativeInputProps$3 {
1502
1603
  *
1503
1604
  * @example
1504
1605
  * ```tsx
1606
+ * import { Input } from '@revolut/ui-kit-miniapp'
1607
+ *
1608
+ * // Button variant
1609
+ * function FormExample() {
1610
+ * const [value, setValue] = useState('')
1611
+ * return (
1612
+ * <Input
1613
+ * label="Airport"
1614
+ * icon="AirplaneDeparture"
1615
+ * type="button"
1616
+ * onClick={() => openPopup()}
1617
+ * value={value}
1618
+ * />
1619
+ * )
1620
+ * }
1621
+ * ```
1622
+ *
1623
+ * @example
1624
+ * ```tsx
1505
1625
  * import { Input, VStack } from '@revolut/ui-kit-miniapp'
1506
1626
  *
1507
1627
  * // Form layout
@@ -1516,7 +1636,7 @@ interface InputProps extends NativeInputProps$3 {
1516
1636
  * }
1517
1637
  * ```
1518
1638
  */
1519
- declare const Input: ({ value, defaultValue, onChange, label, placeholder, type, disabled, readOnly, invalid, description, errorMessage, labelButtonClear, onClear, ...rest }: InputProps) => react_jsx_runtime.JSX.Element;
1639
+ declare const Input: ({ value, defaultValue, onChange, label, placeholder, type, disabled, readOnly, invalid, description, errorMessage, labelButtonClear, onClear, icon, endIcon, ...rest }: InputProps) => react_jsx_runtime.JSX.Element;
1520
1640
 
1521
1641
  type NativeAnchorProps = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'className' | 'style'>;
1522
1642
  /**
@@ -1603,6 +1723,61 @@ interface LinkProps extends NativeAnchorProps {
1603
1723
  */
1604
1724
  declare const Link: ({ href, target, children, ...rest }: LinkProps) => react_jsx_runtime.JSX.Element;
1605
1725
 
1726
+ /**
1727
+ * List item definition.
1728
+ */
1729
+ interface ListItem {
1730
+ /**
1731
+ * Icon to show at the start
1732
+ */
1733
+ icon: IconName;
1734
+ /**
1735
+ * Text to show
1736
+ */
1737
+ text: string;
1738
+ }
1739
+ /**
1740
+ * Props for the List component.
1741
+ *
1742
+ * @example
1743
+ * ```tsx
1744
+ * <List
1745
+ * items={[
1746
+ * { text: 'First item completed', icon: 'Check' },
1747
+ * { text: 'Second item pending', icon: 'Time' },
1748
+ * ]}
1749
+ * />
1750
+ * ```
1751
+ */
1752
+ interface ListProps {
1753
+ /**
1754
+ * List items to render.
1755
+ */
1756
+ items: ListItem[];
1757
+ }
1758
+ /**
1759
+ * List component for showing a list of elements.
1760
+ *
1761
+ * Provides a vertical container for showing a list of text elements with icons.
1762
+ *
1763
+ * @example
1764
+ * ```tsx
1765
+ * import { List } from '@revolut/ui-kit-miniapp'
1766
+ *
1767
+ * function ListExample() {
1768
+ * return (
1769
+ * <List
1770
+ * items={[
1771
+ * { text: 'First item completed', icon: 'Check' },
1772
+ * { text: 'Second item pending', icon: 'Time' },
1773
+ * ]}
1774
+ * />
1775
+ * )
1776
+ * }
1777
+ * ```
1778
+ */
1779
+ declare const List: ({ items }: ListProps) => react_jsx_runtime.JSX.Element;
1780
+
1606
1781
  /**
1607
1782
  * Props for the FilterButton component.
1608
1783
  *
@@ -1842,6 +2017,167 @@ interface HStackProps extends NativeSpanProps {
1842
2017
  */
1843
2018
  declare const HStack: ({ align, gap, children, ...rest }: HStackProps) => react_jsx_runtime.JSX.Element;
1844
2019
 
2020
+ /**
2021
+ * Props for the Placeholder component.
2022
+ *
2023
+ * @example
2024
+ * ```tsx
2025
+ * <Placeholder
2026
+ * title="Nothing found"
2027
+ * description="Try again later"
2028
+ * icon="Question"
2029
+ * action={<Button>Try again</Button>}
2030
+ * />
2031
+ * ```
2032
+ */
2033
+ interface PlaceholderProps {
2034
+ /**
2035
+ * Placeholder title.
2036
+ */
2037
+ title: string;
2038
+ /**
2039
+ * Placeholder description.
2040
+ */
2041
+ description?: string;
2042
+ /**
2043
+ * Placeholder icon.
2044
+ */
2045
+ icon: IconName;
2046
+ /**
2047
+ * Placeholder action.
2048
+ */
2049
+ action?: React.ReactNode;
2050
+ }
2051
+ /**
2052
+ * Placeholder component for showing status information.
2053
+ *
2054
+ * The component is useful for displaying of any statuses or information consist of image, title, description, and action.
2055
+ *
2056
+ * @example
2057
+ * ```tsx
2058
+ * import { Placeholder } from '@revolut/ui-kit-miniapp'
2059
+ *
2060
+ * function PlaceholderExample() {
2061
+ * return (
2062
+ * <Placeholder
2063
+ * title="Nothing found"
2064
+ * description="Try again later"
2065
+ * icon="Question"
2066
+ * action={<Button>Try again</Button>}
2067
+ * />
2068
+ * )
2069
+ * }
2070
+ * ```
2071
+ */
2072
+ declare const Placeholder: ({ action, description, icon, title, }: PlaceholderProps) => react_jsx_runtime.JSX.Element;
2073
+
2074
+ /**
2075
+ * Props for the Popup component.
2076
+ */
2077
+ interface PopupProps {
2078
+ /**
2079
+ * Whether the modal is open.
2080
+ */
2081
+ open?: boolean;
2082
+ /**
2083
+ * Callback when the modal is closed.
2084
+ */
2085
+ onClose?: () => void;
2086
+ /**
2087
+ * Modal content.
2088
+ */
2089
+ children?: React.ReactNode;
2090
+ /**
2091
+ * Modal title
2092
+ */
2093
+ title?: string;
2094
+ /**
2095
+ * Modal subtitle
2096
+ */
2097
+ subtitle?: string;
2098
+ }
2099
+ /**
2100
+ * Popup component for displaying modal content with full screen size.
2101
+ *
2102
+ * @example
2103
+ * ```tsx
2104
+ * import { Button, Calendar, Popup } from '@revolut/ui-kit-miniapp'
2105
+ *
2106
+ * function MyComponent() {
2107
+ * const [open, setOpen] = useState(false)
2108
+ *
2109
+ * return (
2110
+ * <>
2111
+ * <Button onClick={() => setOpen(true)}>Open modal</Button>
2112
+ * <Popup open={open} onClose={() => setOpen(false)} title="Select date" subtitle="From 1st of January to 31th of December">
2113
+ * <Calendar infinite variant="date-range" />
2114
+ * </Popup>
2115
+ * </>
2116
+ * )
2117
+ * }
2118
+ * ```
2119
+ */
2120
+ declare const Popup: ({ open, onClose, children, title, subtitle, }: PopupProps) => react_jsx_runtime.JSX.Element;
2121
+
2122
+ /**
2123
+ * Progress steps item definition.
2124
+ */
2125
+ interface ProgressStepsItem {
2126
+ /**
2127
+ * Title to show in the step
2128
+ */
2129
+ title: string;
2130
+ /**
2131
+ * Description to show in the step
2132
+ */
2133
+ description: string;
2134
+ /**
2135
+ * Color of the indicator at the start of the step item
2136
+ */
2137
+ color: Color;
2138
+ }
2139
+ /**
2140
+ * Props for the ProgressSteps component.
2141
+ *
2142
+ * @example
2143
+ * ```tsx
2144
+ * <ProgressSteps
2145
+ * items={[
2146
+ * { title: 'Free cancellation', description: 'Until 15th of December', color: 'success' },
2147
+ * { title: 'No refund', description: 'From 16th of December', color: 'red' },
2148
+ * ]}
2149
+ * />
2150
+ * ```
2151
+ */
2152
+ interface ProgressStepsProps {
2153
+ /**
2154
+ * Steps items to render.
2155
+ */
2156
+ items: ProgressStepsItem[];
2157
+ }
2158
+ /**
2159
+ * ProgressSteps component for showing current progress on a specific process.
2160
+ *
2161
+ * Provides a vertical container for showing a list of steps with information, description and color to highlight the status of each one.
2162
+ *
2163
+ * @example
2164
+ * ```tsx
2165
+ * import { ProgressSteps } from '@revolut/ui-kit-miniapp'
2166
+ *
2167
+ * function ProgressStepsExample() {
2168
+ * return (
2169
+ * <ProgressSteps
2170
+ * items={[
2171
+ * { title: 'Free cancellation', description: 'Until 15th of December', color: 'success' },
2172
+ * { title: 'No refund', description: 'From 16th of December', color: 'red' },
2173
+ * ]}
2174
+ * />
2175
+ * )
2176
+ * }
2177
+ * ```
2178
+ */
2179
+ declare const ProgressSteps: ({ items }: ProgressStepsProps) => react_jsx_runtime.JSX.Element;
2180
+
1845
2181
  /**
1846
2182
  * Props for the Spacer component.
1847
2183
  *
@@ -3036,6 +3372,23 @@ interface BottomSheetComponent extends React.FC<BottomSheetProps> {
3036
3372
  */
3037
3373
  declare const BottomSheet: BottomSheetComponent;
3038
3374
 
3375
+ /**
3376
+ * Page header action item definition.
3377
+ */
3378
+ interface PageHeaderActionItem {
3379
+ /**
3380
+ * Label for the action (not visible)
3381
+ */
3382
+ label: string;
3383
+ /**
3384
+ * Icon to show
3385
+ */
3386
+ icon: IconName;
3387
+ /**
3388
+ * Callback when the button is clicked
3389
+ */
3390
+ onClick: () => void;
3391
+ }
3039
3392
  /**
3040
3393
  * Props for the Page.Header component.
3041
3394
  */
@@ -3073,8 +3426,12 @@ interface PageHeaderProps extends NativeHeadingProps {
3073
3426
  * Header title content.
3074
3427
  */
3075
3428
  children?: React.ReactNode;
3429
+ /**
3430
+ * Header actions.
3431
+ */
3432
+ actions?: PageHeaderActionItem[];
3076
3433
  }
3077
- declare const PageHeader: ({ onBack, onClose, labelButtonClose, labelButtonBack, subtitle, description, loading, children, ...rest }: PageHeaderProps) => react_jsx_runtime.JSX.Element;
3434
+ declare const PageHeader: ({ onBack, onClose, labelButtonClose, labelButtonBack, subtitle, description, loading, children, actions, ...rest }: PageHeaderProps) => react_jsx_runtime.JSX.Element;
3078
3435
  /**
3079
3436
  * Props for the Page.Main component.
3080
3437
  */
@@ -3392,5 +3749,5 @@ declare const Token: {
3392
3749
  };
3393
3750
  };
3394
3751
 
3395
- export { Action, ActionButton, Avatar, BottomSheet, Button, Calendar, Cell, Checkbox, Copyable, DetailsCell, FilterButton, Footnote, Group, HStack, Icon, Image, Input, Link, Page, Radio, RootProvider, Search, Spacer, Subheader, Switch, TabBar, Text, TextArea, ToggleButton, Token, VStack, VisuallyHidden, useStatusSheet };
3396
- export type { ActionButtonProps, ActionButtonVariant, ActionProps, AvatarProps, AvatarSize, BottomSheetActionsProps, BottomSheetContentProps, BottomSheetHeaderProps, BottomSheetProps, ButtonProps, ButtonVariant, CalendarDateProps, CalendarProps, CalendarRangeProps, CalendarVariant, CellProps, CellVariant, CheckboxProps, CopyableProps, DateRange, DetailsCellProps, FilterButtonProps, FootnoteProps, GroupProps, GroupVariant, HStackProps, IconProps, ImageFit, ImageProp, ImageProps, InputProps, InputType, LinkProps, PageHeaderProps, PageMainProps, PageProps, PageTabsProps, RadioProps, RootProviderProps, SearchProps, Space, SpacerProps, StackAlignment, StatusSheetAction, StatusSheetInstance, StatusSheetOptions, StatusSheetVariant, SubheaderProps, SubheaderVariant, SwitchProps, TabBarItem, TabBarProps, TabBarVariant, TextAreaProps, TextProps, TextVariant, ThemeBackground, ThemeMode, ToggleButtonProps, VStackProps, VisuallyHiddenProps };
3752
+ export { Action, ActionButton, Avatar, BottomSheet, Button, Calendar, Cell, CellSkeleton, Checkbox, Copyable, DetailsCell, Dropdown, FilterButton, Footnote, Group, HStack, Icon, Image, Input, Link, List, Page, Placeholder, Popup, ProgressSteps, Radio, RootProvider, Search, Spacer, Subheader, Switch, TabBar, Text, TextArea, ToggleButton, Token, VStack, VisuallyHidden, useStatusSheet };
3753
+ export type { ActionButtonProps, ActionButtonVariant, ActionProps, AvatarProps, AvatarSize, BottomSheetActionsProps, BottomSheetContentProps, BottomSheetHeaderProps, BottomSheetProps, ButtonProps, ButtonVariant, CalendarDateProps, CalendarProps, CalendarRangeProps, CalendarVariant, CellProps, CellVariant, CheckboxProps, CopyableProps, DateRange, DetailsCellProps, DropdownProps, FilterButtonProps, FootnoteProps, GroupProps, GroupVariant, HStackProps, IconProps, ImageFit, ImageProp, ImageProps, InputProps, InputType, LinkProps, ListProps, PageHeaderProps, PageMainProps, PageProps, PageTabsProps, PlaceholderProps, PopupProps, ProgressStepsProps, RadioProps, RootProviderProps, SearchProps, Space, SpacerProps, StackAlignment, StatusSheetAction, StatusSheetInstance, StatusSheetOptions, StatusSheetVariant, SubheaderProps, SubheaderVariant, SwitchProps, TabBarItem, TabBarProps, TabBarVariant, TextAreaProps, TextProps, TextVariant, ThemeBackground, ThemeMode, ToggleButtonProps, VStackProps, VisuallyHiddenProps };