@tempots/ui 0.2.0 → 0.4.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.
Files changed (64) hide show
  1. package/README.md +3 -1
  2. package/package.json +39 -37
  3. package/components/Box/Box.d.ts +0 -8
  4. package/components/Box/Box.js +0 -8
  5. package/components/Button/Button.d.ts +0 -12
  6. package/components/Button/Button.js +0 -19
  7. package/components/Control/Control.d.ts +0 -8
  8. package/components/Control/Control.js +0 -16
  9. package/components/Field/Field.d.ts +0 -11
  10. package/components/Field/Field.js +0 -37
  11. package/components/Field/field-layout.d.ts +0 -1
  12. package/components/Field/field-layout.js +0 -1
  13. package/components/Fieldset/Fieldset.d.ts +0 -8
  14. package/components/Fieldset/Fieldset.js +0 -12
  15. package/components/Fieldset/fieldset-context.d.ts +0 -7
  16. package/components/Fieldset/fieldset-context.js +0 -3
  17. package/components/Group/Group.d.ts +0 -13
  18. package/components/Group/Group.js +0 -28
  19. package/components/Input/BaseInput.d.ts +0 -10
  20. package/components/Input/BaseInput.js +0 -17
  21. package/components/Input/FloatInput.d.ts +0 -10
  22. package/components/Input/FloatInput.js +0 -14
  23. package/components/Input/IntInput.d.ts +0 -9
  24. package/components/Input/IntInput.js +0 -25
  25. package/components/Input/NativeSelect.d.ts +0 -11
  26. package/components/Input/NativeSelect.js +0 -27
  27. package/components/Input/TextInput.d.ts +0 -7
  28. package/components/Input/TextInput.js +0 -9
  29. package/components/Input/UnitInput.d.ts +0 -10
  30. package/components/Input/UnitInput.js +0 -14
  31. package/components/Popover/Popover.d.ts +0 -9
  32. package/components/Popover/Popover.js +0 -35
  33. package/components/Popover/UnstyledPopover.d.ts +0 -19
  34. package/components/Popover/UnstyledPopover.js +0 -97
  35. package/components/Popover/index.d.ts +0 -2
  36. package/components/Popover/index.js +0 -2
  37. package/components/SegmentedControl/SegmentedControl.d.ts +0 -9
  38. package/components/SegmentedControl/SegmentedControl.js +0 -16
  39. package/components/Stack/Stack.d.ts +0 -11
  40. package/components/Stack/Stack.js +0 -18
  41. package/components/StyleProvider/StyleProvider.d.ts +0 -41
  42. package/components/StyleProvider/StyleProvider.js +0 -106
  43. package/components/Tooltip/index.d.ts +0 -5
  44. package/components/Tooltip/index.js +0 -31
  45. package/components/styling/Sizing.d.ts +0 -10
  46. package/components/styling/Sizing.js +0 -5
  47. package/components/styling/Spacing.d.ts +0 -28
  48. package/components/styling/Spacing.js +0 -49
  49. package/components/styling/Sx.d.ts +0 -6
  50. package/components/styling/Sx.js +0 -6
  51. package/index.d.ts +0 -24
  52. package/index.js +0 -20
  53. package/styles/color.d.ts +0 -1
  54. package/styles/color.js +0 -1
  55. package/styles/reset.d.ts +0 -1
  56. package/styles/reset.js +0 -283
  57. package/styles/side.d.ts +0 -1
  58. package/styles/side.js +0 -1
  59. package/styles/size.d.ts +0 -5
  60. package/styles/size.js +0 -44
  61. package/styles/sx.d.ts +0 -9
  62. package/styles/sx.js +0 -28
  63. package/styles/ui-styles.d.ts +0 -67
  64. package/styles/ui-styles.js +0 -118
