@nuralyui/layout 0.0.3 → 0.1.1
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 +77 -0
- package/dist/LICENSE +28 -0
- package/dist/README.md +77 -0
- package/dist/VERSIONS.md +13 -0
- package/dist/card/card.component.d.ts +30 -0
- package/dist/card/card.component.d.ts.map +1 -0
- package/dist/card/card.component.js +64 -0
- package/dist/card/card.component.js.map +1 -0
- package/dist/card/card.style.d.ts +2 -0
- package/dist/card/card.style.d.ts.map +1 -0
- package/dist/card/card.style.js +62 -0
- package/dist/card/card.style.js.map +1 -0
- package/dist/card/card.types.d.ts +17 -0
- package/dist/card/card.types.d.ts.map +1 -0
- package/dist/card/card.types.js +2 -0
- package/dist/card/card.types.js.map +1 -0
- package/dist/card/index.d.ts +3 -0
- package/dist/card/index.d.ts.map +1 -0
- package/dist/card/index.js +3 -0
- package/dist/card/index.js.map +1 -0
- package/dist/card/package.json +26 -0
- package/dist/card/react.d.ts +5 -0
- package/dist/card/react.d.ts.map +1 -0
- package/dist/card/react.js +12 -0
- package/dist/card/react.js.map +1 -0
- package/dist/flex/flex.component.d.ts +89 -0
- package/dist/flex/flex.component.d.ts.map +1 -0
- package/dist/flex/flex.component.js +178 -0
- package/dist/flex/flex.component.js.map +1 -0
- package/dist/flex/flex.style.d.ts +6 -0
- package/dist/flex/flex.style.d.ts.map +1 -0
- package/dist/flex/flex.style.js +101 -0
- package/dist/flex/flex.style.js.map +1 -0
- package/dist/flex/flex.types.d.ts +63 -0
- package/dist/flex/flex.types.d.ts.map +1 -0
- package/dist/flex/flex.types.js +5 -0
- package/dist/flex/flex.types.js.map +1 -0
- package/dist/flex/index.d.ts +3 -0
- package/dist/flex/index.d.ts.map +1 -0
- package/dist/flex/index.js +3 -0
- package/dist/flex/index.js.map +1 -0
- package/dist/flex/package.json +49 -0
- package/dist/flex/react.d.ts +3 -0
- package/dist/flex/react.d.ts.map +1 -0
- package/dist/flex/react.js +10 -0
- package/dist/flex/react.js.map +1 -0
- package/dist/grid/col.component.d.ts +103 -0
- package/dist/grid/col.component.d.ts.map +1 -0
- package/dist/grid/col.component.js +253 -0
- package/dist/grid/col.component.js.map +1 -0
- package/dist/grid/col.style.d.ts +6 -0
- package/dist/grid/col.style.d.ts.map +1 -0
- package/dist/grid/col.style.js +117 -0
- package/dist/grid/col.style.js.map +1 -0
- package/dist/grid/grid.types.d.ts +80 -0
- package/dist/grid/grid.types.d.ts.map +1 -0
- package/dist/grid/grid.types.js +16 -0
- package/dist/grid/grid.types.js.map +1 -0
- package/dist/grid/index.d.ts +4 -0
- package/dist/grid/index.d.ts.map +1 -0
- package/dist/grid/index.js +4 -0
- package/dist/grid/index.js.map +1 -0
- package/dist/grid/package.json +52 -0
- package/dist/grid/react.d.ts +5 -0
- package/dist/grid/react.d.ts.map +1 -0
- package/dist/grid/react.js +17 -0
- package/dist/grid/react.js.map +1 -0
- package/dist/grid/row.component.d.ts +83 -0
- package/dist/grid/row.component.d.ts.map +1 -0
- package/dist/grid/row.component.js +197 -0
- package/dist/grid/row.component.js.map +1 -0
- package/dist/grid/row.style.d.ts +6 -0
- package/dist/grid/row.style.d.ts.map +1 -0
- package/dist/grid/row.style.js +68 -0
- package/dist/grid/row.style.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/layout/content.component.d.ts.map +1 -0
- package/dist/layout/content.style.d.ts.map +1 -0
- package/dist/layout/footer.component.d.ts.map +1 -0
- package/dist/layout/footer.style.d.ts.map +1 -0
- package/dist/layout/header.component.d.ts.map +1 -0
- package/dist/layout/header.style.d.ts.map +1 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/layout.component.d.ts.map +1 -0
- package/dist/layout/layout.style.d.ts.map +1 -0
- package/dist/layout/layout.types.d.ts.map +1 -0
- package/dist/layout/package.json +43 -0
- package/dist/layout/react.d.ts.map +1 -0
- package/dist/layout/sider.component.d.ts.map +1 -0
- package/dist/layout/sider.style.d.ts.map +1 -0
- package/dist/react.d.ts +4 -0
- package/dist/react.js +4 -0
- package/dist/versions.json +6 -0
- package/package.json +73 -39
- package/bundle.js +0 -297
- /package/{content.component.d.ts → dist/layout/content.component.d.ts} +0 -0
- /package/{content.component.js → dist/layout/content.component.js} +0 -0
- /package/{content.component.js.map → dist/layout/content.component.js.map} +0 -0
- /package/{content.style.d.ts → dist/layout/content.style.d.ts} +0 -0
- /package/{content.style.js → dist/layout/content.style.js} +0 -0
- /package/{content.style.js.map → dist/layout/content.style.js.map} +0 -0
- /package/{footer.component.d.ts → dist/layout/footer.component.d.ts} +0 -0
- /package/{footer.component.js → dist/layout/footer.component.js} +0 -0
- /package/{footer.component.js.map → dist/layout/footer.component.js.map} +0 -0
- /package/{footer.style.d.ts → dist/layout/footer.style.d.ts} +0 -0
- /package/{footer.style.js → dist/layout/footer.style.js} +0 -0
- /package/{footer.style.js.map → dist/layout/footer.style.js.map} +0 -0
- /package/{header.component.d.ts → dist/layout/header.component.d.ts} +0 -0
- /package/{header.component.js → dist/layout/header.component.js} +0 -0
- /package/{header.component.js.map → dist/layout/header.component.js.map} +0 -0
- /package/{header.style.d.ts → dist/layout/header.style.d.ts} +0 -0
- /package/{header.style.js → dist/layout/header.style.js} +0 -0
- /package/{header.style.js.map → dist/layout/header.style.js.map} +0 -0
- /package/{index.d.ts → dist/layout/index.d.ts} +0 -0
- /package/{index.js → dist/layout/index.js} +0 -0
- /package/{index.js.map → dist/layout/index.js.map} +0 -0
- /package/{layout.component.d.ts → dist/layout/layout.component.d.ts} +0 -0
- /package/{layout.component.js → dist/layout/layout.component.js} +0 -0
- /package/{layout.component.js.map → dist/layout/layout.component.js.map} +0 -0
- /package/{layout.style.d.ts → dist/layout/layout.style.d.ts} +0 -0
- /package/{layout.style.js → dist/layout/layout.style.js} +0 -0
- /package/{layout.style.js.map → dist/layout/layout.style.js.map} +0 -0
- /package/{layout.types.d.ts → dist/layout/layout.types.d.ts} +0 -0
- /package/{layout.types.js → dist/layout/layout.types.js} +0 -0
- /package/{layout.types.js.map → dist/layout/layout.types.js.map} +0 -0
- /package/{react.d.ts → dist/layout/react.d.ts} +0 -0
- /package/{react.js → dist/layout/react.js} +0 -0
- /package/{react.js.map → dist/layout/react.js.map} +0 -0
- /package/{sider.component.d.ts → dist/layout/sider.component.d.ts} +0 -0
- /package/{sider.component.js → dist/layout/sider.component.js} +0 -0
- /package/{sider.component.js.map → dist/layout/sider.component.js.map} +0 -0
- /package/{sider.style.d.ts → dist/layout/sider.style.d.ts} +0 -0
- /package/{sider.style.js → dist/layout/sider.style.js} +0 -0
- /package/{sider.style.js.map → dist/layout/sider.style.js.map} +0 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
import { html, LitElement } from 'lit';
|
|
13
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
14
|
+
import { styles } from './flex.style.js';
|
|
15
|
+
import { NuralyUIBaseMixin } from '@nuralyui/common/mixins';
|
|
16
|
+
import { EMPTY_STRING } from './flex.types.js';
|
|
17
|
+
/**
|
|
18
|
+
* Flex layout component for flexible box layouts
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```html
|
|
22
|
+
* <!-- Basic flex -->
|
|
23
|
+
* <nr-flex>
|
|
24
|
+
* <div>Item 1</div>
|
|
25
|
+
* <div>Item 2</div>
|
|
26
|
+
* <div>Item 3</div>
|
|
27
|
+
* </nr-flex>
|
|
28
|
+
*
|
|
29
|
+
* <!-- Flex with gap -->
|
|
30
|
+
* <nr-flex gap="medium">
|
|
31
|
+
* <div>Item 1</div>
|
|
32
|
+
* <div>Item 2</div>
|
|
33
|
+
* </nr-flex>
|
|
34
|
+
*
|
|
35
|
+
* <!-- Centered flex -->
|
|
36
|
+
* <nr-flex justify="center" align="center">
|
|
37
|
+
* <div>Centered content</div>
|
|
38
|
+
* </nr-flex>
|
|
39
|
+
*
|
|
40
|
+
* <!-- Column layout with gap -->
|
|
41
|
+
* <nr-flex vertical gap="16">
|
|
42
|
+
* <div>Item 1</div>
|
|
43
|
+
* <div>Item 2</div>
|
|
44
|
+
* </nr-flex>
|
|
45
|
+
*
|
|
46
|
+
* <!-- Responsive gap -->
|
|
47
|
+
* <nr-flex .gap=${[16, 24]}>
|
|
48
|
+
* <div>Item 1</div>
|
|
49
|
+
* <div>Item 2</div>
|
|
50
|
+
* </nr-flex>
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @slot default - Flex items
|
|
54
|
+
*/
|
|
55
|
+
let NrFlexElement = class NrFlexElement extends NuralyUIBaseMixin(LitElement) {
|
|
56
|
+
constructor() {
|
|
57
|
+
super(...arguments);
|
|
58
|
+
/** Flex direction (shorthand: use vertical prop for column) */
|
|
59
|
+
this.direction = "row" /* FlexDirection.Row */;
|
|
60
|
+
/** Shorthand for flex-direction: column */
|
|
61
|
+
this.vertical = false;
|
|
62
|
+
/** Flex wrap behavior */
|
|
63
|
+
this.wrap = "nowrap" /* FlexWrap.NoWrap */;
|
|
64
|
+
/** Justify content alignment */
|
|
65
|
+
this.justify = EMPTY_STRING;
|
|
66
|
+
/** Align items alignment */
|
|
67
|
+
this.align = EMPTY_STRING;
|
|
68
|
+
/** Gap between flex items - can be preset string, number (px), or [horizontal, vertical] */
|
|
69
|
+
this.gap = 0;
|
|
70
|
+
/** Make flex container inline */
|
|
71
|
+
this.inline = false;
|
|
72
|
+
/** Custom flex CSS value (e.g., "1", "auto", "none") */
|
|
73
|
+
this.flex = EMPTY_STRING;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get computed flex direction
|
|
77
|
+
*/
|
|
78
|
+
getFlexDirection() {
|
|
79
|
+
return this.vertical ? "column" /* FlexDirection.Column */ : this.direction;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Convert gap value to CSS value
|
|
83
|
+
*/
|
|
84
|
+
getGapValue(value) {
|
|
85
|
+
if (typeof value === 'number') {
|
|
86
|
+
return `${value}px`;
|
|
87
|
+
}
|
|
88
|
+
if (typeof value === 'string') {
|
|
89
|
+
// Check if it's a preset
|
|
90
|
+
switch (value) {
|
|
91
|
+
case "small" /* FlexGap.Small */:
|
|
92
|
+
return 'var(--nuraly-spacing-2, 8px)';
|
|
93
|
+
case "medium" /* FlexGap.Medium */:
|
|
94
|
+
return 'var(--nuraly-spacing-3, 16px)';
|
|
95
|
+
case "large" /* FlexGap.Large */:
|
|
96
|
+
return 'var(--nuraly-spacing-4, 24px)';
|
|
97
|
+
default:
|
|
98
|
+
return value; // Use as-is (could be CSS variable or custom value)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return '0';
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get gap styles for flex container
|
|
105
|
+
*/
|
|
106
|
+
getGapStyles() {
|
|
107
|
+
const styles = {};
|
|
108
|
+
if (Array.isArray(this.gap)) {
|
|
109
|
+
const [horizontal, vertical] = this.gap;
|
|
110
|
+
styles['column-gap'] = this.getGapValue(horizontal);
|
|
111
|
+
styles['row-gap'] = this.getGapValue(vertical);
|
|
112
|
+
}
|
|
113
|
+
else if (this.gap) {
|
|
114
|
+
styles['gap'] = this.getGapValue(this.gap);
|
|
115
|
+
}
|
|
116
|
+
return styles;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get all inline styles for flex container
|
|
120
|
+
*/
|
|
121
|
+
getFlexStyles() {
|
|
122
|
+
const styles = Object.assign({}, this.getGapStyles());
|
|
123
|
+
if (this.flex) {
|
|
124
|
+
styles['flex'] = this.flex;
|
|
125
|
+
}
|
|
126
|
+
return Object.entries(styles)
|
|
127
|
+
.map(([key, value]) => `${key}: ${value}`)
|
|
128
|
+
.join('; ');
|
|
129
|
+
}
|
|
130
|
+
render() {
|
|
131
|
+
const flexDirection = this.getFlexDirection();
|
|
132
|
+
const flexStyles = this.getFlexStyles();
|
|
133
|
+
return html `
|
|
134
|
+
<div
|
|
135
|
+
class="nr-flex"
|
|
136
|
+
data-direction="${flexDirection}"
|
|
137
|
+
data-wrap="${this.wrap}"
|
|
138
|
+
data-justify="${this.justify}"
|
|
139
|
+
data-align="${this.align}"
|
|
140
|
+
data-inline="${this.inline}"
|
|
141
|
+
data-theme="${this.currentTheme}"
|
|
142
|
+
style="${flexStyles}"
|
|
143
|
+
>
|
|
144
|
+
<slot></slot>
|
|
145
|
+
</div>
|
|
146
|
+
`;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
NrFlexElement.styles = styles;
|
|
150
|
+
__decorate([
|
|
151
|
+
property({ type: String })
|
|
152
|
+
], NrFlexElement.prototype, "direction", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
property({ type: Boolean })
|
|
155
|
+
], NrFlexElement.prototype, "vertical", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
property({ type: String })
|
|
158
|
+
], NrFlexElement.prototype, "wrap", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
property({ type: String })
|
|
161
|
+
], NrFlexElement.prototype, "justify", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
property({ type: String })
|
|
164
|
+
], NrFlexElement.prototype, "align", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
property({ type: Object })
|
|
167
|
+
], NrFlexElement.prototype, "gap", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
property({ type: Boolean })
|
|
170
|
+
], NrFlexElement.prototype, "inline", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
property({ type: String })
|
|
173
|
+
], NrFlexElement.prototype, "flex", void 0);
|
|
174
|
+
NrFlexElement = __decorate([
|
|
175
|
+
customElement('nr-flex')
|
|
176
|
+
], NrFlexElement);
|
|
177
|
+
export { NrFlexElement };
|
|
178
|
+
//# sourceMappingURL=flex.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.component.js","sourceRoot":"","sources":["../../../src/components/flex/flex.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAOH,YAAY,EACf,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,IAAa,aAAa,GAA1B,MAAa,aAAc,SAAQ,iBAAiB,CAAC,UAAU,CAAC;IAAhE;;QAGE,+DAA+D;QAE/D,cAAS,iCAAoC;QAE7C,2CAA2C;QAE3C,aAAQ,GAAG,KAAK,CAAC;QAEjB,yBAAyB;QAEzB,SAAI,kCAA6B;QAEjC,gCAAgC;QAEhC,YAAO,GAAqB,YAAY,CAAC;QAEzC,4BAA4B;QAE5B,UAAK,GAAmB,YAAY,CAAC;QAErC,4FAA4F;QAE5F,QAAG,GAAQ,CAAC,CAAC;QAEb,iCAAiC;QAEjC,WAAM,GAAG,KAAK,CAAC;QAEf,wDAAwD;QAExD,SAAI,GAAgB,YAAY,C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/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { styles } from './flex.style.js';\nimport { NuralyUIBaseMixin } from '@nuralyui/common/mixins';\nimport {\n FlexDirection,\n FlexWrap,\n FlexJustify,\n FlexAlign,\n FlexGap,\n Gap,\n EMPTY_STRING\n} from './flex.types.js';\n\n/**\n * Flex layout component for flexible box layouts\n * \n * @example\n * ```html\n * <!-- Basic flex -->\n * <nr-flex>\n * <div>Item 1</div>\n * <div>Item 2</div>\n * <div>Item 3</div>\n * </nr-flex>\n * \n * <!-- Flex with gap -->\n * <nr-flex gap=\"medium\">\n * <div>Item 1</div>\n * <div>Item 2</div>\n * </nr-flex>\n * \n * <!-- Centered flex -->\n * <nr-flex justify=\"center\" align=\"center\">\n * <div>Centered content</div>\n * </nr-flex>\n * \n * <!-- Column layout with gap -->\n * <nr-flex vertical gap=\"16\">\n * <div>Item 1</div>\n * <div>Item 2</div>\n * </nr-flex>\n * \n * <!-- Responsive gap -->\n * <nr-flex .gap=${[16, 24]}>\n * <div>Item 1</div>\n * <div>Item 2</div>\n * </nr-flex>\n * ```\n * \n * @slot default - Flex items\n */\n@customElement('nr-flex')\nexport class NrFlexElement extends NuralyUIBaseMixin(LitElement) {\n static override styles = styles;\n\n /** Flex direction (shorthand: use vertical prop for column) */\n @property({ type: String })\n direction: FlexDirection = FlexDirection.Row;\n\n /** Shorthand for flex-direction: column */\n @property({ type: Boolean })\n vertical = false;\n\n /** Flex wrap behavior */\n @property({ type: String })\n wrap: FlexWrap = FlexWrap.NoWrap;\n\n /** Justify content alignment */\n @property({ type: String })\n justify: FlexJustify | '' = EMPTY_STRING;\n\n /** Align items alignment */\n @property({ type: String })\n align: FlexAlign | '' = EMPTY_STRING;\n\n /** Gap between flex items - can be preset string, number (px), or [horizontal, vertical] */\n @property({ type: Object })\n gap: Gap = 0;\n\n /** Make flex container inline */\n @property({ type: Boolean })\n inline = false;\n\n /** Custom flex CSS value (e.g., \"1\", \"auto\", \"none\") */\n @property({ type: String })\n flex: string | '' = EMPTY_STRING;\n\n /**\n * Get computed flex direction\n */\n private getFlexDirection(): FlexDirection {\n return this.vertical ? FlexDirection.Column : this.direction;\n }\n\n /**\n * Convert gap value to CSS value\n */\n private getGapValue(value: Gap): string {\n if (typeof value === 'number') {\n return `${value}px`;\n }\n \n if (typeof value === 'string') {\n // Check if it's a preset\n switch (value) {\n case FlexGap.Small:\n return 'var(--nuraly-spacing-2, 8px)';\n case FlexGap.Medium:\n return 'var(--nuraly-spacing-3, 16px)';\n case FlexGap.Large:\n return 'var(--nuraly-spacing-4, 24px)';\n default:\n return value; // Use as-is (could be CSS variable or custom value)\n }\n }\n \n return '0';\n }\n\n /**\n * Get gap styles for flex container\n */\n private getGapStyles(): Record<string, string> {\n const styles: Record<string, string> = {};\n \n if (Array.isArray(this.gap)) {\n const [horizontal, vertical] = this.gap;\n styles['column-gap'] = this.getGapValue(horizontal);\n styles['row-gap'] = this.getGapValue(vertical);\n } else if (this.gap) {\n styles['gap'] = this.getGapValue(this.gap);\n }\n \n return styles;\n }\n\n /**\n * Get all inline styles for flex container\n */\n private getFlexStyles(): string {\n const styles: Record<string, string> = {\n ...this.getGapStyles()\n };\n \n if (this.flex) {\n styles['flex'] = this.flex;\n }\n \n return Object.entries(styles)\n .map(([key, value]) => `${key}: ${value}`)\n .join('; ');\n }\n\n override render() {\n const flexDirection = this.getFlexDirection();\n const flexStyles = this.getFlexStyles();\n\n return html`\n <div\n class=\"nr-flex\"\n data-direction=\"${flexDirection}\"\n data-wrap=\"${this.wrap}\"\n data-justify=\"${this.justify}\"\n data-align=\"${this.align}\"\n data-inline=\"${this.inline}\"\n data-theme=\"${this.currentTheme}\"\n style=\"${flexStyles}\"\n >\n <slot></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nr-flex': NrFlexElement;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.style.d.ts","sourceRoot":"","sources":["../../../src/components/flex/flex.style.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,MAAM,yBA8FlB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Flex component styles
|
|
4
|
+
* Using shared CSS variables from /src/shared/themes/
|
|
5
|
+
*/
|
|
6
|
+
export const styles = css `
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.nr-flex {
|
|
13
|
+
display: flex;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
|
|
16
|
+
/* Theme-aware */
|
|
17
|
+
color: var(--nuraly-color-text);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Inline flex */
|
|
21
|
+
.nr-flex[data-inline="true"] {
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Flex direction */
|
|
26
|
+
.nr-flex[data-direction="row"] {
|
|
27
|
+
flex-direction: row;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.nr-flex[data-direction="row-reverse"] {
|
|
31
|
+
flex-direction: row-reverse;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.nr-flex[data-direction="column"] {
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.nr-flex[data-direction="column-reverse"] {
|
|
39
|
+
flex-direction: column-reverse;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Flex wrap */
|
|
43
|
+
.nr-flex[data-wrap="nowrap"] {
|
|
44
|
+
flex-wrap: nowrap;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.nr-flex[data-wrap="wrap"] {
|
|
48
|
+
flex-wrap: wrap;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.nr-flex[data-wrap="wrap-reverse"] {
|
|
52
|
+
flex-wrap: wrap-reverse;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Justify content */
|
|
56
|
+
.nr-flex[data-justify="flex-start"] {
|
|
57
|
+
justify-content: flex-start;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.nr-flex[data-justify="flex-end"] {
|
|
61
|
+
justify-content: flex-end;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.nr-flex[data-justify="center"] {
|
|
65
|
+
justify-content: center;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.nr-flex[data-justify="space-between"] {
|
|
69
|
+
justify-content: space-between;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.nr-flex[data-justify="space-around"] {
|
|
73
|
+
justify-content: space-around;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.nr-flex[data-justify="space-evenly"] {
|
|
77
|
+
justify-content: space-evenly;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Align items */
|
|
81
|
+
.nr-flex[data-align="flex-start"] {
|
|
82
|
+
align-items: flex-start;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.nr-flex[data-align="flex-end"] {
|
|
86
|
+
align-items: flex-end;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.nr-flex[data-align="center"] {
|
|
90
|
+
align-items: center;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.nr-flex[data-align="baseline"] {
|
|
94
|
+
align-items: baseline;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.nr-flex[data-align="stretch"] {
|
|
98
|
+
align-items: stretch;
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
//# sourceMappingURL=flex.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.style.js","sourceRoot":"","sources":["../../../src/components/flex/flex.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8FxB,CAAC","sourcesContent":["import { css } from 'lit';\n\n/**\n * Flex component styles\n * Using shared CSS variables from /src/shared/themes/\n */\nexport const styles = css`\n :host {\n display: block;\n box-sizing: border-box;\n }\n\n .nr-flex {\n display: flex;\n box-sizing: border-box;\n \n /* Theme-aware */\n color: var(--nuraly-color-text);\n }\n\n /* Inline flex */\n .nr-flex[data-inline=\"true\"] {\n display: inline-flex;\n }\n\n /* Flex direction */\n .nr-flex[data-direction=\"row\"] {\n flex-direction: row;\n }\n\n .nr-flex[data-direction=\"row-reverse\"] {\n flex-direction: row-reverse;\n }\n\n .nr-flex[data-direction=\"column\"] {\n flex-direction: column;\n }\n\n .nr-flex[data-direction=\"column-reverse\"] {\n flex-direction: column-reverse;\n }\n\n /* Flex wrap */\n .nr-flex[data-wrap=\"nowrap\"] {\n flex-wrap: nowrap;\n }\n\n .nr-flex[data-wrap=\"wrap\"] {\n flex-wrap: wrap;\n }\n\n .nr-flex[data-wrap=\"wrap-reverse\"] {\n flex-wrap: wrap-reverse;\n }\n\n /* Justify content */\n .nr-flex[data-justify=\"flex-start\"] {\n justify-content: flex-start;\n }\n\n .nr-flex[data-justify=\"flex-end\"] {\n justify-content: flex-end;\n }\n\n .nr-flex[data-justify=\"center\"] {\n justify-content: center;\n }\n\n .nr-flex[data-justify=\"space-between\"] {\n justify-content: space-between;\n }\n\n .nr-flex[data-justify=\"space-around\"] {\n justify-content: space-around;\n }\n\n .nr-flex[data-justify=\"space-evenly\"] {\n justify-content: space-evenly;\n }\n\n /* Align items */\n .nr-flex[data-align=\"flex-start\"] {\n align-items: flex-start;\n }\n\n .nr-flex[data-align=\"flex-end\"] {\n align-items: flex-end;\n }\n\n .nr-flex[data-align=\"center\"] {\n align-items: center;\n }\n\n .nr-flex[data-align=\"baseline\"] {\n align-items: baseline;\n }\n\n .nr-flex[data-align=\"stretch\"] {\n align-items: stretch;\n }\n`;\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flex component types and constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const EMPTY_STRING = "";
|
|
5
|
+
/**
|
|
6
|
+
* Flex direction
|
|
7
|
+
*/
|
|
8
|
+
export declare const enum FlexDirection {
|
|
9
|
+
Row = "row",
|
|
10
|
+
RowReverse = "row-reverse",
|
|
11
|
+
Column = "column",
|
|
12
|
+
ColumnReverse = "column-reverse"
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Flex wrap behavior
|
|
16
|
+
*/
|
|
17
|
+
export declare const enum FlexWrap {
|
|
18
|
+
NoWrap = "nowrap",
|
|
19
|
+
Wrap = "wrap",
|
|
20
|
+
WrapReverse = "wrap-reverse"
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Justify content alignment
|
|
24
|
+
*/
|
|
25
|
+
export declare const enum FlexJustify {
|
|
26
|
+
FlexStart = "flex-start",
|
|
27
|
+
FlexEnd = "flex-end",
|
|
28
|
+
Center = "center",
|
|
29
|
+
SpaceBetween = "space-between",
|
|
30
|
+
SpaceAround = "space-around",
|
|
31
|
+
SpaceEvenly = "space-evenly"
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Align items alignment
|
|
35
|
+
*/
|
|
36
|
+
export declare const enum FlexAlign {
|
|
37
|
+
FlexStart = "flex-start",
|
|
38
|
+
FlexEnd = "flex-end",
|
|
39
|
+
Center = "center",
|
|
40
|
+
Baseline = "baseline",
|
|
41
|
+
Stretch = "stretch"
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Gap size presets
|
|
45
|
+
*/
|
|
46
|
+
export declare const enum FlexGap {
|
|
47
|
+
Small = "small",
|
|
48
|
+
Medium = "medium",
|
|
49
|
+
Large = "large"
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Gap configuration - can be string preset, number (px), or array [horizontal, vertical]
|
|
53
|
+
*/
|
|
54
|
+
export declare type Gap = FlexGap | number | string | [number | string, number | string];
|
|
55
|
+
/**
|
|
56
|
+
* Flex item configuration
|
|
57
|
+
*/
|
|
58
|
+
export interface FlexItemConfig {
|
|
59
|
+
flex?: string | number;
|
|
60
|
+
order?: number;
|
|
61
|
+
alignSelf?: FlexAlign | 'auto';
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=flex.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.types.d.ts","sourceRoot":"","sources":["../../../src/components/flex/flex.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B;;GAEG;AACH,0BAAkB,aAAa;IAC7B,GAAG,QAAQ;IACX,UAAU,gBAAgB;IAC1B,MAAM,WAAW;IACjB,aAAa,mBAAmB;CACjC;AAED;;GAEG;AACH,0BAAkB,QAAQ;IACxB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,WAAW,iBAAiB;CAC7B;AAED;;GAEG;AACH,0BAAkB,WAAW;IAC3B,SAAS,eAAe;IACxB,OAAO,aAAa;IACpB,MAAM,WAAW;IACjB,YAAY,kBAAkB;IAC9B,WAAW,iBAAiB;IAC5B,WAAW,iBAAiB;CAC7B;AAED;;GAEG;AACH,0BAAkB,SAAS;IACzB,SAAS,eAAe;IACxB,OAAO,aAAa;IACpB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,0BAAkB,OAAO;IACvB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,oBAAY,GAAG,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.types.js","sourceRoot":"","sources":["../../../src/components/flex/flex.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC","sourcesContent":["/**\n * Flex component types and constants\n */\n\nexport const EMPTY_STRING = '';\n\n/**\n * Flex direction\n */\nexport const enum FlexDirection {\n Row = 'row',\n RowReverse = 'row-reverse',\n Column = 'column',\n ColumnReverse = 'column-reverse'\n}\n\n/**\n * Flex wrap behavior\n */\nexport const enum FlexWrap {\n NoWrap = 'nowrap',\n Wrap = 'wrap',\n WrapReverse = 'wrap-reverse'\n}\n\n/**\n * Justify content alignment\n */\nexport const enum FlexJustify {\n FlexStart = 'flex-start',\n FlexEnd = 'flex-end',\n Center = 'center',\n SpaceBetween = 'space-between',\n SpaceAround = 'space-around',\n SpaceEvenly = 'space-evenly'\n}\n\n/**\n * Align items alignment\n */\nexport const enum FlexAlign {\n FlexStart = 'flex-start',\n FlexEnd = 'flex-end',\n Center = 'center',\n Baseline = 'baseline',\n Stretch = 'stretch'\n}\n\n/**\n * Gap size presets\n */\nexport const enum FlexGap {\n Small = 'small',\n Medium = 'medium',\n Large = 'large'\n}\n\n/**\n * Gap configuration - can be string preset, number (px), or array [horizontal, vertical]\n */\nexport type Gap = FlexGap | number | string | [number | string, number | string];\n\n/**\n * Flex item configuration\n */\nexport interface FlexItemConfig {\n flex?: string | number;\n order?: number;\n alignSelf?: FlexAlign | 'auto';\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/flex/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/flex/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC","sourcesContent":["export * from './flex.component.js';\nexport * from './flex.types.js';\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nuralyui/flex",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Flex layout component for NuralyUI library",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./index.js"
|
|
10
|
+
},
|
|
11
|
+
"./bundle": {
|
|
12
|
+
"import": "./bundle.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"*.js",
|
|
17
|
+
"*.d.ts",
|
|
18
|
+
"*.js.map",
|
|
19
|
+
"flex.bundled.js",
|
|
20
|
+
"bundle.js"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/Nuralyio/NuralyUI.git",
|
|
28
|
+
"directory": "src/components/flex"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"flex",
|
|
32
|
+
"flexbox",
|
|
33
|
+
"layout",
|
|
34
|
+
"container",
|
|
35
|
+
"web-components",
|
|
36
|
+
"lit-element",
|
|
37
|
+
"nuralyui",
|
|
38
|
+
"ui-components"
|
|
39
|
+
],
|
|
40
|
+
"author": "Nuraly, Laabidi Aymen",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/Nuralyio/NuralyUI/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/Nuralyio/NuralyUI#readme",
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/components/flex/react.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,eAAO,MAAM,MAAM,gEAKjB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createComponent } from '@lit-labs/react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { NrFlexElement } from './flex.component.js';
|
|
4
|
+
export const NrFlex = createComponent({
|
|
5
|
+
tagName: 'nr-flex',
|
|
6
|
+
elementClass: NrFlexElement,
|
|
7
|
+
react: React,
|
|
8
|
+
events: {},
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/components/flex/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAC;IACpC,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,aAAa;IAC3B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,EAAE;CACX,CAAC,CAAC","sourcesContent":["import { createComponent } from '@lit-labs/react';\nimport * as React from 'react';\nimport { NrFlexElement } from './flex.component.js';\nexport const NrFlex = createComponent({\n tagName: 'nr-flex',\n elementClass: NrFlexElement,\n react: React,\n events: {},\n});\n"]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { LitElement } from 'lit';
|
|
7
|
+
import { ColSize, FlexType } from './grid.types.js';
|
|
8
|
+
declare const NrColElement_base: (new (...args: any[]) => import("@nuralyui/common/mixins").DependencyAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").ThemeAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").EventHandlerCapable) & typeof LitElement;
|
|
9
|
+
/**
|
|
10
|
+
* Column component for grid layout system
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```html
|
|
14
|
+
* <!-- Basic column with span -->
|
|
15
|
+
* <nr-col span="12">Half width</nr-col>
|
|
16
|
+
* <nr-col span="8">8/24 width</nr-col>
|
|
17
|
+
*
|
|
18
|
+
* <!-- Column with offset -->
|
|
19
|
+
* <nr-col span="12" offset="6">Offset by 6</nr-col>
|
|
20
|
+
*
|
|
21
|
+
* <!-- Responsive column -->
|
|
22
|
+
* <nr-col
|
|
23
|
+
* xs="24"
|
|
24
|
+
* sm="12"
|
|
25
|
+
* md="8"
|
|
26
|
+
* lg="6"
|
|
27
|
+
* >Responsive</nr-col>
|
|
28
|
+
*
|
|
29
|
+
* <!-- Column with order -->
|
|
30
|
+
* <nr-col span="6" order="4">Last</nr-col>
|
|
31
|
+
* <nr-col span="6" order="1">First</nr-col>
|
|
32
|
+
*
|
|
33
|
+
* <!-- Flex column -->
|
|
34
|
+
* <nr-col flex="auto">Auto flex</nr-col>
|
|
35
|
+
* <nr-col flex="1">Flex 1</nr-col>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @slot default - Column content
|
|
39
|
+
*/
|
|
40
|
+
export declare class NrColElement extends NrColElement_base {
|
|
41
|
+
static styles: import("lit").CSSResult;
|
|
42
|
+
/** Number of columns to span (out of 24) */
|
|
43
|
+
span?: number;
|
|
44
|
+
/** Number of columns to offset */
|
|
45
|
+
offset: number;
|
|
46
|
+
/** Order of the column */
|
|
47
|
+
order?: number;
|
|
48
|
+
/** Number of columns to pull */
|
|
49
|
+
pull: number;
|
|
50
|
+
/** Number of columns to push */
|
|
51
|
+
push: number;
|
|
52
|
+
/** Flex layout style */
|
|
53
|
+
flex: FlexType | '';
|
|
54
|
+
/** Extra small devices (<576px) */
|
|
55
|
+
xs?: number | ColSize;
|
|
56
|
+
/** Small devices (≥576px) */
|
|
57
|
+
sm?: number | ColSize;
|
|
58
|
+
/** Medium devices (≥768px) */
|
|
59
|
+
md?: number | ColSize;
|
|
60
|
+
/** Large devices (≥992px) */
|
|
61
|
+
lg?: number | ColSize;
|
|
62
|
+
/** Extra large devices (≥1200px) */
|
|
63
|
+
xl?: number | ColSize;
|
|
64
|
+
/** Extra extra large devices (≥1600px) */
|
|
65
|
+
xxl?: number | ColSize;
|
|
66
|
+
/** Current breakpoint */
|
|
67
|
+
private currentBreakpoint;
|
|
68
|
+
private resizeObserver?;
|
|
69
|
+
connectedCallback(): void;
|
|
70
|
+
disconnectedCallback(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Setup responsive breakpoint detection
|
|
73
|
+
*/
|
|
74
|
+
private setupResponsive;
|
|
75
|
+
/**
|
|
76
|
+
* Update current breakpoint based on window width
|
|
77
|
+
*/
|
|
78
|
+
private updateBreakpoint;
|
|
79
|
+
/**
|
|
80
|
+
* Get responsive configuration for current breakpoint
|
|
81
|
+
*/
|
|
82
|
+
private getResponsiveConfig;
|
|
83
|
+
/**
|
|
84
|
+
* Get computed column properties
|
|
85
|
+
*/
|
|
86
|
+
private getColProperties;
|
|
87
|
+
/**
|
|
88
|
+
* Get gutter from parent row
|
|
89
|
+
*/
|
|
90
|
+
private getGutterFromParent;
|
|
91
|
+
/**
|
|
92
|
+
* Get inline styles for column
|
|
93
|
+
*/
|
|
94
|
+
private getColStyle;
|
|
95
|
+
render(): import("lit").TemplateResult<1>;
|
|
96
|
+
}
|
|
97
|
+
declare global {
|
|
98
|
+
interface HTMLElementTagNameMap {
|
|
99
|
+
'nr-col': NrColElement;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
export {};
|
|
103
|
+
//# sourceMappingURL=col.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"col.component.d.ts","sourceRoot":"","sources":["../../../src/components/grid/col.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAIvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAA6C,MAAM,iBAAiB,CAAC;;AAE/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBACa,YAAa,SAAQ,iBAA6B;IAC7D,OAAgB,MAAM,0BAAU;IAEhC,4CAA4C;IAE5C,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,kCAAkC;IAElC,MAAM,SAAK;IAEX,0BAA0B;IAE1B,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,gCAAgC;IAEhC,IAAI,SAAK;IAET,gCAAgC;IAEhC,IAAI,SAAK;IAET,wBAAwB;IAExB,IAAI,EAAE,QAAQ,GAAG,EAAE,CAAgB;IAEnC,mCAAmC;IAEnC,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEtB,6BAA6B;IAE7B,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEtB,8BAA8B;IAE9B,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEtB,6BAA6B;IAE7B,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEtB,oCAAoC;IAEpC,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEtB,0CAA0C;IAE1C,GAAG,CAAC,EAAE,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