panelui-native 0.46.0 → 0.51.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.
Files changed (87) hide show
  1. package/README.md +12 -1
  2. package/lib/module/components/accordion/index.js +32 -4
  3. package/lib/module/components/accordion/index.js.map +1 -1
  4. package/lib/module/components/button/index.js +83 -15
  5. package/lib/module/components/button/index.js.map +1 -1
  6. package/lib/module/components/button-group/index.js +186 -0
  7. package/lib/module/components/button-group/index.js.map +1 -0
  8. package/lib/module/components/color-picker/index.js +110 -1
  9. package/lib/module/components/color-picker/index.js.map +1 -1
  10. package/lib/module/components/date-time-picker/index.js +23 -5
  11. package/lib/module/components/date-time-picker/index.js.map +1 -1
  12. package/lib/module/components/fab/index.js +514 -0
  13. package/lib/module/components/fab/index.js.map +1 -0
  14. package/lib/module/components/markdown-editor/index.js +406 -0
  15. package/lib/module/components/markdown-editor/index.js.map +1 -0
  16. package/lib/module/components/markdown-editor/markdown-transforms.js +243 -0
  17. package/lib/module/components/markdown-editor/markdown-transforms.js.map +1 -0
  18. package/lib/module/components/questionnaire/index.js +1312 -0
  19. package/lib/module/components/questionnaire/index.js.map +1 -0
  20. package/lib/module/components/sortable/index.js +806 -0
  21. package/lib/module/components/sortable/index.js.map +1 -0
  22. package/lib/module/components/swipe/index.js +140 -5
  23. package/lib/module/components/swipe/index.js.map +1 -1
  24. package/lib/module/components/tabs/index.js +94 -18
  25. package/lib/module/components/tabs/index.js.map +1 -1
  26. package/lib/module/components/time-picker/index.js +34 -6
  27. package/lib/module/components/time-picker/index.js.map +1 -1
  28. package/lib/module/components/tree/index.js +500 -0
  29. package/lib/module/components/tree/index.js.map +1 -0
  30. package/lib/module/icons/index.js +246 -0
  31. package/lib/module/icons/index.js.map +1 -1
  32. package/lib/module/index.js +8 -2
  33. package/lib/module/index.js.map +1 -1
  34. package/lib/module/utils/haptics.js +19 -0
  35. package/lib/module/utils/haptics.js.map +1 -1
  36. package/lib/typescript/src/components/accordion/index.d.ts +21 -0
  37. package/lib/typescript/src/components/accordion/index.d.ts.map +1 -1
  38. package/lib/typescript/src/components/button/index.d.ts +21 -0
  39. package/lib/typescript/src/components/button/index.d.ts.map +1 -1
  40. package/lib/typescript/src/components/button-group/index.d.ts +212 -0
  41. package/lib/typescript/src/components/button-group/index.d.ts.map +1 -0
  42. package/lib/typescript/src/components/color-picker/index.d.ts +82 -1
  43. package/lib/typescript/src/components/color-picker/index.d.ts.map +1 -1
  44. package/lib/typescript/src/components/date-time-picker/index.d.ts +7 -1
  45. package/lib/typescript/src/components/date-time-picker/index.d.ts.map +1 -1
  46. package/lib/typescript/src/components/fab/index.d.ts +285 -0
  47. package/lib/typescript/src/components/fab/index.d.ts.map +1 -0
  48. package/lib/typescript/src/components/markdown-editor/index.d.ts +102 -0
  49. package/lib/typescript/src/components/markdown-editor/index.d.ts.map +1 -0
  50. package/lib/typescript/src/components/markdown-editor/markdown-transforms.d.ts +76 -0
  51. package/lib/typescript/src/components/markdown-editor/markdown-transforms.d.ts.map +1 -0
  52. package/lib/typescript/src/components/questionnaire/index.d.ts +336 -0
  53. package/lib/typescript/src/components/questionnaire/index.d.ts.map +1 -0
  54. package/lib/typescript/src/components/sortable/index.d.ts +238 -0
  55. package/lib/typescript/src/components/sortable/index.d.ts.map +1 -0
  56. package/lib/typescript/src/components/swipe/index.d.ts +35 -0
  57. package/lib/typescript/src/components/swipe/index.d.ts.map +1 -1
  58. package/lib/typescript/src/components/tabs/index.d.ts +9 -0
  59. package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
  60. package/lib/typescript/src/components/time-picker/index.d.ts +19 -1
  61. package/lib/typescript/src/components/time-picker/index.d.ts.map +1 -1
  62. package/lib/typescript/src/components/tree/index.d.ts +125 -0
  63. package/lib/typescript/src/components/tree/index.d.ts.map +1 -0
  64. package/lib/typescript/src/icons/index.d.ts +30 -0
  65. package/lib/typescript/src/icons/index.d.ts.map +1 -1
  66. package/lib/typescript/src/index.d.ts +10 -4
  67. package/lib/typescript/src/index.d.ts.map +1 -1
  68. package/lib/typescript/src/utils/haptics.d.ts +14 -0
  69. package/lib/typescript/src/utils/haptics.d.ts.map +1 -1
  70. package/package.json +1 -1
  71. package/src/components/accordion/index.tsx +48 -6
  72. package/src/components/button/index.tsx +97 -15
  73. package/src/components/button-group/index.tsx +199 -0
  74. package/src/components/color-picker/index.tsx +140 -3
  75. package/src/components/date-time-picker/index.tsx +39 -3
  76. package/src/components/fab/index.tsx +583 -0
  77. package/src/components/markdown-editor/index.tsx +526 -0
  78. package/src/components/markdown-editor/markdown-transforms.ts +228 -0
  79. package/src/components/questionnaire/index.tsx +1615 -0
  80. package/src/components/sortable/index.tsx +1080 -0
  81. package/src/components/swipe/index.tsx +165 -3
  82. package/src/components/tabs/index.tsx +100 -28
  83. package/src/components/time-picker/index.tsx +42 -6
  84. package/src/components/tree/index.tsx +564 -0
  85. package/src/icons/index.tsx +176 -0
  86. package/src/index.ts +89 -1
  87. package/src/utils/haptics.ts +21 -0
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # PanelUI — React Native UI components for Expo, styled with Tailwind CSS
2
2
 
