|
63 | 63 | choicesItemBackgroundColor = "#f3f2f1",
|
64 | 64 | choicesItemBorderColor = "#b1b4b6",
|
65 | 65 | choicesItemTextColor = "black",
|
| 66 | + choicesItemDividerPadding = "10px", |
66 | 67 | ...attributes
|
67 | 68 | }: {
|
68 | 69 | id: string;
|
|
96 | 97 | choicesItemBackgroundColor?: string;
|
97 | 98 | choicesItemBorderColor?: string;
|
98 | 99 | choicesItemTextColor?: string;
|
| 100 | + choicesItemDividerPadding?: string; |
99 | 101 | } & Omit<
|
100 | 102 | import("svelte/elements").HTMLSelectAttributes,
|
101 | 103 | | "id"
|
|
958 | 960 |
|
959 | 961 | <div
|
960 | 962 | class="gem-c-select-with-search"
|
961 |
| - style={`--cross-icon-url: url("${crossIconUrl}"); --choices-item-bg-color: ${choicesItemBackgroundColor}; --choices-item-border-color: ${choicesItemBorderColor}; --choices-item-text-color: ${choicesItemTextColor};`} |
| 963 | + style={`--cross-icon-url: url("${crossIconUrl}"); --choices-item-bg-color: ${choicesItemBackgroundColor}; --choices-item-border-color: ${choicesItemBorderColor}; --choices-item-text-color: ${choicesItemTextColor}; --choices-item-divider-padding: ${choicesItemDividerPadding};`} |
962 | 964 | >
|
963 | 965 | {#snippet rightIcon()}
|
964 | 966 | <button
|
|
1703 | 1705 | border-top-width: 2px;
|
1704 | 1706 | border-bottom-width: 0;
|
1705 | 1707 | }
|
| 1708 | +
|
| 1709 | + /* Remove the full-width divider and add pseudo-element dividers */ |
1706 | 1710 | :global(.gem-c-select-with-search .choices__list--dropdown .choices__item),
|
1707 | 1711 | :global(
|
1708 | 1712 | .gem-c-select-with-search .choices__list[aria-expanded] .choices__item
|
1709 | 1713 | ) {
|
1710 |
| - position: relative; |
1711 |
| - border-bottom: 1px solid #b1b4b6; |
| 1714 | + border-bottom: none; |
| 1715 | + position: relative; /* for the ::after divider */ |
1712 | 1716 | }
|
| 1717 | +
|
| 1718 | + /* Inset divider with configurable padding */ |
1713 | 1719 | :global(
|
1714 |
| - .gem-c-select-with-search .choices__list--dropdown .choices__item:last-child |
| 1720 | + .gem-c-select-with-search .choices__list--dropdown .choices__item::after |
1715 | 1721 | ),
|
1716 | 1722 | :global(
|
1717 | 1723 | .gem-c-select-with-search
|
1718 | 1724 | .choices__list[aria-expanded]
|
1719 |
| - .choices__item:last-child |
| 1725 | + .choices__item::after |
1720 | 1726 | ) {
|
1721 |
| - border-bottom: 0; |
| 1727 | + content: ""; |
| 1728 | + position: absolute; |
| 1729 | + left: var(--choices-item-divider-padding, 15px); |
| 1730 | + right: var(--choices-item-divider-padding, 15px); |
| 1731 | + bottom: 0; |
| 1732 | + height: 1px; |
| 1733 | + background: var(--choices-item-border-color, #b1b4b6); |
1722 | 1734 | }
|
| 1735 | +
|
| 1736 | + /* No divider on the last item */ |
| 1737 | + :global( |
| 1738 | + .gem-c-select-with-search |
| 1739 | + .choices__list--dropdown |
| 1740 | + .choices__item:last-child::after |
| 1741 | + ), |
| 1742 | + :global( |
| 1743 | + .gem-c-select-with-search |
| 1744 | + .choices__list[aria-expanded] |
| 1745 | + .choices__item:last-child::after |
| 1746 | + ) { |
| 1747 | + display: none; |
| 1748 | + } |
| 1749 | +
|
1723 | 1750 | :global(
|
1724 | 1751 | .gem-c-select-with-search
|
1725 | 1752 | .choices__list--dropdown
|
|
0 commit comments