bianic-ui 2.3.0 → 2.3.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/dist/cjs/index.js CHANGED
@@ -4420,6 +4420,42 @@ function Window(_a) {
4420
4420
  React.createElement("div", { className: "bianic-window-content flex w-full flex-col items-start gap-[20px] px-[20px] pb-[20px] text-primary-black" }, rest.children)));
4421
4421
  }
4422
4422
 
4423
+ /**
4424
+ * getRelativeTime
4425
+ * Accepts a JavaScript Date and returns a human friendly relative time string.
4426
+ * Rules:
4427
+ * - < 1 minute: "just now"
4428
+ * - < 1 hour: "x minutes ago"
4429
+ * - < 1 day: "x hours ago"
4430
+ * - < 30 days: "x days ago"
4431
+ * - < 12 months: "x months ago" (uses 30-day months approximation)
4432
+ * - >= 1 year: "x years ago" (uses 365-day years approximation; floors to whole years,
4433
+ * so e.g. 1 year 11 months => "1 years ago" as requested)
4434
+ */
4435
+ function getRelativeTime(date) {
4436
+ var now = new Date();
4437
+ var diffMs = now.getTime() - date.getTime();
4438
+ // If date is in the future or exactly now, return "just now"
4439
+ if (diffMs <= 0)
4440
+ return 'just now';
4441
+ var minute = 60 * 1000;
4442
+ var hour = 60 * minute;
4443
+ var day = 24 * hour;
4444
+ var month = 30 * day; // approximate month as 30 days
4445
+ var year = 365 * day; // approximate year as 365 days
4446
+ if (diffMs < minute)
4447
+ return 'just now';
4448
+ if (diffMs < hour)
4449
+ return "".concat(Math.floor(diffMs / minute), " minutes ago");
4450
+ if (diffMs < day)
4451
+ return "".concat(Math.floor(diffMs / hour), " hours ago");
4452
+ if (diffMs < month)
4453
+ return "".concat(Math.floor(diffMs / day), " days ago");
4454
+ if (diffMs < year)
4455
+ return "".concat(Math.floor(diffMs / month), " months ago");
4456
+ return "".concat(Math.floor(diffMs / year), " years ago");
4457
+ }
4458
+
4423
4459
  exports.Accordions = Accordions;
4424
4460
  exports.Alert = Alert;
4425
4461
  exports.Avatar = Avatar;
@@ -4498,4 +4534,5 @@ exports.Toggle = Toggle;
4498
4534
  exports.Tooltip = Tooltip;
4499
4535
  exports.TreeItem = TreeItem;
4500
4536
  exports.Window = Window;
4537
+ exports.getRelativeTime = getRelativeTime;
4501
4538
  exports.useFileTree = useFileTree;
@@ -32,3 +32,4 @@ export { default as Tooltip } from './Tooltip';
32
32
  export { Display, P, Heading, Text, Link } from './Typography';
33
33
  export { Toaster } from './Toaster';
34
34
  export { default as Window } from './Window';
35
+ export { getRelativeTime } from '../utility';
@@ -0,0 +1 @@
1
+ export { getRelativeTime } from './public/words';
package/dist/esm/index.js CHANGED
@@ -4418,4 +4418,40 @@ function Window(_a) {
4418
4418
  React.createElement("div", { className: "bianic-window-content flex w-full flex-col items-start gap-[20px] px-[20px] pb-[20px] text-primary-black" }, rest.children)));
4419
4419
  }
4420
4420
 
