@randstad-uca/design-system 1.0.120 → 1.0.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,10 @@
1
1
  import { LitElement } from 'lit';
2
2
  import './Icon';
3
- import '../styles/buttons.css';
4
3
  export declare class RandstadBubble extends LitElement {
5
4
  message: string;
6
5
  duration?: number;
7
6
  position: 'top' | 'bottom';
8
- variant: 'bubble' | 'circle';
7
+ variant: 'bubble' | 'circle' | 'plain';
9
8
  visible: boolean;
10
9
  icon?: string;
11
10
  arrowAlign: string;
@@ -1,5 +1,4 @@
1
1
  import { LitElement } from 'lit';
2
- import '../styles/buttons.css';
3
2
  export declare class RandstadButton extends LitElement {
4
3
  type: 'button' | 'submit' | 'reset';
5
4
  variant: 'button-primary' | 'button-secondary' | 'button-tertiary' | 'button-round' | 'button-card' | 'button-icon' | 'button-danger';
@@ -0,0 +1,52 @@
1
+ import { LitElement } from 'lit';
2
+ import type { TemplateResult } from 'lit';
3
+ import type { FilterBarItem, SortDirection } from '../helpers/filterBarUtils';
4
+ import './Button';
5
+ import './Icon';
6
+ export declare class FilterBar extends LitElement {
7
+ items: readonly FilterBarItem[];
8
+ selectedValue: string;
9
+ sortDirection: SortDirection;
10
+ disabled: boolean;
11
+ label: string;
12
+ /**
13
+ * `justify-content` applied inline on `.container`. Empty (default) keeps
14
+ * the stylesheet value (`flex-start`). Non-empty values are validated
15
+ * against the CSS keyword allowlist before rendering; unknown values fall
16
+ * back to the stylesheet default.
17
+ */
18
+ justifyContent: string;
19
+ /**
20
+ * Elevates `.items` with a neumorphic shadow for sticky/fixed layouts.
21
+ * The consumer toggles it to reflect the bar's positioning state.
22
+ */
23
+ sticky: boolean;
24
+ private validatedItems;
25
+ private internalSelected;
26
+ private countsHidden;
27
+ private resizeObserver;
28
+ private pendingFocusValue;
29
+ static styles: import("lit").CSSResult;
30
+ protected willUpdate(changed: Map<PropertyKey, unknown>): void;
31
+ firstUpdated(changed: Map<PropertyKey, unknown>): void;
32
+ connectedCallback(): void;
33
+ protected updated(changed: Map<PropertyKey, unknown>): void;
34
+ disconnectedCallback(): void;
35
+ private observeItems;
36
+ private measureCounts;
37
+ private focusItemByValue;
38
+ private selectItem;
39
+ private handleItemKeydown;
40
+ private handleSortClick;
41
+ private renderItem;
42
+ private renderSortButton;
43
+ render(): TemplateResult;
44
+ }
45
+ /**
46
+ * Legacy alias for `<randstad-filter-bar>`: it keeps existing consumers of the
47
+ * original `<filter-bar>` tag working without breaking changes. A custom
48
+ * element constructor cannot be registered twice, hence the subclass.
49
+ * Prefer `<randstad-filter-bar>` in new code.
50
+ */
51
+ export declare class LegacyFilterBar extends FilterBar {
52
+ }
@@ -0,0 +1,42 @@
1
+ export type SortDirection = 'asc' | 'desc';
2
+ export interface FilterBarItem<TValue extends string = string> {
3
+ readonly value: TValue;
4
+ readonly label: string;
5
+ readonly count?: number;
6
+ readonly disabled?: boolean;
7
+ }
8
+ export interface FilterChangeEventDetail<TValue extends string = string> {
9
+ readonly value: TValue;
10
+ readonly item: FilterBarItem<TValue>;
11
+ }
12
+ export interface SortChangeEventDetail {
13
+ readonly direction: SortDirection;
14
+ }
15
+ export interface FilterBarEventMap<TValue extends string = string> {
16
+ 'filter-change': CustomEvent<FilterChangeEventDetail<TValue>>;
17
+ 'sort-change': CustomEvent<SortChangeEventDetail>;
18
+ }
19
+ export type FilterBarEventDetail<TKey extends keyof FilterBarEventMap> = FilterBarEventMap[TKey] extends CustomEvent<infer TDetail> ? TDetail : never;
20
+ export interface FilterBarProps<TValue extends string = string> {
21
+ readonly items: readonly FilterBarItem<TValue>[];
22
+ readonly selectedValue: string;
23
+ readonly sortDirection: SortDirection;
24
+ readonly disabled: boolean;
25
+ readonly label: string;
26
+ readonly justifyContent: string;
27
+ readonly sticky: boolean;
28
+ }
29
+ export declare function isFilterBarItem(value: unknown): value is FilterBarItem;
30
+ export declare function parseFilterItems(input: unknown): readonly FilterBarItem[];
31
+ export declare function resolveSelectedValue(items: readonly FilterBarItem[], requested: string | undefined): string | undefined;
32
+ export declare function toggleSortDirection(direction: SortDirection): SortDirection;
33
+ export declare function coerceSortDirection(value: unknown): SortDirection;
34
+ export declare function formatCount(count: number | undefined): string;
35
+ export declare function shouldHideCounts(scrollWidth: number, clientWidth: number): boolean;
36
+ /**
37
+ * Validates a consumer-provided `justify-content` value before it is written
38
+ * into the container's inline `style`. Anything that is not a single CSS
39
+ * keyword (e.g. `"center;background-image:url(...)"`) is rejected and the
40
+ * stylesheet default is kept.
41
+ */
42
+ export declare function normalizeJustifyContent(value: unknown): string;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- import './styles/colors.css';
2
- import './styles/fonts.css';
3
- import './styles/buttons.css';
4
1
  export * from './helpers/BaseControl';
5
2
  export * from './components/Accordion';
6
3
  export * from './components/AccordionList';
@@ -21,6 +18,8 @@ export * from './components/Snackbar';
21
18
  export * from './components/Stepper';
22
19
  export * from './components/Tabs';
23
20
  export * from './components/Upload';
21
+ export * from './components/FilterBar';
22
+ export * from './helpers/filterBarUtils';
24
23
  export * from './components/DatePicker';
25
24
  export * from './components/CalendarOverlay';
26
25
  export * from './components/File';