@dotss/tictoccroc 0.0.18 → 0.0.19

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,2 +1,2 @@
1
1
  import { DayFlag } from '../../typings/common';
2
- export default function dayFlagToDay(dayFlag?: DayFlag): 1 | 0 | 2 | 4 | 3 | 5 | 6 | null;
2
+ export default function dayFlagToDay(dayFlag?: DayFlag): 0 | 1 | 2 | 4 | 3 | 5 | 6 | null;
@@ -1,18 +1,17 @@
1
1
  import { jsxs as i, jsx as t, Fragment as m } from "react/jsx-runtime";
2
- import { useState as S, Children as O, isValidElement as F } from "react";
2
+ import { useState as S, Children as E, isValidElement as F } from "react";
3
3
  import { Flexbox as r, Typography as f, Tooltip as Y, Icon as p, Button as M } from "@dotss/ui";
4
4
  import T from "@dotss/ui/core/useTheme";
5
5
  import g from "dayjs";
6
6
  import W from "./CareerItem/CareerItem.mjs";
7
- import { sortItemElements as z } from "../../utils/sortItems/sortItems.mjs";
8
- function q({
7
+ function U({
9
8
  children: u,
10
9
  action: C,
11
10
  showTooltip: x = !1,
12
11
  enableToggle: s = !1,
13
12
  ...o
14
13
  }) {
15
- const { spacing: w } = T(), [b, I] = S(!1), [a, v] = S(!1), l = O.toArray(u).filter(F).filter((e) => e.type === W), D = l.length > 0, j = l.length > 3, y = l.map((e) => [e.props.startDate, e.props.endDate ?? g().format("YYYY-MM-DD")]).map(([e, n]) => [g(e), g(n)]).map(([e, n]) => n.diff(e, "month")), c = Math.floor(y.reduce((e, n) => e + n, 0) / 12), d = y.reduce((e, n) => e + n, 0) % 12, k = () => v((e) => !e), h = () => I((e) => !e), E = (e) => {
14
+ const { spacing: w } = T(), [b, I] = S(!1), [a, v] = S(!1), l = E.toArray(u).filter(F).filter((e) => e.type === W), D = l.length > 0, j = l.length > 3, y = l.map((e) => [e.props.startDate, e.props.endDate ?? g().format("YYYY-MM-DD")]).map(([e, n]) => [g(e), g(n)]).map(([e, n]) => n.diff(e, "month")), c = Math.floor(y.reduce((e, n) => e + n, 0) / 12), d = y.reduce((e, n) => e + n, 0) % 12, k = () => v((e) => !e), h = () => I((e) => !e), O = (e) => {
16
15
  (e.key === "Enter" || e.key === " ") && h();
17
16
  };
18
17
  return /* @__PURE__ */ i(
@@ -100,7 +99,7 @@ function q({
100
99
  size: "small",
101
100
  color: "grey.50",
102
101
  onClick: h,
103
- onKeyDown: E,
102
+ onKeyDown: O,
104
103
  "aria-label": "추가 정보 안내",
105
104
  inlineCSS: {
106
105
  cursor: "pointer"
@@ -134,7 +133,7 @@ function q({
134
133
  tag: "ul",
135
134
  flexDirection: "column",
136
135
  inlineCSS: { width: "inherit" },
137
- children: z(l).slice(0, !s || a ? void 0 : 3)
136
+ children: l.slice(0, !s || a ? void 0 : 3)
138
137
  }
139
138
  ),
140
139
  s && j && /* @__PURE__ */ t(
@@ -175,5 +174,5 @@ function q({
175
174
  );
176
175
  }
177
176
  export {
178
- q as default
177
+ U as default
179
178
  };
@@ -1,18 +1,17 @@
1
1
  import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
2
  import { useState as f, Children as I, isValidElement as v } from "react";
3
- import { Flexbox as i, Typography as m, Tooltip as j, Icon as s, Button as k } from "@dotss/ui";
3
+ import { Flexbox as i, Typography as h, Tooltip as j, Icon as s, Button as k } from "@dotss/ui";
4
4
  import D from "@dotss/ui/core/useTheme";
5
- import E from "./CertificateItem/CertificateItem.mjs";
6
- import { sortItemElements as O } from "../../utils/sortItems/sortItems.mjs";
7
- function K({
8
- children: h,
5
+ import O from "./CertificateItem/CertificateItem.mjs";
6
+ function A({
7
+ children: m,
9
8
  action: d,
10
9
  showTooltip: p = !1,
11
10
  enableToggle: r = !1,
12
11
  ...n
13
12
  }) {
14
- const { spacing: x } = D(), [y, C] = f(!1), [o, g] = f(!1), l = I.toArray(h).filter(v).filter((t) => t.type === E), u = l.length > 0, S = l.length > 3, c = () => C((t) => !t), b = (t) => {
15
- (t.key === "Enter" || t.key === " ") && c();
13
+ const { spacing: x } = D(), [y, C] = f(!1), [o, g] = f(!1), c = I.toArray(m).filter(v).filter((t) => t.type === O), u = c.length > 0, S = c.length > 3, l = () => C((t) => !t), b = (t) => {
14
+ (t.key === "Enter" || t.key === " ") && l();
16
15
  }, w = () => g((t) => !t);
17
16
  return /* @__PURE__ */ a(
18
17
  i,
@@ -30,7 +29,7 @@ function K({
30
29
  children: [
31
30
  /* @__PURE__ */ a(i, { alignItems: "center", justifyContent: "center", gap: 1, children: [
32
31
  /* @__PURE__ */ e(
33
- m,
32
+ h,
34
33
  {
35
34
  id: "certificate-section-title",
36
35
  tag: "h2",
@@ -43,13 +42,13 @@ function K({
43
42
  j,
44
43
  {
45
44
  open: y,
46
- onClose: c,
45
+ onClose: l,
47
46
  color: "secondary",
48
47
  role: "tooltip",
49
48
  "aria-labelledby": "certificate-section-tooltip",
50
49
  "aria-describedby": "certificate-section-tooltip-desc",
51
50
  body: /* @__PURE__ */ a(
52
- m,
51
+ h,
53
52
  {
54
53
  id: "certificate-section-tooltip-desc",
55
54
  tag: "p",
@@ -83,7 +82,7 @@ function K({
83
82
  name: "TooltipFill",
84
83
  size: "small",
85
84
  color: "grey.50",
86
- onClick: c,
85
+ onClick: l,
87
86
  onKeyDown: b,
88
87
  "aria-label": "추가 정보 안내",
89
88
  inlineCSS: {
@@ -101,10 +100,7 @@ function K({
101
100
  tag: "ul",
102
101
  flexDirection: "column",
103
102
  inlineCSS: { width: "inherit" },
104
- children: O(l).slice(
105
- 0,
106
- !r || o ? void 0 : 3
107
- )
103
+ children: c.slice(0, !r || o ? void 0 : 3)
108
104
  }
109
105
  ),
110
106
  r && S && /* @__PURE__ */ e(
@@ -145,5 +141,5 @@ function K({
145
141
  );
146
142
  }
147
143
  export {
148
- K as default
144
+ A as default
149
145
  };
@@ -4,7 +4,7 @@ import x from "@dotss/ui/core/useTheme";
4
4
  import y from "dayjs";
5
5
  import C from "../../../../../shared/components/Roller/RollerBlock/RollerBlock.mjs";
6
6
  import { getChildLabel as S } from "../ClassNotesSection.utils.mjs";
7
- function M({ content: h, keywords: t, regDatetime: s, childrenInfo: p, ...n }) {
7
+ function D({ content: h, keywords: t, regDatetime: s, childrenInfo: p, ...n }) {
8
8
  var c, m;
9
9
  const {
10
10
  palette: { grey: f, brand: i }
@@ -26,7 +26,7 @@ function M({ content: h, keywords: t, regDatetime: s, childrenInfo: p, ...n }) {
26
26
  /* @__PURE__ */ e(r, { tag: "p", variant: "b4R", color: "grey.70", lineClamp: 6, inlineCSS: { flexGrow: 1 }, children: h }),
27
27
  t.length > 0 && /* @__PURE__ */ e(g, { alignItems: "center", gap: 1, flexWrap: "wrap", children: t.map((d) => /* @__PURE__ */ e(u, { variant: "ghost", color: "yellow", size: "small", children: d }, `activity-keyword-${d}`)) }),
28
28
  /* @__PURE__ */ l(g, { alignItems: "center", justifyContent: "space-between", gap: 1, children: [
29
- /* @__PURE__ */ e(r, { tag: "p", variant: "b4R", color: "grey.70", children: b.format("YYYY년 MMDD일") }),
29
+ /* @__PURE__ */ e(r, { tag: "p", variant: "b4R", color: "grey.70", children: b.format("YYYY년 MD일") }),
30
30
  /* @__PURE__ */ l(
31
31
  r,
32
32
  {
@@ -50,5 +50,5 @@ function M({ content: h, keywords: t, regDatetime: s, childrenInfo: p, ...n }) {
50
50
  );
51
51
  }
52
52
  export {
53
- M as default
53
+ D as default
54
54
  };
@@ -1,18 +1,17 @@
1
1
  import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
- import { useState as m, Children as I, isValidElement as E } from "react";
3
- import { Flexbox as i, Typography as h, Tooltip as v, Icon as s, Button as j } from "@dotss/ui";
2
+ import { useState as h, Children as I, isValidElement as v } from "react";
3
+ import { Flexbox as i, Typography as m, Tooltip as E, Icon as s, Button as j } from "@dotss/ui";
4
4
  import k from "@dotss/ui/core/useTheme";
5
5
  import D from "./EducationItem/EducationItem.mjs";
6
- import { sortItemElements as O } from "../../utils/sortItems/sortItems.mjs";
7
- function L({
8
- children: f,
6
+ function B({
7
+ children: u,
9
8
  action: d,
10
- showTooltip: u = !1,
9
+ showTooltip: f = !1,
11
10
  enableToggle: l = !1,
12
11
  ...n
13
12
  }) {
14
- const { spacing: p } = k(), [x, y] = m(!1), [o, g] = m(!1), r = I.toArray(f).filter(E).filter((t) => t.type === D), C = r.length > 0, S = r.length > 3, a = () => y((t) => !t), b = (t) => {
15
- (t.key === "Enter" || t.key === " ") && a();
13
+ const { spacing: p } = k(), [x, y] = h(!1), [o, g] = h(!1), a = I.toArray(u).filter(v).filter((t) => t.type === D), C = a.length > 0, S = a.length > 3, r = () => y((t) => !t), b = (t) => {
14
+ (t.key === "Enter" || t.key === " ") && r();
16
15
  }, w = () => g((t) => !t);
17
16
  return /* @__PURE__ */ c(
18
17
  i,
@@ -30,7 +29,7 @@ function L({
30
29
  children: [
31
30
  /* @__PURE__ */ c(i, { alignItems: "center", justifyContent: "center", gap: 1, children: [
32
31
  /* @__PURE__ */ e(
33
- h,
32
+ m,
34
33
  {
35
34
  id: "education-section-title",
36
35
  tag: "h2",
@@ -39,17 +38,17 @@ function L({
39
38
  children: "학력"
40
39
  }
41
40
  ),
42
- u && /* @__PURE__ */ e(
43
- v,
41
+ f && /* @__PURE__ */ e(
42
+ E,
44
43
  {
45
44
  open: x,
46
- onClose: a,
45
+ onClose: r,
47
46
  color: "secondary",
48
47
  role: "tooltip",
49
48
  "aria-labelledby": "education-section-tooltip",
50
49
  "aria-describedby": "education-section-tooltip-desc",
51
50
  body: /* @__PURE__ */ c(
52
- h,
51
+ m,
53
52
  {
54
53
  id: "education-section-tooltip-desc",
55
54
  tag: "p",
@@ -83,7 +82,7 @@ function L({
83
82
  name: "TooltipFill",
84
83
  size: "small",
85
84
  color: "grey.50",
86
- onClick: a,
85
+ onClick: r,
87
86
  onKeyDown: b,
88
87
  "aria-label": "추가 정보 안내",
89
88
  inlineCSS: {
@@ -101,7 +100,7 @@ function L({
101
100
  tag: "ul",
102
101
  flexDirection: "column",
103
102
  inlineCSS: { width: "inherit" },
104
- children: O(r).slice(0, !l || o ? void 0 : 3)
103
+ children: a.slice(0, !l || o ? void 0 : 3)
105
104
  }
106
105
  ),
107
106
  l && S && /* @__PURE__ */ e(
@@ -142,5 +141,5 @@ function L({
142
141
  );
143
142
  }
144
143
  export {
145
- L as default
144
+ B as default
146
145
  };
@@ -1 +1 @@
1
- export { default as sortItems, sortItemElements } from './sortItems';
1
+ export { default as sortItems } from './sortItems';
@@ -1,5 +1,4 @@
1
- import { sortItemElements as s, default as m } from "./sortItems/sortItems.mjs";
1
+ import { default as o } from "./sortItems/sortItems.mjs";
2
2
  export {
3
- s as sortItemElements,
4
- m as sortItems
3
+ o as sortItems
5
4
  };
@@ -1,3 +1,2 @@
1
- import { default as sortItems, sortItemElements } from './sortItems';
2
- export { sortItemElements };
1
+ import { default as sortItems } from './sortItems';
3
2
  export default sortItems;
@@ -1,6 +1,4 @@
1
- import e from "./sortItems.mjs";
2
- import { sortItemElements as m } from "./sortItems.mjs";
1
+ import o from "./sortItems.mjs";
3
2
  export {
4
- e as default,
5
- m as sortItemElements
3
+ o as default
6
4
  };
@@ -1,9 +1,11 @@
1
- import { ReactElement } from 'react';
2
1
  type ItemProps = {
3
2
  status: 'VERIFIED' | 'PENDING' | 'REJECTED' | 'DELETED';
4
3
  regDatetime: string;
4
+ startDate?: string;
5
+ endDate?: string | null;
6
+ phase?: 'STUDYING' | 'ONBREAK' | 'FINISHED';
7
+ acqDate?: string;
5
8
  priority: number;
6
9
  };
7
10
  export default function sortItems<T>(items: T[], get?: (item: T) => ItemProps): T[];
8
- export declare function sortItemElements<T extends ReactElement<ItemProps>>(items: T[]): T[];
9
11
  export {};
@@ -1,29 +1,49 @@
1
- function c(s, r = (a) => a) {
2
- const a = s.some((o) => !!r(o).priority), n = s.filter((o) => r(o).status !== "REJECTED"), m = s.filter((o) => r(o).status === "REJECTED");
3
- if (a)
1
+ function d(i, s = (D) => D) {
2
+ const D = i.some((a) => !!s(a).priority), c = i.filter((a) => s(a).status !== "REJECTED"), u = i.filter((a) => s(a).status === "REJECTED"), n = (a, o) => {
3
+ const t = s(a), e = s(o);
4
+ if (t.phase && e.phase) {
5
+ const r = { STUDYING: 0, ONBREAK: 1, FINISHED: 2 }, f = r[t.phase], p = r[e.phase];
6
+ if (f !== p)
7
+ return f - p;
8
+ }
9
+ if (t.phase && !e.phase) return -1;
10
+ if (!t.phase && e.phase) return 1;
11
+ if (t.acqDate && e.acqDate) {
12
+ const r = e.acqDate.localeCompare(t.acqDate);
13
+ if (r !== 0) return r;
14
+ }
15
+ if (t.acqDate && !e.acqDate) return -1;
16
+ if (!t.acqDate && e.acqDate) return 1;
17
+ if (t.startDate && e.startDate) {
18
+ const r = e.startDate.localeCompare(t.startDate);
19
+ if (r !== 0) return r;
20
+ }
21
+ if (t.startDate && !e.startDate) return -1;
22
+ if (!t.startDate && e.startDate) return 1;
23
+ if (t.endDate && e.endDate) {
24
+ const r = e.endDate.localeCompare(t.endDate);
25
+ if (r !== 0) return r;
26
+ }
27
+ return t.endDate && !e.endDate ? -1 : !t.endDate && e.endDate ? 1 : e.regDatetime.localeCompare(t.regDatetime);
28
+ };
29
+ if (D) {
30
+ const a = (o, t) => {
31
+ const e = s(o), r = s(t);
32
+ return e.priority !== r.priority ? r.priority - e.priority : n(o, t);
33
+ };
4
34
  return [
5
- ...n.sort((o, i) => {
6
- const t = r(o).priority, e = r(i).priority;
7
- return t === 0 && e === 0 ? r(i).regDatetime.localeCompare(r(o).regDatetime) : t === 0 && e !== 0 ? -1 : t !== 0 && e === 0 ? 1 : e - t;
8
- }),
9
- ...m.sort((o, i) => {
10
- const t = r(o).priority, e = r(i).priority;
11
- return t === 0 && e === 0 ? r(i).regDatetime.localeCompare(r(o).regDatetime) : t === 0 && e !== 0 ? -1 : t !== 0 && e === 0 ? 1 : e - t;
12
- })
35
+ ...c.sort(a),
36
+ ...u.sort(a)
13
37
  ];
14
- {
15
- const o = n.filter((t) => r(t).status === "VERIFIED"), i = n.filter((t) => r(t).status !== "VERIFIED");
38
+ } else {
39
+ const a = c.filter((t) => s(t).status === "VERIFIED"), o = c.filter((t) => s(t).status !== "VERIFIED");
16
40
  return [
17
- ...o.sort((t, e) => r(e).regDatetime.localeCompare(r(t).regDatetime)),
18
- ...i.sort((t, e) => r(e).regDatetime.localeCompare(r(t).regDatetime)),
19
- ...m.sort((t, e) => r(e).regDatetime.localeCompare(r(t).regDatetime))
41
+ ...a.sort(n),
42
+ ...o.sort(n),
43
+ ...u.sort(n)
20
44
  ];
21
45
  }
22
46
  }
23
- function u(s) {
24
- return c(s, (r) => r.props);
25
- }
26
47
  export {
27
- c as default,
28
- u as sortItemElements
48
+ d as default
29
49
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dotss/tictoccroc",
3
3
  "type": "module",
4
- "version": "0.0.18",
4
+ "version": "0.0.19",
5
5
  "description": "Tictoccroc shared components, hooks, utils, and APIs for Dotss",
6
6
  "main": "./dist/index.mjs",
7
7
  "module": "./dist/index.mjs",