3
3
  **PanelUI** (`panelui-native`) is an accessible, high-performance React Native component
4
- library for Expo apps. 84 typed components — buttons, bottom sheets, dialogs, selects,
4
+ library for Expo apps. 93 typed components — buttons, bottom sheets, dialogs, selects,
5
5
  toasts, forms — styled with Tailwind CSS v4 and animated on the UI thread with Reanimated.
6
6
  Zero native code, so it runs in Expo Go.
7
7
 
@@ -175,6 +175,7 @@ you are done. Unstyled text on a white screen means the styles are not reaching
175
175
  | `BottomSheet` | Draggable sheet anchored to the bottom of the screen |
176
176
  | `Breadcrumb` | The trail of links back up the hierarchy to the current page |
177
177
  | `Button` | Pressable action with variants, sizes, loading state and icon slots |
178
+ | `ButtonGroup` | Several buttons drawn as one control |
178
179
  | `Calendar` | A month of days, for picking one, several, or a range |
179
180
  | `Card` | Content surface with header, body and footer |
180
181
  | `Carousel` | A run of slides, one at a time, dragged with a finger |
@@ -184,22 +185,27 @@ you are done. Unstyled text on a white screen means the styles are not reaching
184
185
  | `ColorPicker` | A colour chosen by dragging — a saturation square, a hue scale, and opacity |
185
186
  | `Combobox` | A text field that filters a list of options as you type |
186
187
  | `DatePicker` | A calendar behind a button |
188
+ | `DateTimePicker` | A day and a time of day, picked in one panel |
187
189
  | `Dialog` | Modal dialog with a backdrop and footer actions |
188
190
  | `Direction` | Reading direction for everything below it |
189
191
  | `Drawer` | Panel that slides in from an edge of the screen |
190
192
  | `EmptyState` | Placeholder for a list or screen with no content |
193
+ | `Fab` | The floating action button, and the dial behind it |
191
194
  | `Field` | Layout and validation-state kit a form control composes into |
192
195
  | `Flow` | Pan-and-zoom canvas of draggable nodes joined by animated edges |
193
196
  | `Form` | Form state — values, validation and submission — with no form library underneath |
194
197
  | `Frame` | Widget shell — a card of rows sitting in a titled tray |
198
+ | `GridItem` | Bento tiles, and the grid that places them |
195
199
  | `HeatmapChart` | Contribution grid with a themed colour ramp and a readout |
196
200
  | `Input` | Text field with label, description and error message |
197
201
  | `InputGroup` | Input with leading and trailing decorators |
198
202
  | `Item` | Row of media, text and actions for lists and settings |
203
+ | `Kpi` | One number, what it is doing, and the shape it made getting there |
199
204
  | `Label` | Form field label with required, invalid and disabled states |
200
205
  | `LineChart` | Animated time series, drawn on the UI thread |
201
206
  | `Loader` | Nine loading animations behind one variant prop |
202
207
  | `Map` | Vector map whose basemap is drawn from your theme tokens |
208
+ | `MarkdownEditor` | A field for writing markdown, with a toolbar and a preview |
203
209
  | `Marker` | Inline note between conversation turns |
204
210
  | `Menu` | The list of things you can do to something |
205
211
  | `Message` | Chat turn with avatar, bubble, header and footer |
@@ -208,10 +214,13 @@ you are done. Unstyled text on a white screen means the styles are not reaching
208
214
  | `OtpInput` | One-time-code field drawn as a row of separate cells |
209
215
  | `Pagination` | Paged navigation over a long result set |
210
216
  | `Panelside` | Collapsible side panel with its own search, groups and scenes |
217
+ | `PieChart` | One whole, divided between its parts |
211
218
  | `Plan` | What an agent intends to do, before it does it |
212
219
  | `Popover` | Panel anchored to the element that opened it |
213
220
  | `Post` | Social card — author, body, media and the counts underneath |
214
221
  | `Progress` | Determinate and indeterminate progress bar |
222
+ | `Questionnaire` | One question at a time, with progress, validation and a way back |
223
+ | `RadarChart` | Several measures of one thing, drawn as one shape |
215
224
  | `RadioGroup` | Single-select list of options |
216
225
  | `Rating` | A row of stars to read or set a score |
217
226
  | `Reasoning` | An agent’s thinking, collapsed until you want it |
@@ -228,6 +237,7 @@ you are done. Unstyled text on a white screen means the styles are not reaching
228
237
  | `Signature` | Sign with a finger, and get the result back out as SVG or PNG |
229
238
  | `Skeleton` | Shimmer placeholder for loading content |
230
239
  | `Slider` | Pick a value, or a span, by dragging a thumb along a track |
240
+ | `Sortable` | A list whose rows can be dragged into a different order |
231
241
  | `Soundwave` | What a voice looks like while an app listens |
232
242
  | `Sources` | The references behind an answer, behind a disclosure |
233
243
  | `Spinner` | Indeterminate loading indicator |
@@ -246,6 +256,7 @@ you are done. Unstyled text on a white screen means the styles are not reaching
246
256
  | `Toast` | Transient notification queue with swipe to dismiss |
