UNPKG

@postnord/web-components

Version:
132 lines (131 loc) 4.99 kB
import { SE, DK, FI, NO, sv, en, da, fi, no } from './helpers'; import * as colors from 'pn-design-assets/pn-assets/colors.js'; export interface PnUploadFileItem { uuid: string; filename: string; filesize: number; progress: number; status: 'queue' | 'start' | 'completed' | 'error'; base64: string; contentType: string; error: any; errorMessage: string; file: File; xhr: XMLHttpRequest; xhrPromise?: () => Promise<any>; } export type PnMarkets = '' | typeof SE | typeof DK | typeof FI | typeof NO; export type PnLanguages = '' | typeof sv | typeof en | typeof da | typeof fi | typeof no; export type PnButtonAppearance = '' | 'light' | 'warning'; export type PnButtonVariant = '' | 'outlined' | 'borderless'; export type PnColors = keyof typeof colors; /** @deprecated Its just numbers now. */ export type PnSteps = number; export type PnStepProps = 'totalSteps' | 'currentStep'; export interface PnTopbar { hasLoaded: boolean; market: PnMarkets; language: PnLanguages; } export interface PnMultiselectSubOption { /** Set the label for the option, **required**. */ label: string; /** Set the value for the option, **required**. */ value: string; /** Set the status of the option, **required**. */ checked: boolean; /** Display a helpertext for the option, optional. */ helpertext?: string; /** Display an icon for the option. optional. */ icon?: string; /** Use a custom HTML id, optional. */ id?: string; /** Invalid */ invalid?: boolean; /** Set the option as disabled, optional. */ disabled?: boolean; /** Internal use for the search feature. Do not use manually. */ hide?: boolean; } export interface PnMultiselectOption extends PnMultiselectSubOption { /** The list of items that will be nested under this option. */ group?: PnMultiselectSubOption[]; } /** This is the default option. A `label` and `value` is required. */ export interface PnActionMenuOption { /** The label of the button. */ label: string; /** * Used as a unique identifier when toggling the menus. * Also acts as the value for the checkbox/radio if the `input` prop is used. **/ value: string; /** Set a custom SVG icon for the option. */ icon?: string; /** Set a custom SVG icon that appears as a suffix. */ trailingIcon?: string; /** Set a short `string` suffix for the option. */ suffix?: string; /** Disable the button. @see Requires {@link PnActionMenuInput.input input} or default button. */ disabled?: boolean; /** Display a helpertext for the option. Has no effect on {@link PnActionMenuLink}. */ helpertext?: string; } /** Create a link inside the action menu. */ export interface PnActionMenuLink extends PnActionMenuOption { /** Setting a `href` will turn the option into a link option. **/ href?: string; /** Set the `href` target. The value `_blank` will add the `open_in_new` icon automatically. @see **Requires** {@link href} */ target?: string; } /** Allow the user to toggle the option with the {@link PnActionMenuInput.input input} prop. */ export interface PnActionMenuInput extends PnActionMenuOption { /** Turn the option into a `checkbox` or `radio` button. */ input?: 'checkbox' | 'radio'; /** Pre-check the option. @see **Requires** {@link input} */ checked?: boolean; /** The `name` property used for the input. @see **Requires** {@link input} */ name?: string; } /** Create a group of options. */ export interface PnActionMenuGroup extends PnActionMenuOption { /** * Create a collection of `PnActionMenuOption`s. This group will be visible without the need to toggle. * @see {@link label} will act as the label for this collection. Not a separate button. */ group?: PnActionMenuItem[]; } /** Create a nested sub menu that you must explicitly toggle to view. */ export interface PnActionMenuSubMenu extends PnActionMenuOption { /** Assign the array of {@link PnActionMenuItem} objects. */ options?: PnActionMenuItem[]; } /** * The label and value property are required for every `pn-action-menu` option. * * See individual items for exact type: * - {@link PnActionMenuOption} * - {@link PnActionMenuLink} * - {@link PnActionMenuInput} * * Group multiple items inside one of the following: * - {@link PnActionMenuGroup} * - {@link PnActionMenuSubMenu} */ export interface PnActionMenuItem extends PnActionMenuOption, PnActionMenuLink, PnActionMenuInput, PnActionMenuGroup, PnActionMenuSubMenu { } export interface PnPaginationItem { page: number; index: number; } export type PnZipCodeSearchLanguages = '' | typeof sv | typeof en; export type PnMeasurements = { /** The elements height upwards. */ hUp: number; /** The elements height downwards. */ hDown: number; /** Space available upwards */ sUp: number; /** Space available downwards */ sDown: number; };