4421
- export { Accordions, Alert, Avatar, AlertRoundedSquare as BCAlertRoundedSquare, CubeHeader as BCCubeHeader, Discrepancy as BCDiscrepancy, ExposedPort as BCExposedPort, FQAnalytical as BCFQAnalytical, FQGetaway as BCFQGetaway, FQModeler as BCFQModeler, FQOperation as BCFQOperation, FQWelldone as BCFQWelldone, Flowqount as BCFlowqount, Inlet as BCInlet, Legend as BCLegend, ModalBalance as BCModalBalance, Neutral as BCNeutral, Node as BCNode, Outlet as BCOutlet, Port as BCPort, SelectAllAdd as BCSelectAllAdd, SelectAllRemove as BCSelectAllRemove, Spinner$1 as BCSpinner, Stack as BCStack, VirtualPort as BCVirtualPort, Badge, Banner, Brand, Breadcrumb, Button, ButtonApp, Card, Checkbox, Color, ContextualButton, DatePicker, Display, Divider, DropdownContainer, DropdownItem, FileTree, FormGroup, FormGroupButton, FormGroupLabel, FormLabel, Heading, InfoPanel, Link, LiveSearch, MenuContainer, MenuItem, Modal, P, PaginationBar, PickerCalendar, Pills, Popover, ProgressBar, ProgressCircle, Radio, ResizeableDiv, SegmentButtonGroup, SegmentButtonItem, SelectInput, Slider, Spinner, Tab, TabMenu, TableCell, TagLabel, Text, TextArea, TextInput, Toaster, Toggle, Tooltip, TreeItem, Window, useFileTree };
4421
+ /**
4422
+ * getRelativeTime
4423
+ * Accepts a JavaScript Date and returns a human friendly relative time string.
4424
+ * Rules:
4425
+ * - < 1 minute: "just now"
4426
+ * - < 1 hour: "x minutes ago"
4427
+ * - < 1 day: "x hours ago"
4428
+ * - < 30 days: "x days ago"
4429
+ * - < 12 months: "x months ago" (uses 30-day months approximation)
4430
+ * - >= 1 year: "x years ago" (uses 365-day years approximation; floors to whole years,
4431
+ * so e.g. 1 year 11 months => "1 years ago" as requested)
4432
+ */
4433
+ function getRelativeTime(date) {
4434
+ var now = new Date();
4435
+ var diffMs = now.getTime() - date.getTime();
4436
+ // If date is in the future or exactly now, return "just now"
4437
+ if (diffMs <= 0)
4438
+ return 'just now';
4439
+ var minute = 60 * 1000;
4440
+ var hour = 60 * minute;
4441
+ var day = 24 * hour;
4442
+ var month = 30 * day; // approximate month as 30 days
4443
+ var year = 365 * day; // approximate year as 365 days
4444
+ if (diffMs < minute)
4445
+ return 'just now';
4446
+ if (diffMs < hour)
4447
+ return "".concat(Math.floor(diffMs / minute), " minutes ago");
4448
+ if (diffMs < day)
4449
+ return "".concat(Math.floor(diffMs / hour), " hours ago");
4450
+ if (diffMs < month)
4451
+ return "".concat(Math.floor(diffMs / day), " days ago");
4452
+ if (diffMs < year)
4453
+ return "".concat(Math.floor(diffMs / month), " months ago");
4454
+ return "".concat(Math.floor(diffMs / year), " years ago");
4455
+ }
4456
+
4457
+ export { Accordions, Alert, Avatar, AlertRoundedSquare as BCAlertRoundedSquare, CubeHeader as BCCubeHeader, Discrepancy as BCDiscrepancy, ExposedPort as BCExposedPort, FQAnalytical as BCFQAnalytical, FQGetaway as BCFQGetaway, FQModeler as BCFQModeler, FQOperation as BCFQOperation, FQWelldone as BCFQWelldone, Flowqount as BCFlowqount, Inlet as BCInlet, Legend as BCLegend, ModalBalance as BCModalBalance, Neutral as BCNeutral, Node as BCNode, Outlet as BCOutlet, Port as BCPort, SelectAllAdd as BCSelectAllAdd, SelectAllRemove as BCSelectAllRemove, Spinner$1 as BCSpinner, Stack as BCStack, VirtualPort as BCVirtualPort, Badge, Banner, Brand, Breadcrumb, Button, ButtonApp, Card, Checkbox, Color, ContextualButton, DatePicker, Display, Divider, DropdownContainer, DropdownItem, FileTree, FormGroup, FormGroupButton, FormGroupLabel, FormLabel, Heading, InfoPanel, Link, LiveSearch, MenuContainer, MenuItem, Modal, P, PaginationBar, PickerCalendar, Pills, Popover, ProgressBar, ProgressCircle, Radio, ResizeableDiv, SegmentButtonGroup, SegmentButtonItem, SelectInput, Slider, Spinner, Tab, TabMenu, TableCell, TagLabel, Text, TextArea, TextInput, Toaster, Toggle, Tooltip, TreeItem, Window, getRelativeTime, useFileTree };
@@ -32,3 +32,4 @@ export { default as Tooltip } from './Tooltip';
32
32
  export { Display, P, Heading, Text, Link } from './Typography';
33
33
  export { Toaster } from './Toaster';
34
34
  export { default as Window } from './Window';
35
+ export { getRelativeTime } from '../utility';
@@ -0,0 +1 @@
1
+ export { getRelativeTime } from './public/words';
package/dist/index.d.ts CHANGED
@@ -862,4 +862,18 @@ interface WindowProps extends ComponentPropsWithRef<'div'> {
862
862
  }