247
257
  | `ToggleButton` | A button that stays down, on its own or in a group |
248
258
  | `Tooltip` | A small label that names the control under your finger |
259
+ | `Tree` | A hierarchy you can open a level at a time |
249
260
  | `Typography` | Semantic text presets |
250
261
 
251
262
  Plus `PanelUIProvider`, `Portal`, `AnimatedPressable`, `KeyboardAvoider`, `ScrollProgress`,
@@ -11,6 +11,14 @@
11
11
  * `selectionMode` decides whether opening one section closes the others, which
12
12
  * also changes the shape of `value`: a string when single, an array when
13
13
  * multiple.
14
+ *
15
+ * A closed section costs nothing, because its body is unmounted. That is the
16
+ * right default and the wrong one for a body with state in it: a half-filled
17
+ * form, a list scrolled to the middle, a video part-way through. Collapsing
18
+ * such a section throws that away and reopening it starts over. `keepMounted`
19
+ * is the way out — the body stays mounted and is hidden from layout instead,
20
+ * so it takes up no room, the same layout transition carries the change, and
21
+ * everything inside is exactly where it was left.
14
22
  */
15
23
  import { Children, createContext, forwardRef, isValidElement, useCallback, useContext, useMemo, useState } from 'react';
16
24
  import { Pressable, View } from 'react-native';
