@nova-design-system/nova-react 3.20.0 → 3.21.0

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.
Files changed (66) hide show
  1. package/dist/cjs/generated/components.server.js +14 -2
  2. package/dist/cjs/{index-BObVnP12.js → index-yxDlFA78.js} +636 -347
  3. package/dist/cjs/index.js +2 -1
  4. package/dist/cjs/{nv-accordion-item.entry-BBAGkmLI.js → nv-accordion-item.entry-5DF2ffDE.js} +1 -1
  5. package/dist/cjs/{nv-accordion.entry-CvvtdLIz.js → nv-accordion.entry-CPB1HBT1.js} +1 -1
  6. package/dist/cjs/{nv-alert.entry-w5XeFsrC.js → nv-alert.entry-jPxt1obA.js} +1 -1
  7. package/dist/cjs/{nv-avatar.entry-BxUZg-8h.js → nv-avatar.entry-zmnREEN-.js} +1 -1
  8. package/dist/cjs/{nv-badge_2.entry-DdSIFlJf.js → nv-badge_2.entry-DtkQx_M9.js} +1 -1
  9. package/dist/cjs/{nv-breadcrumb.entry-CmbqGw3C.js → nv-breadcrumb.entry-DHAe5FxQ.js} +1 -1
  10. package/dist/cjs/{nv-breadcrumbs.entry-DFHxtPKv.js → nv-breadcrumbs.entry-C7XepUqF.js} +1 -1
  11. package/dist/cjs/nv-button.entry-Dg1knj3Y.js +164 -0
  12. package/dist/cjs/{nv-buttongroup.entry-wn9zFd_M.js → nv-buttongroup.entry-Dlim9p8N.js} +1 -1
  13. package/dist/cjs/{nv-calendar.entry-Dldsa6dz.js → nv-calendar.entry-rL5_GdQg.js} +1 -1
  14. package/dist/cjs/{nv-col.entry-DnG79KM1.js → nv-col.entry-CnbFx7h1.js} +1 -1
  15. package/dist/cjs/{nv-datagrid.entry-C2ML-e47.js → nv-datagrid.entry-CjUfR4ha.js} +3 -3
  16. package/dist/cjs/{nv-datagridcolumn.entry-DcMPUtQS.js → nv-datagridcolumn.entry-BiuYIp4q.js} +1 -1
  17. package/dist/cjs/{nv-dialog.entry-C0Vx7dQc.js → nv-dialog.entry-fDywe5i2.js} +2 -2
  18. package/dist/cjs/{nv-dialogfooter_2.entry-BGq8Jiib.js → nv-dialogfooter_2.entry-CckfZ_QW.js} +1 -1
  19. package/dist/cjs/{nv-fieldcheckbox.entry-CAPwYnSU.js → nv-fieldcheckbox.entry-WmfLxGad.js} +1 -1
  20. package/dist/cjs/{nv-fielddate.entry-Byt5cmQi.js → nv-fielddate.entry-GLGb7tzu.js} +1 -1
  21. package/dist/cjs/{nv-fielddaterange.entry-CCFeFP2q.js → nv-fielddaterange.entry-C8gXNY2P.js} +1 -1
  22. package/dist/cjs/{nv-fielddropdown.entry-BFp_2vBC.js → nv-fielddropdown.entry-BX1V8Uef.js} +1 -1
  23. package/dist/cjs/{nv-fielddropdownitem.entry-D_4KdBY1.js → nv-fielddropdownitem.entry-BMVFbA1v.js} +1 -1
  24. package/dist/cjs/{nv-fieldmultiselect.entry-BaUD7Dcr.js → nv-fieldmultiselect.entry-BuV-qWbu.js} +1 -1
  25. package/dist/cjs/{nv-fieldnumber.entry-DOmhBrDv.js → nv-fieldnumber.entry-qM1ct5SM.js} +1 -1
  26. package/dist/cjs/{nv-fieldpassword.entry-hogiPC5z.js → nv-fieldpassword.entry-BnGWErFQ.js} +1 -1
  27. package/dist/cjs/{nv-fieldradio.entry-CKbyWpIK.js → nv-fieldradio.entry-EliQYldW.js} +1 -1
  28. package/dist/cjs/{nv-fieldselect.entry-tpURNUEP.js → nv-fieldselect.entry-BfPVPmaZ.js} +1 -1
  29. package/dist/cjs/{nv-fieldslider.entry-v0d92XEY.js → nv-fieldslider.entry-DBPpL94x.js} +1 -1
  30. package/dist/cjs/{nv-fieldtext.entry-DNYrOAhj.js → nv-fieldtext.entry-BnabKYgq.js} +1 -1
  31. package/dist/cjs/{nv-fieldtextarea.entry-cRsjPwwR.js → nv-fieldtextarea.entry-HaELAnJb.js} +1 -1
  32. package/dist/cjs/{nv-fieldtime.entry-BpGBUfKr.js → nv-fieldtime.entry-CWQM7fza.js} +1 -1
  33. package/dist/cjs/nv-icon.entry-B5cWNyvf.js +80 -0
  34. package/dist/cjs/{nv-iconbutton_2.entry-DOv1RrkS.js → nv-iconbutton_2.entry-CP1o9IVZ.js} +7 -2
  35. package/dist/cjs/{nv-menu.entry-C2L8F-nG.js → nv-menu.entry-wMwI_sZ3.js} +1 -1
  36. package/dist/cjs/{nv-menuitem.entry-DuDZTlJ1.js → nv-menuitem.entry-C53TrB0_.js} +1 -1
  37. package/dist/cjs/{nv-notification.entry-DxAj-mc7.js → nv-notification.entry-BPyEusqt.js} +1 -1
  38. package/dist/cjs/{nv-notificationcontainer.entry-CUnTicXF.js → nv-notificationcontainer.entry-MRIJURIS.js} +1 -1
  39. package/dist/cjs/{nv-popover.entry-DVwa4DvW.js → nv-popover.entry-fj50OLMu.js} +1 -1
  40. package/dist/cjs/{nv-row.entry-iLk2UglX.js → nv-row.entry-T0OlcSij.js} +1 -1
  41. package/dist/cjs/{nv-split.entry-BrMHK6TS.js → nv-split.entry-DlI7I6Tb.js} +1 -1
  42. package/dist/cjs/{nv-stack.entry-C8jLJ5Ki.js → nv-stack.entry-991A3rOk.js} +1 -1
  43. package/dist/cjs/{nv-table.entry-D6o4g9Vo.js → nv-table.entry-ClSU3-cR.js} +1 -1
  44. package/dist/cjs/nv-tableheader.entry-DzvbPDBN.js +75 -0
  45. package/dist/cjs/{nv-toggle.entry-9iwmu7qi.js → nv-toggle.entry-Dq5hAoVB.js} +3 -3
  46. package/dist/cjs/nv-togglebutton.entry-DI8HQ5Ou.js +56 -0
  47. package/dist/cjs/{nv-togglebuttongroup.entry-DWCytOhV.js → nv-togglebuttongroup.entry-DzGOSBF7.js} +2 -2
  48. package/dist/cjs/{nv-tooltip.entry-BMxnZVYA.js → nv-tooltip.entry-CF0-gdZL.js} +2 -2
  49. package/dist/components/{NvDatatable.js → NvDatatable/NvDatatable.js} +88 -46
  50. package/dist/components/NvDatatable/index.js +3 -0
  51. package/dist/components/NvDatatable/types.js +1 -0
  52. package/dist/components/NvDatatable/utils.js +5 -0
  53. package/dist/generated/components.js +8 -0
  54. package/dist/generated/components.server.js +13 -2
  55. package/dist/providers/NotificationProvider.js +27 -0
  56. package/dist/types/components/NvDatatable/NvDatatable.d.ts +7 -0
  57. package/dist/types/components/NvDatatable/index.d.ts +3 -0
  58. package/dist/types/components/{NvDatatable.d.ts → NvDatatable/types.d.ts} +18 -8
  59. package/dist/types/components/NvDatatable/utils.d.ts +2 -0
  60. package/dist/types/generated/components.d.ts +5 -0
  61. package/dist/types/generated/components.server.d.ts +5 -0
  62. package/dist/types/providers/NotificationProvider.d.ts +1 -0
  63. package/package.json +1 -1
  64. package/dist/cjs/nv-button.entry-Dyks6_mF.js +0 -159
  65. package/dist/cjs/nv-icon.entry-BfmyacWA.js +0 -80
  66. package/dist/cjs/nv-togglebutton.entry-N7_CSvzS.js +0 -56
