@nuralyui/container 0.0.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/bundle.js +161 -0
- package/container.component.d.ts +85 -0
- package/container.component.js +223 -0
- package/container.component.js.map +1 -0
- package/container.style.d.ts +6 -0
- package/container.style.js +146 -0
- package/container.style.js.map +1 -0
- package/container.types.d.ts +67 -0
- package/container.types.js +5 -0
- package/container.types.js.map +1 -0
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/index.js.map +1 -0
- package/package.json +49 -0
- package/react.d.ts +3 -0
- package/react.js +10 -0
- package/react.js.map +1 -0
package/bundle.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import{css as t,LitElement as i,html as n}from"lit";import{property as a,customElement as e}from"lit/decorators.js";import{NuralyUIBaseMixin as r}from"@nuralyui/common/mixins";const s=t`
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.nr-container {
|
|
8
|
+
display: flex;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
min-height: inherit;
|
|
11
|
+
|
|
12
|
+
/* Theme-aware */
|
|
13
|
+
color: var(--nuraly-color-text);
|
|
14
|
+
background: var(--nuraly-container-background, transparent);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Direction */
|
|
18
|
+
.nr-container[data-direction="row"] {
|
|
19
|
+
flex-direction: row;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.nr-container[data-direction="column"] {
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Layout: Fluid (full width) - applies to both directions */
|
|
27
|
+
.nr-container[data-layout="fluid"] {
|
|
28
|
+
width: 100%;
|
|
29
|
+
max-width: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Layout: Boxed (centered with max-width) */
|
|
33
|
+
.nr-container[data-layout="boxed"] {
|
|
34
|
+
margin-inline: auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Layout: Fixed */
|
|
38
|
+
.nr-container[data-layout="fixed"] {
|
|
39
|
+
margin-inline: auto;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Row direction with non-fluid layout should be fit-content */
|
|
43
|
+
.nr-container[data-direction="row"][data-layout="boxed"],
|
|
44
|
+
.nr-container[data-direction="row"][data-layout="fixed"] {
|
|
45
|
+
width: fit-content;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Boxed/Fixed sizes */
|
|
49
|
+
.nr-container[data-size="sm"] {
|
|
50
|
+
max-width: var(--nuraly-container-sm, 640px);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.nr-container[data-size="md"] {
|
|
54
|
+
max-width: var(--nuraly-container-md, 768px);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.nr-container[data-size="lg"] {
|
|
58
|
+
max-width: var(--nuraly-container-lg, 1024px);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.nr-container[data-size="xl"] {
|
|
62
|
+
max-width: var(--nuraly-container-xl, 1280px);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.nr-container[data-size="full"] {
|
|
66
|
+
max-width: 100%;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Padding presets */
|
|
70
|
+
.nr-container[data-padding="none"] {
|
|
71
|
+
padding: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.nr-container[data-padding="sm"] {
|
|
75
|
+
padding: var(--nuraly-spacing-2, 8px);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.nr-container[data-padding="md"] {
|
|
79
|
+
padding: var(--nuraly-spacing-3, 16px);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.nr-container[data-padding="lg"] {
|
|
83
|
+
padding: var(--nuraly-spacing-4, 24px);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Wrap */
|
|
87
|
+
.nr-container[data-wrap="true"] {
|
|
88
|
+
flex-wrap: wrap;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.nr-container[data-wrap="false"] {
|
|
92
|
+
flex-wrap: nowrap;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* Justify content */
|
|
96
|
+
.nr-container[data-justify="flex-start"] {
|
|
97
|
+
justify-content: flex-start;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.nr-container[data-justify="flex-end"] {
|
|
101
|
+
justify-content: flex-end;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.nr-container[data-justify="center"] {
|
|
105
|
+
justify-content: center;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.nr-container[data-justify="space-between"] {
|
|
109
|
+
justify-content: space-between;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.nr-container[data-justify="space-around"] {
|
|
113
|
+
justify-content: space-around;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.nr-container[data-justify="space-evenly"] {
|
|
117
|
+
justify-content: space-evenly;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Align items */
|
|
121
|
+
.nr-container[data-align="flex-start"] {
|
|
122
|
+
align-items: flex-start;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.nr-container[data-align="flex-end"] {
|
|
126
|
+
align-items: flex-end;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.nr-container[data-align="center"] {
|
|
130
|
+
align-items: center;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.nr-container[data-align="baseline"] {
|
|
134
|
+
align-items: baseline;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.nr-container[data-align="stretch"] {
|
|
138
|
+
align-items: stretch;
|
|
139
|
+
}
|
|
140
|
+
`
|
|
141
|
+
/**
|
|
142
|
+
* @license
|
|
143
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
144
|
+
* SPDX-License-Identifier: MIT
|
|
145
|
+
*/;var o=function(t,i,n,a){for(var e,r=arguments.length,s=r<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,n):a,o=t.length-1;o>=0;o--)(e=t[o])&&(s=(r<3?e(s):r>3?e(i,n,s):e(i,n))||s);return r>3&&s&&Object.defineProperty(i,n,s),s};let d=class extends(r(i)){constructor(){super(...arguments),this.layout="fluid",this.direction="column",this.size="lg",this.padding="",this.justify="",this.align="",this.gap=0,this.wrap=!1,this.width="",this.height="",this.minHeight="",this.innerClass=""}getGapValue(t){if("number"==typeof t)return`${t}px`;if("string"==typeof t)switch(t){case"small":return"var(--nuraly-spacing-2, 8px)";case"medium":return"var(--nuraly-spacing-3, 16px)";case"large":return"var(--nuraly-spacing-4, 24px)";default:return t}return"0"}getGapStyles(){const t={};if(Array.isArray(this.gap)){const[i,n]=this.gap;t["column-gap"]=this.getGapValue(i),t["row-gap"]=this.getGapValue(n)}else this.gap&&(t.gap=this.getGapValue(this.gap));return t}getContainerStyles(){const t=Object.assign({},this.getGapStyles());return this.height&&(t.height=this.height),this.minHeight&&(t["min-height"]=this.minHeight),Object.entries(t).map(([t,i])=>`${t}: ${i}`).join("; ")}updated(t){super.updated(t),"boxed"===this.layout?(this.width?(this.style.maxWidth=this.width,this.style.width=""):this.style.maxWidth="",this.style.marginInline="auto"):this.width?(this.style.width=this.width,this.style.maxWidth=this.width,this.style.marginInline=""):"fluid"===this.layout?(this.style.width="100%",this.style.maxWidth="",this.style.marginInline=""):"row"===this.direction&&"fixed"===this.layout?(this.style.width="fit-content",this.style.maxWidth="",this.style.marginInline=""):(this.style.width="100%",this.style.maxWidth="",this.style.marginInline="")}render(){const t=this.getContainerStyles(),i=this.innerClass?`nr-container ${this.innerClass}`:"nr-container";return n`
|
|
146
|
+
<div
|
|
147
|
+
class="${i}"
|
|
148
|
+
part="container"
|
|
149
|
+
data-layout="${this.layout}"
|
|
150
|
+
data-direction="${this.direction}"
|
|
151
|
+
data-size="${"fluid"!==this.layout?this.size:""}"
|
|
152
|
+
data-padding="${this.padding}"
|
|
153
|
+
data-justify="${this.justify}"
|
|
154
|
+
data-align="${this.align}"
|
|
155
|
+
data-wrap="${this.wrap}"
|
|
156
|
+
data-theme="${this.currentTheme}"
|
|
157
|
+
style="${t}"
|
|
158
|
+
>
|
|
159
|
+
<slot></slot>
|
|
160
|
+
</div>
|
|
161
|
+
`}};d.styles=s,o([a({type:String})],d.prototype,"layout",void 0),o([a({type:String})],d.prototype,"direction",void 0),o([a({type:String})],d.prototype,"size",void 0),o([a({type:String})],d.prototype,"padding",void 0),o([a({type:String})],d.prototype,"justify",void 0),o([a({type:String})],d.prototype,"align",void 0),o([a({type:Object})],d.prototype,"gap",void 0),o([a({type:Boolean})],d.prototype,"wrap",void 0),o([a({type:String})],d.prototype,"width",void 0),o([a({type:String})],d.prototype,"height",void 0),o([a({type:String,attribute:"min-height"})],d.prototype,"minHeight",void 0),o([a({type:String,attribute:"inner-class"})],d.prototype,"innerClass",void 0),d=o([e("nr-container")],d);const c="";export{c as EMPTY_STRING,d as NrContainerElement};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { LitElement } from 'lit';
|
|
7
|
+
import type { Gap } from './container.types.js';
|
|
8
|
+
declare const NrContainerElement_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
|
+
* Container layout component for wrapping content with configurable layout options
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```html
|
|
14
|
+
* <!-- Basic container -->
|
|
15
|
+
* <nr-container>
|
|
16
|
+
* <div>Content</div>
|
|
17
|
+
* </nr-container>
|
|
18
|
+
*
|
|
19
|
+
* <!-- Boxed centered container -->
|
|
20
|
+
* <nr-container layout="boxed" size="lg">
|
|
21
|
+
* <div>Centered content with max-width</div>
|
|
22
|
+
* </nr-container>
|
|
23
|
+
*
|
|
24
|
+
* <!-- Vertical container with gap -->
|
|
25
|
+
* <nr-container direction="column" gap="16">
|
|
26
|
+
* <div>Item 1</div>
|
|
27
|
+
* <div>Item 2</div>
|
|
28
|
+
* </nr-container>
|
|
29
|
+
*
|
|
30
|
+
* <!-- Centered content -->
|
|
31
|
+
* <nr-container justify="center" align="center">
|
|
32
|
+
* <div>Centered content</div>
|
|
33
|
+
* </nr-container>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @slot default - Container content
|
|
37
|
+
*/
|
|
38
|
+
export declare class NrContainerElement extends NrContainerElement_base {
|
|
39
|
+
static styles: import("lit").CSSResult;
|
|
40
|
+
/** Layout type: fluid (full width), boxed (centered with max-width), or fixed */
|
|
41
|
+
layout: 'fluid' | 'boxed' | 'fixed';
|
|
42
|
+
/** Flex direction: row or column */
|
|
43
|
+
direction: 'row' | 'column';
|
|
44
|
+
/** Size preset for boxed/fixed layouts */
|
|
45
|
+
size: 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
46
|
+
/** Padding preset */
|
|
47
|
+
padding: 'none' | 'sm' | 'md' | 'lg' | '';
|
|
48
|
+
/** Justify content alignment */
|
|
49
|
+
justify: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | '';
|
|
50
|
+
/** Align items alignment */
|
|
51
|
+
align: 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch' | '';
|
|
52
|
+
/** Gap between items - can be preset string, number (px), or [horizontal, vertical] */
|
|
53
|
+
gap: Gap;
|
|
54
|
+
/** Enable flex wrap */
|
|
55
|
+
wrap: boolean;
|
|
56
|
+
/** Custom width (overrides size preset) */
|
|
57
|
+
width: string;
|
|
58
|
+
/** Custom height */
|
|
59
|
+
height: string;
|
|
60
|
+
/** Custom min-height */
|
|
61
|
+
minHeight: string;
|
|
62
|
+
/** Class to apply to inner container (for component styles) */
|
|
63
|
+
innerClass: string;
|
|
64
|
+
/**
|
|
65
|
+
* Convert gap value to CSS value
|
|
66
|
+
*/
|
|
67
|
+
private getGapValue;
|
|
68
|
+
/**
|
|
69
|
+
* Get gap styles for container
|
|
70
|
+
*/
|
|
71
|
+
private getGapStyles;
|
|
72
|
+
/**
|
|
73
|
+
* Get all inline styles for inner container
|
|
74
|
+
*/
|
|
75
|
+
private getContainerStyles;
|
|
76
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
77
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
78
|
+
}
|
|
79
|
+
declare global {
|
|
80
|
+
interface HTMLElementTagNameMap {
|
|
81
|
+
'nr-container': NrContainerElement;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export {};
|
|
85
|
+
//# sourceMappingURL=container.component.d.ts.map
|
|
@@ -0,0 +1,223 @@
|
|
|
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 './container.style.js';
|
|
15
|
+
import { NuralyUIBaseMixin } from '@nuralyui/common/mixins';
|
|
16
|
+
/**
|
|
17
|
+
* Container layout component for wrapping content with configurable layout options
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```html
|
|
21
|
+
* <!-- Basic container -->
|
|
22
|
+
* <nr-container>
|
|
23
|
+
* <div>Content</div>
|
|
24
|
+
* </nr-container>
|
|
25
|
+
*
|
|
26
|
+
* <!-- Boxed centered container -->
|
|
27
|
+
* <nr-container layout="boxed" size="lg">
|
|
28
|
+
* <div>Centered content with max-width</div>
|
|
29
|
+
* </nr-container>
|
|
30
|
+
*
|
|
31
|
+
* <!-- Vertical container with gap -->
|
|
32
|
+
* <nr-container direction="column" gap="16">
|
|
33
|
+
* <div>Item 1</div>
|
|
34
|
+
* <div>Item 2</div>
|
|
35
|
+
* </nr-container>
|
|
36
|
+
*
|
|
37
|
+
* <!-- Centered content -->
|
|
38
|
+
* <nr-container justify="center" align="center">
|
|
39
|
+
* <div>Centered content</div>
|
|
40
|
+
* </nr-container>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @slot default - Container content
|
|
44
|
+
*/
|
|
45
|
+
let NrContainerElement = class NrContainerElement extends NuralyUIBaseMixin(LitElement) {
|
|
46
|
+
constructor() {
|
|
47
|
+
super(...arguments);
|
|
48
|
+
/** Layout type: fluid (full width), boxed (centered with max-width), or fixed */
|
|
49
|
+
this.layout = 'fluid';
|
|
50
|
+
/** Flex direction: row or column */
|
|
51
|
+
this.direction = 'column';
|
|
52
|
+
/** Size preset for boxed/fixed layouts */
|
|
53
|
+
this.size = 'lg';
|
|
54
|
+
/** Padding preset */
|
|
55
|
+
this.padding = '';
|
|
56
|
+
/** Justify content alignment */
|
|
57
|
+
this.justify = '';
|
|
58
|
+
/** Align items alignment */
|
|
59
|
+
this.align = '';
|
|
60
|
+
/** Gap between items - can be preset string, number (px), or [horizontal, vertical] */
|
|
61
|
+
this.gap = 0;
|
|
62
|
+
/** Enable flex wrap */
|
|
63
|
+
this.wrap = false;
|
|
64
|
+
/** Custom width (overrides size preset) */
|
|
65
|
+
this.width = '';
|
|
66
|
+
/** Custom height */
|
|
67
|
+
this.height = '';
|
|
68
|
+
/** Custom min-height */
|
|
69
|
+
this.minHeight = '';
|
|
70
|
+
/** Class to apply to inner container (for component styles) */
|
|
71
|
+
this.innerClass = '';
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Convert gap value to CSS value
|
|
75
|
+
*/
|
|
76
|
+
getGapValue(value) {
|
|
77
|
+
if (typeof value === 'number') {
|
|
78
|
+
return `${value}px`;
|
|
79
|
+
}
|
|
80
|
+
if (typeof value === 'string') {
|
|
81
|
+
switch (value) {
|
|
82
|
+
case 'small':
|
|
83
|
+
return 'var(--nuraly-spacing-2, 8px)';
|
|
84
|
+
case 'medium':
|
|
85
|
+
return 'var(--nuraly-spacing-3, 16px)';
|
|
86
|
+
case 'large':
|
|
87
|
+
return 'var(--nuraly-spacing-4, 24px)';
|
|
88
|
+
default:
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return '0';
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get gap styles for container
|
|
96
|
+
*/
|
|
97
|
+
getGapStyles() {
|
|
98
|
+
const styles = {};
|
|
99
|
+
if (Array.isArray(this.gap)) {
|
|
100
|
+
const [horizontal, vertical] = this.gap;
|
|
101
|
+
styles['column-gap'] = this.getGapValue(horizontal);
|
|
102
|
+
styles['row-gap'] = this.getGapValue(vertical);
|
|
103
|
+
}
|
|
104
|
+
else if (this.gap) {
|
|
105
|
+
styles['gap'] = this.getGapValue(this.gap);
|
|
106
|
+
}
|
|
107
|
+
return styles;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get all inline styles for inner container
|
|
111
|
+
*/
|
|
112
|
+
getContainerStyles() {
|
|
113
|
+
const styles = Object.assign({}, this.getGapStyles());
|
|
114
|
+
// Width is handled on host element, not inner container
|
|
115
|
+
if (this.height) {
|
|
116
|
+
styles['height'] = this.height;
|
|
117
|
+
}
|
|
118
|
+
if (this.minHeight) {
|
|
119
|
+
styles['min-height'] = this.minHeight;
|
|
120
|
+
}
|
|
121
|
+
return Object.entries(styles)
|
|
122
|
+
.map(([key, value]) => `${key}: ${value}`)
|
|
123
|
+
.join('; ');
|
|
124
|
+
}
|
|
125
|
+
updated(changedProperties) {
|
|
126
|
+
super.updated(changedProperties);
|
|
127
|
+
// Update host styles based on layout
|
|
128
|
+
if (this.layout === 'boxed') {
|
|
129
|
+
// Boxed: host is centered with max-width
|
|
130
|
+
if (this.width) {
|
|
131
|
+
this.style.maxWidth = this.width;
|
|
132
|
+
this.style.width = '';
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
this.style.maxWidth = '';
|
|
136
|
+
}
|
|
137
|
+
this.style.marginInline = 'auto';
|
|
138
|
+
}
|
|
139
|
+
else if (this.width) {
|
|
140
|
+
this.style.width = this.width;
|
|
141
|
+
this.style.maxWidth = this.width;
|
|
142
|
+
this.style.marginInline = '';
|
|
143
|
+
}
|
|
144
|
+
else if (this.layout === 'fluid') {
|
|
145
|
+
this.style.width = '100%';
|
|
146
|
+
this.style.maxWidth = '';
|
|
147
|
+
this.style.marginInline = '';
|
|
148
|
+
}
|
|
149
|
+
else if (this.direction === 'row' && this.layout === 'fixed') {
|
|
150
|
+
this.style.width = 'fit-content';
|
|
151
|
+
this.style.maxWidth = '';
|
|
152
|
+
this.style.marginInline = '';
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
this.style.width = '100%';
|
|
156
|
+
this.style.maxWidth = '';
|
|
157
|
+
this.style.marginInline = '';
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
render() {
|
|
161
|
+
const containerStyles = this.getContainerStyles();
|
|
162
|
+
const classes = this.innerClass ? `nr-container ${this.innerClass}` : 'nr-container';
|
|
163
|
+
return html `
|
|
164
|
+
<div
|
|
165
|
+
class="${classes}"
|
|
166
|
+
part="container"
|
|
167
|
+
data-layout="${this.layout}"
|
|
168
|
+
data-direction="${this.direction}"
|
|
169
|
+
data-size="${this.layout !== 'fluid' ? this.size : ''}"
|
|
170
|
+
data-padding="${this.padding}"
|
|
171
|
+
data-justify="${this.justify}"
|
|
172
|
+
data-align="${this.align}"
|
|
173
|
+
data-wrap="${this.wrap}"
|
|
174
|
+
data-theme="${this.currentTheme}"
|
|
175
|
+
style="${containerStyles}"
|
|
176
|
+
>
|
|
177
|
+
<slot></slot>
|
|
178
|
+
</div>
|
|
179
|
+
`;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
NrContainerElement.styles = styles;
|
|
183
|
+
__decorate([
|
|
184
|
+
property({ type: String })
|
|
185
|
+
], NrContainerElement.prototype, "layout", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
property({ type: String })
|
|
188
|
+
], NrContainerElement.prototype, "direction", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
property({ type: String })
|
|
191
|
+
], NrContainerElement.prototype, "size", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
property({ type: String })
|
|
194
|
+
], NrContainerElement.prototype, "padding", void 0);
|
|
195
|
+
__decorate([
|
|
196
|
+
property({ type: String })
|
|
197
|
+
], NrContainerElement.prototype, "justify", void 0);
|
|
198
|
+
__decorate([
|
|
199
|
+
property({ type: String })
|
|
200
|
+
], NrContainerElement.prototype, "align", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
property({ type: Object })
|
|
203
|
+
], NrContainerElement.prototype, "gap", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
property({ type: Boolean })
|
|
206
|
+
], NrContainerElement.prototype, "wrap", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
property({ type: String })
|
|
209
|
+
], NrContainerElement.prototype, "width", void 0);
|
|
210
|
+
__decorate([
|
|
211
|
+
property({ type: String })
|
|
212
|
+
], NrContainerElement.prototype, "height", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
property({ type: String, attribute: 'min-height' })
|
|
215
|
+
], NrContainerElement.prototype, "minHeight", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
property({ type: String, attribute: 'inner-class' })
|
|
218
|
+
], NrContainerElement.prototype, "innerClass", void 0);
|
|
219
|
+
NrContainerElement = __decorate([
|
|
220
|
+
customElement('nr-container')
|
|
221
|
+
], NrContainerElement);
|
|
222
|
+
export { NrContainerElement };
|
|
223
|
+
//# sourceMappingURL=container.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.component.js","sourceRoot":"","sources":["../../../../src/components/container/container.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,sBAAsB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAK5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,iBAAiB,CAAC,UAAU,CAAC;IAA9D;;QAGL,iFAAiF;QAEjF,WAAM,GAAgC,OAAO,CAAC;QAE9C,oCAAoC;QAEpC,cAAS,GAAqB,QAAQ,CAAC;QAEvC,0CAA0C;QAE1C,SAAI,GAAuC,IAAI,CAAC;QAEhD,qBAAqB;QAErB,YAAO,GAAqC,EAAE,CAAC;QAE/C,gCAAgC;QAEhC,YAAO,GAAkG,EAAE,CAAC;QAE5G,4BAA4B;QAE5B,UAAK,GAAuE,EAAE,CAAC;QAE/E,uFAAuF;QAEvF,QAAG,GAAQ,CAAC,CAAC;QAEb,uBAAuB;QAEvB,SAAI,GAAG,KAAK,CAAC;QAEb,2CAA2C;QAE3C,UAAK,GAAG,EA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AAAT,CAAU;AAIhC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACmB;AAI9C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDACY;AAIvC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDACqB;AAIhD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDACoB;AAI/C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDACiF;AAI5G;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACoD;AAI/E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACd;AAIb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDACf;AAIb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAChB;AAIX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACf;AAIZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;qDACrC;AAIf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;sDACrC;AAjDL,kBAAkB;IAD9B,aAAa,CAAC,cAAc,CAAC;GACjB,kBAAkB,CAyK9B","sourcesContent":["/**\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 './container.style.js';\nimport { NuralyUIBaseMixin } from '@nuralyui/common/mixins';\nimport type {\n Gap\n} from './container.types.js';\n\n/**\n * Container layout component for wrapping content with configurable layout options\n *\n * @example\n * ```html\n * <!-- Basic container -->\n * <nr-container>\n * <div>Content</div>\n * </nr-container>\n *\n * <!-- Boxed centered container -->\n * <nr-container layout=\"boxed\" size=\"lg\">\n * <div>Centered content with max-width</div>\n * </nr-container>\n *\n * <!-- Vertical container with gap -->\n * <nr-container direction=\"column\" gap=\"16\">\n * <div>Item 1</div>\n * <div>Item 2</div>\n * </nr-container>\n *\n * <!-- Centered content -->\n * <nr-container justify=\"center\" align=\"center\">\n * <div>Centered content</div>\n * </nr-container>\n * ```\n *\n * @slot default - Container content\n */\n@customElement('nr-container')\nexport class NrContainerElement extends NuralyUIBaseMixin(LitElement) {\n static override styles = styles;\n\n /** Layout type: fluid (full width), boxed (centered with max-width), or fixed */\n @property({ type: String })\n layout: 'fluid' | 'boxed' | 'fixed' = 'fluid';\n\n /** Flex direction: row or column */\n @property({ type: String })\n direction: 'row' | 'column' = 'column';\n\n /** Size preset for boxed/fixed layouts */\n @property({ type: String })\n size: 'sm' | 'md' | 'lg' | 'xl' | 'full' = 'lg';\n\n /** Padding preset */\n @property({ type: String })\n padding: 'none' | 'sm' | 'md' | 'lg' | '' = '';\n\n /** Justify content alignment */\n @property({ type: String })\n justify: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | '' = '';\n\n /** Align items alignment */\n @property({ type: String })\n align: 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch' | '' = '';\n\n /** Gap between items - can be preset string, number (px), or [horizontal, vertical] */\n @property({ type: Object })\n gap: Gap = 0;\n\n /** Enable flex wrap */\n @property({ type: Boolean })\n wrap = false;\n\n /** Custom width (overrides size preset) */\n @property({ type: String })\n width = '';\n\n /** Custom height */\n @property({ type: String })\n height = '';\n\n /** Custom min-height */\n @property({ type: String, attribute: 'min-height' })\n minHeight = '';\n\n /** Class to apply to inner container (for component styles) */\n @property({ type: String, attribute: 'inner-class' })\n innerClass = '';\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 switch (value) {\n case 'small':\n return 'var(--nuraly-spacing-2, 8px)';\n case 'medium':\n return 'var(--nuraly-spacing-3, 16px)';\n case 'large':\n return 'var(--nuraly-spacing-4, 24px)';\n default:\n return value;\n }\n }\n\n return '0';\n }\n\n /**\n * Get gap styles for 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 inner container\n */\n private getContainerStyles(): string {\n const styles: Record<string, string> = {\n ...this.getGapStyles()\n };\n\n // Width is handled on host element, not inner container\n\n if (this.height) {\n styles['height'] = this.height;\n }\n\n if (this.minHeight) {\n styles['min-height'] = this.minHeight;\n }\n\n return Object.entries(styles)\n .map(([key, value]) => `${key}: ${value}`)\n .join('; ');\n }\n\n override updated(changedProperties: Map<string, unknown>): void {\n super.updated(changedProperties);\n\n // Update host styles based on layout\n if (this.layout === 'boxed') {\n // Boxed: host is centered with max-width\n if (this.width) {\n this.style.maxWidth = this.width;\n this.style.width = '';\n } else {\n this.style.maxWidth = '';\n }\n this.style.marginInline = 'auto';\n } else if (this.width) {\n this.style.width = this.width;\n this.style.maxWidth = this.width;\n this.style.marginInline = '';\n } else if (this.layout === 'fluid') {\n this.style.width = '100%';\n this.style.maxWidth = '';\n this.style.marginInline = '';\n } else if (this.direction === 'row' && this.layout === 'fixed') {\n this.style.width = 'fit-content';\n this.style.maxWidth = '';\n this.style.marginInline = '';\n } else {\n this.style.width = '100%';\n this.style.maxWidth = '';\n this.style.marginInline = '';\n }\n }\n\n override render() {\n const containerStyles = this.getContainerStyles();\n const classes = this.innerClass ? `nr-container ${this.innerClass}` : 'nr-container';\n\n return html`\n <div\n class=\"${classes}\"\n part=\"container\"\n data-layout=\"${this.layout}\"\n data-direction=\"${this.direction}\"\n data-size=\"${this.layout !== 'fluid' ? this.size : ''}\"\n data-padding=\"${this.padding}\"\n data-justify=\"${this.justify}\"\n data-align=\"${this.align}\"\n data-wrap=\"${this.wrap}\"\n data-theme=\"${this.currentTheme}\"\n style=\"${containerStyles}\"\n >\n <slot></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nr-container': NrContainerElement;\n }\n}\n"]}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Container 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-container {
|
|
13
|
+
display: flex;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
min-height: inherit;
|
|
16
|
+
|
|
17
|
+
/* Theme-aware */
|
|
18
|
+
color: var(--nuraly-color-text);
|
|
19
|
+
background: var(--nuraly-container-background, transparent);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Direction */
|
|
23
|
+
.nr-container[data-direction="row"] {
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.nr-container[data-direction="column"] {
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Layout: Fluid (full width) - applies to both directions */
|
|
32
|
+
.nr-container[data-layout="fluid"] {
|
|
33
|
+
width: 100%;
|
|
34
|
+
max-width: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Layout: Boxed (centered with max-width) */
|
|
38
|
+
.nr-container[data-layout="boxed"] {
|
|
39
|
+
margin-inline: auto;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Layout: Fixed */
|
|
43
|
+
.nr-container[data-layout="fixed"] {
|
|
44
|
+
margin-inline: auto;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Row direction with non-fluid layout should be fit-content */
|
|
48
|
+
.nr-container[data-direction="row"][data-layout="boxed"],
|
|
49
|
+
.nr-container[data-direction="row"][data-layout="fixed"] {
|
|
50
|
+
width: fit-content;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Boxed/Fixed sizes */
|
|
54
|
+
.nr-container[data-size="sm"] {
|
|
55
|
+
max-width: var(--nuraly-container-sm, 640px);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.nr-container[data-size="md"] {
|
|
59
|
+
max-width: var(--nuraly-container-md, 768px);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.nr-container[data-size="lg"] {
|
|
63
|
+
max-width: var(--nuraly-container-lg, 1024px);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.nr-container[data-size="xl"] {
|
|
67
|
+
max-width: var(--nuraly-container-xl, 1280px);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.nr-container[data-size="full"] {
|
|
71
|
+
max-width: 100%;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Padding presets */
|
|
75
|
+
.nr-container[data-padding="none"] {
|
|
76
|
+
padding: 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.nr-container[data-padding="sm"] {
|
|
80
|
+
padding: var(--nuraly-spacing-2, 8px);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.nr-container[data-padding="md"] {
|
|
84
|
+
padding: var(--nuraly-spacing-3, 16px);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.nr-container[data-padding="lg"] {
|
|
88
|
+
padding: var(--nuraly-spacing-4, 24px);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* Wrap */
|
|
92
|
+
.nr-container[data-wrap="true"] {
|
|
93
|
+
flex-wrap: wrap;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.nr-container[data-wrap="false"] {
|
|
97
|
+
flex-wrap: nowrap;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Justify content */
|
|
101
|
+
.nr-container[data-justify="flex-start"] {
|
|
102
|
+
justify-content: flex-start;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.nr-container[data-justify="flex-end"] {
|
|
106
|
+
justify-content: flex-end;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.nr-container[data-justify="center"] {
|
|
110
|
+
justify-content: center;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.nr-container[data-justify="space-between"] {
|
|
114
|
+
justify-content: space-between;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.nr-container[data-justify="space-around"] {
|
|
118
|
+
justify-content: space-around;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.nr-container[data-justify="space-evenly"] {
|
|
122
|
+
justify-content: space-evenly;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* Align items */
|
|
126
|
+
.nr-container[data-align="flex-start"] {
|
|
127
|
+
align-items: flex-start;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.nr-container[data-align="flex-end"] {
|
|
131
|
+
align-items: flex-end;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.nr-container[data-align="center"] {
|
|
135
|
+
align-items: center;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.nr-container[data-align="baseline"] {
|
|
139
|
+
align-items: baseline;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.nr-container[data-align="stretch"] {
|
|
143
|
+
align-items: stretch;
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
146
|
+
//# sourceMappingURL=container.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.style.js","sourceRoot":"","sources":["../../../../src/components/container/container.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2IxB,CAAC","sourcesContent":["import { css } from 'lit';\n\n/**\n * Container 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-container {\n display: flex;\n box-sizing: border-box;\n min-height: inherit;\n\n /* Theme-aware */\n color: var(--nuraly-color-text);\n background: var(--nuraly-container-background, transparent);\n }\n\n /* Direction */\n .nr-container[data-direction=\"row\"] {\n flex-direction: row;\n }\n\n .nr-container[data-direction=\"column\"] {\n flex-direction: column;\n }\n\n /* Layout: Fluid (full width) - applies to both directions */\n .nr-container[data-layout=\"fluid\"] {\n width: 100%;\n max-width: none;\n }\n\n /* Layout: Boxed (centered with max-width) */\n .nr-container[data-layout=\"boxed\"] {\n margin-inline: auto;\n }\n\n /* Layout: Fixed */\n .nr-container[data-layout=\"fixed\"] {\n margin-inline: auto;\n }\n\n /* Row direction with non-fluid layout should be fit-content */\n .nr-container[data-direction=\"row\"][data-layout=\"boxed\"],\n .nr-container[data-direction=\"row\"][data-layout=\"fixed\"] {\n width: fit-content;\n }\n\n /* Boxed/Fixed sizes */\n .nr-container[data-size=\"sm\"] {\n max-width: var(--nuraly-container-sm, 640px);\n }\n\n .nr-container[data-size=\"md\"] {\n max-width: var(--nuraly-container-md, 768px);\n }\n\n .nr-container[data-size=\"lg\"] {\n max-width: var(--nuraly-container-lg, 1024px);\n }\n\n .nr-container[data-size=\"xl\"] {\n max-width: var(--nuraly-container-xl, 1280px);\n }\n\n .nr-container[data-size=\"full\"] {\n max-width: 100%;\n }\n\n /* Padding presets */\n .nr-container[data-padding=\"none\"] {\n padding: 0;\n }\n\n .nr-container[data-padding=\"sm\"] {\n padding: var(--nuraly-spacing-2, 8px);\n }\n\n .nr-container[data-padding=\"md\"] {\n padding: var(--nuraly-spacing-3, 16px);\n }\n\n .nr-container[data-padding=\"lg\"] {\n padding: var(--nuraly-spacing-4, 24px);\n }\n\n /* Wrap */\n .nr-container[data-wrap=\"true\"] {\n flex-wrap: wrap;\n }\n\n .nr-container[data-wrap=\"false\"] {\n flex-wrap: nowrap;\n }\n\n /* Justify content */\n .nr-container[data-justify=\"flex-start\"] {\n justify-content: flex-start;\n }\n\n .nr-container[data-justify=\"flex-end\"] {\n justify-content: flex-end;\n }\n\n .nr-container[data-justify=\"center\"] {\n justify-content: center;\n }\n\n .nr-container[data-justify=\"space-between\"] {\n justify-content: space-between;\n }\n\n .nr-container[data-justify=\"space-around\"] {\n justify-content: space-around;\n }\n\n .nr-container[data-justify=\"space-evenly\"] {\n justify-content: space-evenly;\n }\n\n /* Align items */\n .nr-container[data-align=\"flex-start\"] {\n align-items: flex-start;\n }\n\n .nr-container[data-align=\"flex-end\"] {\n align-items: flex-end;\n }\n\n .nr-container[data-align=\"center\"] {\n align-items: center;\n }\n\n .nr-container[data-align=\"baseline\"] {\n align-items: baseline;\n }\n\n .nr-container[data-align=\"stretch\"] {\n align-items: stretch;\n }\n`;\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container component types and constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const EMPTY_STRING = "";
|
|
5
|
+
/**
|
|
6
|
+
* Container layout type
|
|
7
|
+
*/
|
|
8
|
+
export declare const enum ContainerLayout {
|
|
9
|
+
/** Full width container */
|
|
10
|
+
Fluid = "fluid",
|
|
11
|
+
/** Centered with max-width (boxed) */
|
|
12
|
+
Boxed = "boxed",
|
|
13
|
+
/** Fixed width */
|
|
14
|
+
Fixed = "fixed"
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Container direction
|
|
18
|
+
*/
|
|
19
|
+
export declare const enum ContainerDirection {
|
|
20
|
+
Row = "row",
|
|
21
|
+
Column = "column"
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Container size presets for boxed layout
|
|
25
|
+
*/
|
|
26
|
+
export declare const enum ContainerSize {
|
|
27
|
+
Small = "sm",
|
|
28
|
+
Medium = "md",
|
|
29
|
+
Large = "lg",
|
|
30
|
+
ExtraLarge = "xl",
|
|
31
|
+
Full = "full"
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Padding size presets
|
|
35
|
+
*/
|
|
36
|
+
export declare const enum ContainerPadding {
|
|
37
|
+
None = "none",
|
|
38
|
+
Small = "sm",
|
|
39
|
+
Medium = "md",
|
|
40
|
+
Large = "lg"
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Justify content alignment
|
|
44
|
+
*/
|
|
45
|
+
export declare const enum ContainerJustify {
|
|
46
|
+
FlexStart = "flex-start",
|
|
47
|
+
FlexEnd = "flex-end",
|
|
48
|
+
Center = "center",
|
|
49
|
+
SpaceBetween = "space-between",
|
|
50
|
+
SpaceAround = "space-around",
|
|
51
|
+
SpaceEvenly = "space-evenly"
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Align items alignment
|
|
55
|
+
*/
|
|
56
|
+
export declare const enum ContainerAlign {
|
|
57
|
+
FlexStart = "flex-start",
|
|
58
|
+
FlexEnd = "flex-end",
|
|
59
|
+
Center = "center",
|
|
60
|
+
Baseline = "baseline",
|
|
61
|
+
Stretch = "stretch"
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Gap configuration - can be string preset, number (px), or array [horizontal, vertical]
|
|
65
|
+
*/
|
|
66
|
+
export type Gap = 'small' | 'medium' | 'large' | number | string | [number | string, number | string];
|
|
67
|
+
//# sourceMappingURL=container.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.types.js","sourceRoot":"","sources":["../../../../src/components/container/container.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC","sourcesContent":["/**\n * Container component types and constants\n */\n\nexport const EMPTY_STRING = '';\n\n/**\n * Container layout type\n */\nexport const enum ContainerLayout {\n /** Full width container */\n Fluid = 'fluid',\n /** Centered with max-width (boxed) */\n Boxed = 'boxed',\n /** Fixed width */\n Fixed = 'fixed'\n}\n\n/**\n * Container direction\n */\nexport const enum ContainerDirection {\n Row = 'row',\n Column = 'column'\n}\n\n/**\n * Container size presets for boxed layout\n */\nexport const enum ContainerSize {\n Small = 'sm',\n Medium = 'md',\n Large = 'lg',\n ExtraLarge = 'xl',\n Full = 'full'\n}\n\n/**\n * Padding size presets\n */\nexport const enum ContainerPadding {\n None = 'none',\n Small = 'sm',\n Medium = 'md',\n Large = 'lg'\n}\n\n/**\n * Justify content alignment\n */\nexport const enum ContainerJustify {\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 ContainerAlign {\n FlexStart = 'flex-start',\n FlexEnd = 'flex-end',\n Center = 'center',\n Baseline = 'baseline',\n Stretch = 'stretch'\n}\n\n/**\n * Gap configuration - can be string preset, number (px), or array [horizontal, vertical]\n */\nexport type Gap = 'small' | 'medium' | 'large' | number | string | [number | string, number | string];\n"]}
|
package/index.d.ts
ADDED
package/index.js
ADDED
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/container/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC","sourcesContent":["export * from './container.component.js';\nexport * from './container.types.js';\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nuralyui/container",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Container 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
|
+
"container.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/container"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"container",
|
|
32
|
+
"layout",
|
|
33
|
+
"boxed",
|
|
34
|
+
"fluid",
|
|
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
|
+
}
|
package/react.d.ts
ADDED
package/react.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createComponent } from '@lit-labs/react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { NrContainerElement } from './container.component.js';
|
|
4
|
+
export const NrContainer = createComponent({
|
|
5
|
+
tagName: 'nr-container',
|
|
6
|
+
elementClass: NrContainerElement,
|
|
7
|
+
react: React,
|
|
8
|
+
events: {},
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=react.js.map
|
package/react.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../../src/components/container/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC;IACzC,OAAO,EAAE,cAAc;IACvB,YAAY,EAAE,kBAAkB;IAChC,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,EAAE;CACX,CAAC,CAAC","sourcesContent":["import { createComponent } from '@lit-labs/react';\nimport * as React from 'react';\nimport { NrContainerElement } from './container.component.js';\n\nexport const NrContainer = createComponent({\n tagName: 'nr-container',\n elementClass: NrContainerElement,\n react: React,\n events: {},\n});\n"]}
|