From d06d0389b0a72c496148cbf5aad74019e7e8c24a Mon Sep 17 00:00:00 2001 From: Andrew Gliga Date: Fri, 1 Nov 2024 10:20:41 -0700 Subject: [PATCH 1/2] feat(list): added interactive radio fieldet and incremental list --- .changeset/light-pots-wink.md | 5 + dist/list/list.css | 13 + src/modules/list.marko | 632 +++++++++++++++++++++----- src/sass/list/list.scss | 17 +- src/sass/list/stories/list.stories.js | 132 ++++++ 5 files changed, 674 insertions(+), 125 deletions(-) create mode 100644 .changeset/light-pots-wink.md diff --git a/.changeset/light-pots-wink.md b/.changeset/light-pots-wink.md new file mode 100644 index 000000000..4f213a6a4 --- /dev/null +++ b/.changeset/light-pots-wink.md @@ -0,0 +1,5 @@ +--- +"@ebay/skin": minor +--- + +feat(list): added inremental list and radio fieldset in list diff --git a/dist/list/list.css b/dist/list/list.css index 084633e9a..18fa5e873 100644 --- a/dist/list/list.css +++ b/dist/list/list.css @@ -2,12 +2,15 @@ max-width: 480px; } +.list ol, .list ul { list-style: none; margin: 0; padding: 0; } +.list fieldset > *, +.list ol li > *, .list ul li > * { align-items: center; background-color: var( @@ -36,6 +39,16 @@ flex: 1; } +.list ol li { + counter-increment: item; +} + +.list ol li > :before { + content: counter(item) "."; + margin-inline-end: var(--spacing-200); + width: var(--spacing-300); +} + .list li > a, .list li > button { border: none; diff --git a/src/modules/list.marko b/src/modules/list.marko index bfa1d215e..440d8a849 100644 --- a/src/modules/list.marko +++ b/src/modules/list.marko @@ -1,17 +1,28 @@
-

A list component is used to display certain types of data in a structured format. It can be used to display a list of items, a list of links, or a list of buttons.

-

This can be placed inside a container and will resize to fit the contents. The list expands to a maxumum of 480px.

+

+ A list component is used to display certain types of data in a structured format. It can be used to display a list of items, a list of links, or a list of buttons. +

+

+ This can be placed inside a container and will resize to fit the contents. The list expands to a maxumum of 480px. +

-

Default List

-
+

+ Default List +

+
  • - @@ -23,7 +34,12 @@
  • - @@ -35,7 +51,12 @@
  • - @@ -48,13 +69,18 @@
- +
  • - @@ -66,7 +92,12 @@
  • - @@ -78,7 +109,12 @@
  • - @@ -91,16 +127,18 @@
    -

    Actionable list

    -

    List also supports buttons or links as a list item. Actionable components, such as a switch, can be added in the trailing portion of the list, but they cannot be used in conjunction with buttons or link.

    -
    +

    + Actionable list +

    +

    + List also supports buttons or links as a list item. Actionable components, such as a switch, can be added in the trailing portion of the list, but they cannot be used in conjunction with buttons or link. +

    +
  • @@ -138,13 +180,11 @@
- - -

List with dividers

-

To add a divider, add a hr element after the list item.

-
+

+ List with dividers +

+

+ To add a divider, add a + + hr + + element after the list item. +

+
  • - @@ -200,11 +257,16 @@
  • -
    +
  • - @@ -216,7 +278,12 @@
  • - @@ -230,130 +297,449 @@
-
-
    -
  • -
    - - - - - Item 1 - -
    -
  • -
    -
  • -
    - - - - - Item 2 - -
    -
    - - - - - Item with a large amount of text that should wrap and go to the next line. If there is too much it would wrap - -
    -
  • -
-
+
+
    +
  • +
    + + + + + Item 1 + +
    +
  • +
    +
  • +
    + + + + + Item 2 + +
    +
    + + + + + Item with a large amount of text that should wrap and go to the next line. If there is too much it would wrap + +
    +
  • +
+
- - -

List with variable width

+

+ List with variable width +

The list will adjust to the width of the container it is in.

-
+
+
+
    +
  • +
    + + + + + Item 1 + +
    +
  • +
  • +
    + + + + + Item 2 + + + + +
    +
  • +
+
+
+
+
+ + +
+
    +
  • +
    + + + + + Item 1 + +
    +
  • +
  • +
    + + + + + Item 2 + + + + +
    +
  • +
+
+
+

+ List with fieldset +

+

+ For an interactive list, you can add a fieldset with radios or checkboxes +

+
+
-
    -
  • -
    - -
    + + + - - Item 1 - -
    -
  • -
  • -
    - - - - Item 2 + + +
    +
    + + + - - + +
    +
    + + + -
    -
  • -
+ + +
+
-
- +
+
+ Choose an Option +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+
+
+ +

+ Ordered list +

+
+
-
    +
    1. - - - - Item 1 + Text 1
    2. - - - - Item 2 + Text 2 - - +
      +
    3. +
    4. +
      + + Text 3
    5. -
+
- +
+
+ +
+
    +
  1. +
    + + Text 1 + +
    +
  2. +
  3. +
    + + Text 2 + +
    +
  4. +
  5. +
    + + Text 3 + +
    +
  6. +
+
+
export const metadata = { "ds-component": { name: "list", version: 1.0, }, -}; \ No newline at end of file +}; diff --git a/src/sass/list/list.scss b/src/sass/list/list.scss index 1fc8bf76d..5da1f6b12 100644 --- a/src/sass/list/list.scss +++ b/src/sass/list/list.scss @@ -6,13 +6,16 @@ max-width: 480px; } -.list ul { +.list ul, +.list ol { list-style: none; margin: 0; padding: 0; } -.list ul li > * { +.list ul li > *, +.list ol li > *, +.list fieldset > * { @include background-color-token( list-background-color, color-background-primary @@ -41,6 +44,16 @@ flex: 1; } +.list ol li { + counter-increment: item; +} + +.list ol li > *::before { + content: counter(item) "."; + margin-inline-end: var(--spacing-200); + width: var(--spacing-300); +} + .list li > a, .list li > button { border: none; diff --git a/src/sass/list/stories/list.stories.js b/src/sass/list/stories/list.stories.js index 899ce8ac7..41f1d97c0 100644 --- a/src/sass/list/stories/list.stories.js +++ b/src/sass/list/stories/list.stories.js @@ -329,3 +329,135 @@ export const withDivider = () => `
`; + +export const withRadio = () => ` +
+
+ Choose an Option +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+
+`; + +export const orderedList = () => ` +
+
    +
  1. +
    + + Text 1 + +
    +
  2. +
  3. +
    + + Text 2 + +
    +
  4. +
  5. +
    + + Text 3 + +
    +
  6. +
+
+`; From 2b70fccf53427d7054633135b005109aa2c546ed Mon Sep 17 00:00:00 2001 From: Andrew Gliga Date: Fri, 1 Nov 2024 10:32:42 -0700 Subject: [PATCH 2/2] chore: review --- dist/list/list.css | 3 +-- src/sass/list/list.scss | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dist/list/list.css b/dist/list/list.css index 18fa5e873..2eab3f189 100644 --- a/dist/list/list.css +++ b/dist/list/list.css @@ -10,8 +10,7 @@ } .list fieldset > *, -.list ol li > *, -.list ul li > * { +.list li > * { align-items: center; background-color: var( --list-background-color, diff --git a/src/sass/list/list.scss b/src/sass/list/list.scss index 5da1f6b12..bd0a18a7e 100644 --- a/src/sass/list/list.scss +++ b/src/sass/list/list.scss @@ -13,8 +13,7 @@ padding: 0; } -.list ul li > *, -.list ol li > *, +.list li > *, .list fieldset > * { @include background-color-token( list-background-color,