@plastic-js/tsumiki 0.1.43 → 0.1.45

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.
@@ -1,6 +1,6 @@
1
1
  import Portal_default from "./Portal.js";
2
2
  import { insert, jsx, mergeProps, setProp, template } from "@plastic-js/plastic/jsx-runtime";
3
- import { css } from "@emotion/css";
3
+ import { css, keyframes } from "@emotion/css";
4
4
  import { Either, createEffect, createSignal, mergeProps as mergeProps$1, onCleanup, splitProps } from "@plastic-js/plastic";
5
5
  //#region src/components/BottomSheet.jsx
6
6
  var _tmpl3 = template("<div data-part=\"grabber\"><div></div></div>");
@@ -45,7 +45,11 @@ var sheetClass = css({
45
45
  "&[data-open]": {
46
46
  transform: "translateY(0)",
47
47
  pointerEvents: "auto",
48
- transition: "transform var(--tsu-transition-overlay-enter)"
48
+ transition: "transform var(--tsu-transition-overlay-enter)",
49
+ animation: `${keyframes({
50
+ from: { transform: "translateY(100%)" },
51
+ to: { transform: "translateY(0)" }
52
+ })} var(--tsu-duration-overlay-enter) var(--tsu-ease-out)`
49
53
  },
50
54
  "&::after": {
51
55
  content: "\"\"",
@@ -57,7 +61,10 @@ var sheetClass = css({
57
61
  background: "var(--tsu-surface)"
58
62
  }
59
63
  });
60
- var draggingClass = css({ transition: "none" });
64
+ var draggingClass = css({
65
+ transition: "none",
66
+ animation: "none"
67
+ });
61
68
  var grabberAreaClass = css({
62
69
  display: "flex",
63
70
  alignItems: "center",
@@ -73,7 +73,6 @@ var variantClasses = {
73
73
  }
74
74
  }),
75
75
  outline: css({
76
- backgroundColor: "var(--tsu-bg)",
77
76
  borderColor: "var(--_btn-border)",
78
77
  color: "var(--tsu-fg)",
79
78
  "&:active:not(:disabled)": {
@@ -3,7 +3,7 @@ import Icon from "./Icon.js";
3
3
  import { expandCircular, makeWheel } from "./DateWheel.js";
4
4
  import { Fragment, insert, jsx, mergeProps, setProp, template } from "@plastic-js/plastic/jsx-runtime";
5
5
  import { css } from "@emotion/css";
6
- import { createEffect, createSignal, splitProps } from "@plastic-js/plastic";
6
+ import { createEffect, createSignal, mergeProps as mergeProps$1, splitProps } from "@plastic-js/plastic";
7
7
  //#region src/components/DateInput.jsx
8
8
  var _tmpl4 = template("<div></div>");
9
9
  var _tmpl3 = template("<div><div role=\"presentation\" aria-hidden=\"true\"></div><div role=\"dialog\" aria-label=\"Date picker\"><div><button type=\"button\">Cancel</button><span>Select Date</span><button type=\"button\">Done</button></div><div><div><div><span>Year</span><div><div></div><div></div></div></div><div><span>Month</span><div><div></div><div></div></div></div><div><span>Day</span><div><div></div><div></div></div></div></div></div></div></div>");
@@ -68,15 +68,11 @@ var triggerDisabledClass = css({
68
68
  opacity: .4,
69
69
  cursor: "not-allowed"
70
70
  });
71
- var triggerClass = css({
71
+ var triggerBaseClass = css({
72
72
  width: "100%",
73
- height: "var(--tsu-comp-height-md)",
74
- padding: "0 36px 0 var(--tsu-comp-padding-x-md)",
75
- background: "var(--tsu-surface)",
73
+ background: "transparent",
76
74
  border: "1px solid var(--tsu-accent-8)",
77
- borderRadius: "var(--tsu-radius-l1-md)",
78
75
  color: "var(--tsu-fg)",
79
- fontSize: "var(--tsu-comp-font-size-md)",
80
76
  fontFamily: "inherit",
81
77
  outline: "none",
82
78
  boxSizing: "border-box",
@@ -86,6 +82,38 @@ var triggerClass = css({
86
82
  transition: "border-color var(--tsu-transition-fast), background-color var(--tsu-transition-fast)",
87
83
  "&:hover:not(:disabled)": { borderColor: "var(--tsu-focus-border)" }
88
84
  });
85
+ var triggerSizeClasses = {
86
+ xs: css({
87
+ height: "var(--tsu-comp-height-xs)",
88
+ padding: "0 36px 0 var(--tsu-comp-padding-x-xs)",
89
+ fontSize: "var(--tsu-comp-font-size-xs)",
90
+ borderRadius: "var(--tsu-radius-l1-xs)"
91
+ }),
92
+ sm: css({
93
+ height: "var(--tsu-comp-height-sm)",
94
+ padding: "0 36px 0 var(--tsu-comp-padding-x-sm)",
95
+ fontSize: "var(--tsu-comp-font-size-sm)",
96
+ borderRadius: "var(--tsu-radius-l1-sm)"
97
+ }),
98
+ md: css({
99
+ height: "var(--tsu-comp-height-md)",
100
+ padding: "0 36px 0 var(--tsu-comp-padding-x-md)",
101
+ fontSize: "var(--tsu-comp-font-size-md)",
102
+ borderRadius: "var(--tsu-radius-l1-md)"
103
+ }),
104
+ lg: css({
105
+ height: "var(--tsu-comp-height-lg)",
106
+ padding: "0 36px 0 var(--tsu-comp-padding-x-lg)",
107
+ fontSize: "var(--tsu-comp-font-size-lg)",
108
+ borderRadius: "var(--tsu-radius-l1-lg)"
109
+ }),
110
+ xl: css({
111
+ height: "var(--tsu-comp-height-xl)",
112
+ padding: "0 36px 0 var(--tsu-comp-padding-x-xl)",
113
+ fontSize: "var(--tsu-comp-font-size-xl)",
114
+ borderRadius: "var(--tsu-radius-l1-xl)"
115
+ })
116
+ };
89
117
  var triggerPlaceholderClass = css({ color: "var(--tsu-neutral-11)" });
90
118
  var triggerValueClass = css({ color: "var(--tsu-fg)" });
91
119
  var calendarIconClass = css({
@@ -237,12 +265,17 @@ var mountWheel = (el, wheel) => {
237
265
  el._wheel = wheel;
238
266
  wheel.mount(el);
239
267
  };
268
+ var read = (v) => typeof v === "function" ? v() : v;
240
269
  var DateInput = (props = {}) => {
241
- const [local] = splitProps(props, [
270
+ const [local] = splitProps(mergeProps$1({
271
+ size: "md",
272
+ disabled: false
273
+ }, props), [
242
274
  "value",
243
275
  "onValueChange",
244
276
  "placeholder",
245
277
  "disabled",
278
+ "size",
246
279
  "className"
247
280
  ]);
248
281
  const open = createSignal(false);
@@ -298,7 +331,7 @@ var DateInput = (props = {}) => {
298
331
  return () => {
299
332
  const _el0 = _tmpl2.cloneNode(true);
300
333
  insert(_el0, () => displayDate ? formatDateLabel(displayDate) : local.placeholder || "Select date");
301
- setProp(_el0, "className", () => `${triggerClass} ${displayDate ? triggerValueClass : triggerPlaceholderClass}`);
334
+ setProp(_el0, "className", () => `${triggerBaseClass} ${triggerSizeClasses[read(local.size)]} ${displayDate ? triggerValueClass : triggerPlaceholderClass}`);
302
335
  return _el0;
303
336
  };
304
337
  }, _el1);
@@ -3,8 +3,8 @@ import Button from "./Button.js";
3
3
  import Icon from "./Icon.js";
4
4
  import { insert, jsx, mergeProps, setProp, template } from "@plastic-js/plastic/jsx-runtime";
5
5
  import { css, keyframes } from "@emotion/css";
6
- import { Dialog } from "@plastic-js/ark";
7
- import { mergeProps as mergeProps$2, splitProps } from "@plastic-js/plastic";
6
+ import { Dialog, useDialogContext } from "@plastic-js/ark";
7
+ import { Either, mergeProps as mergeProps$2, splitProps } from "@plastic-js/plastic";
8
8
  //#region src/components/Dialog.jsx
9
9
  var _tmpl4 = template("<div data-scope=\"dialog\" data-part=\"footer\"></div>");
10
10
  var _tmpl3 = template("<div data-scope=\"dialog\" data-part=\"body\"></div>");
@@ -156,6 +156,14 @@ var positiveBtnClass = css({
156
156
  });
157
157
  var read = (v) => typeof v === "function" ? v() : v;
158
158
  var warnedSheetNoTitle = false;
159
+ var DialogPortal = (props) => {
160
+ const dialog = useDialogContext();
161
+ return jsx(Either, mergeProps({
162
+ condition: () => !dialog()?.unmounted,
163
+ trueBranch: () => jsx(Portal_default, mergeProps({ children: () => props.children })),
164
+ falseBranch: () => null
165
+ }));
166
+ };
159
167
  var Dialog$1 = (props) => {
160
168
  const [local, rest] = splitProps(mergeProps$2({
161
169
  mode: "sheet",
@@ -273,7 +281,7 @@ var Dialog$1 = (props) => {
273
281
  return local.closeOnInteractOutside;
274
282
  },
275
283
  modal: true
276
- }, rest, { children: jsx(Portal_default, mergeProps({ children: [jsx(Dialog.Backdrop, mergeProps({ className: isSheet ? backdropSheetClass : backdropModalClass })), jsx(Dialog.Positioner, mergeProps({
284
+ }, rest, { children: jsx(DialogPortal, mergeProps({ children: [jsx(Dialog.Backdrop, mergeProps({ className: isSheet ? backdropSheetClass : backdropModalClass })), jsx(Dialog.Positioner, mergeProps({
277
285
  className: isSheet ? positionerSheetClass : positionerModalClass,
278
286
  children: jsx(Dialog.Content, mergeProps({
279
287
  get className() {
@@ -65,7 +65,6 @@ var variantClasses = {
65
65
  }
66
66
  }),
67
67
  outline: css({
68
- backgroundColor: "var(--tsu-bg)",
69
68
  border: "1px solid var(--tsu-accent-8)",
70
69
  color: "var(--tsu-fg)",
71
70
  "&:focus-within": {
@@ -71,7 +71,6 @@ var variantClasses = {
71
71
  }
72
72
  }),
73
73
  outline: css({
74
- backgroundColor: "var(--tsu-surface)",
75
74
  border: "1px solid var(--tsu-accent-8)",
76
75
  "&:active:not(:disabled)": {
77
76
  backgroundColor: "var(--tsu-accent-3)",
package/docs/api.md CHANGED
@@ -176,6 +176,7 @@ Mobile date picker built on the `DateWheel` utility.
176
176
  | `onValueChange` | `(value) => void` | — | Called with the new ISO date. |
177
177
  | `placeholder` | `string` | — | Placeholder text. |
178
178
  | `disabled` | `boolean` | `false` | Disabled. |
179
+ | `size` | `string` | `md` | See size values. |
179
180
  | `className` | `string` | — | Root class. |
180
181
 
181
182
  ### ColorPicker
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plastic-js/tsumiki",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
4
4
  "description": "A UI component library for Plastic JS.",
5
5
  "license": "MIT",
6
6
  "author": "tigre",
@@ -51,7 +51,9 @@
51
51
  "preview": "vite preview",
52
52
  "theme": "node scripts/theme.js",
53
53
  "e2e:repro": "node e2e/dlgcbx-repro.mjs",
54
- "e2e:bottomsheet": "node e2e/bottomsheet-presence-verify.mjs"
54
+ "e2e:bottomsheet": "node e2e/bottomsheet-presence-verify.mjs",
55
+ "e2e:dialog-portal": "node e2e/dialog-portal-verify.mjs",
56
+ "e2e:bottomsheet-animation": "node e2e/bottomsheet-animation-verify.mjs"
55
57
  },
56
58
  "dependencies": {
57
59
  "@emotion/css": "^11.13.5",