@granularjs/ui 0.1.1 → 0.1.2
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/dist/granular-ui.min.js +9 -9
- package/dist/granular-ui.min.js.map +3 -3
- package/package.json +1 -1
- package/src/components/Container.js +1 -0
- package/src/components/List.js +7 -1
- package/src/components/SegmentedControl.js +9 -9
- package/src/index.js +1 -1
- package/src/theme/styles.js +8 -8
- package/types/index.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@granularjs/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "90+ production-ready UI components for Granular. Dark/light themes, CSS variables, accessible, zero dependencies beyond @granularjs/core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/granular-ui.min.js",
|
package/src/components/List.js
CHANGED
|
@@ -17,7 +17,13 @@ export function List(...args) {
|
|
|
17
17
|
value && typeof value === 'object' && typeof value.tagName === 'string' &&
|
|
18
18
|
value.tagName.toLowerCase() === 'li';
|
|
19
19
|
const wrapChild = (child) => {
|
|
20
|
+
console.log('INFO ABOUT ITEM', child,
|
|
21
|
+
typeof child,
|
|
22
|
+
typeof child?.tagName,
|
|
23
|
+
child?.tagName?.toLowerCase()
|
|
24
|
+
);
|
|
20
25
|
const wrapValue = (value) => {
|
|
26
|
+
if (value?.nodeType === 'granular-list-node') return value;
|
|
21
27
|
if (value == null || value === false) return null;
|
|
22
28
|
if (Array.isArray(value)) return value.map((item) => wrapValue(item));
|
|
23
29
|
if (isListItemNode(value)) return value;
|
|
@@ -29,7 +35,7 @@ export function List(...args) {
|
|
|
29
35
|
}
|
|
30
36
|
return wrapValue(child);
|
|
31
37
|
};
|
|
32
|
-
const listChildren = children.map((child) => wrapChild(child));
|
|
38
|
+
const listChildren = when(children, () => children.map((child) => wrapChild(child)));
|
|
33
39
|
const listProps = {
|
|
34
40
|
...rest,
|
|
35
41
|
className: cx(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Div, after, state } from '@granularjs/core';
|
|
1
|
+
import { Div, after, state, list } from '@granularjs/core';
|
|
2
2
|
import { cx, splitPropsChildren, classVar, resolveValue } from '../utils.js';
|
|
3
3
|
|
|
4
4
|
export function SegmentedControl(...args) {
|
|
@@ -18,22 +18,22 @@ export function SegmentedControl(...args) {
|
|
|
18
18
|
return Div(
|
|
19
19
|
{ ...rest, className: cx(scroll && 'g-ui-segmented-scroll') },
|
|
20
20
|
Div(
|
|
21
|
-
{ className: cx('g-ui-segmented', classVar('g-ui-segmented-size-', size, 'sm'),
|
|
22
|
-
data
|
|
21
|
+
{ className: cx('g-ui-segmented', classVar('g-ui-segmented-size-', size, 'sm'), className) },
|
|
22
|
+
list(data, ((item) =>
|
|
23
23
|
Div(
|
|
24
24
|
{
|
|
25
25
|
className: cx(
|
|
26
26
|
'g-ui-segmented-item',
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
after(currentState).compute((current) => {
|
|
28
|
+
if (item.get().value === current) return 'g-ui-segmented-active';
|
|
29
|
+
return '';
|
|
30
|
+
})
|
|
31
31
|
),
|
|
32
|
-
onClick: () => setValue(item.value),
|
|
32
|
+
onClick: () => setValue(item.get().value),
|
|
33
33
|
},
|
|
34
34
|
item.label
|
|
35
35
|
)
|
|
36
|
-
)
|
|
36
|
+
))
|
|
37
37
|
)
|
|
38
38
|
);
|
|
39
39
|
}
|
package/src/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ensureStyles } from './theme/styles.js';
|
|
|
3
3
|
ensureStyles();
|
|
4
4
|
|
|
5
5
|
export { setThemeVars, setThemeMode } from './theme/theme.js';
|
|
6
|
-
export { cx } from './utils.js';
|
|
6
|
+
export { cx, classVar, classFlag, classMap, splitPropsChildren } from './utils.js';
|
|
7
7
|
export { Button } from './components/Button.js';
|
|
8
8
|
export { Text } from './components/Text.js';
|
|
9
9
|
export { Title } from './components/Title.js';
|
package/src/theme/styles.js
CHANGED
|
@@ -839,8 +839,8 @@ body {
|
|
|
839
839
|
.g-ui-button-size-xs { font-size: 12px; height: 30px; padding: 0 var(--g-ui-space-8); }
|
|
840
840
|
.g-ui-button-size-sm { font-size: 13px; height: 36px; padding: 0 var(--g-ui-space-10); }
|
|
841
841
|
.g-ui-button-size-md { font-size: 14px; height: 42px; padding: 0 var(--g-ui-space-10); }
|
|
842
|
-
.g-ui-button-size-lg { font-size: 15px; height: 50px; padding: 0 var(--g-ui-space-
|
|
843
|
-
.g-ui-button-size-xl { font-size: 16px; height: 60px; padding: 0 var(--g-ui-space-
|
|
842
|
+
.g-ui-button-size-lg { font-size: 15px; height: 50px; padding: 0 var(--g-ui-space-12); }
|
|
843
|
+
.g-ui-button-size-xl { font-size: 16px; height: 60px; padding: 0 var(--g-ui-space-14); }
|
|
844
844
|
|
|
845
845
|
.g-ui-input-wrapper {
|
|
846
846
|
width: 100%;
|
|
@@ -1034,22 +1034,22 @@ body {
|
|
|
1034
1034
|
.g-ui-checkbox-size-xs .g-ui-checkbox-indeterminate svg { width: 16px; height: 16px; }
|
|
1035
1035
|
.g-ui-checkbox-size-sm .g-ui-checkbox-indeterminate { top:3px; left:4px; }
|
|
1036
1036
|
.g-ui-checkbox-size-sm .g-ui-checkbox-indeterminate svg { width: 20px; height:20px; }
|
|
1037
|
-
.g-ui-checkbox-size-md .g-ui-checkbox-indeterminate { top:
|
|
1037
|
+
.g-ui-checkbox-size-md .g-ui-checkbox-indeterminate { top:0px; left:0px; }
|
|
1038
1038
|
.g-ui-checkbox-size-md .g-ui-checkbox-indeterminate svg { width: 24px; height: 24px; }
|
|
1039
1039
|
.g-ui-checkbox-size-lg .g-ui-checkbox-indeterminate { top:4px; left:5px; }
|
|
1040
1040
|
.g-ui-checkbox-size-lg .g-ui-checkbox-indeterminate svg { width: 28px; height: 28px; }
|
|
1041
1041
|
.g-ui-checkbox-size-xl .g-ui-checkbox-indeterminate { top:5px; left:6px; }
|
|
1042
1042
|
.g-ui-checkbox-size-xl .g-ui-checkbox-indeterminate svg { width: 32px; height: 32px; }
|
|
1043
1043
|
|
|
1044
|
-
.g-ui-checkbox-size-xs .g-ui-checkbox-checked { top:
|
|
1044
|
+
.g-ui-checkbox-size-xs .g-ui-checkbox-checked { top: 0px;left:0.5px; }
|
|
1045
1045
|
.g-ui-checkbox-size-xs .g-ui-checkbox-checked svg { width: 16px; height: 16px; }
|
|
1046
|
-
.g-ui-checkbox-size-sm .g-ui-checkbox-checked { top:
|
|
1046
|
+
.g-ui-checkbox-size-sm .g-ui-checkbox-checked { top:0px; left:0.3px; }
|
|
1047
1047
|
.g-ui-checkbox-size-sm .g-ui-checkbox-checked svg { width: 20px; height:20px; }
|
|
1048
|
-
.g-ui-checkbox-size-md .g-ui-checkbox-checked { top:
|
|
1048
|
+
.g-ui-checkbox-size-md .g-ui-checkbox-checked { top:0px; left:0px; }
|
|
1049
1049
|
.g-ui-checkbox-size-md .g-ui-checkbox-checked svg { width: 24px; height: 24px; }
|
|
1050
|
-
.g-ui-checkbox-size-lg .g-ui-checkbox-checked { top:
|
|
1050
|
+
.g-ui-checkbox-size-lg .g-ui-checkbox-checked { top:1px; left:1px; }
|
|
1051
1051
|
.g-ui-checkbox-size-lg .g-ui-checkbox-checked svg { width: 28px; height: 28px; }
|
|
1052
|
-
.g-ui-checkbox-size-xl .g-ui-checkbox-checked { top:
|
|
1052
|
+
.g-ui-checkbox-size-xl .g-ui-checkbox-checked { top:2px; left:3px; }
|
|
1053
1053
|
.g-ui-checkbox-size-xl .g-ui-checkbox-checked svg { width: 32px; height: 32px; }
|
|
1054
1054
|
|
|
1055
1055
|
.g-ui-switch {
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { cx } from "./utils.js";
|
|
2
1
|
export { Button } from "./components/Button.js";
|
|
3
2
|
export { Text } from "./components/Text.js";
|
|
4
3
|
export { Title } from "./components/Title.js";
|
|
@@ -91,3 +90,4 @@ export { BottomBar } from "./components/BottomBar.js";
|
|
|
91
90
|
export { EventCalendar } from "./components/EventCalendar.js";
|
|
92
91
|
export { useDisclosure } from "./hooks/useDisclosure.js";
|
|
93
92
|
export { setThemeVars, setThemeMode } from "./theme/theme.js";
|
|
93
|
+
export { cx, classVar, classFlag, classMap, splitPropsChildren } from "./utils.js";
|