Skip to content

Commit

Permalink
🐧
Browse files Browse the repository at this point in the history
  • Loading branch information
jpzwarte committed Oct 25, 2024
1 parent 125546d commit 1c19b94
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 124 deletions.
7 changes: 7 additions & 0 deletions .changeset/nice-games-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@sl-design-system/listbox': patch
---

Various improvements:
- Support `<option>` and `<optgroup>` elements in addition to `<sl-option>` and `<sl-option-group>` inside `<sl-listbox>`
- Override `textContent` in `<sl-option>` to return only the text directly inside the element
8 changes: 8 additions & 0 deletions .changeset/thirty-kings-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@sl-design-system/combobox': patch
---

Various improvements:
- For improved performance, also support `<option>` and `<optgroup>`
- Scroll to the selected option when opening the popover in single mode
- Actually toggle the popover when clicking the button
6 changes: 2 additions & 4 deletions packages/components/listbox/src/listbox.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { type IconLibrary } from '@sl-design-system/icon';
import { Config } from '@sl-design-system/shared';
import { type CSSResultGroup, LitElement, type TemplateResult, html } from 'lit';
import styles from './listbox.scss.js';

Expand All @@ -15,13 +13,13 @@ export class Listbox extends LitElement {

#lightStyles?: HTMLStyleElement;

override async connectedCallback(): Promise<void> {
override connectedCallback(): void {
super.connectedCallback();

this.setAttribute('role', 'listbox');

if (!this.#lightStyles) {
const { check } = await Config.getConfigSetting<IconLibrary>('icons');
const { check } = window.SLDS.icons;

this.#lightStyles = document.createElement('style');
this.#lightStyles.textContent = `
Expand Down
8 changes: 2 additions & 6 deletions packages/themes/bingel-dc/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { IconLibrary } from '@sl-design-system/icon';
import { Icon } from '@sl-design-system/icon';
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { icons } from './icons.js';

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
Icon.register(icons as IconLibrary);
};
8 changes: 2 additions & 6 deletions packages/themes/bingel-int/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { IconLibrary } from '@sl-design-system/icon';
import { Icon } from '@sl-design-system/icon';
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { icons } from './icons.js';

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
Icon.register(icons as IconLibrary);
};
8 changes: 2 additions & 6 deletions packages/themes/clickedu/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { IconLibrary } from '@sl-design-system/icon';
import { Icon } from '@sl-design-system/icon';
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { icons } from './icons.js';

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
Icon.register(icons as IconLibrary);
};
25 changes: 2 additions & 23 deletions packages/themes/editorial-suite/index.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
import type { IconLibrary } from '@sl-design-system/icon';
import { Icon } from '@sl-design-system/icon';
import type { ConfigSettings } from '@sl-design-system/shared';
import { Config } from '@sl-design-system/shared';
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { icons } from './icons.js';

// export const setup = (): void => {
// 1. Add typekit url to `<head>`
// 2. Add theme icons
// 3. Load the base stylesheet/css variables
// 4. Start using the SLDS in your application
// };

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
const config: ConfigSettings = {
avatar: {
shape: 'circle',
badgeGapWidth: 2
}
};

Icon.register(icons as IconLibrary);
Config.setConfig(config);
};
8 changes: 2 additions & 6 deletions packages/themes/itslearning/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { IconLibrary } from '@sl-design-system/icon';
import { Icon } from '@sl-design-system/icon';
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { icons } from './icons.js';

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
Icon.register(icons as IconLibrary);
};
8 changes: 2 additions & 6 deletions packages/themes/kampus/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { IconLibrary } from '@sl-design-system/icon';
import { Icon } from '@sl-design-system/icon';
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { icons } from './icons.js';

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
Icon.register(icons as IconLibrary);
};
8 changes: 2 additions & 6 deletions packages/themes/magister/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { IconLibrary } from '@sl-design-system/icon';
import { Icon } from '@sl-design-system/icon';
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { icons } from './icons.js';

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
Icon.register(icons as IconLibrary);
};
8 changes: 2 additions & 6 deletions packages/themes/max/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { IconLibrary } from '@sl-design-system/icon';
import { Icon } from '@sl-design-system/icon';
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { icons } from './icons.js';

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
Icon.register(icons as IconLibrary);
};
8 changes: 2 additions & 6 deletions packages/themes/my-digital-book/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { IconLibrary } from '@sl-design-system/icon';
import { Icon } from '@sl-design-system/icon';
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { icons } from './icons.js';

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
Icon.register(icons as IconLibrary);
};
8 changes: 2 additions & 6 deletions packages/themes/myvanin_onhold/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { IconLibrary } from '@sl-design-system/icon';
import { Icon } from '@sl-design-system/icon';
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { icons } from './icons.js';

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
Icon.register(icons as IconLibrary);
};
8 changes: 2 additions & 6 deletions packages/themes/neon/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { IconLibrary } from '@sl-design-system/icon';
import { Icon } from '@sl-design-system/icon';
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { icons } from './icons.js';

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
Icon.register(icons as IconLibrary);
};
22 changes: 1 addition & 21 deletions packages/themes/sanoma-learning/index.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { Config, type ConfigSettings } from '@sl-design-system/shared';
import { icons } from './icons.js';

// export const setup = (): void => {
// 1. Add typekit url to `<head>`
// 2. Add theme icons
// 3. Load the base stylesheet/css variables
// 4. Start using the SLDS in your application
// };

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
const config: ConfigSettings = {
avatar: {
shape: 'circle',
badgeGapWidth: 2
},
icons
};

Icon.register(icons as IconLibrary);
Config.setConfig(config);
};
6 changes: 1 addition & 5 deletions packages/themes/sanoma-utbildning_onhold/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { icons } from './icons.js';

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
console.log('register Icons');
Icon.register(icons as IconLibrary);
};
12 changes: 1 addition & 11 deletions packages/themes/teas/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import { Icon, type IconLibrary } from '@sl-design-system/icon';
import { icons } from './icons.js';

// export const setup = (): void => {
// 1. Add typekit url to `<head>`
// 2. Add theme icons
// 3. Load the base stylesheet/css variables
// 4. Start using the SLDS in your application
// };

/**
* initializes all necessary things to load your theme,
* like icons, ...
*/
/** Setup the theme. */
export const setup = (): void => {
Icon.register(icons as IconLibrary);
};

0 comments on commit 1c19b94

Please sign in to comment.