@kanso-labs/kanso-ui 0.44.1 → 0.45.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.
Files changed (127) hide show
  1. package/README.md +59 -7
  2. package/dist/chip/index.js +24 -4
  3. package/dist/chip/index.js.map +1 -1
  4. package/dist/chip/styles.js +13 -5
  5. package/dist/chip/styles.js.map +1 -1
  6. package/dist/components/app-bar/index.d.ts +14 -2
  7. package/dist/components/app-bar/index.js +36 -7
  8. package/dist/components/app-bar/index.js.map +1 -1
  9. package/dist/components/autocomplete/index.d.ts +44 -0
  10. package/dist/components/autocomplete/index.js +44 -0
  11. package/dist/components/autocomplete/index.js.map +1 -1
  12. package/dist/components/button/index.d.ts +3 -2
  13. package/dist/components/button/index.js +53 -59
  14. package/dist/components/button/index.js.map +1 -1
  15. package/dist/components/card/index.d.ts +11 -3
  16. package/dist/components/card/index.js +23 -1
  17. package/dist/components/card/index.js.map +1 -1
  18. package/dist/components/checkbox/index.js +65 -58
  19. package/dist/components/checkbox/index.js.map +1 -1
  20. package/dist/components/chip/index.d.ts +46 -30
  21. package/dist/components/chip/index.js +38 -17
  22. package/dist/components/chip/index.js.map +1 -1
  23. package/dist/components/chip-group/index.d.ts +5 -2
  24. package/dist/components/chip-group/index.js +8 -2
  25. package/dist/components/chip-group/index.js.map +1 -1
  26. package/dist/components/dialog/index.d.ts +27 -0
  27. package/dist/components/dialog/index.js +81 -37
  28. package/dist/components/dialog/index.js.map +1 -1
  29. package/dist/components/fab/index.d.ts +1 -1
  30. package/dist/components/fab/index.js.map +1 -1
  31. package/dist/components/form/index.d.ts +14 -4
  32. package/dist/components/form/index.js +6 -3
  33. package/dist/components/form/index.js.map +1 -1
  34. package/dist/components/icon-button/index.d.ts +15 -1
  35. package/dist/components/icon-button/index.js +15 -1
  36. package/dist/components/icon-button/index.js.map +1 -1
  37. package/dist/components/link/index.d.ts +4 -0
  38. package/dist/components/link/index.js +4 -0
  39. package/dist/components/link/index.js.map +1 -1
  40. package/dist/components/list/index.d.ts +34 -0
  41. package/dist/components/list/index.js +47 -13
  42. package/dist/components/list/index.js.map +1 -1
  43. package/dist/components/list-detail/index.d.ts +34 -1
  44. package/dist/components/list-detail/index.js +34 -1
  45. package/dist/components/list-detail/index.js.map +1 -1
  46. package/dist/components/list-item/index.d.ts +21 -2
  47. package/dist/components/list-item/index.js +6 -0
  48. package/dist/components/list-item/index.js.map +1 -1
  49. package/dist/components/menu/index.d.ts +6 -3
  50. package/dist/components/menu/index.js +3 -1
  51. package/dist/components/menu/index.js.map +1 -1
  52. package/dist/components/meter/index.d.ts +4 -0
  53. package/dist/components/meter/index.js +4 -0
  54. package/dist/components/meter/index.js.map +1 -1
  55. package/dist/components/navigation-bar/index.d.ts +14 -2
  56. package/dist/components/navigation-bar/index.js +14 -2
  57. package/dist/components/navigation-bar/index.js.map +1 -1
  58. package/dist/components/navigation-tree/index.js +2 -9
  59. package/dist/components/navigation-tree/index.js.map +1 -1
  60. package/dist/components/number-field/index.d.ts +7 -1
  61. package/dist/components/number-field/index.js +7 -1
  62. package/dist/components/number-field/index.js.map +1 -1
  63. package/dist/components/popover/index.d.ts +15 -1
  64. package/dist/components/popover/index.js +15 -1
  65. package/dist/components/popover/index.js.map +1 -1
  66. package/dist/components/product-icon/index.d.ts +8 -1
  67. package/dist/components/product-icon/index.js +8 -1
  68. package/dist/components/product-icon/index.js.map +1 -1
  69. package/dist/components/progress-indicator/index.d.ts +12 -6
  70. package/dist/components/progress-indicator/index.js +57 -46
  71. package/dist/components/progress-indicator/index.js.map +1 -1
  72. package/dist/components/radio-group/index.d.ts +7 -0
  73. package/dist/components/radio-group/index.js +23 -14
  74. package/dist/components/radio-group/index.js.map +1 -1
  75. package/dist/components/search-field/index.d.ts +13 -4
  76. package/dist/components/search-field/index.js +10 -4
  77. package/dist/components/search-field/index.js.map +1 -1
  78. package/dist/components/search-view/index.d.ts +2 -0
  79. package/dist/components/search-view/index.js.map +1 -1
  80. package/dist/components/segmented-button/index.d.ts +1 -1
  81. package/dist/components/segmented-button/index.js.map +1 -1
  82. package/dist/components/separator/index.d.ts +31 -6
  83. package/dist/components/separator/index.js +30 -6
  84. package/dist/components/separator/index.js.map +1 -1
  85. package/dist/components/sheet/index.d.ts +96 -37
  86. package/dist/components/sheet/index.js +420 -136
  87. package/dist/components/sheet/index.js.map +1 -1
  88. package/dist/components/snackbar/index.d.ts +8 -1
  89. package/dist/components/snackbar/index.js +7 -0
  90. package/dist/components/snackbar/index.js.map +1 -1
  91. package/dist/components/stack/index.d.ts +21 -5
  92. package/dist/components/stack/index.js +10 -0
  93. package/dist/components/stack/index.js.map +1 -1
  94. package/dist/components/switch/index.d.ts +12 -0
  95. package/dist/components/switch/index.js +12 -0
  96. package/dist/components/switch/index.js.map +1 -1
  97. package/dist/components/text-field/index.d.ts +39 -9
  98. package/dist/components/text-field/index.js +29 -7
  99. package/dist/components/text-field/index.js.map +1 -1
  100. package/dist/components/tree/index.js +11 -15
  101. package/dist/components/tree/index.js.map +1 -1
  102. package/dist/hooks/useBottomEdge.js +6 -3
  103. package/dist/hooks/useBottomEdge.js.map +1 -1
  104. package/dist/hooks/useRipple.js +216 -192
  105. package/dist/hooks/useRipple.js.map +1 -1
  106. package/dist/i18n/index.js +1 -0
  107. package/dist/i18n/index.js.map +1 -1
  108. package/dist/i18n/messages.js +34 -0
  109. package/dist/i18n/messages.js.map +1 -1
  110. package/dist/index.d.ts +2 -2
  111. package/dist/indicator/styles.js +7 -4
  112. package/dist/indicator/styles.js.map +1 -1
  113. package/dist/mark/styles.js +11 -5
  114. package/dist/mark/styles.js.map +1 -1
  115. package/dist/react-aria.d.ts +2 -2
  116. package/dist/row/index.js +90 -62
  117. package/dist/row/index.js.map +1 -1
  118. package/dist/row/styles.js +6 -1
  119. package/dist/row/styles.js.map +1 -1
  120. package/dist/styles/focus.js.map +1 -1
  121. package/dist/styles/overlay.js +8 -0
  122. package/dist/styles/overlay.js.map +1 -1
  123. package/dist/styles.css +135 -114
  124. package/dist/theme-scope.d.ts +14 -2
  125. package/dist/theme-scope.js +12 -0
  126. package/dist/theme-scope.js.map +1 -1
  127. package/package.json +3 -3