863
863
  declare function Window({ size, title, zIndex, onClose, ...rest }: WindowProps): React$1.JSX.Element;
864
864
 
865
- export { Accordions, Alert, Avatar, AlertRoundedSquare as BCAlertRoundedSquare, CubeHeader as BCCubeHeader, Discrepancy as BCDiscrepancy, ExposedPort as BCExposedPort, FQAnalytical as BCFQAnalytical, FQGetaway as BCFQGetaway, FQModeler as BCFQModeler, FQOperation as BCFQOperation, FQWelldone as BCFQWelldone, Flowqount as BCFlowqount, Inlet as BCInlet, Legend as BCLegend, ModalBalance as BCModalBalance, Neutral as BCNeutral, Node as BCNode, Outlet as BCOutlet, Port as BCPort, SelectAllAdd as BCSelectAllAdd, SelectAllRemove as BCSelectAllRemove, Spinner$1 as BCSpinner, Stack as BCStack, VirtualPort as BCVirtualPort, Badge, Banner, Brand, Breadcrumb, Button, ButtonApp, Card, Checkbox, Color, ContextualButton, DatePicker, Display, Divider, DropdownContainer, DropdownItem, FileTree, FormGroup, FormGroupButton, FormGroupLabel, FormLabel, Heading, InfoPanel, Link, LiveSearch, MenuContainer, MenuItem, Modal, P, PaginationBar, PickerCalendar, Pills, Popover, ProgressBar, ProgressCircle, Radio, ResizeableDiv, SegmentButtonGroup, SegmentButtonItem, SelectInput, Slider, Spinner, Tab, TabMenu, TableCell, TagLabel, Text, TextArea, TextInput, Toaster, Toggle, Tooltip, TreeItem, Window, useFileTree };
865
+ /**
866
+ * getRelativeTime
867
+ * Accepts a JavaScript Date and returns a human friendly relative time string.
868
+ * Rules:
869
+ * - < 1 minute: "just now"
870
+ * - < 1 hour: "x minutes ago"
871
+ * - < 1 day: "x hours ago"
872
+ * - < 30 days: "x days ago"
873
+ * - < 12 months: "x months ago" (uses 30-day months approximation)
874
+ * - >= 1 year: "x years ago" (uses 365-day years approximation; floors to whole years,
875
+ * so e.g. 1 year 11 months => "1 years ago" as requested)
876
+ */
877
+ declare function getRelativeTime(date: Date): string;
878
+
879
+ export { Accordions, Alert, Avatar, AlertRoundedSquare as BCAlertRoundedSquare, CubeHeader as BCCubeHeader, Discrepancy as BCDiscrepancy, ExposedPort as BCExposedPort, FQAnalytical as BCFQAnalytical, FQGetaway as BCFQGetaway, FQModeler as BCFQModeler, FQOperation as BCFQOperation, FQWelldone as BCFQWelldone, Flowqount as BCFlowqount, Inlet as BCInlet, Legend as BCLegend, ModalBalance as BCModalBalance, Neutral as BCNeutral, Node as BCNode, Outlet as BCOutlet, Port as BCPort, SelectAllAdd as BCSelectAllAdd, SelectAllRemove as BCSelectAllRemove, Spinner$1 as BCSpinner, Stack as BCStack, VirtualPort as BCVirtualPort, Badge, Banner, Brand, Breadcrumb, Button, ButtonApp, Card, Checkbox, Color, ContextualButton, DatePicker, Display, Divider, DropdownContainer, DropdownItem, FileTree, FormGroup, FormGroupButton, FormGroupLabel, FormLabel, Heading, InfoPanel, Link, LiveSearch, MenuContainer, MenuItem, Modal, P, PaginationBar, PickerCalendar, Pills, Popover, ProgressBar, ProgressCircle, Radio, ResizeableDiv, SegmentButtonGroup, SegmentButtonItem, SelectInput, Slider, Spinner, Tab, TabMenu, TableCell, TagLabel, Text, TextArea, TextInput, Toaster, Toggle, Tooltip, TreeItem, Window, getRelativeTime, useFileTree };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "@biaenergi:registry": "https://gitlab.com/api/v4/projects/50905269/packages/npm/"
5
5
  },
6
- "version": "2.3.0",
6
+ "version": "2.3.1",
7
7
  "description": "Design Language System develop by BIAENERGI",
8
8
  "repository": {
9
9
  "type": "git",