@egose/shadcn-theme-ng-tw 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -11
- package/data-table/README.md +164 -0
- package/data-table/fesm2022/data-table.mjs +1449 -0
- package/data-table/package.json +25 -0
- package/data-table/types/data-table.d.ts +483 -0
- package/dropdown-menu/README.md +2 -0
- package/form-text-input/fesm2022/form-text-input.mjs +1 -1
- package/form-textarea/fesm2022/form-textarea.mjs +1 -1
- package/input/README.md +7 -12
- package/input/fesm2022/input.mjs +7 -4
- package/input/types/input.d.ts +3 -1
- package/layout-simple/fesm2022/layout-simple.mjs +1 -1
- package/package.json +6 -1
- package/phone-input/fesm2022/phone-input.mjs +1 -1
- package/table/README.md +2 -0
- package/table/fesm2022/table.mjs +12 -8
- package/table/types/table.d.ts +7 -2
package/input/fesm2022/input.mjs
CHANGED
|
@@ -4,16 +4,19 @@ import * as i2 from '@spartan-ng/brain/field';
|
|
|
4
4
|
import { BrnFieldControlDescribedBy } from '@spartan-ng/brain/field';
|
|
5
5
|
import * as i1 from '@spartan-ng/brain/input';
|
|
6
6
|
import { BrnInput } from '@spartan-ng/brain/input';
|
|
7
|
-
import { classes } from '@egose/shadcn-theme-ng-tw/utils';
|
|
7
|
+
import { classes, hlm } from '@egose/shadcn-theme-ng-tw/utils';
|
|
8
8
|
|
|
9
9
|
class HlmInput {
|
|
10
10
|
ariaDescribedby = input(null, /* @ts-ignore */
|
|
11
11
|
...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : /* istanbul ignore next */ []));
|
|
12
|
+
/** Height density. Merged after the base height class, so it wins via `twMerge`. */
|
|
13
|
+
size = input('default', /* @ts-ignore */
|
|
14
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
12
15
|
constructor() {
|
|
13
|
-
classes(() => 'tw:dark:bg-input/30 tw:border-input tw:focus-visible:border-ring tw:focus-visible:ring-ring/50 tw:data-[matches-spartan-invalid=true]:ring-destructive/20 tw:dark:data-[matches-spartan-invalid=true]:ring-destructive/40 tw:data-[matches-spartan-invalid=true]:border-destructive tw:dark:data-[matches-spartan-invalid=true]:border-destructive/50 tw:h-9 tw:rounded-md tw:border tw:bg-transparent tw:px-2.5 tw:py-1 tw:text-base tw:shadow-xs tw:transition-[color,box-shadow] tw:file:h-7 tw:file:text-sm tw:file:font-medium tw:focus-visible:ring-3 tw:data-[matches-spartan-invalid=true]:ring-3 tw:md:text-sm tw:file:text-foreground tw:placeholder:text-muted-foreground tw:w-full tw:min-w-0 tw:outline-none tw:file:inline-flex tw:file:border-0 tw:file:bg-transparent tw:disabled:pointer-events-none tw:disabled:cursor-not-allowed tw:disabled:opacity-50');
|
|
16
|
+
classes(() => hlm('tw:dark:bg-input/30 tw:border-input tw:focus-visible:border-ring tw:focus-visible:ring-ring/50 tw:data-[matches-spartan-invalid=true]:ring-destructive/20 tw:dark:data-[matches-spartan-invalid=true]:ring-destructive/40 tw:data-[matches-spartan-invalid=true]:border-destructive tw:dark:data-[matches-spartan-invalid=true]:border-destructive/50 tw:h-9 tw:rounded-md tw:border tw:bg-transparent tw:px-2.5 tw:py-1 tw:text-base tw:shadow-xs tw:transition-[color,box-shadow] tw:file:h-7 tw:file:text-sm tw:file:font-medium tw:focus-visible:ring-3 tw:data-[matches-spartan-invalid=true]:ring-3 tw:md:text-sm tw:file:text-foreground tw:placeholder:text-muted-foreground tw:w-full tw:min-w-0 tw:outline-none tw:file:inline-flex tw:file:border-0 tw:file:bg-transparent tw:disabled:pointer-events-none tw:disabled:cursor-not-allowed tw:disabled:opacity-50', this.size() === 'sm' ? 'tw:h-8' : this.size() === 'lg' ? 'tw:h-10' : ''));
|
|
14
17
|
}
|
|
15
18
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
16
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmInput, isStandalone: true, selector: "[hlmInput]", inputs: { ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "ariaDescribedby", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "input" }, properties: { "attr.aria-describedby": "ariaDescribedby()" } }, hostDirectives: [{ directive: i1.BrnInput, inputs: ["id", "id", "forceInvalid", "forceInvalid"] }, { directive: i2.BrnFieldControlDescribedBy }], ngImport: i0 });
|
|
19
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmInput, isStandalone: true, selector: "[hlmInput]", inputs: { ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "ariaDescribedby", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "input" }, properties: { "attr.aria-describedby": "ariaDescribedby()" } }, hostDirectives: [{ directive: i1.BrnInput, inputs: ["id", "id", "forceInvalid", "forceInvalid"] }, { directive: i2.BrnFieldControlDescribedBy }], ngImport: i0 });
|
|
17
20
|
}
|
|
18
21
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmInput, decorators: [{
|
|
19
22
|
type: Directive,
|
|
@@ -25,7 +28,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
25
28
|
'[attr.aria-describedby]': 'ariaDescribedby()',
|
|
26
29
|
},
|
|
27
30
|
}]
|
|
28
|
-
}], ctorParameters: () => [], propDecorators: { ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedby", required: false }] }] } });
|
|
31
|
+
}], ctorParameters: () => [], propDecorators: { ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedby", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
29
32
|
|
|
30
33
|
/*
|
|
31
34
|
* Public API Surface of input
|
package/input/types/input.d.ts
CHANGED
|
@@ -4,9 +4,11 @@ import * as i2 from '@spartan-ng/brain/field';
|
|
|
4
4
|
|
|
5
5
|
declare class HlmInput {
|
|
6
6
|
readonly ariaDescribedby: i0.InputSignal<string | null>;
|
|
7
|
+
/** Height density. Merged after the base height class, so it wins via `twMerge`. */
|
|
8
|
+
readonly size: i0.InputSignal<"sm" | "default" | "lg">;
|
|
7
9
|
constructor();
|
|
8
10
|
static ɵfac: i0.ɵɵFactoryDeclaration<HlmInput, never>;
|
|
9
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<HlmInput, "[hlmInput]", never, { "ariaDescribedby": { "alias": "ariaDescribedby"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.BrnInput; inputs: { "id": "id"; "forceInvalid": "forceInvalid"; }; outputs: {}; }, { directive: typeof i2.BrnFieldControlDescribedBy; inputs: {}; outputs: {}; }]>;
|
|
11
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HlmInput, "[hlmInput]", never, { "ariaDescribedby": { "alias": "ariaDescribedby"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.BrnInput; inputs: { "id": "id"; "forceInvalid": "forceInvalid"; }; outputs: {}; }, { directive: typeof i2.BrnFieldControlDescribedBy; inputs: {}; outputs: {}; }]>;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
declare const HlmInputImports: readonly [typeof HlmInput];
|
|
@@ -435,7 +435,7 @@ class EgLayoutSearch {
|
|
|
435
435
|
</div>
|
|
436
436
|
</hlm-popover-content>
|
|
437
437
|
</hlm-popover>
|
|
438
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: HlmPopover, selector: "[hlmPopover],hlm-popover" }, { kind: "directive", type: HlmPopoverTrigger, selector: "button[hlmPopoverTrigger],button[hlmPopoverTriggerFor]" }, { kind: "directive", type: HlmPopoverContent, selector: "[hlmPopoverContent],hlm-popover-content" }, { kind: "directive", type: HlmPopoverPortal, selector: "[hlmPopoverPortal]" }, { kind: "directive", type: HlmInput, selector: "[hlmInput]", inputs: ["ariaDescribedby"] }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
438
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: HlmPopover, selector: "[hlmPopover],hlm-popover" }, { kind: "directive", type: HlmPopoverTrigger, selector: "button[hlmPopoverTrigger],button[hlmPopoverTriggerFor]" }, { kind: "directive", type: HlmPopoverContent, selector: "[hlmPopoverContent],hlm-popover-content" }, { kind: "directive", type: HlmPopoverPortal, selector: "[hlmPopoverPortal]" }, { kind: "directive", type: HlmInput, selector: "[hlmInput]", inputs: ["ariaDescribedby", "size"] }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
439
439
|
}
|
|
440
440
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgLayoutSearch, decorators: [{
|
|
441
441
|
type: Component,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egose/shadcn-theme-ng-tw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Angular shadcn UI theme",
|
|
5
5
|
"author": "Junmin Ahn",
|
|
6
6
|
"bundles": [
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@angular/router": ">=22.0.0 <23.0.0",
|
|
32
32
|
"@ng-icons/core": ">=35.0.1 <36.0.0",
|
|
33
33
|
"@spartan-ng/brain": ">=1.3.2 <2.0.0",
|
|
34
|
+
"@tanstack/angular-table": ">=9.1.2 <10.0.0",
|
|
34
35
|
"rxjs": ">=7.8.0 <8.0.0"
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -126,6 +127,10 @@
|
|
|
126
127
|
"types": "./context-menu/types/context-menu.d.ts",
|
|
127
128
|
"default": "./context-menu/fesm2022/context-menu.mjs"
|
|
128
129
|
},
|
|
130
|
+
"./data-table": {
|
|
131
|
+
"types": "./data-table/types/data-table.d.ts",
|
|
132
|
+
"default": "./data-table/fesm2022/data-table.mjs"
|
|
133
|
+
},
|
|
129
134
|
"./date-picker": {
|
|
130
135
|
"types": "./date-picker/types/date-picker.d.ts",
|
|
131
136
|
"default": "./date-picker/fesm2022/date-picker.mjs"
|
|
@@ -143,7 +143,7 @@ class HlmPhoneInput {
|
|
|
143
143
|
(input)="_handleInput($event)"
|
|
144
144
|
(blur)="_handleBlur()"
|
|
145
145
|
/>
|
|
146
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: HlmInput, selector: "[hlmInput]", inputs: ["ariaDescribedby"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
146
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: HlmInput, selector: "[hlmInput]", inputs: ["ariaDescribedby", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
147
147
|
}
|
|
148
148
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmPhoneInput, decorators: [{
|
|
149
149
|
type: Component,
|
package/table/README.md
CHANGED
|
@@ -130,6 +130,8 @@ There are **no inputs, outputs, or methods** on any table directive. Each direct
|
|
|
130
130
|
|
|
131
131
|
User `class` attributes on the same element are preserved and merged (the `classes()` helper keeps base classes).
|
|
132
132
|
|
|
133
|
+
`HlmTh`/`HlmTd` take a `size` input (`HlmTableSize`: `sm` / `default` / `lg`) scaling density one step down/up: header height `h-8` / `h-10` / `h-12`, cell padding `p-1` / `p-2` / `p-3`.
|
|
134
|
+
|
|
133
135
|
## Examples
|
|
134
136
|
|
|
135
137
|
### 1. Basic invoice table
|
package/table/fesm2022/table.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, NgModule } from '@angular/core';
|
|
3
|
-
import { classes } from '@egose/shadcn-theme-ng-tw/utils';
|
|
2
|
+
import { Directive, input, NgModule } from '@angular/core';
|
|
3
|
+
import { classes, hlm } from '@egose/shadcn-theme-ng-tw/utils';
|
|
4
4
|
|
|
5
5
|
class HlmTableContainer {
|
|
6
6
|
constructor() {
|
|
@@ -110,11 +110,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
110
110
|
* within an HlmTable context.
|
|
111
111
|
*/
|
|
112
112
|
class HlmTh {
|
|
113
|
+
size = input('default', /* @ts-ignore */
|
|
114
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
113
115
|
constructor() {
|
|
114
|
-
classes(() => 'tw:text-foreground tw:h-10 tw:px-2 tw:text-start tw:align-middle tw:font-medium tw:whitespace-nowrap tw:[&:has([role=checkbox])]:pe-0');
|
|
116
|
+
classes(() => hlm('tw:text-foreground tw:h-10 tw:px-2 tw:text-start tw:align-middle tw:font-medium tw:whitespace-nowrap tw:[&:has([role=checkbox])]:pe-0', this.size() === 'sm' ? 'tw:h-8' : this.size() === 'lg' ? 'tw:h-12' : ''));
|
|
115
117
|
}
|
|
116
118
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmTh, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
117
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
119
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmTh, isStandalone: true, selector: "th[hlmTh],th[hlmTableHead]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "table-head" } }, ngImport: i0 });
|
|
118
120
|
}
|
|
119
121
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmTh, decorators: [{
|
|
120
122
|
type: Directive,
|
|
@@ -122,17 +124,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
122
124
|
selector: 'th[hlmTh],th[hlmTableHead]',
|
|
123
125
|
host: { 'data-slot': 'table-head' },
|
|
124
126
|
}]
|
|
125
|
-
}], ctorParameters: () => [] });
|
|
127
|
+
}], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
126
128
|
/**
|
|
127
129
|
* Directive to apply Shadcn-like styling to a <td> element
|
|
128
130
|
* within an HlmTable context.
|
|
129
131
|
*/
|
|
130
132
|
class HlmTd {
|
|
133
|
+
size = input('default', /* @ts-ignore */
|
|
134
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
131
135
|
constructor() {
|
|
132
|
-
classes(() => 'tw:p-2 tw:align-middle tw:whitespace-nowrap tw:[&:has([role=checkbox])]:pe-0');
|
|
136
|
+
classes(() => hlm('tw:p-2 tw:align-middle tw:whitespace-nowrap tw:[&:has([role=checkbox])]:pe-0', this.size() === 'sm' ? 'tw:p-1' : this.size() === 'lg' ? 'tw:p-3' : ''));
|
|
133
137
|
}
|
|
134
138
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmTd, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
135
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
139
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmTd, isStandalone: true, selector: "td[hlmTd],td[hlmTableCell]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "table-cell" } }, ngImport: i0 });
|
|
136
140
|
}
|
|
137
141
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmTd, decorators: [{
|
|
138
142
|
type: Directive,
|
|
@@ -140,7 +144,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
140
144
|
selector: 'td[hlmTd],td[hlmTableCell]',
|
|
141
145
|
host: { 'data-slot': 'table-cell' },
|
|
142
146
|
}]
|
|
143
|
-
}], ctorParameters: () => [] });
|
|
147
|
+
}], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
144
148
|
/**
|
|
145
149
|
* Directive to apply Shadcn-like styling to a <caption> element
|
|
146
150
|
* within an HlmTable context.
|
package/table/types/table.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
|
|
3
|
+
/** Density scale shared by table parts and higher-level components (e.g. data-table). */
|
|
4
|
+
type HlmTableSize = 'sm' | 'default' | 'lg';
|
|
3
5
|
declare class HlmTableContainer {
|
|
4
6
|
constructor();
|
|
5
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<HlmTableContainer, never>;
|
|
@@ -54,18 +56,20 @@ declare class HlmTr {
|
|
|
54
56
|
* within an HlmTable context.
|
|
55
57
|
*/
|
|
56
58
|
declare class HlmTh {
|
|
59
|
+
readonly size: i0.InputSignal<HlmTableSize>;
|
|
57
60
|
constructor();
|
|
58
61
|
static ɵfac: i0.ɵɵFactoryDeclaration<HlmTh, never>;
|
|
59
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<HlmTh, "th[hlmTh],th[hlmTableHead]", never, {}, {}, never, never, true, never>;
|
|
62
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HlmTh, "th[hlmTh],th[hlmTableHead]", never, { "size": { "alias": "size"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
60
63
|
}
|
|
61
64
|
/**
|
|
62
65
|
* Directive to apply Shadcn-like styling to a <td> element
|
|
63
66
|
* within an HlmTable context.
|
|
64
67
|
*/
|
|
65
68
|
declare class HlmTd {
|
|
69
|
+
readonly size: i0.InputSignal<HlmTableSize>;
|
|
66
70
|
constructor();
|
|
67
71
|
static ɵfac: i0.ɵɵFactoryDeclaration<HlmTd, never>;
|
|
68
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<HlmTd, "td[hlmTd],td[hlmTableCell]", never, {}, {}, never, never, true, never>;
|
|
72
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HlmTd, "td[hlmTd],td[hlmTableCell]", never, { "size": { "alias": "size"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
69
73
|
}
|
|
70
74
|
/**
|
|
71
75
|
* Directive to apply Shadcn-like styling to a <caption> element
|
|
@@ -85,3 +89,4 @@ declare class HlmTableModule {
|
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
export { HlmCaption, HlmTBody, HlmTFoot, HlmTHead, HlmTable, HlmTableContainer, HlmTableImports, HlmTableModule, HlmTd, HlmTh, HlmTr };
|
|
92
|
+
export type { HlmTableSize };
|