@bonniernews/dn-design-system-web 36.0.0 → 37.0.1
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/CHANGELOG.md +25 -0
- package/components/list-item/README.md +8 -7
- package/components/list-item/list-item-types.ts +35 -18
- package/foundations/variables/colorsCssVariables.scss +1 -0
- package/foundations/variables/colorsDnDark.scss +2 -1
- package/foundations/variables/colorsDnLight.scss +2 -1
- package/package.json +1 -1
- package/preact/components/icon-with-wrapper/icon-with-wrapper.js +1 -0
- package/preact/components/icon-with-wrapper/icon-with-wrapper.js.map +2 -2
- package/preact/components/list-item/list-item-types.d.ts +18 -15
- package/preact/components/list-item/list-item.js +68 -121
- package/preact/components/list-item/list-item.js.map +4 -4
- package/types-lib/ds-color.d.ts +1 -0
- package/variables/colors-css-variables.json +1 -0
- package/variables/colors-dark-mode.json +2 -1
- package/variables/colors-light-mode.json +2 -1
|
@@ -326,54 +326,8 @@ var SwitchInner = ({ showMeta, metaOn, metaOff, componentClassName }) => {
|
|
|
326
326
|
] });
|
|
327
327
|
};
|
|
328
328
|
|
|
329
|
-
// ../src/components/radio-button-group/radio-button-group.tsx
|
|
330
|
-
import { Fragment as Fragment3 } from "preact";
|
|
331
|
-
import { jsx as jsx9, jsxs as jsxs6 } from "preact/jsx-runtime";
|
|
332
|
-
var RadioButtonGroup = ({
|
|
333
|
-
buttons,
|
|
334
|
-
error,
|
|
335
|
-
name,
|
|
336
|
-
errorMessage,
|
|
337
|
-
required,
|
|
338
|
-
stripLabel,
|
|
339
|
-
disabled,
|
|
340
|
-
forcePx,
|
|
341
|
-
classNames
|
|
342
|
-
}) => {
|
|
343
|
-
const radioButtonClassName = "ds-radio-btn";
|
|
344
|
-
const wrapperClasses = formatClassString(["ds-radio-btn-group", forcePx && "ds-force-px", classNames]);
|
|
345
|
-
return /* @__PURE__ */ jsx9(form_field_default, { error, errorMessage, wrapperClasses, children: buttons?.map((button) => {
|
|
346
|
-
const { id, selected, value, label, attributes } = button;
|
|
347
|
-
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
348
|
-
/* @__PURE__ */ jsx9(
|
|
349
|
-
"input",
|
|
350
|
-
{
|
|
351
|
-
type: "radio",
|
|
352
|
-
id,
|
|
353
|
-
name,
|
|
354
|
-
defaultChecked: selected,
|
|
355
|
-
disabled,
|
|
356
|
-
required,
|
|
357
|
-
value,
|
|
358
|
-
...attributes
|
|
359
|
-
}
|
|
360
|
-
),
|
|
361
|
-
stripLabel ? /* @__PURE__ */ jsx9("div", { className: `${radioButtonClassName}__inner`, children: /* @__PURE__ */ jsx9(RadioButtonIcons, { radioButtonClassName }) }) : /* @__PURE__ */ jsxs6("label", { className: `${radioButtonClassName}__inner`, htmlFor: id, children: [
|
|
362
|
-
/* @__PURE__ */ jsx9(RadioButtonIcons, { radioButtonClassName }),
|
|
363
|
-
label && /* @__PURE__ */ jsx9("span", { className: `${radioButtonClassName}__text`, children: label })
|
|
364
|
-
] })
|
|
365
|
-
] }, id);
|
|
366
|
-
}) });
|
|
367
|
-
};
|
|
368
|
-
var RadioButtonIcons = ({ radioButtonClassName }) => {
|
|
369
|
-
return /* @__PURE__ */ jsxs6("span", { className: `${radioButtonClassName}__icon`, children: [
|
|
370
|
-
/* @__PURE__ */ jsx9(IconUse, { iconName: "radio_button_unchecked" }),
|
|
371
|
-
/* @__PURE__ */ jsx9(IconUse, { iconName: "radio_button_checked" })
|
|
372
|
-
] });
|
|
373
|
-
};
|
|
374
|
-
|
|
375
329
|
// ../src/components/list-item/list-item.tsx
|
|
376
|
-
import { Fragment as
|
|
330
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs6 } from "preact/jsx-runtime";
|
|
377
331
|
var ListItem = (props) => {
|
|
378
332
|
const {
|
|
379
333
|
listItemType,
|
|
@@ -383,6 +337,8 @@ var ListItem = (props) => {
|
|
|
383
337
|
border = false,
|
|
384
338
|
fontWeight = "regular",
|
|
385
339
|
attributes,
|
|
340
|
+
linkAttributes,
|
|
341
|
+
disabled,
|
|
386
342
|
forcePx,
|
|
387
343
|
classNames
|
|
388
344
|
} = props;
|
|
@@ -408,21 +364,24 @@ var ListItem = (props) => {
|
|
|
408
364
|
}
|
|
409
365
|
}
|
|
410
366
|
const mediaHtml = listItemType === "image" && props.mediaHtml;
|
|
411
|
-
return /* @__PURE__ */
|
|
412
|
-
iconLeftSvg && /* @__PURE__ */
|
|
413
|
-
mediaHtml && /* @__PURE__ */
|
|
414
|
-
title && /* @__PURE__ */
|
|
367
|
+
return /* @__PURE__ */ jsx9("li", { className: classes, children: /* @__PURE__ */ jsxs6(ListItemInner, { ...{ ...props, componentClassName }, children: [
|
|
368
|
+
iconLeftSvg && /* @__PURE__ */ jsx9("span", { className: `${componentClassName}__icon-left`, children: iconLeftSvg }),
|
|
369
|
+
mediaHtml && /* @__PURE__ */ jsx9("div", { className: `${componentClassName}__image`, dangerouslySetInnerHTML: { __html: mediaHtml } }),
|
|
370
|
+
title && /* @__PURE__ */ jsx9(
|
|
415
371
|
Title,
|
|
416
372
|
{
|
|
417
373
|
title,
|
|
418
374
|
subtitle,
|
|
375
|
+
titleHref: listItemType === "toggle" && props.titleHref || void 0,
|
|
419
376
|
fontWeight,
|
|
420
377
|
componentClassName,
|
|
421
|
-
|
|
378
|
+
disabled,
|
|
379
|
+
attributes,
|
|
380
|
+
linkAttributes
|
|
422
381
|
}
|
|
423
382
|
),
|
|
424
|
-
meta && /* @__PURE__ */
|
|
425
|
-
iconRightSvg && /* @__PURE__ */
|
|
383
|
+
meta && /* @__PURE__ */ jsx9("span", { className: `${componentClassName}__meta`, children: meta }),
|
|
384
|
+
iconRightSvg && /* @__PURE__ */ jsx9("span", { className: `${componentClassName}__icon-right`, children: iconRightSvg })
|
|
426
385
|
] }) });
|
|
427
386
|
};
|
|
428
387
|
var ListItemInner = ({
|
|
@@ -430,14 +389,15 @@ var ListItemInner = ({
|
|
|
430
389
|
href,
|
|
431
390
|
disabled,
|
|
432
391
|
attributes,
|
|
392
|
+
linkAttributes,
|
|
393
|
+
interactiveElementAttributes,
|
|
394
|
+
interactiveElementClassNames,
|
|
433
395
|
checked,
|
|
434
396
|
selected,
|
|
435
|
-
value,
|
|
436
397
|
variant,
|
|
437
398
|
toggleText,
|
|
438
399
|
toggleSelectedText,
|
|
439
400
|
name = "ds-list-item",
|
|
440
|
-
id = "ds-list-item",
|
|
441
401
|
forcePx,
|
|
442
402
|
componentClassName,
|
|
443
403
|
accordionContent,
|
|
@@ -452,104 +412,91 @@ var ListItemInner = ({
|
|
|
452
412
|
case "standard":
|
|
453
413
|
case "image":
|
|
454
414
|
const hasLink = href && !disabled;
|
|
455
|
-
return /* @__PURE__ */
|
|
415
|
+
return /* @__PURE__ */ jsx9(Fragment3, { children: hasLink ? /* @__PURE__ */ jsx9("a", { className: classes, href, ...linkAttributes, children }) : /* @__PURE__ */ jsx9("button", { className: classes, disabled, ...attributes, children }) });
|
|
456
416
|
case "checkbox":
|
|
457
|
-
return /* @__PURE__ */
|
|
458
|
-
/* @__PURE__ */
|
|
417
|
+
return /* @__PURE__ */ jsxs6("label", { className: classes, htmlFor: name, ...attributes, children: [
|
|
418
|
+
/* @__PURE__ */ jsx9(ListItemIconWrapper, { placement: "left", componentClassName, children: /* @__PURE__ */ jsx9(
|
|
459
419
|
checkbox_default,
|
|
460
420
|
{
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
) }),
|
|
471
|
-
children
|
|
472
|
-
] });
|
|
473
|
-
case "radio":
|
|
474
|
-
return /* @__PURE__ */ jsxs7("label", { className: classes, htmlFor: id, ...attributes, children: [
|
|
475
|
-
/* @__PURE__ */ jsx10(ListItemIconWrapper, { placement: "left", componentClassName, children: /* @__PURE__ */ jsx10(
|
|
476
|
-
RadioButtonGroup,
|
|
477
|
-
{
|
|
478
|
-
...{
|
|
479
|
-
id,
|
|
480
|
-
name,
|
|
481
|
-
disabled,
|
|
482
|
-
selected,
|
|
483
|
-
forcePx,
|
|
484
|
-
buttons: [{ id, selected, value: value || "" }],
|
|
485
|
-
attributes
|
|
486
|
-
}
|
|
421
|
+
name,
|
|
422
|
+
checked,
|
|
423
|
+
stripLabel: true,
|
|
424
|
+
disabled,
|
|
425
|
+
forcePx,
|
|
426
|
+
attributes: interactiveElementAttributes,
|
|
427
|
+
classNames: interactiveElementClassNames
|
|
487
428
|
}
|
|
488
429
|
) }),
|
|
489
430
|
children
|
|
490
431
|
] });
|
|
491
432
|
case "switch":
|
|
492
|
-
return /* @__PURE__ */
|
|
433
|
+
return /* @__PURE__ */ jsxs6("label", { className: classes, htmlFor: name, ...attributes, children: [
|
|
493
434
|
children,
|
|
494
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ jsx9(ListItemIconWrapper, { placement: "right", componentClassName, children: /* @__PURE__ */ jsx9(
|
|
495
436
|
Switch,
|
|
496
437
|
{
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}
|
|
438
|
+
name,
|
|
439
|
+
showMeta: true,
|
|
440
|
+
checked,
|
|
441
|
+
disabled,
|
|
442
|
+
forcePx,
|
|
443
|
+
stripLabel: true,
|
|
444
|
+
attributes: interactiveElementAttributes,
|
|
445
|
+
classNames: interactiveElementClassNames
|
|
506
446
|
}
|
|
507
447
|
) })
|
|
508
448
|
] });
|
|
509
449
|
case "accordion":
|
|
510
|
-
return /* @__PURE__ */
|
|
511
|
-
/* @__PURE__ */
|
|
450
|
+
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
451
|
+
/* @__PURE__ */ jsxs6("button", { className: classes, disabled, ...attributes, children: [
|
|
512
452
|
children,
|
|
513
|
-
/* @__PURE__ */
|
|
514
|
-
/* @__PURE__ */
|
|
515
|
-
/* @__PURE__ */
|
|
453
|
+
/* @__PURE__ */ jsxs6(ListItemIconWrapper, { placement: "right", componentClassName, children: [
|
|
454
|
+
/* @__PURE__ */ jsx9(IconUse, { iconName: "expand_less" }),
|
|
455
|
+
/* @__PURE__ */ jsx9(IconUse, { iconName: "expand_more" })
|
|
516
456
|
] })
|
|
517
457
|
] }),
|
|
518
|
-
accordionContent && /* @__PURE__ */
|
|
458
|
+
accordionContent && /* @__PURE__ */ jsx9("div", { className: `${componentClassName}__accordion-inner`, children: accordionContent })
|
|
519
459
|
] });
|
|
520
460
|
case "toggle":
|
|
521
|
-
const buttonComponent = /* @__PURE__ */
|
|
461
|
+
const buttonComponent = /* @__PURE__ */ jsx9(
|
|
522
462
|
button_toggle_default,
|
|
523
463
|
{
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
}
|
|
464
|
+
text: toggleText,
|
|
465
|
+
selectedText: toggleSelectedText || "",
|
|
466
|
+
variant: variant || "secondaryFilled",
|
|
467
|
+
size: "sm",
|
|
468
|
+
selected,
|
|
469
|
+
disabled,
|
|
470
|
+
forcePx,
|
|
471
|
+
attributes: interactiveElementAttributes,
|
|
472
|
+
classNames: interactiveElementClassNames
|
|
534
473
|
}
|
|
535
474
|
);
|
|
536
|
-
return /* @__PURE__ */
|
|
475
|
+
return /* @__PURE__ */ jsxs6("div", { className: classes, ...attributes, children: [
|
|
537
476
|
children,
|
|
538
477
|
buttonComponent
|
|
539
478
|
] });
|
|
540
479
|
default:
|
|
541
|
-
return /* @__PURE__ */
|
|
480
|
+
return /* @__PURE__ */ jsx9("div", { className: classes, ...attributes, children });
|
|
542
481
|
}
|
|
543
482
|
};
|
|
544
|
-
var Title = ({
|
|
545
|
-
|
|
483
|
+
var Title = ({
|
|
484
|
+
title,
|
|
485
|
+
subtitle,
|
|
486
|
+
titleHref,
|
|
487
|
+
fontWeight,
|
|
488
|
+
disabled,
|
|
489
|
+
attributes,
|
|
490
|
+
linkAttributes,
|
|
491
|
+
componentClassName
|
|
492
|
+
}) => {
|
|
546
493
|
const titleClasses = formatClassString([
|
|
547
494
|
`${componentClassName}__title`,
|
|
548
495
|
`${componentClassName}__title--${fontWeight}`
|
|
549
496
|
]);
|
|
550
|
-
return /* @__PURE__ */
|
|
551
|
-
/* @__PURE__ */
|
|
552
|
-
subtitle && /* @__PURE__ */
|
|
497
|
+
return /* @__PURE__ */ jsxs6("div", { className: `${componentClassName}__titles`, children: [
|
|
498
|
+
titleHref && !disabled ? /* @__PURE__ */ jsx9("a", { class: titleClasses, href: titleHref, ...linkAttributes, children: title }) : /* @__PURE__ */ jsx9("span", { className: titleClasses, ...attributes, children: title }),
|
|
499
|
+
subtitle && /* @__PURE__ */ jsx9("span", { className: `${componentClassName}__subtitle`, children: subtitle })
|
|
553
500
|
] });
|
|
554
501
|
};
|
|
555
502
|
var ListItemIconWrapper = ({
|
|
@@ -557,7 +504,7 @@ var ListItemIconWrapper = ({
|
|
|
557
504
|
componentClassName,
|
|
558
505
|
children
|
|
559
506
|
}) => {
|
|
560
|
-
return /* @__PURE__ */
|
|
507
|
+
return /* @__PURE__ */ jsx9("div", { className: `${componentClassName}__icon-${placement}`, children });
|
|
561
508
|
};
|
|
562
509
|
export {
|
|
563
510
|
ListItem
|