@roadlittledawn/docs-design-system-react 0.12.1 → 0.12.2

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/USAGE.md CHANGED
@@ -529,10 +529,20 @@ import { List } from "@roadlittledawn/docs-design-system-react";
529
529
 
530
530
  ### List.Item Props
531
531
 
532
- | Prop | Type | Default | Description |
533
- | ----------- | ----------- | ------- | ---------------------- |
534
- | `children` | `ReactNode` | — | List item content |
535
- | `className` | `string` | `""` | Additional CSS classes |
532
+ | Prop | Type | Default | Description |
533
+ | ------------ | ----------- | ------- | --------------------------------------------------------------------------- |
534
+ | `children` | `ReactNode` | — | List item content |
535
+ | `className` | `string` | `""` | Additional CSS classes |
536
+ | `bulletIcon` | `ReactNode` | — | Custom bullet icon for this item. Overrides the parent `List`'s `bulletIcon` |
537
+
538
+ ### CSS classes
539
+
540
+ | Class | Element | Notes |
541
+ | ----- | ------- | ----- |
542
+ | `dds-list` | `<ol>` / `<ul>` | Root list element |
543
+ | `dds-list-item` | `<li>` | Each list item |
544
+ | `dds-list-item-content` | `<div>` | Wraps item children; target for content-level overrides |
545
+ | `dds-list-item-icon` | `<span>` | Wrapper for custom `bulletIcon` SVG/node |
536
546
 
537
547
  ### Examples
538
548
 
@@ -16,7 +16,7 @@ export interface ListItemProps {
16
16
  children: ReactNode;
17
17
  /** Additional CSS classes */
18
18
  className?: string;
19
- /** Internal: bullet icon injected by List parent for unordered lists */
19
+ /** Custom bullet icon (React node, e.g., SVG) for this item. Overrides the parent List's bulletIcon */
20
20
  bulletIcon?: ReactNode;
21
21
  }
22
22
  export declare function ListItem({ children, className, bulletIcon }: ListItemProps): import("react/jsx-runtime").JSX.Element;
