Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC: UHF-X: poc hds web components #666

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ node_modules/**/*
webpack.config.js
webpack.config.dev.js
webpack.config.build.js
# TODO: remove this when POC phase is over
src/js/hds-web-component-lib/**/*
1,201 changes: 1,201 additions & 0 deletions dist/js/Accordion-c73b97d8.min.js

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions dist/js/IconAngleUp-2e1d15ac.min.js

Large diffs are not rendered by default.

1,201 changes: 1,201 additions & 0 deletions dist/js/hds-accordion.min.js

Large diffs are not rendered by default.

1,201 changes: 1,201 additions & 0 deletions dist/js/index.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions hdbt.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,8 @@ hyphenopoly:
dist/js/hyphenopoly/Hyphenopoly_Loader.js: {
preprocess: false
}

hds-accordion:
version: 1.x
js:
dist/js/hds-accordion.min.js: {}
170 changes: 170 additions & 0 deletions src/js/hds-web-component-lib/Accordion-c73b97d8.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
/// <reference types="react" />
import { LitElement, PropertyValueMap } from 'lit';
// FIXME: This is just a copy of the file in packages/react/src/components/accordion
type Language = "en" | "fi" | "sv";
interface AccordionCustomTheme {
"--background-color"?: string;
"--border-color"?: string;
"--padding-horizontal"?: string;
"--padding-vertical"?: string;
"--header-font-color"?: string;
"--header-font-size"?: string;
"--header-line-height"?: string;
"--button-size"?: string;
"--header-focus-outline-color"?: string;
"--content-font-size"?: string;
"--content-line-height"?: string;
}
type CommonAccordionProps = React.PropsWithChildren<{
/**
* If `true` border will be drawn around the accordion card.
*/
border?: false;
/**
* Use the card variant if `true`
*/
card?: false;
/**
* Additional class names for accordion
*/
className?: string;
/**
* Boolean indicating whether there is a close button at the bottom of the accordion or not.
* @Default true
*/
closeButton?: boolean;
/**
* className for close button to enable custom styling
*/
closeButtonClassName?: string;
/**
* Heading text.
*/
heading?: string;
/**
* Heading level
* @default 2
*/
headingLevel?: number;
/**
* The id for the accordion element
*/
id?: string;
/**
* Boolean indicating whether the accordion is initially opened.
* @default false
*/
initiallyOpen?: boolean;
/**
* The language of the component. It affects which language is used for the close button text.
*
* @default "fi"
*/
language?: Language;
/**
* Size
* @default m
*/
size?: "s" | "m" | "l";
/**
* Additional styles
*/
style?: React.CSSProperties;
/**
* Custom theme styles
*/
theme?: AccordionCustomTheme;
}>;
type CardAccordionProps = Omit<CommonAccordionProps, "card" | "border"> & {
/**
* If `true` border will be drawn around the accordion card.
*/
border?: boolean;
/**
* Use the card variant if `true`
*/
card: true;
};
type AccordionProps = CommonAccordionProps | CardAccordionProps;
declare class AccordionHTMLElement extends LitElement {
id: string;
card: boolean;
border: boolean;
children: HTMLCollection;
language: Language;
heading: string;
headingLevel: number;
isOpen: boolean;
closeButton: boolean;
closeButtonClassName: string;
size: string;
theme?: AccordionCustomTheme;
static readonly styles: import("lit").CSSResult[];
static get properties(): {
id: {
type: StringConstructor;
};
card: {
type: BooleanConstructor;
converter: {
fromAttribute: (value: any) => boolean;
toAttribute: (value: any) => string;
};
};
border: {
type: BooleanConstructor;
converter: {
fromAttribute: (value: any) => boolean;
toAttribute: (value: any) => string;
};
};
children: {
type: {
new (): HTMLCollection;
prototype: HTMLCollection;
};
};
language: {
type: StringConstructor;
};
heading: {
type: StringConstructor;
};
headingLevel: {
type: NumberConstructor;
};
isOpen: {
type: BooleanConstructor;
converter: {
fromAttribute: (value: any) => boolean;
toAttribute: (value: any) => string;
};
};
closeButton: {
type: BooleanConstructor;
converter: {
fromAttribute: (value: any) => boolean;
toAttribute: (value: any) => string;
};
};
closeButtonClassName: {
type: StringConstructor;
};
size: {
type: StringConstructor;
};
};
identifierPrefix: string;
private get identifiers();
toggleOpen: () => void;
hasCloseButton: () => boolean;
protected willUpdate(_changedProperties: PropertyValueMap<unknown> | Map<PropertyKey, unknown>): void;
render(): import("lit-html").TemplateResult<1>;
private renderCloseButton;
}
declare global {
interface HTMLElementTagNameMap {
'hds-accordion': AccordionHTMLElement;
}
}
export { Language, AccordionCustomTheme, CommonAccordionProps, CardAccordionProps, AccordionProps, AccordionHTMLElement as default };
10,839 changes: 10,839 additions & 0 deletions src/js/hds-web-component-lib/Accordion-c73b97d8.js

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions src/js/hds-web-component-lib/IconAngleUp-2e1d15ac.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { LitElement } from 'lit';
declare class IconAngleUp extends LitElement {
size: string;
static readonly styles: import("lit").CSSResult[];
static get properties(): {
size: {
type: StringConstructor;
};
};
render(): import("lit-html").TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'hds-icon-angle-up': IconAngleUp;
}
}
export { IconAngleUp };
Loading