@obosbbl/grunnmuren-react 1.2.1 → 1.4.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/dist/Accordion/Accordion.d.ts +25 -0
- package/dist/Accordion/index.d.ts +1 -0
- package/dist/Button/Button.d.ts +4 -2
- package/dist/Checkbox/Checkbox.d.ts +1 -1
- package/dist/Chip/Chip.d.ts +10 -0
- package/dist/Chip/index.d.ts +1 -0
- package/dist/Form/FormLabel.d.ts +1 -0
- package/dist/Input/Input.d.ts +4 -1
- package/dist/TextField/TextField.d.ts +4 -1
- package/dist/grunnmuren.es.js +182 -124
- package/dist/hooks/index.d.ts +1 -2
- package/dist/hooks/usePrefersReducedMotion.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/package.json +15 -12
- package/dist/hooks/useComposedRefs.d.ts +0 -25
- package/dist/hooks/useMedia.d.ts +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const Accordion: {
|
|
3
|
+
(): void;
|
|
4
|
+
Item: (props: AccordionItemProps) => JSX.Element;
|
|
5
|
+
Header: <T extends React.ElementType<any> = "h3">(props: AccordionHeaderProps<T> & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "as">) => JSX.Element;
|
|
6
|
+
Content: (props: AccordionContentProps) => JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
export interface AccordionItemProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange'> {
|
|
9
|
+
defaultOpen?: boolean;
|
|
10
|
+
open?: boolean;
|
|
11
|
+
onChange?: (open: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const AccordionItem: (props: AccordionItemProps) => JSX.Element;
|
|
14
|
+
interface AccordionHeaderProps<T extends React.ElementType> {
|
|
15
|
+
/**
|
|
16
|
+
* The heading element that wraps the accordion item's button. Should always be an element with `role="heading"`
|
|
17
|
+
* or a HTML heading tag. Change this to an appropriate heading level for your page.
|
|
18
|
+
* @default h3 */
|
|
19
|
+
as?: T;
|
|
20
|
+
}
|
|
21
|
+
export declare const AccordionHeader: <T extends React.ElementType<any> = "h3">(props: AccordionHeaderProps<T> & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "as">) => JSX.Element;
|
|
22
|
+
interface AccordionContentProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
23
|
+
}
|
|
24
|
+
export declare const AccordionContent: (props: AccordionContentProps) => JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Accordion';
|
package/dist/Button/Button.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export declare type ButtonColor = 'standard' | 'white' | 'light-green';
|
|
3
3
|
export interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {
|
|
4
4
|
children: React.ReactNode;
|
|
@@ -6,9 +6,11 @@ export interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {
|
|
|
6
6
|
color?: 'standard' | 'white' | 'light-green';
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
href?: string;
|
|
9
|
+
/** Renders the button in a loading state */
|
|
10
|
+
loading?: boolean;
|
|
9
11
|
/** @default button */
|
|
10
12
|
type?: 'button' | 'submit' | 'reset';
|
|
11
13
|
/** @default primary */
|
|
12
14
|
variant?: 'primary' | 'secondary';
|
|
13
15
|
}
|
|
14
|
-
export declare const Button:
|
|
16
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
@@ -8,4 +8,4 @@ export interface CheckboxProps extends React.ComponentPropsWithRef<'input'> {
|
|
|
8
8
|
/** Error message for the form control */
|
|
9
9
|
error?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare const Checkbox: import("react").ForwardRefExoticComponent<Pick<CheckboxProps, "className" | "children" | "form" | "slot" | "style" | "title" | "pattern" | "list" | "role" | "error" | "key" | "alt" | "crossOrigin" | "height" | "src" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "
|
|
11
|
+
export declare const Checkbox: import("react").ForwardRefExoticComponent<Pick<CheckboxProps, "className" | "children" | "form" | "slot" | "style" | "title" | "pattern" | "list" | "role" | "color" | "error" | "key" | "alt" | "crossOrigin" | "height" | "src" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "step" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "autoComplete" | "accept" | "capture" | "checked" | "multiple" | "maxLength" | "minLength" | "enterKeyHint" | "max" | "min" | "readOnly" | "required" | "size"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type ChipColor = 'blue-light' | 'green-light' | 'red-light' | 'orange-light';
|
|
3
|
+
export interface ChipProps {
|
|
4
|
+
icon?: React.ReactNode;
|
|
5
|
+
color?: ChipColor;
|
|
6
|
+
className?: string;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
variant?: 'outline' | 'filled';
|
|
9
|
+
}
|
|
10
|
+
export declare const Chip: (props: ChipProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Chip';
|
package/dist/Form/FormLabel.d.ts
CHANGED
package/dist/Input/Input.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface InputProps extends React.ComponentPropsWithoutRef<'input'> {
|
|
3
3
|
as?: string;
|
|
4
|
-
|
|
4
|
+
/** React node on the left (ex. icon, text, component) */
|
|
5
|
+
leftAddon?: React.ReactNode;
|
|
6
|
+
/** React node on the left (ex. icon, text, component) */
|
|
7
|
+
rightAddon?: React.ReactNode;
|
|
5
8
|
/** Render input as invalid. Sets `aria-invalid` to true */
|
|
6
9
|
isInvalid?: boolean;
|
|
7
10
|
}
|
|
@@ -7,7 +7,10 @@ export interface TextFieldProps extends React.ComponentPropsWithoutRef<'input'>
|
|
|
7
7
|
error?: string;
|
|
8
8
|
/** Label for the form control */
|
|
9
9
|
label: string;
|
|
10
|
-
|
|
10
|
+
/** React node on the left (ex. icon, text, component) */
|
|
11
|
+
leftAddon?: React.ReactNode;
|
|
12
|
+
/** React node on the left (ex. icon, text, component) */
|
|
13
|
+
rightAddon?: React.ReactNode;
|
|
11
14
|
/** Automatically valdiate the form control using the HTML constraint validation API. @default true */
|
|
12
15
|
validate?: boolean;
|
|
13
16
|
}
|
package/dist/grunnmuren.es.js
CHANGED
|
@@ -29,9 +29,14 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import
|
|
32
|
+
import cx from "clsx";
|
|
33
|
+
import composeRefs from "@seznam/compose-react-refs";
|
|
33
34
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
34
|
-
import {
|
|
35
|
+
import { useMedia } from "react-use";
|
|
36
|
+
export { useMedia } from "react-use";
|
|
37
|
+
import { useState, useCallback, useEffect, useId, forwardRef, useContext, Children, isValidElement, cloneElement, createContext, useMemo, useRef } from "react";
|
|
38
|
+
const noop = () => {
|
|
39
|
+
};
|
|
35
40
|
var __defProp2 = Object.defineProperty;
|
|
36
41
|
var __defProps2 = Object.defineProperties;
|
|
37
42
|
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
|
@@ -90,6 +95,21 @@ const InfoCircle = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spread
|
|
|
90
95
|
d: "M16 0C12.8355 0 9.74207 0.938384 7.11088 2.69649C4.4797 4.45459 2.42894 6.95345 1.21793 9.87707C0.0069325 12.8007 -0.309921 16.0177 0.307443 19.1214C0.924806 22.2251 2.44866 25.0761 4.6863 27.3137C6.92394 29.5513 9.77487 31.0752 12.8786 31.6926C15.9823 32.3099 19.1993 31.9931 22.1229 30.7821C25.0466 29.5711 27.5454 27.5203 29.3035 24.8891C31.0616 22.2579 32 19.1645 32 16C32 11.7565 30.3143 7.68687 27.3137 4.68629C24.3131 1.68571 20.2435 0 16 0ZM18 26H14V15H18V26ZM18 11H14V7H18V11Z"
|
|
91
96
|
})
|
|
92
97
|
}));
|
|
98
|
+
const LoadingSpinner = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadValues2({
|
|
99
|
+
width: "1.25em",
|
|
100
|
+
height: "1.25em",
|
|
101
|
+
fill: "none",
|
|
102
|
+
viewBox: "0 0 33 30",
|
|
103
|
+
role: "img",
|
|
104
|
+
"aria-hidden": props["aria-label"] == null
|
|
105
|
+
}, props), {
|
|
106
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
107
|
+
fill: "currentColor",
|
|
108
|
+
fillRule: "evenodd",
|
|
109
|
+
d: "M16.954 0.0129699C14.1678 -0.0982239 11.3996 0.507048 8.91404 1.77093C6.42847 3.03482 4.30859 4.91508 2.75703 7.23199C1.20546 9.54891 0.274066 12.2251 0.0518554 15.0046C-0.170355 17.7842 0.324049 20.5743 1.48781 23.1083C2.65158 25.6423 4.44581 27.8355 6.69901 29.4782C7.91167 30.3623 9.61144 30.096 10.4955 28.8833C11.3796 27.6706 11.1133 25.9709 9.90064 25.0868C8.3985 23.9916 7.20235 22.5295 6.42651 20.8402C5.65066 19.1509 5.32106 17.2908 5.4692 15.4377C5.61734 13.5847 6.23827 11.8006 7.27265 10.256C8.30703 8.71135 9.72027 7.45784 11.3773 6.61525C13.0344 5.77266 14.8798 5.36915 16.7373 5.44328C18.5948 5.51741 20.4022 6.0667 21.9869 7.03866C23.5715 8.01062 24.8804 9.37276 25.7884 10.9949C26.6964 12.617 27.1731 14.4449 27.1731 16.3039C27.1731 17.8046 28.3897 19.0212 29.8905 19.0212C31.3912 19.0212 32.6078 17.8046 32.6078 16.3039C32.6078 13.5154 31.8926 10.7736 30.5306 8.34039C29.1686 5.9072 27.2053 3.86399 24.8284 2.40605C22.4514 0.948106 19.7403 0.124164 16.954 0.0129699ZM28.5318 27.1732C30.0325 27.1732 31.2491 25.9566 31.2491 24.4558C31.2491 22.9551 30.0325 21.7385 28.5318 21.7385C27.031 21.7385 25.8145 22.9551 25.8145 24.4558C25.8145 25.9566 27.031 27.1732 28.5318 27.1732Z",
|
|
110
|
+
clipRule: "evenodd"
|
|
111
|
+
})
|
|
112
|
+
}));
|
|
93
113
|
const MenuAlt = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadValues2({
|
|
94
114
|
width: "1.25em",
|
|
95
115
|
height: "1.25em",
|
|
@@ -131,7 +151,7 @@ const Alert = (props) => {
|
|
|
131
151
|
"severity"
|
|
132
152
|
]);
|
|
133
153
|
return /* @__PURE__ */ jsx("section", __spreadProps(__spreadValues({
|
|
134
|
-
className:
|
|
154
|
+
className: cx(className, "p-4 md:py-8", {
|
|
135
155
|
"bg-orange-light": severity === "info",
|
|
136
156
|
"bg-red-light": severity === "alert"
|
|
137
157
|
}),
|
|
@@ -158,38 +178,50 @@ const AlertIcon = ({
|
|
|
158
178
|
}) => {
|
|
159
179
|
if (severity === "alert") {
|
|
160
180
|
return /* @__PURE__ */ jsx(Warning, {
|
|
161
|
-
className:
|
|
181
|
+
className: cx(className, "text-red")
|
|
162
182
|
});
|
|
163
183
|
}
|
|
164
184
|
return /* @__PURE__ */ jsx(InfoCircle, {
|
|
165
|
-
className:
|
|
185
|
+
className: cx(className, "text-orange")
|
|
166
186
|
});
|
|
167
187
|
};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
const chipVariations = {
|
|
189
|
+
"blue-light": "bg-blue-light border-blue-light",
|
|
190
|
+
"red-light": "bg-red-light border-red-light",
|
|
191
|
+
"green-light": "bg-green-light border-green-light",
|
|
192
|
+
"orange-light": "bg-orange-light border-orange-light"
|
|
193
|
+
};
|
|
194
|
+
const iconColors = {
|
|
195
|
+
"blue-light": "text-blue-dark",
|
|
196
|
+
"red-light": "text-red",
|
|
197
|
+
"green-light": "text-green",
|
|
198
|
+
"orange-light": "text-black"
|
|
199
|
+
};
|
|
200
|
+
const Chip = (props) => {
|
|
201
|
+
const {
|
|
202
|
+
className,
|
|
203
|
+
color,
|
|
204
|
+
icon,
|
|
205
|
+
children,
|
|
206
|
+
variant = "filled"
|
|
207
|
+
} = props;
|
|
208
|
+
const chipVariation = color && chipVariations[color];
|
|
209
|
+
const iconColor = color && iconColors[color];
|
|
210
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
211
|
+
className: cx("inline-flex items-center overflow-hidden rounded-lg border-2 font-medium", chipVariation, className),
|
|
212
|
+
children: [icon && /* @__PURE__ */ jsx("div", {
|
|
213
|
+
className: cx("px-3 py-2", iconColor),
|
|
214
|
+
children: icon
|
|
215
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
216
|
+
className: cx("flex-1 py-2 px-3", {
|
|
217
|
+
"bg-white": variant === "outline"
|
|
218
|
+
}),
|
|
219
|
+
children
|
|
220
|
+
})]
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
const QUERY = "(prefers-reduced-motion: reduce)";
|
|
224
|
+
const usePrefersReducedMotion = (defaultState = false) => useMedia(QUERY, defaultState);
|
|
193
225
|
function useBlockBackgroundColor(blockBgColor) {
|
|
194
226
|
switch (blockBgColor) {
|
|
195
227
|
case "gray":
|
|
@@ -202,21 +234,6 @@ function useBlockBackgroundColor(blockBgColor) {
|
|
|
202
234
|
return "bg-blue-lightest";
|
|
203
235
|
}
|
|
204
236
|
}
|
|
205
|
-
function useMedia(query) {
|
|
206
|
-
const [matches, setMatches] = useState(false);
|
|
207
|
-
useEffect(() => {
|
|
208
|
-
const mediaQueryList = window.matchMedia(query);
|
|
209
|
-
setMatches(mediaQueryList.matches);
|
|
210
|
-
const listener = (event) => {
|
|
211
|
-
setMatches(event.matches);
|
|
212
|
-
};
|
|
213
|
-
mediaQueryList.addEventListener("change", listener);
|
|
214
|
-
return () => {
|
|
215
|
-
mediaQueryList.removeEventListener("change", listener);
|
|
216
|
-
};
|
|
217
|
-
}, [query]);
|
|
218
|
-
return matches;
|
|
219
|
-
}
|
|
220
237
|
const useScreenMaxWidthMd = () => useMedia("(max-width: 767.9px)");
|
|
221
238
|
function useFormControlValidity(ref, enabled = true) {
|
|
222
239
|
const [validity, setValidity] = useState("indeterminate");
|
|
@@ -278,7 +295,7 @@ const Banner = (props) => {
|
|
|
278
295
|
]);
|
|
279
296
|
const bgColor = useBlockBackgroundColor(bgColorProp);
|
|
280
297
|
return /* @__PURE__ */ jsx("article", __spreadProps(__spreadValues({
|
|
281
|
-
className:
|
|
298
|
+
className: cx(className, bgColor, "py-8 px-4 md:py-14")
|
|
282
299
|
}, rest), {
|
|
283
300
|
children: /* @__PURE__ */ jsxs("div", {
|
|
284
301
|
className: "<md:flex-wrap container flex gap-4 md:flex-row md:gap-12",
|
|
@@ -309,34 +326,74 @@ const buttonVariations = {
|
|
|
309
326
|
};
|
|
310
327
|
const Button = forwardRef((props, ref) => {
|
|
311
328
|
const _a = props, {
|
|
329
|
+
children: childrenFromProp,
|
|
312
330
|
className,
|
|
313
331
|
color: colorFromProp,
|
|
314
332
|
href,
|
|
333
|
+
loading,
|
|
315
334
|
type = "button",
|
|
316
335
|
variant = "primary"
|
|
317
336
|
} = _a, rest = __objRest(_a, [
|
|
337
|
+
"children",
|
|
318
338
|
"className",
|
|
319
339
|
"color",
|
|
320
340
|
"href",
|
|
341
|
+
"loading",
|
|
321
342
|
"type",
|
|
322
343
|
"variant"
|
|
323
344
|
]);
|
|
324
345
|
const colorFromContext = useContext(ButtonColorContext);
|
|
325
346
|
const color = colorFromProp != null ? colorFromProp : colorFromContext;
|
|
326
347
|
const buttonVariation = buttonVariations[`${color}-${variant}`];
|
|
327
|
-
const classes =
|
|
348
|
+
const classes = cx(className, buttonVariation, "button");
|
|
349
|
+
const children = loading ? /* @__PURE__ */ jsx(Loader, {
|
|
350
|
+
children: childrenFromProp
|
|
351
|
+
}) : childrenFromProp;
|
|
328
352
|
return /* @__PURE__ */ jsx(Fragment, {
|
|
329
|
-
children: href ? /* @__PURE__ */ jsx("a", __spreadProps(__spreadValues({
|
|
353
|
+
children: href ? /* @__PURE__ */ jsx("a", __spreadProps(__spreadValues({
|
|
354
|
+
"aria-busy": loading ? true : void 0
|
|
355
|
+
}, rest), {
|
|
330
356
|
href,
|
|
331
357
|
ref,
|
|
332
|
-
className: classes
|
|
333
|
-
|
|
358
|
+
className: classes,
|
|
359
|
+
children
|
|
360
|
+
})) : /* @__PURE__ */ jsx("button", __spreadProps(__spreadValues({
|
|
361
|
+
"aria-busy": loading ? true : void 0
|
|
362
|
+
}, rest), {
|
|
334
363
|
type,
|
|
335
364
|
ref,
|
|
336
|
-
className: classes
|
|
365
|
+
className: classes,
|
|
366
|
+
children
|
|
337
367
|
}))
|
|
338
368
|
});
|
|
339
369
|
});
|
|
370
|
+
const Loader = (props) => {
|
|
371
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
372
|
+
children: [deeplyWrapStrings(props.children), /* @__PURE__ */ jsx("span", {
|
|
373
|
+
className: "!visible absolute top-1 bottom-1 left-1 right-1 grid place-items-center overflow-hidden bg-inherit",
|
|
374
|
+
"aria-hidden": true,
|
|
375
|
+
children: /* @__PURE__ */ jsx(LoadingSpinner, {
|
|
376
|
+
className: "animate-spin"
|
|
377
|
+
})
|
|
378
|
+
})]
|
|
379
|
+
});
|
|
380
|
+
};
|
|
381
|
+
function deeplyWrapStrings(children) {
|
|
382
|
+
return Children.map(children, (child) => {
|
|
383
|
+
if (!isValidElement(child)) {
|
|
384
|
+
return typeof child === "string" ? /* @__PURE__ */ jsx("span", {
|
|
385
|
+
children: child
|
|
386
|
+
}) : child;
|
|
387
|
+
}
|
|
388
|
+
if (child.props.children) {
|
|
389
|
+
const props = {
|
|
390
|
+
children: deeplyWrapStrings(child.props.children)
|
|
391
|
+
};
|
|
392
|
+
child = cloneElement(child, props);
|
|
393
|
+
}
|
|
394
|
+
return child;
|
|
395
|
+
});
|
|
396
|
+
}
|
|
340
397
|
const ButtonColorContext = createContext("standard");
|
|
341
398
|
const CampaignContext = createContext(true);
|
|
342
399
|
const Campaign = (props) => {
|
|
@@ -354,7 +411,7 @@ const Campaign = (props) => {
|
|
|
354
411
|
"rightAlignBody"
|
|
355
412
|
]);
|
|
356
413
|
return /* @__PURE__ */ jsxs(Component, __spreadProps(__spreadValues({
|
|
357
|
-
className:
|
|
414
|
+
className: cx(className, "grid gap-8 md:grid-flow-col md:grid-cols-[50%,50%] md:gap-0")
|
|
358
415
|
}, rest), {
|
|
359
416
|
children: [/* @__PURE__ */ jsx(CampaignContext.Provider, {
|
|
360
417
|
value: rightAlignBody,
|
|
@@ -369,7 +426,7 @@ const CampaignBody = (props) => {
|
|
|
369
426
|
"className"
|
|
370
427
|
]);
|
|
371
428
|
return /* @__PURE__ */ jsx("div", __spreadValues({
|
|
372
|
-
className:
|
|
429
|
+
className: cx(className, "md:mx-18 self-center")
|
|
373
430
|
}, rest));
|
|
374
431
|
};
|
|
375
432
|
const CampaignImage = (props) => {
|
|
@@ -381,7 +438,7 @@ const CampaignImage = (props) => {
|
|
|
381
438
|
"children"
|
|
382
439
|
]);
|
|
383
440
|
const bodyIsRightAligned = useContext(CampaignContext);
|
|
384
|
-
const className =
|
|
441
|
+
const className = cx(classNameProp, "<md:rounded-b-3xl w-full", bodyIsRightAligned ? "md:rounded-r-3xl" : "md:rounded-l-3xl md:order-1");
|
|
385
442
|
if (isValidElement(children)) {
|
|
386
443
|
const child = Children.only(children);
|
|
387
444
|
return cloneElement(child, __spreadValues({
|
|
@@ -405,7 +462,7 @@ const Card = (props) => {
|
|
|
405
462
|
"bgColor"
|
|
406
463
|
]);
|
|
407
464
|
return /* @__PURE__ */ jsx(Component, __spreadValues({
|
|
408
|
-
className:
|
|
465
|
+
className: cx(className, "relative overflow-hidden rounded-3xl", {
|
|
409
466
|
"border-gray-concrete border-2 border-solid bg-white": bgColor === "white",
|
|
410
467
|
"bg-gray-light": bgColor === "gray"
|
|
411
468
|
})
|
|
@@ -418,7 +475,7 @@ const CardImage = (props) => {
|
|
|
418
475
|
"className"
|
|
419
476
|
]);
|
|
420
477
|
return /* @__PURE__ */ jsx("img", __spreadValues({
|
|
421
|
-
className:
|
|
478
|
+
className: cx(className, "w-full object-cover"),
|
|
422
479
|
loading: "lazy"
|
|
423
480
|
}, rest));
|
|
424
481
|
};
|
|
@@ -432,7 +489,7 @@ const CardList = (props) => {
|
|
|
432
489
|
]);
|
|
433
490
|
const bgColor = useBlockBackgroundColor(bgColorProp);
|
|
434
491
|
return /* @__PURE__ */ jsx("div", {
|
|
435
|
-
className:
|
|
492
|
+
className: cx(bgColor, className),
|
|
436
493
|
children: /* @__PURE__ */ jsx("div", __spreadValues({
|
|
437
494
|
className: "container grid grid-cols-1 gap-12 py-16 md:grid-cols-2 md:py-20 lg:py-24"
|
|
438
495
|
}, rest))
|
|
@@ -445,7 +502,7 @@ const CardContent = (props) => {
|
|
|
445
502
|
"className"
|
|
446
503
|
]);
|
|
447
504
|
return /* @__PURE__ */ jsx("div", __spreadValues({
|
|
448
|
-
className:
|
|
505
|
+
className: cx(className, "p-8 md:p-10")
|
|
449
506
|
}, rest));
|
|
450
507
|
};
|
|
451
508
|
const CardLinkOverlay = forwardRef((props, ref) => {
|
|
@@ -455,7 +512,7 @@ const CardLinkOverlay = forwardRef((props, ref) => {
|
|
|
455
512
|
"className"
|
|
456
513
|
]);
|
|
457
514
|
return /* @__PURE__ */ jsx("a", __spreadValues({
|
|
458
|
-
className:
|
|
515
|
+
className: cx(className, "no-underline before:absolute before:top-0 before:left-0 before:block before:h-full before:w-full hover:underline"),
|
|
459
516
|
ref
|
|
460
517
|
}, rest));
|
|
461
518
|
});
|
|
@@ -476,17 +533,17 @@ const Checkbox = forwardRef((props, ref) => {
|
|
|
476
533
|
return /* @__PURE__ */ jsxs("div", {
|
|
477
534
|
className: "grid gap-2",
|
|
478
535
|
children: [/* @__PURE__ */ jsxs("label", {
|
|
479
|
-
className:
|
|
536
|
+
className: cx(className, "inline-flex cursor-pointer items-center"),
|
|
480
537
|
children: [/* @__PURE__ */ jsx("input", __spreadProps(__spreadValues({
|
|
481
538
|
id,
|
|
482
|
-
className:
|
|
539
|
+
className: cx("checkbox checked:bg-green checked:border-green mr-3 grid h-[1.25em] w-[1.25em] flex-none cursor-pointer appearance-none place-content-center rounded border-2 border-solid bg-white text-white focus:outline-none focus:ring-2", {
|
|
483
540
|
"border-gray-dark focus:ring-black": !error,
|
|
484
541
|
"border-red focus:ring-red": !!error
|
|
485
542
|
}),
|
|
486
543
|
ref,
|
|
487
544
|
type: "checkbox"
|
|
488
545
|
}, rest), {
|
|
489
|
-
"aria-describedby":
|
|
546
|
+
"aria-describedby": cx({
|
|
490
547
|
[errorMsgId]: !!error
|
|
491
548
|
}),
|
|
492
549
|
"aria-invalid": !!error
|
|
@@ -508,7 +565,7 @@ const Footer = (props) => {
|
|
|
508
565
|
return /* @__PURE__ */ jsx(ButtonColorContext.Provider, {
|
|
509
566
|
value: "white",
|
|
510
567
|
children: /* @__PURE__ */ jsx("footer", __spreadProps(__spreadValues({
|
|
511
|
-
className:
|
|
568
|
+
className: cx(className, "bg-blue pt-18 relative pb-12 text-white before:absolute before:top-0 before:left-0 before:right-0 before:h-6 before:rounded-b-3xl before:bg-white")
|
|
512
569
|
}, rest), {
|
|
513
570
|
children: /* @__PURE__ */ jsx("div", {
|
|
514
571
|
className: "container",
|
|
@@ -528,7 +585,7 @@ const Form = (props) => {
|
|
|
528
585
|
"className"
|
|
529
586
|
]);
|
|
530
587
|
return /* @__PURE__ */ jsxs("form", __spreadProps(__spreadValues({
|
|
531
|
-
className:
|
|
588
|
+
className: cx(className, "border-blue-dark block overflow-hidden rounded-t-3xl rounded-b-lg border-2")
|
|
532
589
|
}, rest), {
|
|
533
590
|
children: [heading && /* @__PURE__ */ jsx(FormHeading, {
|
|
534
591
|
children: heading
|
|
@@ -545,7 +602,7 @@ const FormHeading = (props) => {
|
|
|
545
602
|
"className"
|
|
546
603
|
]);
|
|
547
604
|
return /* @__PURE__ */ jsx("h2", __spreadValues({
|
|
548
|
-
className:
|
|
605
|
+
className: cx(className, "bg-blue-dark p-6 text-xl font-bold text-white md:px-10 md:py-8 md:text-2xl")
|
|
549
606
|
}, rest));
|
|
550
607
|
};
|
|
551
608
|
const FormError = (props) => {
|
|
@@ -556,7 +613,7 @@ const FormError = (props) => {
|
|
|
556
613
|
]);
|
|
557
614
|
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({
|
|
558
615
|
"aria-live": "polite",
|
|
559
|
-
className:
|
|
616
|
+
className: cx(className, "border-red bg-red-light rounded-lg border-2 p-6 text-sm")
|
|
560
617
|
}, rest), {
|
|
561
618
|
children: "Beklager! Noe gikk dessverre galt under innesendingen av skjemaet. Pr\xF8v gjerne igjen om en stund."
|
|
562
619
|
}));
|
|
@@ -570,7 +627,7 @@ const FormErrorMessage = (props) => {
|
|
|
570
627
|
"className"
|
|
571
628
|
]);
|
|
572
629
|
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({
|
|
573
|
-
className:
|
|
630
|
+
className: cx(className, "bg-red-light text-red flex items-center gap-2 rounded-lg py-1 px-4 text-sm"),
|
|
574
631
|
"aria-live": "polite"
|
|
575
632
|
}, rest), {
|
|
576
633
|
children: [/* @__PURE__ */ jsx(Warning, {
|
|
@@ -587,7 +644,7 @@ const FormHelperText = (props) => {
|
|
|
587
644
|
"children"
|
|
588
645
|
]);
|
|
589
646
|
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({
|
|
590
|
-
className:
|
|
647
|
+
className: cx(className, "text-gray-dark text-sm")
|
|
591
648
|
}, rest), {
|
|
592
649
|
children
|
|
593
650
|
}));
|
|
@@ -596,20 +653,22 @@ const FormLabel = (props) => {
|
|
|
596
653
|
const _a = props, {
|
|
597
654
|
className,
|
|
598
655
|
children,
|
|
599
|
-
isRequired
|
|
656
|
+
isRequired,
|
|
657
|
+
isInvalid
|
|
600
658
|
} = _a, rest = __objRest(_a, [
|
|
601
659
|
"className",
|
|
602
660
|
"children",
|
|
603
|
-
"isRequired"
|
|
661
|
+
"isRequired",
|
|
662
|
+
"isInvalid"
|
|
604
663
|
]);
|
|
605
664
|
return /* @__PURE__ */ jsxs("label", __spreadProps(__spreadValues({
|
|
606
|
-
className:
|
|
665
|
+
className: cx(className, "block cursor-pointer font-semibold")
|
|
607
666
|
}, rest), {
|
|
608
|
-
children: [
|
|
667
|
+
children: [isRequired && /* @__PURE__ */ jsx("span", {
|
|
609
668
|
"aria-hidden": true,
|
|
610
|
-
className: "
|
|
669
|
+
className: cx("mr-px select-none", isInvalid ? "text-red" : "text-blue"),
|
|
611
670
|
children: "*"
|
|
612
|
-
})]
|
|
671
|
+
}), children]
|
|
613
672
|
}));
|
|
614
673
|
};
|
|
615
674
|
const FormSuccess = (props) => {
|
|
@@ -623,7 +682,7 @@ const FormSuccess = (props) => {
|
|
|
623
682
|
"text"
|
|
624
683
|
]);
|
|
625
684
|
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({
|
|
626
|
-
className:
|
|
685
|
+
className: cx(className, "bg-gray-concrete flex flex-col gap-8 p-8 text-center")
|
|
627
686
|
}, rest), {
|
|
628
687
|
children: [/* @__PURE__ */ jsx("img", {
|
|
629
688
|
className: "mx-auto",
|
|
@@ -674,7 +733,7 @@ const Hero = (props) => {
|
|
|
674
733
|
children: /* @__PURE__ */ jsx(HeroContext.Provider, {
|
|
675
734
|
value: context,
|
|
676
735
|
children: /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({
|
|
677
|
-
className:
|
|
736
|
+
className: cx(className, "<md:px-0 container md:grid", {
|
|
678
737
|
"md:grid-cols-[50%,50%]": contentPosition === "vertical-split"
|
|
679
738
|
}),
|
|
680
739
|
style: usesGridAreaPlacement(contentPosition) ? {
|
|
@@ -691,7 +750,7 @@ const HeroImage = (props) => {
|
|
|
691
750
|
contentPosition
|
|
692
751
|
} = useContext(HeroContext);
|
|
693
752
|
return /* @__PURE__ */ jsxs("picture", {
|
|
694
|
-
className:
|
|
753
|
+
className: cx("aspect-w-6 aspect-h-7 block", {
|
|
695
754
|
"sm:aspect-w-8 sm:aspect-h-4": contentPosition !== "vertical-split",
|
|
696
755
|
"sm:aspect-w-8 sm:aspect-h-8": contentPosition === "vertical-split"
|
|
697
756
|
}),
|
|
@@ -702,9 +761,7 @@ const HeroImage = (props) => {
|
|
|
702
761
|
media: "(min-width: 768px)",
|
|
703
762
|
srcSet: props.mdSrc
|
|
704
763
|
}), /* @__PURE__ */ jsx("img", {
|
|
705
|
-
className:
|
|
706
|
-
"md:rounded-l-none": contentPosition === "vertical-split"
|
|
707
|
-
}),
|
|
764
|
+
className: "object-cover",
|
|
708
765
|
decoding: "async",
|
|
709
766
|
src: props.src,
|
|
710
767
|
alt: props.alt
|
|
@@ -730,13 +787,13 @@ const HeroContent = (props) => {
|
|
|
730
787
|
]);
|
|
731
788
|
const usesGridArea = usesGridAreaPlacement(contentPosition);
|
|
732
789
|
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({
|
|
733
|
-
className:
|
|
790
|
+
className: cx(className, "<md:mx-4 relative grid grid-flow-row grid-cols-[minmax(auto,_37rem)] content-center gap-6 rounded-3xl py-10 px-6 text-center md:p-12", {
|
|
734
791
|
"<md:-mt-18": hasImage,
|
|
735
792
|
"text-white": bgColor !== "white",
|
|
736
793
|
"bg-green-dark": bgColor === "green",
|
|
737
794
|
"bg-blue-dark": bgColor === "blue",
|
|
738
795
|
"bg-white": bgColor === "white",
|
|
739
|
-
"md:-order-1 md:mt-0 md:justify-center md:rounded-
|
|
796
|
+
"md:z-10 md:-order-1 md:mt-0 md:-mr-5 md:justify-center md:rounded-l-none md:text-left": contentPosition === "vertical-split",
|
|
740
797
|
"justify-center md:mx-auto md:w-4/5": contentPosition === "below-center",
|
|
741
798
|
"md:-mt-18": hasImage && contentPosition === "below-center",
|
|
742
799
|
"md:ml-[8%] md:-mt-32 md:max-w-[58%] md:text-left": contentPosition === "below-left",
|
|
@@ -769,7 +826,7 @@ const HeroActions = (props) => {
|
|
|
769
826
|
contentPosition
|
|
770
827
|
} = useContext(HeroContext);
|
|
771
828
|
return /* @__PURE__ */ jsx("div", __spreadValues({
|
|
772
|
-
className:
|
|
829
|
+
className: cx(className, "grid items-center justify-center justify-items-center gap-4 md:grid-flow-col", {
|
|
773
830
|
"md:justify-start": contentPosition === "vertical-split" || contentPosition === "below-left"
|
|
774
831
|
})
|
|
775
832
|
}, rest));
|
|
@@ -779,36 +836,37 @@ const Input = forwardRef((props, ref) => {
|
|
|
779
836
|
className,
|
|
780
837
|
isInvalid,
|
|
781
838
|
size,
|
|
782
|
-
prefix,
|
|
783
839
|
as,
|
|
784
|
-
type: typeProp
|
|
840
|
+
type: typeProp,
|
|
841
|
+
rightAddon,
|
|
842
|
+
leftAddon
|
|
785
843
|
} = _a, rest = __objRest(_a, [
|
|
786
844
|
"className",
|
|
787
845
|
"isInvalid",
|
|
788
846
|
"size",
|
|
789
|
-
"prefix",
|
|
790
847
|
"as",
|
|
791
|
-
"type"
|
|
848
|
+
"type",
|
|
849
|
+
"rightAddon",
|
|
850
|
+
"leftAddon"
|
|
792
851
|
]);
|
|
793
852
|
const Component = as != null ? as : "input";
|
|
794
853
|
const type = getType(Component, typeProp);
|
|
795
854
|
return /* @__PURE__ */ jsxs("div", {
|
|
796
|
-
className:
|
|
797
|
-
"border-
|
|
855
|
+
className: cx(className, "relative flex items-center rounded-md border-[1px] border-b-[3px] focus-within:-ml-[2px] focus-within:-mt-[2px] focus-within:border-[3px] focus-within:shadow", {
|
|
856
|
+
"focus-within:border-blue-dark border-black": !isInvalid,
|
|
798
857
|
"border-red focus-within:border-red": isInvalid,
|
|
799
858
|
"w-fit": size != null,
|
|
800
|
-
"w-full": size == null
|
|
859
|
+
"w-full": size == null,
|
|
860
|
+
"pl-4": leftAddon,
|
|
861
|
+
"pr-4": rightAddon
|
|
801
862
|
}),
|
|
802
|
-
children: [
|
|
803
|
-
className: "text-gray pl-4",
|
|
804
|
-
children: prefix
|
|
805
|
-
}), /* @__PURE__ */ jsx(Component, __spreadValues({
|
|
863
|
+
children: [leftAddon, /* @__PURE__ */ jsx(Component, __spreadValues({
|
|
806
864
|
"aria-invalid": isInvalid,
|
|
807
865
|
ref,
|
|
808
|
-
className: "focus:none placeholder-gray w-full rounded-md border-none px-4 py-3 outline-none",
|
|
866
|
+
className: "focus:none placeholder-gray w-full rounded-md border-none px-4 py-3.5 focus:outline-none",
|
|
809
867
|
size,
|
|
810
868
|
type
|
|
811
|
-
}, rest))]
|
|
869
|
+
}, rest)), rightAddon]
|
|
812
870
|
});
|
|
813
871
|
});
|
|
814
872
|
function getType(Component, type) {
|
|
@@ -829,8 +887,7 @@ const Link = (props) => {
|
|
|
829
887
|
});
|
|
830
888
|
};
|
|
831
889
|
const NavbarContext = createContext({
|
|
832
|
-
setIsExpanded:
|
|
833
|
-
},
|
|
890
|
+
setIsExpanded: noop,
|
|
834
891
|
isExpanded: false,
|
|
835
892
|
collapsibleId: ""
|
|
836
893
|
});
|
|
@@ -854,7 +911,7 @@ const Navbar = (props) => {
|
|
|
854
911
|
children: /* @__PURE__ */ jsx(NavbarContext.Provider, {
|
|
855
912
|
value: expandedContext,
|
|
856
913
|
children: /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({
|
|
857
|
-
className:
|
|
914
|
+
className: cx(className, "bg-blue relative pt-6 pb-12 text-white before:absolute before:bottom-0 before:left-0 before:right-0 before:h-6 before:rounded-t-3xl before:bg-white md:pt-8 md:pb-14")
|
|
858
915
|
}, rest), {
|
|
859
916
|
children: /* @__PURE__ */ jsx("div", {
|
|
860
917
|
className: "container",
|
|
@@ -876,7 +933,7 @@ const NavbarItems = (props) => {
|
|
|
876
933
|
isExpanded
|
|
877
934
|
} = useContext(NavbarContext);
|
|
878
935
|
return /* @__PURE__ */ jsx("nav", __spreadProps(__spreadValues({
|
|
879
|
-
className:
|
|
936
|
+
className: cx(className, "my-8 flex flex-col md:mb-0 md:flex md:flex-row md:flex-wrap md:gap-x-8", {
|
|
880
937
|
hidden: !isExpanded
|
|
881
938
|
})
|
|
882
939
|
}, rest), {
|
|
@@ -895,7 +952,7 @@ const NavbarItem = forwardRef((props, ref) => {
|
|
|
895
952
|
]);
|
|
896
953
|
return /* @__PURE__ */ jsx("a", __spreadProps(__spreadValues({
|
|
897
954
|
"aria-current": active ? "page" : void 0,
|
|
898
|
-
className:
|
|
955
|
+
className: cx(className, "border-b border-[#0156E0] py-3 no-underline md:border-b-2 md:border-transparent md:py-2 md:hover:border-white", {
|
|
899
956
|
"fake-font-bold md:bg-blue-dark md:-mx-3 md:rounded-t-lg md:px-3": active
|
|
900
957
|
}),
|
|
901
958
|
ref
|
|
@@ -934,7 +991,7 @@ const NavbarContent = (props) => {
|
|
|
934
991
|
"logo"
|
|
935
992
|
]);
|
|
936
993
|
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({
|
|
937
|
-
className:
|
|
994
|
+
className: cx(className, "flex items-center justify-between gap-8")
|
|
938
995
|
}, rest), {
|
|
939
996
|
children: [logo, /* @__PURE__ */ jsx("div", {
|
|
940
997
|
className: "hidden md:block",
|
|
@@ -956,7 +1013,7 @@ const NavbarCollapsible = (props) => {
|
|
|
956
1013
|
} = useContext(NavbarContext);
|
|
957
1014
|
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({}, rest), {
|
|
958
1015
|
"aria-hidden": !isExpanded,
|
|
959
|
-
className:
|
|
1016
|
+
className: cx(className, "md:-mb-8 md:block", {
|
|
960
1017
|
hidden: !isExpanded
|
|
961
1018
|
}),
|
|
962
1019
|
id: collapsibleId,
|
|
@@ -978,8 +1035,7 @@ const RadioContext = createContext({
|
|
|
978
1035
|
defaultValue: void 0,
|
|
979
1036
|
isControlled: false,
|
|
980
1037
|
name: void 0,
|
|
981
|
-
onChange
|
|
982
|
-
},
|
|
1038
|
+
onChange: noop,
|
|
983
1039
|
required: false,
|
|
984
1040
|
value: void 0
|
|
985
1041
|
});
|
|
@@ -1000,7 +1056,7 @@ const Radio = forwardRef((props, ref) => {
|
|
|
1000
1056
|
value
|
|
1001
1057
|
} = useContext(RadioContext);
|
|
1002
1058
|
return /* @__PURE__ */ jsxs("label", {
|
|
1003
|
-
className:
|
|
1059
|
+
className: cx(className, "cursor-pointer"),
|
|
1004
1060
|
children: [/* @__PURE__ */ jsx("input", __spreadValues({
|
|
1005
1061
|
className: "radio",
|
|
1006
1062
|
defaultChecked: !isControlled ? rest.value === defaultValue : void 0,
|
|
@@ -1056,7 +1112,7 @@ const RadioGroup = forwardRef((props, ref) => {
|
|
|
1056
1112
|
children: /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({
|
|
1057
1113
|
"aria-describedby": description ? helpId : void 0,
|
|
1058
1114
|
"aria-labelledby": label ? labelId : void 0,
|
|
1059
|
-
className:
|
|
1115
|
+
className: cx(className, "flex flex-col gap-4"),
|
|
1060
1116
|
role: "radiogroup",
|
|
1061
1117
|
ref
|
|
1062
1118
|
}, rest), {
|
|
@@ -1087,7 +1143,7 @@ const Snackbar = (props) => {
|
|
|
1087
1143
|
children: [/* @__PURE__ */ jsx(InfoCircle, {
|
|
1088
1144
|
className: "text-orange snackbar-icon mr-4 md:mr-8 md:text-2xl"
|
|
1089
1145
|
}), /* @__PURE__ */ jsx("h3", {
|
|
1090
|
-
className:
|
|
1146
|
+
className: cx("snackbar-header min-w-0 max-w-prose text-base font-medium", {
|
|
1091
1147
|
"overflow-hidden overflow-ellipsis whitespace-nowrap": !isExpanded
|
|
1092
1148
|
}),
|
|
1093
1149
|
children: heading
|
|
@@ -1107,7 +1163,7 @@ const Snackbar = (props) => {
|
|
|
1107
1163
|
});
|
|
1108
1164
|
};
|
|
1109
1165
|
const SnackbarButton = (props) => /* @__PURE__ */ jsx("button", __spreadProps(__spreadValues({
|
|
1110
|
-
className:
|
|
1166
|
+
className: cx(props.className, "focus-visible:ring-offset flex-shrink-0 underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black")
|
|
1111
1167
|
}, props), {
|
|
1112
1168
|
children: props.children
|
|
1113
1169
|
}));
|
|
@@ -1132,7 +1188,7 @@ const StepListItem = (props) => {
|
|
|
1132
1188
|
"bullet"
|
|
1133
1189
|
]);
|
|
1134
1190
|
return /* @__PURE__ */ jsxs("li", __spreadProps(__spreadValues({
|
|
1135
|
-
className:
|
|
1191
|
+
className: cx(className, "group relative flex gap-4 pb-8 text-sm last:pb-0 md:gap-8 md:pb-12 md:text-base")
|
|
1136
1192
|
}, rest), {
|
|
1137
1193
|
children: [/* @__PURE__ */ jsx(StepListBullet, {
|
|
1138
1194
|
children: bullet
|
|
@@ -1176,22 +1232,23 @@ const TextArea = forwardRef((props, ref) => {
|
|
|
1176
1232
|
children: [/* @__PURE__ */ jsx(FormLabel, {
|
|
1177
1233
|
htmlFor: id,
|
|
1178
1234
|
isRequired: required,
|
|
1235
|
+
isInvalid: !!error || validity === "invalid",
|
|
1179
1236
|
children: label
|
|
1237
|
+
}), description && /* @__PURE__ */ jsx(FormHelperText, {
|
|
1238
|
+
id: helpTextId,
|
|
1239
|
+
children: description
|
|
1180
1240
|
}), /* @__PURE__ */ jsx(Input, __spreadProps(__spreadValues({
|
|
1181
1241
|
as: "textarea",
|
|
1182
|
-
ref:
|
|
1242
|
+
ref: composeRefs(ownRef, ref),
|
|
1183
1243
|
id,
|
|
1184
1244
|
required
|
|
1185
1245
|
}, rest), {
|
|
1186
1246
|
isInvalid: !!error || validity === "invalid",
|
|
1187
|
-
"aria-describedby":
|
|
1247
|
+
"aria-describedby": cx({
|
|
1188
1248
|
[errorMsgId]: !!error,
|
|
1189
1249
|
[helpTextId]: description
|
|
1190
1250
|
})
|
|
1191
|
-
})),
|
|
1192
|
-
id: helpTextId,
|
|
1193
|
-
children: description
|
|
1194
|
-
}), errorMsg && /* @__PURE__ */ jsx(FormErrorMessage, {
|
|
1251
|
+
})), errorMsg && /* @__PURE__ */ jsx(FormErrorMessage, {
|
|
1195
1252
|
id: errorMsgId,
|
|
1196
1253
|
children: errorMsg
|
|
1197
1254
|
})]
|
|
@@ -1229,22 +1286,23 @@ const TextField = forwardRef((props, ref) => {
|
|
|
1229
1286
|
children: [/* @__PURE__ */ jsx(FormLabel, {
|
|
1230
1287
|
htmlFor: id,
|
|
1231
1288
|
isRequired: required,
|
|
1289
|
+
isInvalid: !!error || validity === "invalid",
|
|
1232
1290
|
children: label
|
|
1291
|
+
}), description && /* @__PURE__ */ jsx(FormHelperText, {
|
|
1292
|
+
id: helpTextId,
|
|
1293
|
+
children: description
|
|
1233
1294
|
}), /* @__PURE__ */ jsx(Input, __spreadProps(__spreadValues({
|
|
1234
1295
|
id,
|
|
1235
1296
|
required,
|
|
1236
|
-
ref:
|
|
1297
|
+
ref: composeRefs(ownRef, ref),
|
|
1237
1298
|
type
|
|
1238
1299
|
}, rest), {
|
|
1239
1300
|
isInvalid: !!error || validity === "invalid",
|
|
1240
|
-
"aria-describedby":
|
|
1301
|
+
"aria-describedby": cx({
|
|
1241
1302
|
[errorMsgId]: !!error,
|
|
1242
1303
|
[helpTextId]: description
|
|
1243
1304
|
})
|
|
1244
|
-
})),
|
|
1245
|
-
id: helpTextId,
|
|
1246
|
-
children: description
|
|
1247
|
-
}), errorMsg && /* @__PURE__ */ jsx(FormErrorMessage, {
|
|
1305
|
+
})), errorMsg && /* @__PURE__ */ jsx(FormErrorMessage, {
|
|
1248
1306
|
id: errorMsgId,
|
|
1249
1307
|
children: errorMsg
|
|
1250
1308
|
})]
|
|
@@ -1259,7 +1317,7 @@ const Select = forwardRef((props, ref) => {
|
|
|
1259
1317
|
"className"
|
|
1260
1318
|
]);
|
|
1261
1319
|
return /* @__PURE__ */ jsxs("div", {
|
|
1262
|
-
className:
|
|
1320
|
+
className: cx("relative", className),
|
|
1263
1321
|
children: [/* @__PURE__ */ jsx("select", __spreadProps(__spreadValues({}, rest), {
|
|
1264
1322
|
className: "focus:border-blue border-gray-dark w-full appearance-none rounded-lg border-2 border-solid bg-white px-4 py-3 focus:outline-none",
|
|
1265
1323
|
ref,
|
|
@@ -1269,4 +1327,4 @@ const Select = forwardRef((props, ref) => {
|
|
|
1269
1327
|
})]
|
|
1270
1328
|
});
|
|
1271
1329
|
});
|
|
1272
|
-
export { Alert, Banner, BannerImage, Button, ButtonColorContext, Campaign, Card, CardContent, CardImage, CardLinkOverlay, CardList, Checkbox, Footer, Form, FormError, FormErrorMessage, FormHeading, FormHelperText, FormLabel, FormSuccess, Hero, HeroActions, HeroContent, HeroContext, HeroImage, Input, Link, Navbar, NavbarCollapsible, NavbarContent, NavbarExpandedMobileContent, NavbarItem, NavbarItems, Radio, RadioGroup, Select, Snackbar, SnackbarButton, SnackbarContent, StepList, StepListItem, TextArea, TextField,
|
|
1330
|
+
export { Alert, Banner, BannerImage, Button, ButtonColorContext, Campaign, Card, CardContent, CardImage, CardLinkOverlay, CardList, Checkbox, Chip, Footer, Form, FormError, FormErrorMessage, FormHeading, FormHelperText, FormLabel, FormSuccess, Hero, HeroActions, HeroContent, HeroContext, HeroImage, Input, Link, Navbar, NavbarCollapsible, NavbarContent, NavbarExpandedMobileContent, NavbarItem, NavbarItems, Radio, RadioGroup, Select, Snackbar, SnackbarButton, SnackbarContent, StepList, StepListItem, TextArea, TextField, useBlockBackgroundColor, useFallbackId, useFormControlValidity, usePrefersReducedMotion, useScreenMaxWidthMd };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { useMedia } from 'react-use';
|
|
2
2
|
export * from './usePrefersReducedMotion';
|
|
3
3
|
export * from './useBlockBackgroundColor';
|
|
4
|
-
export * from './useMedia';
|
|
5
4
|
export * from './useScreenMaxWidthMd';
|
|
6
5
|
export * from './useFormControlValidity';
|
|
7
6
|
export * from './useFallbackId';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const usePrefersReducedMotion: () => boolean;
|
|
1
|
+
export declare const usePrefersReducedMotion: (defaultState?: boolean) => boolean;
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@obosbbl/grunnmuren-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "OBOS Grunnmuren design system React components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -17,19 +17,20 @@
|
|
|
17
17
|
],
|
|
18
18
|
"types": "./dist/index.d.ts",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@babel/core": "7.
|
|
21
|
-
"@obosbbl/grunnmuren-tailwind": "0.
|
|
22
|
-
"@storybook/addon-controls": "6.5.
|
|
23
|
-
"@storybook/addon-docs": "6.5.
|
|
20
|
+
"@babel/core": "7.19.1",
|
|
21
|
+
"@obosbbl/grunnmuren-tailwind": "0.7.0",
|
|
22
|
+
"@storybook/addon-controls": "6.5.12",
|
|
23
|
+
"@storybook/addon-docs": "6.5.12",
|
|
24
24
|
"@storybook/addon-postcss": "2.0.0",
|
|
25
|
-
"@storybook/builder-webpack5": "6.5.
|
|
26
|
-
"@storybook/manager-webpack5": "6.5.
|
|
27
|
-
"@storybook/react": "6.5.
|
|
28
|
-
"@types/react": "18.0.
|
|
25
|
+
"@storybook/builder-webpack5": "6.5.12",
|
|
26
|
+
"@storybook/manager-webpack5": "6.5.12",
|
|
27
|
+
"@storybook/react": "6.5.12",
|
|
28
|
+
"@types/react": "18.0.20",
|
|
29
29
|
"@types/react-dom": "18.0.6",
|
|
30
30
|
"@vitejs/plugin-react": "1.3.2",
|
|
31
31
|
"postcss": "8.4.16",
|
|
32
32
|
"react": "18.2.0",
|
|
33
|
+
"react-collapsed": "3.4.0",
|
|
33
34
|
"react-dom": "18.2.0",
|
|
34
35
|
"require-from-string": "2.0.2",
|
|
35
36
|
"rimraf": "3.0.2",
|
|
@@ -38,11 +39,13 @@
|
|
|
38
39
|
"webpack": "5.74.0"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
|
-
"@obosbbl/grunnmuren-icons": "^0.
|
|
42
|
-
"
|
|
42
|
+
"@obosbbl/grunnmuren-icons": "^0.5.0",
|
|
43
|
+
"@seznam/compose-react-refs": "1.0.6",
|
|
44
|
+
"clsx": "1.2.1",
|
|
45
|
+
"react-use": "17.4.0"
|
|
43
46
|
},
|
|
44
47
|
"peerDependencies": {
|
|
45
|
-
"@obosbbl/grunnmuren-tailwind": "^0.
|
|
48
|
+
"@obosbbl/grunnmuren-tailwind": "^0.7.0",
|
|
46
49
|
"react": "^18"
|
|
47
50
|
},
|
|
48
51
|
"peerDependenciesMeta": {
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/**
|
|
3
|
-
* React.Ref uses the readonly type `React.RefObject` instead of
|
|
4
|
-
* `React.MutableRefObject`, We pretty much always assume ref objects are
|
|
5
|
-
* mutable (at least when we create them), so this type is a workaround so some
|
|
6
|
-
* of the weird mechanics of using refs with TS.
|
|
7
|
-
*/
|
|
8
|
-
export declare type AssignableRef<ValueType> = {
|
|
9
|
-
bivarianceHack(instance: ValueType | null): void;
|
|
10
|
-
}['bivarianceHack'] | React.MutableRefObject<ValueType | null>;
|
|
11
|
-
/**
|
|
12
|
-
* Passes or assigns an arbitrary value to a ref function or object.
|
|
13
|
-
*
|
|
14
|
-
* @param ref
|
|
15
|
-
* @param value
|
|
16
|
-
*/
|
|
17
|
-
export declare function assignRef<RefValueType = unknown>(ref: AssignableRef<RefValueType> | null | undefined, value: any): void;
|
|
18
|
-
/**
|
|
19
|
-
* Passes or assigns a value to multiple refs (typically a DOM node). Useful for
|
|
20
|
-
* dealing with components that need an explicit ref for DOM calculations but
|
|
21
|
-
* also forwards refs assigned by an app.
|
|
22
|
-
*
|
|
23
|
-
* @param refs Refs to fork
|
|
24
|
-
*/
|
|
25
|
-
export declare function useComposedRefs<RefValueType = unknown>(...refs: (AssignableRef<RefValueType> | null | undefined)[]): (node: unknown) => void;
|
package/dist/hooks/useMedia.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useMedia(query: string): boolean;
|