@westpac/ui 0.4.0 → 0.6.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 (226) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/accordion/accordion.component.d.ts +2 -2
  3. package/dist/components/accordion/components/accordion-item/accordion-item.component.js +5 -3
  4. package/dist/components/accordion/components/accordion-item/accordion-item.styles.d.ts +16 -0
  5. package/dist/components/accordion/components/accordion-item/accordion-item.styles.js +17 -9
  6. package/dist/components/alert/alert.component.js +2 -1
  7. package/dist/components/alert/alert.styles.js +2 -2
  8. package/dist/components/autocomplete/autocomplete.styles.js +3 -3
  9. package/dist/components/button/button.component.d.ts +18 -2
  10. package/dist/components/button/button.component.js +6 -6
  11. package/dist/components/button/button.styles.d.ts +16 -0
  12. package/dist/components/button/button.styles.js +8 -0
  13. package/dist/components/button-dropdown/button-dropdown.styles.js +1 -1
  14. package/dist/components/button-dropdown/components/panel/panel.component.js +6 -3
  15. package/dist/components/button-dropdown/components/panel/panel.styles.d.ts +14 -2
  16. package/dist/components/button-dropdown/components/panel/panel.styles.js +8 -2
  17. package/dist/components/checkbox-group/components/checkbox/checkbox.component.js +2 -2
  18. package/dist/components/checkbox-group/components/checkbox/checkbox.styles.d.ts +2 -2
  19. package/dist/components/checkbox-group/components/checkbox/checkbox.styles.js +4 -4
  20. package/dist/components/collapsible/collapsible.styles.js +1 -1
  21. package/dist/components/compacta/compacta.component.js +4 -3
  22. package/dist/components/compacta/compacta.styles.js +1 -1
  23. package/dist/components/flexi-cell/flexi-cell.component.js +6 -3
  24. package/dist/components/flexi-cell/flexi-cell.styles.d.ts +10 -0
  25. package/dist/components/flexi-cell/flexi-cell.styles.js +7 -2
  26. package/dist/components/flexi-cell/flexi-cell.types.d.ts +4 -0
  27. package/dist/components/flexi-cell/index.d.ts +1 -0
  28. package/dist/components/flexi-cell/index.js +1 -0
  29. package/dist/components/icon/index.d.ts +1 -0
  30. package/dist/components/icon/index.js +1 -0
  31. package/dist/components/index.d.ts +3 -1
  32. package/dist/components/index.js +3 -1
  33. package/dist/components/input/input.component.d.ts +7 -1
  34. package/dist/components/input/input.component.js +5 -2
  35. package/dist/components/input/input.styles.d.ts +7 -1
  36. package/dist/components/input/input.styles.js +4 -1
  37. package/dist/components/link/link.component.d.ts +1 -1
  38. package/dist/components/link/link.component.js +5 -3
  39. package/dist/components/link/link.styles.d.ts +16 -0
  40. package/dist/components/link/link.styles.js +11 -3
  41. package/dist/components/list/components/item/item.component.d.ts +1 -1
  42. package/dist/components/list/components/item/item.component.js +6 -3
  43. package/dist/components/list/components/item/item.styles.d.ts +10 -0
  44. package/dist/components/list/components/item/item.styles.js +7 -2
  45. package/dist/components/list/list.component.d.ts +1 -1
  46. package/dist/components/list/list.stories.js +7 -1
  47. package/dist/components/list/list.styles.js +1 -1
  48. package/dist/components/list/list.utils.d.ts +1 -1
  49. package/dist/components/modal/components/backdrop/backdrop.styles.js +2 -2
  50. package/dist/components/modal/components/dialog/dialog.component.js +6 -4
  51. package/dist/components/modal/components/dialog/dialog.styles.d.ts +16 -0
  52. package/dist/components/modal/components/dialog/dialog.styles.js +11 -3
  53. package/dist/components/popover/components/panel/panel.styles.js +1 -1
  54. package/dist/components/popover/popover.component.js +0 -1
  55. package/dist/components/popover/popover.styles.d.ts +0 -2
  56. package/dist/components/popover/popover.styles.js +1 -2
  57. package/dist/components/radio-group/components/radio/radio.component.js +2 -2
  58. package/dist/components/radio-group/components/radio/radio.styles.d.ts +2 -2
  59. package/dist/components/radio-group/components/radio/radio.styles.js +5 -5
  60. package/dist/components/repeater/index.d.ts +2 -0
  61. package/dist/components/repeater/index.js +1 -0
  62. package/dist/components/repeater/repeater.component.d.ts +3 -0
  63. package/dist/components/repeater/repeater.component.js +144 -0
  64. package/dist/components/repeater/repeater.stories.d.ts +13 -0
  65. package/dist/components/repeater/repeater.stories.js +34 -0
  66. package/dist/components/repeater/repeater.styles.d.ts +49 -0
  67. package/dist/components/repeater/repeater.styles.js +36 -0
  68. package/dist/components/repeater/repeater.types.d.ts +19 -0
  69. package/dist/components/repeater/repeater.types.js +1 -0
  70. package/dist/components/repeater/repeater.utils.d.ts +2 -0
  71. package/dist/components/repeater/repeater.utils.js +2 -0
  72. package/dist/components/select/select.component.d.ts +11 -1
  73. package/dist/components/select/select.component.js +5 -2
  74. package/dist/components/select/select.styles.d.ts +11 -1
  75. package/dist/components/select/select.styles.js +6 -1
  76. package/dist/components/selector/components/index.d.ts +2 -0
  77. package/dist/components/selector/components/index.js +2 -0
  78. package/dist/components/selector/components/selector-checkbox-group/components/index.d.ts +1 -0
  79. package/dist/components/selector/components/selector-checkbox-group/components/index.js +1 -0
  80. package/dist/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/index.d.ts +2 -0
  81. package/dist/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/index.js +1 -0
  82. package/dist/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/selector-checkbox-group-option.component.d.ts +12 -0
  83. package/dist/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/selector-checkbox-group-option.component.js +67 -0
  84. package/dist/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/selector-checkbox-group-option.styles.d.ts +59 -0
  85. package/dist/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/selector-checkbox-group-option.styles.js +57 -0
  86. package/dist/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/selector-checkbox-group-option.types.d.ts +10 -0
  87. package/dist/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/selector-checkbox-group-option.types.js +1 -0
  88. package/dist/components/selector/components/selector-checkbox-group/index.d.ts +2 -0
  89. package/dist/components/selector/components/selector-checkbox-group/index.js +1 -0
  90. package/dist/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.d.ts +15 -0
  91. package/dist/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.js +49 -0
  92. package/dist/components/selector/components/selector-checkbox-group/selector-checkbox-group.styles.d.ts +3 -0
  93. package/dist/components/selector/components/selector-checkbox-group/selector-checkbox-group.styles.js +13 -0
  94. package/dist/components/selector/components/selector-checkbox-group/selector-checkbox-group.types.d.ts +20 -0
  95. package/dist/components/selector/components/selector-checkbox-group/selector-checkbox-group.types.js +1 -0
  96. package/dist/components/selector/components/selector-radio-group/components/index.d.ts +1 -0
  97. package/dist/components/selector/components/selector-radio-group/components/index.js +1 -0
  98. package/dist/components/selector/components/selector-radio-group/components/selector-radio-group-option/index.d.ts +2 -0
  99. package/dist/components/selector/components/selector-radio-group/components/selector-radio-group-option/index.js +1 -0
  100. package/dist/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.component.d.ts +12 -0
  101. package/dist/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.component.js +67 -0
  102. package/dist/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.styles.d.ts +59 -0
  103. package/dist/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.styles.js +57 -0
  104. package/dist/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.types.d.ts +15 -0
  105. package/dist/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.types.js +1 -0
  106. package/dist/components/selector/components/selector-radio-group/index.d.ts +2 -0
  107. package/dist/components/selector/components/selector-radio-group/index.js +1 -0
  108. package/dist/components/selector/components/selector-radio-group/selector-radio-group.component.d.ts +15 -0
  109. package/dist/components/selector/components/selector-radio-group/selector-radio-group.component.js +58 -0
  110. package/dist/components/selector/components/selector-radio-group/selector-radio-group.styles.d.ts +13 -0
  111. package/dist/components/selector/components/selector-radio-group/selector-radio-group.styles.js +18 -0
  112. package/dist/components/selector/components/selector-radio-group/selector-radio-group.types.d.ts +17 -0
  113. package/dist/components/selector/components/selector-radio-group/selector-radio-group.types.js +1 -0
  114. package/dist/components/selector/index.d.ts +2 -0
  115. package/dist/components/selector/index.js +1 -0
  116. package/dist/components/selector/selector.component.d.ts +30 -0
  117. package/dist/components/selector/selector.component.js +34 -0
  118. package/dist/components/selector/selector.stories.d.ts +57 -0
  119. package/dist/components/selector/selector.stories.js +515 -0
  120. package/dist/components/selector/selector.types.d.ts +20 -0
  121. package/dist/components/selector/selector.types.js +1 -0
  122. package/dist/components/switch/switch.component.d.ts +1 -1
  123. package/dist/components/switch/switch.component.js +11 -7
  124. package/dist/components/switch/switch.stories.js +1 -1
  125. package/dist/components/switch/switch.styles.d.ts +2 -2
  126. package/dist/components/switch/switch.styles.js +2 -2
  127. package/dist/components/switch/switch.types.d.ts +5 -1
  128. package/dist/components/tabs/components/tab/tab.component.js +5 -3
  129. package/dist/components/tabs/components/tab/tab.styles.d.ts +9 -1
  130. package/dist/components/tabs/components/tab/tab.styles.js +12 -8
  131. package/dist/components/tabs/components/tab-panel/tab-panel.component.js +5 -3
  132. package/dist/components/tabs/components/tab-panel/tab-panel.styles.d.ts +7 -1
  133. package/dist/components/tabs/components/tab-panel/tab-panel.styles.js +5 -2
  134. package/dist/components/textarea/textarea.component.d.ts +7 -1
  135. package/dist/components/textarea/textarea.component.js +5 -2
  136. package/dist/components/textarea/textarea.styles.d.ts +7 -1
  137. package/dist/components/textarea/textarea.styles.js +4 -1
  138. package/dist/css/westpac-ui.css +165 -3
  139. package/dist/css/westpac-ui.min.css +165 -3
  140. package/dist/tailwind/constants/colors.d.ts +9 -9
  141. package/dist/tailwind/themes/index.d.ts +11 -11
  142. package/dist/utils/generateId.d.ts +1 -0
  143. package/dist/utils/generateId.js +6 -0
  144. package/dist/utils/index.d.ts +1 -0
  145. package/dist/utils/index.js +1 -0
  146. package/package.json +7 -1
  147. package/src/components/accordion/components/accordion-item/accordion-item.component.tsx +4 -3
  148. package/src/components/accordion/components/accordion-item/accordion-item.styles.ts +17 -9
  149. package/src/components/alert/alert.component.tsx +1 -1
  150. package/src/components/alert/alert.styles.ts +2 -2
  151. package/src/components/autocomplete/autocomplete.styles.ts +3 -3
  152. package/src/components/button/button.component.tsx +9 -10
  153. package/src/components/button/button.styles.ts +4 -0
  154. package/src/components/button-dropdown/button-dropdown.styles.ts +1 -1
  155. package/src/components/button-dropdown/components/panel/panel.component.tsx +4 -3
  156. package/src/components/button-dropdown/components/panel/panel.styles.ts +8 -2
  157. package/src/components/checkbox-group/components/checkbox/checkbox.component.tsx +2 -2
  158. package/src/components/checkbox-group/components/checkbox/checkbox.styles.ts +4 -4
  159. package/src/components/collapsible/collapsible.styles.ts +1 -1
  160. package/src/components/compacta/compacta.component.tsx +4 -3
  161. package/src/components/compacta/compacta.styles.ts +1 -1
  162. package/src/components/flexi-cell/flexi-cell.component.tsx +5 -2
  163. package/src/components/flexi-cell/flexi-cell.styles.ts +5 -2
  164. package/src/components/flexi-cell/flexi-cell.types.ts +4 -0
  165. package/src/components/flexi-cell/index.ts +1 -0
  166. package/src/components/icon/index.ts +1 -0
  167. package/src/components/index.ts +3 -1
  168. package/src/components/input/input.component.tsx +10 -1
  169. package/src/components/input/input.styles.ts +4 -1
  170. package/src/components/link/link.component.tsx +10 -3
  171. package/src/components/link/link.styles.ts +7 -3
  172. package/src/components/list/components/item/item.component.tsx +4 -1
  173. package/src/components/list/components/item/item.styles.ts +5 -2
  174. package/src/components/list/list.stories.tsx +3 -3
  175. package/src/components/list/list.styles.ts +1 -1
  176. package/src/components/modal/components/backdrop/backdrop.styles.ts +2 -2
  177. package/src/components/modal/components/dialog/dialog.component.tsx +4 -3
  178. package/src/components/modal/components/dialog/dialog.styles.ts +7 -3
  179. package/src/components/popover/components/panel/panel.styles.ts +1 -1
  180. package/src/components/popover/popover.component.tsx +0 -1
  181. package/src/components/popover/popover.styles.ts +0 -1
  182. package/src/components/radio-group/components/radio/radio.component.tsx +2 -2
  183. package/src/components/radio-group/components/radio/radio.styles.ts +5 -5
  184. package/src/components/repeater/index.ts +2 -0
  185. package/src/components/repeater/repeater.component.tsx +124 -0
  186. package/src/components/repeater/repeater.stories.tsx +49 -0
  187. package/src/components/repeater/repeater.styles.ts +32 -0
  188. package/src/components/repeater/repeater.types.ts +20 -0
  189. package/src/components/repeater/repeater.utils.tsx +3 -0
  190. package/src/components/select/select.component.tsx +3 -1
  191. package/src/components/select/select.styles.ts +6 -1
  192. package/src/components/selector/components/index.ts +2 -0
  193. package/src/components/selector/components/selector-checkbox-group/components/index.ts +1 -0
  194. package/src/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/index.ts +2 -0
  195. package/src/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/selector-checkbox-group-option.component.tsx +96 -0
  196. package/src/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/selector-checkbox-group-option.styles.ts +53 -0
  197. package/src/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/selector-checkbox-group-option.types.ts +15 -0
  198. package/src/components/selector/components/selector-checkbox-group/index.ts +2 -0
  199. package/src/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.tsx +46 -0
  200. package/src/components/selector/components/selector-checkbox-group/selector-checkbox-group.styles.ts +9 -0
  201. package/src/components/selector/components/selector-checkbox-group/selector-checkbox-group.types.ts +25 -0
  202. package/src/components/selector/components/selector-radio-group/components/index.ts +1 -0
  203. package/src/components/selector/components/selector-radio-group/components/selector-radio-group-option/index.ts +2 -0
  204. package/src/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.component.tsx +90 -0
  205. package/src/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.styles.ts +53 -0
  206. package/src/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.types.ts +21 -0
  207. package/src/components/selector/components/selector-radio-group/index.ts +2 -0
  208. package/src/components/selector/components/selector-radio-group/selector-radio-group.component.tsx +48 -0
  209. package/src/components/selector/components/selector-radio-group/selector-radio-group.styles.ts +14 -0
  210. package/src/components/selector/components/selector-radio-group/selector-radio-group.types.ts +22 -0
  211. package/src/components/selector/index.ts +2 -0
  212. package/src/components/selector/selector.component.tsx +34 -0
  213. package/src/components/selector/selector.stories.tsx +621 -0
  214. package/src/components/selector/selector.types.ts +24 -0
  215. package/src/components/switch/switch.component.tsx +19 -7
  216. package/src/components/switch/switch.stories.tsx +1 -1
  217. package/src/components/switch/switch.styles.ts +2 -2
  218. package/src/components/switch/switch.types.ts +5 -1
  219. package/src/components/tabs/components/tab/tab.component.tsx +4 -3
  220. package/src/components/tabs/components/tab/tab.styles.ts +12 -8
  221. package/src/components/tabs/components/tab-panel/tab-panel.component.tsx +3 -2
  222. package/src/components/tabs/components/tab-panel/tab-panel.styles.ts +5 -2
  223. package/src/components/textarea/textarea.component.tsx +9 -1
  224. package/src/components/textarea/textarea.styles.ts +4 -1
  225. package/src/utils/generateId.ts +6 -0
  226. package/src/utils/index.ts +1 -0