@@ -1,15 +1,10 @@
1
- import React, { type ComponentProps } from 'react';
2
- import { type NoInfer } from '@tanstack/react-table';
3
- declare function NvDatatable<T>({ columns, rows, pagination, renderPagination, stickyHeader, ...htmlProps }: NvDatatableProps<T>): React.JSX.Element;
4
- declare namespace NvDatatable {
5
- var displayName: string;
6
- }
7
- export { NvDatatable };
8
- export declare function makeColumn<Row>(): <K extends keyof Row, F = Row[K]>(col: NvDatatableColumn<Row, K, F>) => NvDatatableColumn<Row, keyof Row, Row[keyof Row]>;
1
+ import type { ComponentProps } from 'react';
2
+ import type { SortingFn, NoInfer, SortingState } from '@tanstack/react-table';
9
3
  export type NvDatatableProps<T> = {
10
4
  columns: Array<NvDatatableColumn<T>>;
11
5
  rows: Array<T>;
12
6
  pagination?: NvDatatablePaginationConfig;
7
+ sorting?: NvDatatableSortingConfig;
13
8
  renderPagination?: (api: NvDatatableRenderPaginationAPI) => React.ReactNode;
14
9
  stickyHeader?: boolean;
15
10
  } & Pick<ComponentProps<'div'>, 'className' | 'style'>;
