@wirekyt/angular 0.0.11 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/fesm2022/wirekyt-angular-accordion.mjs +58 -22
  2. package/dist/fesm2022/wirekyt-angular-accordion.mjs.map +1 -1
  3. package/dist/fesm2022/wirekyt-angular-color-picker.mjs +92 -9
  4. package/dist/fesm2022/wirekyt-angular-color-picker.mjs.map +1 -1
  5. package/dist/fesm2022/wirekyt-angular-combobox.mjs +44 -74
  6. package/dist/fesm2022/wirekyt-angular-combobox.mjs.map +1 -1
  7. package/dist/fesm2022/wirekyt-angular-date-input.mjs +532 -0
  8. package/dist/fesm2022/wirekyt-angular-date-input.mjs.map +1 -0
  9. package/dist/fesm2022/wirekyt-angular-date-picker.mjs +1315 -0
  10. package/dist/fesm2022/wirekyt-angular-date-picker.mjs.map +1 -0
  11. package/dist/fesm2022/wirekyt-angular-presence.mjs +176 -0
  12. package/dist/fesm2022/wirekyt-angular-presence.mjs.map +1 -0
  13. package/dist/package.json +17 -5
  14. package/dist/types/wirekyt-angular-accordion.d.ts +5 -1
  15. package/dist/types/wirekyt-angular-accordion.d.ts.map +1 -1
  16. package/dist/types/wirekyt-angular-color-picker.d.ts +7 -3
  17. package/dist/types/wirekyt-angular-color-picker.d.ts.map +1 -1
  18. package/dist/types/wirekyt-angular-combobox.d.ts +7 -39
  19. package/dist/types/wirekyt-angular-combobox.d.ts.map +1 -1
  20. package/dist/types/wirekyt-angular-date-input.d.ts +164 -0
  21. package/dist/types/wirekyt-angular-date-input.d.ts.map +1 -0
  22. package/dist/types/wirekyt-angular-date-picker.d.ts +340 -0
  23. package/dist/types/wirekyt-angular-date-picker.d.ts.map +1 -0
  24. package/dist/types/wirekyt-angular-presence.d.ts +64 -0
  25. package/dist/types/wirekyt-angular-presence.d.ts.map +1 -0
  26. package/package.json +19 -7
@@ -3,8 +3,8 @@ import { anatomy } from '@wirekyt/dom/machines/combobox';
3
3
  import { injectLocale, injectEnvironment, createId, useMachine, bindProps, createCvaController, buildRootCarrier } from '@wirekyt/angular';
4
4
  import { injectFieldContextOptional } from '@wirekyt/angular/field';
5
5
  import * as i0 from '@angular/core';
6
- import { input, booleanAttribute, output, signal, effect, computed, Directive, InjectionToken, inject, TemplateRef, ViewContainerRef, ElementRef, untracked, DestroyRef, Renderer2, model, EnvironmentInjector, Injector, forwardRef } from '@angular/core';
7
- import * as presence from '@wirekyt/dom/machines/presence';
6
+ import { InjectionToken, inject, TemplateRef, ViewContainerRef, ElementRef, effect, untracked, DestroyRef, Renderer2, Directive, input, model, booleanAttribute, output, signal, EnvironmentInjector, Injector, forwardRef, computed } from '@angular/core';
7
+ import { injectPresenceContext, PresenceBase, PRESENCE_CONTEXT } from '@wirekyt/angular/presence';
8
8
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
9
9
  import { ListCollection } from '@wirekyt/dom/collection';
10
10
 
@@ -52,52 +52,6 @@ function useCombobox(options) {
52
52
  });
53
53
  }
54
54
 