@@ -15,12 +15,16 @@ function ListImpl(_a) {
15
15
  var children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b, _c = _a.ordered, ordered = _c === void 0 ? true : _c, bullet = _a.bullet, bulletIcon = _a.bulletIcon;
16
16
  var listClasses = ["dds-list", className].filter(Boolean).join(" ");
17
17
  var Element = ordered ? "ol" : "ul";
18
- return (_jsx(Element, { className: listClasses, "data-ordered": ordered, "data-has-icon": !!bulletIcon && !ordered, style: bullet && !bulletIcon
18
+ return (_jsx(Element, { className: listClasses, "data-ordered": ordered, style: bullet && !bulletIcon
19
19
  ? { "--dds-list-bullet": JSON.stringify(bullet) }
20
20
  : undefined, children: bulletIcon && !ordered
21
21
  ? React.Children.map(children, function (child) {
22
+ var _a;
22
23
  if (React.isValidElement(child) && child.type === ListItem) {
23
- return React.cloneElement(child, __assign(__assign({}, child.props), { bulletIcon: bulletIcon }));
24
+ var childProps = child.props;
25
+ return React.cloneElement(child, __assign(__assign({}, childProps), {
26
+ // Child's own bulletIcon takes precedence over the parent's
27
+ bulletIcon: (_a = childProps.bulletIcon) !== null && _a !== void 0 ? _a : bulletIcon }));
24
28
  }
25
29
  return child;
26
30
  })
@@ -29,7 +33,7 @@ function ListImpl(_a) {
29
33
  export function ListItem(_a) {
30
34
  var children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b, bulletIcon = _a.bulletIcon;
31
35
  var itemClasses = ["dds-list-item", className].filter(Boolean).join(" ");
32
- return (_jsxs("li", { className: itemClasses, children: [bulletIcon && (_jsx("span", { className: "dds-list-item-icon", "aria-hidden": "true", children: bulletIcon })), children] }));
36
+ return (_jsxs("li", { className: itemClasses, "data-has-icon": bulletIcon ? "true" : undefined, children: [bulletIcon && (_jsx("span", { className: "dds-list-item-icon", "aria-hidden": "true", children: bulletIcon })), _jsx("div", { className: "dds-list-item-content", children: children })] }));
33
37
  }
34
38
  export var List = Object.assign(ListImpl, {
35
39
  Item: ListItem,
package/dist/styles.css CHANGED
@@ -1745,7 +1745,9 @@ a.no-text-decoration {
1745
1745
  .dds-list-item {
1746
1746
  counter-increment: list-counter;
1747
1747
  position: relative;
1748
- padding-inline-start: calc(var(--dds-list-badge-size) + 1rem);
1748
+ display: flex;
1749
+ align-items: flex-start;
1750
+ gap: 1rem;
1749
1751
  margin-bottom: var(--dds-list-item-margin-bottom, 1.5rem);
1750
1752
  min-height: var(--dds-list-badge-size);
1751
1753
  }
@@ -1767,13 +1769,10 @@ a.no-text-decoration {
1767
1769
  /* Ordered list badges */
1768
1770
  .dds-list[data-ordered="true"] .dds-list-item::before {
1769
1771
  content: counter(list-counter);
1770
- position: absolute;
1771
- left: 0;
1772
- top: 0;
1772
+ flex-shrink: 0;
1773
1773
  width: var(--dds-list-badge-size, 2.5rem);
1774
1774
  height: var(--dds-list-badge-size, 2.5rem);
1775
1775
  line-height: var(--dds-line-height-relaxed);
1776
- inset-inline-start: 0;
1777
1776
  display: flex;
1778
1777
  align-items: center;
1779
1778
  justify-content: center;
@@ -1787,27 +1786,24 @@ a.no-text-decoration {
1787
1786
  /* Unordered list bullets */
1788
1787
  .dds-list[data-ordered="false"] .dds-list-item::before {
1789
1788
  content: var(--dds-list-bullet, "•");
1790
- position: absolute;
1791
- left: 0;
1792
- top: 0;
1789
+ flex-shrink: 0;
1793
1790
  width: var(--dds-list-badge-size, 2.5rem);
1794
1791
  height: var(--dds-list-badge-size, 2.5rem);
1795
- inset-inline-start: 0;
1796
1792
  display: flex;
1793
+ transform: translateY(var(--dds-list-bullet-offset, -0.1em));
1797
1794
  align-items: center;
1798
1795
  justify-content: center;
1799
- font-size: var(--dds-list-bullet-size, 1.5rem);
1796
+ font-size: var(--dds-list-bullet-size, 1.25rem);
1800
1797
  color: var(--dds-list-badge-text);
1801
1798
  }
1802
- /* Hide ::before when using custom icon */
1803
- .dds-list[data-has-icon="true"] .dds-list-item::before {
1799
+ /* Hide ::before when item has a custom icon.
1800
+ Specificity matches the show rules above (0-3-1) and comes after, so it wins. */
1801
+ .dds-list .dds-list-item[data-has-icon="true"]::before {
1804
1802
  display: none;
1805
1803
  }
1806
1804
  /* Custom icon bullet */
1807
1805
  .dds-list-item-icon {
1808
- position: absolute;
1809
- left: 0;
1810
- top: 0;
1806
+ flex-shrink: 0;
1811
1807
  width: var(--dds-list-badge-size, 2.5rem);
1812
1808
  height: var(--dds-list-badge-size, 2.5rem);
1813
1809
  display: flex;
@@ -1819,6 +1815,27 @@ a.no-text-decoration {
1819
1815
  width: 1.25rem;
1820
1816
  height: 1.25rem;
1821
1817
  }
1818
+ /* Content wrapper — flex child that fills remaining space */
1819
+ .dds-list-item-content {
1820
+ flex: 1;
1821
+ min-width: 0;
1822
+ }
1823
+ /* Neutralize consuming-site typography margins that would misalign the badge.
1824
+ The list item's own margin/padding controls spacing — not the children's. */
1825
+ .dds-list-item-content > :first-child {
1826
+ margin-top: 0;
1827
+ }
1828
+ .dds-list-item-content > :last-child {
1829
+ margin-bottom: 0;
1830
+ }
1831
+ /* For unordered lists, vertically center the content within the li so the first
1832
+ text line's center aligns with the bullet/icon center.
1833
+ margin-block: auto distributes remaining space evenly above and below the
1834
+ content span, so its midpoint always lands at badge-size/2 — the same as the
1835
+ bullet center — regardless of font-size or line-height. */
1836
+ .dds-list[data-ordered="false"] .dds-list-item-content {
1837
+ margin-block: auto;
1838
+ }
1822
1839
  /* ==========================================================================
1823
1840
  Popover Component
1824
1841
  Uses the native Popover API for top-layer rendering.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roadlittledawn/docs-design-system-react",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "license": "MIT",
5
5
  "description": "React components for documentation design system",
6
6
  "repository": {