@kanso-labs/react-native-kanso-ui 0.9.0 → 0.10.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 (196) hide show
  1. package/README.md +4 -3
  2. package/dist/autocomplete/index.js +15 -1
  3. package/dist/autocomplete/index.js.map +1 -1
  4. package/dist/button/group.d.ts +5 -0
  5. package/dist/button/group.js +115 -0
  6. package/dist/button/group.js.map +1 -0
  7. package/dist/button/index.d.ts +4 -1
  8. package/dist/button/index.js +44 -22
  9. package/dist/button/index.js.map +1 -1
  10. package/dist/button/slots.js +2 -1
  11. package/dist/button/slots.js.map +1 -1
  12. package/dist/calendar/index.js +351 -182
  13. package/dist/calendar/index.js.map +1 -1
  14. package/dist/calendar/styles.js +33 -2
  15. package/dist/calendar/styles.js.map +1 -1
  16. package/dist/carousel/arrangement.d.ts +5 -0
  17. package/dist/carousel/arrangement.js +123 -0
  18. package/dist/carousel/arrangement.js.map +1 -0
  19. package/dist/chequer/index.js +95 -0
  20. package/dist/chequer/index.js.map +1 -0
  21. package/dist/collection/index.d.ts +157 -0
  22. package/dist/collection/index.js +1331 -0
  23. package/dist/collection/index.js.map +1 -0
  24. package/dist/color-thumb/index.js +56 -0
  25. package/dist/color-thumb/index.js.map +1 -0
  26. package/dist/components/button/index.d.ts +4 -2
  27. package/dist/components/button/index.js +227 -188
  28. package/dist/components/button/index.js.map +1 -1
  29. package/dist/components/button-group/index.d.ts +87 -0
  30. package/dist/components/button-group/index.js +275 -0
  31. package/dist/components/button-group/index.js.map +1 -0
  32. package/dist/components/calendar/index.d.ts +11 -3
  33. package/dist/components/calendar/index.js +60 -45
  34. package/dist/components/calendar/index.js.map +1 -1
  35. package/dist/components/carousel/index.d.ts +72 -0
  36. package/dist/components/carousel/index.js +496 -0
  37. package/dist/components/carousel/index.js.map +1 -0
  38. package/dist/components/checkbox-group/index.d.ts +3 -4
  39. package/dist/components/checkbox-group/index.js +1 -1
  40. package/dist/components/checkbox-group/index.js.map +1 -1
  41. package/dist/components/color-area/index.d.ts +85 -0
  42. package/dist/components/color-area/index.js +630 -0
  43. package/dist/components/color-area/index.js.map +1 -0
  44. package/dist/components/color-field/index.d.ts +144 -0
  45. package/dist/components/color-field/index.js +516 -0
  46. package/dist/components/color-field/index.js.map +1 -0
  47. package/dist/components/color-picker/index.d.ts +74 -0
  48. package/dist/components/color-picker/index.js +317 -0
  49. package/dist/components/color-picker/index.js.map +1 -0
  50. package/dist/components/color-slider/index.d.ts +82 -0
  51. package/dist/components/color-slider/index.js +456 -0
  52. package/dist/components/color-slider/index.js.map +1 -0
  53. package/dist/components/color-swatch/index.d.ts +46 -0
  54. package/dist/components/color-swatch/index.js +127 -0
  55. package/dist/components/color-swatch/index.js.map +1 -0
  56. package/dist/components/color-swatch-picker/index.d.ts +81 -0
  57. package/dist/components/color-swatch-picker/index.js +287 -0
  58. package/dist/components/color-swatch-picker/index.js.map +1 -0
  59. package/dist/components/color-wheel/index.d.ts +71 -0
  60. package/dist/components/color-wheel/index.js +407 -0
  61. package/dist/components/color-wheel/index.js.map +1 -0
  62. package/dist/components/combo-box/index.d.ts +193 -0
  63. package/dist/components/combo-box/index.js +616 -0
  64. package/dist/components/combo-box/index.js.map +1 -0
  65. package/dist/components/date-field/index.d.ts +120 -0
  66. package/dist/components/date-field/index.js +111 -0
  67. package/dist/components/date-field/index.js.map +1 -0
  68. package/dist/components/date-picker/index.d.ts +130 -0
  69. package/dist/components/date-picker/index.js +310 -0
  70. package/dist/components/date-picker/index.js.map +1 -0
  71. package/dist/components/date-range-picker/index.d.ts +139 -0
  72. package/dist/components/date-range-picker/index.js +421 -0
  73. package/dist/components/date-range-picker/index.js.map +1 -0
  74. package/dist/components/disclosure/index.d.ts +94 -0
  75. package/dist/components/disclosure/index.js +365 -0
  76. package/dist/components/disclosure/index.js.map +1 -0
  77. package/dist/components/disclosure-group/index.d.ts +61 -0
  78. package/dist/components/disclosure-group/index.js +100 -0
  79. package/dist/components/disclosure-group/index.js.map +1 -0
  80. package/dist/components/drop-zone/index.d.ts +113 -0
  81. package/dist/components/drop-zone/index.js +304 -0
  82. package/dist/components/drop-zone/index.js.map +1 -0
  83. package/dist/components/fab/index.d.ts +1 -1
  84. package/dist/components/fab/index.js +91 -76
  85. package/dist/components/fab/index.js.map +1 -1
  86. package/dist/components/form/index.d.ts +3 -2
  87. package/dist/components/form/index.js.map +1 -1
  88. package/dist/components/icon-button/index.d.ts +4 -2
  89. package/dist/components/icon-button/index.js +204 -171
  90. package/dist/components/icon-button/index.js.map +1 -1
  91. package/dist/components/list/index.d.ts +15 -158
  92. package/dist/components/list/index.js +21 -1047
  93. package/dist/components/list/index.js.map +1 -1
  94. package/dist/components/list-box/index.d.ts +73 -0
  95. package/dist/components/list-box/index.js +82 -0
  96. package/dist/components/list-box/index.js.map +1 -0
  97. package/dist/components/loading-indicator/index.d.ts +32 -0
  98. package/dist/components/loading-indicator/index.js +174 -0
  99. package/dist/components/loading-indicator/index.js.map +1 -0
  100. package/dist/components/navigation-tree/index.d.ts +117 -0
  101. package/dist/components/navigation-tree/index.js +135 -0
  102. package/dist/components/navigation-tree/index.js.map +1 -0
  103. package/dist/components/number-field/index.js +132 -143
  104. package/dist/components/number-field/index.js.map +1 -1
  105. package/dist/components/range-calendar/index.d.ts +69 -0
  106. package/dist/components/range-calendar/index.js +144 -0
  107. package/dist/components/range-calendar/index.js.map +1 -0
  108. package/dist/components/search-view/index.d.ts +78 -0
  109. package/dist/components/search-view/index.js +570 -0
  110. package/dist/components/search-view/index.js.map +1 -0
  111. package/dist/components/select/index.d.ts +152 -0
  112. package/dist/components/select/index.js +419 -0
  113. package/dist/components/select/index.js.map +1 -0
  114. package/dist/components/slider/index.d.ts +111 -0
  115. package/dist/components/slider/index.js +673 -0
  116. package/dist/components/slider/index.js.map +1 -0
  117. package/dist/components/split-button/index.d.ts +77 -0
  118. package/dist/components/split-button/index.js +354 -0
  119. package/dist/components/split-button/index.js.map +1 -0
  120. package/dist/components/tabs/index.d.ts +196 -0
  121. package/dist/components/tabs/index.js +1137 -0
  122. package/dist/components/tabs/index.js.map +1 -0
  123. package/dist/components/time-field/index.d.ts +43 -0
  124. package/dist/components/time-field/index.js +107 -0
  125. package/dist/components/time-field/index.js.map +1 -0
  126. package/dist/components/time-picker/index.d.ts +65 -0
  127. package/dist/components/time-picker/index.js +1168 -0
  128. package/dist/components/time-picker/index.js.map +1 -0
  129. package/dist/components/tooltip/index.d.ts +101 -0
  130. package/dist/components/tooltip/index.js +223 -0
  131. package/dist/components/tooltip/index.js.map +1 -0
  132. package/dist/components/tree/index.d.ts +112 -0
  133. package/dist/components/tree/index.js +157 -0
  134. package/dist/components/tree/index.js.map +1 -0
  135. package/dist/disclosure/chevron.js +75 -0
  136. package/dist/disclosure/chevron.js.map +1 -0
  137. package/dist/disclosure/index.js +7 -0
  138. package/dist/disclosure/index.js.map +1 -0
  139. package/dist/drop/index.d.ts +54 -0
  140. package/dist/drop/index.js +161 -0
  141. package/dist/drop/index.js.map +1 -0
  142. package/dist/field/chevron.js +74 -0
  143. package/dist/field/chevron.js.map +1 -0
  144. package/dist/field/index.d.ts +2 -1
  145. package/dist/field/index.js +310 -154
  146. package/dist/field/index.js.map +1 -1
  147. package/dist/field/styles.js +9 -0
  148. package/dist/field/styles.js.map +1 -1
  149. package/dist/files/index.d.ts +18 -0
  150. package/dist/files/index.js +107 -0
  151. package/dist/files/index.js.map +1 -0
  152. package/dist/form/index.d.ts +5 -2
  153. package/dist/form/index.js +64 -85
  154. package/dist/form/index.js.map +1 -1
  155. package/dist/glyphs/index.js +92 -1
  156. package/dist/glyphs/index.js.map +1 -1
  157. package/dist/i18n/index.js +20 -1
  158. package/dist/i18n/index.js.map +1 -1
  159. package/dist/i18n/messages.js +1394 -34
  160. package/dist/i18n/messages.js.map +1 -1
  161. package/dist/index.d.ts +35 -3
  162. package/dist/index.js +34 -3
  163. package/dist/indicator/paths.js +23 -1
  164. package/dist/indicator/paths.js.map +1 -1
  165. package/dist/modal/index.js +92 -77
  166. package/dist/modal/index.js.map +1 -1
  167. package/dist/number/keyboard.js +16 -0
  168. package/dist/number/keyboard.js.map +1 -0
  169. package/dist/overlay/anchored.js +68 -38
  170. package/dist/overlay/anchored.js.map +1 -1
  171. package/dist/overlay/keyboard.js +57 -0
  172. package/dist/overlay/keyboard.js.map +1 -0
  173. package/dist/overlay/panel.js +173 -19
  174. package/dist/overlay/panel.js.map +1 -1
  175. package/dist/overlay/placement.js +13 -1
  176. package/dist/overlay/placement.js.map +1 -1
  177. package/dist/picker/index.js +322 -0
  178. package/dist/picker/index.js.map +1 -0
  179. package/dist/press/index.d.ts +2 -0
  180. package/dist/press/index.js +102 -100
  181. package/dist/press/index.js.map +1 -1
  182. package/dist/row/index.js +77 -69
  183. package/dist/row/index.js.map +1 -1
  184. package/dist/row/styles.js +13 -2
  185. package/dist/row/styles.js.map +1 -1
  186. package/dist/segments/field.js +277 -0
  187. package/dist/segments/field.js.map +1 -0
  188. package/dist/segments/index.js +574 -0
  189. package/dist/segments/index.js.map +1 -0
  190. package/dist/segments/styles.js +24 -0
  191. package/dist/segments/styles.js.map +1 -0
  192. package/dist/slider/index.js +145 -0
  193. package/dist/slider/index.js.map +1 -0
  194. package/dist/swatch/index.js +56 -0
  195. package/dist/swatch/index.js.map +1 -0
  196. package/package.json +11 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","PressableProps","StyleProp","TextStyle","View","ViewStyle","AnimatedStyle","Text","NativeText","StyleSheet","useWindowDimensions","Animated","ButtonLinkForm","ButtonPressForm","ButtonToggleForm","PaletteName","IconStyle","ResolvedTheme","TypeRole","AnimatedPressable","buttonStyles","HEIGHTS","OUTLINE_WIDTHS","PRESSED_CORNERS","toggleState","useButtonAction","useCorner","useSlotTrigger","palettesOf","BUSY","CONCEALED","PendingContent","PendingRing","pendingStyles","usePending","IconStyleContext","hitSlop","usePressFeedback","useTheme","composeStyles","themedStyles","useTypeRole","ButtonForm","variant","Exclude","ButtonVariant","ButtonProps","Omit","children","disableRipple","icon","isDisabled","ref","shape","ButtonShape","size","ButtonSize","style","ToggleVariant","DISABLED","Readonly","Record","elevated","filled","outlined","text","tonal","ICON_SIZES","lg","md","xl","xs","xxl","ROLES","SQUARE_CORNERS","const","TOGGLE_PALETTES","selected","unselected","styles","create","base","alignItems","flexDirection","justifyContent","maxWidth","flexShrink","label","textAlign","inlinePaddings","spacing","shadowsOf","shadows","elevation1","boxShadow","elevation2","sizesOf","theme","sizing","inline","gap","sm","minHeight","controlLg","paddingHorizontal","paddingVertical","controlSm","controlXl","controlXs","controlXxl","outlinedSizesOf","borderWidth","Button","t0","$","_c","defaultSelected","delayLongPress","href","isSelected","onBlur","onChange","onFocus","onHoverIn","onHoverOut","onLayout","onLongPress","onPress","onPressIn","onPressOut","ownHitSlop","pendingLabel","props","slot","t1","t2","t3","t4","t5","t6","type","isPending","undefined","role","fontScale","pending","ringLabel","isToggle","t7","t8","action","t9","t10","hoverIn","hoverOut","longPress","triggerProps","colors","feedback","color","content","disabled","radii","resting","pill","shaped","pressed","T0","t11","t12","t13","t14","handlers","t15","t16","t17","t18","t19","container","shadowOf","corner","ring","t20","clip","t21","layer","t22","iconStyleOf","t23","hidden","t24","typography","t25","hovered","lifted","_c","NativeText"],"sources":["../../../src/components/button/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type {\n PressableProps,\n StyleProp,\n TextStyle,\n View,\n ViewStyle,\n} from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\n\nimport {\n Text as NativeText,\n StyleSheet,\n useWindowDimensions,\n} from 'react-native'\nimport Animated from 'react-native-reanimated'\n\nimport type {\n ButtonLinkForm,\n ButtonPressForm,\n ButtonToggleForm,\n} from '../../button'\nimport type { PaletteName } from '../../button/palettes'\nimport type { IconStyle } from '../../glyphs/icon-style'\nimport type { ResolvedTheme } from '../../theme/scope'\nimport type { TypeRole } from '../../typography/roles'\n\nimport {\n AnimatedPressable,\n buttonStyles,\n HEIGHTS,\n OUTLINE_WIDTHS,\n PRESSED_CORNERS,\n toggleState,\n useButtonAction,\n useCorner,\n useSlotTrigger,\n} from '../../button'\nimport { palettesOf } from '../../button/palettes'\nimport {\n BUSY,\n CONCEALED,\n PendingContent,\n PendingRing,\n pendingStyles,\n usePending,\n} from '../../button/pending'\nimport { IconStyleContext } from '../../glyphs/icon-style'\nimport { hitSlop, usePressFeedback } from '../../press'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { useTypeRole } from '../../typography/roles'\n\n// The buttons spec page's five colour styles, five sizes and two shapes, as\n// kanso-ui's Button draws them. The variant carries colour and the size\n// carries geometry, so the two never argue: the padding belongs to the size\n// alone, and a text button is as wide as a filled one at the same size.\n//\n// The colour pairs are the page's: filled on primary, tonal on secondary\n// container, outlined with an outline-variant rule and an on-surface-variant\n// label, text on primary, and elevated on surface container low with a\n// primary label. Elevated is the one variant whose shadow is part of it: it\n// rests at elevation 1, rises to 2 under a pointer and settles back while\n// pressed, where filled and tonal rest flat and lift to 1 under a pointer\n// only. The shadow is the theme's `boxShadow` value, which React Native draws\n// on iOS and Android as React Native Web draws it in a browser.\n//\n// The state layers, the ripple and the focus ring are src/press's, drawn in\n// the label's colour over the container, as on web.\n//\n// **Disabled is the page's colour at an opacity, translucent.** A container\n// is on-surface at the `disabledContainer` opacity, and the label on-surface\n// at `disabledContent`, over whatever the button sits on rather than mixed\n// over the surface role as web's are; src/button/palettes.ts gives the\n// reason. Disabled drops the shadow, since a shadow says a control is there\n// to press.\n//\n// **A toggle is the same button reporting a state.** Given `isSelected`,\n// `defaultSelected` or `onChange` it takes the page's second pair of colour\n// roles for its variant: a filled toggle rests on surface container with an\n// on-surface-variant label and takes primary once selected, a tonal one moves\n// from the secondary container pair to secondary, an elevated one keeps its\n// low surface until it takes primary, and an outlined one swaps its rule for\n// the inverse surface pair. The page gives text no pair, so a text button\n// given those props stays a plain one.\n//\n// **A pending button keeps its place.** Given `isPending` the label and the\n// icon are hidden where they stand, so the button keeps its width, and an\n// indeterminate ring is drawn over them in the label's colour, at the label's\n// type size times the device's text size, which is what web's `1em` reads.\n// The button keeps its focus and its ring and takes no press, so a double tap\n// cannot run the action twice: neither `onPress` nor `onLongPress` is called,\n// and a toggle keeps its state until it clears. It reports itself busy, and\n// src/button's pending.tsx says the change out loud.\n//\n// **The corner is a shape the button morphs between.** `round` rests as the\n// pill and `square` at the size's square corner: 12dp up to the page's S,\n// 16dp at M and 28dp above. A press tightens either to the size's pressed\n// corner, 8dp, 12dp or 16dp, and a toggle trades its shape for the other\n// once selected. The corner eases through Reanimated, as src/button's\n// `useCorner` sets out.\n//\n// The forms, the toggle's state, what a press does and the corner's ease are\n// src/button's, shared with IconButton.\n\ntype ButtonForm =\n | ButtonLinkForm\n | ButtonPressForm\n | (ButtonToggleForm & {\n /**\n * A toggle takes any variant but `text`, which the page gives no\n * selected colours.\n */\n readonly variant?: Exclude<ButtonVariant, 'text'>\n })\n\ntype ButtonProps = ButtonForm &\n Omit<PressableProps, 'children' | 'disabled' | 'style'> & {\n /** The label. */\n readonly children?: ReactNode\n /**\n * Draws no press ripple. The state layer is unaffected.\n * @default false\n */\n readonly disableRipple?: boolean\n /**\n * An icon before the label, at the page's icon size for the button's\n * size: 20dp at `xs` and `md`, 24dp at `lg`, 32dp at `xl` and 40dp at\n * `xxl`. The slot hands it the label's colour and that size through\n * `useIconStyle()`.\n */\n readonly icon?: ReactNode\n /**\n * Draws the button disabled, and takes no presses.\n * @default false\n */\n readonly isDisabled?: boolean\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * The corner the button rests at: `round` is the pill, `square` the\n * page's rounded rectangle, 12dp up to `md`, 16dp at `lg` and 28dp above.\n * Either tightens while pressed, and a toggle trades one for the other\n * once selected.\n * @default 'round'\n */\n readonly shape?: ButtonShape\n /**\n * Control height: `xs` 32dp, `md` 40dp, `lg` 56dp, `xl` 96dp, `xxl` 136dp,\n * the buttons spec page's XS, S, M, L and XL, each with its own padding\n * and type role. `md` is the page's default. The height is a floor, so a\n * label that wraps, or that the device's text size enlarges, grows the\n * button rather than running out of it.\n * @default 'md'\n */\n readonly size?: ButtonSize\n readonly style?: StyleProp<ViewStyle>\n /**\n * How much weight the button pulls. `filled` and `tonal` carry a container\n * of their own; `outlined` and `text` sit on the page; `elevated` sits on\n * a low surface and lifts off it with a shadow, for a button that has to\n * separate from a busy background rather than from the page.\n * @default 'filled'\n */\n readonly variant?: ButtonVariant\n }\n\ntype ButtonShape = 'round' | 'square'\n\ntype ButtonSize = 'lg' | 'md' | 'xl' | 'xs' | 'xxl'\n\ntype ButtonVariant = 'elevated' | 'filled' | 'outlined' | 'text' | 'tonal'\n\ntype ToggleVariant = Exclude<ButtonVariant, 'text'>\n\n// The disabled container each variant draws. Filled, tonal and elevated share\n// one, which is the page's single disabled container for all three.\nconst DISABLED: Readonly<Record<ButtonVariant, PaletteName>> = {\n elevated: 'filledDisabled',\n filled: 'filledDisabled',\n outlined: 'outlinedDisabled',\n text: 'textDisabled',\n tonal: 'filledDisabled',\n}\n\n// The icon each size draws, from the page's size token sets. Literals, as on\n// web: they are icon sizes, which the theme has no scale for.\nconst ICON_SIZES: Readonly<Record<ButtonSize, number>> = {\n lg: 24,\n md: 20,\n xl: 32,\n xs: 20,\n xxl: 40,\n}\n\n// The type role each size sets its label in, taken whole: label-large for the\n// two small sizes, then title-medium, headline-small and headline-large.\nconst ROLES: Readonly<Record<ButtonSize, TypeRole>> = {\n lg: 'titleMedium',\n md: 'labelLarge',\n xl: 'headlineSmall',\n xs: 'labelLarge',\n xxl: 'headlineLarge',\n}\n\n// The square corner each size rests at, and a round toggle takes once\n// selected.\nconst SQUARE_CORNERS = {\n lg: 'lg',\n md: 'md',\n xl: 'xl',\n xs: 'md',\n xxl: 'xl',\n} as const satisfies Record<ButtonSize, keyof ResolvedTheme['radii']>\n\n// Which container a toggle draws, selected and not.\nconst TOGGLE_PALETTES: Readonly<\n Record<\n ToggleVariant,\n Readonly<Record<'selected' | 'unselected', PaletteName>>\n >\n> = {\n elevated: { selected: 'elevatedToggleSelected', unselected: 'elevated' },\n filled: { selected: 'filledToggleSelected', unselected: 'filledToggle' },\n outlined: { selected: 'outlinedToggleSelected', unselected: 'outlined' },\n tonal: { selected: 'tonalToggleSelected', unselected: 'tonal' },\n}\n\nconst styles = StyleSheet.create({\n // The label sits in the middle of a button wider than it, one stretched by\n // a column or given a width, as the page draws every button, and a button\n // is never wider than what holds it.\n base: {\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'center',\n maxWidth: '100%',\n },\n icon: {\n alignItems: 'center',\n flexShrink: 0,\n justifyContent: 'center',\n },\n // A label too long for the row wraps, its lines centred, and grows the\n // button with it.\n label: {\n flexShrink: 1,\n textAlign: 'center',\n },\n})\n\n// Each size's inline padding. The two largest are literals: 48 and 64 are not\n// steps of the spacing scale, and the scale should not grow to fit one\n// component. `xs` pads 12 a side, the extra-small token set's leading and\n// trailing space.\nfunction inlinePaddings({\n spacing,\n}: ResolvedTheme): Readonly<Record<ButtonSize, number>> {\n return { lg: spacing.xl, md: spacing.lg, xl: 48, xs: spacing.md, xxl: 64 }\n}\n\nconst shadowsOf = themedStyles(({ shadows }) =>\n StyleSheet.create({\n elevation1: { boxShadow: shadows.elevation1 },\n elevation2: { boxShadow: shadows.elevation2 },\n }),\n)\n\n// The five sizes, from the page's size token sets: the container height, the\n// padding, and the gap before an icon. The height is a floor rather than a\n// fixed size, and the block padding is what keeps a wrapped label off the\n// pill's edge: a step short of a single line's own inset, so a label on one\n// line still draws exactly the page's height.\nconst sizesOf = themedStyles((theme) => {\n const { sizing, spacing } = theme\n const inline = inlinePaddings(theme)\n\n return StyleSheet.create({\n lg: {\n gap: spacing.sm,\n minHeight: sizing.controlLg,\n paddingHorizontal: inline.lg,\n paddingVertical: spacing.md,\n },\n md: {\n gap: spacing.sm,\n minHeight: sizing.controlSm,\n paddingHorizontal: inline.md,\n paddingVertical: spacing.sm,\n },\n xl: {\n gap: spacing.md,\n minHeight: sizing.controlXl,\n paddingHorizontal: inline.xl,\n paddingVertical: spacing.xl,\n },\n xs: {\n gap: spacing.sm,\n minHeight: sizing.controlXs,\n paddingHorizontal: inline.xs,\n paddingVertical: spacing.xs,\n },\n xxl: {\n gap: spacing.lg,\n minHeight: sizing.controlXxl,\n paddingHorizontal: inline.xxl,\n paddingVertical: spacing.xxl,\n },\n })\n})\n\n// The outlined button draws its rule inside the width the other variants\n// take, as the page's buttons do: the padding gives up what the rule takes,\n// so an outlined and a filled button with one label are one width.\nconst outlinedSizesOf = themedStyles((theme) => {\n const inline = inlinePaddings(theme)\n\n function outlined(size: ButtonSize): ViewStyle {\n return {\n borderWidth: OUTLINE_WIDTHS[size],\n paddingHorizontal: inline[size] - OUTLINE_WIDTHS[size],\n }\n }\n\n return StyleSheet.create({\n lg: outlined('lg'),\n md: outlined('md'),\n xl: outlined('xl'),\n xs: outlined('xs'),\n xxl: outlined('xxl'),\n })\n})\n\n/**\n * The design's button, at five emphasis levels and five control heights,\n * round or square, with web's props and values. Given `href` it is a link with\n * the same appearance, and given `isSelected`, `defaultSelected` or\n * `onChange` it is a toggle, which reports its state to a screen reader and\n * draws the page's second pair of colour roles for its variant.\n *\n * ```tsx\n * <Button defaultSelected variant=\"tonal\">\n * Label\n * </Button>\n * ```\n *\n * A column stretches a button across it, as it does any view, and as a flex\n * column does a button on web; a column that should hold its buttons at their\n * labels' width says so with `alignItems`.\n *\n * The two sizes under 48dp tall, `xs` and `md`, take presses over a 48dp\n * target through `hitSlop`, which a `hitSlop` of the call site's own replaces.\n * `style`, `ref` and `testID` land on the `Pressable`.\n */\nfunction Button({\n children,\n defaultSelected,\n delayLongPress,\n disableRipple = false,\n hitSlop: ownHitSlop,\n href,\n icon,\n isDisabled = false,\n isPending = false,\n isSelected,\n onBlur,\n onChange,\n onFocus,\n onHoverIn,\n onHoverOut,\n onLayout,\n onLongPress,\n onPress,\n onPressIn,\n onPressOut,\n pendingLabel,\n ref,\n shape = 'round',\n size = 'md',\n slot,\n style,\n type,\n variant = 'filled',\n ...props\n}: ButtonProps) {\n const theme = useTheme()\n const role = useTypeRole(ROLES[size])\n const { fontScale } = useWindowDimensions()\n // A link is never pending, as on web, where its props have no such state.\n const pending = href === undefined && isPending\n const ringLabel = usePending(pending, pendingLabel)\n\n // The three props that make this a toggle, read as web reads them. The\n // types keep them off a `text` button; the check here keeps a call site\n // that slipped past them a plain button.\n const isToggle =\n variant !== 'text' &&\n (defaultSelected !== undefined ||\n isSelected !== undefined ||\n onChange !== undefined)\n const action = useButtonAction({\n defaultSelected,\n href,\n isSelected,\n isToggle,\n onChange,\n onPress,\n slot: slot ?? 'default',\n type,\n })\n const {\n onHoverIn: hoverIn,\n onHoverOut: hoverOut,\n onLongPress: longPress,\n ...triggerProps\n } = useSlotTrigger({\n delayLongPress,\n href,\n onHoverIn,\n onHoverOut,\n onLongPress,\n ref,\n slot,\n })\n const colors =\n palettesOf(theme)[\n isDisabled\n ? DISABLED[variant]\n : variant !== 'text' && isToggle\n ? TOGGLE_PALETTES[variant][\n action.selected ? 'selected' : 'unselected'\n ]\n : variant\n ]\n\n const feedback = usePressFeedback({\n color: colors.content,\n disabled: isDisabled,\n disableRipple,\n onBlur,\n onFocus,\n onHoverIn: hoverIn,\n onHoverOut: hoverOut,\n onPressIn,\n onPressOut,\n pending,\n })\n\n const { radii } = theme\n const resting =\n (shape === 'square') !== action.selected\n ? radii[SQUARE_CORNERS[size]]\n : radii.pill\n const shaped = useCorner(\n feedback.pressed ? radii[PRESSED_CORNERS[size]] : resting,\n onLayout,\n )\n\n return (\n <AnimatedPressable\n role={href === undefined ? 'button' : 'link'}\n {...(isToggle ? toggleState(action.selected) : undefined)}\n {...(pending ? BUSY : undefined)}\n {...props}\n {...triggerProps}\n {...feedback.handlers}\n disabled={isDisabled}\n hitSlop={ownHitSlop ?? hitSlop(theme.sizing[HEIGHTS[size]])}\n onLayout={shaped.onLayout}\n onLongPress={pending ? undefined : longPress}\n onPress={pending ? undefined : action.onPress}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.base,\n sizesOf(theme)[size],\n variant === 'outlined' ? outlinedSizesOf(theme)[size] : undefined,\n colors.container,\n shadowOf(variant, feedback, isDisabled, theme),\n shaped.corner,\n feedback.ring,\n style,\n )}\n >\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n buttonStyles.clip,\n shaped.corner,\n )}\n >\n {feedback.layer}\n </Animated.View>\n {icon === undefined ? null : (\n <PendingContent isPending={pending}>\n <IconStyleContext value={iconStyleOf(colors.content, size)}>\n {icon}\n </IconStyleContext>\n </PendingContent>\n )}\n {children === undefined ? null : (\n <NativeText\n {...(pending ? CONCEALED : undefined)}\n style={composeStyles<TextStyle>(\n role,\n styles.label,\n colors.label,\n pending ? pendingStyles.hidden : undefined,\n )}\n >\n {children}\n </NativeText>\n )}\n {pending ? (\n <PendingRing\n color={colors.content}\n diameter={theme.typography[`${ROLES[size]}Size`] * fontScale}\n label={ringLabel}\n />\n ) : null}\n </AnimatedPressable>\n )\n}\n\nfunction iconStyleOf(color: string, size: ButtonSize): IconStyle {\n return { color, size: ICON_SIZES[size] }\n}\n\n// The shadow a variant draws in its state: elevated rests at 1 and rises to 2\n// under a pointer, filled and tonal rest flat and rise to 1, and a press\n// brings each back to where it rests.\nfunction shadowOf(\n variant: ButtonVariant,\n {\n hovered,\n pressed,\n }: { readonly hovered: boolean; readonly pressed: boolean },\n isDisabled: boolean,\n theme: ResolvedTheme,\n): undefined | ViewStyle {\n const lifted = hovered && !pressed\n\n if (isDisabled) {\n return undefined\n }\n\n if (variant === 'elevated') {\n return shadowsOf(theme)[lifted ? 'elevation2' : 'elevation1']\n }\n\n return (variant === 'filled' || variant === 'tonal') && lifted\n ? shadowsOf(theme).elevation1\n : undefined\n}\n\nexport { Button }\nexport type { ButtonProps, ButtonShape, ButtonSize, ButtonVariant }\n"],"mappings":";;;;;;;;;;;;;AAgLA,MAAM6D,WA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tC;GAAK,GACLwB;GAAY,GACZe;GACMxH,UAAAA;GACD,SAAA0H;GACC,UAAAC;GACG,aAAAC;GACJ,SAAAC;GACF,OAAAC;GAZT,UAAA;IAuBEO;IAQCE;IAOAE;IAaAE;GAnDe;;EA0DE5E,EAAA,MAAAqD;EAAArD,EAAA,MAAA4C,SAAAc;EAAA1D,EAAA,MAAA/D;EAAA+D,EAAA,MAAAkB;EAAAlB,EAAA,MAAAmD,OAAAxC;EAAAX,EAAA,MAAAsD;EAAAtD,EAAA,MAAAuD;EAAAvD,EAAA,MAAAwD;EAAAxD,EAAA,MAAA2D;EAAA3D,EAAA,MAAA6D;EAAA7D,EAAA,MAAA8D;EAAA9D,EAAA,MAAA+D;EAAA/D,EAAA,MAAAsE;EAAAtE,EAAA,MAAAwE;EAAAxE,EAAA,MAAA0E;EAAA1E,EAAA,MAAA4E;EAAA5E,EAAA,MAAA0C;EAAA1C,EAAA,MAAA8E;CAAA,OAAAA,MAAA9E,EAAA;CAAA,OA1DpB8E;AA0DoB;AAIxB,SAASL,YAAY5B,OAAexG,MAA6B;CAC/D,OAAO;EAAEwG;EAAOxG,MAAMY,WAAWZ;CAAM;AACzC;AAKA,SAAS4H,SACPxI,SACA,EACEsJ,SACA3B,WAEFnH,YACA8C,OACuB;CACvB,MAAMiG,SAASD,WAAW,CAAC3B;CAE3B,IAAInH,YACF;CAGF,IAAIR,YAAY,YACd,OAAOgD,UAAUM,KAAK,CAAC,CAACiG,SAAS,eAAe;CAGlD,QAAQvJ,YAAY,YAAYA,YAAY,YAAYuJ,SACpDvG,UAAUM,KAAK,CAAC,CAACJ,aACjBiD,KAAAA;AACN"}
