@coopdigital/react 0.52.3 → 0.54.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.
- package/README.md +3 -3
- package/dist/components/AlertBanner/AlertBanner.d.ts +3 -1
- package/dist/components/AlertBanner/AlertBanner.js +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.js +4 -3
- package/dist/components/Card/Card.d.ts +15 -5
- package/dist/components/Card/Card.js +8 -7
- package/dist/components/DatePicker/DatePicker.js +3 -3
- package/dist/components/Expandable/Expandable.d.ts +16 -2
- package/dist/components/Expandable/Expandable.js +13 -8
- package/dist/components/Field/Field.d.ts +15 -5
- package/dist/components/Field/Field.js +4 -4
- package/dist/components/Fieldset/Fieldset.d.ts +15 -5
- package/dist/components/Fieldset/Fieldset.js +4 -4
- package/dist/components/Pill/Pill.d.ts +3 -1
- package/dist/components/Pill/Pill.js +2 -2
- package/dist/components/Popover/Popover.d.ts +12 -4
- package/dist/components/Popover/Popover.js +5 -5
- package/dist/components/Searchbox/Searchbox.d.ts +20 -4
- package/dist/components/Searchbox/Searchbox.js +42 -28
- package/dist/components/Select/Select.d.ts +6 -2
- package/dist/components/Select/Select.js +2 -2
- package/dist/components/Signpost/Signpost.js +1 -1
- package/dist/components/Squircle/Squircle.js +1 -1
- package/dist/hooks/useSlots.d.ts +2 -1
- package/dist/hooks/useSlots.js +8 -3
- package/dist/types/colors.d.ts +1 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +4 -1
- package/package.json +20 -17
- package/src/components/AlertBanner/AlertBanner.tsx +1 -1
- package/src/components/Button/Button.tsx +9 -13
- package/src/components/Card/Card.tsx +8 -11
- package/src/components/DatePicker/DatePicker.tsx +2 -2
- package/src/components/Expandable/Expandable.tsx +26 -9
- package/src/components/Field/Field.tsx +4 -9
- package/src/components/Fieldset/Fieldset.tsx +4 -9
- package/src/components/Pill/Pill.tsx +2 -2
- package/src/components/Popover/Popover.tsx +4 -7
- package/src/components/Searchbox/Searchbox.tsx +66 -56
- package/src/components/Select/Select.tsx +2 -3
- package/src/components/Signpost/Signpost.tsx +1 -1
- package/src/components/Squircle/Squircle.tsx +1 -1
- package/src/hooks/useSlots.ts +12 -4
- package/src/types/colors.ts +1 -3
- package/src/types/index.ts +1 -0
- package/src/utils/index.ts +4 -0
- /package/dist/components/{Icon → icons}/AddIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/AddIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ArrowDownIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ArrowDownIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ArrowLeftIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ArrowLeftIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ArrowRightIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ArrowRightIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ArrowUpIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ArrowUpIcon.js +0 -0
- /package/dist/components/{Icon → icons}/AvatarAltIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/AvatarAltIcon.js +0 -0
- /package/dist/components/{Icon → icons}/AvatarIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/AvatarIcon.js +0 -0
- /package/dist/components/{Icon → icons}/BasketIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/BasketIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CalendarIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CalendarIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ChevronDownIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ChevronDownIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ChevronLeftIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ChevronLeftIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ChevronRightIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ChevronRightIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ChevronUpIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ChevronUpIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ClockIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ClockIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CloseAltIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CloseAltIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CloseIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CloseIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CoopCardIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CoopCardIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CoopIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CoopIcon.js +0 -0
- /package/dist/components/{Icon → icons}/CoopLocationIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/CoopLocationIcon.js +0 -0
- /package/dist/components/{Icon → icons}/DownloadIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/DownloadIcon.js +0 -0
- /package/dist/components/{Icon → icons}/HomeIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/HomeIcon.js +0 -0
- /package/dist/components/{Icon → icons}/InformationIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/InformationIcon.js +0 -0
- /package/dist/components/{Icon → icons}/LoadingIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/LoadingIcon.js +0 -0
- /package/dist/components/{Icon → icons}/LocationIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/LocationIcon.js +0 -0
- /package/dist/components/{Icon → icons}/MailIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/MailIcon.js +0 -0
- /package/dist/components/{Icon → icons}/MenuIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/MenuIcon.js +0 -0
- /package/dist/components/{Icon → icons}/MessageIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/MessageIcon.js +0 -0
- /package/dist/components/{Icon → icons}/MinusIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/MinusIcon.js +0 -0
- /package/dist/components/{Icon → icons}/OpenNewIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/OpenNewIcon.js +0 -0
- /package/dist/components/{Icon → icons}/PencilIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/PencilIcon.js +0 -0
- /package/dist/components/{Icon → icons}/PhoneIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/PhoneIcon.js +0 -0
- /package/dist/components/{Icon → icons}/QuestionIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/QuestionIcon.js +0 -0
- /package/dist/components/{Icon → icons}/ScooterIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/ScooterIcon.js +0 -0
- /package/dist/components/{Icon → icons}/SearchIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/SearchIcon.js +0 -0
- /package/dist/components/{Icon → icons}/SettingsIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/SettingsIcon.js +0 -0
- /package/dist/components/{Icon → icons}/TickAltIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/TickAltIcon.js +0 -0
- /package/dist/components/{Icon → icons}/TickIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/TickIcon.js +0 -0
- /package/dist/components/{Icon → icons}/VanIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/VanIcon.js +0 -0
- /package/dist/components/{Icon → icons}/WarningIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/WarningIcon.js +0 -0
- /package/dist/components/{Icon → icons}/WriteIcon.d.ts +0 -0
- /package/dist/components/{Icon → icons}/WriteIcon.js +0 -0
- /package/dist/components/{Icon → icons}/index.d.ts +0 -0
- /package/dist/components/{Icon → icons}/index.js +0 -0
- /package/src/components/{Icon → icons}/AddIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ArrowDownIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ArrowLeftIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ArrowRightIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ArrowUpIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/AvatarAltIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/AvatarIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/BasketIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CalendarIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ChevronDownIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ChevronLeftIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ChevronRightIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ChevronUpIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ClockIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CloseAltIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CloseIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CoopCardIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CoopIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/CoopLocationIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/DownloadIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/HomeIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/InformationIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/LoadingIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/LocationIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/MailIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/MenuIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/MessageIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/MinusIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/OpenNewIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/PencilIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/PhoneIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/QuestionIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/ScooterIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/SearchIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/SettingsIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/TickAltIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/TickIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/VanIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/WarningIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/WriteIcon.tsx +0 -0
- /package/src/components/{Icon → icons}/index.ts +0 -0
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { FormHTMLAttributes, JSX, Ref } from "react"
|
|
4
4
|
|
|
5
5
|
import clsx from "clsx"
|
|
6
6
|
import React, { useCallback, useState } from "react"
|
|
7
7
|
|
|
8
8
|
import { useId } from "../../hooks/useId"
|
|
9
|
+
import { useSlots } from "../../hooks/useSlots"
|
|
9
10
|
import { StandardSizes } from "../../types"
|
|
11
|
+
import { hasUserBorder } from "../../utils"
|
|
10
12
|
import { Button, type ButtonProps } from "../Button"
|
|
11
13
|
import Field from "../Field"
|
|
12
|
-
import {
|
|
13
|
-
import { SearchIcon } from "../Icon"
|
|
14
|
+
import { SearchIcon } from "../icons"
|
|
14
15
|
import TextInput, { TextInputProps } from "../TextInput"
|
|
15
16
|
|
|
16
|
-
export interface SearchboxProps extends
|
|
17
|
-
InputHTMLAttributes<HTMLInputElement>,
|
|
18
|
-
"size" | "type"
|
|
19
|
-
> {
|
|
17
|
+
export interface SearchboxProps extends FormHTMLAttributes<HTMLFormElement> {
|
|
20
18
|
/** **(Optional)** Specify a server endpoint to submit the form. Will be ignored if onSubmit is also set. */
|
|
21
19
|
action?: string
|
|
22
20
|
/** **(Optional)** Specify props to forward to the Button element. Use `label` to set Button text. */
|
|
@@ -40,46 +38,40 @@ export interface SearchboxProps extends Omit<
|
|
|
40
38
|
/** **(Optional)** Specify the Searchbox size. */
|
|
41
39
|
size?: StandardSizes
|
|
42
40
|
/** **(Optional)** Specify the Searchbox variant. */
|
|
43
|
-
variant?:
|
|
44
|
-
| "green"
|
|
45
|
-
| "blue"
|
|
46
|
-
| "white"
|
|
47
|
-
| "grey"
|
|
48
|
-
| "green-ghost"
|
|
49
|
-
| "blue-ghost"
|
|
50
|
-
| "white-ghost"
|
|
51
|
-
| "grey-ghost"
|
|
41
|
+
variant?: "solid" | "ghost"
|
|
52
42
|
}
|
|
53
43
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
const componentSlots = {
|
|
45
|
+
SearchboxButton: null,
|
|
46
|
+
SearchboxInput: null,
|
|
57
47
|
}
|
|
58
48
|
|
|
49
|
+
const defaultButtonText = React.createElement(SearchIcon, {
|
|
50
|
+
alt: "Search",
|
|
51
|
+
stroke: "currentColor",
|
|
52
|
+
strokeWidth: 2,
|
|
53
|
+
})
|
|
54
|
+
|
|
59
55
|
export const Searchbox = ({
|
|
60
56
|
action,
|
|
61
|
-
|
|
62
|
-
autoCapitalize = "off",
|
|
63
|
-
autoComplete = "off",
|
|
64
|
-
button = defaultButtonProps,
|
|
57
|
+
children,
|
|
65
58
|
className,
|
|
66
|
-
|
|
67
59
|
id,
|
|
68
60
|
label,
|
|
69
61
|
labelVisible = false,
|
|
70
|
-
name = "query",
|
|
71
62
|
onSubmit,
|
|
72
|
-
placeholder,
|
|
73
63
|
ref,
|
|
74
64
|
size = "md",
|
|
75
|
-
variant = "
|
|
65
|
+
variant = "solid",
|
|
76
66
|
...props
|
|
77
67
|
}: SearchboxProps): JSX.Element => {
|
|
68
|
+
const slots = useSlots(componentSlots, children)
|
|
69
|
+
|
|
78
70
|
const [isPending, setIsPending] = useState(false)
|
|
79
71
|
const uid = useId(id)
|
|
80
72
|
|
|
81
73
|
const handleSubmit = useCallback(
|
|
82
|
-
async (event: React.
|
|
74
|
+
async (event: React.SubmitEvent<HTMLFormElement>) => {
|
|
83
75
|
event.preventDefault()
|
|
84
76
|
|
|
85
77
|
if (isPending || !onSubmit) return
|
|
@@ -95,51 +87,69 @@ export const Searchbox = ({
|
|
|
95
87
|
[onSubmit, isPending]
|
|
96
88
|
)
|
|
97
89
|
|
|
90
|
+
let borderClass = ""
|
|
91
|
+
if (!hasUserBorder(className)) {
|
|
92
|
+
borderClass = variant === "ghost" ? "border-teal" : "border-grey"
|
|
93
|
+
}
|
|
94
|
+
|
|
98
95
|
const formProps = {
|
|
99
96
|
action: action ?? undefined,
|
|
100
|
-
className: clsx("coop-searchbox", className),
|
|
97
|
+
className: clsx("coop-searchbox", borderClass, className),
|
|
101
98
|
"data-size": size && size !== "md" ? size : undefined,
|
|
102
|
-
"data-variant": variant.length && variant !== "
|
|
103
|
-
id: uid,
|
|
99
|
+
"data-variant": variant.length && variant !== "solid" ? variant : undefined,
|
|
100
|
+
id: uid + "-form",
|
|
104
101
|
onSubmit: onSubmit ? handleSubmit : undefined,
|
|
102
|
+
...props,
|
|
105
103
|
}
|
|
106
104
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
slots.SearchboxButton = React.cloneElement(
|
|
106
|
+
slots.SearchboxButton as React.ReactElement<ButtonProps>,
|
|
107
|
+
{
|
|
108
|
+
isLoading: isPending,
|
|
109
|
+
size,
|
|
110
|
+
}
|
|
111
|
+
)
|
|
114
112
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
type: "search",
|
|
124
|
-
...props,
|
|
125
|
-
}
|
|
113
|
+
slots.SearchboxInput = React.cloneElement(
|
|
114
|
+
slots.SearchboxInput as React.ReactElement<TextInputProps>,
|
|
115
|
+
{
|
|
116
|
+
autoCapitalize: "off",
|
|
117
|
+
id: uid,
|
|
118
|
+
size,
|
|
119
|
+
}
|
|
120
|
+
)
|
|
126
121
|
|
|
127
122
|
const labelProps = {
|
|
128
|
-
htmlFor: uid
|
|
123
|
+
htmlFor: uid,
|
|
129
124
|
isVisible: labelVisible,
|
|
130
125
|
}
|
|
131
126
|
|
|
132
127
|
return (
|
|
133
128
|
<form {...formProps} ref={ref}>
|
|
134
|
-
{label && <
|
|
135
|
-
<div className="coop-searchbox--inner">
|
|
136
|
-
<Field>
|
|
137
|
-
|
|
138
|
-
</Field>
|
|
139
|
-
<Button {...buttonProps}>{button.label}</Button>
|
|
129
|
+
{label && <Field.Label {...labelProps}>{label}</Field.Label>}
|
|
130
|
+
<div className={clsx("coop-searchbox--inner")}>
|
|
131
|
+
<Field>{slots.SearchboxInput}</Field>
|
|
132
|
+
{slots.SearchboxButton}
|
|
140
133
|
</div>
|
|
141
134
|
</form>
|
|
142
135
|
)
|
|
143
136
|
}
|
|
144
137
|
|
|
138
|
+
const SearchboxButton = ({ children, ...props }: ButtonProps) => {
|
|
139
|
+
const buttonProps = {
|
|
140
|
+
children: children ?? defaultButtonText,
|
|
141
|
+
...props,
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return <Button {...buttonProps} />
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const SearchboxInput = (props: TextInputProps) => <TextInput {...props} />
|
|
148
|
+
|
|
149
|
+
Searchbox.Button = SearchboxButton
|
|
150
|
+
Searchbox.Input = SearchboxInput
|
|
151
|
+
|
|
152
|
+
SearchboxButton.config = { name: "SearchboxButton" }
|
|
153
|
+
SearchboxInput.config = { isField: true, name: "SearchboxInput" }
|
|
154
|
+
|
|
145
155
|
export default Searchbox
|
|
@@ -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.
|
|
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 "../
|
|
6
|
+
import { ChevronRightIcon } from "../icons"
|
|
7
7
|
import { Image, ImageProps } from "../Image"
|
|
8
8
|
|
|
9
9
|
export interface SignpostProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -22,7 +22,7 @@ export const Squircle = ({
|
|
|
22
22
|
...props
|
|
23
23
|
}: SquircleProps): JSX.Element => {
|
|
24
24
|
const componentProps = {
|
|
25
|
-
className: clsx("coop-squircle", !hasUserBg(className) && "bg-offer
|
|
25
|
+
className: clsx("coop-squircle", !hasUserBg(className) && "bg-offer", className),
|
|
26
26
|
"data-size": size.length && size !== "lg" ? size : undefined,
|
|
27
27
|
...props,
|
|
28
28
|
}
|
package/src/hooks/useSlots.ts
CHANGED
|
@@ -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:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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>(
|
package/src/types/colors.ts
CHANGED
|
@@ -30,12 +30,10 @@ export type Lights =
|
|
|
30
30
|
| "light-purple"
|
|
31
31
|
| "light-red"
|
|
32
32
|
|
|
33
|
-
export type Greys = "dark-grey" | "mid-dark-grey" | "mid-grey" | "mid-light-grey" | "light-grey"
|
|
34
|
-
|
|
35
33
|
export type White = "white"
|
|
36
34
|
export type Black = "black"
|
|
37
35
|
export type None = "none"
|
|
38
36
|
export type BrandBlue = "brand-blue"
|
|
39
|
-
export type OfferRed = "offer
|
|
37
|
+
export type OfferRed = "offer"
|
|
40
38
|
export type Green = "green"
|
|
41
39
|
export type Blue = "blue"
|
package/src/types/index.ts
CHANGED
package/src/utils/index.ts
CHANGED
|
@@ -5,6 +5,10 @@ export const hasUserBg = (userClasses?: string) => {
|
|
|
5
5
|
return typeof userClasses === "string" && userClasses?.includes("bg-") ? true : false
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
export const hasUserBorder = (userClasses?: string) => {
|
|
9
|
+
return typeof userClasses === "string" && userClasses?.includes("border-") ? true : false
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
export const bgClassToColor = (userClasses: string) => {
|
|
9
13
|
return /bg-([^\s]+)/.exec(userClasses)?.[1] ?? null
|
|
10
14
|
|
|
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
|
|
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
|