@@ -1,9 +1,6 @@
1
1
  import { HTMLAttributes, ReactNode, RefAttributes } from "react";
2
- import { ClassNameOrFunction, DialogProps, DialogTriggerProps, HeadingProps, ModalOverlayProps, ModalRenderProps, StyleOrFunction } from "react-aria-components";
2
+ import { ClassNameOrFunction, DialogProps, DialogTriggerProps, HeadingProps, ModalOverlayProps, SheetRenderProps, StyleOrFunction } from "react-aria-components";
3
3
  //#region src/components/sheet/index.d.ts
4
- type SheetProps = Omit<DialogTriggerProps, 'children'> & {
5
- children?: ReactNode;
6
- };
7
4
  /**
8
5
  * A modal panel that arrives from the edge of the screen — a side sheet on a
9
6
  * wide viewport, a bottom sheet on a narrow one. Open state is React Aria's:
@@ -17,16 +14,42 @@ type SheetProps = Omit<DialogTriggerProps, 'children'> & {
17
14
  * given `slot="close"` anywhere inside the content closes it; neither needs
18
15
  * a part of its own.
19
16
  *
17
+ * ```tsx
18
+ * <Sheet>
19
+ * <Button>Open</Button>
20
+ * <Sheet.Content>
21
+ * <Sheet.Handle />
22
+ * <Sheet.Header>
23
+ * <Sheet.Title>Headline</Sheet.Title>
24
+ * </Sheet.Header>
25
+ * <Sheet.Body>Supporting line</Sheet.Body>
26
+ * <Sheet.Footer>
27
+ * <Button slot="close">Close</Button>
28
+ * </Sheet.Footer>
29
+ * </Sheet.Content>
30
+ * </Sheet>
31
+ * ```
32
+ *
20
33
  * `Sheet` is the trigger's half, so a sheet nothing on the page opens — one
21
34
  * a route shows, or a menu item raises — leaves it out and passes `isOpen`
22
35
  * and `onOpenChange` to `Sheet.Content` instead. Wrapped in `Sheet` with no
23
36
  * button inside it, React Aria warns that its press responder found nothing
24
37
  * to press.
38
+ *
39
+ * ```tsx
40
+ * <Sheet.Content isOpen={isOpen} onOpenChange={setOpen}>
41
+ * …
42
+ * </Sheet.Content>
43
+ * ```
44
+ *
45
+ * Tab stays inside an open sheet, so a `Snackbar` shown meanwhile is reached
46
+ * with F6, which React Aria uses to move between landmarks. Tabbing on past
47
+ * the snackbar's last control leads back into the sheet.
25
48
  */