@@ -0,0 +1,49 @@
1
+ function _extends() {
2
+ _extends = Object.assign || function(target) {
3
+ for(var i = 1; i < arguments.length; i++){
4
+ var source = arguments[i];
5
+ for(var key in source){
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
15
+ import React, { createContext } from 'react';
16
+ import { useCheckboxGroup } from 'react-aria';
17
+ import { useCheckboxGroupState } from 'react-stately';
18
+ import { SelectorCheckboxGroupOption } from './components/index.js';
19
+ import { styles } from './selector-checkbox-group.styles.js';
20
+ export const SelectorCheckboxGroupContext = createContext({
21
+ value: [],
22
+ isDisabled: false,
23
+ isReadOnly: false,
24
+ isSelected: ()=>false,
25
+ setValue: ()=>null,
26
+ addValue: ()=>null,
27
+ removeValue: ()=>null,
28
+ toggleValue: ()=>null,
29
+ validationState: 'valid'
30
+ });
31
+ export function SelectorCheckboxGroup(props) {
32
+ const { children , label , description , errorMessage } = props;
33
+ const state = useCheckboxGroupState(props);
34
+ const { groupProps , labelProps , descriptionProps , errorMessageProps } = useCheckboxGroup(props, state);
35
+ return React.createElement("div", _extends({}, groupProps, {
36
+ className: styles({
37
+ className: groupProps.className
38
+ })
39
+ }), React.createElement("span", _extends({}, labelProps), label), React.createElement(SelectorCheckboxGroupContext.Provider, {
40
+ value: state
41
+ }, children), description && React.createElement("div", _extends({}, descriptionProps, {
42
+ style: {
43
+ fontSize: 12
44
+ }
45
+ }), description), errorMessage && state.validationState === 'invalid' && React.createElement("div", _extends({}, errorMessageProps, {
46
+ className: "typography-body-10 text-danger"
47
+ }), errorMessage));
48
+ }
49
+ SelectorCheckboxGroup.Option = SelectorCheckboxGroupOption;
@@ -0,0 +1,3 @@
1
+ export declare const styles: import("tailwind-variants").TVReturnType<{}, undefined, "flex flex-col gap-2 md:gap-3", {
2
+ responsiveVariants: string[];
3
+ }, {}, undefined>;
@@ -0,0 +1,13 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const styles = tv({
3
+ base: 'flex flex-col gap-2 md:gap-3',
4
+ variants: {}
5
+ }, {
6
+ responsiveVariants: [
7
+ 'xsl',
8
+ 'sm',
9
+ 'md',
10
+ 'lg',
11
+ 'xl'
12
+ ]
13
+ });
@@ -0,0 +1,20 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { AriaCheckboxGroupProps } from 'react-aria';
3
+ import { CheckboxGroupState } from 'react-stately';
4
+ import { type VariantProps } from 'tailwind-variants';
5
+ import { styles } from './selector-checkbox-group.styles.js';
6
+ export type SelectorCheckboxGroupContextState = CheckboxGroupState;
7
+ export type SelectorCheckboxGroupProps = {
8
+ /**
9
+ * String to override base style
10
+ */
11
+ className?: string;
12
+ /**
13
+ * Orientation of checkbox items
14
+ */
15
+ orientation?: 'horizontal' | 'vertical';
16
+ /**
17
+ * Controls size of `CheckboxItem` components, can't be applied directly to `CheckboxItem`
18
+ */
19
+ size?: 'medium' | 'large';
20
+ } & AriaCheckboxGroupProps & VariantProps<typeof styles> & Omit<HTMLAttributes<Element>, 'onChange'>;
@@ -0,0 +1 @@
1
+ export * from './selector-radio-group-option/index.js';
@@ -0,0 +1 @@
1
+ export * from './selector-radio-group-option/index.js';
@@ -0,0 +1,2 @@
1
+ export { SelectorRadioGroupOption } from './selector-radio-group-option.component.js';
2
+ export { type SelectorRadioGroupOptionProps } from './selector-radio-group-option.types.js';
@@ -0,0 +1 @@
1
+ export { SelectorRadioGroupOption } from './selector-radio-group-option.component.js';
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { FlexiCell } from '../../../../../index.js';
3
+ import { type SelectorRadioGroupOptionProps } from './selector-radio-group-option.types.js';
4
+ export declare const SelectorRadioGroupOption: React.ForwardRefExoticComponent<SelectorRadioGroupOptionProps & React.RefAttributes<unknown>> & {
5
+ Adornment: typeof FlexiCell.Adornment;
6
+ Body: typeof FlexiCell.Body;
7
+ Button: typeof FlexiCell.Button;
8
+ Circle: typeof FlexiCell.Circle;
9
+ Footer: typeof FlexiCell.Footer;
10
+ Hint: typeof FlexiCell.Hint;
11
+ Label: typeof FlexiCell.Label;
12
+ };
@@ -0,0 +1,67 @@
1
+ function _extends() {
2
+ _extends = Object.assign || function(target) {
3
+ for(var i = 1; i < arguments.length; i++){
4
+ var source = arguments[i];
5
+ for(var key in source){
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
15
+ import React, { forwardRef, useContext, useRef } from 'react';
16
+ import { VisuallyHidden, mergeProps, useFocusRing, useRadio } from 'react-aria';
17
+ import { FlexiCellAdornment, FlexiCellBody, FlexiCellButton, FlexiCellCircle, FlexiCellFooter, FlexiCellHint, FlexiCellLabel } from '../../../../../../components/flexi-cell/index.js';
18
+ import { ArrowRightIcon, TickIcon } from '../../../../../../components/icon/index.js';
19
+ import { FlexiCell } from '../../../../../index.js';
20
+ import { SelectorRadioGroupContext } from '../../selector-radio-group.component.js';
21
+ import { styles as selectorRadioGroupOptionStyles } from './selector-radio-group-option.styles.js';
22
+ function BaseSelectorRadioGroupOption({ className , children , value , withBorder =true , withArrow , after , badge , badgeZIndex , before , body =true , checkIcon ='checkbox' , ...props }, ref) {
23
+ const state = useContext(SelectorRadioGroupContext);
24
+ const localRef = useRef(null);
25
+ const { inputProps , isSelected , isDisabled } = useRadio({
26
+ ...props,
27
+ value,
28
+ children
29
+ }, state, localRef);
30
+ const { isFocused , focusProps } = useFocusRing();
31
+ const styles = selectorRadioGroupOptionStyles({
32
+ className,
33
+ isSelected,
34
+ isFocused,
35
+ isDisabled,
36
+ checkIcon
37
+ });
38
+ const FinalIcon = checkIcon === 'checkbox' ? TickIcon : ArrowRightIcon;
39
+ return React.createElement(FlexiCell, {
40
+ after: React.createElement("div", {
41
+ className: "flex gap-2"
42
+ }, after, React.createElement(FinalIcon, {
43
+ "aria-hidden": "true",
44
+ className: styles.icon({})
45
+ })),
46
+ badge: badge,
47
+ badgeZIndex: badgeZIndex,
48
+ before: before,
49
+ body: body,
50
+ withBorder: withBorder,
51
+ withArrow: withArrow,
52
+ tag: "label",
53
+ ref: ref,
54
+ className: styles.base({}),
55
+ withHoverEffect: true
56
+ }, React.createElement(VisuallyHidden, null, React.createElement("input", _extends({}, mergeProps(inputProps, focusProps), {
57
+ ref: localRef
58
+ }))), children);
59
+ }
60
+ export const SelectorRadioGroupOption = forwardRef(BaseSelectorRadioGroupOption);
61
+ SelectorRadioGroupOption.Body = FlexiCellBody;
62
+ SelectorRadioGroupOption.Footer = FlexiCellFooter;
63
+ SelectorRadioGroupOption.Adornment = FlexiCellAdornment;
64
+ SelectorRadioGroupOption.Hint = FlexiCellHint;
65
+ SelectorRadioGroupOption.Label = FlexiCellLabel;
66
+ SelectorRadioGroupOption.Button = FlexiCellButton;
67
+ SelectorRadioGroupOption.Circle = FlexiCellCircle;
@@ -0,0 +1,59 @@
1
+ export declare const styles: import("tailwind-variants").TVReturnType<{
2
+ checkIcon: {
3
+ arrow: {
4
+ icon: string;
5
+ };
6
+ checkbox: {};
7
+ };
8
+ isSelected: {
9
+ true: {
10
+ base: string;
11
+ };
12
+ false: {};
13
+ };
14
+ isFocused: {
15
+ true: {
16
+ base: string;
17
+ };
18
+ false: {};
19
+ };
20
+ isDisabled: {
21
+ true: {
22
+ base: string;
23
+ };
24
+ false: {};
25
+ };
26
+ }, {
27
+ base: string;
28
+ icon: string;
29
+ }, undefined, {
30
+ responsiveVariants: string[];
31
+ }, {
32
+ checkIcon: {
33
+ arrow: {
34
+ icon: string;
35
+ };
36
+ checkbox: {};
37
+ };
38
+ isSelected: {
39
+ true: {
40
+ base: string;
41
+ };
42
+ false: {};
43
+ };
44
+ isFocused: {
45
+ true: {
46
+ base: string;
47
+ };
48
+ false: {};
49
+ };
50
+ isDisabled: {
51
+ true: {
52
+ base: string;
53
+ };
54
+ false: {};
55
+ };
56
+ }, {
57
+ base: string;
58
+ icon: string;
59
+ }>;
@@ -0,0 +1,57 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const styles = tv({
3
+ slots: {
4
+ base: 'group/radio-option cursor-pointer',
5
+ icon: 'transition-transform'
6
+ },
7
+ variants: {
8
+ checkIcon: {
9
+ arrow: {
10
+ icon: 'text-primary group-hover/radio-option:translate-x-1'
11
+ },
12
+ checkbox: {}
13
+ },
14
+ isSelected: {
15
+ true: {
16
+ base: 'border-hero shadow-hero shadow-[0_0_0_2px_inset]'
17
+ },
18
+ false: {}
19
+ },
20
+ isFocused: {
21
+ true: {
22
+ base: 'focus-outline'
23
+ },
24
+ false: {}
25
+ },
26
+ isDisabled: {
27
+ true: {
28
+ base: 'opacity-50'
29
+ },
30
+ false: {}
31
+ }
32
+ },
33
+ compoundVariants: [
34
+ {
35
+ checkIcon: 'checkbox',
36
+ isSelected: false,
37
+ className: {
38
+ icon: 'opacity-0'
39
+ }
40
+ },
41
+ {
42
+ checkIcon: 'checkbox',
43
+ isSelected: true,
44
+ className: {
45
+ icon: 'opacity-100'
46
+ }
47
+ }
48
+ ]
49
+ }, {
50
+ responsiveVariants: [
51
+ 'xsl',
52
+ 'sm',
53
+ 'md',
54
+ 'lg',
55
+ 'xl'
56
+ ]
57
+ });
@@ -0,0 +1,15 @@
1
+ import { type HTMLAttributes } from 'react';
2
+ import { type AriaRadioProps } from 'react-aria';
3
+ import { type VariantProps } from 'tailwind-variants';
4
+ import { type FlexiCellProps } from '../../../../../../index.js';
5
+ import { styles } from './selector-radio-group-option.styles.js';
6
+ export type SelectorRadioGroupOptionProps = {
7
+ /**
8
+ * Check icon to render
9
+ */
10
+ checkIcon?: 'checkbox' | 'arrow';
11
+ /**
12
+ * Tag to render
13
+ */
14
+ tag?: keyof JSX.IntrinsicElements;
15
+ } & FlexiCellProps & AriaRadioProps & VariantProps<typeof styles> & HTMLAttributes<Element>;
@@ -0,0 +1,2 @@
1
+ export { SelectorRadioGroup } from './selector-radio-group.component.js';
2
+ export { type SelectorRadioGroupProps } from './selector-radio-group.types.js';
@@ -0,0 +1 @@
1
+ export { SelectorRadioGroup } from './selector-radio-group.component.js';
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { type SelectorRadioGroupContextState, type SelectorRadioGroupProps } from './selector-radio-group.types.js';
3
+ export declare const SelectorRadioGroupContext: React.Context<SelectorRadioGroupContextState>;
4
+ export declare function SelectorRadioGroup({ className, children, label, orientation, errorMessage, ...props }: SelectorRadioGroupProps): JSX.Element;
5
+ export declare namespace SelectorRadioGroup {
6
+ var Option: React.ForwardRefExoticComponent<import("./components/index.js").SelectorRadioGroupOptionProps & React.RefAttributes<unknown>> & {
7
+ Adornment: ({ children, tag: Tag, align, className, ...props }: import("../../../flexi-cell/index.js").FlexiCellAdornmentProps) => JSX.Element;
8
+ Body: ({ children, tag: Tag, className, ...props }: import("../../../flexi-cell/index.js").FlexiCellBodyProps) => JSX.Element;
9
+ Button: ({ className, ...props }: import("../../../index.js").ButtonProps) => JSX.Element;
10
+ Circle: ({ className, ...props }: import("../../../index.js").CircleProps) => JSX.Element;
11
+ Footer: ({ children, className, tag: Tag, ...props }: import("../../../flexi-cell/index.js").FlexiCellFooterProps) => JSX.Element;
12
+ Hint: ({ children, tag: Tag, className, truncateText, ...props }: import("../../../flexi-cell/index.js").FlexiCellHintProps) => JSX.Element;
13
+ Label: ({ children, tag: Tag, truncateText, className, ...props }: import("../../../flexi-cell/index.js").FlexiCellLabelProps) => JSX.Element;
14
+ };
15
+ }
@@ -0,0 +1,58 @@
1
+ function _extends() {
2
+ _extends = Object.assign || function(target) {
3
+ for(var i = 1; i < arguments.length; i++){
4
+ var source = arguments[i];
5
+ for(var key in source){
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
15
+ import React, { createContext } from 'react';
16
+ import { useRadioGroup } from 'react-aria';
17
+ import { useRadioGroupState } from 'react-stately';
18
+ import { SelectorRadioGroupOption } from './components/index.js';
19
+ import { styles } from './selector-radio-group.styles.js';
20
+ export const SelectorRadioGroupContext = createContext({
21
+ name: '',
22
+ isDisabled: false,
23
+ isReadOnly: false,
24
+ isRequired: false,
25
+ validationState: null,
26
+ selectedValue: null,
27
+ setSelectedValue: ()=>null,
28
+ lastFocusedValue: null,
29
+ setLastFocusedValue: ()=>null,
30
+ orientation: 'vertical'
31
+ });
32
+ export function SelectorRadioGroup({ className , children , label , orientation ='vertical' , errorMessage , ...props }) {
33
+ const state = useRadioGroupState({
34
+ ...props,
35
+ errorMessage,
36
+ label,
37
+ orientation
38
+ });
39
+ const { radioGroupProps , labelProps , errorMessageProps } = useRadioGroup({
40
+ ...props,
41
+ label,
42
+ orientation
43
+ }, state);
44
+ return React.createElement("div", _extends({
45
+ className: styles({
46
+ className,
47
+ orientation
48
+ })
49
+ }, radioGroupProps), React.createElement("span", _extends({}, labelProps), label), React.createElement(SelectorRadioGroupContext.Provider, {
50
+ value: {
51
+ ...state,
52
+ orientation
53
+ }
54
+ }, children), errorMessage && state.validationState === 'invalid' && React.createElement("div", _extends({}, errorMessageProps, {
55
+ className: "typography-body-10 text-danger"
56
+ }), errorMessage));
57
+ }
58
+ SelectorRadioGroup.Option = SelectorRadioGroupOption;
@@ -0,0 +1,13 @@
1
+ export declare const styles: import("tailwind-variants").TVReturnType<{
2
+ orientation: {
3
+ vertical: string;
4
+ horizontal: string;
5
+ };
6
+ }, undefined, "flex gap-2 md:gap-3", {
7
+ responsiveVariants: string[];
8
+ }, {
9
+ orientation: {
10
+ vertical: string;
11
+ horizontal: string;
12
+ };
13
+ }, undefined>;
@@ -0,0 +1,18 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const styles = tv({
3
+ base: 'flex gap-2 md:gap-3',
4
+ variants: {
5
+ orientation: {
6
+ vertical: 'flex-col',
7
+ horizontal: 'flex-row'
8
+ }
9
+ }
10
+ }, {
11
+ responsiveVariants: [
12
+ 'xsl',
13
+ 'sm',
14
+ 'md',
15
+ 'lg',
16
+ 'xl'
17
+ ]
18
+ });
@@ -0,0 +1,17 @@
1
+ import { type HTMLAttributes } from 'react';
2
+ import { type AriaRadioGroupProps } from 'react-aria';
3
+ import { type RadioGroupState } from 'react-stately';
4
+ import { type VariantProps } from 'tailwind-variants';
5
+ import { styles } from './selector-radio-group.styles.js';
6
+ export type SelectorRadioGroupProps = {
7
+ /**
8
+ * Tag to render
9
+ */
10
+ tag?: keyof JSX.IntrinsicElements;
11
+ } & VariantProps<typeof styles> & AriaRadioGroupProps & Omit<HTMLAttributes<Element>, 'onChange'>;
12
+ export type SelectorRadioGroupContextState = {
13
+ /**
14
+ * Controls orientation of `Radio` components, can't be applied directly on `Radio`
15
+ */
16
+ orientation: 'vertical' | 'horizontal';
17
+ } & RadioGroupState;
@@ -0,0 +1,2 @@
1
+ export { Selector } from './selector.component.js';
2
+ export { type SelectorProps } from './selector.types.js';
@@ -0,0 +1 @@
1
+ export { Selector } from './selector.component.js';
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { type SelectorProps } from './selector.types.js';
3
+ export declare function Selector(props: SelectorProps): JSX.Element;
4
+ export declare namespace Selector {
5
+ var Radio: React.ForwardRefExoticComponent<import("./components/selector-radio-group/components/index.js").SelectorRadioGroupOptionProps & React.RefAttributes<unknown>> & {
6
+ Adornment: ({ children, tag: Tag, align, className, ...props }: import("../flexi-cell/components/index.js").FlexiCellAdornmentProps) => JSX.Element;
7
+ Body: ({ children, tag: Tag, className, ...props }: import("../flexi-cell/components/index.js").FlexiCellBodyProps) => JSX.Element;
8
+ Button: ({ className, ...props }: import("../index.js").ButtonProps) => JSX.Element;
9
+ Circle: ({ className, ...props }: import("../index.js").CircleProps) => JSX.Element;
10
+ Footer: ({ children, className, tag: Tag, ...props }: import("../flexi-cell/components/index.js").FlexiCellFooterProps) => JSX.Element;
11
+ Hint: ({ children, tag: Tag, className, truncateText, ...props }: import("../flexi-cell/components/index.js").FlexiCellHintProps) => JSX.Element;
12
+ Label: ({ children, tag: Tag, truncateText, className, ...props }: import("../flexi-cell/components/index.js").FlexiCellLabelProps) => JSX.Element;
13
+ };
14
+ var Checkbox: React.ForwardRefExoticComponent<import("./components/selector-checkbox-group/components/index.js").SelectorCheckboxGroupOptionProps & React.RefAttributes<unknown>> & {
15
+ Adornment: ({ children, tag: Tag, align, className, ...props }: import("../flexi-cell/components/index.js").FlexiCellAdornmentProps) => JSX.Element;
16
+ Body: ({ children, tag: Tag, className, ...props }: import("../flexi-cell/components/index.js").FlexiCellBodyProps) => JSX.Element;
17
+ Button: ({ className, ...props }: import("../index.js").ButtonProps) => JSX.Element;
18
+ Circle: ({ className, ...props }: import("../index.js").CircleProps) => JSX.Element;
19
+ Footer: ({ children, className, tag: Tag, ...props }: import("../flexi-cell/components/index.js").FlexiCellFooterProps) => JSX.Element;
20
+ Hint: ({ children, tag: Tag, className, truncateText, ...props }: import("../flexi-cell/components/index.js").FlexiCellHintProps) => JSX.Element;
21
+ Label: ({ children, tag: Tag, truncateText, className, ...props }: import("../flexi-cell/components/index.js").FlexiCellLabelProps) => JSX.Element;
22
+ };
23
+ var Body: ({ children, tag: Tag, className, ...props }: import("../flexi-cell/components/index.js").FlexiCellBodyProps) => JSX.Element;
24
+ var Footer: ({ children, className, tag: Tag, ...props }: import("../flexi-cell/components/index.js").FlexiCellFooterProps) => JSX.Element;
25
+ var Adornment: ({ children, tag: Tag, align, className, ...props }: import("../flexi-cell/components/index.js").FlexiCellAdornmentProps) => JSX.Element;
26
+ var Hint: ({ children, tag: Tag, className, truncateText, ...props }: import("../flexi-cell/components/index.js").FlexiCellHintProps) => JSX.Element;
27
+ var Label: ({ children, tag: Tag, truncateText, className, ...props }: import("../flexi-cell/components/index.js").FlexiCellLabelProps) => JSX.Element;
28
+ var Button: ({ className, ...props }: import("../index.js").ButtonProps) => JSX.Element;
29
+ var Circle: ({ className, ...props }: import("../index.js").CircleProps) => JSX.Element;
30
+ }
@@ -0,0 +1,34 @@
1
+ function _extends() {
2
+ _extends = Object.assign || function(target) {
3
+ for(var i = 1; i < arguments.length; i++){
4
+ var source = arguments[i];
5
+ for(var key in source){
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
15
+ import React from 'react';
16
+ import { FlexiCellAdornment, FlexiCellBody, FlexiCellButton, FlexiCellCircle, FlexiCellFooter, FlexiCellHint, FlexiCellLabel } from '../flexi-cell/components/index.js';
17
+ import { SelectorCheckboxGroup, SelectorRadioGroup } from './components/index.js';
18
+ import { SelectorCheckboxGroupOption } from './components/selector-checkbox-group/components/index.js';
19
+ import { SelectorRadioGroupOption } from './components/selector-radio-group/components/index.js';
20
+ export function Selector(props) {
21
+ if (props.type === 'checkbox') {
22
+ return React.createElement(SelectorCheckboxGroup, _extends({}, props));
23
+ }
24
+ return React.createElement(SelectorRadioGroup, _extends({}, props));
25
+ }
26
+ Selector.Radio = SelectorRadioGroupOption;
27
+ Selector.Checkbox = SelectorCheckboxGroupOption;
28
+ Selector.Body = FlexiCellBody;
29
+ Selector.Footer = FlexiCellFooter;
30
+ Selector.Adornment = FlexiCellAdornment;
31
+ Selector.Hint = FlexiCellHint;
32
+ Selector.Label = FlexiCellLabel;
33
+ Selector.Button = FlexiCellButton;
34
+ Selector.Circle = FlexiCellCircle;
@@ -0,0 +1,57 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ import { type Meta } from '@storybook/react';
3
+ import { Selector } from './selector.component.js';
4
+ declare const meta: Meta<typeof Selector>;
5
+ export default meta;
6
+ /**
7
+ * > Default usage example
8
+ */
9
+ export declare const DefaultStory: () => JSX.Element;
10
+ /**
11
+ * > Radio usage example
12
+ */
13
+ export declare const RadioStory: () => JSX.Element;
14
+ /**
15
+ * > Radio usage example
16
+ */
17
+ export declare const CheckWithArrowStory: () => JSX.Element;
18
+ /**
19
+ * > Radio with state usage example
20
+ */
21
+ export declare const RadioWithStateStory: () => JSX.Element;
22
+ /**
23
+ * > Check options with state usage example
24
+ */
25
+ export declare const CheckboxWithStateStory: () => JSX.Element;
26
+ /**
27
+ * > Default usage example
28
+ */
29
+ export declare const LongTextStory: () => JSX.Element;
30
+ /**
31
+ * > With hint text usage example
32
+ */
33
+ export declare const WithHintTextStory: () => JSX.Element;
34
+ /**
35
+ * > With pictogram usage example
36
+ */
37
+ export declare const WithPictogramStory: () => JSX.Element;
38
+ /**
39
+ * > With pictogram with different sizes usage example
40
+ */
41
+ export declare const WithPictogramDifferentSizesStory: () => JSX.Element;
42
+ /**
43
+ * > With icon and different size
44
+ */
45
+ export declare const WithIconsDifferentSizesStory: () => JSX.Element;
46
+ /**
47
+ * > With icon and secondary label
48
+ */
49
+ export declare const WithIconsAndSecondaryLabelStory: () => JSX.Element;
50
+ /**
51
+ * > Radio example with icons and secondary text
52
+ */
53
+ export declare const RadioWithIconsAndSecondaryLabelStory: () => JSX.Element;
54
+ /**
55
+ * > Disable state style example
56
+ */
57
+ export declare const DisableStateStory: () => JSX.Element;