@@ -1,97 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@tempots/dom/jsx-runtime";
2
- import { Lifecycle, Signal, Prop, FadeIn, FadeOut, When } from '@tempots/dom';
3
- import { computePosition, flip, shift, offset, arrow } from '@floating-ui/dom';
4
- import { Sx } from '../styling/Sx';
5
- export function onTargetOverMount(el, open, close) {
6
- el.addEventListener('mouseenter', open);
7
- el.addEventListener('mouseleave', close);
8
- el.addEventListener('focus', open);
9
- el.addEventListener('blur', close);
10
- return () => {
11
- el.removeEventListener('mouseenter', open);
12
- el.removeEventListener('mouseleave', close);
13
- el.removeEventListener('focus', open);
14
- el.removeEventListener('blur', close);
15
- };
16
- }
17
- export function onTargetClickMount(el, open, close) {
18
- el.addEventListener('click', open);
19
- function clickOutside(e) {
20
- if (!el.contains(e.target)) {
21
- close();
22
- }
23
- }
24
- document.addEventListener('click', clickOutside);
25
- return () => {
26
- el.removeEventListener('click', open);
27
- document.removeEventListener('click', clickOutside);
28
- };
29
- }
30
- export function UnstyledPopover({ children, placement: maybePlacement, shiftPadding: maybeShiftPadding, offset: maybeOffset, arrow: maybeArrow, arrowOver, arrowPadding: maybeArrowPadding, onTargetMount, opened: passedOpened }) {
31
- let target = null;
32
- let dropdown = null;
33
- let arrowElement = null;
34
- const placement = maybePlacement ?? Signal.of('bottom');
35
- const shiftPadding = maybeShiftPadding ?? Signal.of(5);
36
- const offsetValue = maybeOffset ?? Signal.of(5);
37
- const arrowPadding = maybeArrowPadding ?? Signal.of(0);
38
- const opened = passedOpened ?? Prop.of(false);
39
- const placementTop = Prop.of(false);
40
- function open() { opened.set(true); }
41
- function close() { opened.set(false); }
42
- function execute() {
43
- if ((target == null) || (dropdown == null))
44
- return;
45
- const middleware = [];
46
- if (maybeArrow == null) {
47
- middleware.push(flip());
48
- }
49
- middleware.push(shift({ padding: shiftPadding.get() }), offset(offsetValue.get()));
50
- if (arrowElement != null) {
51
- middleware.push(arrow({
52
- element: arrowElement,
53
- padding: arrowPadding.get()
54
- }));
55
- }
56
- computePosition(target, dropdown, {
57
- placement: placement.get(),
58
- middleware
59
- }).then(({ x, y, middlewareData, placement }) => {
60
- if (dropdown == null)
61
- return;
62
- placementTop.set(placement.includes('top'));
63
- dropdown.style.top = `${String(y)}px`;
64
- dropdown.style.left = `${String(x)}px`;
65
- if (arrowElement != null && middlewareData.arrow != null) {
66
- const { x, y } = middlewareData.arrow;
67
- arrowElement.style.top = y != null ? `${String(y)}px` : '';
68
- arrowElement.style.left = x != null ? `${String(x)}px` : '';
69
- }
70
- });
71
- }
72
- let unmountTarget;
73
- function onMountTarget(element) {
74
- target = element;
75
- unmountTarget = onTargetMount?.(element, open, close);
76
- }
77
- function onUnmountTarget() {
78
- target = null;
79
- unmountTarget?.();
80
- }
81
- function onMountArrow(element) {
82
- arrowElement = element;
83
- }
84
- function onUnmountArrow() {
85
- arrowElement = null;
86
- }
87
- function onMountDropdown(element) {
88
- dropdown = element;
89
- window.addEventListener('resize', execute);
90
- execute();
91
- }
92
- function onUnmountDropdown() {
93
- dropdown = null;
94
- window.removeEventListener('resize', execute);
95
- }
96
- return (_jsxs(_Fragment, { children: [_jsx(When, { is: opened, children: _jsxs("div", { children: [_jsx(FadeIn, { start: { opacity: 0, translateY: 12 }, opacity: 1, translateY: 0, duration: 250 }), _jsx(FadeOut, { opacity: 0, translateY: 12, duration: 250 }), _jsx(Sx, { sx: { position: 'absolute' } }), _jsx(When, { is: placementTop.map(v => !v && maybeArrow != null), children: _jsxs("div", { children: [_jsx(Sx, { sx: { position: 'absolute', zIndex: (arrowOver ?? false) ? 1 : 0 } }), _jsx(Lifecycle, { onMount: onMountArrow, onUnmount: onUnmountArrow }), maybeArrow] }) }), _jsxs("div", { children: [_jsx(Sx, { sx: { zIndex: (arrowOver ?? false) ? 0 : 1, position: 'relative' } }), children] }), _jsx(When, { is: placementTop.map(v => v && maybeArrow != null), children: _jsxs("div", { children: [_jsx(Sx, { sx: { position: 'absolute', zIndex: (arrowOver ?? false) ? 1 : 0 } }), _jsx(Lifecycle, { onMount: onMountArrow, onUnmount: onUnmountArrow }), maybeArrow] }) }), _jsx(Lifecycle, { onMount: onMountDropdown, onUnmount: onUnmountDropdown })] }) }), _jsx(Lifecycle, { onMount: onMountTarget, onUnmount: onUnmountTarget })] }));
97
- }
@@ -1,2 +0,0 @@
1
- export { UnstyledPopover, type Placement, type UnstyledPopoverProps } from './UnstyledPopover';
2
- export { Popover, type PopoverProps, type OpenStrategy } from './Popover';
@@ -1,2 +0,0 @@
1
- export { UnstyledPopover } from './UnstyledPopover';
2
- export { Popover } from './Popover';
@@ -1,9 +0,0 @@
1
- import { type JSX, type Signal } from '@tempots/dom';
2
- export interface SegmentedControlProps<T> {
3
- options: Signal<T[]>;
4
- value: Signal<T>;
5
- onChange?: (value: T) => void;
6
- display?: (value: T) => JSX.DOMNode;
7
- equality?: (a: T, b: T) => boolean;
8
- }
9
- export declare function SegmentedControl<T>(props: SegmentedControlProps<T>): JSX.DOMNode;
@@ -1,16 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@tempots/dom/jsx-runtime";
2
- import { For } from '@tempots/dom';
3
- import { strictEqual } from '@tempots/std/equals';
4
- import { Box } from '../Box/Box';
5
- import { Control } from '../Control/Control';
6
- import { Sx } from '../styling/Sx';
7
- function Segment({ value, display, selected, onChange }) {
8
- return (_jsx(Box, { children: _jsxs("button", { onClick: () => { onChange(value.get()); }, disabled: selected, children: [_jsx(Sx, { sx: { display: 'inline', fontWeight: selected.map(v => v ? 'bold' : 'normal') } }), value.map(display)] }) }));
9
- }
10
- export function SegmentedControl(props) {
11
- const options = props.options;
12
- const equality = props.equality ?? strictEqual;
13
- // eslint-disable-next-line @typescript-eslint/no-empty-function
14
- const onChange = props.onChange ?? (() => { });
15
- return (_jsx(Control, { children: _jsx(For, { of: options, children: (option) => _jsx(Segment, { value: option, display: props.display ?? String, selected: option.combine(props.value, equality), onChange: onChange }) }) }));
16
- }
@@ -1,11 +0,0 @@
1
- import { type JSX, Signal } from '@tempots/dom';
2
- import { type Size } from '../../styles/size';
3
- export type AlignItems = 'flex-start' | 'flex-end' | 'center' | 'start' | 'end' | 'self-start' | 'self-end' | 'baseline' | 'stretch' | 'safe' | 'unsafe';
4
- export type JustifyContent = 'center' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'left' | 'right' | 'normal' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch' | 'safe center' | 'unsafe center' | 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset';
5
- export interface StackProps {
6
- align?: Signal<AlignItems>;
7
- justify?: Signal<JustifyContent>;
8
- spacing?: Signal<number> | Signal<Size>;
9
- children?: JSX.DOMNode;
10
- }
11
- export declare const Stack: (props: StackProps) => JSX.DOMNode;
@@ -1,18 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@tempots/dom/jsx-runtime";
2
- import { Signal } from '@tempots/dom';
3
- import { StyleConsumer } from '../StyleProvider/StyleProvider';
4
- import { Sx } from '../styling/Sx';
5
- export const Stack = (props) => {
6
- const { children, align, justify, spacing } = props;
7
- return (_jsx(StyleConsumer, { children: ({ styles }) => {
8
- return (_jsxs("div", { children: [_jsx(Sx, { sx: {
9
- display: 'flex',
10
- flexDirection: 'column',
11
- alignItems: align ?? Signal.of('normal'),
12
- justifyContent: justify,
13
- gap: (spacing ?? Signal.of('md')).combine(styles, (sp, st) => {
14
- return (typeof sp === 'number' ? sp : st.styles.spacing[sp]);
15
- })
16
- } }), children] }));
17
- } }));
18
- };
@@ -1,41 +0,0 @@
1
- import { type JSX, Prop, type Signal } from '@tempots/dom';
2
- import { type Size } from '../../styles/size';
3
- import { type UIStyles } from '../../styles/ui-styles';
4
- export interface Styles {
5
- components: UIComponentStyles;
6
- styles: UIStyles;
7
- }
8
- export interface UITheme {
9
- styles: Signal<Styles>;
10
- isLight: Prop<boolean>;
11
- }
12
- export interface StyleProviderProps {
13
- children?: JSX.Element;
14
- }
15
- export declare const StyleMarker: symbol;
16
- export declare const StyleProvider: ({ children }: StyleProviderProps) => JSX.DOMNode;
17
- export interface StyleConsumerProps {
18
- children?: (theme: UITheme) => JSX.DOMNode;
19
- }
20
- export declare function StyleConsumer({ children }: StyleConsumerProps): JSX.DOMNode;
21
- export type ComponentClasses<T> = (options: T) => string;
22
- export interface UIComponentStyles {
23
- button: {
24
- root: ComponentClasses<ButtonStyles>;
25
- content: ComponentClasses<ButtonStyles>;
26
- };
27
- control: {
28
- root: ComponentClasses<ControlStyles>;
29
- };
30
- }
31
- export type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'danger';
32
- export interface ButtonStyles {
33
- size: Size | number;
34
- compact: boolean;
35
- variant: ButtonVariant;
36
- }
37
- export interface ControlStyles {
38
- size: Size;
39
- spacing: Size;
40
- }
41
- export declare const defaultComponentStyle: ({ font, border, spacing, background, control }: UIStyles) => UIComponentStyles;
@@ -1,106 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@tempots/dom/jsx-runtime";
2
- import { css } from '@emotion/css';
3
- import { Portal, Prop, OnRemove, Provider, makeProviderMark, When, Consumer } from '@tempots/dom';
4
- import { resetCss } from '../../styles/reset';
5
- import { getRadiusSize, getSize } from '../../styles/size';
6
- import { defaultDarkStyles, defaultLightStyles } from '../../styles/ui-styles';
7
- import { Sx } from '../styling/Sx';
8
- export const StyleMarker = makeProviderMark();
9
- const counter = Prop.of(0);
10
- export const StyleProvider = ({ children }) => {
11
- const isLight = Prop.of(true);
12
- const styles = isLight.map(v => {
13
- if (v) {
14
- return {
15
- components: defaultComponentStyle(defaultLightStyles),
16
- styles: defaultLightStyles
17
- };
18
- }
19
- else {
20
- return {
21
- components: defaultComponentStyle(defaultDarkStyles),
22
- styles: defaultDarkStyles
23
- };
24
- }
25
- });
26
- counter.update(v => v + 1);
27
- return (_jsxs(Provider, { value: { styles, isLight }, mark: StyleMarker, children: [_jsx(Sx, { sx: { backgroundColor: styles.map(v => v.styles.background.color) } }), _jsx(When, { is: counter.map(v => v > 0), children: _jsx(Portal, { selector: "head", children: _jsx("style", { children: resetCss }) }) }), children, _jsx(OnRemove, { clear: () => { counter.update(v => v - 1); } })] }));
28
- };
29
- export function StyleConsumer({ children }) {
30
- return _jsx(Consumer, { mark: StyleMarker, children: children });
31
- }
32
- export const defaultComponentStyle = ({ font, border, spacing, background, control }) => {
33
- return {
34
- button: {
35
- root: ({ size, variant, compact }) => {
36
- const obj = {
37
- alignContent: 'center',
38
- display: 'inline-flex',
39
- alignItems: 'center',
40
- fontWeight: 500,
41
- fontSize: getSize(size, 'md', font.size),
42
- borderRadius: getRadiusSize('md', 'sm', border.radius),
43
- border: `1px solid ${control.borderColor}`,
44
- backgroundColor: background.color,
45
- color: font.color,
46
- padding: `0 ${spacing.md / (compact ? 2 : 1)}px`,
47
- textShadow: control.accentTextShadow,
48
- boxShadow: control.shadow,
49
- // minWidth: getSize(size, 'md', control.height),
50
- height: getSize(size, 'md', control.height),
51
- cursor: 'pointer',
52
- fontFamily: font.family.control
53
- };
54
- obj[':hover:not([disabled])'] = {
55
- backgroundColor: background.inverseColor,
56
- color: font.inverseColor
57
- };
58
- obj[':focus'] = {
59
- outline: `2px solid ${control.focusColor}`,
60
- outlineOffset: 0.5
61
- };
62
- obj[':active:not([disabled])'] = {
63
- transform: 'translateY(2px)'
64
- };
65
- obj[':disabled'] = {
66
- cursor: 'not-allowed',
67
- backgroundColor: background.mutedColor,
68
- color: font.mutedColor
69
- };
70
- return css(obj);
71
- },
72
- content: ({ size, variant, compact }) => {
73
- return css({
74
- minWidth: '1.25em',
75
- margin: '0 auto'
76
- });
77
- }
78
- },
79
- control: {
80
- root: ({ size, spacing: sp }) => {
81
- const obj = {
82
- display: 'inline-flex',
83
- alignItems: 'center',
84
- flexDirection: 'row',
85
- gap: getSize(sp, 'md', spacing),
86
- overflow: 'hidden',
87
- lineHeight: getSize(size, 'md', control.height),
88
- height: getSize(size, 'md', control.height),
89
- fontWeight: 500,
90
- padding: '0 2px',
91
- fontSize: getSize(size, 'md', font.size),
92
- fontFamily: font.family.control,
93
- borderRadius: getRadiusSize('md', 'sm', border.radius),
94
- border: `1px solid ${control.borderColor}`,
95
- backgroundColor: background.color,
96
- color: font.color,
97
- ':focus-within': {
98
- outline: `2px solid ${control.focusColor}`,
99
- outlineOffset: 0.5
100
- }
101
- };
102
- return css(obj);
103
- }
104
- }
105
- };
106
- };
@@ -1,5 +0,0 @@
1
- import { type JSX } from '@tempots/dom';
2
- export interface TooltipProps {
3
- children?: JSX.DOMNode;
4
- }
5
- export declare function Tooltip({ children }: TooltipProps): JSX.DOMNode;
@@ -1,31 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@tempots/dom/jsx-runtime";
2
- import { Signal, Attribute } from '@tempots/dom';
3
- import { UnstyledPopover } from '../Popover';
4
- import { onTargetOverMount } from '../Popover/UnstyledPopover';
5
- import { StyleConsumer } from '../StyleProvider/StyleProvider';
6
- import { Sx } from '../styling/Sx';
7
- const ARROW_SIZE = 8;
8
- export function Tooltip({ children }) {
9
- return (_jsx(_Fragment, { children: _jsx(StyleConsumer, { children: ({ styles }) => {
10
- const at = styles.at('styles').at;
11
- return (_jsxs(UnstyledPopover, { onTargetMount: onTargetOverMount, placement: Signal.of('top'), arrow: _jsx("div", { children: _jsx(Sx, { sx: {
12
- backgroundColor: at('background').at('inverseColor'),
13
- boxShadow: at('shadow').at('md'),
14
- marginTop: -ARROW_SIZE / 2,
15
- transform: 'rotate(45deg)',
16
- width: ARROW_SIZE,
17
- height: ARROW_SIZE
18
- } }) }), children: [_jsx(Attribute, { name: "role", value: Signal.of('tooltip') }), _jsx(Sx, { sx: {
19
- maxWidth: '200px',
20
- height: 'auto',
21
- lineHeight: '1em',
22
- textAlign: 'center',
23
- whiteSpace: 'normal',
24
- backgroundColor: at('background').at('inverseColor'),
25
- color: at('font').at('inverseColor'),
26
- padding: at('spacing').map(v => `${v.xs}px ${v.md}px`),
27
- borderRadius: at('border').at('radius').at('sm'),
28
- boxShadow: at('shadow').at('md')
29
- } }), children] }));
30
- } }) }));
31
- }
@@ -1,10 +0,0 @@
1
- import { type JSX } from '@tempots/dom';
2
- export interface SizingProps {
3
- width?: JSX.VValue<string> | JSX.VValue<number>;
4
- height?: JSX.VValue<string> | JSX.VValue<number>;
5
- minWidth?: JSX.VValue<string> | JSX.VValue<number>;
6
- minHeight?: JSX.VValue<string> | JSX.VValue<number>;
7
- maxWidth?: JSX.VValue<string> | JSX.VValue<number>;
8
- maxHeight?: JSX.VValue<string> | JSX.VValue<number>;
9
- }
10
- export declare const Sizing: ({ width, height, maxHeight, maxWidth, minHeight, minWidth }: SizingProps) => JSX.DOMNode;
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx } from "@tempots/dom/jsx-runtime";
2
- import { Sx } from './Sx';
3
- export const Sizing = ({ width, height, maxHeight, maxWidth, minHeight, minWidth }) => {
4
- return _jsx(Sx, { sx: { width, height, maxHeight, maxWidth, minHeight, minWidth } }); // TODO any
5
- };
@@ -1,28 +0,0 @@
1
- import { type JSX } from '@tempots/dom';
2
- import { type Size } from '../../styles/size';
3
- export type Space = JSX.VValue<Size> | JSX.VValue<number>;
4
- export interface SpacingProps {
5
- m?: Space;
6
- mt?: Space;
7
- mr?: Space;
8
- mb?: Space;
9
- ml?: Space;
10
- mh?: Space;
11
- mv?: Space;
12
- ms?: Space;
13
- me?: Space;
14
- mis?: Space;
15
- mie?: Space;
16
- p?: Space;
17
- pt?: Space;
18
- pr?: Space;
19
- pb?: Space;
20
- pl?: Space;
21
- ph?: Space;
22
- pv?: Space;
23
- ps?: Space;
24
- pe?: Space;
25
- pis?: Space;
26
- pie?: Space;
27
- }
28
- export declare const Spacing: (props: SpacingProps) => JSX.DOMNode;
@@ -1,49 +0,0 @@
1
- import { jsx as _jsx } from "@tempots/dom/jsx-runtime";
2
- import { Signal, ClassName } from '@tempots/dom';
3
- import { getSizeOrNull } from '../../styles/size';
4
- import { objectOfPropertiesToSignalOfObject, sxToClassProp } from '../../styles/sx';
5
- import { StyleConsumer } from '../StyleProvider/StyleProvider';
6
- const map = {
7
- m: ['margin'],
8
- mt: ['marginTop'],
9
- mr: ['marginRight'],
10
- mb: ['marginBottom'],
11
- ml: ['marginLeft'],
12
- ms: ['marginBlockStart'],
13
- me: ['marginBlockEnd'],
14
- mis: ['marginInlineStart'],
15
- mie: ['marginInlineEnd'],
16
- p: ['padding'],
17
- pt: ['paddingTop'],
18
- pr: ['paddingRight'],
19
- pb: ['paddingBottom'],
20
- pl: ['paddingLeft'],
21
- ps: ['paddingBlockStart'],
22
- pe: ['paddingBlockEnd'],
23
- pis: ['paddingInlineStart'],
24
- pie: ['paddingInlineEnd'],
25
- mh: ['marginStart', 'marginEnd'],
26
- mv: ['marginTop', 'marginBottom'],
27
- ph: ['paddingStart', 'paddingEnd'],
28
- pv: ['paddingTop', 'paddingBottom']
29
- };
30
- export const Spacing = (props) => {
31
- return (_jsx(StyleConsumer, { children: (theme) => {
32
- const keys = Object.keys(props).filter(k => k !== 'children');
33
- if (keys.length === 0)
34
- return null;
35
- const sx = keys.reduce((acc, k) => {
36
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
- const s = Signal.wrap(props[k]).combine(theme.styles, (s, { styles: { spacing } }) => [s, spacing]);
38
- for (const kk of map[k]) {
39
- if (acc[kk] == null) {
40
- continue;
41
- }
42
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
- acc[kk] = s.map(([v, spacing]) => getSizeOrNull(v, spacing));
44
- }
45
- return acc;
46
- }, {});
47
- return _jsx(ClassName, { value: sxToClassProp(objectOfPropertiesToSignalOfObject(sx)) });
48
- } }));
49
- };
@@ -1,6 +0,0 @@
1
- import { type JSX } from '@tempots/dom';
2
- import { type SX } from '../../styles/sx';
3
- export interface SxProps {
4
- sx?: SX;
5
- }
6
- export declare const Sx: ({ sx }: SxProps) => JSX.DOMNode;
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx } from "@tempots/dom/jsx-runtime";
2
- import { ClassName } from '@tempots/dom';
3
- import { sxToClassProp } from '../../styles/sx';
4
- export const Sx = ({ sx }) => {
5
- return sx != null ? _jsx(ClassName, { value: sxToClassProp(sx) }) : null;
6
- };
package/index.d.ts DELETED
@@ -1,24 +0,0 @@
1
- export { Box, type BoxProps } from './components/Box/Box';
2
- export { Button, type ButtonProps } from './components/Button/Button';
3
- export { Control, type ControlProps } from './components/Control/Control';
4
- export { Sizing, type SizingProps } from './components/styling/Sizing';
5
- export { Spacing, type SpacingProps, type Space } from './components/styling/Spacing';
6
- export { Stack, type StackProps, type AlignItems, type JustifyContent } from './components/Stack/Stack';
7
- export { Group, type GroupProps, type Position } from './components/Group/Group';
8
- export { Sx, type SxProps as ElSxProps } from './components/styling/Sx';
9
- export { Field, type FieldProps } from './components/Field/Field';
10
- export type { FieldLayout } from './components/Field/field-layout';
11
- export { Fieldset, type FieldsetProps } from './components/Fieldset/Fieldset';
12
- export { FloatInput, type FloatInputProps, BaseFloatInput } from './components/Input/FloatInput';
13
- export { IntInput, type IntInputProps, BaseIntInput } from './components/Input/IntInput';
14
- export { SegmentedControl, type SegmentedControlProps } from './components/SegmentedControl/SegmentedControl';
15
- export { NativeSelect, type NativeSelectProps } from './components/Input/NativeSelect';
16
- export { Popover, type PopoverProps, type Placement, type OpenStrategy, UnstyledPopover, type UnstyledPopoverProps } from './components/Popover';
17
- export type { Side } from './styles/side';
18
- export type { Size } from './styles/size';
19
- export type { SX } from './styles/sx';
20
- export { TextInput, type TextInputProps, BaseTextInput } from './components/Input/TextInput';
21
- export { Tooltip, type TooltipProps } from './components/Tooltip';
22
- export { type UIStyles, defaultLightStyles as defaultStyles, type Heading } from './styles/ui-styles';
23
- export { UnitInput, type UnitInputProps } from './components/Input/UnitInput';
24
- export { StyleMarker, StyleProvider, type StyleProviderProps, type UITheme, type UIComponentStyles, defaultComponentStyle } from './components/StyleProvider/StyleProvider';
package/index.js DELETED
@@ -1,20 +0,0 @@
1
- export { Box } from './components/Box/Box';
2
- export { Button } from './components/Button/Button';
3
- export { Control } from './components/Control/Control';
4
- export { Sizing } from './components/styling/Sizing';
5
- export { Spacing } from './components/styling/Spacing';
6
- export { Stack } from './components/Stack/Stack';
7
- export { Group } from './components/Group/Group';
8
- export { Sx } from './components/styling/Sx';
9
- export { Field } from './components/Field/Field';
10
- export { Fieldset } from './components/Fieldset/Fieldset';
11
- export { FloatInput, BaseFloatInput } from './components/Input/FloatInput';
12
- export { IntInput, BaseIntInput } from './components/Input/IntInput';
13
- export { SegmentedControl } from './components/SegmentedControl/SegmentedControl';
14
- export { NativeSelect } from './components/Input/NativeSelect';
15
- export { Popover, UnstyledPopover } from './components/Popover';
16
- export { TextInput, BaseTextInput } from './components/Input/TextInput';
17
- export { Tooltip } from './components/Tooltip';
18
- export { defaultLightStyles as defaultStyles } from './styles/ui-styles';
19
- export { UnitInput } from './components/Input/UnitInput';
20
- export { StyleMarker, StyleProvider, defaultComponentStyle } from './components/StyleProvider/StyleProvider';
package/styles/color.d.ts DELETED
@@ -1 +0,0 @@
1
- export type Color = 'blue' | 'green' | 'red' | 'yellow' | 'orange' | 'purple' | 'pink' | 'gray' | 'black';
package/styles/color.js DELETED
@@ -1 +0,0 @@
1
- export {};
package/styles/reset.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const resetCss = "\n html {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n font-family: system-ui, sans-serif;\n -webkit-font-smoothing: antialiased;\n text-rendering: optimizeLegibility;\n -moz-osx-font-smoothing: grayscale;\n touch-action: manipulation;\n }\n\n body {\n position: relative;\n min-height: 100%;\n font-feature-settings: 'kern';\n }\n\n *,\n *::before,\n *::after {\n border-width: 0;\n border-style: solid;\n box-sizing: border-box;\n }\n\n main {\n display: block;\n }\n\n hr {\n border-top-width: 1px;\n box-sizing: content-box;\n height: 0;\n overflow: visible;\n }\n\n pre,\n code,\n kbd,\n samp {\n font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n font-size: 1em;\n }\n\n a {\n background-color: transparent;\n color: inherit;\n text-decoration: inherit;\n }\n\n abbr[title] {\n border-bottom: none;\n text-decoration: underline;\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n }\n\n b,\n strong {\n font-weight: bold;\n }\n\n small {\n font-size: 80%;\n }\n\n sub,\n sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n\n sub {\n bottom: -0.25em;\n }\n\n sup {\n top: -0.5em;\n }\n\n img {\n border-style: none;\n }\n\n button,\n input,\n optgroup,\n select,\n textarea {\n font-family: inherit;\n font-size: 100%;\n line-height: 1.15;\n margin: 0;\n }\n\n button,\n input {\n overflow: visible;\n }\n\n button,\n select {\n text-transform: none;\n }\n\n button::-moz-focus-inner,\n [type='button']::-moz-focus-inner,\n [type='reset']::-moz-focus-inner,\n [type='submit']::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n fieldset {\n padding: 0.35em 0.75em 0.625em;\n }\n\n legend {\n box-sizing: border-box;\n color: inherit;\n display: table;\n max-width: 100%;\n padding: 0;\n white-space: normal;\n }\n\n progress {\n vertical-align: baseline;\n }\n\n textarea {\n overflow: auto;\n }\n\n [type='checkbox'],\n [type='radio'] {\n box-sizing: border-box;\n padding: 0;\n }\n\n [type='number']::-webkit-inner-spin-button,\n [type='number']::-webkit-outer-spin-button {\n -webkit-appearance: none !important;\n }\n\n input[type='number'] {\n -moz-appearance: textfield;\n }\n\n [type='search'] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n }\n\n [type='search']::-webkit-search-decoration {\n -webkit-appearance: none !important;\n }\n\n ::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n }\n\n details {\n display: block;\n }\n\n summary {\n display: list-item;\n }\n\n template {\n display: none;\n }\n\n [hidden] {\n display: none !important;\n }\n\n body,\n blockquote,\n dl,\n dd,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n hr,\n figure,\n p,\n pre {\n margin: 0;\n }\n\n button {\n background: transparent;\n padding: 0;\n }\n\n fieldset {\n margin: 0;\n padding: 0;\n }\n\n ol,\n ul {\n margin: 0;\n padding: 0;\n }\n\n textarea {\n resize: vertical;\n }\n\n button,\n [role='button'] {\n cursor: pointer;\n }\n\n button::-moz-focus-inner {\n border: 0 !important;\n }\n\n table {\n border-collapse: collapse;\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n\n button,\n input,\n optgroup,\n select,\n textarea {\n padding: 0;\n line-height: inherit;\n color: inherit;\n }\n\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n }\n\n img,\n video {\n max-width: 100%;\n height: auto;\n }\n\n [data-js-focus-visible]\n :focus:not([data-focus-visible-added]):not([data-focus-visible-disabled]) {\n outline: none;\n box-shadow: none;\n }\n\n select::-ms-expand {\n display: none;\n }\n";