@tectra-ng/ui 0.4.2 → 0.4.4
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/README.md +1 -1
- package/amount/README.md +2 -2
- package/analog-clock/README.md +3 -2
- package/button-group/README.md +34 -2
- package/chips-input/README.md +10 -0
- package/data-view/README.md +3 -0
- package/fesm2022/tectra-ng-ui-accordion.mjs +21 -21
- package/fesm2022/tectra-ng-ui-amount.mjs +14 -12
- package/fesm2022/tectra-ng-ui-amount.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-analog-clock.mjs +18 -12
- package/fesm2022/tectra-ng-ui-analog-clock.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-autocomplete.mjs +3 -3
- package/fesm2022/tectra-ng-ui-avatar.mjs +9 -9
- package/fesm2022/tectra-ng-ui-badge.mjs +3 -3
- package/fesm2022/tectra-ng-ui-breadcrumb.mjs +9 -9
- package/fesm2022/tectra-ng-ui-button-group.mjs +142 -9
- package/fesm2022/tectra-ng-ui-button-group.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-button.mjs +9 -9
- package/fesm2022/tectra-ng-ui-card.mjs +3 -3
- package/fesm2022/tectra-ng-ui-carousel.mjs +15 -15
- package/fesm2022/tectra-ng-ui-cascade-select.mjs +3 -3
- package/fesm2022/tectra-ng-ui-checkbox.mjs +9 -9
- package/fesm2022/tectra-ng-ui-chip.mjs +3 -3
- package/fesm2022/tectra-ng-ui-chips-input.mjs +42 -12
- package/fesm2022/tectra-ng-ui-chips-input.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-color-picker.mjs +3 -3
- package/fesm2022/tectra-ng-ui-color-swatches.mjs +3 -3
- package/fesm2022/tectra-ng-ui-confirm.mjs +9 -9
- package/fesm2022/tectra-ng-ui-countdown.mjs +9 -9
- package/fesm2022/tectra-ng-ui-country-select.mjs +5 -5
- package/fesm2022/tectra-ng-ui-country-select.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-country.mjs +3 -3
- package/fesm2022/tectra-ng-ui-data-view.mjs +41 -33
- package/fesm2022/tectra-ng-ui-data-view.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-datepicker.mjs +47 -36
- package/fesm2022/tectra-ng-ui-datepicker.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-dialog.mjs +24 -24
- package/fesm2022/tectra-ng-ui-divider.mjs +3 -3
- package/fesm2022/tectra-ng-ui-drawer.mjs +9 -9
- package/fesm2022/tectra-ng-ui-email-suggestion.mjs +3 -3
- package/fesm2022/tectra-ng-ui-export.mjs +41 -46
- package/fesm2022/tectra-ng-ui-export.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-field.mjs +3 -3
- package/fesm2022/tectra-ng-ui-fieldset.mjs +3 -3
- package/fesm2022/tectra-ng-ui-file-upload.mjs +12 -12
- package/fesm2022/tectra-ng-ui-galleria.mjs +21 -21
- package/fesm2022/tectra-ng-ui-highlight-text.mjs +3 -3
- package/fesm2022/tectra-ng-ui-icon-field.mjs +12 -12
- package/fesm2022/tectra-ng-ui-image.mjs +9 -9
- package/fesm2022/tectra-ng-ui-input-group.mjs +6 -6
- package/fesm2022/tectra-ng-ui-input-mask.mjs +3 -3
- package/fesm2022/tectra-ng-ui-input-number.mjs +3 -3
- package/fesm2022/tectra-ng-ui-input-otp.mjs +9 -5
- package/fesm2022/tectra-ng-ui-input-otp.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-input.mjs +8 -8
- package/fesm2022/tectra-ng-ui-input.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-key-filter.mjs +3 -3
- package/fesm2022/tectra-ng-ui-knob.mjs +18 -10
- package/fesm2022/tectra-ng-ui-knob.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-label.mjs +9 -9
- package/fesm2022/tectra-ng-ui-link.mjs +6 -6
- package/fesm2022/tectra-ng-ui-list-input.mjs +3 -3
- package/fesm2022/tectra-ng-ui-listbox.mjs +3 -3
- package/fesm2022/tectra-ng-ui-mention-textarea.mjs +3 -3
- package/fesm2022/tectra-ng-ui-menu.mjs +15 -15
- package/fesm2022/tectra-ng-ui-menubar.mjs +6 -6
- package/fesm2022/tectra-ng-ui-message.mjs +19 -19
- package/fesm2022/tectra-ng-ui-message.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-month-calendar.mjs +6 -6
- package/fesm2022/tectra-ng-ui-multiselect.mjs +3 -3
- package/fesm2022/tectra-ng-ui-overlay-badge.mjs +3 -3
- package/fesm2022/tectra-ng-ui-paginator.mjs +12 -29
- package/fesm2022/tectra-ng-ui-paginator.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-panel-menu.mjs +25 -8
- package/fesm2022/tectra-ng-ui-panel-menu.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-panel.mjs +5 -5
- package/fesm2022/tectra-ng-ui-panel.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-password-generator.mjs +6 -6
- package/fesm2022/tectra-ng-ui-password.mjs +12 -12
- package/fesm2022/tectra-ng-ui-pill.mjs +6 -5
- package/fesm2022/tectra-ng-ui-pill.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-popover.mjs +15 -15
- package/fesm2022/tectra-ng-ui-progress-bar.mjs +6 -6
- package/fesm2022/tectra-ng-ui-progress-spinner.mjs +3 -3
- package/fesm2022/tectra-ng-ui-radio-button.mjs +6 -6
- package/fesm2022/tectra-ng-ui-rating.mjs +9 -9
- package/fesm2022/tectra-ng-ui-scroll-panel.mjs +7 -7
- package/fesm2022/tectra-ng-ui-scroll-panel.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-select-button.mjs +748 -0
- package/fesm2022/tectra-ng-ui-select-button.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-select.mjs +36 -36
- package/fesm2022/tectra-ng-ui-skeleton.mjs +6 -6
- package/fesm2022/tectra-ng-ui-slider.mjs +3 -3
- package/fesm2022/tectra-ng-ui-sparkline.mjs +3 -3
- package/fesm2022/tectra-ng-ui-speed-dial.mjs +94 -63
- package/fesm2022/tectra-ng-ui-speed-dial.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-split-button.mjs +19 -8
- package/fesm2022/tectra-ng-ui-split-button.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-splitter.mjs +6 -6
- package/fesm2022/tectra-ng-ui-stat-tiles.mjs +14 -11
- package/fesm2022/tectra-ng-ui-stat-tiles.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-status-icon.mjs +3 -3
- package/fesm2022/tectra-ng-ui-stepper.mjs +109 -60
- package/fesm2022/tectra-ng-ui-stepper.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-table.mjs +132 -195
- package/fesm2022/tectra-ng-ui-table.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-tabs.mjs +18 -18
- package/fesm2022/tectra-ng-ui-tag.mjs +6 -6
- package/fesm2022/tectra-ng-ui-textarea.mjs +9 -9
- package/fesm2022/tectra-ng-ui-timeline.mjs +15 -15
- package/fesm2022/tectra-ng-ui-toast.mjs +9 -9
- package/fesm2022/tectra-ng-ui-toggle-button.mjs +5 -5
- package/fesm2022/tectra-ng-ui-toggle-button.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-toggle-switch.mjs +6 -6
- package/fesm2022/tectra-ng-ui-toolbar.mjs +12 -12
- package/fesm2022/tectra-ng-ui-tooltip.mjs +9 -9
- package/fesm2022/tectra-ng-ui-tree-select.mjs +20 -6
- package/fesm2022/tectra-ng-ui-tree-select.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-tree-table.mjs +7 -7
- package/fesm2022/tectra-ng-ui-tree-table.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-tree.mjs +30 -30
- package/fesm2022/tectra-ng-ui-truncate-text.mjs +5 -5
- package/fesm2022/tectra-ng-ui-truncate-text.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-virtual-scroller.mjs +15 -15
- package/fesm2022/tectra-ng-ui.mjs +1 -1
- package/field/README.md +2 -2
- package/input/README.md +1 -1
- package/input-otp/README.md +1 -1
- package/knob/README.md +1 -1
- package/message/README.md +2 -2
- package/package.json +8 -4
- package/paginator/README.md +1 -1
- package/panel-menu/README.md +1 -1
- package/pill/README.md +1 -1
- package/select-button/README.md +70 -0
- package/speed-dial/README.md +2 -1
- package/stat-tiles/README.md +3 -3
- package/stepper/README.md +3 -2
- package/table/README.md +10 -7
- package/tabs/README.md +1 -1
- package/tree-select/README.md +1 -1
- package/tree-table/README.md +1 -1
- package/truncate-text/README.md +1 -1
- package/types/tectra-ng-ui-amount.d.ts +6 -3
- package/types/tectra-ng-ui-amount.d.ts.map +1 -1
- package/types/tectra-ng-ui-analog-clock.d.ts +9 -4
- package/types/tectra-ng-ui-analog-clock.d.ts.map +1 -1
- package/types/tectra-ng-ui-button-group.d.ts +58 -5
- package/types/tectra-ng-ui-button-group.d.ts.map +1 -1
- package/types/tectra-ng-ui-chips-input.d.ts +14 -1
- package/types/tectra-ng-ui-chips-input.d.ts.map +1 -1
- package/types/tectra-ng-ui-datepicker.d.ts +2 -0
- package/types/tectra-ng-ui-datepicker.d.ts.map +1 -1
- package/types/tectra-ng-ui-field.d.ts +2 -2
- package/types/tectra-ng-ui-input-otp.d.ts +1 -1
- package/types/tectra-ng-ui-input-otp.d.ts.map +1 -1
- package/types/tectra-ng-ui-input.d.ts +1 -1
- package/types/tectra-ng-ui-knob.d.ts +2 -1
- package/types/tectra-ng-ui-knob.d.ts.map +1 -1
- package/types/tectra-ng-ui-message.d.ts +2 -2
- package/types/tectra-ng-ui-paginator.d.ts +2 -21
- package/types/tectra-ng-ui-paginator.d.ts.map +1 -1
- package/types/tectra-ng-ui-panel-menu.d.ts +9 -9
- package/types/tectra-ng-ui-panel-menu.d.ts.map +1 -1
- package/types/tectra-ng-ui-pill.d.ts +7 -3
- package/types/tectra-ng-ui-pill.d.ts.map +1 -1
- package/types/tectra-ng-ui-select-button.d.ts +256 -0
- package/types/tectra-ng-ui-select-button.d.ts.map +1 -0
- package/types/tectra-ng-ui-speed-dial.d.ts.map +1 -1
- package/types/tectra-ng-ui-stat-tiles.d.ts +4 -3
- package/types/tectra-ng-ui-stat-tiles.d.ts.map +1 -1
- package/types/tectra-ng-ui-stepper.d.ts +26 -10
- package/types/tectra-ng-ui-stepper.d.ts.map +1 -1
- package/types/tectra-ng-ui-table.d.ts +39 -42
- package/types/tectra-ng-ui-table.d.ts.map +1 -1
- package/types/tectra-ng-ui-tabs.d.ts +1 -1
- package/types/tectra-ng-ui-tree-select.d.ts +3 -1
- package/types/tectra-ng-ui-tree-select.d.ts.map +1 -1
- package/types/tectra-ng-ui-truncate-text.d.ts +1 -1
- package/types/tectra-ng-ui.d.ts +1 -1
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ Every component takes `dt` (design tokens of this instance), `pt` / `ptOptions`
|
|
|
53
53
|
|
|
54
54
|
| Group | `@tectra-ng/ui/…` |
|
|
55
55
|
|---|---|
|
|
56
|
-
| Form | `autocomplete`, `cascade-select`, `checkbox`, `chips-input`, `color-picker`, `color-swatches`, `country-select`, `datepicker`, `email-suggestion`, `field`, `icon-field`, `input`, `input-group`, `input-mask`, `input-number`, `input-otp`, `key-filter`, `knob`, `label`, `list-input`, `listbox`, `mention-textarea`, `multiselect`, `password`, `password-generator`, `radio-button`, `rating`, `select`, `slider`, `textarea`, `toggle-button`, `toggle-switch`, `tree-select` |
|
|
56
|
+
| Form | `autocomplete`, `cascade-select`, `checkbox`, `chips-input`, `color-picker`, `color-swatches`, `country-select`, `datepicker`, `email-suggestion`, `field`, `icon-field`, `input`, `input-group`, `input-mask`, `input-number`, `input-otp`, `key-filter`, `knob`, `label`, `list-input`, `listbox`, `mention-textarea`, `multiselect`, `password`, `password-generator`, `radio-button`, `rating`, `select`, `select-button`, `slider`, `textarea`, `toggle-button`, `toggle-switch`, `tree-select` |
|
|
57
57
|
| Actions | `button`, `button-group`, `speed-dial`, `split-button` |
|
|
58
58
|
| Data | `data-view`, `export`, `month-calendar`, `paginator`, `sparkline`, `stat-tiles`, `table`, `timeline`, `tree`, `tree-table`, `virtual-scroller` |
|
|
59
59
|
| Overlay | `confirm`, `dialog`, `drawer`, `menu`, `popover`, `toast`, `tooltip` |
|
package/amount/README.md
CHANGED
|
@@ -7,14 +7,14 @@ A number or a sum of money formatted for the current locale — grouping, decima
|
|
|
7
7
|
<tx-amount [amount]="delta" [signColor]="true" [showSign]="true" />
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
`format` uses the digits notation `minInteger.minFraction-maxFraction`: `1.0-2` (
|
|
10
|
+
`format` uses the digits notation `minInteger.minFraction-maxFraction`: `1.0-2` (up to two decimals), `1.2-2` (always two), `1.0-0` (whole numbers). Without it a sum of money shows the digits of its currency (`$318.60`, `¥318`) and a plain number shows up to two decimals. `formatAmount(value, options)` returns the formatted parts for own markup.
|
|
11
11
|
|
|
12
12
|
## Inputs
|
|
13
13
|
| Name | Description |
|
|
14
14
|
|---|---|
|
|
15
15
|
| amount | The number; `null` or `undefined` shows `emptyText` |
|
|
16
16
|
| currency | ISO 4217 code (`USD`, `EUR`, `UAH`); an unknown code is shown after the number as is |
|
|
17
|
-
| format | Digits: `minInteger.minFraction-maxFraction` |
|
|
17
|
+
| format | Digits: `minInteger.minFraction-maxFraction`; by default the currency's own digits, or `1.0-2` without a currency |
|
|
18
18
|
| notation | `standard` or `compact` (`1.2K`, `3.4M`) |
|
|
19
19
|
| currencyDisplay | `narrowSymbol` ($), `symbol` (US$), `code` (USD) or `name` (US dollars) |
|
|
20
20
|
| showSign | Adds `+` to positive numbers |
|
package/analog-clock/README.md
CHANGED
|
@@ -10,7 +10,7 @@ A clock face with hour and minute hands (and an optional second hand) that shows
|
|
|
10
10
|
| Name | Description |
|
|
11
11
|
|---|---|
|
|
12
12
|
| timezone | IANA time zone such as `Europe/Kyiv`; empty or unknown is the local time |
|
|
13
|
-
| time | A fixed time (`Date
|
|
13
|
+
| time | A fixed time (`Date`, ms or an ISO string) instead of the running clock; an invalid string shows the running clock |
|
|
14
14
|
| showSeconds | Adds a second hand; the clock then updates every second instead of every minute |
|
|
15
15
|
| ariaLabel | Text before the time in the accessible name, e.g. the city |
|
|
16
16
|
| dt | Design tokens of this instance (`analogClock`) |
|
|
@@ -28,4 +28,5 @@ A clock face with hour and minute hands (and an optional second hand) that shows
|
|
|
28
28
|
- The face is `role="img"` named by the time (`14:30`, after `ariaLabel` when set).
|
|
29
29
|
- Hands turn with a soft spring and always forward — from :59 to :00 they go on, not back around the face; with reduced motion they jump.
|
|
30
30
|
- The clock updates at the start of each minute (or second), so it stays exact without polling.
|
|
31
|
-
- `
|
|
31
|
+
- The face is always round: its width is the `size` token (`210px`), at most the width of its container, and the height follows; ticks and hands are sized in percent of the face.
|
|
32
|
+
- `txAnalogClockHands` (pipe) and `clockHands(time, timezone)` (a `Date`, ms or an ISO string) return `{ time, hourAngle, minuteAngle, secondAngle }`.
|
package/button-group/README.md
CHANGED
|
@@ -1,8 +1,40 @@
|
|
|
1
1
|
# ButtonGroup
|
|
2
2
|
|
|
3
|
-
Joins buttons into one
|
|
3
|
+
Joins related `txButton` buttons into one block: the inner corners go square, neighbouring borders merge into one line, and only the outer corners stay rounded. Use it for a few actions on the same object (save / delete / cancel), for a pager or a zoom control, or as the base of a split button. For a choice between options that stays selected use `tx-select-button` or `tx-tabs` instead — a button group only triggers actions.
|
|
4
|
+
|
|
5
|
+
Solid buttons next to each other get a thin divider in their own text colour, faded (`buttonGroup.dividerColor` and `buttonGroup.dividerWidth` tokens), so the group does not read as one wide button; outlined buttons share their border instead. The divider sits on the shared edge and stays in place while either neighbour is hovered or pressed.
|
|
6
|
+
|
|
7
|
+
Every button keeps its own inputs: severity, size, variant, icon, badge, loading and disabled work inside a group as they do alone. Give all buttons of a group the same size and variant.
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<tx-button-group aria-label="Document actions">
|
|
11
|
+
<button txButton icon="check">Save</button>
|
|
12
|
+
<button txButton icon="trash">Delete</button>
|
|
13
|
+
<button txButton icon="times">Cancel</button>
|
|
14
|
+
</tx-button-group>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Inputs
|
|
18
|
+
| Name | Description |
|
|
19
|
+
|---|---|
|
|
20
|
+
| orientation | `horizontal` (default) puts the buttons in a row, `vertical` stacks them in a column with the divider between rows |
|
|
21
|
+
| fluid | The group takes the full width of its container and the buttons share it equally; without the input it follows a parent `<tx-fluid>` |
|
|
22
|
+
| dt | Design tokens of this one group, e.g. `{ root: { dividerColor: 'var(--tx-surface-0)', dividerWidth: '2px' } }` |
|
|
23
|
+
| pt | Extra `class` / `style` for the `root` part — an object or a function `({ instance }) => ({ class, style })` |
|
|
24
|
+
| ptOptions | How this `pt` meets the global one from `provideTectra({ pt })`: `mergeSections` (default `true`), `mergeProps` (default `false`) |
|
|
25
|
+
| unstyled | Drops the joined borders, square inner corners and the divider; the classes `tx-button-group`, `tx-button-group--vertical` and `tx-button-group--fluid` stay for your own CSS; default from `provideTectra({ unstyled })` |
|
|
26
|
+
|
|
27
|
+
## Slots
|
|
28
|
+
| Name | Description |
|
|
29
|
+
|---|---|
|
|
30
|
+
| default | The `txButton` buttons (`button` or `a`) of the group |
|
|
4
31
|
|
|
5
32
|
## Keyboard
|
|
6
33
|
| Key | Action |
|
|
7
34
|
|---|---|
|
|
8
|
-
| Tab | Moves focus from one button to the next |
|
|
35
|
+
| Tab | Moves focus from one button to the next; disabled buttons are skipped |
|
|
36
|
+
| Enter / Space | Triggers the focused button |
|
|
37
|
+
|
|
38
|
+
## Accessibility
|
|
39
|
+
|
|
40
|
+
The host has `role="group"`. Give it a name with `aria-label` (or `aria-labelledby`) when the buttons alone do not say what they act on, and give icon-only buttons their own `aria-label`. A focused or hovered button is drawn above its neighbours, so the focus ring is never cut by the next button.
|
package/chips-input/README.md
CHANGED
|
@@ -5,6 +5,7 @@ A text field that turns what you type into chips — keywords, tags, emails, dom
|
|
|
5
5
|
## Inputs
|
|
6
6
|
| Name | Description |
|
|
7
7
|
|---|---|
|
|
8
|
+
| text | Typed text that is not a chip yet; two-way with `[(text)]` — setting it updates the field |
|
|
8
9
|
| placeholder | Text shown while the field is empty |
|
|
9
10
|
| separator | Text or pattern that ends a chip while typing and splits pasted text (`,` by default); Enter always adds |
|
|
10
11
|
| addOnBlur | Adds the typed text when the field loses focus (on by default) |
|
|
@@ -32,6 +33,15 @@ A text field that turns what you type into chips — keywords, tags, emails, dom
|
|
|
32
33
|
| added | A chip was added: `{ value, values }` |
|
|
33
34
|
| removed | A chip was removed: `{ value, values }` |
|
|
34
35
|
| rejected | A value was not added — duplicate, over `max` or not matching `itemPattern`: `{ value, values }` |
|
|
36
|
+
| textChange | The typed text changed |
|
|
37
|
+
|
|
38
|
+
## Methods
|
|
39
|
+
| Name | Description |
|
|
40
|
+
|---|---|
|
|
41
|
+
| add(value) | Adds a chip or a list of chips with the same checks as typing (duplicates, `max`, `maxLength`, `itemPattern`); emits `added` / `rejected`; does nothing when disabled or read-only. The typed text stays |
|
|
42
|
+
| clearText() | Clears the typed text and keeps the chips |
|
|
43
|
+
| clear() | Removes every chip and the typed text |
|
|
44
|
+
| removeAt(index) | Removes the chip at the index |
|
|
35
45
|
|
|
36
46
|
## Slots
|
|
37
47
|
| Name | Description |
|
package/data-view/README.md
CHANGED
|
@@ -69,6 +69,9 @@ Give the list and grid templates the items for typing — `<ng-template txDataVi
|
|
|
69
69
|
| txDataViewListOf | `txDataViewList`: the items, only for the type of `let-items` |
|
|
70
70
|
| txDataViewGridOf | `txDataViewGrid`: the items, only for the type of `let-items` |
|
|
71
71
|
|
|
72
|
+
## Frame
|
|
73
|
+
The data view is a content surface like a card: its corner radius and shadow come from `--tx-content-radius` and `--tx-content-shadow`, and the corners clip the header, items and paginator. The items get an inset from the `content.padding` token (none by default, for full-width rows) and `content.gridPadding` in the grid layout (12.25px), so cards never touch the rounded edge.
|
|
74
|
+
|
|
72
75
|
## Layout switch
|
|
73
76
|
`<tx-data-view-layout [(layout)]="layout" />` — two toggle buttons (list, grid) with `aria-pressed`.
|
|
74
77
|
|
|
@@ -13,7 +13,7 @@ var TxAccordionHeaderTemplate = class TxAccordionHeaderTemplate {
|
|
|
13
13
|
}
|
|
14
14
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
15
15
|
minVersion: "12.0.0",
|
|
16
|
-
version: "22.2.
|
|
16
|
+
version: "22.2.6",
|
|
17
17
|
ngImport: i0,
|
|
18
18
|
type: TxAccordionHeaderTemplate,
|
|
19
19
|
deps: [],
|
|
@@ -21,7 +21,7 @@ var TxAccordionHeaderTemplate = class TxAccordionHeaderTemplate {
|
|
|
21
21
|
});
|
|
22
22
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
23
23
|
minVersion: "14.0.0",
|
|
24
|
-
version: "22.2.
|
|
24
|
+
version: "22.2.6",
|
|
25
25
|
type: TxAccordionHeaderTemplate,
|
|
26
26
|
isStandalone: true,
|
|
27
27
|
selector: "ng-template[txAccordionHeader]",
|
|
@@ -30,7 +30,7 @@ var TxAccordionHeaderTemplate = class TxAccordionHeaderTemplate {
|
|
|
30
30
|
};
|
|
31
31
|
i0.ɵɵngDeclareClassMetadata({
|
|
32
32
|
minVersion: "12.0.0",
|
|
33
|
-
version: "22.2.
|
|
33
|
+
version: "22.2.6",
|
|
34
34
|
ngImport: i0,
|
|
35
35
|
type: TxAccordionHeaderTemplate,
|
|
36
36
|
decorators: [{
|
|
@@ -45,7 +45,7 @@ var TxAccordionContentTemplate = class TxAccordionContentTemplate {
|
|
|
45
45
|
}
|
|
46
46
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
47
47
|
minVersion: "12.0.0",
|
|
48
|
-
version: "22.2.
|
|
48
|
+
version: "22.2.6",
|
|
49
49
|
ngImport: i0,
|
|
50
50
|
type: TxAccordionContentTemplate,
|
|
51
51
|
deps: [],
|
|
@@ -53,7 +53,7 @@ var TxAccordionContentTemplate = class TxAccordionContentTemplate {
|
|
|
53
53
|
});
|
|
54
54
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
55
55
|
minVersion: "14.0.0",
|
|
56
|
-
version: "22.2.
|
|
56
|
+
version: "22.2.6",
|
|
57
57
|
type: TxAccordionContentTemplate,
|
|
58
58
|
isStandalone: true,
|
|
59
59
|
selector: "ng-template[txAccordionContent]",
|
|
@@ -62,7 +62,7 @@ var TxAccordionContentTemplate = class TxAccordionContentTemplate {
|
|
|
62
62
|
};
|
|
63
63
|
i0.ɵɵngDeclareClassMetadata({
|
|
64
64
|
minVersion: "12.0.0",
|
|
65
|
-
version: "22.2.
|
|
65
|
+
version: "22.2.6",
|
|
66
66
|
ngImport: i0,
|
|
67
67
|
type: TxAccordionContentTemplate,
|
|
68
68
|
decorators: [{
|
|
@@ -77,7 +77,7 @@ var TxAccordionToggleIconTemplate = class TxAccordionToggleIconTemplate {
|
|
|
77
77
|
}
|
|
78
78
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
79
79
|
minVersion: "12.0.0",
|
|
80
|
-
version: "22.2.
|
|
80
|
+
version: "22.2.6",
|
|
81
81
|
ngImport: i0,
|
|
82
82
|
type: TxAccordionToggleIconTemplate,
|
|
83
83
|
deps: [],
|
|
@@ -85,7 +85,7 @@ var TxAccordionToggleIconTemplate = class TxAccordionToggleIconTemplate {
|
|
|
85
85
|
});
|
|
86
86
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
87
87
|
minVersion: "14.0.0",
|
|
88
|
-
version: "22.2.
|
|
88
|
+
version: "22.2.6",
|
|
89
89
|
type: TxAccordionToggleIconTemplate,
|
|
90
90
|
isStandalone: true,
|
|
91
91
|
selector: "ng-template[txAccordionToggleIcon]",
|
|
@@ -94,7 +94,7 @@ var TxAccordionToggleIconTemplate = class TxAccordionToggleIconTemplate {
|
|
|
94
94
|
};
|
|
95
95
|
i0.ɵɵngDeclareClassMetadata({
|
|
96
96
|
minVersion: "12.0.0",
|
|
97
|
-
version: "22.2.
|
|
97
|
+
version: "22.2.6",
|
|
98
98
|
ngImport: i0,
|
|
99
99
|
type: TxAccordionToggleIconTemplate,
|
|
100
100
|
decorators: [{
|
|
@@ -131,7 +131,7 @@ var TxAccordionContent = class TxAccordionContent {
|
|
|
131
131
|
}, ...ngDevMode ? [{ debugName: "templateContext" }] : /* istanbul ignore next */ []);
|
|
132
132
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
133
133
|
minVersion: "12.0.0",
|
|
134
|
-
version: "22.2.
|
|
134
|
+
version: "22.2.6",
|
|
135
135
|
ngImport: i0,
|
|
136
136
|
type: TxAccordionContent,
|
|
137
137
|
deps: [],
|
|
@@ -139,7 +139,7 @@ var TxAccordionContent = class TxAccordionContent {
|
|
|
139
139
|
});
|
|
140
140
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
141
141
|
minVersion: "17.0.0",
|
|
142
|
-
version: "22.2.
|
|
142
|
+
version: "22.2.6",
|
|
143
143
|
type: TxAccordionContent,
|
|
144
144
|
isStandalone: true,
|
|
145
145
|
selector: "tx-accordion-content",
|
|
@@ -191,7 +191,7 @@ var TxAccordionContent = class TxAccordionContent {
|
|
|
191
191
|
};
|
|
192
192
|
i0.ɵɵngDeclareClassMetadata({
|
|
193
193
|
minVersion: "12.0.0",
|
|
194
|
-
version: "22.2.
|
|
194
|
+
version: "22.2.6",
|
|
195
195
|
ngImport: i0,
|
|
196
196
|
type: TxAccordionContent,
|
|
197
197
|
decorators: [{
|
|
@@ -282,7 +282,7 @@ var TxAccordionHeader = class TxAccordionHeader {
|
|
|
282
282
|
}
|
|
283
283
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
284
284
|
minVersion: "12.0.0",
|
|
285
|
-
version: "22.2.
|
|
285
|
+
version: "22.2.6",
|
|
286
286
|
ngImport: i0,
|
|
287
287
|
type: TxAccordionHeader,
|
|
288
288
|
deps: [],
|
|
@@ -290,7 +290,7 @@ var TxAccordionHeader = class TxAccordionHeader {
|
|
|
290
290
|
});
|
|
291
291
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
292
292
|
minVersion: "17.0.0",
|
|
293
|
-
version: "22.2.
|
|
293
|
+
version: "22.2.6",
|
|
294
294
|
type: TxAccordionHeader,
|
|
295
295
|
isStandalone: true,
|
|
296
296
|
selector: "tx-accordion-header",
|
|
@@ -367,7 +367,7 @@ var TxAccordionHeader = class TxAccordionHeader {
|
|
|
367
367
|
};
|
|
368
368
|
i0.ɵɵngDeclareClassMetadata({
|
|
369
369
|
minVersion: "12.0.0",
|
|
370
|
-
version: "22.2.
|
|
370
|
+
version: "22.2.6",
|
|
371
371
|
ngImport: i0,
|
|
372
372
|
type: TxAccordionHeader,
|
|
373
373
|
decorators: [{
|
|
@@ -452,7 +452,7 @@ var TxAccordionPanel = class TxAccordionPanel {
|
|
|
452
452
|
}
|
|
453
453
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
454
454
|
minVersion: "12.0.0",
|
|
455
|
-
version: "22.2.
|
|
455
|
+
version: "22.2.6",
|
|
456
456
|
ngImport: i0,
|
|
457
457
|
type: TxAccordionPanel,
|
|
458
458
|
deps: [],
|
|
@@ -460,7 +460,7 @@ var TxAccordionPanel = class TxAccordionPanel {
|
|
|
460
460
|
});
|
|
461
461
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
462
462
|
minVersion: "17.1.0",
|
|
463
|
-
version: "22.2.
|
|
463
|
+
version: "22.2.6",
|
|
464
464
|
type: TxAccordionPanel,
|
|
465
465
|
isStandalone: true,
|
|
466
466
|
selector: "tx-accordion-panel",
|
|
@@ -518,7 +518,7 @@ var TxAccordionPanel = class TxAccordionPanel {
|
|
|
518
518
|
};
|
|
519
519
|
i0.ɵɵngDeclareClassMetadata({
|
|
520
520
|
minVersion: "12.0.0",
|
|
521
|
-
version: "22.2.
|
|
521
|
+
version: "22.2.6",
|
|
522
522
|
ngImport: i0,
|
|
523
523
|
type: TxAccordionPanel,
|
|
524
524
|
decorators: [{
|
|
@@ -677,7 +677,7 @@ var TxAccordion = class TxAccordion {
|
|
|
677
677
|
}
|
|
678
678
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
679
679
|
minVersion: "12.0.0",
|
|
680
|
-
version: "22.2.
|
|
680
|
+
version: "22.2.6",
|
|
681
681
|
ngImport: i0,
|
|
682
682
|
type: TxAccordion,
|
|
683
683
|
deps: [],
|
|
@@ -685,7 +685,7 @@ var TxAccordion = class TxAccordion {
|
|
|
685
685
|
});
|
|
686
686
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
687
687
|
minVersion: "17.0.0",
|
|
688
|
-
version: "22.2.
|
|
688
|
+
version: "22.2.6",
|
|
689
689
|
type: TxAccordion,
|
|
690
690
|
isStandalone: true,
|
|
691
691
|
selector: "tx-accordion",
|
|
@@ -847,7 +847,7 @@ var TxAccordion = class TxAccordion {
|
|
|
847
847
|
};
|
|
848
848
|
i0.ɵɵngDeclareClassMetadata({
|
|
849
849
|
minVersion: "12.0.0",
|
|
850
|
-
version: "22.2.
|
|
850
|
+
version: "22.2.6",
|
|
851
851
|
ngImport: i0,
|
|
852
852
|
type: TxAccordion,
|
|
853
853
|
decorators: [{
|
|
@@ -6,6 +6,7 @@ import { optionalBoolean } from "@tectra-ng/core/utils";
|
|
|
6
6
|
import { amountTokens, toStyleObject } from "@tectra-ng/themes";
|
|
7
7
|
import { provideTxIconDefaults, txIconCode } from "@tectra-ng/icons";
|
|
8
8
|
const DIGITS_INFO = /^(\d+)?(?:\.(\d+))?(?:-(\d+))?$/;
|
|
9
|
+
const DEFAULT_FORMAT = "1.0-2";
|
|
9
10
|
function parseDigitsInfo(format) {
|
|
10
11
|
const match = DIGITS_INFO.exec((format ?? "").trim());
|
|
11
12
|
if (!match) return {};
|
|
@@ -32,24 +33,25 @@ function toSegments(parts) {
|
|
|
32
33
|
return segments;
|
|
33
34
|
}
|
|
34
35
|
function formatAmount(amount, options) {
|
|
35
|
-
const
|
|
36
|
-
|
|
36
|
+
const currency = options.currency?.trim();
|
|
37
|
+
const base = (format) => ({
|
|
38
|
+
...parseDigitsInfo(format),
|
|
37
39
|
notation: options.notation ?? "standard",
|
|
38
40
|
signDisplay: options.showSign ? "exceptZero" : "auto"
|
|
39
|
-
};
|
|
40
|
-
const
|
|
41
|
+
});
|
|
42
|
+
const plain = base(options.format ?? DEFAULT_FORMAT);
|
|
41
43
|
if (currency) try {
|
|
42
44
|
return toSegments(new Intl.NumberFormat(options.locale, {
|
|
43
|
-
...base,
|
|
45
|
+
...base(options.format),
|
|
44
46
|
style: "currency",
|
|
45
47
|
currency,
|
|
46
48
|
currencyDisplay: options.currencyDisplay ?? "narrowSymbol"
|
|
47
49
|
}).formatToParts(amount));
|
|
48
50
|
} catch {
|
|
49
51
|
return [
|
|
50
|
-
...toSegments(new Intl.NumberFormat(options.locale,
|
|
52
|
+
...toSegments(new Intl.NumberFormat(options.locale, plain).formatToParts(amount)),
|
|
51
53
|
{
|
|
52
|
-
text: "
|
|
54
|
+
text: " ",
|
|
53
55
|
currency: false
|
|
54
56
|
},
|
|
55
57
|
{
|
|
@@ -58,7 +60,7 @@ function formatAmount(amount, options) {
|
|
|
58
60
|
}
|
|
59
61
|
];
|
|
60
62
|
}
|
|
61
|
-
return toSegments(new Intl.NumberFormat(options.locale,
|
|
63
|
+
return toSegments(new Intl.NumberFormat(options.locale, plain).formatToParts(amount));
|
|
62
64
|
}
|
|
63
65
|
const AMOUNT_ICON_DEFAULTS = { code: txIconCode };
|
|
64
66
|
const AMOUNT_THEME = { amount: amountTokens };
|
|
@@ -67,7 +69,7 @@ var TxAmount = class TxAmount {
|
|
|
67
69
|
localeService = inject(TxLocaleService);
|
|
68
70
|
amount = input(null, ...ngDevMode ? [{ debugName: "amount" }] : /* istanbul ignore next */ []);
|
|
69
71
|
currency = input(void 0, ...ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []);
|
|
70
|
-
format = input(
|
|
72
|
+
format = input(void 0, ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
|
|
71
73
|
notation = input("standard", ...ngDevMode ? [{ debugName: "notation" }] : /* istanbul ignore next */ []);
|
|
72
74
|
currencyDisplay = input("narrowSymbol", ...ngDevMode ? [{ debugName: "currencyDisplay" }] : /* istanbul ignore next */ []);
|
|
73
75
|
showSign = input(false, {
|
|
@@ -120,7 +122,7 @@ var TxAmount = class TxAmount {
|
|
|
120
122
|
}), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
121
123
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
122
124
|
minVersion: "12.0.0",
|
|
123
|
-
version: "22.2.
|
|
125
|
+
version: "22.2.6",
|
|
124
126
|
ngImport: i0,
|
|
125
127
|
type: TxAmount,
|
|
126
128
|
deps: [],
|
|
@@ -128,7 +130,7 @@ var TxAmount = class TxAmount {
|
|
|
128
130
|
});
|
|
129
131
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
130
132
|
minVersion: "17.0.0",
|
|
131
|
-
version: "22.2.
|
|
133
|
+
version: "22.2.6",
|
|
132
134
|
type: TxAmount,
|
|
133
135
|
isStandalone: true,
|
|
134
136
|
selector: "tx-amount",
|
|
@@ -266,7 +268,7 @@ var TxAmount = class TxAmount {
|
|
|
266
268
|
};
|
|
267
269
|
i0.ɵɵngDeclareClassMetadata({
|
|
268
270
|
minVersion: "12.0.0",
|
|
269
|
-
version: "22.2.
|
|
271
|
+
version: "22.2.6",
|
|
270
272
|
ngImport: i0,
|
|
271
273
|
type: TxAmount,
|
|
272
274
|
decorators: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tectra-ng-ui-amount.mjs","names":[],"sources":["../../../../packages/ui/amount/src/format-amount.ts","../../../../packages/ui/amount/src/amount.icons.ts","../../../../packages/ui/amount/src/amount.theme.ts","../../../../packages/ui/amount/src/amount.component.ts"],"sourcesContent":["import { TxAmountFormatOptions, TxAmountSegment } from './amount.types';\n\nconst DIGITS_INFO = /^(\\d+)?(?:\\.(\\d+))?(?:-(\\d+))?$/;\n\n/**\n * Reads a digits-info string like `1.2-2` (integer digits, minimum and maximum fraction digits) into number format options; an invalid string gives no options.\n */\nexport function parseDigitsInfo(format: string | undefined): Pick<Intl.NumberFormatOptions, 'minimumIntegerDigits' | 'minimumFractionDigits' | 'maximumFractionDigits'> {\n const match = DIGITS_INFO.exec((format ?? '').trim());\n if (!match) {\n return {};\n }\n const [, integer, minFraction, maxFraction] = match;\n const minimumFractionDigits = minFraction === undefined ? undefined : Number(minFraction);\n const maximumFractionDigits = maxFraction === undefined ? minimumFractionDigits : Math.max(Number(maxFraction), minimumFractionDigits ?? 0);\n return {\n ...(integer === undefined ? {} : { minimumIntegerDigits: Math.max(1, Number(integer)) }),\n ...(minimumFractionDigits === undefined ? {} : { minimumFractionDigits }),\n ...(maximumFractionDigits === undefined ? {} : { maximumFractionDigits }),\n };\n}\n\nfunction toSegments(parts: Intl.NumberFormatPart[]): TxAmountSegment[] {\n const segments: TxAmountSegment[] = [];\n for (const part of parts) {\n const currency = part.type === 'currency';\n const last = segments[segments.length - 1];\n if (last && last.currency === currency) {\n last.text += part.value;\n } else {\n segments.push({ text: part.value, currency });\n }\n }\n return segments;\n}\n\n/**\n * Formats a number as money in the given locale and currency and splits the result into currency and number segments.\n */\nexport function formatAmount(amount: number, options: TxAmountFormatOptions): TxAmountSegment[] {\n const base: Intl.NumberFormatOptions = {\n ...parseDigitsInfo(options.format),\n notation: options.notation ?? 'standard',\n signDisplay: options.showSign ? 'exceptZero' : 'auto',\n };\n const currency = options.currency?.trim();\n if (currency) {\n try {\n return toSegments(\n new Intl.NumberFormat(options.locale, { ...base, style: 'currency', currency, currencyDisplay: options.currencyDisplay ?? 'narrowSymbol' }).formatToParts(amount),\n );\n } catch {\n return [...toSegments(new Intl.NumberFormat(options.locale, base).formatToParts(amount)), { text: ' ', currency: false }, { text: currency, currency: true }];\n }\n }\n return toSegments(new Intl.NumberFormat(options.locale, base).formatToParts(amount));\n}\n","import { TxIconSet, txIconCode } from '@tectra-ng/icons';\n\nexport const AMOUNT_ICON_DEFAULTS: TxIconSet = {\n code: txIconCode,\n};\n","import { amountTokens } from '@tectra-ng/themes';\n\nexport const AMOUNT_THEME = {\n amount: amountTokens,\n};\n","import { ChangeDetectionStrategy, Component, booleanAttribute, computed, inject, input } from '@angular/core';\nimport { injectPassThrough, injectTokens, injectUnstyled, TxPassThrough, TxPassThroughOptions } from '@tectra-ng/core/config';\nimport { TxLocaleService } from '@tectra-ng/core/i18n';\nimport { optionalBoolean } from '@tectra-ng/core/utils';\nimport { TectraAmountTokens, TectraDeepPartial, toStyleObject } from '@tectra-ng/themes';\nimport { TxAmountCurrencyDisplay, TxAmountNotation, TxAmountPart, TxAmountSign } from './amount.types';\nimport { formatAmount } from './format-amount';\nimport { provideTxIconDefaults } from '@tectra-ng/icons';\nimport { AMOUNT_ICON_DEFAULTS } from './amount.icons';\nimport { AMOUNT_THEME } from './amount.theme';\n\n@Component({\n selector: 'tx-amount',\n template: `\n @if (isEmpty()) {\n <span class=\"tx-amount__empty\">{{ emptyText() }}</span>\n } @else {\n @for (segment of segments(); track $index) {\n @if (segment.currency) {\n <span class=\"tx-amount__currency\" [class]=\"passThrough().currency?.class\" [style]=\"passThrough().currency?.style\">{{ segment.text }}</span>\n } @else {\n <span class=\"tx-amount__value\" [class]=\"passThrough().value?.class\" [style]=\"passThrough().value?.style\">{{ segment.text }}</span>\n }\n }\n }\n `,\n styleUrl: './amount.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'tx-amount',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[attr.data-sign]': 'signColor() ? sign() : null',\n '[class.tx-amount--strong]': 'strong()',\n '[class.tx-amount--zero]': 'sign() === \"zero\"',\n '[class.tx-amount--empty]': 'isEmpty()',\n },\n viewProviders: [provideTxIconDefaults(AMOUNT_ICON_DEFAULTS)],\n})\nexport class TxAmount {\n private readonly amountTheme = injectTokens(AMOUNT_THEME);\n\n private localeService = inject(TxLocaleService);\n\n readonly amount = input<number | null | undefined>(null);\n readonly currency = input<string | null | undefined>(undefined);\n readonly format = input<string>('1.0-2');\n readonly notation = input<TxAmountNotation>('standard');\n readonly currencyDisplay = input<TxAmountCurrencyDisplay>('narrowSymbol');\n readonly showSign = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly signColor = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly strong = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly locale = input<string | undefined>(undefined);\n readonly emptyText = input<string>('—');\n readonly dt = input<TectraDeepPartial<TectraAmountTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxAmountPart, TxAmount> | undefined>(undefined);\n readonly ptOptions = input<TxPassThroughOptions | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly isUnstyled = injectUnstyled(this.unstyled);\n readonly passThrough = injectPassThrough('amount', this, this.pt, this.ptOptions);\n readonly isEmpty = computed(() => {\n const amount = this.amount();\n return amount === null || amount === undefined || Number.isNaN(amount);\n });\n readonly sign = computed<TxAmountSign | null>(() => {\n const amount = this.amount();\n if (this.isEmpty() || amount === null || amount === undefined) {\n return null;\n }\n return amount > 0 ? 'positive' : amount < 0 ? 'negative' : 'zero';\n });\n readonly segments = computed(() => {\n const amount = this.amount();\n if (this.isEmpty() || amount === null || amount === undefined) {\n return [];\n }\n return formatAmount(amount, {\n locale: this.locale() ?? this.localeService.locale().intl,\n currency: this.currency(),\n format: this.format(),\n notation: this.notation(),\n currencyDisplay: this.currencyDisplay(),\n showSign: this.showSign(),\n });\n });\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-amount'), ...this.passThrough().root?.style }));\n}\n"],"mappings":";;;;;;;AAEA,MAAM,cAAc;AAKpB,SAAgB,gBAAgB,QAA0B;CACxD,MAAM,QAAQ,YAAY,MAAM,UAAU,GAAA,CAAI,KAAI,CAAE;CACpD,IAAI,CAAC,OACH,OAAO,CAAA;CAET,MAAM,GAAG,SA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IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,IAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,WAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,YAAA;IAAA,SAAA;IAAA,SAAA;IAAA,oBAAA;IAAA,kBAAA;IAAA,2BAAA;IAAA,yBAAA;IAAA,0BAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UA3BT;;;;;;;;;;;;;EAYT,UAAA;EAAA,QAAA,CAAA,q3BAAA;EAAA,eAac,CAAC,sBAAsB,oBAAoB,CAAC;EAAC,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAEjD,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EA7BpB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAW,UACX;;;;;;;;;;;;;GAYT,iBAEgB,wBAAwB;GAAM,MACzC;IACJ,OAAO;IACP,WAAW;IACX,WAAW;IACX,sBAAsB;IACtB,oBAAoB;IACpB,6BAA6B;IAC7B,2BAA2B;IAC3B,4BAA4B;GAC7B;GAAA,eACc,CAAC,sBAAsB,oBAAoB,CAAC;GAAC,QAAA,CAAA,q3BAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"tectra-ng-ui-amount.mjs","names":[],"sources":["../../../../packages/ui/amount/src/format-amount.ts","../../../../packages/ui/amount/src/amount.icons.ts","../../../../packages/ui/amount/src/amount.theme.ts","../../../../packages/ui/amount/src/amount.component.ts"],"sourcesContent":["import { TxAmountFormatOptions, TxAmountSegment } from './amount.types';\n\nconst DIGITS_INFO = /^(\\d+)?(?:\\.(\\d+))?(?:-(\\d+))?$/;\nconst DEFAULT_FORMAT = '1.0-2';\n\n/**\n * Reads a digits-info string like `1.2-2` (integer digits, minimum and maximum fraction digits) into number format options; an invalid string gives no options.\n */\nexport function parseDigitsInfo(format: string | undefined): Pick<Intl.NumberFormatOptions, 'minimumIntegerDigits' | 'minimumFractionDigits' | 'maximumFractionDigits'> {\n const match = DIGITS_INFO.exec((format ?? '').trim());\n if (!match) {\n return {};\n }\n const [, integer, minFraction, maxFraction] = match;\n const minimumFractionDigits = minFraction === undefined ? undefined : Number(minFraction);\n const maximumFractionDigits = maxFraction === undefined ? minimumFractionDigits : Math.max(Number(maxFraction), minimumFractionDigits ?? 0);\n return {\n ...(integer === undefined ? {} : { minimumIntegerDigits: Math.max(1, Number(integer)) }),\n ...(minimumFractionDigits === undefined ? {} : { minimumFractionDigits }),\n ...(maximumFractionDigits === undefined ? {} : { maximumFractionDigits }),\n };\n}\n\nfunction toSegments(parts: Intl.NumberFormatPart[]): TxAmountSegment[] {\n const segments: TxAmountSegment[] = [];\n for (const part of parts) {\n const currency = part.type === 'currency';\n const last = segments[segments.length - 1];\n if (last && last.currency === currency) {\n last.text += part.value;\n } else {\n segments.push({ text: part.value, currency });\n }\n }\n return segments;\n}\n\n/**\n * Formats a number as money in the given locale and currency and splits the result into currency and number segments.\n */\nexport function formatAmount(amount: number, options: TxAmountFormatOptions): TxAmountSegment[] {\n const currency = options.currency?.trim();\n const base = (format: string | undefined): Intl.NumberFormatOptions => ({\n ...parseDigitsInfo(format),\n notation: options.notation ?? 'standard',\n signDisplay: options.showSign ? 'exceptZero' : 'auto',\n });\n const plain = base(options.format ?? DEFAULT_FORMAT);\n if (currency) {\n try {\n return toSegments(\n new Intl.NumberFormat(options.locale, { ...base(options.format), style: 'currency', currency, currencyDisplay: options.currencyDisplay ?? 'narrowSymbol' }).formatToParts(amount),\n );\n } catch {\n return [...toSegments(new Intl.NumberFormat(options.locale, plain).formatToParts(amount)), { text: ' ', currency: false }, { text: currency, currency: true }];\n }\n }\n return toSegments(new Intl.NumberFormat(options.locale, plain).formatToParts(amount));\n}\n","import { TxIconSet, txIconCode } from '@tectra-ng/icons';\n\nexport const AMOUNT_ICON_DEFAULTS: TxIconSet = {\n code: txIconCode,\n};\n","import { amountTokens } from '@tectra-ng/themes';\n\nexport const AMOUNT_THEME = {\n amount: amountTokens,\n};\n","import { ChangeDetectionStrategy, Component, booleanAttribute, computed, inject, input } from '@angular/core';\nimport { injectPassThrough, injectTokens, injectUnstyled, TxPassThrough, TxPassThroughOptions } from '@tectra-ng/core/config';\nimport { TxLocaleService } from '@tectra-ng/core/i18n';\nimport { optionalBoolean } from '@tectra-ng/core/utils';\nimport { TectraAmountTokens, TectraDeepPartial, toStyleObject } from '@tectra-ng/themes';\nimport { TxAmountCurrencyDisplay, TxAmountNotation, TxAmountPart, TxAmountSign } from './amount.types';\nimport { formatAmount } from './format-amount';\nimport { provideTxIconDefaults } from '@tectra-ng/icons';\nimport { AMOUNT_ICON_DEFAULTS } from './amount.icons';\nimport { AMOUNT_THEME } from './amount.theme';\n\n@Component({\n selector: 'tx-amount',\n template: `\n @if (isEmpty()) {\n <span class=\"tx-amount__empty\">{{ emptyText() }}</span>\n } @else {\n @for (segment of segments(); track $index) {\n @if (segment.currency) {\n <span class=\"tx-amount__currency\" [class]=\"passThrough().currency?.class\" [style]=\"passThrough().currency?.style\">{{ segment.text }}</span>\n } @else {\n <span class=\"tx-amount__value\" [class]=\"passThrough().value?.class\" [style]=\"passThrough().value?.style\">{{ segment.text }}</span>\n }\n }\n }\n `,\n styleUrl: './amount.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'tx-amount',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[attr.data-sign]': 'signColor() ? sign() : null',\n '[class.tx-amount--strong]': 'strong()',\n '[class.tx-amount--zero]': 'sign() === \"zero\"',\n '[class.tx-amount--empty]': 'isEmpty()',\n },\n viewProviders: [provideTxIconDefaults(AMOUNT_ICON_DEFAULTS)],\n})\nexport class TxAmount {\n private readonly amountTheme = injectTokens(AMOUNT_THEME);\n\n private localeService = inject(TxLocaleService);\n\n readonly amount = input<number | null | undefined>(null);\n readonly currency = input<string | null | undefined>(undefined);\n readonly format = input<string | undefined>(undefined);\n readonly notation = input<TxAmountNotation>('standard');\n readonly currencyDisplay = input<TxAmountCurrencyDisplay>('narrowSymbol');\n readonly showSign = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly signColor = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly strong = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly locale = input<string | undefined>(undefined);\n readonly emptyText = input<string>('—');\n readonly dt = input<TectraDeepPartial<TectraAmountTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxAmountPart, TxAmount> | undefined>(undefined);\n readonly ptOptions = input<TxPassThroughOptions | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly isUnstyled = injectUnstyled(this.unstyled);\n readonly passThrough = injectPassThrough('amount', this, this.pt, this.ptOptions);\n readonly isEmpty = computed(() => {\n const amount = this.amount();\n return amount === null || amount === undefined || Number.isNaN(amount);\n });\n readonly sign = computed<TxAmountSign | null>(() => {\n const amount = this.amount();\n if (this.isEmpty() || amount === null || amount === undefined) {\n return null;\n }\n return amount > 0 ? 'positive' : amount < 0 ? 'negative' : 'zero';\n });\n readonly segments = computed(() => {\n const amount = this.amount();\n if (this.isEmpty() || amount === null || amount === undefined) {\n return [];\n }\n return formatAmount(amount, {\n locale: this.locale() ?? this.localeService.locale().intl,\n currency: this.currency(),\n format: this.format(),\n notation: this.notation(),\n currencyDisplay: this.currencyDisplay(),\n showSign: this.showSign(),\n });\n });\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-amount'), ...this.passThrough().root?.style }));\n}\n"],"mappings":";;;;;;;AAEA,MAAM,cAAc;AACpB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(timezone) {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
function clockTime(value) {
|
|
16
|
+
if (value === null || value === void 0 || value === "") return null;
|
|
17
|
+
const time = value instanceof Date ? value.getTime() : typeof value === "string" ? Date.parse(value) : value;
|
|
18
|
+
return Number.isFinite(time) ? time : null;
|
|
19
|
+
}
|
|
15
20
|
function clockHands(now, timezone) {
|
|
16
21
|
const parts = Object.fromEntries(new Intl.DateTimeFormat("en-GB", {
|
|
17
22
|
hour: "2-digit",
|
|
@@ -19,7 +24,7 @@ function clockHands(now, timezone) {
|
|
|
19
24
|
second: "2-digit",
|
|
20
25
|
hourCycle: "h23",
|
|
21
26
|
timeZone: validTimeZone(timezone)
|
|
22
|
-
}).formatToParts(new Date(now)).map((part) => [part.type, part.value]));
|
|
27
|
+
}).formatToParts(new Date(clockTime(now) ?? Date.now())).map((part) => [part.type, part.value]));
|
|
23
28
|
const hours = Number(parts["hour"]);
|
|
24
29
|
const minutes = Number(parts["minute"]);
|
|
25
30
|
const seconds = Number(parts["second"]);
|
|
@@ -42,7 +47,7 @@ var TxAnalogClockHandsPipe = class TxAnalogClockHandsPipe {
|
|
|
42
47
|
}
|
|
43
48
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
44
49
|
minVersion: "12.0.0",
|
|
45
|
-
version: "22.2.
|
|
50
|
+
version: "22.2.6",
|
|
46
51
|
ngImport: i0,
|
|
47
52
|
type: TxAnalogClockHandsPipe,
|
|
48
53
|
deps: [],
|
|
@@ -50,7 +55,7 @@ var TxAnalogClockHandsPipe = class TxAnalogClockHandsPipe {
|
|
|
50
55
|
});
|
|
51
56
|
static ɵpipe = i0.ɵɵngDeclarePipe({
|
|
52
57
|
minVersion: "14.0.0",
|
|
53
|
-
version: "22.2.
|
|
58
|
+
version: "22.2.6",
|
|
54
59
|
ngImport: i0,
|
|
55
60
|
type: TxAnalogClockHandsPipe,
|
|
56
61
|
isStandalone: true,
|
|
@@ -59,7 +64,7 @@ var TxAnalogClockHandsPipe = class TxAnalogClockHandsPipe {
|
|
|
59
64
|
};
|
|
60
65
|
i0.ɵɵngDeclareClassMetadata({
|
|
61
66
|
minVersion: "12.0.0",
|
|
62
|
-
version: "22.2.
|
|
67
|
+
version: "22.2.6",
|
|
63
68
|
ngImport: i0,
|
|
64
69
|
type: TxAnalogClockHandsPipe,
|
|
65
70
|
decorators: [{
|
|
@@ -106,7 +111,8 @@ var TxAnalogClock = class TxAnalogClock {
|
|
|
106
111
|
];
|
|
107
112
|
now = signal(Date.now(), ...ngDevMode ? [{ debugName: "now" }] : /* istanbul ignore next */ []);
|
|
108
113
|
timer = null;
|
|
109
|
-
|
|
114
|
+
fixedTime = computed(() => clockTime(this.time()), ...ngDevMode ? [{ debugName: "fixedTime" }] : /* istanbul ignore next */ []);
|
|
115
|
+
hands = computed(() => clockHands(this.fixedTime() ?? this.now(), this.timezone()), ...ngDevMode ? [{ debugName: "hands" }] : /* istanbul ignore next */ []);
|
|
110
116
|
label = computed(() => this.ariaLabel() ? `${this.ariaLabel()}, ${this.hands().time}` : this.hands().time, ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
111
117
|
hourAngle = linkedSignal({
|
|
112
118
|
...ngDevMode ? { debugName: "hourAngle" } : /* istanbul ignore next */ {},
|
|
@@ -125,7 +131,7 @@ var TxAnalogClock = class TxAnalogClock {
|
|
|
125
131
|
});
|
|
126
132
|
schedule = effect((onCleanup) => {
|
|
127
133
|
this.now();
|
|
128
|
-
if (this.
|
|
134
|
+
if (this.fixedTime() !== null) return;
|
|
129
135
|
const step = this.showSeconds() ? 1e3 : 6e4;
|
|
130
136
|
this.timer = setTimeout(() => this.now.set(Date.now()), step - Date.now() % step + 5);
|
|
131
137
|
onCleanup(() => {
|
|
@@ -137,7 +143,7 @@ var TxAnalogClock = class TxAnalogClock {
|
|
|
137
143
|
});
|
|
138
144
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
139
145
|
minVersion: "12.0.0",
|
|
140
|
-
version: "22.2.
|
|
146
|
+
version: "22.2.6",
|
|
141
147
|
ngImport: i0,
|
|
142
148
|
type: TxAnalogClock,
|
|
143
149
|
deps: [],
|
|
@@ -145,7 +151,7 @@ var TxAnalogClock = class TxAnalogClock {
|
|
|
145
151
|
});
|
|
146
152
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
147
153
|
minVersion: "17.0.0",
|
|
148
|
-
version: "22.2.
|
|
154
|
+
version: "22.2.6",
|
|
149
155
|
type: TxAnalogClock,
|
|
150
156
|
isStandalone: true,
|
|
151
157
|
selector: "tx-analog-clock",
|
|
@@ -255,13 +261,13 @@ var TxAnalogClock = class TxAnalogClock {
|
|
|
255
261
|
</div>
|
|
256
262
|
`,
|
|
257
263
|
isInline: true,
|
|
258
|
-
styles: [":host{display:block}.tx-analog-clock__face{position:relative;box-sizing:border-box;width:100%;
|
|
264
|
+
styles: [":host{display:block}.tx-analog-clock__face{position:relative;box-sizing:border-box;width:100%;aspect-ratio:1;border-radius:50%}.tx-analog-clock__tick,.tx-analog-clock__hand,.tx-analog-clock__pin{position:absolute;left:50%;border-radius:9999px}:host([data-styled]){width:var(--tx-analog-clock-size);max-width:100%;aspect-ratio:1}:host([data-styled]) .tx-analog-clock__face{background:var(--tx-analog-clock-background);box-shadow:0 0 0 1px var(--tx-analog-clock-border-color),var(--tx-analog-clock-shadow)}:host([data-styled]) .tx-analog-clock__tick{top:50%;width:var(--tx-analog-clock-tick-width);height:var(--tx-analog-clock-tick-height);margin-top:calc(var(--tx-analog-clock-tick-height) / -2);margin-left:calc(var(--tx-analog-clock-tick-width) / -2);background:var(--tx-analog-clock-tick-color);transform:rotate(var(--tx-analog-clock-angle)) translateY(var(--tx-analog-clock-tick-offset))}:host([data-styled]) .tx-analog-clock__tick--major{height:var(--tx-analog-clock-tick-major-height);margin-top:calc(var(--tx-analog-clock-tick-major-height) / -2);background:var(--tx-analog-clock-tick-major-color);transform:rotate(var(--tx-analog-clock-angle)) translateY(var(--tx-analog-clock-tick-major-offset))}:host([data-styled]) .tx-analog-clock__hand{bottom:50%;transform-origin:bottom;rotate:var(--tx-analog-clock-angle);transition:rotate var(--tx-analog-clock-transition-duration) var(--tx-analog-clock-transition-easing)}:host([data-styled]) .tx-analog-clock__hand--hour{width:var(--tx-analog-clock-hour-hand-width);height:var(--tx-analog-clock-hour-hand-length);margin-left:calc(var(--tx-analog-clock-hour-hand-width) / -2);background:var(--tx-analog-clock-hour-hand-color)}:host([data-styled]) .tx-analog-clock__hand--minute{width:var(--tx-analog-clock-minute-hand-width);height:var(--tx-analog-clock-minute-hand-length);margin-left:calc(var(--tx-analog-clock-minute-hand-width) / -2);background:var(--tx-analog-clock-minute-hand-color)}:host([data-styled]) .tx-analog-clock__hand--second{width:var(--tx-analog-clock-second-hand-width);height:var(--tx-analog-clock-second-hand-length);margin-left:calc(var(--tx-analog-clock-second-hand-width) / -2);background:var(--tx-analog-clock-second-hand-color)}:host([data-styled]) .tx-analog-clock__pin{top:50%;width:var(--tx-analog-clock-pin-size);height:var(--tx-analog-clock-pin-size);background:var(--tx-analog-clock-pin-color);box-shadow:0 0 0 var(--tx-analog-clock-pin-ring-width) var(--tx-analog-clock-pin-ring-color);transform:translate(-50%,-50%)}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-analog-clock__hand{transition:none}}\n"],
|
|
259
265
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
260
266
|
});
|
|
261
267
|
};
|
|
262
268
|
i0.ɵɵngDeclareClassMetadata({
|
|
263
269
|
minVersion: "12.0.0",
|
|
264
|
-
version: "22.2.
|
|
270
|
+
version: "22.2.6",
|
|
265
271
|
ngImport: i0,
|
|
266
272
|
type: TxAnalogClock,
|
|
267
273
|
decorators: [{
|
|
@@ -313,7 +319,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
313
319
|
"[style]": "hostStyle()",
|
|
314
320
|
"[attr.data-styled]": "!isUnstyled() || null"
|
|
315
321
|
},
|
|
316
|
-
styles: [":host{display:block}.tx-analog-clock__face{position:relative;box-sizing:border-box;width:100%;
|
|
322
|
+
styles: [":host{display:block}.tx-analog-clock__face{position:relative;box-sizing:border-box;width:100%;aspect-ratio:1;border-radius:50%}.tx-analog-clock__tick,.tx-analog-clock__hand,.tx-analog-clock__pin{position:absolute;left:50%;border-radius:9999px}:host([data-styled]){width:var(--tx-analog-clock-size);max-width:100%;aspect-ratio:1}:host([data-styled]) .tx-analog-clock__face{background:var(--tx-analog-clock-background);box-shadow:0 0 0 1px var(--tx-analog-clock-border-color),var(--tx-analog-clock-shadow)}:host([data-styled]) .tx-analog-clock__tick{top:50%;width:var(--tx-analog-clock-tick-width);height:var(--tx-analog-clock-tick-height);margin-top:calc(var(--tx-analog-clock-tick-height) / -2);margin-left:calc(var(--tx-analog-clock-tick-width) / -2);background:var(--tx-analog-clock-tick-color);transform:rotate(var(--tx-analog-clock-angle)) translateY(var(--tx-analog-clock-tick-offset))}:host([data-styled]) .tx-analog-clock__tick--major{height:var(--tx-analog-clock-tick-major-height);margin-top:calc(var(--tx-analog-clock-tick-major-height) / -2);background:var(--tx-analog-clock-tick-major-color);transform:rotate(var(--tx-analog-clock-angle)) translateY(var(--tx-analog-clock-tick-major-offset))}:host([data-styled]) .tx-analog-clock__hand{bottom:50%;transform-origin:bottom;rotate:var(--tx-analog-clock-angle);transition:rotate var(--tx-analog-clock-transition-duration) var(--tx-analog-clock-transition-easing)}:host([data-styled]) .tx-analog-clock__hand--hour{width:var(--tx-analog-clock-hour-hand-width);height:var(--tx-analog-clock-hour-hand-length);margin-left:calc(var(--tx-analog-clock-hour-hand-width) / -2);background:var(--tx-analog-clock-hour-hand-color)}:host([data-styled]) .tx-analog-clock__hand--minute{width:var(--tx-analog-clock-minute-hand-width);height:var(--tx-analog-clock-minute-hand-length);margin-left:calc(var(--tx-analog-clock-minute-hand-width) / -2);background:var(--tx-analog-clock-minute-hand-color)}:host([data-styled]) .tx-analog-clock__hand--second{width:var(--tx-analog-clock-second-hand-width);height:var(--tx-analog-clock-second-hand-length);margin-left:calc(var(--tx-analog-clock-second-hand-width) / -2);background:var(--tx-analog-clock-second-hand-color)}:host([data-styled]) .tx-analog-clock__pin{top:50%;width:var(--tx-analog-clock-pin-size);height:var(--tx-analog-clock-pin-size);background:var(--tx-analog-clock-pin-color);box-shadow:0 0 0 var(--tx-analog-clock-pin-ring-width) var(--tx-analog-clock-pin-ring-color);transform:translate(-50%,-50%)}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-analog-clock__hand{transition:none}}\n"]
|
|
317
323
|
}]
|
|
318
324
|
}],
|
|
319
325
|
propDecorators: {
|
|
@@ -383,6 +389,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
383
389
|
}]
|
|
384
390
|
}
|
|
385
391
|
});
|
|
386
|
-
export { TxAnalogClock, TxAnalogClockHandsPipe, clockHands, forwardAngle, validTimeZone };
|
|
392
|
+
export { TxAnalogClock, TxAnalogClockHandsPipe, clockHands, clockTime, forwardAngle, validTimeZone };
|
|
387
393
|
|
|
388
394
|
//# sourceMappingURL=tectra-ng-ui-analog-clock.mjs.map
|