1
+ {"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","PressableProps","StyleProp","TextStyle","View","ViewStyle","AnimatedStyle","use","Text","NativeText","StyleSheet","useWindowDimensions","Animated","useSharedValue","ButtonLinkForm","ButtonPressForm","ButtonToggleForm","PaletteName","IconStyle","ResolvedTheme","TypeRole","AnimatedPressable","buttonStyles","HEIGHTS","OUTLINE_WIDTHS","PRESSED_CORNERS","pressThen","toggleState","useButtonAction","useCorner","useSlotTrigger","ButtonGroupItemContext","groupCornersOf","groupPressHandlers","groupSelectionOf","groupStyles","groupWidthThen","useGroupShift","palettesOf","BUSY","CONCEALED","PendingContent","PendingRing","pendingStyles","usePending","IconStyleContext","hitSlop","usePressFeedback","useTheme","composeStyles","themedStyles","useTypeRole","ButtonForm","variant","Exclude","ButtonVariant","ButtonProps","Omit","children","disableRipple","icon","id","isDisabled","ref","shape","ButtonShape","size","ButtonSize","style","ToggleVariant","DISABLED","Readonly","Record","elevated","filled","outlined","text","tonal","ICON_SIZES","lg","md","xl","xs","xxl","ROLES","SQUARE_CORNERS","const","TOGGLE_PALETTES","selected","unselected","styles","create","base","alignItems","flexDirection","justifyContent","maxWidth","flexShrink","label","textAlign","inlinePaddings","spacing","shadowsOf","shadows","elevation1","boxShadow","elevation2","sizesOf","theme","sizing","inline","gap","sm","minHeight","controlLg","paddingHorizontal","paddingVertical","controlSm","controlXl","controlXs","controlXxl","outlinedSizesOf","borderWidth","Button","t0","$","_c","accessibilityHint","defaultSelected","delayLongPress","href","isSelected","onBlur","onChange","onFocus","onHoverIn","onHoverOut","onLayout","onLongPress","onPress","onPressIn","onPressOut","ownHitSlop","ownSize","pendingLabel","props","slot","t1","t2","t3","t4","t5","type","isPending","undefined","ownDisabled","group","membership","role","fontScale","pending","ringLabel","isToggle","t6","t7","action","t8","t9","hoverIn","hoverOut","longPress","pressIn","pressOut","triggerProps","toggles","colors","width","feedback","color","content","disabled","held","radii","resting","pill","shaped","pressed","border","t10","shift","T0","t11","t12","t13","accessibility","t14","t15","handlers","t16","t17","t18","t19","toggle","t20","container","shadowOf","corner","keepsTarget","target","ring","t21","clip","t22","layer","t23","iconStyleOf","t24","hidden","t25","typography","t26","hovered","lifted","_c","NativeText"],"sources":["../../../src/components/button/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type {\n PressableProps,\n StyleProp,\n TextStyle,\n View,\n ViewStyle,\n} from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\n\nimport { use } from 'react'\nimport {\n Text as NativeText,\n StyleSheet,\n useWindowDimensions,\n} from 'react-native'\nimport Animated, { useSharedValue } from 'react-native-reanimated'\n\nimport type {\n ButtonLinkForm,\n ButtonPressForm,\n ButtonToggleForm,\n} from '../../button'\nimport type { PaletteName } from '../../button/palettes'\nimport type { IconStyle } from '../../glyphs/icon-style'\nimport type { ResolvedTheme } from '../../theme/scope'\nimport type { TypeRole } from '../../typography/roles'\n\nimport {\n AnimatedPressable,\n buttonStyles,\n HEIGHTS,\n OUTLINE_WIDTHS,\n PRESSED_CORNERS,\n pressThen,\n toggleState,\n useButtonAction,\n useCorner,\n useSlotTrigger,\n} from '../../button'\nimport {\n ButtonGroupItemContext,\n groupCornersOf,\n groupPressHandlers,\n groupSelectionOf,\n groupStyles,\n groupWidthThen,\n useGroupShift,\n} from '../../button/group'\nimport { palettesOf } from '../../button/palettes'\nimport {\n BUSY,\n CONCEALED,\n PendingContent,\n PendingRing,\n pendingStyles,\n usePending,\n} from '../../button/pending'\nimport { IconStyleContext } from '../../glyphs/icon-style'\nimport { hitSlop, usePressFeedback } from '../../press'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { useTypeRole } from '../../typography/roles'\n\n// The buttons spec page's five colour styles, five sizes and two shapes, as\n// kanso-ui's Button draws them. The variant carries colour and the size\n// carries geometry, so the two never argue: the padding belongs to the size\n// alone, and a text button is as wide as a filled one at the same size.\n//\n// The colour pairs are the page's: filled on primary, tonal on secondary\n// container, outlined with an outline-variant rule and an on-surface-variant\n// label, text on primary, and elevated on surface container low with a\n// primary label. Elevated is the one variant whose shadow is part of it: it\n// rests at elevation 1, rises to 2 under a pointer and settles back while\n// pressed, where filled and tonal rest flat and lift to 1 under a pointer\n// only. The shadow is the theme's `boxShadow` value, which React Native draws\n// on iOS and Android as React Native Web draws it in a browser.\n//\n// The state layers, the ripple and the focus ring are src/press's, drawn in\n// the label's colour over the container, as on web.\n//\n// **Disabled is the page's colour at an opacity, translucent.** A container\n// is on-surface at the `disabledContainer` opacity, and the label on-surface\n// at `disabledContent`, over whatever the button sits on rather than mixed\n// over the surface role as web's are; src/button/palettes.ts gives the\n// reason. Disabled drops the shadow, since a shadow says a control is there\n// to press.\n//\n// **A toggle is the same button reporting a state.** Given `isSelected`,\n// `defaultSelected` or `onChange` it takes the page's second pair of colour\n// roles for its variant: a filled toggle rests on surface container with an\n// on-surface-variant label and takes primary once selected, a tonal one moves\n// from the secondary container pair to secondary, an elevated one keeps its\n// low surface until it takes primary, and an outlined one swaps its rule for\n// the inverse surface pair. The page gives text no pair, so a text button\n// given those props stays a plain one.\n//\n// **A pending button keeps its place.** Given `isPending` the label and the\n// icon are hidden where they stand, so the button keeps its width, and an\n// indeterminate ring is drawn over them in the label's colour, at the label's\n// type size times the device's text size, which is what web's `1em` reads.\n// The button keeps its focus and its ring and takes no press, so a double tap\n// cannot run the action twice: neither `onPress` nor `onLongPress` is called,\n// and a toggle keeps its state until it clears. It reports itself busy, and\n// src/button's pending.tsx says the change out loud.\n//\n// **The corner is a shape the button morphs between.** `round` rests as the\n// pill and `square` at the size's square corner: 12dp up to the page's S,\n// 16dp at M and 28dp above. A press tightens either to the size's pressed\n// corner, 8dp, 12dp or 16dp, and a toggle trades its shape for the other\n// once selected. The corner eases through Reanimated, as src/button's\n// `useCorner` sets out.\n//\n// **A ButtonGroup around it hands it what the group decides**, through\n// src/button's group.ts: its size, unless the button names its own, whether\n// it is disabled, a connected group's corners in place of its own shape, and\n// a standard group's widening while it or a neighbour is pressed, which the\n// button takes as inline padding. In a group that selects, the group keeps\n// the selection by the buttons' `id`s, and a button there is a toggle of the\n// group's whatever its own props say: a radio in a group that chooses one,\n// and a button reporting its state in one that chooses several. A `text`\n// button keeps its plain colours there, and draws its selection by nothing\n// but a connected group's corners, as on web.\n//\n// The forms, the toggle's state, what a press does and the corner's ease are\n// src/button's, shared with IconButton.\n\ntype ButtonForm =\n | ButtonLinkForm\n | ButtonPressForm\n | (ButtonToggleForm & {\n /**\n * A toggle takes any variant but `text`, which the page gives no\n * selected colours.\n */\n readonly variant?: Exclude<ButtonVariant, 'text'>\n })\n\ntype ButtonProps = ButtonForm &\n Omit<PressableProps, 'children' | 'disabled' | 'style'> & {\n /** The label. */\n readonly children?: ReactNode\n /**\n * Draws no press ripple. The state layer is unaffected.\n * @default false\n */\n readonly disableRipple?: boolean\n /**\n * An icon before the label, at the page's icon size for the button's\n * size: 20dp at `xs` and `md`, 24dp at `lg`, 32dp at `xl` and 40dp at\n * `xxl`. The slot hands it the label's colour and that size through\n * `useIconStyle()`.\n */\n readonly icon?: ReactNode\n /** The key a ButtonGroup that selects reports the button by. */\n readonly id?: string\n /**\n * Draws the button disabled, and takes no presses.\n * @default false\n */\n readonly isDisabled?: boolean\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * The corner the button rests at: `round` is the pill, `square` the\n * page's rounded rectangle, 12dp up to `md`, 16dp at `lg` and 28dp above.\n * Either tightens while pressed, and a toggle trades one for the other\n * once selected.\n * @default 'round'\n */\n readonly shape?: ButtonShape\n /**\n * Control height: `xs` 32dp, `md` 40dp, `lg` 56dp, `xl` 96dp, `xxl` 136dp,\n * the buttons spec page's XS, S, M, L and XL, each with its own padding\n * and type role. `md` is the page's default. The height is a floor, so a\n * label that wraps, or that the device's text size enlarges, grows the\n * button rather than running out of it.\n * @default the size of the ButtonGroup around it, else 'md'\n */\n readonly size?: ButtonSize\n readonly style?: StyleProp<ViewStyle>\n /**\n * How much weight the button pulls. `filled` and `tonal` carry a container\n * of their own; `outlined` and `text` sit on the page; `elevated` sits on\n * a low surface and lifts off it with a shadow, for a button that has to\n * separate from a busy background rather than from the page.\n * @default 'filled'\n */\n readonly variant?: ButtonVariant\n }\n\ntype ButtonShape = 'round' | 'square'\n\ntype ButtonSize = 'lg' | 'md' | 'xl' | 'xs' | 'xxl'\n\ntype ButtonVariant = 'elevated' | 'filled' | 'outlined' | 'text' | 'tonal'\n\ntype ToggleVariant = Exclude<ButtonVariant, 'text'>\n\n// The disabled container each variant draws. Filled, tonal and elevated share\n// one, which is the page's single disabled container for all three.\nconst DISABLED: Readonly<Record<ButtonVariant, PaletteName>> = {\n elevated: 'filledDisabled',\n filled: 'filledDisabled',\n outlined: 'outlinedDisabled',\n text: 'textDisabled',\n tonal: 'filledDisabled',\n}\n\n// The icon each size draws, from the page's size token sets. Literals, as on\n// web: they are icon sizes, which the theme has no scale for.\nconst ICON_SIZES: Readonly<Record<ButtonSize, number>> = {\n lg: 24,\n md: 20,\n xl: 32,\n xs: 20,\n xxl: 40,\n}\n\n// The type role each size sets its label in, taken whole: label-large for the\n// two small sizes, then title-medium, headline-small and headline-large.\nconst ROLES: Readonly<Record<ButtonSize, TypeRole>> = {\n lg: 'titleMedium',\n md: 'labelLarge',\n xl: 'headlineSmall',\n xs: 'labelLarge',\n xxl: 'headlineLarge',\n}\n\n// The square corner each size rests at, and a round toggle takes once\n// selected.\nconst SQUARE_CORNERS = {\n lg: 'lg',\n md: 'md',\n xl: 'xl',\n xs: 'md',\n xxl: 'xl',\n} as const satisfies Record<ButtonSize, keyof ResolvedTheme['radii']>\n\n// Which container a toggle draws, selected and not.\nconst TOGGLE_PALETTES: Readonly<\n Record<\n ToggleVariant,\n Readonly<Record<'selected' | 'unselected', PaletteName>>\n >\n> = {\n elevated: { selected: 'elevatedToggleSelected', unselected: 'elevated' },\n filled: { selected: 'filledToggleSelected', unselected: 'filledToggle' },\n outlined: { selected: 'outlinedToggleSelected', unselected: 'outlined' },\n tonal: { selected: 'tonalToggleSelected', unselected: 'tonal' },\n}\n\nconst styles = StyleSheet.create({\n // The label sits in the middle of a button wider than it, one stretched by\n // a column or given a width, as the page draws every button, and a button\n // is never wider than what holds it.\n base: {\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'center',\n maxWidth: '100%',\n },\n icon: {\n alignItems: 'center',\n flexShrink: 0,\n justifyContent: 'center',\n },\n // A label too long for the row wraps, its lines centred, and grows the\n // button with it.\n label: {\n flexShrink: 1,\n textAlign: 'center',\n },\n})\n\n// Each size's inline padding. The two largest are literals: 48 and 64 are not\n// steps of the spacing scale, and the scale should not grow to fit one\n// component. `xs` pads 12 a side, the extra-small token set's leading and\n// trailing space.\nfunction inlinePaddings({\n spacing,\n}: ResolvedTheme): Readonly<Record<ButtonSize, number>> {\n return { lg: spacing.xl, md: spacing.lg, xl: 48, xs: spacing.md, xxl: 64 }\n}\n\nconst shadowsOf = themedStyles(({ shadows }) =>\n StyleSheet.create({\n elevation1: { boxShadow: shadows.elevation1 },\n elevation2: { boxShadow: shadows.elevation2 },\n }),\n)\n\n// The five sizes, from the page's size token sets: the container height, the\n// padding, and the gap before an icon. The height is a floor rather than a\n// fixed size, and the block padding is what keeps a wrapped label off the\n// pill's edge: a step short of a single line's own inset, so a label on one\n// line still draws exactly the page's height.\nconst sizesOf = themedStyles((theme) => {\n const { sizing, spacing } = theme\n const inline = inlinePaddings(theme)\n\n return StyleSheet.create({\n lg: {\n gap: spacing.sm,\n minHeight: sizing.controlLg,\n paddingHorizontal: inline.lg,\n paddingVertical: spacing.md,\n },\n md: {\n gap: spacing.sm,\n minHeight: sizing.controlSm,\n paddingHorizontal: inline.md,\n paddingVertical: spacing.sm,\n },\n xl: {\n gap: spacing.md,\n minHeight: sizing.controlXl,\n paddingHorizontal: inline.xl,\n paddingVertical: spacing.xl,\n },\n xs: {\n gap: spacing.sm,\n minHeight: sizing.controlXs,\n paddingHorizontal: inline.xs,\n paddingVertical: spacing.xs,\n },\n xxl: {\n gap: spacing.lg,\n minHeight: sizing.controlXxl,\n paddingHorizontal: inline.xxl,\n paddingVertical: spacing.xxl,\n },\n })\n})\n\n// The outlined button draws its rule inside the width the other variants\n// take, as the page's buttons do: the padding gives up what the rule takes,\n// so an outlined and a filled button with one label are one width.\nconst outlinedSizesOf = themedStyles((theme) => {\n const inline = inlinePaddings(theme)\n\n function outlined(size: ButtonSize): ViewStyle {\n return {\n borderWidth: OUTLINE_WIDTHS[size],\n paddingHorizontal: inline[size] - OUTLINE_WIDTHS[size],\n }\n }\n\n return StyleSheet.create({\n lg: outlined('lg'),\n md: outlined('md'),\n xl: outlined('xl'),\n xs: outlined('xs'),\n xxl: outlined('xxl'),\n })\n})\n\n/**\n * The design's button, at five emphasis levels and five control heights,\n * round or square, with web's props and values. Given `href` it is a link with\n * the same appearance, and given `isSelected`, `defaultSelected` or\n * `onChange` it is a toggle, which reports its state to a screen reader and\n * draws the page's second pair of colour roles for its variant.\n *\n * ```tsx\n * <Button defaultSelected variant=\"tonal\">\n * Label\n * </Button>\n * ```\n *\n * A column stretches a button across it, as it does any view, and as a flex\n * column does a button on web; a column that should hold its buttons at their\n * labels' width says so with `alignItems`.\n *\n * The two sizes under 48dp tall, `xs` and `md`, take presses over a 48dp\n * target through `hitSlop`, which a `hitSlop` of the call site's own replaces.\n * `style`, `ref` and `testID` land on the `Pressable`.\n */\nfunction Button({\n accessibilityHint,\n children,\n defaultSelected,\n delayLongPress,\n disableRipple = false,\n hitSlop: ownHitSlop,\n href,\n icon,\n id,\n isDisabled: ownDisabled = false,\n isPending = false,\n isSelected,\n onBlur,\n onChange,\n onFocus,\n onHoverIn,\n onHoverOut,\n onLayout,\n onLongPress,\n onPress,\n onPressIn,\n onPressOut,\n pendingLabel,\n ref,\n shape = 'round',\n size: ownSize,\n slot,\n style,\n type,\n variant = 'filled',\n ...props\n}: ButtonProps) {\n const theme = useTheme()\n // A ButtonGroup around the button hands it a size, which one named here\n // still beats, and its part in the group; src/button's group.ts sets it out.\n const group = use(ButtonGroupItemContext)\n const size = ownSize ?? group?.size ?? 'md'\n const isDisabled = ownDisabled || group?.isDisabled === true\n const membership = groupSelectionOf(group, id)\n const role = useTypeRole(ROLES[size])\n const { fontScale } = useWindowDimensions()\n // A link is never pending, as on web, where its props have no such state.\n const pending = href === undefined && isPending\n const ringLabel = usePending(pending, pendingLabel)\n\n // The three props that make this a toggle, read as web reads them. The\n // types keep them off a `text` button; the check here keeps a call site\n // that slipped past them a plain button. A group that selects keeps the\n // selection itself, so they mean nothing there.\n const isToggle =\n membership === undefined &&\n variant !== 'text' &&\n (defaultSelected !== undefined ||\n isSelected !== undefined ||\n onChange !== undefined)\n const action = useButtonAction({\n defaultSelected,\n href,\n isSelected,\n isToggle,\n onChange,\n onPress,\n slot: slot ?? 'default',\n type,\n })\n const {\n onHoverIn: hoverIn,\n onHoverOut: hoverOut,\n onLongPress: longPress,\n onPressIn: pressIn,\n onPressOut: pressOut,\n ...triggerProps\n } = useSlotTrigger({\n accessibilityHint,\n delayLongPress,\n href,\n onHoverIn,\n onHoverOut,\n onLongPress,\n onPressIn,\n onPressOut,\n ref,\n slot,\n })\n // A text button in a selecting group takes part in its selection but\n // draws none of it, since the page gives text no selected colours.\n const toggles = variant !== 'text' && (isToggle || membership !== undefined)\n const selected = toggles && (membership?.selected ?? action.selected)\n const colors =\n palettesOf(theme)[\n isDisabled\n ? DISABLED[variant]\n : variant !== 'text' && toggles\n ? TOGGLE_PALETTES[variant][selected ? 'selected' : 'unselected']\n : variant\n ]\n\n // The width a standard group widens the button from, recorded as it is\n // laid out, before the press feedback that tells the group of a press.\n const width = useSharedValue(0)\n const feedback = usePressFeedback({\n color: colors.content,\n disabled: isDisabled,\n disableRipple,\n onBlur,\n onFocus,\n onHoverIn: hoverIn,\n onHoverOut: hoverOut,\n ...groupPressHandlers(group, width, pressIn, pressOut),\n held: group?.held,\n pending,\n })\n\n const { radii } = theme\n const resting =\n (shape === 'square') !== selected ? radii[SQUARE_CORNERS[size]] : radii.pill\n const shaped = useCorner(\n groupCornersOf(group, feedback, membership?.selected ?? action.selected) ??\n (feedback.pressed ? radii[PRESSED_CORNERS[size]] : resting),\n groupWidthThen(group, width, onLayout),\n )\n const border = variant === 'outlined' ? OUTLINE_WIDTHS[size] : 0\n const shift = useGroupShift(\n group,\n inlinePaddings(theme)[size] - border,\n 'padding',\n )\n\n return (\n <AnimatedPressable\n id={id}\n role={href === undefined ? 'button' : 'link'}\n {...(isToggle ? toggleState(action.selected) : undefined)}\n {...membership?.accessibility}\n {...(pending ? BUSY : undefined)}\n {...props}\n {...triggerProps}\n {...feedback.handlers}\n disabled={isDisabled}\n hitSlop={ownHitSlop ?? hitSlop(theme.sizing[HEIGHTS[size]])}\n onLayout={shaped.onLayout}\n onLongPress={pending ? undefined : longPress}\n onPress={\n pending\n ? undefined\n : membership === undefined\n ? action.onPress\n : pressThen(action.onPress, membership.toggle)\n }\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.base,\n sizesOf(theme)[size],\n variant === 'outlined' ? outlinedSizesOf(theme)[size] : undefined,\n group?.style,\n colors.container,\n shadowOf(variant, feedback, isDisabled, theme),\n shaped.corner,\n shift,\n group?.keepsTarget === true ? groupStyles.target : undefined,\n feedback.ring,\n style,\n )}\n >\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n buttonStyles.clip,\n shaped.corner,\n )}\n >\n {feedback.layer}\n </Animated.View>\n {icon === undefined ? null : (\n <PendingContent isPending={pending}>\n <IconStyleContext value={iconStyleOf(colors.content, size)}>\n {icon}\n </IconStyleContext>\n </PendingContent>\n )}\n {children === undefined ? null : (\n <NativeText\n {...(pending ? CONCEALED : undefined)}\n style={composeStyles<TextStyle>(\n role,\n styles.label,\n colors.label,\n pending ? pendingStyles.hidden : undefined,\n )}\n >\n {children}\n </NativeText>\n )}\n {pending ? (\n <PendingRing\n color={colors.content}\n diameter={theme.typography[`${ROLES[size]}Size`] * fontScale}\n label={ringLabel}\n />\n ) : null}\n </AnimatedPressable>\n )\n}\n\nfunction iconStyleOf(color: string, size: ButtonSize): IconStyle {\n return { color, size: ICON_SIZES[size] }\n}\n\n// The shadow a variant draws in its state: elevated rests at 1 and rises to 2\n// under a pointer, filled and tonal rest flat and rise to 1, and a press\n// brings each back to where it rests.\nfunction shadowOf(\n variant: ButtonVariant,\n {\n hovered,\n pressed,\n }: { readonly hovered: boolean; readonly pressed: boolean },\n isDisabled: boolean,\n theme: ResolvedTheme,\n): undefined | ViewStyle {\n const lifted = hovered && !pressed\n\n if (isDisabled) {\n return undefined\n }\n\n if (variant === 'elevated') {\n return shadowsOf(theme)[lifted ? 'elevation2' : 'elevation1']\n }\n\n return (variant === 'filled' || variant === 'tonal') && lifted\n ? shadowsOf(theme).elevation1\n : undefined\n}\n\nexport { Button }\nexport type { ButtonProps, ButtonShape, ButtonSize, ButtonVariant }\n"],"mappings":";;;;;;;;;;;;;;;AAwMA,MAAMwE,WAAyD;CAC7DG,UAAU;CACVC,QAAQ;CACRC,UAAU;CACVC,MAAM;CACNC,OAAO;AACT;AAIA,MAAMC,aAAmD;CACvDC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,KAAK;AACP;AAIA,MAAMC,QAAgD;CACpDL,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,KAAK;AACP;AAIA,MAAME,iBAAiB;CACrBN,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,KAAK;AACP;AAGA,MAAMI,kBAKF;CACFd,UAAU;EAAEe,UAAU;EAA0BC,YAAY;CAAW;CACvEf,QAAQ;EAAEc,UAAU;EAAwBC,YAAY;CAAe;CACvEd,UAAU;EAAEa,UAAU;EAA0BC,YAAY;CAAW;CACvEZ,OAAO;EAAEW,UAAU;EAAuBC,YAAY;CAAQ;AAChE;AAEA,MAAMC,SAAShF,WAAWiF,OAAO;CAI/BC,MAAM;EACJC,YAAY;EACZC,eAAe;EACfC,gBAAgB;EAChBC,UAAU;CACZ;CACApC,MAAM;EACJiC,YAAY;EACZI,YAAY;EACZF,gBAAgB;CAClB;CAGAG,OAAO;EACLD,YAAY;EACZE,WAAW;CACb;AACF,CAAC;AAMD,SAASC,eAAe,EACtBC,WACsD;CACtD,OAAO;EAAEtB,IAAIsB,QAAQpB;EAAID,IAAIqB,QAAQ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YrC,OAAehH,MAA6B;CAC/D,OAAO;EAAEgH;EAAOhH,MAAMY,WAAWZ;CAAM;AACzC;AAKA,SAAS2I,SACPxJ,SACA,EACEwK,SACAnC,WAEF5H,YACA8C,OACuB;CACvB,MAAMkH,SAASD,WAAW,CAACnC;CAE3B,IAAI5H,YACF;CAGF,IAAIT,YAAY,YACd,OAAOiD,UAAUM,KAAK,CAAC,CAACkH,SAAS,eAAe;CAGlD,QAAQzK,YAAY,YAAYA,YAAY,YAAYyK,SACpDxH,UAAUM,KAAK,CAAC,CAACJ,aACjBkD,KAAAA;AACN"}
@@ -0,0 +1,87 @@
1
+ import { ControlSize } from "../../button/index.js";
2
+ import { ButtonShape } from "../button/index.js";
3
+ import { StyleProp, View, ViewProps, ViewStyle } from "react-native";
4
+ import { ComponentRef, ReactNode, Ref } from "react";
5
+ import { Key } from "react-stately";
6
+ //#region src/components/button-group/index.d.ts
7
+ type ButtonGroupNaming = {
8
+ readonly 'aria-label': string;
9
+ readonly 'aria-labelledby'?: string;
10
+ } | {
11
+ readonly 'aria-label'?: string;
12
+ readonly 'aria-labelledby': string;
13
+ };
14
+ type ButtonGroupProps = ButtonGroupNaming & Omit<ViewProps, 'aria-label' | 'aria-labelledby' | 'children' | 'role' | 'style'> & {
15
+ /**
16
+ * The buttons: Buttons and IconButtons, each with an `id` in a group
17
+ * that selects.
18
+ */
19
+ readonly children?: ReactNode;
20
+ /** The keys chosen at first, when the group keeps its own selection. */
21
+ readonly defaultSelectedKeys?: Iterable<Key>;
22
+ /**
23
+ * Whether a press on the last chosen button leaves it chosen rather
24
+ * than clearing the choice.
25
+ * @default false
26
+ */
27
+ readonly disallowEmptySelection?: boolean;
28
+ /**
29
+ * Disables every button in the group.
30
+ * @default false
31
+ */
32
+ readonly isDisabled?: boolean;
33
+ /** Called with the chosen keys when the choice changes. */
34
+ readonly onSelectionChange?: (keys: Set<Key>) => void;
35
+ readonly ref?: Ref<ComponentRef<typeof View>>;
36
+ /** The chosen keys, when the call site holds the selection. */
37
+ readonly selectedKeys?: Iterable<Key>;
38
+ /**
39
+ * Makes the group select: `single` for one button at a time, `multiple`
40
+ * for any number. Left out, the group's buttons are plain buttons.
41
+ */
42
+ readonly selectionMode?: 'multiple' | 'single';
43
+ /**
44
+ * The shape a connected group gives its two ends: `round`, the pill, or
45
+ * `square`, the size's inner corner, which its inner corners take as
46
+ * well.
47
+ * @default 'round'
48
+ */
49
+ readonly shape?: ButtonShape;
50
+ /**
51
+ * The size every button in the group takes, unless it names its own,
52
+ * and the size the group spaces and shapes them for.
53
+ * @default 'md'
54
+ */
55
+ readonly size?: ControlSize;
56
+ readonly style?: StyleProp<ViewStyle>;
57
+ /**
58
+ * `standard` sets the buttons apart and widens a pressed one;
59
+ * `connected` sets them 2dp apart with square inner corners.
60
+ * @default 'standard'
61
+ */
62
+ readonly variant?: ButtonGroupVariant;
63
+ };
64
+ type ButtonGroupVariant = 'connected' | 'standard';
65
+ /**
66
+ * A row of Buttons and IconButtons drawn as the button groups page's
67
+ * standard or connected group. Given `selectionMode`, its buttons are
68
+ * toggles whose selection the group keeps, by their `id`s.
69
+ *
70
+ * ```tsx
71
+ * <ButtonGroup aria-label="Label" selectionMode="single" variant="connected">
72
+ * <Button id="first">First item</Button>
73
+ * <Button id="second">Second item</Button>
74
+ * <Button id="third">Third item</Button>
75
+ * </ButtonGroup>
76
+ * ```
77
+ *
78
+ * Name the group with `aria-label` or `aria-labelledby`, one of which the
79
+ * props require. Choosing one is announced as a radio group, choosing
80
+ * several as a toolbar, and a group that selects nothing as a group.
81
+ *
82
+ * `style`, `ref` and `testID` land on the row.
83
+ */
84
+ declare function ButtonGroup({ children, defaultSelectedKeys, disallowEmptySelection, isDisabled, onSelectionChange, selectedKeys, selectionMode, shape, size, style, variant, ...props }: ButtonGroupProps): import("react").JSX.Element;
85
+ //#endregion
86
+ export { ButtonGroup, type ButtonGroupProps, type ButtonGroupVariant };
87
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,275 @@
1
+ import { useTheme } from "../../theme/scope.js";
2
+ import { composeStyles, themedStyles } from "../../theme/styles.js";
3
+ import { HEIGHTS } from "../../button/index.js";
4
+ import { ButtonGroupItemContext } from "../../button/group.js";
5
+ import { c } from "react/compiler-runtime";
6
+ import { StyleSheet, View } from "react-native";
7
+ import { Children, Fragment, isValidElement, useState } from "react";
8
+ import { jsx } from "react/jsx-runtime";
9
+ import { useToggleGroupState } from "react-stately/useToggleGroupState";
10
+ //#region src/components/button-group/index.tsx
11
+ const EXPANDED_RATIO = .15;
12
+ const XS_GAP = 18;
13
+ const styles = StyleSheet.create({ group: {
14
+ alignItems: "center",
15
+ alignSelf: "flex-start",
16
+ flexDirection: "row"
17
+ } });
18
+ const gapsOf = themedStyles(({ spacing }) => StyleSheet.create({
19
+ connected: { gap: spacing.xxs },
20
+ lg: { gap: spacing.sm },
21
+ md: { gap: spacing.md },
22
+ xl: { gap: spacing.sm },
23
+ xs: { gap: XS_GAP },
24
+ xxl: { gap: spacing.sm }
25
+ }));
26
+ const cornersOf = themedStyles(({ radii, sizing }) => {
27
+ const round = (size) => sizing[HEIGHTS[size]] / 2;
28
+ return {
29
+ inner: {
30
+ lg: radii.sm,
31
+ md: radii.sm,
32
+ xl: radii.lg,
33
+ xs: radii.xs,
34
+ xxl: 20
35
+ },
36
+ pressed: {
37
+ lg: radii.xs,
38
+ md: radii.xs,
39
+ xl: radii.sm,
40
+ xs: 2,
41
+ xxl: 10
42
+ },
43
+ round: {
44
+ lg: round("lg"),
45
+ md: round("md"),
46
+ xl: round("xl"),
47
+ xs: round("xs"),
48
+ xxl: round("xxl")
49
+ }
50
+ };
51
+ });
52
+ /**
53
+ * A row of Buttons and IconButtons drawn as the button groups page's
54
+ * standard or connected group. Given `selectionMode`, its buttons are
55
+ * toggles whose selection the group keeps, by their `id`s.
56
+ *
57
+ * ```tsx
58
+ * <ButtonGroup aria-label="Label" selectionMode="single" variant="connected">
59
+ * <Button id="first">First item</Button>
60
+ * <Button id="second">Second item</Button>
61
+ * <Button id="third">Third item</Button>
62
+ * </ButtonGroup>
63
+ * ```
64
+ *
65
+ * Name the group with `aria-label` or `aria-labelledby`, one of which the
66
+ * props require. Choosing one is announced as a radio group, choosing
67
+ * several as a toolbar, and a group that selects nothing as a group.
68
+ *
69
+ * `style`, `ref` and `testID` land on the row.
70
+ */
71
+ function ButtonGroup(t0) {
72
+ const $ = c(47);
73
+ let children;
74
+ let defaultSelectedKeys;
75
+ let onSelectionChange;
76
+ let props;
77
+ let selectedKeys;
78
+ let selectionMode;
79
+ let size;
80
+ let style;
81
+ let t1;
82
+ let t2;
83
+ let t3;
84
+ let t4;
85
+ if ($[0] !== t0) {
86
+ ({children, defaultSelectedKeys, disallowEmptySelection: t1, isDisabled: t2, onSelectionChange, selectedKeys, selectionMode, shape: t3, size, style, variant: t4, ...props} = t0);
87
+ $[0] = t0;
88
+ $[1] = children;
89
+ $[2] = defaultSelectedKeys;
90
+ $[3] = onSelectionChange;
91
+ $[4] = props;
92
+ $[5] = selectedKeys;
93
+ $[6] = selectionMode;
94
+ $[7] = size;
95
+ $[8] = style;
96
+ $[9] = t1;
97
+ $[10] = t2;
98
+ $[11] = t3;
99
+ $[12] = t4;
100
+ } else {
101
+ children = $[1];
102
+ defaultSelectedKeys = $[2];
103
+ onSelectionChange = $[3];
104
+ props = $[4];
105
+ selectedKeys = $[5];
106
+ selectionMode = $[6];
107
+ size = $[7];
108
+ style = $[8];
109
+ t1 = $[9];
110
+ t2 = $[10];
111
+ t3 = $[11];
112
+ t4 = $[12];
113
+ }
114
+ const disallowEmptySelection = t1 === void 0 ? false : t1;
115
+ const isDisabled = t2 === void 0 ? false : t2;
116
+ const shape = t3 === void 0 ? "round" : t3;
117
+ const variant = t4 === void 0 ? "standard" : t4;
118
+ const theme = useTheme();
119
+ const [press, setPress] = useState(null);
120
+ const t5 = selectionMode ?? "single";
121
+ let t6;
122
+ if ($[13] !== defaultSelectedKeys || $[14] !== disallowEmptySelection || $[15] !== isDisabled || $[16] !== onSelectionChange || $[17] !== selectedKeys || $[18] !== t5) {
123
+ t6 = {
124
+ defaultSelectedKeys,
125
+ disallowEmptySelection,
126
+ isDisabled,
127
+ onSelectionChange,
128
+ selectedKeys,
129
+ selectionMode: t5
130
+ };
131
+ $[13] = defaultSelectedKeys;
132
+ $[14] = disallowEmptySelection;
133
+ $[15] = isDisabled;
134
+ $[16] = onSelectionChange;
135
+ $[17] = selectedKeys;
136
+ $[18] = t5;
137
+ $[19] = t6;
138
+ } else t6 = $[19];
139
+ const state = useToggleGroupState(t6);
140
+ let T0;
141
+ let t10;
142
+ let t7;
143
+ let t8;
144
+ let t9;
145
+ if ($[20] !== children || $[21] !== isDisabled || $[22] !== press || $[23] !== props || $[24] !== selectionMode || $[25] !== shape || $[26] !== size || $[27] !== state || $[28] !== style || $[29] !== theme || $[30] !== variant) {
146
+ const items = buttonsOf(children);
147
+ const sized = size ?? "md";
148
+ const selection = selectionMode === void 0 ? void 0 : {
149
+ single: selectionMode === "single",
150
+ state
151
+ };
152
+ T0 = View;
153
+ t7 = selectionMode === void 0 ? "group" : selection?.single === true ? "radiogroup" : "toolbar";
154
+ t8 = props;
155
+ if ($[36] !== sized || $[37] !== style || $[38] !== theme || $[39] !== variant) {
156
+ t9 = composeStyles(styles.group, gapsOf(theme)[variant === "connected" ? "connected" : sized], style);
157
+ $[36] = sized;
158
+ $[37] = style;
159
+ $[38] = theme;
160
+ $[39] = variant;
161
+ $[40] = t9;
162
+ } else t9 = $[40];
163
+ t10 = items.map((t11, index) => {
164
+ const { element, key } = t11;
165
+ return /* @__PURE__ */ jsx(ButtonGroupItemContext, {
166
+ value: itemFor({
167
+ corners: cornersOf(theme),
168
+ count: items.length,
169
+ index,
170
+ isDisabled,
171
+ press,
172
+ selection,
173
+ setPress,
174
+ shape,
175
+ size,
176
+ variant
177
+ }),
178
+ children: element
179
+ }, key);
180
+ });
181
+ $[20] = children;
182
+ $[21] = isDisabled;
183
+ $[22] = press;
184
+ $[23] = props;
185
+ $[24] = selectionMode;
186
+ $[25] = shape;
187
+ $[26] = size;
188
+ $[27] = state;
189
+ $[28] = style;
190
+ $[29] = theme;
191
+ $[30] = variant;
192
+ $[31] = T0;
193
+ $[32] = t10;
194
+ $[33] = t7;
195
+ $[34] = t8;
196
+ $[35] = t9;
197
+ } else {
198
+ T0 = $[31];
199
+ t10 = $[32];
200
+ t7 = $[33];
201
+ t8 = $[34];
202
+ t9 = $[35];
203
+ }
204
+ let t11;
205
+ if ($[41] !== T0 || $[42] !== t10 || $[43] !== t7 || $[44] !== t8 || $[45] !== t9) {
206
+ t11 = /* @__PURE__ */ jsx(T0, {
207
+ role: t7,
208
+ ...t8,
209
+ style: t9,
210
+ children: t10
211
+ });
212
+ $[41] = T0;
213
+ $[42] = t10;
214
+ $[43] = t7;
215
+ $[44] = t8;
216
+ $[45] = t9;
217
+ $[46] = t11;
218
+ } else t11 = $[46];
219
+ return t11;
220
+ }
221
+ function buttonsOf(children, prefix = "") {
222
+ return Children.toArray(children).flatMap((child) => {
223
+ if (!isValidElement(child)) return [];
224
+ const key = `${prefix}${String(child.key)}`;
225
+ return child.type === Fragment ? buttonsOf(child.props.children, `${key}/`) : [{
226
+ element: child,
227
+ key
228
+ }];
229
+ });
230
+ }
231
+ function connectedCorners(corners, index, count, size, shape, { pressed, selected }) {
232
+ const outer = shape === "square" ? corners.inner[size] : corners.round[size];
233
+ const inner = pressed ? corners.pressed[size] : selected ? corners.round[size] : corners.inner[size];
234
+ return {
235
+ end: index === count - 1 ? outer : inner,
236
+ start: index === 0 ? outer : inner
237
+ };
238
+ }
239
+ function itemFor({ corners, count, index, isDisabled, press, selection, setPress, shape, size, variant }) {
240
+ const sized = size ?? "md";
241
+ if (variant === "connected") return {
242
+ corners: (state) => connectedCorners(corners, index, count, sized, shape, state),
243
+ isDisabled,
244
+ keepsTarget: sized === "xs" || sized === "md",
245
+ selection,
246
+ shift: 0,
247
+ size
248
+ };
249
+ return {
250
+ isDisabled,
251
+ keepsTarget: false,
252
+ onPressEnd: () => {
253
+ setPress(null);
254
+ },
255
+ onPressStart: (width) => {
256
+ setPress({
257
+ delta: width * EXPANDED_RATIO,
258
+ index
259
+ });
260
+ },
261
+ selection,
262
+ shift: shiftFor(index, count, press),
263
+ size
264
+ };
265
+ }
266
+ function shiftFor(index, count, press) {
267
+ if (press === null) return 0;
268
+ if (index === press.index) return press.delta;
269
+ if (Math.abs(index - press.index) !== 1) return 0;
270
+ return -(press.index === 0 || press.index === count - 1 ? press.delta : press.delta / 2);
271
+ }
272
+ //#endregion
273
+ export { ButtonGroup };
274
+
275
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["ComponentRef","ReactElement","ReactNode","Ref","StyleProp","ViewProps","ViewStyle","Key","Children","Fragment","isValidElement","useState","StyleSheet","View","useToggleGroupState","ControlSize","ButtonGroupItem","GroupButtonState","GroupCorners","ResolvedTheme","ButtonShape","HEIGHTS","ButtonGroupItemContext","useTheme","composeStyles","themedStyles","EXPANDED_RATIO","XS_GAP","ButtonGroupNaming","ButtonGroupProps","Omit","children","defaultSelectedKeys","Iterable","disallowEmptySelection","isDisabled","onSelectionChange","keys","Set","ref","selectedKeys","selectionMode","shape","size","style","variant","ButtonGroupVariant","Press","delta","index","styles","create","group","alignItems","alignSelf","flexDirection","gapsOf","spacing","connected","gap","xxs","lg","sm","md","xl","xs","xxl","cornersOf","radii","sizing","round","inner","pressed","Record","Readonly","ButtonGroup","t0","$","_c","props","t1","t2","t3","t4","undefined","theme","press","setPress","t5","t6","state","T0","t10","t7","t8","t9","items","buttonsOf","sized","selection","single","map","t11","element","key","itemFor","corners","count","length","prefix","toArray","flatMap","child","String","type","connectedCorners","ReturnType","selected","outer","end","start","keepsTarget","shift","onPressEnd","onPressStart","width","shiftFor","Math","abs","atEnd","_c"],"sources":["../../../src/components/button-group/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactElement, ReactNode, Ref } from 'react'\nimport type { StyleProp, ViewProps, ViewStyle } from 'react-native'\nimport type { Key } from 'react-stately'\n\nimport { Children, Fragment, isValidElement, useState } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { useToggleGroupState } from 'react-stately/useToggleGroupState'\n\nimport type { ControlSize } from '../../button'\nimport type {\n ButtonGroupItem,\n GroupButtonState,\n GroupCorners,\n} from '../../button/group'\nimport type { ResolvedTheme } from '../../theme/scope'\nimport type { ButtonShape } from '../button'\n\nimport { HEIGHTS } from '../../button'\nimport { ButtonGroupItemContext } from '../../button/group'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// The button groups page's two groups, around Buttons and IconButtons placed\n// inside, as kanso-ui's ButtonGroup draws them: the standard group, buttons\n// set apart by the page's 18dp, 12dp, 8dp, 8dp and 8dp across the sizes, and\n// the connected group, buttons 2dp apart whose inner corners square off,\n// 4dp, 8dp, 8dp, 16dp and 20dp, while the group's two ends keep the buttons'\n// own round. A square connected group takes the same corner at its ends. The\n// group draws nothing itself; it hands each button its size, its corners and\n// its part in the press interaction through src/button's group.ts.\n//\n// **A press is felt across a standard group.** The pressed button widens by\n// 15% of its width, the share Material Design's own group widens it by, and\n// its neighbours narrow to make the room, so the group's width holds: both\n// neighbours by half the gain each, or the one neighbour of a button at the\n// group's end by all of it. Button takes the change as inline padding and\n// IconButton as width, and both ease it over the motion tokens' short\n// duration on the emphasised curve, or at once under reduced motion.\n//\n// **A connected group answers a press and a selection in the corner\n// instead.** Its buttons stay where they are; a pressed one's inner corners\n// tighten, and a selected one's round off entirely. The page gives the\n// pressed corner for its small group alone, 4dp against the 8dp it rests at;\n// the other sizes press to half their resting corner the same way. The\n// page also gives XS and S buttons in a connected group a 48dp minimum\n// width, which is their touch target. The corners ease as a button's own\n// do, and follow the layout's direction, so a right-to-left group keeps its\n// round end at its start, on the right.\n//\n// Given `selectionMode` the group keeps a selection of its buttons by their\n// `id`s, as web's React Aria `ToggleButtonGroup` does, and every button in\n// it is a toggle of the group's: a radio group for `single`, and a toolbar\n// of buttons that each say whether they are selected for `multiple`.\n// Without it the group is a plain group of buttons.\n\n// The press interaction's share, from Material Design's own button group.\nconst EXPANDED_RATIO = 0.15\n\n// The 18dp a standard group sets its smallest buttons apart by falls between\n// two steps of the spacing scale and is written out, as on web.\nconst XS_GAP = 18\n\ntype ButtonGroupNaming =\n | { readonly 'aria-label': string; readonly 'aria-labelledby'?: string }\n | { readonly 'aria-label'?: string; readonly 'aria-labelledby': string }\n\ntype ButtonGroupProps = ButtonGroupNaming &\n Omit<\n ViewProps,\n 'aria-label' | 'aria-labelledby' | 'children' | 'role' | 'style'\n > & {\n /**\n * The buttons: Buttons and IconButtons, each with an `id` in a group\n * that selects.\n */\n readonly children?: ReactNode\n /** The keys chosen at first, when the group keeps its own selection. */\n readonly defaultSelectedKeys?: Iterable<Key>\n /**\n * Whether a press on the last chosen button leaves it chosen rather\n * than clearing the choice.\n * @default false\n */\n readonly disallowEmptySelection?: boolean\n /**\n * Disables every button in the group.\n * @default false\n */\n readonly isDisabled?: boolean\n /** Called with the chosen keys when the choice changes. */\n readonly onSelectionChange?: (keys: Set<Key>) => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n /** The chosen keys, when the call site holds the selection. */\n readonly selectedKeys?: Iterable<Key>\n /**\n * Makes the group select: `single` for one button at a time, `multiple`\n * for any number. Left out, the group's buttons are plain buttons.\n */\n readonly selectionMode?: 'multiple' | 'single'\n /**\n * The shape a connected group gives its two ends: `round`, the pill, or\n * `square`, the size's inner corner, which its inner corners take as\n * well.\n * @default 'round'\n */\n readonly shape?: ButtonShape\n /**\n * The size every button in the group takes, unless it names its own,\n * and the size the group spaces and shapes them for.\n * @default 'md'\n */\n readonly size?: ControlSize\n readonly style?: StyleProp<ViewStyle>\n /**\n * `standard` sets the buttons apart and widens a pressed one;\n * `connected` sets them 2dp apart with square inner corners.\n * @default 'standard'\n */\n readonly variant?: ButtonGroupVariant\n }\n\ntype ButtonGroupVariant = 'connected' | 'standard'\n\ntype Press = { readonly delta: number; readonly index: number }\n\nconst styles = StyleSheet.create({\n // A row as wide as its buttons, as web's inline-flex group is.\n group: {\n alignItems: 'center',\n alignSelf: 'flex-start',\n flexDirection: 'row',\n },\n})\n\n// The space between buttons, by variant and size.\nconst gapsOf = themedStyles(({ spacing }) =>\n StyleSheet.create({\n connected: { gap: spacing.xxs },\n lg: { gap: spacing.sm },\n md: { gap: spacing.md },\n xl: { gap: spacing.sm },\n xs: { gap: XS_GAP },\n xxl: { gap: spacing.sm },\n }),\n)\n\n// A connected button's three corners at each size: the inner corner it\n// rests at, the one it presses to, and the round end, half the button's\n// height. Not the pill: a corner larger than half its side scales down every\n// corner beside it, so a pill end beside an 8dp inner corner would shrink\n// the inner one. The 20dp at `xxl` and the 2dp and 10dp halves fall between\n// steps of the radius scale and are written out, as on web.\nconst cornersOf = themedStyles(({ radii, sizing }: ResolvedTheme) => {\n const round = (size: ControlSize) => sizing[HEIGHTS[size]] / 2\n\n return {\n inner: { lg: radii.sm, md: radii.sm, xl: radii.lg, xs: radii.xs, xxl: 20 },\n pressed: { lg: radii.xs, md: radii.xs, xl: radii.sm, xs: 2, xxl: 10 },\n round: {\n lg: round('lg'),\n md: round('md'),\n xl: round('xl'),\n xs: round('xs'),\n xxl: round('xxl'),\n },\n } satisfies Record<string, Readonly<Record<ControlSize, number>>>\n})\n\n/**\n * A row of Buttons and IconButtons drawn as the button groups page's\n * standard or connected group. Given `selectionMode`, its buttons are\n * toggles whose selection the group keeps, by their `id`s.\n *\n * ```tsx\n * <ButtonGroup aria-label=\"Label\" selectionMode=\"single\" variant=\"connected\">\n * <Button id=\"first\">First item</Button>\n * <Button id=\"second\">Second item</Button>\n * <Button id=\"third\">Third item</Button>\n * </ButtonGroup>\n * ```\n *\n * Name the group with `aria-label` or `aria-labelledby`, one of which the\n * props require. Choosing one is announced as a radio group, choosing\n * several as a toolbar, and a group that selects nothing as a group.\n *\n * `style`, `ref` and `testID` land on the row.\n */\nfunction ButtonGroup({\n children,\n defaultSelectedKeys,\n disallowEmptySelection = false,\n isDisabled = false,\n onSelectionChange,\n selectedKeys,\n selectionMode,\n shape = 'round',\n size,\n style,\n variant = 'standard',\n ...props\n}: ButtonGroupProps) {\n const theme = useTheme()\n const [press, setPress] = useState<null | Press>(null)\n // The state is kept whether or not the group selects, since a hook cannot\n // be called conditionally; a group that selects nothing never reads it.\n const state = useToggleGroupState({\n defaultSelectedKeys,\n disallowEmptySelection,\n isDisabled,\n onSelectionChange,\n selectedKeys,\n selectionMode: selectionMode ?? 'single',\n })\n const items = buttonsOf(children)\n const sized = size ?? 'md'\n const selection =\n selectionMode === undefined\n ? undefined\n : { single: selectionMode === 'single', state }\n\n return (\n <View\n role={\n selectionMode === undefined\n ? 'group'\n : selection?.single === true\n ? 'radiogroup'\n : 'toolbar'\n }\n {...props}\n style={composeStyles<ViewStyle>(\n styles.group,\n gapsOf(theme)[variant === 'connected' ? 'connected' : sized],\n style,\n )}\n >\n {items.map(({ element, key }, index) => (\n <ButtonGroupItemContext\n key={key}\n value={itemFor({\n corners: cornersOf(theme),\n count: items.length,\n index,\n isDisabled,\n press,\n selection,\n setPress,\n shape,\n size,\n variant,\n })}\n >\n {element}\n </ButtonGroupItemContext>\n ))}\n </View>\n )\n}\n\n// The buttons among a group's children, with any fragment between them\n// opened, so a group can take its buttons as one fragment and still know\n// which is first and which last. Each keeps a key made of its own and its\n// fragments', so two fragments' children never share one.\nfunction buttonsOf(\n children: ReactNode,\n prefix = '',\n): { readonly element: ReactElement; readonly key: string }[] {\n return Children.toArray(children).flatMap((child) => {\n if (!isValidElement<{ readonly children?: ReactNode }>(child)) {\n return []\n }\n const key = `${prefix}${String(child.key)}`\n return child.type === Fragment\n ? buttonsOf(child.props.children, `${key}/`)\n : [{ element: child, key }]\n })\n}\n\n// A connected button's corners: the group's ends keep the outer shape, and\n// every edge it shares with a neighbour takes the inner corner, tighter\n// while pressed and round once selected; a press wins over a selection.\nfunction connectedCorners(\n corners: ReturnType<typeof cornersOf>,\n index: number,\n count: number,\n size: ControlSize,\n shape: ButtonShape,\n { pressed, selected }: GroupButtonState,\n): GroupCorners {\n const outer = shape === 'square' ? corners.inner[size] : corners.round[size]\n const inner = pressed\n ? corners.pressed[size]\n : selected\n ? corners.round[size]\n : corners.inner[size]\n\n return {\n end: index === count - 1 ? outer : inner,\n start: index === 0 ? outer : inner,\n }\n}\n\n// One button's part in the group: its size, whether it is disabled, the\n// group's selection, its corners in a connected group, and its share of a\n// press in a standard one.\nfunction itemFor({\n corners,\n count,\n index,\n isDisabled,\n press,\n selection,\n setPress,\n shape,\n size,\n variant,\n}: {\n readonly corners: ReturnType<typeof cornersOf>\n readonly count: number\n readonly index: number\n readonly isDisabled: boolean\n readonly press: null | Press\n readonly selection: ButtonGroupItem['selection']\n readonly setPress: (press: null | Press) => void\n readonly shape: ButtonShape\n readonly size: ControlSize | undefined\n readonly variant: ButtonGroupVariant\n}): ButtonGroupItem {\n const sized = size ?? 'md'\n\n if (variant === 'connected') {\n return {\n corners: (state) =>\n connectedCorners(corners, index, count, sized, shape, state),\n isDisabled,\n keepsTarget: sized === 'xs' || sized === 'md',\n selection,\n shift: 0,\n size,\n }\n }\n\n return {\n isDisabled,\n keepsTarget: false,\n onPressEnd: () => {\n setPress(null)\n },\n onPressStart: (width) => {\n setPress({ delta: width * EXPANDED_RATIO, index })\n },\n selection,\n shift: shiftFor(index, count, press),\n size,\n }\n}\n\n// How far a standard group moves one button's width while a press is held:\n// the pressed button gains the whole share, and its neighbours give it up,\n// half each, or all of it from the one neighbour of a button at an end.\nfunction shiftFor(index: number, count: number, press: null | Press) {\n if (press === null) {\n return 0\n }\n if (index === press.index) {\n return press.delta\n }\n if (Math.abs(index - press.index) !== 1) {\n return 0\n }\n\n const atEnd = press.index === 0 || press.index === count - 1\n\n return -(atEnd ? press.delta : press.delta / 2)\n}\n\nexport { ButtonGroup }\nexport type { ButtonGroupProps, ButtonGroupVariant }\n"],"mappings":";;;;;;;;;;AAwDA,MAAM0B,iBAAiB;AAI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UAAU,MACZ,OAAO;CAET,IAAIrC,UAAUqC,MAAMrC,OAClB,OAAOqC,MAAMtC;CAEf,IAAI+E,KAAKC,IAAI/E,QAAQqC,MAAMrC,KAAK,MAAM,GACpC,OAAO;CAKT,OAAO,EAFOqC,MAAMrC,UAAU,KAAKqC,MAAMrC,UAAU0D,QAAQ,IAE1CrB,MAAMtC,QAAQsC,MAAMtC,QAAQ;AAC/C"}
@@ -1,11 +1,12 @@
1
1
  import { StyleProp, View, ViewStyle } from "react-native";
