Skip to content

Commit

Permalink
fix: 🐛 implemented font-feature-settings for all components (#243)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Dan Büschlen <danbueschlen@gmail.com>
  • Loading branch information
resmartiZH and daenub authored Nov 25, 2024
1 parent 11950f1 commit 4ce502f
Show file tree
Hide file tree
Showing 42 changed files with 36 additions and 84 deletions.
2 changes: 1 addition & 1 deletion scripts/generate-component/templates/[Name].js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import styles from "./[name].css"
* @tagname [namespace]-[name]
*/
export class Leu[Name] extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

static shadowRootOptions = {
...LeuElement.shadowRootOptions,
Expand Down
5 changes: 0 additions & 5 deletions scripts/generate-component/templates/[name].css
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
:host,
:host * {
box-sizing: border-box;
}

:host {
--[name]-font-regular: var(--leu-font-family-regular);
--[name]-font-black: var(--leu-font-family-black);
Expand Down
2 changes: 1 addition & 1 deletion src/components/accordion/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import styles from "./accordion.css"
* @attr {string} label-prefix - The prefix of the accordion label. e.g. "01"
*/
export class LeuAccordion extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

/** @internal */
static shadowRootOptions = {
Expand Down
7 changes: 1 addition & 6 deletions src/components/accordion/accordion.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
@import url("../../styles/custom-media.css");

:host,
:host * {
box-sizing: border-box;
}

:host {
--accordion-font-regular: var(--leu-font-family-regular);
--accordion-font-black: var(--leu-font-family-black);
Expand All @@ -19,7 +14,7 @@

--transition: 0.1s ease;

font-family: var(--chip-font-regular);
font-family: var(--accordion-font-regular);

position: relative;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/breadcrumb/Breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class LeuBreadcrumb extends LeuElement {
"leu-visually-hidden": LeuVisuallyHidden,
}

static styles = styles
static styles = [LeuElement.styles, styles]

static properties = {
items: { type: Array },
Expand Down
5 changes: 0 additions & 5 deletions src/components/breadcrumb/breadcrumb.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
:host,
:host * {
box-sizing: border-box;
}

:host {
--breadcrumb-font-regular: var(--leu-font-family-regular);
--breadcrumb-font-black: var(--leu-font-family-black);
Expand Down
2 changes: 1 addition & 1 deletion src/components/button-group/ButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import styles from "./button-group.css"
* @fires input - When the value of the group changes by clicking a button
*/
export class LeuButtonGroup extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

constructor() {
super()
Expand Down
5 changes: 0 additions & 5 deletions src/components/button-group/button-group.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
:host,
:host * {
box-sizing: border-box;
}

.group {
display: flex;
gap: 0.5rem;
Expand Down
2 changes: 1 addition & 1 deletion src/components/button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class LeuButton extends LeuElement {
"leu-icon": LeuIcon,
}

static styles = styles
static styles = [LeuElement.styles, styles]

/**
* @internal
Expand Down
2 changes: 1 addition & 1 deletion src/components/checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class LeuCheckbox extends LeuElement {
"leu-icon": LeuIcon,
}

static styles = styles
static styles = [LeuElement.styles, styles]

/** @internal */
static shadowRootOptions = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/checkbox/CheckboxGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import styles from "./checkbox-group.css"
* @tagname leu-checkbox-group
*/
export class LeuCheckboxGroup extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

static properties = {
orientation: { type: String, reflect: true },
Expand Down
2 changes: 1 addition & 1 deletion src/components/chip/Chip.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styles from "./chip.css"
/* Design: https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=21161-184433&mode=design&t=Kjo5VDiqivihn8dh-11 */

export class LeuChipBase extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

/** @internal */
static shadowRootOptions = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/chip/ChipGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const SELECTION_MODES = Object.freeze({
* @tagname leu-chip-group
*/
export class LeuChipGroup extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

static properties = {
inverted: { type: Boolean, reflect: true },
Expand Down
2 changes: 0 additions & 2 deletions src/components/chip/chip.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
:host,
:host *,
:host *::before,
:host *::after {
box-sizing: border-box;
Expand Down
2 changes: 1 addition & 1 deletion src/components/dialog/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class LeuDialog extends LeuElement {
"leu-icon": LeuIcon,
}

static styles = styles
static styles = [LeuElement.styles, styles]

static shadowRootOptions = {
...LeuElement.shadowRootOptions,
Expand Down
5 changes: 0 additions & 5 deletions src/components/dialog/dialog.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

/* figma https://www.figma.com/design/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?node-id=21161-186812&t=8VgDy9avMRG5aL7s-0 */

:host,
:host * {
box-sizing: border-box;
}

:host {
--dialog-font-regular: var(--leu-font-family-regular);
--dialog-font-black: var(--leu-font-family-black);
Expand Down
2 changes: 1 addition & 1 deletion src/components/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class LeuDropdown extends LeuElement {
"leu-popup": LeuPopup,
}

static styles = styles
static styles = [LeuElement.styles, styles]

static properties = {
label: { type: String, reflect: true },
Expand Down
5 changes: 0 additions & 5 deletions src/components/dropdown/dropdown.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
:host,
:host * {
box-sizing: border-box;
}

:host {
position: relative;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/icon/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { paths } from "./paths.js"
* @cssprop --leu-icon-size - The size of the icon.
*/
export class LeuIcon extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

static properties = {
name: { type: String, reflect: true },
Expand Down
2 changes: 1 addition & 1 deletion src/components/input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class LeuInput extends LeuElement {
"leu-icon": LeuIcon,
}

static styles = styles
static styles = [LeuElement.styles, styles]

/**
* @internal
Expand Down
5 changes: 0 additions & 5 deletions src/components/input/input.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
:host,
:host * {
box-sizing: border-box;
}

:host {
--input-color: var(--leu-color-black-100);
--input-color-disabled: var(--leu-color-black-20);
Expand Down
2 changes: 1 addition & 1 deletion src/components/menu/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import styles from "./menu.css"
* @property {SelectsType} selects - This has only an effect when the role is 'menu'. It defines which role the menu items will get. Default is 'none'.
*/
export class LeuMenu extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

static shadowRootOptions = {
...LeuElement.shadowRootOptions,
Expand Down
2 changes: 1 addition & 1 deletion src/components/menu/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class LeuMenuItem extends LeuElement {
"leu-icon": LeuIcon,
}

static styles = styles
static styles = [LeuElement.styles, styles]

/**
* @internal
Expand Down
5 changes: 0 additions & 5 deletions src/components/menu/menu-item.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
:host,
:host * {
box-sizing: border-box;
}

:host {
--background: var(--leu-color-black-0);
--background-hover: var(--leu-color-black-10);
Expand Down
5 changes: 0 additions & 5 deletions src/components/menu/menu.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
:host,
:host * {
box-sizing: border-box;
}

:host {
--menu-divider-color: var(--leu-color-black-transp-20);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/pagination/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class LeuPagination extends LeuElement {
"leu-visually-hidden": LeuVisuallyHidden,
}

static styles = styles
static styles = [LeuElement.styles, styles]

/**
* @internal
Expand Down
2 changes: 1 addition & 1 deletion src/components/popup/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import styles from "./popup.css"
* @tagname leu-popup
*/
export class LeuPopup extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

static shadowRootOptions = {
...LeuElement.shadowRootOptions,
Expand Down
5 changes: 0 additions & 5 deletions src/components/popup/popup.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
:host,
:host * {
box-sizing: border-box;
}

:host {
--popup-font-regular: var(--leu-font-family-regular);
--popup-font-black: var(--leu-font-family-black);
Expand Down
2 changes: 1 addition & 1 deletion src/components/radio/Radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import styles from "./radio.css"
* @tagname leu-radio
*/
export class LeuRadio extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

/** @internal */
static shadowRootOptions = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/radio/RadioGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import styles from "./radio-group.css"
* @tagname leu-radio-group
*/
export class LeuRadioGroup extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

static properties = {
orientation: { type: String, reflect: true },
Expand Down
2 changes: 1 addition & 1 deletion src/components/range/Range.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const RANGE_LABELS = ["Von", "Bis"]
* @tagname leu-range
*/
export class LeuRange extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

static shadowRootOptions = {
...LeuElement.shadowRootOptions,
Expand Down
1 change: 0 additions & 1 deletion src/components/range/range.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
--range-font-black: var(--leu-font-family-black);

display: block;
box-sizing: border-box;

font-family: var(--range-font-regular);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/scroll-top/ScrollTop.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class LeuScrollTop extends LeuElement {
"leu-icon": LeuIcon,
}

static styles = styles
static styles = [LeuElement.styles, styles]

static properties = {
_showButton: { state: true },
Expand Down
2 changes: 1 addition & 1 deletion src/components/select/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class LeuSelect extends LeuElement {
"leu-popup": LeuPopup,
}

static styles = styles
static styles = [LeuElement.styles, styles]

static get properties() {
return {
Expand Down
5 changes: 0 additions & 5 deletions src/components/select/select.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
:host,
:host * {
box-sizing: border-box;
}

:host {
--select-color: var(--leu-color-black-100);
--select-color-disabled: var(--leu-color-black-20);
Expand Down
2 changes: 1 addition & 1 deletion src/components/spinner/Spinner.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import styles from "./spinner.css"
* @cssprop --leu-spinner-size - The size of the spinner.
*/
export class LeuSpinner extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

render() {
return html`
Expand Down
2 changes: 1 addition & 1 deletion src/components/table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class LeuTable extends LeuElement {
"leu-pagination": LeuPagination,
}

static styles = styles
static styles = [LeuElement.styles, styles]

static properties = {
columns: { type: Array },
Expand Down
2 changes: 1 addition & 1 deletion src/components/visually-hidden/VisuallyHidden.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import styles from "./visually-hidden.css"
* @tagname leu-visually-hidden
*/
export class LeuVisuallyHidden extends LeuElement {
static styles = styles
static styles = [LeuElement.styles, styles]

render() {
return html`<slot></slot>`
Expand Down
3 changes: 3 additions & 0 deletions src/lib/LeuElement.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { LitElement } from "lit"
import commonStyles from "../styles/common-styles.css"

export class LeuElement extends LitElement {
static version = __LEU_VERSION__

static dependencies = {}

static styles = commonStyles

static define(name, constructor = this, options = {}) {
Object.entries(this.dependencies).forEach(([n, c]) => c.define(n))

Expand Down
5 changes: 5 additions & 0 deletions src/styles/common-styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:host,
:host * {
box-sizing: border-box;
font-feature-settings: var(--leu-t-font-feature-settings);
}
1 change: 1 addition & 0 deletions src/styles/style.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function Template() {
background-color: var(--leu-color-black-5);
font-family: var(--leu-font-family-regular);
font-feature-settings: var(--leu-t-font-feature-settings);
}
.container div {
Expand Down
1 change: 1 addition & 0 deletions web-dev-server.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
mimeTypes: {
"**/custom-elements.json": "js",
"src/components/**/*.css": "js",
"src/styles/common-styles.css": "js",
},
plugins: [...plugins, json()],
})

0 comments on commit 4ce502f

Please sign in to comment.