- Render the
AppComponent
as a custom element
export class AppModule {
ngDoBootstrap(): void {
customElements.define('mg-root', createCustomIvyElement(AppComponent));
}
}
<style> | |
dna-page-header[stuck], | |
dna-tab-bar[stuck] { | |
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.2); | |
// Make sure the shadow does not bleed at the top | |
clip-path: inset(0 0 -10px 0); | |
} | |
</style> | |
<dna-page-header ${sticky()} heading="Hello world!"></dna-page-header> | |
<dna-tab-bar ${sticky({ stuckTo: 'dna-page-header' })}> |
import type { StoryObj } from '@storybook/web-components'; | |
import type { RouterLocation } from '@vaadin/router'; | |
import { html } from 'lit'; | |
import { rest } from 'msw'; | |
import { absenceNotices } from '../../data-mocks.js'; | |
import './register.js'; | |
export default { | |
title: 'Absence/Pages/Details', | |
render: ({ id }: { id: string }) => |
❯ yarn start | |
Installing Script Dependencies... | |
Task readiness up to dev | |
🟡 install > 🟡 compile > 🟡 sandbox > 🔊 dev | |
🔄 install > 🟡 compile > 🟡 sandbox > 🔊 dev | |
> yarn install | |
✅ install > 🔄 compile > 🟡 sandbox > 🔊 dev |
import type { PropertyValues, ReactiveElement } from 'lit'; | |
import type { Constructor, FormControlInterface } from '@open-wc/form-control'; | |
import { FormControlMixin as OwcFormControlMixin } from '@open-wc/form-control'; | |
export interface FormControl extends FormControlInterface { | |
labels: Set<WeakRef<Node>>; | |
} | |
let nextUniqueId = 0; |
npx -p @storybook/cli sb init --type react
(we use react so you can use JSX inside your stories)npm add @babel/plugin-syntax-import-meta @open-wc/webpack-import-meta-loader webpack-merge -D
import { defineCustomElements } from "../dist/esm/loader";
function managerEntries(entry = []) { | |
return [...entry, require.resolve('./register')]; | |
} | |
module.exports = { managerEntries }; |
export type DateParts = { year: string; month: string; day: string }; | |
export function getLocalizedDateParts(locale: string): DateParts { | |
const rtf = new Intl.RelativeTimeFormat(locale), | |
result: DateParts = { year: '', month: '', day: '' }; | |
['year', 'month', 'day'].forEach(part => { | |
const parts = rtf.formatToParts(-1, `${part}s` as Intl.RelativeTimeFormatUnit), | |
index = parts.findIndex(({ unit }) => unit === part), | |
value = parts[index + 1].value; |
module.exports = { | |
root: true, | |
env: { | |
browser: true | |
}, | |
parser: '@typescript-eslint/parser', | |
parserOptions: { | |
tsconfigRootDir: __dirname, | |
project: ['./tsconfig.json'] | |
}, |