react-ui89 0.15.0 → 0.16.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.
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ export interface TimeAnimationPropsChildrenProps {
3
+ now: Date;
4
+ }
5
+ export interface TimeAnimationProps {
6
+ children: (props: TimeAnimationPropsChildrenProps) => React.ReactNode;
7
+ }
8
+ export declare const TimeAnimation: React.FC<TimeAnimationProps>;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { TimeAnimation } from "./TimeAnimation";
3
+ declare const meta: Meta<typeof TimeAnimation>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Updates: Story;
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare function Ui89DigitalTimeClock(): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Ui89DigitalTimeClock } from "./Ui89DigitalTimeClock";
3
+ declare const meta: Meta<typeof Ui89DigitalTimeClock>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Time: Story;
@@ -0,0 +1,9 @@
1
+ export interface DateComponents {
2
+ hours: number;
3
+ minutes: number;
4
+ seconds: number;
5
+ milliseconds: number;
6
+ day: number;
7
+ month: number;
8
+ year: number;
9
+ }
@@ -4,6 +4,7 @@ export type { Ui89BreadcrumbsProps, Ui89BreadcrumbsPropsItem, Ui89BreadcrumbsPro
4
4
  export { Ui89Breadcrumbs } from "./components/Ui89Breadcrumbs";
5
5
  export { Ui89Button } from "./components/Ui89Button";
6
6
  export { Ui89Card } from "./components/Ui89Card";
7
+ export { Ui89DigitalTimeClock } from "./components/Ui89DigitalTimeClock";
7
8
  export { Ui89HighlightText } from "./components/Ui89HighlightText";
8
9
  export { Ui89InputText } from "./components/Ui89InputText";
9
10
  export { Ui89InputTextNumber } from "./components/Ui89InputTextNumber";
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { createContext, useContext, useState, useRef, useMemo, useEffect, forwardRef } from 'react';
2
+ import React__default, { createContext, useContext, useState, useEffect, useRef, useMemo, forwardRef } from 'react';
3
3
  import Timeout from 'smart-timeout';
4
4
  import { VariableSizeGrid } from 'react-window';
5
5
  import AutoSizer from 'react-virtualized-auto-sizer';
@@ -159,6 +159,39 @@ function Ui89Card({ topLeftCenter, topCenter, children, }) {
159
159
  hasTopContent && React__default.createElement("div", { className: "space-vertical-1" }))));
160
160
  }
161
161
 
162
+ const TimeAnimation = ({ children }) => {
163
+ const [currentTime, setCurrentTime] = useState(new Date());
164
+ useEffect(() => {
165
+ const tick = () => {
166
+ const now = new Date();
167
+ setCurrentTime(now);
168
+ // Calculate time until the next exact second
169
+ const msUntilNextSecond = 1000 - now.getMilliseconds();
170
+ setTimeout(tick, msUntilNextSecond);
171
+ };
172
+ // Start the first tick
173
+ const msUntilNextSecond = 1000 - currentTime.getMilliseconds();
174
+ const timeoutId = setTimeout(tick, msUntilNextSecond);
175
+ return () => clearTimeout(timeoutId);
176
+ }, []);
177
+ return React__default.createElement(React__default.Fragment, null, children({ now: currentTime }));
178
+ };
179
+
180
+ function Ui89DigitalTimeClock() {
181
+ const withColon = useRef(false);
182
+ function render({ now }) {
183
+ withColon.current = !withColon.current;
184
+ const separator = withColon.current ? ":" : " ";
185
+ return (now.getHours().toString().padStart(2, "0") +
186
+ separator +
187
+ now.getMinutes().toString().padStart(2, "0") +
188
+ separator +
189
+ now.getSeconds().toString().padStart(2, "0"));
190
+ }
191
+ return (React__default.createElement("span", { className: `${typoStyles.special}` },
192
+ React__default.createElement(TimeAnimation, null, render)));
193
+ }
194
+
162
195
  var style$1 = {"container":"Ui89HighlightText-module_container__gap-L","container--block":"Ui89HighlightText-module_container--block__BDJUL"};
163
196
 
164
197
  function Ui89HighlightText({ theme, block, children, }) {
@@ -31470,5 +31503,5 @@ function Ui89VirtualTable(props) {
31470
31503
  React__default.createElement(Ui89TagBox, { theme: "warn" }, "Empty")))));
31471
31504
  }
31472
31505
 
31473
- export { Ui89Breadcrumbs, Ui89Button, Ui89Card, Ui89HighlightText, Ui89InputText, Ui89InputTextNumber, Ui89Look, Ui89MenuBar, Ui89ModalDialog, Ui89OverrideProvider, Ui89Scene, Ui89Shortcut, Ui89SpaceVertical, Ui89TabbedCard, Ui89Tabs, Ui89TagBox, Ui89Theme, Ui89ThemeBackground, Ui89TitleBox, Ui89TitleUnderline, Ui89VirtualTable };
31506
+ export { Ui89Breadcrumbs, Ui89Button, Ui89Card, Ui89DigitalTimeClock, Ui89HighlightText, Ui89InputText, Ui89InputTextNumber, Ui89Look, Ui89MenuBar, Ui89ModalDialog, Ui89OverrideProvider, Ui89Scene, Ui89Shortcut, Ui89SpaceVertical, Ui89TabbedCard, Ui89Tabs, Ui89TagBox, Ui89Theme, Ui89ThemeBackground, Ui89TitleBox, Ui89TitleUnderline, Ui89VirtualTable };
31474
31507
  //# sourceMappingURL=index.js.map