cclkit4svelte 2.0.1 → 2.0.3

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/Alert.svelte CHANGED
@@ -46,51 +46,51 @@ function dismissAlert() {
46
46
  </script>
47
47
 
48
48
  <div
49
- class="alert-wrapper"
50
- class:dismissible={dismissible}
51
- class:outline={outline}
52
- style="background-color: var({computedBgColor}); color: {textColor}; border-color: var({computedBorderColor});"
49
+ class="alert-wrapper"
50
+ class:dismissible
51
+ class:outline
52
+ style="background-color: var({computedBgColor}); color: {textColor}; border-color: var({computedBorderColor});"
53
53
  >
54
- <span class="alert-message">{message}</span>
55
- {#if dismissible}
56
- <button class="dismiss-button" on:click={dismissAlert} aria-label="Dismiss alert">
57
- &times;
58
- </button>
59
- {/if}
54
+ <span class="alert-message">{message}</span>
55
+ {#if dismissible}
56
+ <button class="dismiss-button" on:click={dismissAlert} aria-label="Dismiss alert">
57
+ &times;
58
+ </button>
59
+ {/if}
60
60
  </div>
61
61
 
62
62
  <style>
63
- .alert-wrapper {
64
- padding: 12px 20px;
65
- border-radius: 8px;
66
- display: flex;
67
- justify-content: space-between;
68
- align-items: center;
69
- font-size: 16px;
70
- font-weight: 500;
71
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
72
- margin-bottom: 10px; /* Add some spacing when multiple alerts are shown */
73
- border: 2px solid; /* Use solid border, color set by style attribute */
74
- }
63
+ .alert-wrapper {
64
+ padding: 12px 20px;
65
+ border-radius: 8px;
66
+ display: flex;
67
+ justify-content: space-between;
68
+ align-items: center;
69
+ font-size: 16px;
70
+ font-weight: 500;
71
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
72
+ margin-bottom: 10px; /* Add some spacing when multiple alerts are shown */
73
+ border: 2px solid; /* Use solid border, color set by style attribute */
74
+ }
75
75
 
76
- .alert-message {
77
- flex-grow: 1;
78
- }
76
+ .alert-message {
77
+ flex-grow: 1;
78
+ }
79
79
 
80
- .dismiss-button {
81
- background: none;
82
- border: none;
83
- color: inherit; /* Inherit text color from parent */
84
- font-size: 20px;
85
- cursor: pointer;
86
- margin-left: 15px;
87
- padding: 0;
88
- line-height: 1;
89
- opacity: 0.7;
90
- transition: opacity 0.2s ease-in-out;
91
- }
80
+ .dismiss-button {
81
+ background: none;
82
+ border: none;
83
+ color: inherit; /* Inherit text color from parent */
84
+ font-size: 20px;
85
+ cursor: pointer;
86
+ margin-left: 15px;
87
+ padding: 0;
88
+ line-height: 1;
89
+ opacity: 0.7;
90
+ transition: opacity 0.2s ease-in-out;
91
+ }
92
92
 
93
- .dismiss-button:hover {
94
- opacity: 1;
95
- }
96
- </style>
93
+ .dismiss-button:hover {
94
+ opacity: 1;
95
+ }
96
+ </style>
@@ -39,4 +39,4 @@ let buttonColor = getButtonColor(bgColor);
39
39
  font-size: 18px;
40
40
  line-height: normal;
41
41
  }
42
- </style>
42
+ </style>
package/dist/Card.svelte CHANGED
@@ -86,4 +86,4 @@ $: bodyColor = getBodyColor(borderColor);
86
86
  text-overflow: ellipsis;
87
87
  overflow: hidden;
88
88
  }
89
- </style>
89
+ </style>
@@ -1,3 +1,5 @@
1
+ <script context="module"></script>
2
+
1
3
  <script>import "./const/variables.css";
2
4
  export let src;
3
5
  export let csWidth;
@@ -12,7 +14,10 @@ const prevSlide = () => {
12
14
  };
13
15
  </script>
14
16
 
15
- <div class="carouselWrapper" style="--carousel-width: {csWidth}; --translate-x: calc(-{currentIndex} * 100%)">
17
+ <div
18
+ class="carouselWrapper"
19
+ style="--carousel-width: {csWidth}; --translate-x: calc(-{currentIndex} * 100%)"
20
+ >
16
21
  <div class="slides">
17
22
  {#each src as item, index}
18
23
  <img class="slide" src={item.src} alt={item.alt} />
@@ -68,4 +73,4 @@ const prevSlide = () => {
68
73
  justify-content: center;
69
74
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
70
75
  }
71
- </style>
76
+ </style>
@@ -1,4 +1,8 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
+ export interface Imgsrc {
3
+ src: string;
4
+ alt: string;
5
+ }
2
6
  import './const/variables.css';
3
7
  declare const __propDef: {
4
8
  props: {
@@ -0,0 +1,157 @@
1
+ <script>import "./const/variables.css";
2
+ import { CCLVividColor, CCLPastelColor } from "./const/config";
3
+ export let historyItems = [];
4
+ export let height = void 0;
5
+ export let defaultColor = CCLVividColor.SODA_BLUE;
6
+ const vividToPastelMap = {
7
+ [CCLVividColor.STRAWBERRY_PINK]: CCLPastelColor.PEACH_PINK,
8
+ [CCLVividColor.PINEAPPLE_YELLOW]: CCLPastelColor.LEMON_YELLOW,
9
+ [CCLVividColor.SODA_BLUE]: CCLPastelColor.SUGAR_BLUE,
10
+ [CCLVividColor.MELON_GREEN]: CCLPastelColor.MATCHA_GREEN,
11
+ [CCLVividColor.GRAPE_PURPLE]: CCLPastelColor.AKEBI_PURPLE,
12
+ [CCLVividColor.WRAP_GREY]: CCLPastelColor.CLOUD_GREY
13
+ };
14
+ $: defaultPastelColor = vividToPastelMap[defaultColor] || CCLPastelColor.SUGAR_BLUE;
15
+ </script>
16
+
17
+ <div class="change-history-container" style={height ? `height: ${height};` : ''}>
18
+ <ul class="timeline">
19
+ {#each historyItems as item (item.date + item.title)}
20
+ <li
21
+ class="timeline-item"
22
+ style:--marker-color="var({item.color || defaultColor})"
23
+ style:--tag-color="var({item.color || defaultColor})"
24
+ style:--tag-bg-color="var({vividToPastelMap[item.color || defaultColor] || defaultPastelColor})"
25
+ >
26
+ <div class="timeline-marker"></div>
27
+ <div class="timeline-content">
28
+ <div class="header">
29
+ <time class="date" datetime={item.date}>{item.date}</time>
30
+ {#if item.tag}
31
+ <span class="tag">{item.tag}</span>
32
+ {/if}
33
+ {#if item.version}
34
+ <span class="version">{item.version}</span>
35
+ {/if}
36
+ </div>
37
+ <h3 class="title">{item.title}</h3>
38
+ {#if item.details && item.details.length > 0}
39
+ <ul class="details">
40
+ {#each item.details as detail}
41
+ <li>{detail}</li>
42
+ {/each}
43
+ </ul>
44
+ {/if}
45
+ </div>
46
+ </li>
47
+ {/each}
48
+ </ul>
49
+ </div>
50
+
51
+ <style>
52
+ .change-history-container {
53
+ font-family: sans-serif;
54
+ max-width: 800px;
55
+ margin: 0 auto;
56
+ padding: 20px;
57
+ overflow-y: auto;
58
+ }
59
+
60
+ .timeline {
61
+ list-style-type: none;
62
+ padding-left: 20px;
63
+ position: relative;
64
+ }
65
+
66
+ /* タイムラインの縦線 */
67
+ .timeline::before {
68
+ content: '';
69
+ position: absolute;
70
+ top: 5px;
71
+ left: 5px;
72
+ height: calc(100% - 5px);
73
+ width: 2px;
74
+ background-color: #dee2e6;
75
+ }
76
+
77
+ .timeline-item {
78
+ position: relative;
79
+ margin-bottom: 30px;
80
+ padding-left: 35px;
81
+ }
82
+
83
+ .timeline-item:last-child {
84
+ margin-bottom: 0;
85
+ }
86
+
87
+ .timeline-marker {
88
+ position: absolute;
89
+ top: 5px;
90
+ left: -2px;
91
+ width: 16px;
92
+ height: 16px;
93
+ border-radius: 50%;
94
+ background-color: var(--marker-color);
95
+ border: 3px solid #fff;
96
+ z-index: 1;
97
+ }
98
+
99
+ .timeline-content {
100
+ background-color: #ffffff;
101
+ padding: 15px 20px;
102
+ border-radius: 6px;
103
+ border: 1px solid #dee2e6;
104
+ }
105
+
106
+ .header {
107
+ display: flex;
108
+ align-items: center;
109
+ gap: 12px;
110
+ margin-bottom: 8px;
111
+ }
112
+
113
+ .date {
114
+ font-weight: bold;
115
+ color: #343a40;
116
+ }
117
+
118
+ .tag {
119
+ background-color: var(--tag-bg-color);
120
+ color: var(--tag-color);
121
+ padding: 3px 10px;
122
+ border-radius: 12px;
123
+ font-size: 0.85em;
124
+ font-weight: 600;
125
+ }
126
+
127
+ .version {
128
+ background-color: #f1f3f5; /* ニュートラルなグレー */
129
+ color: #495057;
130
+ padding: 3px 10px;
131
+ border-radius: 12px;
132
+ font-size: 0.85em;
133
+ font-weight: 600;
134
+ }
135
+
136
+ .title {
137
+ margin: 0 0 12px 0;
138
+ font-size: 1.15em;
139
+ font-weight: 600;
140
+ color: #212529;
141
+ }
142
+
143
+ .details {
144
+ list-style-type: disc;
145
+ padding-left: 20px;
146
+ margin: 0;
147
+ color: #495057;
148
+ line-height: 1.6;
149
+ }
150
+
151
+ .details li {
152
+ margin-bottom: 5px;
153
+ }
154
+ .details li:last-child {
155
+ margin-bottom: 0;
156
+ }
157
+ </style>
@@ -0,0 +1,28 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import './const/variables.css';
3
+ declare const __propDef: {
4
+ props: {
5
+ /**
6
+ * 表示する更新履歴の配列
7
+ * @type {HistoryItem[]}
8
+ */ historyItems?: HistoryItem[];
9
+ /**
10
+ * コンポーネントの高さ。'400px'や'50vh'のようにCSSの値を指定します。
11
+ * @type {string | undefined}
12
+ */ height?: string | undefined;
13
+ /**
14
+ * アイテムに色が指定されていない場合のデフォルトカラー。`CCLVividColor`の値を指定します。
15
+ * @type {string}
16
+ */ defaultColor?: string;
17
+ };
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
22
+ };
23
+ export type ChangeHistoryProps = typeof __propDef.props;
24
+ export type ChangeHistoryEvents = typeof __propDef.events;
25
+ export type ChangeHistorySlots = typeof __propDef.slots;
26
+ export default class ChangeHistory extends SvelteComponentTyped<ChangeHistoryProps, ChangeHistoryEvents, ChangeHistorySlots> {
27
+ }
28
+ export {};
@@ -6,7 +6,7 @@ export let color = CCLVividColor.SODA_BLUE;
6
6
  export let disabled = false;
7
7
  export let onChange = () => {
8
8
  };
9
- let checkMarkColor = "white";
9
+ const checkMarkColor = "white";
10
10
  function handleChange(event) {
11
11
  if (disabled) {
12
12
  return;
@@ -17,9 +17,19 @@ function handleChange(event) {
17
17
  }
18
18
  </script>
19
19
 
20
- <label class="checkboxWrapper" class:disabled={disabled}>
21
- <input type="checkbox" bind:checked on:change={handleChange} {disabled} aria-label={label} name={label} />
22
- <span class="customCheckbox" style="--bg-color: var({color}); --check-mark-color: {checkMarkColor};">
20
+ <label class="checkboxWrapper" class:disabled>
21
+ <input
22
+ type="checkbox"
23
+ bind:checked
24
+ on:change={handleChange}
25
+ {disabled}
26
+ aria-label={label}
27
+ name={label}
28
+ />
29
+ <span
30
+ class="customCheckbox"
31
+ style="--bg-color: var({color}); --check-mark-color: {checkMarkColor};"
32
+ >
23
33
  {#if checked}
24
34
  <svg
25
35
  class="checkMark"
@@ -3,13 +3,16 @@ export let bgColor;
3
3
  export let height;
4
4
  export let logo;
5
5
  export let logoHeight;
6
+ export let href;
6
7
  </script>
7
8
 
8
9
  <!--汎用ヘッダー-->
9
10
  <header>
10
11
  <div class="wrapper" style="--bgColor: var({bgColor}); --height: var({height})">
11
12
  {#if logo}
12
- <img style="height: {logoHeight}" src={logo} alt="SVG Image" />
13
+ <a {href}>
14
+ <img style="height: {logoHeight}" src={logo} alt="SVG Image" />
15
+ </a>
13
16
  {:else}
14
17
  <p>SVGファイルが指定されていません</p>
15
18
  {/if}
@@ -23,6 +23,10 @@ declare const __propDef: {
23
23
  * ロゴの高さ
24
24
  * @type string
25
25
  */ logoHeight: string;
26
+ /**
27
+ * ロゴのリンク先
28
+ * @type string
29
+ */ href: string;
26
30
  };
27
31
  events: {
28
32
  [evt: string]: CustomEvent<any>;
@@ -6,18 +6,20 @@ export let selectedDate = null;
6
6
  export let placeholder = "\u65E5\u4ED8\u3092\u9078\u629E";
7
7
  export let id = "date-picker-" + Math.random().toString(36).substring(2, 9);
8
8
  export let borderColor = "--strawberry-pink";
9
- export let disableBlurClose = false;
10
9
  let showCalendar = false;
11
10
  let currentMonth = selectedDate ? DateTime.fromJSDate(selectedDate) : DateTime.local();
12
11
  $: formattedDate = selectedDate ? DateTime.fromJSDate(selectedDate).toFormat("yyyy/MM/dd") : "";
13
- function toggleCalendar() {
14
- showCalendar = !showCalendar;
12
+ function openCalendar() {
13
+ showCalendar = true;
14
+ }
15
+ function closeCalendar() {
16
+ showCalendar = false;
15
17
  }
16
18
  function selectDay(day) {
17
19
  const newDate = currentMonth.set({ day }).toJSDate();
18
20
  selectedDate = newDate;
19
21
  dispatch("change", newDate);
20
- showCalendar = false;
22
+ closeCalendar();
21
23
  }
22
24
  function prevMonth() {
23
25
  currentMonth = currentMonth.minus({ months: 1 });
@@ -29,27 +31,59 @@ function getDaysInMonth(date) {
29
31
  const startOfMonth = date.startOf("month");
30
32
  const endOfMonth = date.endOf("month");
31
33
  const days = [];
32
- const startDayOfWeek = startOfMonth.weekday === 7 ? 0 : startOfMonth.weekday;
34
+ const startDayOfWeek = startOfMonth.weekday % 7;
33
35
  for (let i = 0; i < startDayOfWeek; i++) {
34
36
  days.push(null);
35
37
  }
36
38
  for (let i = 1; i <= endOfMonth.day; i++) {
37
39
  days.push(i);
38
40
  }
39
- const remainingDays = 42 - days.length;
40
- for (let i = 0; i < remainingDays; i++) {
41
+ while (days.length < 42) {
41
42
  days.push(null);
42
43
  }
43
44
  return days;
44
45
  }
46
+ function clickOutside(node) {
47
+ const handleClick = (event) => {
48
+ if (node && !node.contains(event.target) && !event.defaultPrevented) {
49
+ node.dispatchEvent(new CustomEvent("click_outside"));
50
+ }
51
+ };
52
+ document.addEventListener("click", handleClick, true);
53
+ return {
54
+ destroy() {
55
+ document.removeEventListener("click", handleClick, true);
56
+ }
57
+ };
58
+ }
45
59
  $: daysInMonth = getDaysInMonth(currentMonth);
46
60
  </script>
47
61
 
48
- <div class="datePickerWrapper" style="--selected-color: var({borderColor});">
49
- <input type="text" {id} value={formattedDate} placeholder={placeholder} on:focus={toggleCalendar} on:blur={() => { if (!disableBlurClose) toggleCalendar(); }} readonly style="border-color: var({borderColor});" />
62
+ <!--
63
+ - `use:clickOutside` でアクションを適用
64
+ - `on:click_outside` で外側クリック時の動作を定義
65
+ -->
66
+ <div
67
+ class="datePickerWrapper"
68
+ style="--selected-color: var({borderColor});"
69
+ use:clickOutside
70
+ on:click_outside={closeCalendar}
71
+ >
72
+ <input
73
+ type="text"
74
+ {id}
75
+ value={formattedDate}
76
+ {placeholder}
77
+ on:focus={openCalendar}
78
+ readonly
79
+ style="border-color: var({borderColor});"
80
+ />
50
81
 
51
82
  {#if showCalendar}
52
- <div class="calendarOverlay" on:mousedown|preventDefault={() => {}}>
83
+ <!--
84
+ - カレンダー内のクリックが外側クリックと誤認されないようにイベントの伝播を止める
85
+ -->
86
+ <div class="calendarOverlay" on:click|stopPropagation>
53
87
  <div class="calendarHeader">
54
88
  <button on:click={prevMonth} aria-label="前月へ">&lt;</button>
55
89
  <span>{currentMonth.toFormat('yyyy年MM月')}</span>
@@ -67,10 +101,13 @@ $: daysInMonth = getDaysInMonth(currentMonth);
67
101
  <div class="daysGrid">
68
102
  {#each daysInMonth as day}
69
103
  <button
70
- class:currentMonthDay={day !== null}
71
- class:selected={selectedDate && day === DateTime.fromJSDate(selectedDate).day && currentMonth.month === DateTime.fromJSDate(selectedDate).month && currentMonth.year === DateTime.fromJSDate(selectedDate).year}
72
- on:click={() => day && selectDay(day)}
73
- disabled={day === null}
104
+ class:currentMonthDay={day !== null}
105
+ class:selected={selectedDate &&
106
+ day === DateTime.fromJSDate(selectedDate).day &&
107
+ currentMonth.month === DateTime.fromJSDate(selectedDate).month &&
108
+ currentMonth.year === DateTime.fromJSDate(selectedDate).year}
109
+ on:click={() => day && selectDay(day)}
110
+ disabled={day === null}
74
111
  >
75
112
  {day !== null ? day : ''}
76
113
  </button>
@@ -81,6 +118,7 @@ $: daysInMonth = getDaysInMonth(currentMonth);
81
118
  </div>
82
119
 
83
120
  <style>
121
+ /* スタイルは変更なし */
84
122
  .datePickerWrapper {
85
123
  position: relative;
86
124
  display: inline-block;
@@ -91,6 +129,11 @@ $: daysInMonth = getDaysInMonth(currentMonth);
91
129
  border: 1px solid #ccc;
92
130
  border-radius: 4px;
93
131
  width: 120px;
132
+ cursor: pointer; /* クリックできることを示す */
133
+ }
134
+
135
+ .datePickerWrapper input:focus {
136
+ outline: none;
94
137
  }
95
138
 
96
139
  .calendarOverlay {
@@ -159,4 +202,4 @@ $: daysInMonth = getDaysInMonth(currentMonth);
159
202
  color: #ccc;
160
203
  cursor: default;
161
204
  }
162
- </style>
205
+ </style>
@@ -22,14 +22,9 @@ declare const __propDef: {
22
22
  * @default --strawberry-pink
23
23
  * @type string
24
24
  */ borderColor?: string;
25
- /**
26
- * blurイベントでカレンダーを閉じないようにするか
27
- * テスト用途で利用
28
- * @default false
29
- * @type boolean
30
- */ disableBlurClose?: boolean;
31
25
  };
32
26
  events: {
27
+ click: MouseEvent;
33
28
  change: CustomEvent<any>;
34
29
  } & {
35
30
  [evt: string]: CustomEvent<any>;
@@ -22,4 +22,4 @@ const year = getYear();
22
22
  color: #fff;
23
23
  font-size: 9px;
24
24
  }
25
- </style>
25
+ </style>