55
- class ComboboxPresence {
56
- lazyMount = input(false, { ...(ngDevMode ? { debugName: "lazyMount" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
57
- unmountOnExit = input(false, { ...(ngDevMode ? { debugName: "unmountOnExit" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
58
- skipAnimationOnMount = input(false, { ...(ngDevMode ? { debugName: "skipAnimationOnMount" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
59
- immediate = input(false, { ...(ngDevMode ? { debugName: "immediate" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
60
- present = input(undefined, /* @ts-ignore */
61
- ...(ngDevMode ? [{ debugName: "present" }] : /* istanbul ignore next */ []));
62
- exitComplete = output();
63
- createPresence(open) {
64
- const machine = useMachine({
65
- machine: presence.machine,
66
- context: () => ({
67
- present: this.present() ?? open(),
68
- immediate: this.immediate(),
69
- onExitComplete: () => this.exitComplete.emit(),
70
- }),
71
- connect: presence.connect,
72
- });
73
- const wasPresent = signal(false, /* @ts-ignore */
74
- ...(ngDevMode ? [{ debugName: "wasPresent" }] : /* istanbul ignore next */ []));
75
- effect(() => {
76
- if (machine.api().present)
77
- wasPresent.set(true);
78
- });
79
- return {
80
- api: machine.api,
81
- isUnmounted: computed(() => !machine.api().present &&
82
- ((!wasPresent() && this.lazyMount()) || (wasPresent() && this.unmountOnExit()))),
83
- props: () => ({
84
- hidden: !machine.api().present,
85
- "data-state": machine.api().skip && this.skipAnimationOnMount()
86
- ? undefined
87
- : (this.present() ?? open())
88
- ? "open"
89
- : "closed",
90
- }),
91
- };
92
- }
93
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxPresence, deps: [], target: i0.ɵɵFactoryTarget.Directive });
94
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ComboboxPresence, isStandalone: true, inputs: { lazyMount: { classPropertyName: "lazyMount", publicName: "lazyMount", isSignal: true, isRequired: false, transformFunction: null }, unmountOnExit: { classPropertyName: "unmountOnExit", publicName: "unmountOnExit", isSignal: true, isRequired: false, transformFunction: null }, skipAnimationOnMount: { classPropertyName: "skipAnimationOnMount", publicName: "skipAnimationOnMount", isSignal: true, isRequired: false, transformFunction: null }, immediate: { classPropertyName: "immediate", publicName: "immediate", isSignal: true, isRequired: false, transformFunction: null }, present: { classPropertyName: "present", publicName: "present", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { exitComplete: "exitComplete" }, ngImport: i0 });
95
- }
96
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxPresence, decorators: [{
97
- type: Directive
98
- }], propDecorators: { lazyMount: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazyMount", required: false }] }], unmountOnExit: [{ type: i0.Input, args: [{ isSignal: true, alias: "unmountOnExit", required: false }] }], skipAnimationOnMount: [{ type: i0.Input, args: [{ isSignal: true, alias: "skipAnimationOnMount", required: false }] }], immediate: [{ type: i0.Input, args: [{ isSignal: true, alias: "immediate", required: false }] }], present: [{ type: i0.Input, args: [{ isSignal: true, alias: "present", required: false }] }], exitComplete: [{ type: i0.Output, args: ["exitComplete"] }] } });
99
- const COMBOBOX_PRESENCE = new InjectionToken("WIREKYT.COMBOBOX_PRESENCE");
100
-
101
55
  const COMBOBOX_CONTEXT = new InjectionToken("WIREKYT.COMBOBOX_CONTEXT");
102
56
  function injectComboboxContext() {
103
57
  return inject(COMBOBOX_CONTEXT);
@@ -110,14 +64,14 @@ function injectComboboxContextCarrier() {
110
64
  class ComboboxContent {
111
65
  constructor() {
112
66
  const context = injectComboboxContext();
113
- const { presence } = inject(COMBOBOX_PRESENCE);
67
+ const presence = injectPresenceContext();
114
68
  const template = inject((TemplateRef), { optional: true });
115
69
  const container = inject(ViewContainerRef);
116
70
  const host = inject(ElementRef);
117
71
  const elementRef = template ? { nativeElement: null } : host;
118
72
  let view;
119
73
  effect(() => {
120
- const unmounted = presence.isUnmounted();
74
+ const unmounted = presence.unmounted();
121
75
  if (template) {
122
76
  if (unmounted) {
123
77
  elementRef.nativeElement = null;
@@ -130,15 +84,15 @@ class ComboboxContent {
130
84
  view.rootNodes.find((node) => node.nodeType === 1) ?? null;
131
85
  }
132
86
  }
133
- untracked(() => presence.api().setNode(elementRef.nativeElement));
87
+ untracked(() => presence.setNode(elementRef.nativeElement));
134
88
  });
135
89
  bindProps({
136
90
  elementRef,
137
91
  renderer: inject(Renderer2),
138
92
  destroyRef: inject(DestroyRef),
139
93
  props: () => {
140
- presence.isUnmounted();
141
- return { ...context.api().getContentProps(), ...presence.props() };
94
+ presence.unmounted();
95
+ return { ...context.api().getContentProps(), ...presence.getPresenceProps() };
142
96
  },
143
97
  });
144
98
  }
@@ -150,7 +104,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
150
104
  args: [{ selector: "[comboboxContent]", standalone: true, exportAs: "comboboxContent" }]
151
105
  }], ctorParameters: () => [] });
152
106
 
153
- class ComboboxRoot extends ComboboxPresence {
107
+ class ComboboxRoot extends PresenceBase {
154
108
  id = input(undefined, /* @ts-ignore */
155
109
  ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
156
110
  elementIds = input(undefined, { ...(ngDevMode ? { debugName: "elementIds" } : /* istanbul ignore next */ {}), alias: "ids" });
@@ -318,8 +272,9 @@ class ComboboxRoot extends ComboboxPresence {
318
272
  api = this.machine.api;
319
273
  service = this.machine.service;
320
274
  send = this.machine.send;
275
+ presence = this.createPresence(() => this.api().open);
321
276
  contextCarrier = buildRootCarrier({
322
- providers: [{ provide: COMBOBOX_PRESENCE, useValue: this }],
277
+ providers: [{ provide: PRESENCE_CONTEXT, useValue: this.presence }],
323
278
  root: this,
324
279
  rootToken: COMBOBOX_CONTEXT,
325
280
  originInjector: inject(Injector),
@@ -328,7 +283,6 @@ class ComboboxRoot extends ComboboxPresence {
328
283
  getContextCarrier() {
329
284
  return this.contextCarrier;
330
285
  }
331
- presence = this.createPresence(() => this.api().open);
332
286
  constructor() {
333
287
  super();
334
288
  let firstRunValue = true;
@@ -375,7 +329,11 @@ class ComboboxRoot extends ComboboxPresence {
375
329
  }
376
330
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive });
377
331
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ComboboxRoot, isStandalone: true, selector: "[comboboxRoot]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, elementIds: { classPropertyName: "elementIds", publicName: "ids", isSignal: true, isRequired: false, transformFunction: null }, collection: { classPropertyName: "collection", publicName: "collection", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, inputValue: { classPropertyName: "inputValue", publicName: "inputValue", isSignal: true, isRequired: false, transformFunction: null }, defaultInputValue: { classPropertyName: "defaultInputValue", publicName: "defaultInputValue", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, defaultOpen: { classPropertyName: "defaultOpen", publicName: "defaultOpen", isSignal: true, isRequired: false, transformFunction: null }, highlightedValue: { classPropertyName: "highlightedValue", publicName: "highlightedValue", isSignal: true, isRequired: false, transformFunction: null }, defaultHighlightedValue: { classPropertyName: "defaultHighlightedValue", publicName: "defaultHighlightedValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, allowCustomValue: { classPropertyName: "allowCustomValue", publicName: "allowCustomValue", isSignal: true, isRequired: false, transformFunction: null }, autoFocus: { classPropertyName: "autoFocus", publicName: "autoFocus", isSignal: true, isRequired: false, transformFunction: null }, openOnClick: { classPropertyName: "openOnClick", publicName: "openOnClick", isSignal: true, isRequired: false, transformFunction: null }, openOnKeyPress: { classPropertyName: "openOnKeyPress", publicName: "openOnKeyPress", isSignal: true, isRequired: false, transformFunction: null }, alwaysSubmitOnEnter: { classPropertyName: "alwaysSubmitOnEnter", publicName: "alwaysSubmitOnEnter", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, loopFocus: { classPropertyName: "loopFocus", publicName: "loopFocus", isSignal: true, isRequired: false, transformFunction: null }, composite: { classPropertyName: "composite", publicName: "composite", isSignal: true, isRequired: false, transformFunction: null }, disableLayer: { classPropertyName: "disableLayer", publicName: "disableLayer", isSignal: true, isRequired: false, transformFunction: null }, inputBehavior: { classPropertyName: "inputBehavior", publicName: "inputBehavior", isSignal: true, isRequired: false, transformFunction: null }, selectionBehavior: { classPropertyName: "selectionBehavior", publicName: "selectionBehavior", isSignal: true, isRequired: false, transformFunction: null }, openOnChange: { classPropertyName: "openOnChange", publicName: "openOnChange", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, positioning: { classPropertyName: "positioning", publicName: "positioning", isSignal: true, isRequired: false, transformFunction: null }, scrollToIndexFn: { classPropertyName: "scrollToIndexFn", publicName: "scrollToIndexFn", isSignal: true, isRequired: false, transformFunction: null }, navigate: { classPropertyName: "navigate", publicName: "navigate", isSignal: true, isRequired: false, transformFunction: null }, translations: { classPropertyName: "translations", publicName: "translations", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", inputValue: "inputValueChange", open: "openChange", highlightedValue: "highlightedValueChange", valueChangeDetails: "valueChangeDetails", inputValueChangeDetails: "inputValueChangeDetails", highlightChange: "highlightChange", openChangeDetails: "openChangeDetails", select: "select", focusOutside: "focusOutside", pointerDownOutside: "pointerDownOutside", interactOutside: "interactOutside" }, providers: [
378
- { provide: COMBOBOX_PRESENCE, useExisting: forwardRef(() => ComboboxRoot) },
332
+ {
333
+ provide: PRESENCE_CONTEXT,
334
+ useFactory: (root) => root.presence,
335
+ deps: [forwardRef(() => ComboboxRoot)],
336
+ },
379
337
  { provide: COMBOBOX_CONTEXT, useExisting: forwardRef(() => ComboboxRoot) },
380
338
  {
381
339
  provide: COMBOBOX_CONTEXT_CARRIER,
@@ -392,7 +350,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
392
350
  standalone: true,
393
351
  exportAs: "comboboxRoot",
394
352
  providers: [
395
- { provide: COMBOBOX_PRESENCE, useExisting: forwardRef(() => ComboboxRoot) },
353
+ {
354
+ provide: PRESENCE_CONTEXT,
355
+ useFactory: (root) => root.presence,
356
+ deps: [forwardRef(() => ComboboxRoot)],
357
+ },
396
358
  { provide: COMBOBOX_CONTEXT, useExisting: forwardRef(() => ComboboxRoot) },
397
359
  {
398
360
  provide: COMBOBOX_CONTEXT_CARRIER,
@@ -417,7 +379,7 @@ function arraysShallowEqual(a, b) {
417
379
  return true;
418
380
  }
419
381
 
420
- class ComboboxRootProvider extends ComboboxPresence {
382
+ class ComboboxRootProvider extends PresenceBase {
421
383
  value = input.required(/* @ts-ignore */
422
384
  ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
423
385
  get state() {
@@ -435,8 +397,16 @@ class ComboboxRootProvider extends ComboboxPresence {
435
397
  resolveValue() {
436
398
  return this.value();
437
399
  }
400
+ presence = this.createPresence(() => {
401
+ try {
402
+ return this.api().open;
403
+ }
404
+ catch {
405
+ return false;
406
+ }
407
+ });
438
408
  contextCarrier = buildRootCarrier({
439
- providers: [{ provide: COMBOBOX_PRESENCE, useValue: this }],
409
+ providers: [{ provide: PRESENCE_CONTEXT, useValue: this.presence }],
440
410
  root: this,
441
411
  rootToken: COMBOBOX_CONTEXT,
442
412
  originInjector: inject(Injector),
@@ -445,14 +415,6 @@ class ComboboxRootProvider extends ComboboxPresence {
445
415
  getContextCarrier() {
446
416
  return this.contextCarrier;
447
417
  }
448
- presence = this.createPresence(() => {
449
- try {
450
- return this.api().open;
451
- }
452
- catch {
453
- return false;
454
- }
455
- });
456
418
  constructor() {
457
419
  super();
458
420
  bindProps({
@@ -464,7 +426,11 @@ class ComboboxRootProvider extends ComboboxPresence {
464
426
  }
465
427
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxRootProvider, deps: [], target: i0.ɵɵFactoryTarget.Directive });
466
428
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ComboboxRootProvider, isStandalone: true, selector: "[comboboxRootProvider]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, providers: [
467
- { provide: COMBOBOX_PRESENCE, useExisting: forwardRef(() => ComboboxRootProvider) },
429
+ {
430
+ provide: PRESENCE_CONTEXT,
431
+ useFactory: (provider) => provider.presence,
432
+ deps: [forwardRef(() => ComboboxRootProvider)],
433
+ },
468
434
  { provide: COMBOBOX_CONTEXT, useExisting: forwardRef(() => ComboboxRootProvider) },
469
435
  {
470
436
  provide: COMBOBOX_CONTEXT_CARRIER,
@@ -480,7 +446,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
480
446
  standalone: true,
481
447
  exportAs: "comboboxRootProvider",
482
448
  providers: [
483
- { provide: COMBOBOX_PRESENCE, useExisting: forwardRef(() => ComboboxRootProvider) },
449
+ {
450
+ provide: PRESENCE_CONTEXT,
451
+ useFactory: (provider) => provider.presence,
452
+ deps: [forwardRef(() => ComboboxRootProvider)],
453
+ },
484
454
  { provide: COMBOBOX_CONTEXT, useExisting: forwardRef(() => ComboboxRootProvider) },
485
455
  {
486
456
  provide: COMBOBOX_CONTEXT_CARRIER,
@@ -647,14 +617,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
647
617
  class ComboboxPositioner {
648
618
  constructor() {
649
619
  const context = injectComboboxContext();
650
- const { presence } = inject(COMBOBOX_PRESENCE);
620
+ const presence = injectPresenceContext();
651
621
  const template = inject((TemplateRef), { optional: true });
652
622
  const container = inject(ViewContainerRef);
653
623
  const host = inject(ElementRef);
654
624
  const elementRef = template ? { nativeElement: null } : host;
655
625
  let view;
656
626
  effect(() => {
657
- const unmounted = presence.isUnmounted();
627
+ const unmounted = presence.unmounted();
658
628
  if (template) {
659
629
  if (unmounted) {
660
630
  elementRef.nativeElement = null;
@@ -673,8 +643,8 @@ class ComboboxPositioner {
673
643
  renderer: inject(Renderer2),
674
644
  destroyRef: inject(DestroyRef),
675
645
  props: () => {
676
- presence.isUnmounted();
677
- return { ...context.api().getPositionerProps(), hidden: presence.isUnmounted() };
646
+ presence.unmounted();
647
+ return { ...context.api().getPositionerProps(), hidden: presence.unmounted() };
678
648
  },
679
649
  });
680
650
  }