@@ -21,6 +16,11 @@ export interface NvDatatableColumn<Row, K extends keyof Row = keyof Row, F = Row
21
16
  hidden?: boolean;
22
17
  valueFormatter?: (params: NvTableValueFormatterParams<Row, Row[K], K>) => F;
23
18
  renderCell?: (params: NvTableRenderCellParams<Row, F, K>) => React.ReactNode;
19
+ sortable?: boolean;
20
+ sortingFn?: SortingFn<Row> | string;
21
+ sortDescFirst?: boolean;
22
+ invertSorting?: boolean;
23
+ sortUndefined?: 'first' | 'last' | false | -1 | 1;
24
24
  }
25
25
  export interface NvTableRenderCellParams<Row, Value, Field> {
26
26
  value: Value | NoInfer<Value>;
@@ -64,3 +64,13 @@ export interface NvDatatableRenderPaginationAPI {
64
64
  isLoading?: boolean;
65
65
  hasMore?: boolean;
66
66
  }
67
+ export type NvDataTableSortingState = SortingState;
68
+ export interface NvDatatableSortingConfig {
69
+ mode: 'client' | 'server';
70
+ enableMultiSort?: boolean;
71
+ enableSortingRemoval?: boolean;
72
+ maxMultiSortColCount?: number;
73
+ sortDescFirst?: boolean;
74
+ sortState?: NvDataTableSortingState;
75
+ onSortingChange?: (sorting: SortingState) => void;
76
+ }
@@ -0,0 +1,2 @@
1
+ import type { NvDatatableColumn } from './types';
2
+ export declare function makeColumn<Row>(): <K extends keyof Row, F = Row[K]>(col: NvDatatableColumn<Row, K, F>) => NvDatatableColumn<Row, keyof Row, Row[keyof Row]>;
@@ -42,6 +42,7 @@ import { NvRow as NvRowElement } from "@nova-design-system/nova-webcomponents/di
42
42
  import { NvSplit as NvSplitElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-split.js";
43
43
  import { NvStack as NvStackElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-stack.js";
44
44
  import { NvTable as NvTableElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-table.js";
45
+ import { NvTableheader as NvTableheaderElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-tableheader.js";
45
46
  import { NvToggle as NvToggleElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-toggle.js";
46
47
  import { NvTogglebutton as NvTogglebuttonElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-togglebutton.js";
47
48
  import { NvTogglebuttongroup as NvTogglebuttongroupElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-togglebuttongroup.js";
@@ -228,6 +229,10 @@ export type NvStackEvents = NonNullable<unknown>;
228
229
  export declare const NvStack: StencilReactComponent<NvStackElement, NvStackEvents>;
229
230
  export type NvTableEvents = NonNullable<unknown>;
230
231
  export declare const NvTable: StencilReactComponent<NvTableElement, NvTableEvents>;
232
+ export type NvTableheaderEvents = {
233
+ onSortDirectionChanged: EventName<CustomEvent<string>>;
234
+ };
235
+ export declare const NvTableheader: StencilReactComponent<NvTableheaderElement, NvTableheaderEvents>;
231
236
  export type NvToggleEvents = {
232
237
  onCheckedChanged: EventName<CustomEvent<boolean>>;
233
238
  };
@@ -42,6 +42,7 @@ import { NvRow as NvRowElement } from "@nova-design-system/nova-webcomponents/di
42
42
  import { NvSplit as NvSplitElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-split.js";
43
43
  import { NvStack as NvStackElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-stack.js";
44
44
  import { NvTable as NvTableElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-table.js";
45
+ import { NvTableheader as NvTableheaderElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-tableheader.js";
45
46
  import { NvToggle as NvToggleElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-toggle.js";
46
47
  import { NvTogglebutton as NvTogglebuttonElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-togglebutton.js";
47
48
  import { NvTogglebuttongroup as NvTogglebuttongroupElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-togglebuttongroup.js";
@@ -230,6 +231,10 @@ export type NvStackEvents = NonNullable<unknown>;
230
231
  export declare const NvStack: StencilReactComponent<NvStackElement, NvStackEvents>;
231
232
  export type NvTableEvents = NonNullable<unknown>;
232
233
  export declare const NvTable: StencilReactComponent<NvTableElement, NvTableEvents>;
234
+ export type NvTableheaderEvents = {
235
+ onSortDirectionChanged: EventName<CustomEvent<string>>;
236
+ };
237
+ export declare const NvTableheader: StencilReactComponent<NvTableheaderElement, NvTableheaderEvents>;
233
238
  export type NvToggleEvents = {
234
239
  onCheckedChanged: EventName<CustomEvent<boolean>>;
235
240
  };
@@ -14,6 +14,7 @@ export interface NotificationOptions {
14
14
  icon?: string;
15
15
  actions?: NotificationAction[];
16
16
  actionSlot?: React.ReactElement;
17
+ duration?: number;
17
18
  }
18
19
  export interface Notification extends NotificationOptions {
19
20
  createdAt: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nova-design-system/nova-react",
3
- "version": "3.20.0",
3
+ "version": "3.21.0",
4
4
  "description": "Nova is a design system created by Elia Group to empower creators to efficiently build solutions that people love to use.",
5
5
  "author": "Elia Group",
6
6
  "homepage": "https://nova.eliagroup.io",
@@ -1,159 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('./index-BObVnP12.js');
4
- var constants69bafca2 = require('./constants-69bafca2-DpB_ghPF.js');
5
- require('react');
6
- require('react-dom');
7
-
8
- const nvButtonCss = "nv-button{text-decoration:none;display:inline-flex;justify-content:center;align-items:center;font-style:normal;font-weight:var(--font-weight-medium-emphasis);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;transition:background-color 150ms ease-out;user-select:none;cursor:pointer;height:fit-content;width:fit-content}nv-button[size=xs]{padding:var(--button-xs-padding-y) var(--button-xs-padding-x);gap:var(--button-xs-gap);border-radius:var(--button-xs-border-radius);line-height:var(--button-xs-line-height);font-size:var(--button-xs-font-size)}nv-button[size=xs] nv-icon>svg{width:var(--spacing-3);height:var(--spacing-3);stroke-width:1.2px}nv-button[size=sm]{padding:var(--button-sm-padding-y) var(--button-sm-padding-x);gap:var(--button-sm-gap);border-radius:var(--button-sm-border-radius);line-height:var(--button-sm-line-height);font-size:var(--button-sm-font-size)}nv-button[size=sm] nv-icon>svg{width:var(--spacing-4);height:var(--spacing-4);stroke-width:1.5px}nv-button[size=md]{padding:var(--button-md-padding-y) var(--button-md-padding-x);gap:var(--button-md-gap);border-radius:var(--button-md-border-radius);line-height:var(--button-md-line-height);font-size:var(--button-md-font-size)}nv-button[size=md] nv-icon>svg{width:var(--spacing-5);height:var(--spacing-5);stroke-width:1.6px}nv-button[size=lg]{padding:var(--button-lg-padding-y) var(--button-lg-padding-x);gap:var(--button-lg-gap);border-radius:var(--button-lg-border-radius);line-height:var(--button-lg-line-height);font-size:var(--button-lg-font-size)}nv-button[size=lg] nv-icon>svg{width:var(--spacing-6);height:var(--spacing-6);stroke-width:1.8px}nv-button[emphasis=high]{background:var(--components-button-high-background);border:1px solid var(--components-button-high-border);color:var(--components-button-high-text)}nv-button[emphasis=high]:hover{background:var(--components-button-high-background-hover);border:1px solid var(--components-button-high-border);color:var(--components-button-high-text-hover)}nv-button[emphasis=high]:active{background:var(--components-button-high-background-active);border:1px solid var(--components-button-high-border-active);color:var(--components-button-high-text-active)}nv-button[emphasis=high]:focus,nv-button[emphasis=high]:focus-within{outline:none}nv-button[emphasis=high]:focus-visible,nv-button[emphasis=high]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-button[emphasis=high]:disabled:not([disabled=false]){opacity:0.5;cursor:not-allowed;box-shadow:none}nv-button[emphasis=high][active]:not([active=false]){background:var(--components-button-high-background-active);border:1px solid var(--components-button-high-border-active);color:var(--components-button-high-text-active)}nv-button[emphasis=high][danger]:not([danger=false]){background:var(--components-button-destructive-high-background);border:1px solid transparent;color:var(--components-button-destructive-high-text)}nv-button[emphasis=high][danger]:not([danger=false]):hover{background:var(--components-button-destructive-high-background-hover);border:1px solid transparent;color:var(--components-button-destructive-high-text-hover)}nv-button[emphasis=high][danger]:not([danger=false]):focus,nv-button[emphasis=high][danger]:not([danger=false]):focus-within{outline:none}nv-button[emphasis=high][danger]:not([danger=false]):focus-visible,nv-button[emphasis=high][danger]:not([danger=false]):has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-destructive);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-button[emphasis=medium]{background:var(--components-button-medium-background);border:1px solid var(--components-button-medium-border);color:var(--components-button-medium-text)}nv-button[emphasis=medium]:hover{background:var(--components-button-medium-background-hover);border:1px solid var(--components-button-medium-border);color:var(--components-button-medium-text-hover)}nv-button[emphasis=medium]:active{background:var(--components-button-medium-background-active);border:1px solid var(--components-button-medium-border-active);color:var(--components-button-medium-text-active)}nv-button[emphasis=medium]:focus,nv-button[emphasis=medium]:focus-within{outline:none}nv-button[emphasis=medium]:focus-visible,nv-button[emphasis=medium]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-button[emphasis=medium]:disabled:not([disabled=false]){opacity:0.5;cursor:not-allowed;box-shadow:none}nv-button[emphasis=medium][active]:not([active=false]){background:var(--components-button-medium-background-active);border:1px solid var(--components-button-medium-border-active);color:var(--components-button-medium-text-active)}nv-button[emphasis=medium][danger]:not([danger=false]){background:var(--components-button-destructive-medium-background);border:1px solid var(--components-button-destructive-medium-border);color:var(--components-button-destructive-medium-text)}nv-button[emphasis=medium][danger]:not([danger=false]):hover{background:var(--components-button-destructive-medium-background-hover);border:1px solid var(--components-button-destructive-medium-border);color:var(--components-button-destructive-medium-text-hover)}nv-button[emphasis=medium][danger]:not([danger=false]):focus,nv-button[emphasis=medium][danger]:not([danger=false]):focus-within{outline:none}nv-button[emphasis=medium][danger]:not([danger=false]):focus-visible,nv-button[emphasis=medium][danger]:not([danger=false]):has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-destructive);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-button[emphasis=low]{background:var(--components-button-low-background);border:1px solid var(--components-button-low-border);color:var(--components-button-low-text)}nv-button[emphasis=low]:hover{background:var(--components-button-low-background-hover);border:1px solid var(--components-button-low-border);color:var(--components-button-low-text-hover)}nv-button[emphasis=low]:active{background:var(--components-button-low-background-active);border:1px solid var(--components-button-low-border-active);color:var(--components-button-low-text-active)}nv-button[emphasis=low]:focus,nv-button[emphasis=low]:focus-within{outline:none}nv-button[emphasis=low]:focus-visible,nv-button[emphasis=low]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-button[emphasis=low]:disabled:not([disabled=false]){opacity:0.5;cursor:not-allowed;box-shadow:none}nv-button[emphasis=low][active]:not([active=false]){background:var(--components-button-low-background-active);border:1px solid var(--components-button-low-border-active);color:var(--components-button-low-text-active)}nv-button[emphasis=low][danger]:not([danger=false]){background:var(--components-button-destructive-low-background);border:1px solid var(--components-button-destructive-low-border);color:var(--components-button-destructive-low-text)}nv-button[emphasis=low][danger]:not([danger=false]):hover{background:var(--components-button-destructive-low-background-hover);border:1px solid var(--components-button-destructive-low-border);color:var(--components-button-destructive-low-text-hover)}nv-button[emphasis=low][danger]:not([danger=false]):focus,nv-button[emphasis=low][danger]:not([danger=false]):focus-within{outline:none}nv-button[emphasis=low][danger]:not([danger=false]):focus-visible,nv-button[emphasis=low][danger]:not([danger=false]):has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-destructive);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-button[emphasis=lower]{background:var(--components-button-lower-background);border:1px solid var(--components-button-lower-border);color:var(--components-button-lower-text)}nv-button[emphasis=lower]:hover{background:var(--components-button-lower-background-hover);border:1px solid var(--components-button-lower-border);color:var(--components-button-lower-text-hover)}nv-button[emphasis=lower]:active{background:var(--components-button-lower-background-active);border:1px solid var(--components-button-lower-border-active);color:var(--components-button-lower-text-active)}nv-button[emphasis=lower]:focus,nv-button[emphasis=lower]:focus-within{outline:none}nv-button[emphasis=lower]:focus-visible,nv-button[emphasis=lower]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-brand);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-button[emphasis=lower]:disabled:not([disabled=false]){opacity:0.5;cursor:not-allowed;box-shadow:none}nv-button[emphasis=lower][active]:not([active=false]){background:var(--components-button-lower-background-active);border:1px solid var(--components-button-lower-border-active);color:var(--components-button-lower-text-active)}nv-button[emphasis=lower][danger]:not([danger=false]){background:var(--components-button-destructive-lower-background);border:1px solid var(--components-button-destructive-lower-border);color:var(--components-button-destructive-lower-text)}nv-button[emphasis=lower][danger]:not([danger=false]):hover{background:var(--components-button-destructive-lower-background-hover);border:1px solid var(--components-button-destructive-lower-border);color:var(--components-button-destructive-lower-text-hover)}nv-button[emphasis=lower][danger]:not([danger=false]):focus,nv-button[emphasis=lower][danger]:not([danger=false]):focus-within{outline:none}nv-button[emphasis=lower][danger]:not([danger=false]):focus-visible,nv-button[emphasis=lower][danger]:not([danger=false]):has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--color-focus-destructive);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-button[fluid]:not([fluid=false]){width:100%}nv-button[loading]:not([loading=false]) [slot=leading-icon]{display:none}";
9
- const NvButtonStyle0 = nvButtonCss;
10
-
11
- const NvButton = class {
12
- constructor(hostRef) {
13
- index.registerInstance(this, hostRef);
14
- if (hostRef.$hostElement$["s-ei"]) {
15
- this.internals = hostRef.$hostElement$["s-ei"];
16
- }
17
- else {
18
- this.internals = hostRef.$hostElement$.attachInternals();
19
- hostRef.$hostElement$["s-ei"] = this.internals;
20
- }
21
- /****************************************************************************/
22
- //#region PROPERTIES
23
- /**
24
- * Determines how large or small the button appears, allowing for
25
- * customization of the button's dimensions to fit different design
26
- * specifications and user needs.
27
- */
28
- this.size = 'md';
29
- /**
30
- * Adjusts the button's emphasis to make it more or less visually prominent
31
- * to users. Use this to draw attention to important actions or reduce focus
32
- * on less critical ones
33
- */
34
- this.emphasis = 'high';
35
- /**
36
- * Use this prop to highlight the button when it represents the current page
37
- * or active selection. This helps users understand their navigation context.
38
- */
39
- this.active = false;
40
- /**
41
- * Applies styling that visually indicates the button represents a dangerous
42
- * action.
43
- */
44
- this.danger = false;
45
- /**
46
- * Set this to true to show a spinner on the button, letting users know that
47
- * their action is being processed. It helps improve user experience by
48
- * indicating ongoing activities.
49
- */
50
- this.loading = false;
51
- /**
52
- * Disables the button, preventing user interaction.
53
- */
54
- this.disabled = false;
55
- /**
56
- * Allows the button to stretch and fill the entire width of its container.
57
- */
58
- this.fluid = false;
59
- /**
60
- * Sets the button type to control its function in forms. Use 'submit' to send
61
- * form data, 'reset' to clear the form, or 'button' for a standard button
62
- * that doesn't interact with form submission by default.
63
- */
64
- this.type = 'button';
65
- //#endregion PROPERTIES
66
- /****************************************************************************/
67
- //#region METHODS
68
- /**
69
- * Handles button click events, managing form actions and disabled states.
70
- * Prevents default behavior when button is disabled or loading, and
71
- * processes form submissions/resets when appropriate.
72
- * @param {Event} event - The click event.
73
- */
74
- this.handleButtonClick = (event) => {
75
- var _a;
76
- if (this.loading || this.disabled) {
77
- event.preventDefault();
78
- return;
79
- }
80
- if (this.type !== constants69bafca2.ButtonType.Button &&
81
- (this.form || ((_a = this.internals) === null || _a === void 0 ? void 0 : _a.form))) {
82
- this.processFormAction();
83
- }
84
- else if (this.form && this.type === constants69bafca2.ButtonType.Button) {
85
- console.warn('Button has a form id but is not of type submit or reset so no form action will be processed.', `Button:`, this.el);
86
- }
87
- };
88
- /**
89
- * Processes form-related actions by finding the associated form element
90
- * and triggering the appropriate action (submit/reset) based on button type.
91
- * Falls back to ElementInternals form if no explicit form ID is provided.
92
- */
93
- this.processFormAction = () => {
94
- var _a, _b;
95
- const formElement = this.form
96
- ? document.getElementById(this.form)
97
- : (_a = this.internals) === null || _a === void 0 ? void 0 : _a.form;
98
- if (!formElement) {
99
- console.warn('No form element found.', `Form ID: ${this.form || 'Not provided'}`, `Internals form:`, (_b = this.internals) === null || _b === void 0 ? void 0 : _b.form);
100
- return;
101
- }
102
- switch (this.type) {
103
- case constants69bafca2.ButtonType.Submit:
104
- formElement.requestSubmit();
105
- break;
106
- case constants69bafca2.ButtonType.Reset:
107
- formElement.reset();
108
- break;
109
- }
110
- };
111
- }
112
- //#endregion METHODS
113
- /****************************************************************************/
114
- //#region EVENTS
115
- handleKeyDown(event) {
116
- if (event.key === 'Enter' || event.key === ' ') {
117
- event.preventDefault();
118
- this.el.click();
119
- }
120
- }
121
- //#endregion EVENTS
122
- /****************************************************************************/
123
- //#region WATCHERS
124
- handleLoadingChange(loading) {
125
- this.loading = loading;
126
- this.disabled = loading;
127
- }
128
- handleDisabledChange(disabled) {
129
- if (this.loading) {
130
- this.disabled = this.loading;
131
- }
132
- else {
133
- this.disabled = disabled;
134
- }
135
- }
136
- //#endregion WATCHERS
137
- /****************************************************************************/
138
- //#region LIFECYCLE
139
- componentWillLoad() {
140
- if (this.loading) {
141
- this.disabled = this.loading;
142
- }
143
- }
144
- //#endregion LIFECYCLE
145
- /****************************************************************************/
146
- //#region RENDER
147
- render() {
148
- return (index.h(index.Host, { key: '42488f71ad33233c839cd70b3ea57aee50b143b3', role: "button", tabindex: "0", onClick: this.handleButtonClick }, this.loading && (index.h("nv-loader", { key: 'a30c71eebb8f0476bcca5acbc8e7ac7f6377740c', size: this.size === constants69bafca2.ButtonSize.Large ? 'sm' : 'xs' })), index.h("slot", { key: '4bbcee81ef7236ae35471c649971c122e4b468f3', name: "leading-icon" }), index.h("slot", { key: '82203f6aed911e61aef2438bba3b3e664ffb9f76' }), index.h("slot", { key: 'c97a5ce78c15556b8c1a91a4d06eb6bc9a9cd255', name: "trailing-icon" })));
149
- }
150
- static get formAssociated() { return true; }
151
- get el() { return index.getElement(this); }
152
- static get watchers() { return {
153
- "loading": ["handleLoadingChange"],
154
- "disabled": ["handleDisabledChange"]
155
- }; }
156
- };
157
- NvButton.style = NvButtonStyle0;
158
-
159
- exports.nv_button = NvButton;