@obosbbl/grunnmuren-react 1.4.1 → 1.4.3

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.
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
+ interface AccordionProps extends React.ComponentPropsWithoutRef<'div'> {
3
+ }
2
4
  export declare const Accordion: {
3
- (): void;
5
+ (props: AccordionProps): JSX.Element;
4
6
  Item: (props: AccordionItemProps) => JSX.Element;
5
7
  Header: <T extends React.ElementType<any> = "h3">(props: AccordionHeaderProps<T> & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "as">) => JSX.Element;
6
8
  Content: (props: AccordionContentProps) => JSX.Element;
@@ -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" | "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>>;
11
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<Pick<CheckboxProps, "error" | "form" | "slot" | "style" | "title" | "pattern" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "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" | "children" | "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" | "value" | "list" | "step" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "disabled" | "multiple" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "maxLength" | "minLength" | "src" | "crossOrigin" | "height" | "width" | "name" | "type" | "enterKeyHint" | "max" | "min" | "readOnly" | "required" | "size"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -29,14 +29,13 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
+ import { useState, useCallback, useEffect, useId, createContext, useContext, forwardRef, Children, isValidElement, cloneElement, useMemo, useRef } from "react";
33
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
34
+ import useCollapse from "react-collapsed";
32
35
  import cx from "clsx";
33
36
  import composeRefs from "@seznam/compose-react-refs";
34
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
35
37
  import { useMedia } from "react-use";
36
38
  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
- };
40
39
  var __defProp2 = Object.defineProperty;
41
40
  var __defProps2 = Object.defineProperties;
42
41
  var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
@@ -138,87 +137,7 @@ const Warning = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadVal
138
137
  d: "M31.549 24.132L20.12 2.155C19.7824 1.50555 19.273 0.961197 18.6474 0.581216C18.0218 0.201234 17.304 0.000197802 16.572 0H15.428C14.696 0.000197802 13.9782 0.201234 13.3526 0.581216C12.727 0.961197 12.2176 1.50555 11.88 2.155L0.451 24.132C0.154748 24.7022 6.05376e-05 25.3354 0 25.978V26C0 27.0609 0.421427 28.0783 1.17157 28.8284C1.92172 29.5786 2.93913 30 4 30H28C29.0609 30 30.0783 29.5786 30.8284 28.8284C31.5786 28.0783 32 27.0609 32 26V25.978C31.9999 25.3354 31.8453 24.7022 31.549 24.132ZM18 26H14V22H18V26ZM18 18H14V7H18V18Z"
139
138
  })
140
139
  }));
141
- const Alert = (props) => {
142
- const _a = props, {
143
- className,
144
- children,
145
- heading,
146
- severity = "alert"
147
- } = _a, rest = __objRest(_a, [
148
- "className",
149
- "children",
150
- "heading",
151
- "severity"
152
- ]);
153
- return /* @__PURE__ */ jsx("section", __spreadProps(__spreadValues({
154
- className: cx(className, "p-4 md:py-8", {
155
- "bg-orange-light": severity === "info",
156
- "bg-red-light": severity === "alert"
157
- }),
158
- role: "alert"
159
- }, rest), {
160
- children: /* @__PURE__ */ jsxs("div", {
161
- className: "flex justify-center",
162
- children: [/* @__PURE__ */ jsx(AlertIcon, {
163
- className: "mr-4 flex-none md:mr-8 md:text-2xl",
164
- severity
165
- }), /* @__PURE__ */ jsxs("div", {
166
- className: "w-prose flex-initial",
167
- children: [/* @__PURE__ */ jsx("h2", {
168
- className: "h4 mb-2",
169
- children: heading
170
- }), children]
171
- })]
172
- })
173
- }));
174
- };
175
- const AlertIcon = ({
176
- severity,
177
- className
178
- }) => {
179
- if (severity === "alert") {
180
- return /* @__PURE__ */ jsx(Warning, {
181
- className: cx(className, "text-red")
182
- });
183
- }
184
- return /* @__PURE__ */ jsx(InfoCircle, {
185
- className: cx(className, "text-orange")
186
- });
187
- };
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
- });
140
+ const noop = () => {
222
141
  };
