@propbinder/mobile-design 0.2.70 → 0.2.73
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 +63 -63
- package/assets/fonts/brockmann-medium-webfont.woff2 +0 -0
- package/assets/fonts/brockmann-mediumitalic-webfont.woff2 +0 -0
- package/assets/fonts/brockmann-regular-webfont.woff2 +0 -0
- package/assets/fonts/brockmann-regularitalic-webfont.woff2 +0 -0
- package/assets/fonts/brockmann-semibold-webfont.woff2 +0 -0
- package/assets/fonts/brockmann-semibolditalic-webfont.woff2 +0 -0
- package/fesm2022/propbinder-mobile-design-ds-mobile-days-sheet-YO-dvZLx.mjs +148 -0
- package/fesm2022/propbinder-mobile-design-ds-mobile-days-sheet-YO-dvZLx.mjs.map +1 -0
- package/fesm2022/propbinder-mobile-design-ds-mobile-duration-sheet-l8x6d78y.mjs +288 -0
- package/fesm2022/propbinder-mobile-design-ds-mobile-duration-sheet-l8x6d78y.mjs.map +1 -0
- package/fesm2022/propbinder-mobile-design-ds-mobile-time-sheet-B9cV9oGj.mjs +115 -0
- package/fesm2022/propbinder-mobile-design-ds-mobile-time-sheet-B9cV9oGj.mjs.map +1 -0
- package/fesm2022/propbinder-mobile-design.mjs +22051 -14981
- package/fesm2022/propbinder-mobile-design.mjs.map +1 -1
- package/index.d.ts +3231 -2357
- package/package.json +2 -2
- package/styles/ionic.css +988 -954
- package/styles/mobile-common.css +155 -150
- package/styles/mobile-page-base.css +338 -333
package/README.md
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
# MobileDesignLib
|
|
2
|
-
|
|
3
|
-
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.3.0.
|
|
4
|
-
|
|
5
|
-
## Code scaffolding
|
|
6
|
-
|
|
7
|
-
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
ng generate component component-name
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
ng generate --help
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Building
|
|
20
|
-
|
|
21
|
-
To build the library, run:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
ng build mobile-design-lib
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
-
|
|
29
|
-
### Publishing the Library
|
|
30
|
-
|
|
31
|
-
Once the project is built, you can publish your library by following these steps:
|
|
32
|
-
|
|
33
|
-
1. Navigate to the `dist` directory:
|
|
34
|
-
```bash
|
|
35
|
-
cd dist/mobile-design-lib
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
39
|
-
```bash
|
|
40
|
-
npm publish
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Running unit tests
|
|
44
|
-
|
|
45
|
-
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
ng test
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Running end-to-end tests
|
|
52
|
-
|
|
53
|
-
For end-to-end (e2e) testing, run:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
ng e2e
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
60
|
-
|
|
61
|
-
## Additional Resources
|
|
62
|
-
|
|
63
|
-
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
1
|
+
# MobileDesignLib
|
|
2
|
+
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.3.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ng generate component component-name
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ng generate --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Building
|
|
20
|
+
|
|
21
|
+
To build the library, run:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ng build mobile-design-lib
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
+
|
|
29
|
+
### Publishing the Library
|
|
30
|
+
|
|
31
|
+
Once the project is built, you can publish your library by following these steps:
|
|
32
|
+
|
|
33
|
+
1. Navigate to the `dist` directory:
|
|
34
|
+
```bash
|
|
35
|
+
cd dist/mobile-design-lib
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
39
|
+
```bash
|
|
40
|
+
npm publish
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Running unit tests
|
|
44
|
+
|
|
45
|
+
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
ng test
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Running end-to-end tests
|
|
52
|
+
|
|
53
|
+
For end-to-end (e2e) testing, run:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ng e2e
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
60
|
+
|
|
61
|
+
## Additional Resources
|
|
62
|
+
|
|
63
|
+
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { signal, computed, Input, CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
|
|
3
|
+
import { DsMobileBottomSheetWrapperComponent, DsMobileBottomSheetHeaderComponent } from './propbinder-mobile-design.mjs';
|
|
4
|
+
import * as i1 from '@ionic/angular/standalone';
|
|
5
|
+
|
|
6
|
+
const ALL_DAYS = [
|
|
7
|
+
{ full: 'Mandag', short: 'Man', key: 'man' },
|
|
8
|
+
{ full: 'Tirsdag', short: 'Tir', key: 'tir' },
|
|
9
|
+
{ full: 'Onsdag', short: 'Ons', key: 'ons' },
|
|
10
|
+
{ full: 'Torsdag', short: 'Tor', key: 'tor' },
|
|
11
|
+
{ full: 'Fredag', short: 'Fre', key: 'fre' },
|
|
12
|
+
{ full: 'Lørdag', short: 'Lør', key: 'lør' },
|
|
13
|
+
{ full: 'Søndag', short: 'Søn', key: 'søn' },
|
|
14
|
+
];
|
|
15
|
+
const WEEKDAY_KEYS = new Set(['man', 'tir', 'ons', 'tor', 'fre']);
|
|
16
|
+
const WEEKEND_KEYS = new Set(['lør', 'søn']);
|
|
17
|
+
class DsMobileDaysSheetComponent {
|
|
18
|
+
modalController;
|
|
19
|
+
initialDays;
|
|
20
|
+
days = ALL_DAYS;
|
|
21
|
+
selectedDays = signal(new Set(), ...(ngDevMode ? [{ debugName: "selectedDays" }] : []));
|
|
22
|
+
isValid = computed(() => this.selectedDays().size > 0, ...(ngDevMode ? [{ debugName: "isValid" }] : []));
|
|
23
|
+
constructor(modalController) {
|
|
24
|
+
this.modalController = modalController;
|
|
25
|
+
}
|
|
26
|
+
ngOnInit() {
|
|
27
|
+
if (this.initialDays?.length) {
|
|
28
|
+
const fullNames = this.initialDays.map((short) => ALL_DAYS.find((d) => d.short === short || d.full === short)?.full).filter(Boolean);
|
|
29
|
+
this.selectedDays.set(new Set(fullNames));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
this.selectedDays.set(new Set(['Fredag', 'Lørdag', 'Søndag']));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
toggleDay(day) {
|
|
36
|
+
const current = new Set(this.selectedDays());
|
|
37
|
+
current.has(day) ? current.delete(day) : current.add(day);
|
|
38
|
+
this.selectedDays.set(current);
|
|
39
|
+
}
|
|
40
|
+
confirmSelection() {
|
|
41
|
+
const selected = this.selectedDays();
|
|
42
|
+
const days = ALL_DAYS.filter((d) => selected.has(d.full)).map((d) => d.short);
|
|
43
|
+
const label = formatDaysLabel(days.map((s) => s.toLowerCase()));
|
|
44
|
+
this.modalController.dismiss({ label, days }, 'select');
|
|
45
|
+
}
|
|
46
|
+
dismiss() {
|
|
47
|
+
this.modalController.dismiss(null, 'cancel');
|
|
48
|
+
}
|
|
49
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DsMobileDaysSheetComponent, deps: [{ token: i1.ModalController }], target: i0.ɵɵFactoryTarget.Component });
|
|
50
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DsMobileDaysSheetComponent, isStandalone: true, selector: "ds-mobile-days-sheet", inputs: { initialDays: "initialDays" }, ngImport: i0, template: `
|
|
51
|
+
<ds-mobile-bottom-sheet-wrapper>
|
|
52
|
+
<ds-mobile-bottom-sheet-header
|
|
53
|
+
title="Dagene"
|
|
54
|
+
leftButtonLabel="Annuller"
|
|
55
|
+
rightButtonLabel="Gem"
|
|
56
|
+
[rightButtonDisabled]="!isValid()"
|
|
57
|
+
(leftButtonClick)="dismiss()"
|
|
58
|
+
(rightButtonClick)="confirmSelection()">
|
|
59
|
+
</ds-mobile-bottom-sheet-header>
|
|
60
|
+
|
|
61
|
+
<div class="sheet-content">
|
|
62
|
+
<div class="day-grid">
|
|
63
|
+
@for (day of days; track day.full) {
|
|
64
|
+
<button
|
|
65
|
+
type="button"
|
|
66
|
+
class="day-chip"
|
|
67
|
+
[class.active]="selectedDays().has(day.full)"
|
|
68
|
+
(click)="toggleDay(day.full)">
|
|
69
|
+
{{ day.full }}
|
|
70
|
+
</button>
|
|
71
|
+
}
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</ds-mobile-bottom-sheet-wrapper>
|
|
75
|
+
`, isInline: true, styles: [".sheet-content{padding:16px}.day-grid{display:flex;flex-wrap:wrap;gap:8px}.day-chip{display:flex;align-items:center;justify-content:center;height:40px;padding:0 16px;border-radius:99px;border:none;background:var(--color-background-neutral-secondary, #f6f7f8);font-family:Brockmann,sans-serif;font-size:var(--font-size-sm, 14px);font-weight:500;line-height:18px;letter-spacing:-.56px;color:var(--text-color-default-primary, #202227);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background .15s ease,color .15s ease}.day-chip:hover:not(.active){background:var(--color-background-neutral-secondary-hover, #ebebeb)}.day-chip:active{opacity:.7}.day-chip:focus-visible{outline:2px solid var(--color-brand-primary, #5d5fef);outline-offset:2px}.day-chip.active{background:var(--color-accent, #6b5ff5);color:#fff}\n"], dependencies: [{ kind: "component", type: DsMobileBottomSheetWrapperComponent, selector: "ds-mobile-bottom-sheet-wrapper", inputs: ["showDragHandle"] }, { kind: "component", type: DsMobileBottomSheetHeaderComponent, selector: "ds-mobile-bottom-sheet-header", inputs: ["title", "leftButtonLabel", "rightButtonLabel", "rightButtonDisabled", "rightButtonLoading"], outputs: ["leftButtonClick", "rightButtonClick"] }] });
|
|
76
|
+
}
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DsMobileDaysSheetComponent, decorators: [{
|
|
78
|
+
type: Component,
|
|
79
|
+
args: [{ selector: 'ds-mobile-days-sheet', standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA], imports: [
|
|
80
|
+
DsMobileBottomSheetWrapperComponent,
|
|
81
|
+
DsMobileBottomSheetHeaderComponent,
|
|
82
|
+
], template: `
|
|
83
|
+
<ds-mobile-bottom-sheet-wrapper>
|
|
84
|
+
<ds-mobile-bottom-sheet-header
|
|
85
|
+
title="Dagene"
|
|
86
|
+
leftButtonLabel="Annuller"
|
|
87
|
+
rightButtonLabel="Gem"
|
|
88
|
+
[rightButtonDisabled]="!isValid()"
|
|
89
|
+
(leftButtonClick)="dismiss()"
|
|
90
|
+
(rightButtonClick)="confirmSelection()">
|
|
91
|
+
</ds-mobile-bottom-sheet-header>
|
|
92
|
+
|
|
93
|
+
<div class="sheet-content">
|
|
94
|
+
<div class="day-grid">
|
|
95
|
+
@for (day of days; track day.full) {
|
|
96
|
+
<button
|
|
97
|
+
type="button"
|
|
98
|
+
class="day-chip"
|
|
99
|
+
[class.active]="selectedDays().has(day.full)"
|
|
100
|
+
(click)="toggleDay(day.full)">
|
|
101
|
+
{{ day.full }}
|
|
102
|
+
</button>
|
|
103
|
+
}
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</ds-mobile-bottom-sheet-wrapper>
|
|
107
|
+
`, styles: [".sheet-content{padding:16px}.day-grid{display:flex;flex-wrap:wrap;gap:8px}.day-chip{display:flex;align-items:center;justify-content:center;height:40px;padding:0 16px;border-radius:99px;border:none;background:var(--color-background-neutral-secondary, #f6f7f8);font-family:Brockmann,sans-serif;font-size:var(--font-size-sm, 14px);font-weight:500;line-height:18px;letter-spacing:-.56px;color:var(--text-color-default-primary, #202227);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background .15s ease,color .15s ease}.day-chip:hover:not(.active){background:var(--color-background-neutral-secondary-hover, #ebebeb)}.day-chip:active{opacity:.7}.day-chip:focus-visible{outline:2px solid var(--color-brand-primary, #5d5fef);outline-offset:2px}.day-chip.active{background:var(--color-accent, #6b5ff5);color:#fff}\n"] }]
|
|
108
|
+
}], ctorParameters: () => [{ type: i1.ModalController }], propDecorators: { initialDays: [{
|
|
109
|
+
type: Input
|
|
110
|
+
}] } });
|
|
111
|
+
const CANONICAL_ORDER = ['man', 'tir', 'ons', 'tor', 'fre', 'lør', 'søn'];
|
|
112
|
+
const FULL_NAME = {
|
|
113
|
+
man: 'Mandag', tir: 'Tirsdag', ons: 'Onsdag', tor: 'Torsdag',
|
|
114
|
+
fre: 'Fredag', lør: 'Lørdag', søn: 'Søndag',
|
|
115
|
+
};
|
|
116
|
+
function capitalize(s) {
|
|
117
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Given an array of lowercase weekday keys (e.g. ["fre","lør","søn"]),
|
|
121
|
+
* returns a concise Danish label for display.
|
|
122
|
+
*/
|
|
123
|
+
function formatDaysLabel(keys) {
|
|
124
|
+
const set = new Set(keys);
|
|
125
|
+
if (set.size === 7)
|
|
126
|
+
return 'Alle dage';
|
|
127
|
+
if (set.size === 5 && [...WEEKDAY_KEYS].every((k) => set.has(k)))
|
|
128
|
+
return 'Hverdage';
|
|
129
|
+
if (set.size === 2 && [...WEEKEND_KEYS].every((k) => set.has(k)))
|
|
130
|
+
return 'Weekend';
|
|
131
|
+
if (set.size === 1)
|
|
132
|
+
return FULL_NAME[keys[0]] ?? capitalize(keys[0]);
|
|
133
|
+
const indices = CANONICAL_ORDER
|
|
134
|
+
.map((d, i) => (set.has(d) ? i : -1))
|
|
135
|
+
.filter((i) => i !== -1);
|
|
136
|
+
if (indices.length >= 2) {
|
|
137
|
+
const isConsecutive = indices.every((val, i) => i === 0 || val === indices[i - 1] + 1);
|
|
138
|
+
if (isConsecutive) {
|
|
139
|
+
const start = capitalize(CANONICAL_ORDER[indices[0]]);
|
|
140
|
+
const end = CANONICAL_ORDER[indices[indices.length - 1]];
|
|
141
|
+
return `${start}\u2013${end}`;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return 'Udvalgte dage';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { DsMobileDaysSheetComponent, formatDaysLabel };
|
|
148
|
+
//# sourceMappingURL=propbinder-mobile-design-ds-mobile-days-sheet-YO-dvZLx.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propbinder-mobile-design-ds-mobile-days-sheet-YO-dvZLx.mjs","sources":["../../../projects/mobile-design-lib/src/components/facility-creation-modal/sheets/ds-mobile-days-sheet.ts"],"sourcesContent":["import { Component, signal, computed, Input, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';\r\nimport { ModalController } from '@ionic/angular/standalone';\r\nimport { DsMobileBottomSheetWrapperComponent } from '../../bottom-sheet/ds-mobile-bottom-sheet-wrapper';\r\nimport { DsMobileBottomSheetHeaderComponent } from '../../bottom-sheet/ds-mobile-bottom-sheet-header';\r\n\r\nconst ALL_DAYS = [\r\n { full: 'Mandag', short: 'Man', key: 'man' },\r\n { full: 'Tirsdag', short: 'Tir', key: 'tir' },\r\n { full: 'Onsdag', short: 'Ons', key: 'ons' },\r\n { full: 'Torsdag', short: 'Tor', key: 'tor' },\r\n { full: 'Fredag', short: 'Fre', key: 'fre' },\r\n { full: 'Lørdag', short: 'Lør', key: 'lør' },\r\n { full: 'Søndag', short: 'Søn', key: 'søn' },\r\n];\r\n\r\nconst WEEKDAY_KEYS = new Set(['man', 'tir', 'ons', 'tor', 'fre']);\r\nconst WEEKEND_KEYS = new Set(['lør', 'søn']);\r\n\r\n@Component({\r\n selector: 'ds-mobile-days-sheet',\r\n standalone: true,\r\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\r\n imports: [\r\n DsMobileBottomSheetWrapperComponent,\r\n DsMobileBottomSheetHeaderComponent,\r\n ],\r\n template: `\r\n <ds-mobile-bottom-sheet-wrapper>\r\n <ds-mobile-bottom-sheet-header\r\n title=\"Dagene\"\r\n leftButtonLabel=\"Annuller\"\r\n rightButtonLabel=\"Gem\"\r\n [rightButtonDisabled]=\"!isValid()\"\r\n (leftButtonClick)=\"dismiss()\"\r\n (rightButtonClick)=\"confirmSelection()\">\r\n </ds-mobile-bottom-sheet-header>\r\n\r\n <div class=\"sheet-content\">\r\n <div class=\"day-grid\">\r\n @for (day of days; track day.full) {\r\n <button\r\n type=\"button\"\r\n class=\"day-chip\"\r\n [class.active]=\"selectedDays().has(day.full)\"\r\n (click)=\"toggleDay(day.full)\">\r\n {{ day.full }}\r\n </button>\r\n }\r\n </div>\r\n </div>\r\n </ds-mobile-bottom-sheet-wrapper>\r\n `,\r\n styles: [`\r\n .sheet-content {\r\n padding: 16px;\r\n }\r\n\r\n .day-grid {\r\n display: flex;\r\n flex-wrap: wrap;\r\n gap: 8px;\r\n }\r\n\r\n .day-chip {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n height: 40px;\r\n padding: 0 16px;\r\n border-radius: 99px;\r\n border: none;\r\n background: var(--color-background-neutral-secondary, #f6f7f8);\r\n font-family: 'Brockmann', sans-serif;\r\n font-size: var(--font-size-sm, 14px);\r\n font-weight: 500;\r\n line-height: 18px;\r\n letter-spacing: -0.56px;\r\n color: var(--text-color-default-primary, #202227);\r\n cursor: pointer;\r\n -webkit-tap-highlight-color: transparent;\r\n transition: background 0.15s ease, color 0.15s ease;\r\n }\r\n\r\n .day-chip:hover:not(.active) {\r\n background: var(--color-background-neutral-secondary-hover, #ebebeb);\r\n }\r\n\r\n .day-chip:active {\r\n opacity: 0.7;\r\n }\r\n\r\n .day-chip:focus-visible {\r\n outline: 2px solid var(--color-brand-primary, #5d5fef);\r\n outline-offset: 2px;\r\n }\r\n\r\n .day-chip.active {\r\n background: var(--color-accent, #6b5ff5);\r\n color: white;\r\n }\r\n `],\r\n})\r\nexport class DsMobileDaysSheetComponent {\r\n @Input() initialDays?: string[];\r\n\r\n days = ALL_DAYS;\r\n selectedDays = signal<Set<string>>(new Set());\r\n\r\n isValid = computed(() => this.selectedDays().size > 0);\r\n\r\n constructor(private modalController: ModalController) {}\r\n\r\n ngOnInit(): void {\r\n if (this.initialDays?.length) {\r\n const fullNames = this.initialDays.map(\r\n (short) => ALL_DAYS.find((d) => d.short === short || d.full === short)?.full\r\n ).filter(Boolean) as string[];\r\n this.selectedDays.set(new Set(fullNames));\r\n } else {\r\n this.selectedDays.set(new Set(['Fredag', 'Lørdag', 'Søndag']));\r\n }\r\n }\r\n\r\n toggleDay(day: string): void {\r\n const current = new Set(this.selectedDays());\r\n current.has(day) ? current.delete(day) : current.add(day);\r\n this.selectedDays.set(current);\r\n }\r\n\r\n confirmSelection(): void {\r\n const selected = this.selectedDays();\r\n const days = ALL_DAYS.filter((d) => selected.has(d.full)).map((d) => d.short);\r\n const label = formatDaysLabel(days.map((s) => s.toLowerCase()));\r\n this.modalController.dismiss({ label, days }, 'select');\r\n }\r\n\r\n dismiss(): void {\r\n this.modalController.dismiss(null, 'cancel');\r\n }\r\n}\r\n\r\nconst CANONICAL_ORDER = ['man', 'tir', 'ons', 'tor', 'fre', 'lør', 'søn'];\r\n\r\nconst FULL_NAME: Record<string, string> = {\r\n man: 'Mandag', tir: 'Tirsdag', ons: 'Onsdag', tor: 'Torsdag',\r\n fre: 'Fredag', lør: 'Lørdag', søn: 'Søndag',\r\n};\r\n\r\nfunction capitalize(s: string): string {\r\n return s.charAt(0).toUpperCase() + s.slice(1);\r\n}\r\n\r\n/**\r\n * Given an array of lowercase weekday keys (e.g. [\"fre\",\"lør\",\"søn\"]),\r\n * returns a concise Danish label for display.\r\n */\r\nexport function formatDaysLabel(keys: string[]): string {\r\n const set = new Set(keys);\r\n\r\n if (set.size === 7) return 'Alle dage';\r\n\r\n if (set.size === 5 && [...WEEKDAY_KEYS].every((k) => set.has(k))) return 'Hverdage';\r\n\r\n if (set.size === 2 && [...WEEKEND_KEYS].every((k) => set.has(k))) return 'Weekend';\r\n\r\n if (set.size === 1) return FULL_NAME[keys[0]] ?? capitalize(keys[0]);\r\n\r\n const indices = CANONICAL_ORDER\r\n .map((d, i) => (set.has(d) ? i : -1))\r\n .filter((i) => i !== -1);\r\n\r\n if (indices.length >= 2) {\r\n const isConsecutive = indices.every(\r\n (val, i) => i === 0 || val === indices[i - 1] + 1\r\n );\r\n if (isConsecutive) {\r\n const start = capitalize(CANONICAL_ORDER[indices[0]]);\r\n const end = CANONICAL_ORDER[indices[indices.length - 1]];\r\n return `${start}\\u2013${end}`;\r\n }\r\n }\r\n\r\n return 'Udvalgte dage';\r\n}\r\n"],"names":[],"mappings":";;;;;AAKA,MAAM,QAAQ,GAAG;IACf,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE;IAC5C,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE;IAC7C,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE;IAC5C,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE;IAC7C,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE;IAC5C,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE;IAC5C,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE;CAC7C;AAED,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACjE,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;MAsF/B,0BAA0B,CAAA;AAQjB,IAAA,eAAA;AAPX,IAAA,WAAW;IAEpB,IAAI,GAAG,QAAQ;AACf,IAAA,YAAY,GAAG,MAAM,CAAc,IAAI,GAAG,EAAE,wDAAC;AAE7C,IAAA,OAAO,GAAG,QAAQ,CAAC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AC,GAAG,CAAC,CAAC,CAAC,CAAC;AAAE,QAAA,OAAO,SAAS;AAElF,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC;AAAE,QAAA,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEpE,MAAM,OAAO,GAAG;SACb,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;SACnC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAE1B,IAAA,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE;AACvB,QAAA,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CACjC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAClD;QACD,IAAI,aAAa,EAAE;AACjB,YAAA,MAAM,KAAK,GAAG,UAAU,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,YAAA,MAAM,GAAG,GAAG,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACxD,YAAA,OAAO,CAAA,EAAG,KAAK,CAAA,MAAA,EAAS,GAAG,EAAE;QAC/B;IACF;AAEA,IAAA,OAAO,eAAe;AACxB;;;;"}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, PLATFORM_ID, signal, computed, Input, CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
|
|
3
|
+
import { isPlatformBrowser, CommonModule } from '@angular/common';
|
|
4
|
+
import * as i2 from '@angular/forms';
|
|
5
|
+
import { FormsModule } from '@angular/forms';
|
|
6
|
+
import * as i1 from '@ionic/angular/standalone';
|
|
7
|
+
import { IonPicker, IonPickerColumn, IonPickerColumnOption } from '@ionic/angular/standalone';
|
|
8
|
+
import { DsMobileBottomSheetWrapperComponent, DsMobileBottomSheetHeaderComponent, DsMobileDropdownComponent } from './propbinder-mobile-design.mjs';
|
|
9
|
+
|
|
10
|
+
class DsMobileDurationSheetComponent {
|
|
11
|
+
modalController;
|
|
12
|
+
platformId = inject(PLATFORM_ID);
|
|
13
|
+
initialDuration;
|
|
14
|
+
isDesktop = signal(false, ...(ngDevMode ? [{ debugName: "isDesktop" }] : []));
|
|
15
|
+
selectedDuration = signal('1 time', ...(ngDevMode ? [{ debugName: "selectedDuration" }] : []));
|
|
16
|
+
pickerOpen = signal(false, ...(ngDevMode ? [{ debugName: "pickerOpen" }] : []));
|
|
17
|
+
customHours = signal(1, ...(ngDevMode ? [{ debugName: "customHours" }] : []));
|
|
18
|
+
customMinutes = signal(0, ...(ngDevMode ? [{ debugName: "customMinutes" }] : []));
|
|
19
|
+
options = [
|
|
20
|
+
{ value: '30 min', label: '30 min' },
|
|
21
|
+
{ value: '1 time', label: '1 time' },
|
|
22
|
+
{ value: '2 timer', label: '2 timer' },
|
|
23
|
+
{ value: 'Hele dagen', label: 'Hele dagen' },
|
|
24
|
+
{ value: 'Vælg selv', label: 'Vælg selv' },
|
|
25
|
+
];
|
|
26
|
+
hours = Array.from({ length: 24 }, (_, i) => i);
|
|
27
|
+
minuteOptions = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55];
|
|
28
|
+
customLabel = computed(() => {
|
|
29
|
+
const h = this.customHours();
|
|
30
|
+
const m = this.customMinutes();
|
|
31
|
+
const parts = [];
|
|
32
|
+
if (h > 0)
|
|
33
|
+
parts.push(`${h}t`);
|
|
34
|
+
if (m > 0)
|
|
35
|
+
parts.push(`${m}min`);
|
|
36
|
+
return parts.join(' ');
|
|
37
|
+
}, ...(ngDevMode ? [{ debugName: "customLabel" }] : []));
|
|
38
|
+
showInlineInputs = computed(() => this.selectedDuration() === 'Vælg selv' && this.isDesktop(), ...(ngDevMode ? [{ debugName: "showInlineInputs" }] : []));
|
|
39
|
+
isValid = computed(() => {
|
|
40
|
+
if (this.selectedDuration() === 'Vælg selv') {
|
|
41
|
+
return this.customHours() > 0 || this.customMinutes() > 0;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
}, ...(ngDevMode ? [{ debugName: "isValid" }] : []));
|
|
45
|
+
constructor(modalController) {
|
|
46
|
+
this.modalController = modalController;
|
|
47
|
+
}
|
|
48
|
+
ngOnInit() {
|
|
49
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
50
|
+
this.isDesktop.set(window.innerWidth >= 768);
|
|
51
|
+
}
|
|
52
|
+
if (this.initialDuration) {
|
|
53
|
+
const preset = this.options.find((o) => o.value === this.initialDuration);
|
|
54
|
+
if (preset) {
|
|
55
|
+
this.selectedDuration.set(preset.value);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.selectedDuration.set('Vælg selv');
|
|
59
|
+
this.parseCustomDuration(this.initialDuration);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
selectDuration(value) {
|
|
64
|
+
this.selectedDuration.set(value);
|
|
65
|
+
if (value === 'Vælg selv' && !this.isDesktop()) {
|
|
66
|
+
this.pickerOpen.set(true);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
normalize() {
|
|
70
|
+
const totalMinutes = this.customHours() * 60 + this.customMinutes();
|
|
71
|
+
const clamped = Math.max(0, Math.min(totalMinutes, 23 * 60 + 55));
|
|
72
|
+
this.customHours.set(Math.floor(clamped / 60));
|
|
73
|
+
this.customMinutes.set(clamped % 60);
|
|
74
|
+
}
|
|
75
|
+
onPickerDismiss() {
|
|
76
|
+
this.normalize();
|
|
77
|
+
this.pickerOpen.set(false);
|
|
78
|
+
}
|
|
79
|
+
confirmSelection() {
|
|
80
|
+
const value = this.selectedDuration() === 'Vælg selv'
|
|
81
|
+
? this.customLabel()
|
|
82
|
+
: this.selectedDuration();
|
|
83
|
+
this.modalController.dismiss({ value }, 'select');
|
|
84
|
+
}
|
|
85
|
+
dismiss() {
|
|
86
|
+
this.modalController.dismiss(null, 'cancel');
|
|
87
|
+
}
|
|
88
|
+
parseCustomDuration(str) {
|
|
89
|
+
const hMatch = str.match(/(\d+)\s*t/);
|
|
90
|
+
const mMatch = str.match(/(\d+)\s*min/);
|
|
91
|
+
if (hMatch)
|
|
92
|
+
this.customHours.set(+hMatch[1]);
|
|
93
|
+
if (mMatch)
|
|
94
|
+
this.customMinutes.set(+mMatch[1]);
|
|
95
|
+
}
|
|
96
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DsMobileDurationSheetComponent, deps: [{ token: i1.ModalController }], target: i0.ɵɵFactoryTarget.Component });
|
|
97
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DsMobileDurationSheetComponent, isStandalone: true, selector: "ds-mobile-duration-sheet", inputs: { initialDuration: "initialDuration" }, ngImport: i0, template: `
|
|
98
|
+
<ds-mobile-bottom-sheet-wrapper>
|
|
99
|
+
<ds-mobile-bottom-sheet-header
|
|
100
|
+
title="Varighed"
|
|
101
|
+
leftButtonLabel="Annuller"
|
|
102
|
+
rightButtonLabel="Gem"
|
|
103
|
+
[rightButtonDisabled]="!isValid()"
|
|
104
|
+
(leftButtonClick)="dismiss()"
|
|
105
|
+
(rightButtonClick)="confirmSelection()">
|
|
106
|
+
</ds-mobile-bottom-sheet-header>
|
|
107
|
+
|
|
108
|
+
<div class="sheet-content">
|
|
109
|
+
<div class="chip-grid">
|
|
110
|
+
@for (option of options; track option.value) {
|
|
111
|
+
<button
|
|
112
|
+
type="button"
|
|
113
|
+
class="chip"
|
|
114
|
+
[id]="option.value === 'Vælg selv' ? 'vaelg-selv-chip' : null"
|
|
115
|
+
[class.active]="selectedDuration() === option.value"
|
|
116
|
+
(click)="selectDuration(option.value)">
|
|
117
|
+
@if (option.value === 'Vælg selv' && selectedDuration() === 'Vælg selv' && customLabel()) {
|
|
118
|
+
{{ customLabel() }}
|
|
119
|
+
} @else {
|
|
120
|
+
{{ option.label }}
|
|
121
|
+
}
|
|
122
|
+
</button>
|
|
123
|
+
}
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
@if (showInlineInputs()) {
|
|
127
|
+
<div class="custom-inputs">
|
|
128
|
+
<input
|
|
129
|
+
type="number"
|
|
130
|
+
class="number-input"
|
|
131
|
+
min="0"
|
|
132
|
+
[ngModel]="customHours()"
|
|
133
|
+
(ngModelChange)="customHours.set(+$event)"
|
|
134
|
+
(blur)="normalize()"
|
|
135
|
+
/>
|
|
136
|
+
<span class="unit">timer</span>
|
|
137
|
+
<input
|
|
138
|
+
type="number"
|
|
139
|
+
class="number-input"
|
|
140
|
+
min="0"
|
|
141
|
+
max="59"
|
|
142
|
+
[ngModel]="customMinutes()"
|
|
143
|
+
(ngModelChange)="customMinutes.set(+$event)"
|
|
144
|
+
(blur)="normalize()"
|
|
145
|
+
/>
|
|
146
|
+
<span class="unit">min</span>
|
|
147
|
+
</div>
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@if (!isDesktop()) {
|
|
151
|
+
<ds-mobile-dropdown
|
|
152
|
+
trigger="vaelg-selv-chip"
|
|
153
|
+
[isOpen]="pickerOpen()"
|
|
154
|
+
maxWidth="240px"
|
|
155
|
+
position="above"
|
|
156
|
+
(closed)="onPickerDismiss()">
|
|
157
|
+
<ng-template #customContent>
|
|
158
|
+
<ion-picker style="--background: transparent; --fade-background-rgb: transparent; --highlight-background: rgba(0, 0, 0, 0.05); --highlight-border-radius: 9999px;">
|
|
159
|
+
<ion-picker-column
|
|
160
|
+
[value]="customHours()"
|
|
161
|
+
style="--padding-start: 4px; --padding-end: 4px;"
|
|
162
|
+
(ionChange)="customHours.set(+($event.detail.value ?? customHours()))">
|
|
163
|
+
<div slot="suffix" class="picker-suffix">t</div>
|
|
164
|
+
@for (h of hours; track h) {
|
|
165
|
+
<ion-picker-column-option [value]="h">{{ h }}</ion-picker-column-option>
|
|
166
|
+
}
|
|
167
|
+
</ion-picker-column>
|
|
168
|
+
<ion-picker-column
|
|
169
|
+
[value]="customMinutes()"
|
|
170
|
+
style="--padding-start: 4px; --padding-end: 4px;"
|
|
171
|
+
(ionChange)="customMinutes.set(+($event.detail.value ?? customMinutes()))">
|
|
172
|
+
<div slot="suffix" class="picker-suffix">min</div>
|
|
173
|
+
@for (m of minuteOptions; track m) {
|
|
174
|
+
<ion-picker-column-option [value]="m">{{ m }}</ion-picker-column-option>
|
|
175
|
+
}
|
|
176
|
+
</ion-picker-column>
|
|
177
|
+
</ion-picker>
|
|
178
|
+
</ng-template>
|
|
179
|
+
</ds-mobile-dropdown>
|
|
180
|
+
}
|
|
181
|
+
</div>
|
|
182
|
+
</ds-mobile-bottom-sheet-wrapper>
|
|
183
|
+
`, isInline: true, styles: [".sheet-content{padding:16px}.chip-grid{display:flex;flex-wrap:wrap;gap:8px}.chip{display:flex;align-items:center;justify-content:center;height:40px;padding:0 16px;border-radius:99px;border:none;background:var(--color-background-neutral-secondary, #f6f7f8);font-family:Brockmann,sans-serif;font-size:var(--font-size-sm, 14px);font-weight:500;line-height:18px;letter-spacing:-.56px;color:var(--text-color-default-primary, #202227);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background .15s ease,color .15s ease}.chip:hover:not(.active){background:var(--color-background-neutral-secondary-hover, #ebebeb)}.chip:active{opacity:.7}.chip:focus-visible{outline:2px solid var(--color-brand-primary, #5d5fef);outline-offset:2px}.chip.active{background:var(--color-accent, #6b5ff5);color:#fff}.custom-inputs{display:flex;align-items:center;gap:8px;margin-top:12px;animation:fadeSlideIn .15s ease}@keyframes fadeSlideIn{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}.number-input{width:64px;height:40px;padding:0 10px;border:1px solid var(--border-color-default, #e3e6eb);border-radius:99px;background:transparent;font-family:Brockmann,sans-serif;font-size:var(--font-size-sm, 14px);font-weight:500;color:var(--text-color-default-primary, #202227);text-align:center;outline:none;transition:border-color .2s ease}.number-input:focus{border-color:var(--color-accent, #6b5ff5)}.number-input::-webkit-inner-spin-button,.number-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.number-input[type=number]{-moz-appearance:textfield}.unit{font-family:Brockmann,sans-serif;font-size:var(--font-size-sm, 14px);font-weight:500;color:var(--text-color-default-secondary, #626b78)}.picker-suffix{margin-left:-24px;font-size:13px;color:var(--text-color-default-secondary, #626b78)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i2.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: DsMobileBottomSheetWrapperComponent, selector: "ds-mobile-bottom-sheet-wrapper", inputs: ["showDragHandle"] }, { kind: "component", type: DsMobileBottomSheetHeaderComponent, selector: "ds-mobile-bottom-sheet-header", inputs: ["title", "leftButtonLabel", "rightButtonLabel", "rightButtonDisabled", "rightButtonLoading"], outputs: ["leftButtonClick", "rightButtonClick"] }, { kind: "component", type: DsMobileDropdownComponent, selector: "ds-mobile-dropdown", inputs: ["trigger", "keepFocusOn", "items", "isOpen", "position", "align", "maxHeight", "emptyMessage", "ariaLabel", "maxWidth"], outputs: ["itemSelected", "closed"] }, { kind: "component", type: IonPicker, selector: "ion-picker", inputs: ["mode"] }, { kind: "component", type: IonPickerColumn, selector: "ion-picker-column", inputs: ["color", "disabled", "mode", "value"] }, { kind: "component", type: IonPickerColumnOption, selector: "ion-picker-column-option", inputs: ["color", "disabled", "value"] }] });
|
|
184
|
+
}
|
|
185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DsMobileDurationSheetComponent, decorators: [{
|
|
186
|
+
type: Component,
|
|
187
|
+
args: [{ selector: 'ds-mobile-duration-sheet', standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA], imports: [
|
|
188
|
+
CommonModule,
|
|
189
|
+
FormsModule,
|
|
190
|
+
DsMobileBottomSheetWrapperComponent,
|
|
191
|
+
DsMobileBottomSheetHeaderComponent,
|
|
192
|
+
DsMobileDropdownComponent,
|
|
193
|
+
IonPicker,
|
|
194
|
+
IonPickerColumn,
|
|
195
|
+
IonPickerColumnOption,
|
|
196
|
+
], template: `
|
|
197
|
+
<ds-mobile-bottom-sheet-wrapper>
|
|
198
|
+
<ds-mobile-bottom-sheet-header
|
|
199
|
+
title="Varighed"
|
|
200
|
+
leftButtonLabel="Annuller"
|
|
201
|
+
rightButtonLabel="Gem"
|
|
202
|
+
[rightButtonDisabled]="!isValid()"
|
|
203
|
+
(leftButtonClick)="dismiss()"
|
|
204
|
+
(rightButtonClick)="confirmSelection()">
|
|
205
|
+
</ds-mobile-bottom-sheet-header>
|
|
206
|
+
|
|
207
|
+
<div class="sheet-content">
|
|
208
|
+
<div class="chip-grid">
|
|
209
|
+
@for (option of options; track option.value) {
|
|
210
|
+
<button
|
|
211
|
+
type="button"
|
|
212
|
+
class="chip"
|
|
213
|
+
[id]="option.value === 'Vælg selv' ? 'vaelg-selv-chip' : null"
|
|
214
|
+
[class.active]="selectedDuration() === option.value"
|
|
215
|
+
(click)="selectDuration(option.value)">
|
|
216
|
+
@if (option.value === 'Vælg selv' && selectedDuration() === 'Vælg selv' && customLabel()) {
|
|
217
|
+
{{ customLabel() }}
|
|
218
|
+
} @else {
|
|
219
|
+
{{ option.label }}
|
|
220
|
+
}
|
|
221
|
+
</button>
|
|
222
|
+
}
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
@if (showInlineInputs()) {
|
|
226
|
+
<div class="custom-inputs">
|
|
227
|
+
<input
|
|
228
|
+
type="number"
|
|
229
|
+
class="number-input"
|
|
230
|
+
min="0"
|
|
231
|
+
[ngModel]="customHours()"
|
|
232
|
+
(ngModelChange)="customHours.set(+$event)"
|
|
233
|
+
(blur)="normalize()"
|
|
234
|
+
/>
|
|
235
|
+
<span class="unit">timer</span>
|
|
236
|
+
<input
|
|
237
|
+
type="number"
|
|
238
|
+
class="number-input"
|
|
239
|
+
min="0"
|
|
240
|
+
max="59"
|
|
241
|
+
[ngModel]="customMinutes()"
|
|
242
|
+
(ngModelChange)="customMinutes.set(+$event)"
|
|
243
|
+
(blur)="normalize()"
|
|
244
|
+
/>
|
|
245
|
+
<span class="unit">min</span>
|
|
246
|
+
</div>
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@if (!isDesktop()) {
|
|
250
|
+
<ds-mobile-dropdown
|
|
251
|
+
trigger="vaelg-selv-chip"
|
|
252
|
+
[isOpen]="pickerOpen()"
|
|
253
|
+
maxWidth="240px"
|
|
254
|
+
position="above"
|
|
255
|
+
(closed)="onPickerDismiss()">
|
|
256
|
+
<ng-template #customContent>
|
|
257
|
+
<ion-picker style="--background: transparent; --fade-background-rgb: transparent; --highlight-background: rgba(0, 0, 0, 0.05); --highlight-border-radius: 9999px;">
|
|
258
|
+
<ion-picker-column
|
|
259
|
+
[value]="customHours()"
|
|
260
|
+
style="--padding-start: 4px; --padding-end: 4px;"
|
|
261
|
+
(ionChange)="customHours.set(+($event.detail.value ?? customHours()))">
|
|
262
|
+
<div slot="suffix" class="picker-suffix">t</div>
|
|
263
|
+
@for (h of hours; track h) {
|
|
264
|
+
<ion-picker-column-option [value]="h">{{ h }}</ion-picker-column-option>
|
|
265
|
+
}
|
|
266
|
+
</ion-picker-column>
|
|
267
|
+
<ion-picker-column
|
|
268
|
+
[value]="customMinutes()"
|
|
269
|
+
style="--padding-start: 4px; --padding-end: 4px;"
|
|
270
|
+
(ionChange)="customMinutes.set(+($event.detail.value ?? customMinutes()))">
|
|
271
|
+
<div slot="suffix" class="picker-suffix">min</div>
|
|
272
|
+
@for (m of minuteOptions; track m) {
|
|
273
|
+
<ion-picker-column-option [value]="m">{{ m }}</ion-picker-column-option>
|
|
274
|
+
}
|
|
275
|
+
</ion-picker-column>
|
|
276
|
+
</ion-picker>
|
|
277
|
+
</ng-template>
|
|
278
|
+
</ds-mobile-dropdown>
|
|
279
|
+
}
|
|
280
|
+
</div>
|
|
281
|
+
</ds-mobile-bottom-sheet-wrapper>
|
|
282
|
+
`, styles: [".sheet-content{padding:16px}.chip-grid{display:flex;flex-wrap:wrap;gap:8px}.chip{display:flex;align-items:center;justify-content:center;height:40px;padding:0 16px;border-radius:99px;border:none;background:var(--color-background-neutral-secondary, #f6f7f8);font-family:Brockmann,sans-serif;font-size:var(--font-size-sm, 14px);font-weight:500;line-height:18px;letter-spacing:-.56px;color:var(--text-color-default-primary, #202227);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background .15s ease,color .15s ease}.chip:hover:not(.active){background:var(--color-background-neutral-secondary-hover, #ebebeb)}.chip:active{opacity:.7}.chip:focus-visible{outline:2px solid var(--color-brand-primary, #5d5fef);outline-offset:2px}.chip.active{background:var(--color-accent, #6b5ff5);color:#fff}.custom-inputs{display:flex;align-items:center;gap:8px;margin-top:12px;animation:fadeSlideIn .15s ease}@keyframes fadeSlideIn{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}.number-input{width:64px;height:40px;padding:0 10px;border:1px solid var(--border-color-default, #e3e6eb);border-radius:99px;background:transparent;font-family:Brockmann,sans-serif;font-size:var(--font-size-sm, 14px);font-weight:500;color:var(--text-color-default-primary, #202227);text-align:center;outline:none;transition:border-color .2s ease}.number-input:focus{border-color:var(--color-accent, #6b5ff5)}.number-input::-webkit-inner-spin-button,.number-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.number-input[type=number]{-moz-appearance:textfield}.unit{font-family:Brockmann,sans-serif;font-size:var(--font-size-sm, 14px);font-weight:500;color:var(--text-color-default-secondary, #626b78)}.picker-suffix{margin-left:-24px;font-size:13px;color:var(--text-color-default-secondary, #626b78)}\n"] }]
|
|
283
|
+
}], ctorParameters: () => [{ type: i1.ModalController }], propDecorators: { initialDuration: [{
|
|
284
|
+
type: Input
|
|
285
|
+
}] } });
|
|
286
|
+
|
|
287
|
+
export { DsMobileDurationSheetComponent };
|
|
288
|
+
//# sourceMappingURL=propbinder-mobile-design-ds-mobile-duration-sheet-l8x6d78y.mjs.map
|