@coopdigital/react 0.52.2 → 0.53.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 (161) hide show
  1. package/dist/components/AlertBanner/AlertBanner.d.ts +3 -1
  2. package/dist/components/AlertBanner/AlertBanner.js +1 -1
  3. package/dist/components/Button/Button.js +1 -1
  4. package/dist/components/Card/Card.d.ts +15 -5
  5. package/dist/components/Card/Card.js +6 -6
  6. package/dist/components/DatePicker/DatePicker.js +2 -2
  7. package/dist/components/Expandable/Expandable.d.ts +16 -2
  8. package/dist/components/Expandable/Expandable.js +9 -4
  9. package/dist/components/Field/Field.d.ts +15 -5
  10. package/dist/components/Field/Field.js +4 -4
  11. package/dist/components/Fieldset/Fieldset.d.ts +15 -5
  12. package/dist/components/Fieldset/Fieldset.js +4 -4
  13. package/dist/components/Pill/Pill.d.ts +3 -1
  14. package/dist/components/Pill/Pill.js +1 -1
  15. package/dist/components/Popover/Popover.d.ts +12 -4
  16. package/dist/components/Popover/Popover.js +5 -5
  17. package/dist/components/Searchbox/Searchbox.js +1 -1
  18. package/dist/components/Select/Select.d.ts +6 -2
  19. package/dist/components/Select/Select.js +2 -2
  20. package/dist/components/Signpost/Signpost.js +1 -1
  21. package/dist/hooks/useSlots.d.ts +2 -1
  22. package/dist/hooks/useSlots.js +8 -3
  23. package/dist/types/index.d.ts +1 -0
  24. package/package.json +16 -13
  25. package/src/components/AlertBanner/AlertBanner.tsx +1 -1
  26. package/src/components/Button/Button.tsx +1 -1
  27. package/src/components/Card/Card.tsx +6 -10
  28. package/src/components/DatePicker/DatePicker.tsx +1 -1
  29. package/src/components/Expandable/Expandable.tsx +22 -5
  30. package/src/components/Field/Field.tsx +4 -9
  31. package/src/components/Fieldset/Fieldset.tsx +4 -9
  32. package/src/components/Pill/Pill.tsx +1 -1
  33. package/src/components/Popover/Popover.tsx +4 -7
  34. package/src/components/Searchbox/Searchbox.tsx +1 -1
  35. package/src/components/Select/Select.tsx +2 -3
  36. package/src/components/Signpost/Signpost.tsx +1 -1
  37. package/src/hooks/useSlots.ts +12 -4
  38. package/src/types/index.ts +1 -0
  39. /package/dist/components/{Icon → icons}/AddIcon.d.ts +0 -0
  40. /package/dist/components/{Icon → icons}/AddIcon.js +0 -0
  41. /package/dist/components/{Icon → icons}/ArrowDownIcon.d.ts +0 -0
  42. /package/dist/components/{Icon → icons}/ArrowDownIcon.js +0 -0
  43. /package/dist/components/{Icon → icons}/ArrowLeftIcon.d.ts +0 -0
  44. /package/dist/components/{Icon → icons}/ArrowLeftIcon.js +0 -0
  45. /package/dist/components/{Icon → icons}/ArrowRightIcon.d.ts +0 -0
  46. /package/dist/components/{Icon → icons}/ArrowRightIcon.js +0 -0
  47. /package/dist/components/{Icon → icons}/ArrowUpIcon.d.ts +0 -0
  48. /package/dist/components/{Icon → icons}/ArrowUpIcon.js +0 -0
  49. /package/dist/components/{Icon → icons}/AvatarAltIcon.d.ts +0 -0
  50. /package/dist/components/{Icon → icons}/AvatarAltIcon.js +0 -0
  51. /package/dist/components/{Icon → icons}/AvatarIcon.d.ts +0 -0
  52. /package/dist/components/{Icon → icons}/AvatarIcon.js +0 -0
  53. /package/dist/components/{Icon → icons}/BasketIcon.d.ts +0 -0
  54. /package/dist/components/{Icon → icons}/BasketIcon.js +0 -0
  55. /package/dist/components/{Icon → icons}/CalendarIcon.d.ts +0 -0
  56. /package/dist/components/{Icon → icons}/CalendarIcon.js +0 -0
  57. /package/dist/components/{Icon → icons}/ChevronDownIcon.d.ts +0 -0
  58. /package/dist/components/{Icon → icons}/ChevronDownIcon.js +0 -0
  59. /package/dist/components/{Icon → icons}/ChevronLeftIcon.d.ts +0 -0
  60. /package/dist/components/{Icon → icons}/ChevronLeftIcon.js +0 -0
  61. /package/dist/components/{Icon → icons}/ChevronRightIcon.d.ts +0 -0
  62. /package/dist/components/{Icon → icons}/ChevronRightIcon.js +0 -0
  63. /package/dist/components/{Icon → icons}/ChevronUpIcon.d.ts +0 -0
  64. /package/dist/components/{Icon → icons}/ChevronUpIcon.js +0 -0
  65. /package/dist/components/{Icon → icons}/ClockIcon.d.ts +0 -0
  66. /package/dist/components/{Icon → icons}/ClockIcon.js +0 -0
  67. /package/dist/components/{Icon → icons}/CloseAltIcon.d.ts +0 -0
  68. /package/dist/components/{Icon → icons}/CloseAltIcon.js +0 -0
  69. /package/dist/components/{Icon → icons}/CloseIcon.d.ts +0 -0
  70. /package/dist/components/{Icon → icons}/CloseIcon.js +0 -0
  71. /package/dist/components/{Icon → icons}/CoopCardIcon.d.ts +0 -0
  72. /package/dist/components/{Icon → icons}/CoopCardIcon.js +0 -0
  73. /package/dist/components/{Icon → icons}/CoopIcon.d.ts +0 -0
  74. /package/dist/components/{Icon → icons}/CoopIcon.js +0 -0
  75. /package/dist/components/{Icon → icons}/CoopLocationIcon.d.ts +0 -0
  76. /package/dist/components/{Icon → icons}/CoopLocationIcon.js +0 -0
  77. /package/dist/components/{Icon → icons}/DownloadIcon.d.ts +0 -0
  78. /package/dist/components/{Icon → icons}/DownloadIcon.js +0 -0
  79. /package/dist/components/{Icon → icons}/HomeIcon.d.ts +0 -0
  80. /package/dist/components/{Icon → icons}/HomeIcon.js +0 -0
  81. /package/dist/components/{Icon → icons}/InformationIcon.d.ts +0 -0
  82. /package/dist/components/{Icon → icons}/InformationIcon.js +0 -0
  83. /package/dist/components/{Icon → icons}/LoadingIcon.d.ts +0 -0
  84. /package/dist/components/{Icon → icons}/LoadingIcon.js +0 -0
  85. /package/dist/components/{Icon → icons}/LocationIcon.d.ts +0 -0
  86. /package/dist/components/{Icon → icons}/LocationIcon.js +0 -0
  87. /package/dist/components/{Icon → icons}/MailIcon.d.ts +0 -0
  88. /package/dist/components/{Icon → icons}/MailIcon.js +0 -0
  89. /package/dist/components/{Icon → icons}/MenuIcon.d.ts +0 -0
  90. /package/dist/components/{Icon → icons}/MenuIcon.js +0 -0
  91. /package/dist/components/{Icon → icons}/MessageIcon.d.ts +0 -0
  92. /package/dist/components/{Icon → icons}/MessageIcon.js +0 -0
  93. /package/dist/components/{Icon → icons}/MinusIcon.d.ts +0 -0
  94. /package/dist/components/{Icon → icons}/MinusIcon.js +0 -0
  95. /package/dist/components/{Icon → icons}/OpenNewIcon.d.ts +0 -0
  96. /package/dist/components/{Icon → icons}/OpenNewIcon.js +0 -0
  97. /package/dist/components/{Icon → icons}/PencilIcon.d.ts +0 -0
  98. /package/dist/components/{Icon → icons}/PencilIcon.js +0 -0
  99. /package/dist/components/{Icon → icons}/PhoneIcon.d.ts +0 -0
  100. /package/dist/components/{Icon → icons}/PhoneIcon.js +0 -0
  101. /package/dist/components/{Icon → icons}/QuestionIcon.d.ts +0 -0
  102. /package/dist/components/{Icon → icons}/QuestionIcon.js +0 -0
  103. /package/dist/components/{Icon → icons}/ScooterIcon.d.ts +0 -0
  104. /package/dist/components/{Icon → icons}/ScooterIcon.js +0 -0
  105. /package/dist/components/{Icon → icons}/SearchIcon.d.ts +0 -0
  106. /package/dist/components/{Icon → icons}/SearchIcon.js +0 -0
  107. /package/dist/components/{Icon → icons}/SettingsIcon.d.ts +0 -0
  108. /package/dist/components/{Icon → icons}/SettingsIcon.js +0 -0
  109. /package/dist/components/{Icon → icons}/TickAltIcon.d.ts +0 -0
  110. /package/dist/components/{Icon → icons}/TickAltIcon.js +0 -0
  111. /package/dist/components/{Icon → icons}/TickIcon.d.ts +0 -0
  112. /package/dist/components/{Icon → icons}/TickIcon.js +0 -0
  113. /package/dist/components/{Icon → icons}/VanIcon.d.ts +0 -0
  114. /package/dist/components/{Icon → icons}/VanIcon.js +0 -0
  115. /package/dist/components/{Icon → icons}/WarningIcon.d.ts +0 -0
  116. /package/dist/components/{Icon → icons}/WarningIcon.js +0 -0
  117. /package/dist/components/{Icon → icons}/WriteIcon.d.ts +0 -0
  118. /package/dist/components/{Icon → icons}/WriteIcon.js +0 -0
  119. /package/dist/components/{Icon → icons}/index.d.ts +0 -0
  120. /package/dist/components/{Icon → icons}/index.js +0 -0
  121. /package/src/components/{Icon → icons}/AddIcon.tsx +0 -0
  122. /package/src/components/{Icon → icons}/ArrowDownIcon.tsx +0 -0
  123. /package/src/components/{Icon → icons}/ArrowLeftIcon.tsx +0 -0
  124. /package/src/components/{Icon → icons}/ArrowRightIcon.tsx +0 -0
  125. /package/src/components/{Icon → icons}/ArrowUpIcon.tsx +0 -0
  126. /package/src/components/{Icon → icons}/AvatarAltIcon.tsx +0 -0
  127. /package/src/components/{Icon → icons}/AvatarIcon.tsx +0 -0
  128. /package/src/components/{Icon → icons}/BasketIcon.tsx +0 -0
  129. /package/src/components/{Icon → icons}/CalendarIcon.tsx +0 -0
  130. /package/src/components/{Icon → icons}/ChevronDownIcon.tsx +0 -0
  131. /package/src/components/{Icon → icons}/ChevronLeftIcon.tsx +0 -0
  132. /package/src/components/{Icon → icons}/ChevronRightIcon.tsx +0 -0
  133. /package/src/components/{Icon → icons}/ChevronUpIcon.tsx +0 -0
  134. /package/src/components/{Icon → icons}/ClockIcon.tsx +0 -0
  135. /package/src/components/{Icon → icons}/CloseAltIcon.tsx +0 -0
  136. /package/src/components/{Icon → icons}/CloseIcon.tsx +0 -0
  137. /package/src/components/{Icon → icons}/CoopCardIcon.tsx +0 -0
  138. /package/src/components/{Icon → icons}/CoopIcon.tsx +0 -0
  139. /package/src/components/{Icon → icons}/CoopLocationIcon.tsx +0 -0
  140. /package/src/components/{Icon → icons}/DownloadIcon.tsx +0 -0
  141. /package/src/components/{Icon → icons}/HomeIcon.tsx +0 -0
  142. /package/src/components/{Icon → icons}/InformationIcon.tsx +0 -0
  143. /package/src/components/{Icon → icons}/LoadingIcon.tsx +0 -0
  144. /package/src/components/{Icon → icons}/LocationIcon.tsx +0 -0
  145. /package/src/components/{Icon → icons}/MailIcon.tsx +0 -0
  146. /package/src/components/{Icon → icons}/MenuIcon.tsx +0 -0
  147. /package/src/components/{Icon → icons}/MessageIcon.tsx +0 -0
  148. /package/src/components/{Icon → icons}/MinusIcon.tsx +0 -0
  149. /package/src/components/{Icon → icons}/OpenNewIcon.tsx +0 -0
  150. /package/src/components/{Icon → icons}/PencilIcon.tsx +0 -0
  151. /package/src/components/{Icon → icons}/PhoneIcon.tsx +0 -0
  152. /package/src/components/{Icon → icons}/QuestionIcon.tsx +0 -0
  153. /package/src/components/{Icon → icons}/ScooterIcon.tsx +0 -0
  154. /package/src/components/{Icon → icons}/SearchIcon.tsx +0 -0
  155. /package/src/components/{Icon → icons}/SettingsIcon.tsx +0 -0
  156. /package/src/components/{Icon → icons}/TickAltIcon.tsx +0 -0
  157. /package/src/components/{Icon → icons}/TickIcon.tsx +0 -0
  158. /package/src/components/{Icon → icons}/VanIcon.tsx +0 -0
  159. /package/src/components/{Icon → icons}/WarningIcon.tsx +0 -0
  160. /package/src/components/{Icon → icons}/WriteIcon.tsx +0 -0
  161. /package/src/components/{Icon → icons}/index.ts +0 -0