@@ -87,6 +95,7 @@ const AccordionRoot = /*#__PURE__*/forwardRef(({
87
95
  defaultValue,
88
96
  onValueChange,
89
97
  hideSeparator = false,
98
+ keepMounted = false,
90
99
  children,
91
100
  ...props
92
101
  }, ref) => {
@@ -103,8 +112,9 @@ const AccordionRoot = /*#__PURE__*/forwardRef(({
103
112
  const context = useMemo(() => ({
104
113
  expanded,
105
114
  toggle,
106
- variant
107
- }), [expanded, toggle, variant]);
115
+ variant,
116
+ keepMounted
117
+ }), [expanded, toggle, variant, keepMounted]);
108
118
  const {
109
119
  root,
110
120
  separator
@@ -251,14 +261,25 @@ AccordionIndicator.displayName = 'Accordion.Indicator';
251
261
  * The collapsible body. Unmounts when closed, per the repo's convention for
252
262
  * conditionally shown content — the layout transition on the item animates
253
263
  * the height change.
264
+ *
265
+ * `keepMounted` swaps the unmount for `display: 'none'`, which is the one way
266
+ * to hide a view that also takes it out of Yoga's layout. That matters twice
267
+ * over: the item's height changes by exactly as much as it would have on an
268
+ * unmount, so the same layout transition plays and the two modes are
269
+ * indistinguishable to look at — and everything inside stays mounted, so a
270
+ * text field keeps what was typed into it. A hidden subtree is still in the
271
+ * accessibility tree, though, so it is explicitly taken out of that too;
272
+ * otherwise a screen reader would read out a section the eye cannot see.
254
273
  */
255
274
  const AccordionContent = /*#__PURE__*/forwardRef(({
256
275
  className,
276
+ keepMounted,
257
277
  children,
258
278
  ...props
259
279
  }, ref) => {
260
280
  const {
261
- variant
281
+ variant,
282
+ keepMounted: keepMountedDefault
262
283
  } = useAccordion('Accordion.Content');
263
284
  const {
264
285
  isExpanded
@@ -269,9 +290,16 @@ const AccordionContent = /*#__PURE__*/forwardRef(({
269
290
  } = accordionVariants({
270
291
  variant
271
292
  });
272
- if (!isExpanded) return null;
293
+ const stayMounted = keepMounted ?? keepMountedDefault;
294
+ if (!isExpanded && !stayMounted) return null;
295
+ const isHidden = !isExpanded;
273
296
  return /*#__PURE__*/_jsx(View, {
274
297
  ref: ref,
298
+ style: isHidden ? {
299
+ display: 'none'
300
+ } : undefined,
301
+ accessibilityElementsHidden: isHidden,
302
+ importantForAccessibility: isHidden ? 'no-hide-descendants' : 'auto',
275
303
  className: content({
276
304
  className
277
305
  }),
@@ -1 +1 @@
1
- {"version":3,"names":["Children","createContext","forwardRef","isValidElement","useCallback","useContext","useMemo","useState","Pressable","View","Animated","LinearTransition","useAnimatedStyle","useDerivedValue","withTiming","tv","ChevronDownIcon","Text","textChildren","jsx","_jsx","jsxs","_jsxs","accordionVariants","slots","root","separator","item","trigger","title","indicator","content","contentText","variants","variant","default","surface","separated","bordered","ghost","defaultVariants","AccordionContext","AccordionItemContext","useAccordion","component","context","Error","useAccordionItem","toArray","value","undefined","Array","isArray","AccordionRoot","className","selectionMode","defaultValue","onValueChange","hideSeparator","children","props","ref","internal","setInternal","isControlled","expanded","toggle","itemValue","isOpen","includes","next","filter","entry","items","Provider","layout","duration","map","child","index","length","key","displayName","AccordionItem","isDisabled","isExpanded","AccordionTrigger","accessibilityRole","accessibilityState","disabled","onPress","text","AccordionIndicator","rotation","style","transform","rotate","size","AccordionContent","AccordionTitle","Accordion","Object","assign","Item","Trigger","Title","Indicator","Content"],"sourceRoot":"../../../../src","sources":["components/accordion/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,QAAQ,EACRC,aAAa,EACbC,UAAU,EACVC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QAEH,OAAO;AACd,SAASC,SAAS,EAAEC,IAAI,QAA6C,cAAc;AACnF,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,UAAU,QACL,yBAAyB;AAChC,SAASC,EAAE,QAAQ,mBAAmB;AACtC,SAASC,eAAe,QAAQ,sBA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,CAACX,IAAI;IAACoD,GAAG,EAAEA,GAAI;IAACP,SAAS,EAAEvB,OAAO,CAAC;MAAEuB;IAAU,CAAC,CAAE;IAAA,GAAKM,KAAK;IAAAD,QAAA,EACzDzC,YAAY,CAACyC,QAAQ,EAAGgC,IAAI,iBAC3BvE,IAAA,CAACH,IAAI;MAACqC,SAAS,EAAEtB,WAAW,CAAC,CAAE;MAAA2B,QAAA,EAAEgC;IAAI,CAAO,CAC7C;EAAC,CACE,CAAC;AAEX,CACF,CAAC;AACDO,gBAAgB,CAAChB,WAAW,GAAG,mBAAmB;AAElD,MAAMiB,cAAc,gBAAGjG,UAAU,CAAoB,CAAC;EAAEoD,SAAS;EAAE,GAAGM;AAAM,CAAC,EAAEC,GAAG,KAAK;EACrF,MAAM;IAAE3B;EAAQ,CAAC,GAAGS,YAAY,CAAC,iBAAiB,CAAC;EACnD,MAAM;IAAEd;EAAM,CAAC,GAAGN,iBAAiB,CAAC;IAAEW;EAAQ,CAAC,CAAC;EAChD,oBAAOd,IAAA,CAACH,IAAI;IAAC4C,GAAG,EAAEA,GAAI;IAACP,SAAS,EAAEzB,KAAK,CAAC;MAAEyB;IAAU,CAAC,CAAE;IAAA,GAAKM;EAAK,CAAG,CAAC;AACvE,CAAC,CAAC;AACFuC,cAAc,CAACjB,WAAW,GAAG,iBAAiB;AAE9C,OAAO,MAAMkB,SAAS,GAAGC,MAAM,CAACC,MAAM,CAACjD,aAAa,EAAE;EACpDkD,IAAI,EAAEpB,aAAa;EACnBqB,OAAO,EAAElB,gBAAgB;EACzBmB,KAAK,EAAEN,cAAc;EACrBO,SAAS,EAAEd,kBAAkB;EAC7Be,OAAO,EAAET;AACX,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Children","createContext","forwardRef","isValidElement","useCallback","useContext","useMemo","useState","Pressable","View","Animated","LinearTransition","useAnimatedStyle","useDerivedValue","withTiming","tv","ChevronDownIcon","Text","textChildren","jsx","_jsx","jsxs","_jsxs","accordionVariants","slots","root","separator","item","trigger","title","indicator","content","contentText","variants","variant","default","surface","separated","bordered","ghost","defaultVariants","AccordionContext","AccordionItemContext","useAccordion","component","context","Error","useAccordionItem","toArray","value","undefined","Array","isArray","AccordionRoot","className","selectionMode","defaultValue","onValueChange","hideSeparator","keepMounted","children","props","ref","internal","setInternal","isControlled","expanded","toggle","itemValue","isOpen","includes","next","filter","entry","items","Provider","layout","duration","map","child","index","length","key","displayName","AccordionItem","isDisabled","isExpanded","AccordionTrigger","accessibilityRole","accessibilityState","disabled","onPress","text","AccordionIndicator","rotation","style","transform","rotate","size","AccordionContent","keepMountedDefault","stayMounted","isHidden","display","accessibilityElementsHidden","importantForAccessibility","AccordionTitle","Accordion","Object","assign","Item","Trigger","Title","Indicator","Content"],"sourceRoot":"../../../../src","sources":["components/accordion/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,QAAQ,EACRC,aAAa,EACbC,UAAU,EACVC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QAEH,OAAO;AACd,SAASC,SAAS,EAAEC,IAAI,QAA6C,cAAc;AACnF,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,UAAU,QACL,yBAAyB;AAChC,SAASC,EAAE,QAAQ,mBAAmB;AACtC,SAASC,eAAe,QAAQ,sBAAa;AAC7C,SAASC,IAAI,EAAkBC,YAAY,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAW3E,MAAMC,iBAAiB,GAAGR,EAAE,CAAC;EAC3BS,KAAK,EAAE;IACLC,IAAI,EAAE,iCAAiC;IACvCC,SAAS,EAAE,gBAAgB;IAC3BC,IAAI,EAAE,0BAA0B;IAChCC,OAAO,EAAE,kDAAkD;IAC3DC,KAAK,EAAE,8CA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'react';
3
+ import { createContext, forwardRef, useContext } from 'react';
4
4
  import { View } from 'react-native';
5
5
  import { tv } from 'tailwind-variants';
6
6
  import { useCSSVariable } from 'uniwind';
7
7
  import { AnimatedPressable } from "../../primitives/animated-pressable.js";
8
8
  import { Text, textChildren } from "../../primitives/text.js";
9
+ import { cn } from "../../utils/cn.js";
9
10
  import { IconColorProvider } from "../../icons/index.js";
10
11
  import { getNativeUI, getSwiftUIModifiers } from "../../native/index.js";
11
12
  import { Spinner } from "../spinner/index.js";
@@ -83,6 +84,53 @@ const buttonVariants = tv({
83
84
  size: 'md'
84
85
  }
85
86
  });
87
+
88
+ /** How a button looks. */
89
+
90
+ /** How big a button is. `icon` is a square. */
91
+
92
+ /* -------------------------------------------------------------------------- *
93
+ * Grouping
94
+ *
95
+ * A button reads this; `ButtonGroup` writes it. The context lives here rather
96
+ * than beside the group because the button is the consumer, and a component
97
+ * should not have to import the thing that contains it to find out that it is
98
+ * contained — which would also make the two import each other.
99
+ * -------------------------------------------------------------------------- */
100
+
101
+ const ButtonGroupContext = /*#__PURE__*/createContext(null);
102
+
103
+ /** Announces to every button below it that it is part of one control. */
104
+ export function ButtonGroupProvider({
105
+ value,
106
+ children
107
+ }) {
108
+ return /*#__PURE__*/_jsx(ButtonGroupContext.Provider, {
109
+ value: value,
110
+ children: children
111
+ });
112
+ }
113
+
114
+ /** The enclosing group, if there is one. `null` for a button standing alone. */
115
+ export function useButtonGroup() {
116
+ return useContext(ButtonGroupContext);
117
+ }
118
+
119
+ /**
120
+ * What an attached button gives up so the group can draw the shape once.
121
+ *
122
+ * The radius and the shadow go because the group owns both — a rounded,
123
+ * shadowed segment inside a rounded, shadowed container is two shapes where
124
+ * there should be one. The border stays but turns transparent rather than
125
+ * being removed: it is holding a pixel of the button's height, and dropping it
126
+ * would make an `outline` segment a hair shorter than a `ghost` one beside it.
127
+ *
128
+ * The press feedback changes too. A button on its own shrinks slightly when
129
+ * pressed, which inside a joined run would pull the segment away from its
130
+ * neighbours and show the container through the gap. A background is the same
131
+ * signal without the movement.
132
+ */
133
+ const ATTACHED = 'rounded-none border-transparent shadow-none active:bg-accent';
86
134
  const SPINNER_SIZE = {
87
135
  sm: 'sm',
88
136
  md: 'sm',
@@ -192,22 +240,39 @@ export const Button = /*#__PURE__*/forwardRef(({
192
240
  }, ref) => {
193
241
  const isDisabled = disabled || loading;
194
242
  const nativeUI = native ? getNativeUI() : null;
243
+
244
+ /*
245
+ * A group fills in what a button did not say for itself, and never
246
+ * overrides what it did: a run of buttons should look like one control
247
+ * without every segment repeating the same two props, and the odd segment
248
+ * that wants to stand out — the selected one, the destructive one — has to
249
+ * be able to say so.
250
+ *
251
+ * `native` is deliberately outside all of this. The platform draws that
252
+ * button, so it has no border, radius or shadow for a group to take over,
253
+ * and joining several of them would produce a row of platform buttons with
254
+ * a border drawn around it rather than a segmented control.
255
+ */
256
+ const group = useButtonGroup();
257
+ const attached = !native && group?.attached === true;
258
+ const resolvedVariant = variant ?? group?.variant;
259
+ const resolvedSize = size ?? group?.size;
195
260
  const {
196
261
  root,
197
262
  label,
198
263
  spinner
199
264
  } = buttonVariants({
200
- variant,
201
- size,
202
- fullWidth,
265
+ variant: resolvedVariant,
266
+ size: resolvedSize,
267
+ fullWidth: fullWidth ?? (attached && group?.fullWidth),
203
268
  disabled: isDisabled
204
269
  });
205
270
 
206
271
  // Icons in the content slots inherit this, so they stay legible when the
207
272
  // theme inverts the button's background. Without it every caller has to
208
273
  // hardcode a hex that is wrong in one theme or the other.
209
- const themedColor = useCSSVariable(CONTENT_COLOR_VAR[variant === 'destructive' ? 'primary' : variant ?? 'primary']);
210
- const contentColor = variant === 'destructive' ? '#ffffff' : typeof themedColor === 'string' ? themedColor : undefined;
274
+ const themedColor = useCSSVariable(CONTENT_COLOR_VAR[resolvedVariant === 'destructive' ? 'primary' : resolvedVariant ?? 'primary']);
275
+ const contentColor = resolvedVariant === 'destructive' ? '#ffffff' : typeof themedColor === 'string' ? themedColor : undefined;
211
276
  if (nativeUI) {
212
277
  const {
213
278
  Host,
@@ -215,7 +280,7 @@ export const Button = /*#__PURE__*/forwardRef(({
215
280
  RNHostView
216
281
  } = nativeUI;
217
282
  const isStringLabel = typeof children === 'string';
218
- const prominent = variant === 'primary' || variant === 'destructive';
283
+ const prominent = resolvedVariant === 'primary' || resolvedVariant === 'destructive';
219
284
 
220
285
  /*
221
286
  * Looks the portable props cannot ask for.
@@ -232,7 +297,7 @@ export const Button = /*#__PURE__*/forwardRef(({
232
297
  * button somebody forgot to label. It shapes the glass too.
233
298
  */
234
299
  const swiftUI = getSwiftUIModifiers();
235
- const nativeModifiers = swiftUI ? [glass ? swiftUI.buttonStyle(prominent ? 'glassProminent' : 'glass') : null, size === 'icon' ? swiftUI.buttonBorderShape('circle') : null, isStringLabel ? swiftUI.controlSize(NATIVE_CONTROL_SIZE[size ?? 'md']) : null].filter(Boolean) : [];
300
+ const nativeModifiers = swiftUI ? [glass ? swiftUI.buttonStyle(prominent ? 'glassProminent' : 'glass') : null, resolvedSize === 'icon' ? swiftUI.buttonBorderShape('circle') : null, isStringLabel ? swiftUI.controlSize(NATIVE_CONTROL_SIZE[resolvedSize ?? 'md']) : null].filter(Boolean) : [];
236
301
 
237
302
  /*
238
303
  * The platform paints the background, not the theme — so a hosted icon
@@ -246,7 +311,7 @@ export const Button = /*#__PURE__*/forwardRef(({
246
311
  matchContents: true,
247
312
  children: /*#__PURE__*/_jsx(NativeButton, {
248
313
  label: isStringLabel ? children : undefined,
249
- variant: NATIVE_VARIANT[variant ?? 'primary'],
314
+ variant: NATIVE_VARIANT[resolvedVariant ?? 'primary'],
250
315
  disabled: isDisabled
251
316
  /*
252
317
  * A square for an icon button, a height for a labelled one — and
@@ -258,18 +323,18 @@ export const Button = /*#__PURE__*/forwardRef(({
258
323
  * background around. The frame only has to be large enough to hold
259
324
  * the result.
260
325
  */,
261
- style: size === 'icon' ? {
326
+ style: resolvedSize === 'icon' ? {
262
327
  width: NATIVE_ICON_FRAME,
263
328
  height: NATIVE_ICON_FRAME
264
329
  } : {
265
- height: NATIVE_HEIGHT[size ?? 'md']
330
+ height: NATIVE_HEIGHT[resolvedSize ?? 'md']
266
331
  },
267
332
  modifiers: nativeModifiers.length ? nativeModifiers : undefined,
268
333
  onPress: props.onPress,
269
334
  children: isStringLabel ? undefined : /*#__PURE__*/_jsx(RNHostView, {
270
335
  matchContents: true,
271
336
  children: /*#__PURE__*/_jsx(View, {
272
- style: size === 'icon' ? {
337
+ style: resolvedSize === 'icon' ? {
273
338
  padding: NATIVE_ICON_PADDING,
274
339
  alignItems: 'center',
275
340
  justifyContent: 'center'
@@ -297,13 +362,16 @@ export const Button = /*#__PURE__*/forwardRef(({
297
362
  disabled: isDisabled,
298
363
  busy: loading
299
364
  },
300
- disabled: isDisabled,
365
+ disabled: isDisabled
366
+ // Before the spread, so a caller can still ask for the scale back.
367
+ ,
368
+ pressScale: attached ? 1 : undefined,
301
369
  className: root({
302
- className
370
+ className: cn(attached && ATTACHED, className)
303
371
  }),
304
372
  ...props,
305
373
  children: [loading ? /*#__PURE__*/_jsx(Spinner, {
306
- size: SPINNER_SIZE[size ?? 'md'],
374
+ size: SPINNER_SIZE[resolvedSize ?? 'md'],
307
375
  className: spinner()
308
376
  }) : startContent, textChildren(children, text => /*#__PURE__*/_jsx(Text, {
309
377
  className: label({
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","View","tv","useCSSVariable","AnimatedPressable","Text","textChildren","IconColorProvider","getNativeUI","getSwiftUIModifiers","Spinner","jsx","_jsx","jsxs","_jsxs","buttonVariants","slots","root","label","spinner","variants","variant","primary","secondary","outline","ghost","destructive","social","size","sm","md","lg","icon","fullWidth","true","disabled","defaultVariants","SPINNER_SIZE","CONTENT_COLOR_VAR","NATIVE_HEIGHT","NATIVE_ICON_PADDING","NATIVE_ICON_FRAME","NATIVE_CONTROL_SIZE","NATIVE_VARIANT","Button","children","className","labelClassName","loading","startContent","endContent","native","glass","props","ref","isDisabled","nativeUI","themedColor","contentColor","undefined","Host","NativeButton","RNHostView","isStringLabel","prominent","swiftUI","nativeModifiers","buttonStyle","buttonBorderShape","controlSize","filter","Boolean","nativeContent","matchContents","style","width","height","modifiers","length","onPress","padding","alignItems","justifyContent","color","text","accessibilityRole","accessibilityState","busy","displayName"],"sourceRoot":"../../../../src","sources":["components/button/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAwB,OAAO;AAClD,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,cAAc,QAAQ,SAAS;AACxC,SACEC,iBAAiB,QAEZ,wCAAqC;AAC5C,SAASC,IAAI,EAAEC,YAAY,QAAQ,0BAAuB;AAC1D,SAASC,iBAAiB,QAAQ,sBAAa;AAC/C,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,uBAAc;AAC/D,SAASC,OAAO,QAAQ,qBAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAErC,MAAMC,cAAc,GAAGb,EAAE,CAAC;EACxBc,KAAK,EAAE;IACLC,IAAI,EAAE,iFAAiF;IACvFC,KAAK,EAAE,aAAa;IACpBC,OAAO,EAAE;EACX,CAAC;EACDC,QAAQ,EAAE;IACRC,OAAO,EAAE;MACPC,OAAO,EAAE;QACPL,IAAI,EAAE,qCAAqC;QAC3CC,KAAK,EAAE,yBAAyB;QAChCC,OAAO,EAAE;MACX,CAAC;MACDI,SAAS,EAAE;QACTN,IAAI,EAAE,cAAc;QACpBC,KAAK,EAAE,2BAA2B;QAClCC,OAAO,EAAE;MACX,CAAC;MACDK,OAAO,EAAE;QACPP,IAAI,EAAE,mCAAmC;QACzCC,KAAK,EAAE,iBAAiB;QACxBC,OAAO,EAAE;MACX,CAAC;MACDM,KAAK,EAAE;QACLR,IAAI,EAAE,gBAAgB;QACtBC,KAAK,EAAE,iBAAiB;QACxBC,OAAO,EAAE;MACX,CAAC;MACDO,WAAW,EAAE;QACXT,IAAI,EAAE,6CAA6C;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,CAAC;QAAE6B;MAAU,CAAC,CAAE;MAAA,GAC3BO,KAAK;MAAAR,QAAA,GAERG,OAAO,gBACNpC,IAAA,CAACF,OAAO;QAACkB,IAAI,EAAES,YAAY,CAACT,IAAI,IAAI,IAAI,CAAE;QAACkB,SAAS,EAAE3B,OAAO,CAAC;MAAE,CAAE,CAAC,GAEnE8B,YACD,EACA3C,YAAY,CAACuC,QAAQ,EAAGuC,IAAI,iBAC3BxE,IAAA,CAACP,IAAI;QAACyC,SAAS,EAAE5B,KAAK,CAAC;UAAE4B,SAAS,EAAEC;QAAe,CAAC,CAAE;QAAAF,QAAA,EAAEuC;MAAI,CAAO,CACpE,CAAC,EACDlC,UAAU;IAAA,CACM;EAAC,CACH,CAAC;AAExB,CACF,CAAC;AAEDN,MAAM,CAAC4C,WAAW,GAAG,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["createContext","forwardRef","useContext","View","tv","useCSSVariable","AnimatedPressable","Text","textChildren","cn","IconColorProvider","getNativeUI","getSwiftUIModifiers","Spinner","jsx","_jsx","jsxs","_jsxs","buttonVariants","slots","root","label","spinner","variants","variant","primary","secondary","outline","ghost","destructive","social","size","sm","md","lg","icon","fullWidth","true","disabled","defaultVariants","ButtonGroupContext","ButtonGroupProvider","value","children","Provider","useButtonGroup","ATTACHED","SPINNER_SIZE","CONTENT_COLOR_VAR","NATIVE_HEIGHT","NATIVE_ICON_PADDING","NATIVE_ICON_FRAME","NATIVE_CONTROL_SIZE","NATIVE_VARIANT","Button","className","labelClassName","loading","startContent","endContent","native","glass","props","ref","isDisabled","nativeUI","group","attached","resolvedVariant","resolvedSize","themedColor","contentColor","undefined","Host","NativeButton","RNHostView","isStringLabel","prominent","swiftUI","nativeModifiers","buttonStyle","buttonBorderShape","controlSize","filter","Boolean","nativeContent","matchContents","style","width","height","modifiers","length","onPress","padding","alignItems","justifyContent","color","text","accessibilityRole","accessibilityState","busy","pressScale","displayName"],"sourceRoot":"../../../../src","sources":["components/button/index.tsx"],"mapp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C;UAAEkC,SAAS,EAAEC;QAAe,CAAC,CAAE;QAAAb,QAAA,EAAEsD;MAAI,CAAO,CACpE,CAAC,EACDtC,UAAU;IAAA,CACM;EAAC,CACH,CAAC;AAExB,CACF,CAAC;AAEDL,MAAM,CAACgD,WAAW,GAAG,QAAQ","ignoreList":[]}
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * ButtonGroup — several buttons drawn as one control.
5
+ *
6
+ * ```tsx
7
+ * <ButtonGroup>
8
+ * <Button startContent={<ListChecksIcon size={16} />}>Tasks</Button>
9
+ * <Button startContent={<CalendarIcon size={16} />}>Agenda</Button>
10
+ * <Button startContent={<ChartIcon size={16} />}>Board</Button>
11
+ * </ButtonGroup>
12
+ * ```
13
+ *
14
+ * The buttons stay buttons. Anything a `Button` does — an icon, a badge, a
15
+ * loading state, a disabled segment, opening a Popover — it still does inside a
16
+ * group, because the group is a container rather than a component that takes a
17
+ * list of items and renders them for you. A list-of-items API has to grow a
18
+ * prop for every one of those things; this one has none of them and can do all
19
+ * of them.
20
+ *
21
+ * ## Why the container draws the border
22
+ *
23
+ * A joined run could be built by giving the first and last segments their
24
+ * corners and squaring the ones between, then collapsing every shared edge with
25
+ * a negative margin. That works on the web and is a stack of off-by-one
26
+ * problems on a phone: the hairlines land on different fractions of a pixel per
27
+ * device, and a run that wraps has no first or last segment any more.
28
+ *
29
+ * So the group draws the shape once — one border, one radius, one shadow,
30
+ * clipped — and the buttons inside it draw none of their own. The dividers are
31
+ * real one-pixel views the group puts between its children, which is also why
32
+ * they are always exactly one pixel and always in the same place.
33
+ *
34
+ * ## What it passes down
35
+ *
36
+ * `variant` and `size` fill in for a button that did not choose its own, so a
37
+ * run of six does not repeat the same two props six times. A segment that wants
38
+ * to stand out — the selected one, the destructive one — sets its own and wins.
39
+ *
40
+ * ```tsx
41
+ * <ButtonGroup size="sm">
42
+ * <Button>Day</Button>
43
+ * <Button variant="secondary">Week</Button> {/* the selected one *\/}
44
+ * <Button>Month</Button>
45
+ * </ButtonGroup>
46
+ * ```
47
+ *
48
+ * ## Not a selection control
49
+ *
50
+ * This joins buttons; what they mean is yours. For a control that owns which
51
+ * one is on, reach for `ToggleButtonGroup`, and for switching between panels of
52
+ * content reach for `Tabs` — a segmented run of buttons that swaps a screen is
53
+ * navigation, and navigation should say so to a screen reader.
54
+ */
55
+ import { Children, Fragment, forwardRef, useMemo } from 'react';
56
+ import { View } from 'react-native';
57
+ import { tv } from 'tailwind-variants';
58
+ import { ButtonGroupProvider } from "../button/index.js";
59
+
60
+ /** Which way the run reads. */
61
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
62
+ const buttonGroupVariants = tv({
63
+ slots: {
64
+ root: 'items-stretch',
65
+ divider: 'bg-border'
66
+ },
67
+ variants: {
68
+ orientation: {
69
+ horizontal: {
70
+ root: 'flex-row',
71
+ divider: 'w-px'
72
+ },
73
+ vertical: {
74
+ root: 'flex-col',
75
+ divider: 'h-px'
76
+ }
77
+ },
78
+ attached: {
79
+ // `overflow-hidden` is what squares the inner corners and rounds the
80
+ // outer ones without any segment knowing which it is.
81
+ true: {
82
+ root: 'overflow-hidden border border-input bg-popover shadow-sm'
83
+ },
84
+ false: {
85
+ root: 'gap-2'
86
+ }
87
+ },
88
+ /* Matched to the height the buttons will be, since a radius that suited a
89
+ 36pt run reads as a rectangle around a 48pt one. */
90
+ size: {
91
+ sm: {
92
+ root: 'rounded-lg'
93
+ },
94
+ md: {
95
+ root: 'rounded-xl'
96
+ },
97
+ lg: {
98
+ root: 'rounded-xl'
99
+ },
100
+ icon: {
101
+ root: 'rounded-xl'
102
+ }
103
+ },
104
+ fullWidth: {
105
+ true: {
106
+ root: 'w-full'
107
+ }
108
+ }
109
+ },
110
+ compoundVariants: [
111
+ // Nothing is being joined, so the radius belongs to each button instead.
112
+ {
113
+ attached: false,
114
+ class: {
115
+ root: 'rounded-none'
116
+ }
117
+ }],
118
+ defaultVariants: {
119
+ orientation: 'horizontal',
120
+ attached: true,
121
+ size: 'md'
122
+ }
123
+ });
124
+ const ButtonGroupRoot = /*#__PURE__*/forwardRef(({
125
+ className,
126
+ orientation = 'horizontal',
127
+ variant,
128
+ size = 'md',
129
+ attached = true,
130
+ fullWidth = false,
131
+ children,
132
+ ...props
133
+ }, ref) => {
134
+ const {
135
+ root,
136
+ divider
137
+ } = buttonGroupVariants({
138
+ orientation,
139
+ attached,
140
+ size,
141
+ fullWidth
142
+ });
143
+ const context = useMemo(() => ({
144
+ variant,
145
+ size,
146
+ attached,
147
+ fullWidth
148
+ }), [variant, size, attached, fullWidth]);
149
+
150
+ /*
151
+ * `Children.toArray` rather than the raw children: it drops the nulls a
152
+ * conditional segment leaves behind and flattens fragments, so a run built
153
+ * by a `map` or by `{canEdit && <Button/>}` gets its dividers in the right
154
+ * places instead of one before a segment that is not there.
155
+ */
156
+ const items = Children.toArray(children);
157
+ return /*#__PURE__*/_jsx(ButtonGroupProvider, {
158
+ value: context,
159
+ children: /*#__PURE__*/_jsx(View, {
160
+ ref: ref
161
+ // A run of related actions is a toolbar; a screen reader announcing
162
+ // the group is what tells someone the buttons in it belong together.
163
+ ,
164
+ accessibilityRole: "toolbar",
165
+ className: root({
166
+ className
167
+ }),
168
+ ...props,
169
+ children: items.map((child, index) =>
170
+ /*#__PURE__*/
171
+ // Index keys: these fragments have no identity of their own, and
172
+ // the children keep whatever keys they were already given.
173
+ _jsxs(Fragment, {
174
+ children: [index > 0 && attached ? /*#__PURE__*/_jsx(View, {
175
+ className: divider()
176
+ }) : null, fullWidth ? /*#__PURE__*/_jsx(View, {
177
+ className: "flex-1",
178
+ children: child
179
+ }) : child]
180
+ }, index))
181
+ })
182
+ });
183
+ });
184
+ ButtonGroupRoot.displayName = 'ButtonGroup';
185
+ export const ButtonGroup = ButtonGroupRoot;
186
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Children","Fragment","forwardRef","useMemo","View","tv","ButtonGroupProvider","jsx","_jsx","jsxs","_jsxs","buttonGroupVariants","slots","root","divider","variants","orientation","horizontal","vertical","attached","true","false","size","sm","md","lg","icon","fullWidth","compoundVariants","class","defaultVariants","ButtonGroupRoot","className","variant","children","props","ref","context","items","toArray","value","accessibilityRole","map","child","index","displayName","ButtonGroup"],"sourceRoot":"../../../../src","sources":["components/button-group/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,OAAO,QAAwB,OAAO;AAC/E,SAASC,IAAI,QAAwB,cAAc;AACnD,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SACEC,mBAAmB,QAId,oBAAW;;AAElB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGA,MAAMC,mBAAmB,GAAGN,EAAE,CAAC;EAC7BO,KAAK,EAAE;IACLC,IAAI,EAAE,eAAe;IACrBC,OAAO,EAAE;EACX,CAAC;EACDC,QAAQ,EAAE;IACRC,WAAW,EAAE;MACXC,UAAU,EAAE;QAAEJ,IAAI,EAAE,UAAU;QAAEC,OAAO,EAAE;MAAO,CAAC;MACjDI,QAAQ,EAAE;QAAEL,IAAI,EAAE,UAAU;QAAEC,OAAO,EAAE;MAAO;IAChD,CAAC;IACDK,QAAQ,EAAE;MACR;MACA;MACAC,IAAI,EAAE;QAAEP,IAAI,EAAE;MAA2D,CAAC;MAC1EQ,KAAK,EAAE;QAAER,IAAI,EAAE;MAAQ;IACzB,CAAC;IACD;AACJ;IACIS,IAAI,EAAE;MACJC,EAAE,EAAE;QAAEV,IAAI,EAAE;MAAa,CAAC;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