@digdir/designsystemet-react 0.56.3-alpha.1 → 0.58.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/cjs/components/Accordion/AccordionHeader/AccordionHeader.js +1 -2
- package/dist/cjs/components/Button/Button.js +1 -2
- package/dist/cjs/components/Button/Button.module.css.js +1 -1
- package/dist/cjs/components/Card/Card.js +1 -2
- package/dist/cjs/components/Chip/Chip.module.css.js +1 -1
- package/dist/cjs/components/Chip/Removable/Removable.js +1 -2
- package/dist/cjs/components/Chip/Toggle/Toggle.js +1 -2
- package/dist/cjs/components/HelpText/HelpText.js +1 -2
- package/dist/cjs/components/SkipLink/SkipLink.js +1 -2
- package/dist/cjs/components/Table/TableHeaderCell.js +1 -2
- package/dist/cjs/components/Typography/Ingress/Ingress.js +2 -3
- package/dist/cjs/components/form/CharacterCounter.js +1 -2
- package/dist/cjs/components/form/Combobox/internal/ComboboxClearButton.js +1 -2
- package/dist/cjs/components/form/Combobox/internal/ComboboxLabel.js +1 -2
- package/dist/cjs/components/form/Fieldset/Fieldset.js +1 -2
- package/dist/cjs/components/form/NativeSelect/NativeSelect.js +1 -2
- package/dist/cjs/components/form/Search/Search.js +1 -2
- package/dist/cjs/components/form/Textarea/Textarea.js +1 -2
- package/dist/cjs/components/form/Textfield/Textfield.js +1 -2
- package/dist/cjs/react-css-modules.css +2786 -2776
- package/dist/esm/components/Accordion/AccordionHeader/AccordionHeader.js +1 -2
- package/dist/esm/components/Button/Button.js +1 -2
- package/dist/esm/components/Button/Button.module.css.js +1 -1
- package/dist/esm/components/Card/Card.js +1 -2
- package/dist/esm/components/Chip/Chip.module.css.js +1 -1
- package/dist/esm/components/Chip/Removable/Removable.js +1 -2
- package/dist/esm/components/Chip/Toggle/Toggle.js +1 -2
- package/dist/esm/components/HelpText/HelpText.js +1 -2
- package/dist/esm/components/SkipLink/SkipLink.js +1 -2
- package/dist/esm/components/Table/TableHeaderCell.js +1 -2
- package/dist/esm/components/Typography/Ingress/Ingress.js +2 -3
- package/dist/esm/components/form/CharacterCounter.js +1 -2
- package/dist/esm/components/form/Combobox/internal/ComboboxClearButton.js +1 -2
- package/dist/esm/components/form/Combobox/internal/ComboboxLabel.js +1 -2
- package/dist/esm/components/form/Fieldset/Fieldset.js +1 -2
- package/dist/esm/components/form/NativeSelect/NativeSelect.js +1 -2
- package/dist/esm/components/form/Search/Search.js +1 -2
- package/dist/esm/components/form/Textarea/Textarea.js +1 -2
- package/dist/esm/components/form/Textfield/Textfield.js +1 -2
- package/dist/esm/react-css-modules.css +2786 -2776
- package/dist/types/components/Accordion/AccordionHeader/AccordionHeader.d.ts.map +1 -1
- package/dist/types/components/Button/Button.d.ts +1 -1
- package/dist/types/components/Button/Button.d.ts.map +1 -1
- package/dist/types/components/Card/Card.d.ts.map +1 -1
- package/dist/types/components/Chip/Removable/Removable.d.ts.map +1 -1
- package/dist/types/components/Chip/Toggle/Toggle.d.ts.map +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenuTrigger.d.ts +1 -1
- package/dist/types/components/ErrorSummary/ErrorSummaryItem.d.ts.map +1 -1
- package/dist/types/components/HelpText/HelpText.d.ts.map +1 -1
- package/dist/types/components/Modal/ModalTrigger/ModalTrigger.d.ts +1 -1
- package/dist/types/components/Popover/PopoverTrigger.d.ts +1 -1
- package/dist/types/components/SkipLink/SkipLink.d.ts.map +1 -1
- package/dist/types/components/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/types/components/Typography/Ingress/Ingress.d.ts +4 -2
- package/dist/types/components/Typography/Ingress/Ingress.d.ts.map +1 -1
- package/dist/types/components/form/CharacterCounter.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxClearButton.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxLabel.d.ts.map +1 -1
- package/dist/types/components/form/Fieldset/Fieldset.d.ts.map +1 -1
- package/dist/types/components/form/NativeSelect/NativeSelect.d.ts.map +1 -1
- package/dist/types/components/form/Search/Search.d.ts.map +1 -1
- package/dist/types/components/form/Textarea/Textarea.d.ts.map +1 -1
- package/dist/types/components/form/Textfield/Textfield.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/cjs/components/Typography/Ingress/Ingress.module.css.js +0 -6
- package/dist/cjs/utilities/utility.module.css.js +0 -6
- package/dist/esm/components/Typography/Ingress/Ingress.module.css.js +0 -4
- package/dist/esm/utilities/utility.module.css.js +0 -4
|
@@ -4,7 +4,6 @@ import { ChevronDownIcon } from '@navikt/aksel-icons';
|
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/clsx.js';
|
|
5
5
|
import { forwardRef, useContext } from 'react';
|
|
6
6
|
import classes from '../Accordion.module.css.js';
|
|
7
|
-
import utilityClasses from '../../../utilities/utility.module.css.js';
|
|
8
7
|
import { AccordionItemContext } from '../AccordionItem/AccordionItem.js';
|
|
9
8
|
import { Heading } from '../../Typography/Heading/Heading.js';
|
|
10
9
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
@@ -19,7 +18,7 @@ const AccordionHeader = forwardRef(({ level = 1, children, className, onHeaderCl
|
|
|
19
18
|
context.toggleOpen();
|
|
20
19
|
onHeaderClick && onHeaderClick(e);
|
|
21
20
|
};
|
|
22
|
-
return (jsx(Heading, { ref: ref, size: 'xsmall', level: level, className: clsx(classes.header, className), ...rest, children: jsxs("button", { type: 'button', className: clsx(classes.accordionButton,
|
|
21
|
+
return (jsx(Heading, { ref: ref, size: 'xsmall', level: level, className: clsx(classes.header, className), ...rest, children: jsxs("button", { type: 'button', className: clsx(classes.accordionButton, `fds-focus`), onClick: handleClick, "aria-expanded": context.open, "aria-controls": context.contentId, children: [jsx(ChevronDownIcon, { "aria-hidden": true, className: classes.expandIcon, fontSize: '1.5rem' }), jsx(Paragraph, { asChild: true, size: 'small', children: jsx("span", { children: children }) })] }) }));
|
|
23
22
|
});
|
|
24
23
|
AccordionHeader.displayName = 'AccordionHeader';
|
|
25
24
|
|
|
@@ -3,7 +3,6 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/clsx.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
-
import utilityClasses from '../../utilities/utility.module.css.js';
|
|
7
6
|
import classes from './Button.module.css.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -11,7 +10,7 @@ import classes from './Button.module.css.js';
|
|
|
11
10
|
*/
|
|
12
11
|
const Button = forwardRef(({ children, color = 'first', variant = 'primary', size = 'medium', fullWidth = false, icon = false, type = 'button', className, as = 'button', asChild, ...rest }, ref) => {
|
|
13
12
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : as;
|
|
14
|
-
return (jsx(Component, { ref: ref, type: type, className: clsx(classes.button,
|
|
13
|
+
return (jsx(Component, { ref: ref, type: type, className: clsx(classes.button, `fds-focus`, classes[size], classes[variant], classes[color], { [classes.fullWidth]: fullWidth }, { [classes.onlyIcon]: icon }, className), ...rest, children: children }));
|
|
15
14
|
});
|
|
16
15
|
Button.displayName = 'Button';
|
|
17
16
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
var classes = {"button":"fds-button-button-8fa00f0f","small":"fds-button-small-8fa00f0f","medium":"fds-button-medium-8fa00f0f","large":"fds-button-large-8fa00f0f","fullWidth":"fds-button-fullWidth-8fa00f0f","secondary":"fds-button-secondary-8fa00f0f","tertiary":"fds-button-tertiary-8fa00f0f","onlyIcon":"fds-button-onlyIcon-8fa00f0f","primary":"fds-button-primary-8fa00f0f","first":"fds-button-first-8fa00f0f","second":"fds-button-second-8fa00f0f","success":"fds-button-success-8fa00f0f","danger":"fds-button-danger-8fa00f0f"
|
|
2
|
+
var classes = {"button":"fds-button-button-8fa00f0f","small":"fds-button-small-8fa00f0f","medium":"fds-button-medium-8fa00f0f","large":"fds-button-large-8fa00f0f","fullWidth":"fds-button-fullWidth-8fa00f0f","secondary":"fds-button-secondary-8fa00f0f","tertiary":"fds-button-tertiary-8fa00f0f","onlyIcon":"fds-button-onlyIcon-8fa00f0f","primary":"fds-button-primary-8fa00f0f","first":"fds-button-first-8fa00f0f","second":"fds-button-second-8fa00f0f","success":"fds-button-success-8fa00f0f","danger":"fds-button-danger-8fa00f0f"};
|
|
3
3
|
|
|
4
4
|
export { classes as default };
|
|
@@ -3,12 +3,11 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/clsx.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
-
import utilityClasses from '../../utilities/utility.module.css.js';
|
|
7
6
|
import classes from './Card.module.css.js';
|
|
8
7
|
|
|
9
8
|
const Card = forwardRef(({ color = 'neutral', as = 'div', isLink = false, asChild = false, className, ...rest }, ref) => {
|
|
10
9
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : as;
|
|
11
|
-
return (jsx(Component, { ref: ref, className: clsx(classes.card, classes[color], isLink && classes.linkCard, isLink &&
|
|
10
|
+
return (jsx(Component, { ref: ref, className: clsx(classes.card, classes[color], isLink && classes.linkCard, isLink && `fds-focus`, className), ...rest }));
|
|
12
11
|
});
|
|
13
12
|
Card.displayName = 'Card';
|
|
14
13
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
var classes = {"chip":"fds-chip-chip-4563db0f","chipButton":"fds-chip-chipButton-4563db0f","label":"fds-chip-label-4563db0f","removable":"fds-chip-removable-4563db0f","
|
|
2
|
+
var classes = {"chip":"fds-chip-chip-4563db0f","chipButton":"fds-chip-chipButton-4563db0f","label":"fds-chip-label-4563db0f","removable":"fds-chip-removable-4563db0f","small":"fds-chip-small-4563db0f","large":"fds-chip-large-4563db0f","xMark":"fds-chip-xMark-4563db0f","icon":"fds-chip-icon-4563db0f","spacing":"fds-chip-spacing-4563db0f","checkmarkIcon":"fds-chip-checkmarkIcon-4563db0f","medium":"fds-chip-medium-4563db0f","groupContainer":"fds-chip-groupContainer-4563db0f"};
|
|
3
3
|
|
|
4
4
|
export { classes as default };
|
|
@@ -5,12 +5,11 @@ import { clsx } from '../../../node_modules/clsx/dist/clsx.js';
|
|
|
5
5
|
import { XMarkIcon } from '@navikt/aksel-icons';
|
|
6
6
|
import classes from '../Chip.module.css.js';
|
|
7
7
|
import { ChipGroupContext } from '../Group/Group.js';
|
|
8
|
-
import utilityClasses from '../../../utilities/utility.module.css.js';
|
|
9
8
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
10
9
|
|
|
11
10
|
const RemovableChip = forwardRef(({ children, size = 'medium', className, ...rest }, ref) => {
|
|
12
11
|
const group = useContext(ChipGroupContext);
|
|
13
|
-
return (jsx("button", { type: 'button', ref: ref, className: clsx(classes.chipButton,
|
|
12
|
+
return (jsx("button", { type: 'button', ref: ref, className: clsx(classes.chipButton, `fds-focus`, classes[group?.size || size], classes.removable, className), ...rest, children: jsx(Paragraph, { asChild: true, size: group?.size || size, short: true, children: jsxs("span", { className: classes.label, children: [jsx("span", { children: children }), jsx("span", { className: classes.xMark, "aria-hidden": true, children: jsx(XMarkIcon, { className: classes.icon }) })] }) }) }));
|
|
14
13
|
});
|
|
15
14
|
RemovableChip.displayName = 'ChipRemovable';
|
|
16
15
|
|
|
@@ -4,14 +4,13 @@ import { forwardRef, useContext } from 'react';
|
|
|
4
4
|
import { CheckmarkIcon } from '@navikt/aksel-icons';
|
|
5
5
|
import { clsx } from '../../../node_modules/clsx/dist/clsx.js';
|
|
6
6
|
import { ChipGroupContext } from '../Group/Group.js';
|
|
7
|
-
import utilityClasses from '../../../utilities/utility.module.css.js';
|
|
8
7
|
import classes from '../Chip.module.css.js';
|
|
9
8
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
10
9
|
|
|
11
10
|
const ToggleChip = forwardRef(({ children, size = 'medium', selected = false, checkmark = true, className, ...rest }, ref) => {
|
|
12
11
|
const shouldDisplayCheckmark = checkmark && selected;
|
|
13
12
|
const group = useContext(ChipGroupContext);
|
|
14
|
-
return (jsx("button", { ref: ref, type: 'button', "aria-pressed": selected, className: clsx(classes.chipButton,
|
|
13
|
+
return (jsx("button", { ref: ref, type: 'button', "aria-pressed": selected, className: clsx(classes.chipButton, `fds-focus`, classes[group?.size || size], { [classes.spacing]: shouldDisplayCheckmark }, className), ...rest, children: jsx(Paragraph, { asChild: true, size: group?.size || size, short: true, children: jsxs("span", { className: classes.label, children: [shouldDisplayCheckmark && (jsx(CheckmarkIcon, { className: classes.checkmarkIcon, "aria-hidden": true })), jsx("span", { children: children })] }) }) }));
|
|
15
14
|
});
|
|
16
15
|
ToggleChip.displayName = 'ChipToggle';
|
|
17
16
|
|
|
@@ -3,13 +3,12 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/clsx.js';
|
|
5
5
|
import { Popover } from '../Popover/index.js';
|
|
6
|
-
import utilityClasses from '../../utilities/utility.module.css.js';
|
|
7
6
|
import classes from './HelpText.module.css.js';
|
|
8
7
|
import { HelpTextIcon } from './HelpTextIcon.js';
|
|
9
8
|
|
|
10
9
|
const HelpText = ({ title, placement = 'right', size = 'medium', portal, className, children, ...rest }) => {
|
|
11
10
|
const [open, setOpen] = useState(false);
|
|
12
|
-
return (jsx(Fragment, { children: jsxs(Popover, { variant: 'info', placement: placement, size: size, portal: portal, open: open, onClose: () => setOpen(false), children: [jsx(Popover.Trigger, { asChild: true, variant: 'tertiary', children: jsxs("button", { className: clsx(classes.helpTextButton,
|
|
11
|
+
return (jsx(Fragment, { children: jsxs(Popover, { variant: 'info', placement: placement, size: size, portal: portal, open: open, onClose: () => setOpen(false), children: [jsx(Popover.Trigger, { asChild: true, variant: 'tertiary', children: jsxs("button", { className: clsx(classes.helpTextButton, `fds-focus`, className), "aria-expanded": open, onClick: () => setOpen(!open), ...rest, children: [jsx(HelpTextIcon, { filled: true, className: clsx(classes.helpTextIcon, classes.helpTextIconFilled, classes[size], className), openState: open }), jsx(HelpTextIcon, { className: clsx(classes.helpTextIcon, classes[size], className), openState: open }), jsx("span", { className: `fds-sr-only`, children: title })] }) }), jsx(Popover.Content, { className: classes.helpTextContent, children: children })] }) }));
|
|
13
12
|
};
|
|
14
13
|
HelpText.displayName = 'HelpText';
|
|
15
14
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { clsx } from '../../node_modules/clsx/dist/clsx.js';
|
|
4
|
-
import utilityClasses from '../../utilities/utility.module.css.js';
|
|
5
4
|
import classes from './SkipLink.module.css.js';
|
|
6
5
|
|
|
7
6
|
const SkipLink = ({ href, children, className, ...rest }) => {
|
|
8
|
-
return (jsx("a", { href: href, className: clsx(
|
|
7
|
+
return (jsx("a", { href: href, className: clsx(`fds-sr-only`, classes.skiplink, className), ...rest, children: children }));
|
|
9
8
|
};
|
|
10
9
|
SkipLink.displayName = 'SkipLink';
|
|
11
10
|
|
|
@@ -3,7 +3,6 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
3
3
|
import { ChevronUpIcon, ChevronDownIcon, ChevronUpDownIcon } from '@navikt/aksel-icons';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { clsx } from '../../node_modules/clsx/dist/clsx.js';
|
|
6
|
-
import utilityClasses from '../../utilities/utility.module.css.js';
|
|
7
6
|
import classes from './Table.module.css.js';
|
|
8
7
|
|
|
9
8
|
const SORT_ICON = {
|
|
@@ -12,7 +11,7 @@ const SORT_ICON = {
|
|
|
12
11
|
};
|
|
13
12
|
const TableHeaderCell = React.forwardRef(({ sortable = false, sort, onSortClick, className, children, ...rest }, ref) => {
|
|
14
13
|
const sortIcon = sort === 'ascending' || sort === 'descending' ? (SORT_ICON[sort]) : (jsx(ChevronUpDownIcon, {}));
|
|
15
|
-
return (jsxs("th", { className: clsx(sortable && classes.sortable, sort && classes.sorted, classes.headerCell, className), "aria-sort": sort, ref: ref, ...rest, children: [sortable && (jsxs("button", { className:
|
|
14
|
+
return (jsxs("th", { className: clsx(sortable && classes.sortable, sort && classes.sorted, classes.headerCell, className), "aria-sort": sort, ref: ref, ...rest, children: [sortable && (jsxs("button", { className: `fds-focus`, onClick: onSortClick, children: [children, sortIcon] })), !sortable && children] }));
|
|
16
15
|
});
|
|
17
16
|
TableHeaderCell.displayName = 'TableHeaderCell';
|
|
18
17
|
|
|
@@ -3,13 +3,12 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/clsx.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
-
import classes from './Ingress.module.css.js';
|
|
7
6
|
|
|
8
7
|
/** Use `Ingress` to display text as ingress. */
|
|
9
8
|
const Ingress = forwardRef(({ className, size = 'medium', spacing, as = 'p', asChild, ...rest }, ref) => {
|
|
10
9
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : as;
|
|
11
|
-
return (jsx(Component, { ref: ref, className: clsx(
|
|
12
|
-
|
|
10
|
+
return (jsx(Component, { ref: ref, className: clsx(`fds-ingress`, `fds-ingress--${size}`, {
|
|
11
|
+
'fds-ingress--spacing': !!spacing,
|
|
13
12
|
}, className), ...rest }));
|
|
14
13
|
});
|
|
15
14
|
Ingress.displayName = 'Ingress';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import utilityClasses from '../../utilities/utility.module.css.js';
|
|
4
3
|
import { ErrorMessage } from '../Typography/ErrorMessage/ErrorMessage.js';
|
|
5
4
|
|
|
6
5
|
const defaultLabel = (count) => count > -1 ? `${count} tegn igjen` : `${Math.abs(count)} tegn for mye`;
|
|
@@ -9,7 +8,7 @@ const CharacterCounter = ({ label = defaultLabel, srLabel: propsSrLabel, maxCoun
|
|
|
9
8
|
const currentCount = maxCount - value.length;
|
|
10
9
|
const hasExceededLimit = value.length > maxCount;
|
|
11
10
|
const srLabel = propsSrLabel ? propsSrLabel : defaultSrLabel(maxCount);
|
|
12
|
-
return (jsxs(Fragment, { children: [jsx("span", { className:
|
|
11
|
+
return (jsxs(Fragment, { children: [jsx("span", { className: `fds-sr-only`, id: id, children: srLabel }), jsx(ErrorMessage, { asChild: true, size: size, error: hasExceededLimit, children: jsx("span", { "aria-live": hasExceededLimit ? 'polite' : 'off', children: label(currentCount) }) })] }));
|
|
13
12
|
};
|
|
14
13
|
CharacterCounter.displayName = 'CharacterCounter';
|
|
15
14
|
|
|
@@ -5,7 +5,6 @@ import { XMarkIcon } from '@navikt/aksel-icons';
|
|
|
5
5
|
import { clsx } from '../../../../node_modules/clsx/dist/clsx.js';
|
|
6
6
|
import { ComboboxContext } from '../Combobox.js';
|
|
7
7
|
import classes from '../Combobox.module.css.js';
|
|
8
|
-
import utilityClasses from '../../../../utilities/utility.module.css.js';
|
|
9
8
|
|
|
10
9
|
const ComboboxClearButton = () => {
|
|
11
10
|
const context = useContext(ComboboxContext);
|
|
@@ -13,7 +12,7 @@ const ComboboxClearButton = () => {
|
|
|
13
12
|
throw new Error('ComboboxContext is missing');
|
|
14
13
|
}
|
|
15
14
|
const { size, readOnly, disabled, clearButtonLabel, inputRef, setSelectedOptions, setInputValue, } = context;
|
|
16
|
-
return (jsx("button", { disabled: disabled, className: clsx(classes.clearButton, classes[size],
|
|
15
|
+
return (jsx("button", { disabled: disabled, className: clsx(classes.clearButton, classes[size], `fds-focus`), onClick: () => {
|
|
17
16
|
if (readOnly)
|
|
18
17
|
return;
|
|
19
18
|
if (disabled)
|
|
@@ -3,12 +3,11 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { clsx } from '../../../../node_modules/clsx/dist/clsx.js';
|
|
4
4
|
import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
|
|
5
5
|
import classes from '../Combobox.module.css.js';
|
|
6
|
-
import utilityClasses from '../../../../utilities/utility.module.css.js';
|
|
7
6
|
import { Label } from '../../../Typography/Label/Label.js';
|
|
8
7
|
import { Paragraph } from '../../../Typography/Paragraph/Paragraph.js';
|
|
9
8
|
|
|
10
9
|
const ComboboxLabel = ({ label, description, hideLabel, size, readOnly, formFieldProps, }) => {
|
|
11
|
-
return (jsxs(Fragment, { children: [label && (jsxs(Label, { size: size, htmlFor: formFieldProps.inputProps.id, className: clsx(classes.label, hideLabel &&
|
|
10
|
+
return (jsxs(Fragment, { children: [label && (jsxs(Label, { size: size, htmlFor: formFieldProps.inputProps.id, className: clsx(classes.label, hideLabel && `fds-sr-only`), children: [readOnly && (jsx(PadlockLockedFillIcon, { "aria-hidden": true, className: classes.padlock })), label] })), description && (jsx(Paragraph, { asChild: true, size: size, children: jsx("div", { id: formFieldProps.descriptionId, className: clsx(classes.description, hideLabel && `fds-sr-only`), children: description }) }))] }));
|
|
12
11
|
};
|
|
13
12
|
ComboboxLabel.displayName = 'ComboboxLabel';
|
|
14
13
|
var ComboboxLabel$1 = ComboboxLabel;
|
|
@@ -3,7 +3,6 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef, useContext } from 'react';
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/clsx.js';
|
|
5
5
|
import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
|
|
6
|
-
import utilityClasses from '../../../utilities/utility.module.css.js';
|
|
7
6
|
import { useFieldset } from './useFieldset.js';
|
|
8
7
|
import classes from './Fieldset.module.css.js';
|
|
9
8
|
import { FieldsetContext } from './FieldsetContext.js';
|
|
@@ -21,7 +20,7 @@ const Fieldset = forwardRef((props, ref) => {
|
|
|
21
20
|
size,
|
|
22
21
|
disabled: props?.disabled,
|
|
23
22
|
readOnly,
|
|
24
|
-
}, children: jsxs("fieldset", { ...fieldsetProps, className: clsx(classes.fieldset, !hideLegend && classes.withSpacing, readOnly && classes.readonly, props?.disabled && classes.disabled, className), ref: ref, ...rest, children: [jsx(Label, { asChild: true, size: size, children: jsx("legend", { className: classes.legend, children: jsxs("span", { className: clsx(classes.legendContent, hideLegend &&
|
|
23
|
+
}, children: jsxs("fieldset", { ...fieldsetProps, className: clsx(classes.fieldset, !hideLegend && classes.withSpacing, readOnly && classes.readonly, props?.disabled && classes.disabled, className), ref: ref, ...rest, children: [jsx(Label, { asChild: true, size: size, children: jsx("legend", { className: classes.legend, children: jsxs("span", { className: clsx(classes.legendContent, hideLegend && `fds-sr-only`), children: [readOnly && (jsx(PadlockLockedFillIcon, { className: classes.padlock, "aria-hidden": true })), legend] }) }) }), description && (jsx(Paragraph, { size: size, asChild: true, short: true, children: jsx("div", { id: descriptionId, className: clsx(classes.description, hideLegend && `fds-sr-only`), children: description }) })), children, jsx("div", { id: errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', className: classes.errorWrapper, children: hasError && jsx(ErrorMessage, { size: size, children: error }) })] }) }));
|
|
25
24
|
});
|
|
26
25
|
Fieldset.displayName = 'Fieldset';
|
|
27
26
|
|
|
@@ -4,7 +4,6 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/clsx.js';
|
|
5
5
|
import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
|
|
6
6
|
import classes from './NativeSelect.module.css.js';
|
|
7
|
-
import utilityClasses from '../../../utilities/utility.module.css.js';
|
|
8
7
|
import { useNativeSelect } from './useNativeSelect.js';
|
|
9
8
|
import { Label } from '../../Typography/Label/Label.js';
|
|
10
9
|
import { omit } from '../../../utilities/objectUtils.js';
|
|
@@ -14,7 +13,7 @@ import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
|
14
13
|
const NativeSelect = forwardRef((props, ref) => {
|
|
15
14
|
const { children, disabled = false, label, hideLabel = false, error, className, htmlSize = 0, ...rest } = props;
|
|
16
15
|
const { selectProps, errorId, readOnly = false, size = 'medium', } = useNativeSelect(props);
|
|
17
|
-
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { className: clsx(classes.formField, disabled && classes.disabled, readOnly && classes.readOnly, error && classes.error), children: [label && (jsxs(Label, { weight: 'medium', size: size, htmlFor: selectProps.id, className: clsx(classes.label, hideLabel &&
|
|
16
|
+
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { className: clsx(classes.formField, disabled && classes.disabled, readOnly && classes.readOnly, error && classes.error), children: [label && (jsxs(Label, { weight: 'medium', size: size, htmlFor: selectProps.id, className: clsx(classes.label, hideLabel && 'fds-sr-only'), children: [readOnly && (jsx(PadlockLockedFillIcon, { "aria-hidden": true, className: classes.padlock })), label] })), jsx("select", { disabled: disabled || readOnly, ref: ref, size: htmlSize, className: clsx(classes.select, classes[size], `fds-focus`, props.multiple && classes.multiple, className), ...omit(['size', 'error', 'errorId'], rest), ...omit(['readOnly', 'disabled'], selectProps), children: children }), error && (jsx("div", { id: errorId, className: classes.errorMessage, "aria-live": 'polite', "aria-relevant": 'additions removals', children: jsx(ErrorMessage, { size: size, children: error }) }))] }) }));
|
|
18
17
|
});
|
|
19
18
|
NativeSelect.displayName = 'NativeSelect';
|
|
20
19
|
|
|
@@ -6,7 +6,6 @@ import { MagnifyingGlassIcon, XMarkIcon } from '@navikt/aksel-icons';
|
|
|
6
6
|
import { useMergeRefs } from '../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
7
7
|
import { useSearch } from './useSearch.js';
|
|
8
8
|
import classes from './Search.module.css.js';
|
|
9
|
-
import utilityClasses from '../../../utilities/utility.module.css.js';
|
|
10
9
|
import { Button } from '../../Button/Button.js';
|
|
11
10
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
12
11
|
import { Label } from '../../Typography/Label/Label.js';
|
|
@@ -41,7 +40,7 @@ const Search = forwardRef((props, ref) => {
|
|
|
41
40
|
};
|
|
42
41
|
const isSimple = variant === 'simple';
|
|
43
42
|
const showClearButton = Boolean(value ?? internalValue) && !disabled;
|
|
44
|
-
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { style: style, className: clsx(classes.formField, inputProps.disabled && classes.disabled, classes[size], className), children: [label && (jsx(Label, { size: size, weight: 'medium', htmlFor: inputProps.id, className: clsx(classes.label, hideLabel &&
|
|
43
|
+
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { style: style, className: clsx(classes.formField, inputProps.disabled && classes.disabled, classes[size], className), children: [label && (jsx(Label, { size: size, weight: 'medium', htmlFor: inputProps.id, className: clsx(classes.label, hideLabel && 'fds-sr-only'), children: jsx("span", { children: label }) })), jsxs("div", { className: classes.field, children: [jsxs("div", { className: clsx(classes.field, classes[size]), children: [isSimple && (jsx(MagnifyingGlassIcon, { className: classes.icon, "aria-hidden": true })), jsx("input", { ref: mergedRef, size: htmlSize, value: value ?? internalValue, disabled: disabled, className: clsx(classes.input, `fds-focus`, isSimple && classes.simple, !isSimple && classes.withSearchButton), ...omit(['size', 'error', 'errorId', 'readOnly'], rest), ...inputProps, onChange: handleChange }), showClearButton && (jsxs("button", { className: clsx(classes.clearButton, `fds-focus`), type: 'button', onClick: handleClear, disabled: disabled, children: [jsx("span", { className: `fds-sr-only`, children: clearButtonLabel }), jsx(XMarkIcon, { "aria-hidden": true })] }))] }), !isSimple && (jsx(Button, { className: classes.searchButton, size: size, variant: variant, type: 'submit', onClick: handleSearchClick, disabled: disabled, children: searchButtonLabel }))] }), jsx("div", { className: classes.errorMessage, id: errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', children: hasError && jsx(ErrorMessage, { size: size, children: props.error }) })] }) }));
|
|
45
44
|
});
|
|
46
45
|
Search.displayName = 'Search';
|
|
47
46
|
|
|
@@ -6,7 +6,6 @@ import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
|
|
|
6
6
|
import { CharacterCounter } from '../CharacterCounter.js';
|
|
7
7
|
import { useTextarea } from './useTextarea.js';
|
|
8
8
|
import classes from './Textarea.module.css.js';
|
|
9
|
-
import utilityClasses from '../../../utilities/utility.module.css.js';
|
|
10
9
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
11
10
|
import { Label } from '../../Typography/Label/Label.js';
|
|
12
11
|
import { omit } from '../../../utilities/objectUtils.js';
|
|
@@ -26,7 +25,7 @@ const Textarea = forwardRef((props, ref) => {
|
|
|
26
25
|
const characterLimitId = `${textareaProps.id}-charactercount}`;
|
|
27
26
|
const hasCharacterLimit = characterLimit != null;
|
|
28
27
|
const describedBy = clsx(textareaProps['aria-describedby'], hasCharacterLimit && characterLimitId) || undefined;
|
|
29
|
-
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { style: style, className: clsx(classes.formField, textareaProps.disabled && classes.disabled, readOnly && classes.readonly, className), children: [label && (jsxs(Label, { size: size, weight: 'medium', htmlFor: textareaProps.id, className: clsx(classes.label, hideLabel &&
|
|
28
|
+
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { style: style, className: clsx(classes.formField, textareaProps.disabled && classes.disabled, readOnly && classes.readonly, hasError && classes.error, className), children: [label && (jsxs(Label, { size: size, weight: 'medium', htmlFor: textareaProps.id, className: clsx(classes.label, hideLabel && `fds-sr-only`), children: [readOnly && (jsx(PadlockLockedFillIcon, { "aria-hidden": true, className: classes.padlock })), jsx("span", { children: label })] })), description && (jsx(Paragraph, { asChild: true, size: size, children: jsx("div", { id: descriptionId, className: clsx(classes.description, hideLabel && `fds-sr-only`), children: description }) })), jsx("textarea", { className: clsx(classes.textarea, `fds-focus`, classes[size]), ref: ref, "aria-describedby": describedBy, ...omit(['size', 'error', 'errorId'], rest), ...textareaProps, onChange: (e) => {
|
|
30
29
|
textareaProps?.onChange?.(e);
|
|
31
30
|
setValue(e.target.value);
|
|
32
31
|
} }), hasCharacterLimit && (jsx(CharacterCounter, { size: size, value: value ? value.toString() : '', id: characterLimitId, ...characterLimit })), jsx("div", { className: classes.errorMessage, id: errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', children: hasError && jsx(ErrorMessage, { size: size, children: props.error }) })] }) }));
|
|
@@ -6,7 +6,6 @@ import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
|
|
|
6
6
|
import { CharacterCounter } from '../CharacterCounter.js';
|
|
7
7
|
import { useTextfield } from './useTextfield.js';
|
|
8
8
|
import textFieldClasses from './Textfield.module.css.js';
|
|
9
|
-
import utilityClasses from '../../../utilities/utility.module.css.js';
|
|
10
9
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
11
10
|
import { Label } from '../../Typography/Label/Label.js';
|
|
12
11
|
import { omit } from '../../../utilities/objectUtils.js';
|
|
@@ -26,7 +25,7 @@ const Textfield = forwardRef((props, ref) => {
|
|
|
26
25
|
const characterLimitId = `textfield-charactercount-${useId()}`;
|
|
27
26
|
const hasCharacterLimit = characterLimit != null;
|
|
28
27
|
const describedBy = clsx(inputProps['aria-describedby'], hasCharacterLimit && characterLimitId) || undefined;
|
|
29
|
-
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { style: style, className: clsx(textFieldClasses.formField, textFieldClasses[size], inputProps.disabled && textFieldClasses.disabled, readOnly && textFieldClasses.readonly, className), children: [label && (jsxs(Label, { size: size, weight: 'medium', htmlFor: inputProps.id, className: clsx(textFieldClasses.label, hideLabel &&
|
|
28
|
+
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { style: style, className: clsx(textFieldClasses.formField, textFieldClasses[size], inputProps.disabled && textFieldClasses.disabled, readOnly && textFieldClasses.readonly, className), children: [label && (jsxs(Label, { size: size, weight: 'medium', htmlFor: inputProps.id, className: clsx(textFieldClasses.label, hideLabel && `fds-sr-only`), children: [readOnly && (jsx(PadlockLockedFillIcon, { "aria-hidden": true, className: textFieldClasses.padlock })), jsx("span", { children: label })] })), description && (jsx(Paragraph, { asChild: true, size: size, children: jsx("div", { id: descriptionId, className: clsx(textFieldClasses.description, hideLabel && `fds-sr-only`), children: description }) })), jsxs("div", { className: clsx(textFieldClasses.field, hasError && textFieldClasses.error), children: [prefix && (jsx(Paragraph, { asChild: true, size: size, short: true, children: jsx("div", { className: clsx(textFieldClasses.adornment, textFieldClasses.prefix), "aria-hidden": 'true', children: prefix }) })), jsx("input", { className: clsx(textFieldClasses.input, textFieldClasses[size], `fds-focus`, prefix && textFieldClasses.inputPrefix, suffix && textFieldClasses.inputSuffix), ref: ref, type: type, "aria-describedby": describedBy, size: htmlSize, ...omit(['size', 'error', 'errorId'], rest), ...inputProps, onChange: (e) => {
|
|
30
29
|
inputProps?.onChange?.(e);
|
|
31
30
|
setInputValue(e.target.value);
|
|
32
31
|
} }), suffix && (jsx(Paragraph, { asChild: true, size: size, short: true, children: jsx("div", { className: clsx(textFieldClasses.adornment, textFieldClasses.suffix), "aria-hidden": 'true', children: suffix }) }))] }), hasCharacterLimit && (jsx(CharacterCounter, { size: size, value: inputValue ? inputValue.toString() : '', id: characterLimitId, ...characterLimit })), jsx("div", { className: textFieldClasses.errorMessage, id: errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', children: hasError && jsx(ErrorMessage, { size: size, children: props.error }) })] }) }));
|