223
142
  const QUERY = "(prefers-reduced-motion: reduce)";
224
143
  const usePrefersReducedMotion = (defaultState = false) => useMedia(QUERY, defaultState);
@@ -234,7 +153,7 @@ function useBlockBackgroundColor(blockBgColor) {
234
153
  return "bg-blue-lightest";
235
154
  }
236
155
  }
237
- const useScreenMaxWidthMd = () => useMedia("(max-width: 767.9px)");
156
+ const useScreenMaxWidthMd = (defaultState) => useMedia("(max-width: 767.9px)", defaultState);
238
157
  function useFormControlValidity(ref, enabled = true) {
239
158
  const [validity, setValidity] = useState("indeterminate");
240
159
  const [validationMessage, setValidationMessage] = useState();
@@ -279,6 +198,152 @@ function useFallbackId(id) {
279
198
  const generatedId = useId();
280
199
  return id != null ? id : generatedId;
281
200
  }
201
+ const DURATION_MS = 300;
202
+ const DURATION_TW = "duration-300";
203
+ const Accordion = (props) => {
204
+ const _a = props, {
205
+ className
206
+ } = _a, rest = __objRest(_a, [
207
+ "className"
208
+ ]);
209
+ return /* @__PURE__ */ jsx("div", __spreadValues({
210
+ className: cx(className, "flex flex-col gap-2")
211
+ }, rest));
212
+ };
213
+ const AccordionContext = createContext({
214
+ isExpanded: false,
215
+ setExpanded: noop,
216
+ getCollapseProps: noop,
217
+ getToggleProps: noop,
218
+ onChange: noop
219
+ });
220
+ const AccordionItem = (props) => {
221
+ const prefersReducedMotion = usePrefersReducedMotion();
222
+ const _a = props, {
223
+ className,
224
+ defaultOpen,
225
+ onChange = noop,
226
+ open
227
+ } = _a, rest = __objRest(_a, [
228
+ "className",
229
+ "defaultOpen",
230
+ "onChange",
231
+ "open"
232
+ ]);
233
+ const collapseContext = useCollapse({
234
+ defaultExpanded: defaultOpen,
235
+ isExpanded: open,
236
+ duration: DURATION_MS,
237
+ hasDisabledAnimation: prefersReducedMotion,
238
+ easing: "cubic-bezier(0.25, 0.1, 0.25, 1)"
239
+ });
240
+ return /* @__PURE__ */ jsx(AccordionContext.Provider, {
241
+ value: __spreadValues({
242
+ onChange
243
+ }, collapseContext),
244
+ children: /* @__PURE__ */ jsx("div", __spreadValues({
245
+ className: cx(className, "border-b-gray-concrete overflow-hidden rounded-sm border-b-2 border-l-4 border-solid", collapseContext.isExpanded ? "border-l-green-dark" : "border-l-green")
246
+ }, rest))
247
+ });
248
+ };
249
+ const AccordionHeader = (props) => {
250
+ const _a = props, {
251
+ children,
252
+ className,
253
+ as: Heading = "h3"
254
+ } = _a, rest = __objRest(_a, [
255
+ "children",
256
+ "className",
257
+ "as"
258
+ ]);
259
+ const {
260
+ getToggleProps,
261
+ onChange,
262
+ isExpanded
263
+ } = useContext(AccordionContext);
264
+ const toggleProps = getToggleProps({
265
+ onClick: () => onChange(!isExpanded)
266
+ });
267
+ return /* @__PURE__ */ jsx(Heading, {
268
+ children: /* @__PURE__ */ jsxs("button", __spreadProps(__spreadValues(__spreadValues({
269
+ className: cx(className, "focus-visible:outline-blue-dark flex min-h-[4rem] w-full items-center justify-between px-5 py-4 text-left text-lg font-semibold focus:outline-none focus-visible:outline-4 focus-visible:outline-offset-0", isExpanded ? "bg-green-dark text-white" : void 0)
270
+ }, rest), toggleProps), {
271
+ id: getToggleId(toggleProps["aria-controls"]),
272
+ children: [children, /* @__PURE__ */ jsx(ChevronDown, {
273
+ className: cx("shrink-0 text-sm", DURATION_TW, isExpanded ? "rotate-180" : void 0)
274
+ })]
275
+ }))
276
+ });
277
+ };
278
+ const AccordionContent = (props) => {
279
+ const {
280
+ getCollapseProps
281
+ } = useContext(AccordionContext);
282
+ const _a = props, {
283
+ className
284
+ } = _a, rest = __objRest(_a, [
285
+ "className"
286
+ ]);
287
+ const collapseProps = getCollapseProps();
288
+ return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({}, collapseProps), {
289
+ role: "region",
290
+ "aria-labelledby": getToggleId(collapseProps.id),
291
+ children: /* @__PURE__ */ jsx("div", __spreadValues({
292
+ className: cx(className, "p-5 pb-10")
293
+ }, rest))
294
+ }));
295
+ };
296
+ const getToggleId = (id) => id + "toggle";
297
+ Accordion.Item = AccordionItem;
298
+ Accordion.Header = AccordionHeader;
299
+ Accordion.Content = AccordionContent;
300
+ const Alert = (props) => {
301
+ const _a = props, {
302
+ className,
303
+ children,
304
+ heading,
305
+ severity = "alert"
306
+ } = _a, rest = __objRest(_a, [
307
+ "className",
308
+ "children",
309
+ "heading",
310
+ "severity"
311
+ ]);
312
+ return /* @__PURE__ */ jsx("section", __spreadProps(__spreadValues({
313
+ className: cx(className, "p-4 md:py-8", {
314
+ "bg-orange-light": severity === "info",
315
+ "bg-red-light": severity === "alert"
316
+ }),
317
+ role: "alert"
318
+ }, rest), {
319
+ children: /* @__PURE__ */ jsxs("div", {
320
+ className: "flex justify-center",
321
+ children: [/* @__PURE__ */ jsx(AlertIcon, {
322
+ className: "mr-4 flex-none md:mr-8 md:text-2xl",
323
+ severity
324
+ }), /* @__PURE__ */ jsxs("div", {
325
+ className: "w-prose flex-initial",
326
+ children: [/* @__PURE__ */ jsx("h2", {
327
+ className: "h4 mb-2",
328
+ children: heading
329
+ }), children]
330
+ })]
331
+ })
332
+ }));
333
+ };
334
+ const AlertIcon = ({
335
+ severity,
336
+ className
337
+ }) => {
338
+ if (severity === "alert") {
339
+ return /* @__PURE__ */ jsx(Warning, {
340
+ className: cx(className, "text-red")
341
+ });
342
+ }
343
+ return /* @__PURE__ */ jsx(InfoCircle, {
344
+ className: cx(className, "text-orange")
345
+ });
346
+ };
282
347
  const Banner = (props) => {
283
348
  const _a = props, {
284
349
  bgColor: bgColorProp,
@@ -554,6 +619,41 @@ const Checkbox = forwardRef((props, ref) => {
554
619
  })]
555
620
  });
556
621
  });
622
+ const chipVariations = {
623
+ "blue-light": "bg-blue-light border-blue-light",
624
+ "red-light": "bg-red-light border-red-light",
625
+ "green-light": "bg-green-light border-green-light",
626
+ "orange-light": "bg-orange-light border-orange-light"
627
+ };
628
+ const iconColors = {
629
+ "blue-light": "text-blue-dark",
630
+ "red-light": "text-red",
631
+ "green-light": "text-green",
632
+ "orange-light": "text-black"
633
+ };
634
+ const Chip = (props) => {
635
+ const {
636
+ className,
637
+ color,
638
+ icon,
639
+ children,
640
+ variant = "filled"
641
+ } = props;
642
+ const chipVariation = color && chipVariations[color];
643
+ const iconColor = color && iconColors[color];
644
+ return /* @__PURE__ */ jsxs("div", {
645
+ className: cx("inline-flex items-center overflow-hidden rounded-lg border-2 font-medium", chipVariation, className),
646
+ children: [icon && /* @__PURE__ */ jsx("div", {
647
+ className: cx("px-3 py-2", iconColor),
648
+ children: icon
649
+ }), /* @__PURE__ */ jsx("div", {
650
+ className: cx("flex-1 py-2 px-3", {
651
+ "bg-white": variant === "outline"
652
+ }),
653
+ children
654
+ })]
655
+ });
656
+ };
557
657
  const Footer = (props) => {
558
658
  const _a = props, {
559
659
  className,
@@ -1024,7 +1124,7 @@ const NavbarExpandedMobileContent = (props) => {
1024
1124
  const {
1025
1125
  isExpanded
1026
1126
  } = useContext(NavbarContext);
1027
- const isMobileScreen = useScreenMaxWidthMd();
1127
+ const isMobileScreen = useScreenMaxWidthMd(false);
1028
1128
  if (!isExpanded || !isMobileScreen)
1029
1129
  return null;
1030
1130
  return /* @__PURE__ */ jsx(Fragment, {
@@ -1127,6 +1227,25 @@ const RadioGroup = forwardRef((props, ref) => {
1127
1227
  }))
1128
1228
  });
1129
1229
  });