26
- declare function Sheet({ children, ...props }: SheetProps): import("react").JSX.Element;
27
- declare namespace Sheet {
49
+ declare function Sheet$1({ children, ...props }: SheetProps): import("react").JSX.Element;
50
+ declare namespace Sheet$1 {
28
51
  var Body: typeof SheetBody;
29
- var Content: typeof SheetContent;
52
+ var Content: typeof SheetContent$1;
30
53
  var Footer: typeof SheetFooter;
31
54
  var Handle: typeof SheetHandle;
32
55
  var Header: typeof SheetHeader;
@@ -38,43 +61,56 @@ declare function SheetBody({ ref: callerRef, ...props }: HTMLAttributes<HTMLDivE
38
61
  * in here; the trigger stays outside it, since the trigger lives in the page
39
62
  * while this is portalled out to the end of the body.
40
63
  *
41
- * A press on the scrim closes the sheet unless `isDismissable` says
42
- * otherwise — React Aria's own default is the reverse, and a sheet that
43
- * ignores a tap outside it reads as stuck.
64
+ * A swipe toward the edge the panel rests on closes it — down on a bottom
65
+ * sheet, toward the screen's edge on a side sheet — as do a press on the
66
+ * scrim, Escape and a `slot="close"` button. `isDismissable` holds the first
67
+ * two, and `isKeyboardDismissDisabled` holds Escape. React Aria's default for
68
+ * the scrim is the reverse of this one: a sheet that ignores a tap outside it
69
+ * reads as stuck.
44
70
  *
45
71
  * Inside `Sheet`, the open state is the trigger's. On its own, with no
46
72
  * trigger, it is this part's: `isOpen` with `onOpenChange` controls it, and
47
- * a `slot="close"` button, Escape and the scrim all report through
73
+ * a swipe, a `slot="close"` button, Escape and the scrim all report through
48
74
  * `onOpenChange`, as they would to `Sheet`.
49
75
  *
50
- * The scrim draws at `z-index: 900`, over any page content layered below
51
- * that, such as a sticky header, and the panel draws inside it. A
76
+ * The sheet draws at `z-index: 900`, the scrim and the panel over it, over
77
+ * any page content layered below that, such as a sticky header. A
52
78
  * `Snackbar` draws at 1000, so a toast raised from inside the sheet is read
53
79
  * over it, and React Aria's popovers and menus draw above both.
80
+ *
81
+ * React Aria lays the sheet over the page from the page's own top-left
82
+ * corner rather than fixing it to the window, so a `container` inside a
83
+ * positioned element holds the sheet to that element instead.
54
84
  */
55
- declare function SheetContent({ children, className, container, defaultOpen, isDismissable, isKeyboardDismissDisabled, isOpen, onOpenChange, ref, style, ...props }: RefAttributes<HTMLDivElement> & SheetContentProps): import("react").JSX.Element;
85
+ declare function SheetContent$1({ children, className, container, defaultOpen, isDismissable, isKeyboardDismissDisabled, isOpen, onOpenChange, ref, snapPoints, style, ...props }: RefAttributes<HTMLDivElement> & SheetContentProps): import("react").JSX.Element;
56
86
  /**
57
- * The sheet's actions. The panel is pinned to the window's bottom edge in
58
- * both presentations, so they sit on that edge, and a toast rises clear of
59
- * them while the sheet is open rather than lying over its buttons. A side
60
- * sheet's are included: the toast is centred in the window, and on any
61
- * window narrower than about 1376px its 576 reach into the sheet's 400.
87
+ * The sheet's actions. The panel rests on the window's bottom edge in both
88
+ * presentations, so they sit on that edge, and a toast rises clear of them
89
+ * while the sheet is open rather than lying over its buttons. A side sheet's
90
+ * are included: the toast is centred in the window, and on any window
91
+ * narrower than about 1376px its 576 reach into the sheet's 400.
62
92
  */
63
93
  declare function SheetFooter({ ref: callerRef, ...props }: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
64
94
  /**
65
95
  * The bottom sheets page's drag handle: a short bar above the sheet's
66
- * content, saying the panel is a bottom sheet. Place it first inside
67
- * `Sheet.Content`; above the medium breakpoint the panel is a side sheet and
68
- * this draws nothing.
96
+ * content, saying the panel is a bottom sheet that a swipe moves. Place it
97
+ * first inside `Sheet.Content`; above the medium breakpoint the panel is a
98
+ * side sheet and this draws nothing.
99
+ *
100
+ * On a sheet given `snapPoints` it is a button, as the bottom sheets page
101
+ * asks of a handle that moves the sheet between heights: a press, from a
102
+ * pointer, a keyboard or assistive technology, moves the sheet to its next
103
+ * snap point, from the last back to the first, and `aria-expanded` says
104
+ * whether it rests at the last. It is called "Drag handle" in the locale's
105
+ * own words, and a call site's `aria-label` names it instead. Its 48 square
106
+ * is the page's target, centred over the bar.
69
107
  *
70
- * It is decoration rather than a control, and hidden from assistive
71
- * technology. Material's own handle drags a sheet between a collapsed and an
72
- * expanded height and dismisses it from the collapsed one; this panel has
73
- * one height and cannot be dragged, so a control that only looked draggable
74
- * would promise what it cannot do. Closing is already the scrim, Escape, and
75
- * any button given `slot="close"`.
108
+ * On a sheet without them it is decoration, hidden from assistive
109
+ * technology: the panel has one height, and the swipe the bar points at
110
+ * takes it from anywhere on the panel, so a control here would offer
111
+ * nothing a swipe, the scrim, Escape or a `slot="close"` button does not.
76
112
  */
77
- declare function SheetHandle(props: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
113
+ declare function SheetHandle({ 'aria-label': label, ...props }: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
78
114
  declare function SheetHeader(props: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
79
115
  /**
80
116
  * Names the sheet. Rendered through React Aria's title slot, which is what
@@ -82,9 +118,9 @@ declare function SheetHeader(props: HTMLAttributes<HTMLDivElement> & RefAttribut
82
118
  * itself as an unnamed dialog.
83
119
  */
84
120
  declare function SheetTitle(props: RefAttributes<HTMLHeadingElement> & SheetTitleProps): import("react").JSX.Element;
85
- type SheetContentProps = Omit<DialogProps, 'className' | 'style'> & Pick<ModalOverlayProps, 'defaultOpen' | 'isKeyboardDismissDisabled' | 'isOpen' | 'onOpenChange'> & {
121
+ type SheetContentProps = Omit<DialogProps, 'className' | 'style'> & Pick<ModalOverlayProps, 'defaultOpen' | 'isOpen' | 'onOpenChange'> & {
86
122
  /** A function may compute the class from the panel's render state. */
87
- className?: ClassNameOrFunction<ModalRenderProps>;
123
+ className?: ClassNameOrFunction<SheetRenderProps>;
88
124
  /**
89
125
  * Where to portal the panel and scrim. Defaults to the container of the
90
126
  * `ThemeScope` around it, which keeps the sheet on that scope's tokens, or
@@ -94,17 +130,40 @@ type SheetContentProps = Omit<DialogProps, 'className' | 'style'> & Pick<ModalOv
94
130
  */
95
131
  container?: Element;
96
132
  /**
97
- * Whether a press on the scrim, outside the panel, closes the sheet.
98
- * `true` here where React Aria's own default is `false`, since a sheet
99
- * that ignores a tap outside it reads as stuck. Escape is
100
- * `isKeyboardDismissDisabled`'s, and this says nothing about it.
133
+ * Whether a press on the scrim, outside the panel, or a swipe toward the
134
+ * edge it rests on closes the sheet. `true` here where React Aria's own
135
+ * default for the scrim is `false`, since a sheet that ignores a tap
136
+ * outside it reads as stuck. Escape is `isKeyboardDismissDisabled`'s, and
137
+ * this says nothing about it.
101
138
  * @default true
102
139
  */
103
140
  isDismissable?: boolean;
141
+ /**
142
+ * Whether Escape is kept from closing the sheet. The scrim and the swipe
143
+ * are `isDismissable`'s, and this says nothing about them.
144
+ * @default false
145
+ */
146
+ isKeyboardDismissDisabled?: boolean;
147
+ /**
148
+ * The heights a bottom sheet rests at, each the amount of the panel
149
+ * showing: a number of pixels, or a percentage of the panel's own
150
+ * height. The sheet opens at the first, a swipe moves it between them,
151
+ * and a press on `Sheet.Handle` moves it to the next, from the last
152
+ * back to the first. React Aria's own prop, under its own name.
153
+ *
154
+ * End on `'100%'` for a sheet that can show all of itself: its body
155
+ * scrolls only while the whole panel is showing, and short of that a
156
+ * swipe on the body moves the sheet instead. The side sheet has one
157
+ * width and ignores them.
158
+ */
159
+ snapPoints?: Array<number | string>;
104
160
  /** A function may compute the style from the panel's render state. */
105
- style?: StyleOrFunction<ModalRenderProps>;
161
+ style?: StyleOrFunction<SheetRenderProps>;
162
+ };
163
+ type SheetProps = Omit<DialogTriggerProps, 'children'> & {
164
+ children?: ReactNode;
106
165
  };
107
166
  type SheetTitleProps = HeadingProps;
108
167
  //#endregion
109
- export { SheetBody, SheetContent, type SheetContentProps, SheetFooter, SheetHandle, SheetHeader, type SheetProps, SheetTitle, type SheetTitleProps, Sheet as default };
168
+ export { SheetBody, SheetContent$1 as SheetContent, type SheetContentProps, SheetFooter, SheetHandle, SheetHeader, type SheetProps, SheetTitle, type SheetTitleProps, Sheet$1 as default };
110
169
  //# sourceMappingURL=index.d.ts.map