@@ -24,7 +24,7 @@ import type {
24
24
 
25
25
  import { useId } from "../../hooks/useId"
26
26
  import Button from "../Button"
27
- import { CloseIcon, TickIcon } from "../Icon"
27
+ import { CloseIcon, TickIcon } from "../icons"
28
28
  import Popover from "../Popover"
29
29
  import TextInput from "../TextInput"
30
30
  import {
@@ -4,10 +4,10 @@ import { clsx } from "clsx"
4
4
 
5
5
  import { useSlots } from "../../hooks/useSlots"
6
6
  import { bgClassToColor, hasUserBg } from "../../utils"
7
- import { ChevronDownIcon } from "../Icon"
7
+ import { ChevronDownIcon } from "../icons"
8
8
 
9
9
  export interface ExpandableProps extends DetailsHTMLAttributes<HTMLDetailsElement> {
10
- /** Main content inside the component, only visible when it is open. It can be any valid JSX or string. */
10
+ /** Main content inside the component. This should be an `Expandable.Summary` and `Expandable.Content`. */
11
11
  children: React.ReactNode
12
12
  /** **(Optional)** Specify additional CSS classes to be applied to the component. */
13
13
  className?: string
@@ -22,8 +22,15 @@ interface ExpandableSummaryProps extends HTMLAttributes<HTMLElement> {
22
22
  className?: string
23
23
  }
24
24
 
25
+ interface ExpandableContentProps extends HTMLAttributes<HTMLElement> {
26
+ /** **(Optional)** Content inside the Expandable. */
27
+ children?: React.ReactNode
28
+ /** **(Optional)** Specify additional CSS classes to be applied to the content wrapper. */
29
+ className?: string
30
+ }
31
+
25
32
  const componentSlots = {
26
- Children: null,
33
+ ExpandableContent: null,
27
34
  ExpandableSummary: null,
28
35
  }
29
36
 
@@ -47,7 +54,7 @@ export const Expandable = ({
47
54
  return (
48
55
  <details {...componentProps} ref={ref}>
49
56
  {slots.ExpandableSummary}
50
- <div className="coop-expandable--content">{slots.Children}</div>
57
+ {slots.ExpandableContent}
51
58
  </details>
52
59
  )
53
60
  }
@@ -66,8 +73,18 @@ const ExpandableSummary = ({ children, className, ...props }: ExpandableSummaryP
66
73
  )
67
74
  }
68
75
 
69
- ExpandableSummary.displayName = "Expandable.Summary"
76
+ const ExpandableContent = ({ children, className, ...props }: ExpandableContentProps) => {
77
+ return (
78
+ <div className={clsx("coop-expandable--content", className)} {...props}>
79
+ {children}
80
+ </div>
81
+ )
82
+ }
83
+
84
+ ExpandableSummary.config = { name: "ExpandableSummary" }
85
+ ExpandableContent.config = { name: "ExpandableContent" }
70
86
 
71
87
  Expandable.Summary = ExpandableSummary
88
+ Expandable.Content = ExpandableContent
72
89
 
73
90
  export default Expandable
@@ -132,19 +132,14 @@ export const FieldControl = ({ children, className, ...props }: ControlProps): J
132
132
  )
133
133
  }
134
134
 
135
- FieldControl.displayName = "Field.Control"
136
-
137
135
  const FieldLabel = (props: LabelProps) => <BaseLabel {...props} />
138
-
139
- FieldLabel.displayName = "Field.Label"
140
-
141
136
  const FieldHint = (props: HintProps) => <BaseHint {...props} />
142
-
143
- FieldHint.displayName = "Field.Hint"
144
-
145
137
  const FieldError = (props: ErrorProps) => <BaseError {...props} />
146
138
 
147
- FieldError.displayName = "Field.Error"
139
+ FieldControl.config = { name: "FieldControl" }
140
+ FieldLabel.config = { name: "FieldLabel" }
141
+ FieldHint.config = { name: "FieldHint" }
142
+ FieldError.config = { name: "FieldError" }
148
143
 
149
144
  export const Field = Object.assign(Root, {
150
145
  Control: FieldControl,
@@ -79,19 +79,14 @@ export const FieldsetFields = ({
79
79
  return <div {...componentProps}>{children}</div>
80
80
  }
81
81
 
82
- FieldsetFields.displayName = "Fieldset.Fields"
83
-
84
82
  const FieldsetLegend = (props: LegendProps) => <BaseLegend {...props} />
85
-
86
- FieldsetLegend.displayName = "Fieldset.Legend"
87
-
88
83
  const FieldsetHint = (props: HintProps) => <BaseHint {...props} />
89
-
90
- FieldsetHint.displayName = "Fieldset.Hint"
91
-
92
84
  const FieldsetError = (props: ErrorProps) => <BaseError {...props} />
93
85
 
94
- FieldsetError.displayName = "Fieldset.Error"
86
+ FieldsetFields.config = { name: "FieldsetField" }
87
+ FieldsetLegend.config = { name: "FieldsetLegend" }
88
+ FieldsetHint.config = { name: "FieldsetHint" }
89
+ FieldsetError.config = { name: "FieldsetError" }
95
90
 
96
91
  export const Fieldset = Object.assign(Root, {
97
92
  Error: FieldsetError,
@@ -68,7 +68,7 @@ const PillBadge = ({ children, className }: PillBadgeProps) => {
68
68
  )
69
69
  }
70
70
 
71
- PillBadge.displayName = "Pill.Badge"
71
+ PillBadge.config = { name: "PillBadge" }
72
72
 
73
73
  Pill.Badge = PillBadge
74
74
 
@@ -127,8 +127,6 @@ const PopoverContent = ({
127
127
  )
128
128
  }
129
129
 
130
- PopoverContent.displayName = "Popover.Content"
131
-
132
130
  const PopoverTrigger = ({
133
131
  asChild = false,
134
132
  children,
@@ -152,8 +150,6 @@ const PopoverTrigger = ({
152
150
  return <RadixPopover.Trigger {...componentProps}>{children}</RadixPopover.Trigger>
153
151
  }
154
152
 
155
- PopoverTrigger.displayName = "Popover.Trigger"
156
-
157
153
  const PopoverClose = ({
158
154
  asChild = false,
159
155
  children,
@@ -173,8 +169,6 @@ const PopoverClose = ({
173
169
  )
174
170
  }
175
171
 
176
- PopoverClose.displayName = "Popover.Close"
177
-
178
172
  const PopoverAnchor = ({
179
173
  asChild = false,
180
174
  children,
@@ -188,7 +182,10 @@ const PopoverAnchor = ({
188
182
  return <RadixPopover.Anchor {...componentProps}>{children}</RadixPopover.Anchor>
189
183
  }
190
184
 
191
- PopoverAnchor.displayName = "Popover.Anchor"
185
+ PopoverTrigger.config = { name: "PopoverTrigger" }
186
+ PopoverContent.config = { name: "PopoverContent" }
187
+ PopoverClose.config = { name: "PopoverClose" }
188
+ PopoverAnchor.config = { name: "PopoverAnchor" }
192
189
 
193
190
  Popover.Trigger = PopoverTrigger
194
191
  Popover.Content = PopoverContent
@@ -10,7 +10,7 @@ import { StandardSizes } from "../../types"
10
10
  import { Button, type ButtonProps } from "../Button"
11
11
  import Field from "../Field"
12
12
  import { Label as FieldLabel } from "../FieldMarkers/Label"
13
- import { SearchIcon } from "../Icon"
13
+ import { SearchIcon } from "../icons"
14
14
  import TextInput, { TextInputProps } from "../TextInput"
15
15
 
16
16
  export interface SearchboxProps extends Omit<
@@ -80,8 +80,6 @@ const SelectOptionGroup = ({ children, ...props }: SelectOptionGroupProps): JSX.
80
80
  return <optgroup {...props}>{children}</optgroup>
81
81
  }
82
82
 
83
- SelectOptionGroup.displayName = "Select.OptionGroup"
84
-
85
83
  const SelectOption = ({ children, className, ...props }: SelectOptionProps): JSX.Element => {
86
84
  return (
87
85
  <option className={clsx("coop-select--option", className)} {...props}>
@@ -90,7 +88,8 @@ const SelectOption = ({ children, className, ...props }: SelectOptionProps): JSX
90
88
  )
91
89
  }
92
90
 
93
- SelectOption.displayName = "Select.Option"
91
+ SelectOption.config = { name: "SelectOption" }
92
+ SelectOptionGroup.config = { name: "SelectOptionGroup" }
94
93
 
95
94
  Select.OptionGroup = SelectOptionGroup
96
95
  Select.Option = SelectOption
@@ -3,7 +3,7 @@ import type { ForwardRefExoticComponent, HTMLAttributes, JSX, Ref } from "react"
3
3
  import clsx from "clsx"
4
4
  import React from "react"
5
5
 
6
- import { ChevronRightIcon } from "../Icon"
6
+ import { ChevronRightIcon } from "../icons"
7
7
  import { Image, ImageProps } from "../Image"
8
8
 
9
9
  export interface SignpostProps extends HTMLAttributes<HTMLDivElement> {
@@ -1,4 +1,5 @@
1
1
  import React from "react"
2
+ import { ReactNodeWithConfig } from "src/types"
2
3
 
3
4
  type Slots<T> = Record<keyof T, React.ReactNode>
4
5
 
@@ -6,10 +7,17 @@ export function isKey<T extends object>(x: T, k: PropertyKey): k is keyof T {
6
7
  return k in x
7
8
  }
8
9
 
9
- export function getSlotName(node: React.ReactNode): string | false {
10
- return React.isValidElement(node) && node.type && typeof node.type !== "string"
11
- ? node.type.name
12
- : false
10
+ export function getSlotName(node: ReactNodeWithConfig): string | false {
11
+ if (
12
+ React.isValidElement(node) &&
13
+ node.type &&
14
+ typeof node.type !== "string" &&
15
+ typeof node.type !== "symbol"
16
+ ) {
17
+ return node.type?.config?.name ?? node.type.name
18
+ }
19
+
20
+ return false
13
21
  }
14
22
 
15
23
  export function useSlots<T>(
@@ -15,4 +15,5 @@ export interface ComponentConfig {
15
15
  fieldSuffix?: string
16
16
  isField?: boolean
17
17
  isInline?: boolean
18
+ name?: string
18
19
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes