@bonniernews/dn-design-system-web 35.0.0 → 37.0.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/CHANGELOG.md +36 -0
- package/components/list-item/README.md +8 -7
- package/components/list-item/list-item-types.ts +35 -18
- package/components/list-item/list-item.njk +0 -14
- package/components/list-item/list-item.scss +1 -1
- package/components/{radio-button → radio-button-group}/README.md +18 -11
- package/components/{radio-button/radio-button.scss → radio-button-group/radio-button-group.scss} +2 -2
- package/package.json +1 -1
- package/preact/components/list-item/list-item-types.d.ts +18 -15
- package/preact/components/list-item/list-item.js +78 -131
- package/preact/components/list-item/list-item.js.map +4 -4
- package/preact/components/{radio-button/radio-button.d.ts → radio-button-group/radio-button-group.d.ts} +9 -8
- package/preact/components/{radio-button/radio-button.js → radio-button-group/radio-button-group.js} +12 -12
- package/preact/components/radio-button-group/radio-button-group.js.map +7 -0
- package/components/radio-button/README-njk.md +0 -49
- package/components/radio-button/radio-button.njk +0 -47
- package/preact/components/radio-button/radio-button.js.map +0 -7
|
@@ -264,54 +264,8 @@ var CheckboxIcons = ({ componentClassName }) => {
|
|
|
264
264
|
};
|
|
265
265
|
var checkbox_default = Checkbox;
|
|
266
266
|
|
|
267
|
-
// ../src/components/radio-button/radio-button.tsx
|
|
268
|
-
import { Fragment as Fragment2 } from "preact";
|
|
269
|
-
import { jsx as jsx8, jsxs as jsxs5 } from "preact/jsx-runtime";
|
|
270
|
-
var RadioButton = ({
|
|
271
|
-
buttons,
|
|
272
|
-
error,
|
|
273
|
-
name,
|
|
274
|
-
errorMessage,
|
|
275
|
-
required,
|
|
276
|
-
stripLabel,
|
|
277
|
-
disabled,
|
|
278
|
-
forcePx,
|
|
279
|
-
classNames
|
|
280
|
-
}) => {
|
|
281
|
-
const componentClassName = "ds-radio-btn";
|
|
282
|
-
const wrapperClasses = formatClassString([componentClassName, forcePx && "ds-force-px", classNames]);
|
|
283
|
-
return /* @__PURE__ */ jsx8(form_field_default, { error, errorMessage, wrapperClasses, children: buttons?.map((button) => {
|
|
284
|
-
const { id, selected, value, label, attributes } = button;
|
|
285
|
-
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
286
|
-
/* @__PURE__ */ jsx8(
|
|
287
|
-
"input",
|
|
288
|
-
{
|
|
289
|
-
type: "radio",
|
|
290
|
-
id,
|
|
291
|
-
name,
|
|
292
|
-
defaultChecked: selected,
|
|
293
|
-
disabled,
|
|
294
|
-
required,
|
|
295
|
-
value,
|
|
296
|
-
...attributes
|
|
297
|
-
}
|
|
298
|
-
),
|
|
299
|
-
stripLabel ? /* @__PURE__ */ jsx8("div", { className: `${componentClassName}__inner`, children: /* @__PURE__ */ jsx8(RadioButtonIcons, { componentClassName }) }) : /* @__PURE__ */ jsxs5("label", { className: `${componentClassName}__inner`, htmlFor: id, children: [
|
|
300
|
-
/* @__PURE__ */ jsx8(RadioButtonIcons, { componentClassName }),
|
|
301
|
-
label && /* @__PURE__ */ jsx8("span", { className: `${componentClassName}__text`, children: label })
|
|
302
|
-
] })
|
|
303
|
-
] }, id);
|
|
304
|
-
}) });
|
|
305
|
-
};
|
|
306
|
-
var RadioButtonIcons = ({ componentClassName }) => {
|
|
307
|
-
return /* @__PURE__ */ jsxs5("span", { className: `${componentClassName}__icon`, children: [
|
|
308
|
-
/* @__PURE__ */ jsx8(IconUse, { iconName: "radio_button_unchecked" }),
|
|
309
|
-
/* @__PURE__ */ jsx8(IconUse, { iconName: "radio_button_checked" })
|
|
310
|
-
] });
|
|
311
|
-
};
|
|
312
|
-
|
|
313
267
|
// ../src/components/switch/switch.tsx
|
|
314
|
-
import { Fragment as
|
|
268
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs5 } from "preact/jsx-runtime";
|
|
315
269
|
var Switch = ({
|
|
316
270
|
name = "ds-switch",
|
|
317
271
|
checked,
|
|
@@ -326,8 +280,8 @@ var Switch = ({
|
|
|
326
280
|
}) => {
|
|
327
281
|
const componentClassName = "ds-switch";
|
|
328
282
|
const classes = formatClassString([componentClassName, forcePx && "ds-force-px", classNames]);
|
|
329
|
-
return /* @__PURE__ */
|
|
330
|
-
/* @__PURE__ */
|
|
283
|
+
return /* @__PURE__ */ jsxs5("div", { className: classes, children: [
|
|
284
|
+
/* @__PURE__ */ jsx8(
|
|
331
285
|
"input",
|
|
332
286
|
{
|
|
333
287
|
type: "checkbox",
|
|
@@ -339,7 +293,7 @@ var Switch = ({
|
|
|
339
293
|
...attributes
|
|
340
294
|
}
|
|
341
295
|
),
|
|
342
|
-
stripLabel ? /* @__PURE__ */
|
|
296
|
+
stripLabel ? /* @__PURE__ */ jsx8("div", { className: `${componentClassName}__inner`, children: /* @__PURE__ */ jsx8(
|
|
343
297
|
SwitchInner,
|
|
344
298
|
{
|
|
345
299
|
...{
|
|
@@ -349,7 +303,7 @@ var Switch = ({
|
|
|
349
303
|
componentClassName
|
|
350
304
|
}
|
|
351
305
|
}
|
|
352
|
-
) }) : /* @__PURE__ */
|
|
306
|
+
) }) : /* @__PURE__ */ jsx8("label", { className: `${componentClassName}__inner`, tabIndex: 0, htmlFor: name, children: /* @__PURE__ */ jsx8(
|
|
353
307
|
SwitchInner,
|
|
354
308
|
{
|
|
355
309
|
...{
|
|
@@ -363,17 +317,17 @@ var Switch = ({
|
|
|
363
317
|
] });
|
|
364
318
|
};
|
|
365
319
|
var SwitchInner = ({ showMeta, metaOn, metaOff, componentClassName }) => {
|
|
366
|
-
return /* @__PURE__ */
|
|
367
|
-
showMeta && /* @__PURE__ */
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */
|
|
320
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
321
|
+
showMeta && /* @__PURE__ */ jsxs5("div", { className: `${componentClassName}__meta`, children: [
|
|
322
|
+
/* @__PURE__ */ jsx8("span", { className: `${componentClassName}__meta-on`, children: metaOn }),
|
|
323
|
+
/* @__PURE__ */ jsx8("span", { className: `${componentClassName}__meta-off`, children: metaOff })
|
|
370
324
|
] }),
|
|
371
|
-
/* @__PURE__ */
|
|
325
|
+
/* @__PURE__ */ jsx8("span", { className: `${componentClassName}__box`, children: /* @__PURE__ */ jsx8("span", { className: `${componentClassName}__knob` }) })
|
|
372
326
|
] });
|
|
373
327
|
};
|
|
374
328
|
|
|
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
|
-
RadioButton,
|
|
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
|