@kubex/zinc 1.1.120 → 1.1.122
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.
- package/dist/custom-elements.json +1952 -921
- package/dist/vscode.html-custom-data.json +80 -58
- package/dist/web-types.json +208 -142
- package/dist/zn.d.ts +403 -298
- package/dist/zn.min.js +1511 -1370
- package/docs/pages/components/button.md +9 -0
- package/docs/pages/components/data-table-filter.md +60 -4
- package/docs/pages/components/data-table-search.md +3 -3
- package/docs/pages/components/data-table.md +78 -9
- package/docs/pages/components/datepicker.md +10 -0
- package/docs/pages/components/menu-item.md +16 -2
- package/docs/pages/components/translation-group.md +2 -2
- package/package.json +1 -1
- package/src/components/button/button.component.ts +11 -4
- package/src/components/button/button.scss +12 -1
- package/src/components/data-table/data-table.component.ts +341 -139
- package/src/components/data-table/data-table.scss +105 -42
- package/src/components/data-table/data-table.test.ts +110 -0
- package/src/components/data-table-filter/data-table-filter.component.ts +487 -49
- package/src/components/data-table-filter/data-table-filter.scss +163 -9
- package/src/components/data-table-filter/data-table-filter.test.ts +328 -2
- package/src/components/data-table-search/data-table-search.component.ts +1 -1
- package/src/components/datepicker/datepicker.component.ts +23 -2
- package/src/components/datepicker/datepicker.scss +25 -0
- package/src/components/datepicker/datepicker.test.ts +28 -1
- package/src/components/input/input.component.ts +1 -0
- package/src/components/input/input.scss +1 -1
- package/src/components/menu/menu.component.ts +2 -0
- package/src/components/menu/menu.scss +23 -2
- package/src/components/menu-item/menu-item.component.ts +7 -1
- package/src/components/menu-item/menu-item.scss +4 -4
- package/src/components/menu-item/menu-item.test.ts +39 -1
- package/src/components/panel/panel.component.ts +12 -5
- package/src/components/panel/panel.scss +3 -3
- package/src/components/query-builder/query-builder.component.ts +1 -1
- package/src/components/tooltip/tooltip.component.ts +2 -2
- package/src/components/tooltip/tooltip.test.ts +70 -2
- package/src/components/translation-group/translation-group.component.ts +5 -7
- package/src/components/translation-group/translation-group.test.ts +8 -8
- package/src/components/translations/translations.component.ts +3 -4
- package/src/components/translations/translations.test.ts +1 -1
|
@@ -187,6 +187,15 @@ Use the `square` attribute to create square-shaped buttons, useful for icon-only
|
|
|
187
187
|
<zn-button icon="close" square color="error"></zn-button>
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
+
### Pill Buttons
|
|
191
|
+
|
|
192
|
+
Use the `pill` attribute for a label-like trigger rather than an action: fully rounded, sentence case and regular weight, so it reads as a value you can change rather than a command. Used for the filter chips in `zn-data-table-filter`.
|
|
193
|
+
|
|
194
|
+
```html:preview
|
|
195
|
+
<zn-button pill panel-bg icon="chevron-down@lu" icon-position="right">Role</zn-button>
|
|
196
|
+
<zn-button pill panel-bg icon="chevron-down@lu" icon-position="right">Status: Active</zn-button>
|
|
197
|
+
```
|
|
198
|
+
|
|
190
199
|
### Grow
|
|
191
200
|
|
|
192
201
|
Use the `grow` attribute to make the button expand to fill its container width.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
meta:
|
|
3
3
|
title: Data Table Filter
|
|
4
|
-
description:
|
|
4
|
+
description: An inline filter bar for data tables. Each active filter is a pill whose dropdown sets its value, alongside an add-filter control and a clear.
|
|
5
5
|
layout: component
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -12,6 +12,56 @@ layout: component
|
|
|
12
12
|
</zn-data-table-filter>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
Filters render inline rather than in a slideout. Each active filter is a pill showing its name, and its value once set; the pill's dropdown lists the filter's `options` as checkable values, or a text input for a filter that declares none. Each pill carries an X that drops that filter. `+ Add filter` lists the filters that are not yet active, and `Clear` removes them all.
|
|
16
|
+
|
|
17
|
+
A filter starts on its **first declared operator**. Declare more than one and the pill offers a choice: a value editor gets a row of operator chips above it, an options menu lists the operators above its values, and the pill then reads `Age ≥ 18` rather than `Age: 18`. Switching operator keeps the value — a date is re-encoded for the new comparator.
|
|
18
|
+
|
|
19
|
+
Declare `in` or `nin` to let a filter hold several values at once — the pill then counts them, e.g. `Role (2)`, and its dropdown stays open so you can pick more. Any other operator holds a single value: the dropdown closes on select, and picking the same value again clears it.
|
|
20
|
+
|
|
21
|
+
Picking a filter from `+ Add filter` opens its pill straight away, with a text field focused, so naming a filter and giving it a value is one pass. A typed value is one value however many spaces it contains; only a comma starts another.
|
|
22
|
+
|
|
23
|
+
`default-filters` takes a comma-separated list of filter ids to show a pill for up front. Inside a `zn-data-table` the bar is hidden until the header's filter toggle is clicked, and `activeCount` reports how many filters currently hold a value.
|
|
24
|
+
|
|
25
|
+
```html:preview
|
|
26
|
+
<zn-data-table-filter
|
|
27
|
+
default-filters="status"
|
|
28
|
+
filters='[
|
|
29
|
+
{"id":"status","name":"Status","options":{"open":"Open","closed":"Closed"},"operators":["eq"]},
|
|
30
|
+
{"id":"tag","name":"Tag","options":{"bug":"Bug","chore":"Chore","feature":"Feature"},"operators":["in"]},
|
|
31
|
+
{"id":"owner","name":"Owner","operators":["contains"]}
|
|
32
|
+
]'>
|
|
33
|
+
</zn-data-table-filter>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The component emits `zn-filter-change` and exposes the query on `value`, encoded exactly as `zn-query-builder` encodes it — base64 of `[{key, comparator, value}]` — so a backend built against the query builder needs no changes.
|
|
37
|
+
|
|
38
|
+
### Long Option Lists
|
|
39
|
+
|
|
40
|
+
An option list caps its height at 320px and scrolls inside the panel rather than running off the
|
|
41
|
+
screen, with the scrollbar drawn rather than left to the platform's overlay one. Past eight options
|
|
42
|
+
the pill also gains a search field, merged into the top of the panel and pinned there, that narrows
|
|
43
|
+
the list case-insensitively.
|
|
44
|
+
|
|
45
|
+
```html:preview
|
|
46
|
+
<zn-data-table-filter
|
|
47
|
+
default-filters="category"
|
|
48
|
+
filters='[
|
|
49
|
+
{"id":"category","name":"Category","operators":["eq","in"],"options":{
|
|
50
|
+
"how-to":"How To","linux":"Linux","beta":"Beta","router":"Router","tv":"TV","other":"Other",
|
|
51
|
+
"mac":"Mac Hotspot Shield","general":"General","android":"Android Hotspot Shield",
|
|
52
|
+
"educational":"Educational","windows":"Windows Hotspot Shield","ios":"iOS",
|
|
53
|
+
"getting-started":"Getting Started","payments":"Payments & Subscriptions",
|
|
54
|
+
"accounts":"Manage Account & Devices","troubleshoot":"Troubleshoot issues",
|
|
55
|
+
"releases":"Release Notes","archived":"Archived Articles","internal":"Internal Information",
|
|
56
|
+
"tutorials":"Tutorials"}}
|
|
57
|
+
]'>
|
|
58
|
+
</zn-data-table-filter>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Typeahead
|
|
62
|
+
|
|
63
|
+
Inside a `zn-data-table` a text filter suggests values from the rows the table has already loaded, matched case-insensitively against what has been typed, keyed on the column whose name matches the filter's id. Set `suggestions` yourself — `{[filterId]: string[]}` — to offer something else.
|
|
64
|
+
|
|
15
65
|
## Examples
|
|
16
66
|
|
|
17
67
|
### Basic Text Filters
|
|
@@ -27,7 +77,8 @@ Create simple text-based filters with equality and fuzzy search operators.
|
|
|
27
77
|
|
|
28
78
|
### Number Filters with Operators
|
|
29
79
|
|
|
30
|
-
Use number type filters with comparison operators like equal, greater than, less than.
|
|
80
|
+
Use number type filters with comparison operators like equal, greater than, less than. The pill's
|
|
81
|
+
editor shows a chip per operator; `>`, `≥`, `<` and `≤` keep their symbols, and the rest read as words.
|
|
31
82
|
|
|
32
83
|
```html:preview
|
|
33
84
|
<zn-data-table-filter
|
|
@@ -38,11 +89,16 @@ Use number type filters with comparison operators like equal, greater than, less
|
|
|
38
89
|
|
|
39
90
|
### Date Filters
|
|
40
91
|
|
|
41
|
-
Filter by dates with before, after, and equal operators.
|
|
92
|
+
Filter by dates with before, after, and equal operators. A `date` pill opens a calendar and closes
|
|
93
|
+
once a day is picked; a `dateTime` pill adds a time selector and stays open while it's set.
|
|
94
|
+
|
|
95
|
+
Values are encoded the way `zn-query-builder` encodes them, so `dateSubmitFormat` picks the wire
|
|
96
|
+
format: `legacy` (the default — seconds for `eq`/`neq`, otherwise minutes from now, negated for
|
|
97
|
+
`before`), `timestamp` (milliseconds) or `iso`.
|
|
42
98
|
|
|
43
99
|
```html:preview
|
|
44
100
|
<zn-data-table-filter
|
|
45
|
-
filters="[{"id":"created","name":"Created Date","type":"date","operators":["eq","before","after"]},{"id":"modified","name":"Modified Date","type":"date","operators":["before","after"]},{"id":"due_date","name":"Due Date","type":"
|
|
101
|
+
filters="[{"id":"created","name":"Created Date","type":"date","operators":["eq","before","after"]},{"id":"modified","name":"Modified Date","type":"date","operators":["before","after"]},{"id":"due_date","name":"Due Date","type":"dateTime","dateSubmitFormat":"iso","operators":["eq","before","after"]}]"
|
|
46
102
|
name="date-filters">
|
|
47
103
|
</zn-data-table-filter>
|
|
48
104
|
```
|
|
@@ -9,7 +9,7 @@ layout: component
|
|
|
9
9
|
|
|
10
10
|
### Basic Search
|
|
11
11
|
|
|
12
|
-
Use the `zn-data-table-search` component to provide search functionality for data tables. The component includes a search input with a search icon
|
|
12
|
+
Use the `zn-data-table-search` component to provide search functionality for data tables. The component includes a search input with a trailing search icon and is clearable by default.
|
|
13
13
|
|
|
14
14
|
```html:preview
|
|
15
15
|
<zn-data-table-search></zn-data-table-search>
|
|
@@ -401,7 +401,7 @@ Use the `getFormData()` method to retrieve all form data from the search compone
|
|
|
401
401
|
The component is built with accessibility in mind:
|
|
402
402
|
|
|
403
403
|
- Uses semantic HTML with proper input type (`search`)
|
|
404
|
-
- Includes a visible search icon
|
|
404
|
+
- Includes a visible trailing search icon for visual recognition
|
|
405
405
|
- Supports keyboard navigation and clearing via the clearable input
|
|
406
406
|
- Integrates with form validation and submission
|
|
407
407
|
- Provides proper labeling through the help-text attribute
|
|
@@ -448,4 +448,4 @@ The component is built with accessibility in mind:
|
|
|
448
448
|
## Dependencies
|
|
449
449
|
|
|
450
450
|
- `zn-input` - Used for the search input field
|
|
451
|
-
- `zn-icon` - Used for the search icon
|
|
451
|
+
- `zn-icon` - Used for the trailing search icon
|
|
@@ -116,7 +116,9 @@ Use `local-sort` to sort data client-side without making server requests. Best f
|
|
|
116
116
|
|
|
117
117
|
### Pagination
|
|
118
118
|
|
|
119
|
-
Data tables automatically display pagination controls when the total number of records exceeds the per-page limit. Users can navigate between pages and adjust rows per page.
|
|
119
|
+
Data tables automatically display pagination controls when the total number of records exceeds the per-page limit. Users can navigate between pages and adjust the rows per page.
|
|
120
|
+
|
|
121
|
+
Pagination renders as a single joined control: first, previous, a sliding window of three page numbers, next, last. The window keeps the control a fixed width whatever the dataset — the same at 30 pages as at 3000 — while the first and last buttons cover jumping to either end. On narrow widths the footer wraps so pagination sits above the rows selector.
|
|
120
122
|
|
|
121
123
|
:::tip
|
|
122
124
|
Pagination controls appear based on the `total` and `perPage` values in the response. In this preview, changing pages re-fetches the same static data. With a real server, each page request would return the corresponding slice of data.
|
|
@@ -195,6 +197,8 @@ Use `hide-checkboxes` to disable row selection functionality.
|
|
|
195
197
|
|
|
196
198
|
Add action buttons to the table header for performing operations on selected rows. Use the `delete-action`, `modify-action`, and `create-action` slots.
|
|
197
199
|
|
|
200
|
+
`delete-action` and `modify-action` sit beside the caption alongside a select-all toggle, and only appear once rows are selected. `create-action` is a primary action rather than a selection one, so it renders at the end of the header's right-hand group, after the search field.
|
|
201
|
+
|
|
198
202
|
```html:preview
|
|
199
203
|
<zn-data-table
|
|
200
204
|
data-uri="/data/data-table.json"
|
|
@@ -240,9 +244,49 @@ Mark columns as secondary to hide them by default. Users can expand rows to view
|
|
|
240
244
|
</zn-data-table>
|
|
241
245
|
```
|
|
242
246
|
|
|
247
|
+
### Column Select
|
|
248
|
+
|
|
249
|
+
The header carries a column select dropdown whenever the table has rows and more than one column can be toggled. Mark a header `"required": true` to pin it on, or `"default": false` to start it hidden. Set `hide-column-select` to remove the dropdown.
|
|
250
|
+
|
|
251
|
+
```html:preview
|
|
252
|
+
<zn-data-table
|
|
253
|
+
data-uri="/data/data-table.json"
|
|
254
|
+
method="GET"
|
|
255
|
+
standalone
|
|
256
|
+
caption="Customers"
|
|
257
|
+
headers='[
|
|
258
|
+
{"key":"name","label":"Name", "required":true},
|
|
259
|
+
{"key":"email","label":"Email"},
|
|
260
|
+
{"key":"status","label":"Status"},
|
|
261
|
+
{"key":"phone","label":"Phone"},
|
|
262
|
+
{"key":"address","label":"Address", "default":false}
|
|
263
|
+
]'>
|
|
264
|
+
</zn-data-table>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Refresh
|
|
268
|
+
|
|
269
|
+
Tables with a `data-uri` get a refresh button in the header, which reruns the current request. Set `hide-refresh` to remove it.
|
|
270
|
+
|
|
271
|
+
Both the refresh and column select buttons are hidden while the table has no rows, so an empty state keeps just the caption and the slotted controls.
|
|
272
|
+
|
|
273
|
+
```html:preview
|
|
274
|
+
<zn-data-table
|
|
275
|
+
data-uri="/data/data-table.json"
|
|
276
|
+
method="GET"
|
|
277
|
+
standalone
|
|
278
|
+
caption="Customers"
|
|
279
|
+
hide-column-select
|
|
280
|
+
headers='[
|
|
281
|
+
{"key":"name","label":"Name"},
|
|
282
|
+
{"key":"email","label":"Email"}
|
|
283
|
+
]'>
|
|
284
|
+
</zn-data-table>
|
|
285
|
+
```
|
|
286
|
+
|
|
243
287
|
### Hide Columns
|
|
244
288
|
|
|
245
|
-
Use `hide-columns` to completely hide specific columns from the table.
|
|
289
|
+
Use `hide-columns` to completely hide specific columns from the table. Unlike the column select, these columns cannot be turned back on.
|
|
246
290
|
|
|
247
291
|
```html:preview
|
|
248
292
|
<zn-data-table
|
|
@@ -362,7 +406,9 @@ Or use the built-in empty state with custom text:
|
|
|
362
406
|
|
|
363
407
|
### Filtering
|
|
364
408
|
|
|
365
|
-
Add
|
|
409
|
+
Add filtering with the `zn-data-table-filter` component. The header carries a filter toggle beside the refresh button; clicking it reveals a row between the header and the rows holding the `filter` slot, where the filter component shows one pill per active filter alongside add-filter and clear controls. The row stays hidden until the toggle is clicked, and the toggle carries a count of the filters currently applied. Use `default-filters` to show a pill for a filter before the user adds it.
|
|
410
|
+
|
|
411
|
+
The table also feeds the bar typeahead values for its text filters, taken from the rows it has loaded and keyed on the column whose name matches the filter's id.
|
|
366
412
|
|
|
367
413
|
:::tip
|
|
368
414
|
In this preview, filter parameters are sent with the request but the static data file returns the same results regardless. With a real server endpoint, results would be filtered based on the applied criteria.
|
|
@@ -370,6 +416,8 @@ In this preview, filter parameters are sent with the request but the static data
|
|
|
370
416
|
|
|
371
417
|
```html:preview
|
|
372
418
|
<zn-data-table
|
|
419
|
+
standalone
|
|
420
|
+
caption="Users"
|
|
373
421
|
data-uri="/data/data-table.json"
|
|
374
422
|
method="GET"
|
|
375
423
|
headers='[
|
|
@@ -382,9 +430,11 @@ In this preview, filter parameters are sent with the request but the static data
|
|
|
382
430
|
|
|
383
431
|
<zn-data-table-filter
|
|
384
432
|
slot="filter"
|
|
433
|
+
default-filters="status"
|
|
385
434
|
filters='[
|
|
386
|
-
{"id":"name","name":"Name","operators":["
|
|
387
|
-
{"id":"status","name":"Status","options":{"active":"Active","inactive":"Inactive"},"operators":["eq"]}
|
|
435
|
+
{"id":"name","name":"Name","operators":["contains"]},
|
|
436
|
+
{"id":"status","name":"Status","options":{"active":"Active","inactive":"Inactive"},"operators":["eq"]},
|
|
437
|
+
{"id":"role","name":"Role","options":{"admin":"Admin","user":"User"},"operators":["in"]}
|
|
388
438
|
]'>
|
|
389
439
|
</zn-data-table-filter>
|
|
390
440
|
|
|
@@ -395,6 +445,8 @@ In this preview, filter parameters are sent with the request but the static data
|
|
|
395
445
|
|
|
396
446
|
Add complex filtering options above the table using the `filter-top` slot. Perfect for search forms and advanced filters.
|
|
397
447
|
|
|
448
|
+
Content in this slot renders above the table's own panel rather than inside it, so wrap it in a `zn-panel` when it needs its own frame. It never contributes a header row to the table, and with `standalone` an empty state that has no caption or header controls is left unwrapped, so a `zn-panel` around the `empty-state` slot doesn't end up nested inside another.
|
|
449
|
+
|
|
398
450
|
:::tip
|
|
399
451
|
This example uses `no-initial-load` so the table starts empty. Submitting the filter form triggers a data load, but the static data file returns the same results regardless of filter values. With a real server, results would be filtered accordingly.
|
|
400
452
|
:::
|
|
@@ -514,7 +566,9 @@ In this preview, the input values are sent as parameters with each request but t
|
|
|
514
566
|
|
|
515
567
|
### Grouping Data
|
|
516
568
|
|
|
517
|
-
Group rows by a specific column using the `group-by` property. This loads all data and splits it into
|
|
569
|
+
Group rows by a specific column using the `group-by` property. This loads all data and splits it into groups.
|
|
570
|
+
|
|
571
|
+
Groups render as header rows inside a single table, so every group shares the same column widths, one set of column headers and one horizontal scrollbar.
|
|
518
572
|
|
|
519
573
|
```html:preview
|
|
520
574
|
<zn-data-table
|
|
@@ -591,17 +645,32 @@ Prevent automatic data loading on mount with `no-initial-load`. Call the `refres
|
|
|
591
645
|
|
|
592
646
|
### Standalone Mode
|
|
593
647
|
|
|
594
|
-
Use `standalone`
|
|
648
|
+
Use `standalone` when the table supplies its own panel rather than sitting inside one. It renders a `zn-panel`, passing `caption` through as the panel's caption, the header controls into its `actions` slot and the pagination into its `footer` slot, with the rows flush against the panel edges. Columns scroll under the panel's edges, so the border stays put on a wide table.
|
|
649
|
+
|
|
650
|
+
The panel footer is only slotted when there is pagination to show, so an empty table or one with `hide-pagination` gets no footer bar.
|
|
651
|
+
|
|
652
|
+
Leave `standalone` off when the table is already inside a `zn-panel`.
|
|
595
653
|
|
|
596
654
|
```html:preview
|
|
597
655
|
<zn-data-table
|
|
598
656
|
data-uri="/data/data-table.json"
|
|
599
657
|
method="GET"
|
|
600
658
|
standalone
|
|
659
|
+
caption="All Customers"
|
|
601
660
|
headers='[
|
|
602
661
|
{"key":"name","label":"Name"},
|
|
603
|
-
{"key":"email","label":"Email"}
|
|
662
|
+
{"key":"email","label":"Email"},
|
|
663
|
+
{"key":"status","label":"Status"},
|
|
664
|
+
{"key":"date","label":"Date Joined"},
|
|
665
|
+
{"key":"phone","label":"Phone"},
|
|
666
|
+
{"key":"address","label":"Address"},
|
|
667
|
+
{"key":"notes","label":"Notes"}
|
|
604
668
|
]'>
|
|
669
|
+
|
|
670
|
+
<zn-data-table-search slot="search" placeholder="Search"></zn-data-table-search>
|
|
671
|
+
|
|
672
|
+
<zn-button slot="create-action" icon="add">New Customer</zn-button>
|
|
673
|
+
|
|
605
674
|
</zn-data-table>
|
|
606
675
|
```
|
|
607
676
|
|
|
@@ -730,7 +799,7 @@ Rows can have contextual actions that appear in a dropdown menu.
|
|
|
730
799
|
|
|
731
800
|
### Caption
|
|
732
801
|
|
|
733
|
-
Add a caption to
|
|
802
|
+
Add a caption to name the table. It renders as the title on the left of the header row, and supplies the wording for the default empty state.
|
|
734
803
|
|
|
735
804
|
```html:preview
|
|
736
805
|
<zn-data-table
|
|
@@ -428,6 +428,16 @@ Displays time.
|
|
|
428
428
|
</zn-datepicker>
|
|
429
429
|
```
|
|
430
430
|
|
|
431
|
+
### Inline Calendar
|
|
432
|
+
|
|
433
|
+
`inline` renders the calendar in place and hides the text input, which suits a panel or dropdown that
|
|
434
|
+
is already open. Set `--zn-datepicker-inline-border-color: transparent` when the surrounding panel
|
|
435
|
+
already draws the edge.
|
|
436
|
+
|
|
437
|
+
```html:preview
|
|
438
|
+
<zn-datepicker inline></zn-datepicker>
|
|
439
|
+
```
|
|
440
|
+
|
|
431
441
|
### Dialogs & Shadow DOM
|
|
432
442
|
|
|
433
443
|
The calendar popup renders at the document level, so it is never clipped by ancestor shadow roots or
|
|
@@ -24,8 +24,22 @@ layout: component
|
|
|
24
24
|
<zn-menu-item color="warning">Menu item</zn-menu-item>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
###
|
|
27
|
+
### Keeping the Dropdown Open
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
A menu item inside a `zn-dropdown` closes it on select. `keep-open` exempts a single item, for rows
|
|
30
|
+
that change how the panel behaves rather than committing a choice — an operator picker above a list
|
|
31
|
+
of values, say. `stay-open-on-select` on the dropdown itself still covers every item at once.
|
|
32
|
+
|
|
33
|
+
```html:preview
|
|
34
|
+
<zn-dropdown>
|
|
35
|
+
<zn-button slot="trigger" icon="chevron-down@lu" icon-position="right">Sort</zn-button>
|
|
36
|
+
<zn-menu>
|
|
37
|
+
<zn-menu-item type="checkbox" keep-open checked>Ascending</zn-menu-item>
|
|
38
|
+
<zn-menu-item type="checkbox" keep-open>Descending</zn-menu-item>
|
|
39
|
+
<zn-menu-item value="name">Name</zn-menu-item>
|
|
40
|
+
<zn-menu-item value="created">Created</zn-menu-item>
|
|
41
|
+
</zn-menu>
|
|
42
|
+
</zn-dropdown>
|
|
43
|
+
```
|
|
30
44
|
|
|
31
45
|
|
|
@@ -62,8 +62,8 @@ select's accessible name — it is not shown, since the caption names the sectio
|
|
|
62
62
|
### Pre-filled Values
|
|
63
63
|
|
|
64
64
|
Set initial translations on each child. A language every child has a value for is marked `Translated`; one only some
|
|
65
|
-
children have is `Partial`; one no child has falls back to English. English itself is
|
|
66
|
-
|
|
65
|
+
children have is `Partial`; one no child has falls back to English. English itself is marked `Empty` rather than
|
|
66
|
+
falling back, having nothing to fall back to, and counts towards the total like any other language.
|
|
67
67
|
|
|
68
68
|
```html:preview
|
|
69
69
|
<zn-translation-group
|
package/package.json
CHANGED
|
@@ -84,6 +84,9 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
|
84
84
|
@property({type: Boolean}) plain = false;
|
|
85
85
|
/** Disables the hover background, for contexts where the tint doesn't fit. */
|
|
86
86
|
@property({type: Boolean, attribute: 'no-hover'}) noHover = false;
|
|
87
|
+
/** Renders the button as a pill: fully rounded, sentence case and regular
|
|
88
|
+
* weight. For label-like triggers such as filter chips. */
|
|
89
|
+
@property({type: Boolean, reflect: true}) pill = false;
|
|
87
90
|
@property({type: Boolean, attribute: 'panel-bg'}) panelBackground = false;
|
|
88
91
|
|
|
89
92
|
@property({attribute: 'dropdown-closer', type: Boolean}) dropdownCloser = false;
|
|
@@ -386,6 +389,9 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
|
386
389
|
'--icon-button-hover-color': this.getIconButtonColor(this.hoverColor || 'primary')
|
|
387
390
|
} : {};
|
|
388
391
|
|
|
392
|
+
// A removed `notification` attribute lands here as null, not undefined
|
|
393
|
+
const notification = this.notification ?? undefined;
|
|
394
|
+
|
|
389
395
|
const buttonContent = html`
|
|
390
396
|
<${tag}
|
|
391
397
|
part="base"
|
|
@@ -404,6 +410,7 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
|
404
410
|
'button--text': (this.text && !this.outline),
|
|
405
411
|
'button--icon-button': !!this.iconButton,
|
|
406
412
|
'button--plain': !!this.iconButton && this.plain,
|
|
413
|
+
'button--pill': this.pill,
|
|
407
414
|
'button--no-hover': this.noHover,
|
|
408
415
|
'button--icon-button-small': this.iconButton === 'small',
|
|
409
416
|
'button--icon-button-round': this.iconButton === 'round',
|
|
@@ -414,9 +421,9 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
|
414
421
|
'button--icon-right': this.iconPosition === 'right',
|
|
415
422
|
'button--with-content': this.hasSlotController.test('[default]') || this.content,
|
|
416
423
|
'button--square': this.square,
|
|
417
|
-
'button--has-notification':
|
|
418
|
-
'button--muted-notification': this.mutedNotifications ||
|
|
419
|
-
'button--notification-dot':
|
|
424
|
+
'button--has-notification': notification !== undefined && notification !== 0,
|
|
425
|
+
'button--muted-notification': this.mutedNotifications || notification === -2,
|
|
426
|
+
'button--notification-dot': notification !== undefined && notification < 0,
|
|
420
427
|
})}"
|
|
421
428
|
type="${ifDefined(this.type)}"
|
|
422
429
|
href="${ifDefined(this.href)}"
|
|
@@ -425,7 +432,7 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
|
425
432
|
rel="${ifDefined(isLink ? this.rel : undefined)}"
|
|
426
433
|
gaid="${ifDefined(this.gaid)}"
|
|
427
434
|
aria-label="${ifDefined(ariaLabel)}"
|
|
428
|
-
data-notification="${ifDefined(
|
|
435
|
+
data-notification="${ifDefined(notification)}"
|
|
429
436
|
disabled="${this.disabled || nothing}"
|
|
430
437
|
style=${styleMap(iconButtonStyles)}
|
|
431
438
|
@click="${this.handleClick}">
|
|
@@ -462,7 +462,7 @@
|
|
|
462
462
|
border-right: 0 !important;
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
-
:host([data-zn-button-group__button]:not([data-zn-button-group__button--first])
|
|
465
|
+
:host([data-zn-button-group__button]:not([data-zn-button-group__button--first])) {
|
|
466
466
|
.button:after {
|
|
467
467
|
content: '';
|
|
468
468
|
position: absolute;
|
|
@@ -488,6 +488,17 @@
|
|
|
488
488
|
border-left: 0 !important;
|
|
489
489
|
}
|
|
490
490
|
|
|
491
|
+
/* Pill: a label-like trigger (filter chips and similar) rather than an action */
|
|
492
|
+
.button.button--pill {
|
|
493
|
+
border-radius: var(--zn-border-radius-pill);
|
|
494
|
+
padding: 0 var(--zn-spacing-small);
|
|
495
|
+
height: 32px;
|
|
496
|
+
min-height: 32px;
|
|
497
|
+
font-weight: var(--zn-font-weight-normal);
|
|
498
|
+
text-transform: none;
|
|
499
|
+
white-space: nowrap;
|
|
500
|
+
}
|
|
501
|
+
|
|
491
502
|
.button--panel-bg {
|
|
492
503
|
background: rgb(var(--zn-panel));
|
|
493
504
|
border-color: var(--zn-button-border-color, rgb(var(--zn-border-color)));
|