1230
+ const Select = forwardRef((props, ref) => {
1231
+ const _a = props, {
1232
+ children,
1233
+ className
1234
+ } = _a, rest = __objRest(_a, [
1235
+ "children",
1236
+ "className"
1237
+ ]);
1238
+ return /* @__PURE__ */ jsxs("div", {
1239
+ className: cx("relative", className),
1240
+ children: [/* @__PURE__ */ jsx("select", __spreadProps(__spreadValues({}, rest), {
1241
+ 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",
1242
+ ref,
1243
+ children
1244
+ })), /* @__PURE__ */ jsx(ChevronDown, {
1245
+ className: "absolute top-4 right-4"
1246
+ })]
1247
+ });
1248
+ });
1130
1249
  const Snackbar = (props) => {
1131
1250
  const {
1132
1251
  heading,
@@ -1308,23 +1427,4 @@ const TextField = forwardRef((props, ref) => {
1308
1427
  })]
1309
1428
  });
1310
1429
  });
1311
- const Select = forwardRef((props, ref) => {
1312
- const _a = props, {
1313
- children,
1314
- className
1315
- } = _a, rest = __objRest(_a, [
1316
- "children",
1317
- "className"
1318
- ]);
1319
- return /* @__PURE__ */ jsxs("div", {
1320
- className: cx("relative", className),
1321
- children: [/* @__PURE__ */ jsx("select", __spreadProps(__spreadValues({}, rest), {
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",
1323
- ref,
1324
- children
1325
- })), /* @__PURE__ */ jsx(ChevronDown, {
1326
- className: "absolute top-4 right-4"
1327
- })]
1328
- });
1329
- });
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 };
1430
+ export { Accordion, AccordionContent, AccordionHeader, AccordionItem, 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 };
@@ -1 +1 @@
1
- export declare const useScreenMaxWidthMd: () => boolean;
1
+ export declare const useScreenMaxWidthMd: (defaultState: boolean) => boolean;
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
+ export * from './Accordion';
1
2
  export * from './Alert';
2
- export * from './Chip';
3
3
  export * from './Banner';
4
4
  export * from './Button';
5
5
  export * from './Campaign';
6
6
  export * from './Card';
7
7
  export * from './Checkbox';
8
+ export * from './Chip';
8
9
  export * from './Footer';
9
10
  export * from './Form';
10
11
  export * from './Hero';
@@ -12,9 +13,9 @@ export * from './Input';
12
13
  export * from './Link';
13
14
  export * from './Navbar';
14
15
  export * from './Radio';
16
+ export * from './Select';
15
17
  export * from './Snackbar';
16
18
  export * from './StepList';
17
19
  export * from './TextArea';
18
20
  export * from './TextField';
19
21
  export * from './hooks';
20
- export * from './Select';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-react",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "OBOS Grunnmuren design system React components",
5
5
  "license": "MIT",
6
6
  "repository": {