2
2
  import { ComponentRef, Ref } from "react";
3
+ import { DateDuration } from "@internationalized/date";
3
4
  import { CalendarProps, DateValue } from "react-stately/useCalendarState";
4
5
  //#region src/components/calendar/index.d.ts
5
6
  type CalendarProps$1<T extends DateValue = DateValue> = Pick<CalendarProps<T>, 'defaultFocusedValue' | 'defaultValue' | 'firstDayOfWeek' | 'focusedValue' | 'isDateUnavailable' | 'isDisabled' | 'isReadOnly' | 'maxValue' | 'minValue' | 'onChange' | 'onFocusChange' | 'value'> & {
6
7
  /**
7
- * The calendar's name. The month shown is added to it, as React Aria adds
8
- * it on web.
8
+ * The calendar's name. The month shown, or the months, is added to it, as
9
+ * React Aria adds it on web.
9
10
  */
10
11
  readonly 'aria-label'?: string;
11
12
  /**
@@ -27,6 +28,13 @@ type CalendarProps$1<T extends DateValue = DateValue> = Pick<CalendarProps<T>, '
27
28
  readonly showMonthYearMenus?: boolean;
28
29
  readonly style?: StyleProp<ViewStyle>;
29
30
  readonly testID?: string;
31
+ /**
32
+ * How many months the calendar shows at once, and moves by: side by side
33
+ * from the expanded window size up, one under another below it. Only
34
+ * `months` is read.
35
+ * @default { months: 1 }
36
+ */
37
+ readonly visibleDuration?: DateDuration;
30
38
  };
31
39
  /**
32
40
  * A month calendar for picking a date. The value is an
@@ -45,7 +53,7 @@ type CalendarProps$1<T extends DateValue = DateValue> = Pick<CalendarProps<T>, '
45
53
  *
46
54
  * `style`, `ref` and `testID` land on the container.
47
55
  */
48
- declare function Calendar<T extends DateValue = DateValue>({ 'aria-label': ariaLabel, locale, ref, showMonthYearMenus, style, testID, ...props }: CalendarProps$1<T>): import("react").JSX.Element;
56
+ declare function Calendar<T extends DateValue = DateValue>({ 'aria-label': ariaLabel, locale, ref, showMonthYearMenus, style, testID, visibleDuration, ...props }: CalendarProps$1<T>): import("react").JSX.Element;
49
57
  //#endregion
50
58
  export { Calendar, type CalendarProps$1 as CalendarProps };
51
59
  //# sourceMappingURL=index.d.ts.map